@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.
- package/CHANGELOG.md +30 -0
- package/LICENSE +25 -0
- package/NOTICE.md +158 -0
- package/README.md +5294 -2
- package/VanzxyBanner.js +134 -0
- package/WAProto/index.d.ts +13317 -0
- package/WAProto/index.js +147553 -0
- package/lib/Builders/A2UI.d.ts +131 -0
- package/lib/Builders/A2UI.js +343 -0
- package/lib/Builders/AIRich.d.ts +1021 -0
- package/lib/Builders/AIRich.js +2889 -0
- package/lib/Builders/Album.d.ts +51 -0
- package/lib/Builders/Album.js +99 -0
- package/lib/Builders/Button.d.ts +137449 -0
- package/lib/Builders/Button.js +1054 -0
- package/lib/Builders/ButtonV2.d.ts +43 -0
- package/lib/Builders/ButtonV2.js +175 -0
- package/lib/Builders/ButtonV3.d.ts +35 -0
- package/lib/Builders/ButtonV3.js +189 -0
- package/lib/Builders/Carousel.d.ts +68 -0
- package/lib/Builders/Carousel.js +161 -0
- package/lib/Builders/Event.d.ts +61 -0
- package/lib/Builders/Event.js +118 -0
- package/lib/Builders/Expiring.d.ts +17 -0
- package/lib/Builders/Expiring.js +27 -0
- package/lib/Builders/Poll.d.ts +63 -0
- package/lib/Builders/Poll.js +139 -0
- package/lib/Builders/VanzxyBaileys.d.ts +42 -0
- package/lib/Builders/VanzxyBaileys.js +110 -0
- package/lib/Builders/errors.d.ts +25 -0
- package/lib/Builders/errors.js +29 -0
- package/lib/Builders/index.d.ts +14 -0
- package/lib/Builders/index.js +23 -0
- package/lib/Builders/shared.d.ts +395 -0
- package/lib/Builders/shared.js +738 -0
- package/lib/Defaults/bot-jid.d.ts +1 -0
- package/lib/Defaults/bot-jid.js +1 -0
- package/lib/Defaults/index.d.ts +161 -0
- package/lib/Defaults/index.js +165 -0
- package/lib/Defaults/version.d.ts +1 -0
- package/lib/Defaults/version.js +1 -0
- package/lib/Framework/Bot.d.ts +865 -0
- package/lib/Framework/Bot.js +230 -0
- package/lib/Framework/Context.d.ts +17 -0
- package/lib/Framework/Context.js +90 -0
- package/lib/Framework/MediaManager.d.ts +15 -0
- package/lib/Framework/MediaManager.js +154 -0
- package/lib/Framework/SessionManager.d.ts +10 -0
- package/lib/Framework/SessionManager.js +34 -0
- package/lib/Framework/StatsManager.d.ts +20 -0
- package/lib/Framework/StatsManager.js +117 -0
- package/lib/Framework/Store/SQLiteStore.d.ts +13 -0
- package/lib/Framework/Store/SQLiteStore.js +68 -0
- package/lib/Framework/index.d.ts +6 -0
- package/lib/Framework/index.js +11 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
- package/lib/Signal/Group/ciphertext-message.js +11 -0
- package/lib/Signal/Group/group-session-builder.d.ts +7 -0
- package/lib/Signal/Group/group-session-builder.js +29 -0
- package/lib/Signal/Group/group_cipher.d.ts +10 -0
- package/lib/Signal/Group/group_cipher.js +81 -0
- package/lib/Signal/Group/index.d.ts +11 -0
- package/lib/Signal/Group/index.js +11 -0
- package/lib/Signal/Group/keyhelper.d.ts +6 -0
- package/lib/Signal/Group/keyhelper.js +17 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
- package/lib/Signal/Group/sender-chain-key.js +25 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +62 -0
- package/lib/Signal/Group/sender-key-message.d.ts +18 -0
- package/lib/Signal/Group/sender-key-message.js +65 -0
- package/lib/Signal/Group/sender-key-name.d.ts +11 -0
- package/lib/Signal/Group/sender-key-name.js +47 -0
- package/lib/Signal/Group/sender-key-record.d.ts +12 -0
- package/lib/Signal/Group/sender-key-record.js +40 -0
- package/lib/Signal/Group/sender-key-state.d.ts +16 -0
- package/lib/Signal/Group/sender-key-state.js +83 -0
- package/lib/Signal/Group/sender-message-key.d.ts +11 -0
- package/lib/Signal/Group/sender-message-key.js +25 -0
- package/lib/Signal/libsignal.d.ts +58 -0
- package/lib/Signal/libsignal.js +436 -0
- package/lib/Signal/lid-mapping.d.ts +20 -0
- package/lib/Signal/lid-mapping.js +276 -0
- package/lib/Socket/Client/index.d.ts +2 -0
- package/lib/Socket/Client/index.js +2 -0
- package/lib/Socket/Client/types.d.ts +5 -0
- package/lib/Socket/Client/types.js +10 -0
- package/lib/Socket/Client/websocket.d.ts +12 -0
- package/lib/Socket/Client/websocket.js +53 -0
- package/lib/Socket/business.d.ts +674 -0
- package/lib/Socket/business.js +379 -0
- package/lib/Socket/chats.d.ts +137 -0
- package/lib/Socket/chats.js +1299 -0
- package/lib/Socket/communities.d.ts +805 -0
- package/lib/Socket/communities.js +454 -0
- package/lib/Socket/dugong.d.ts +118 -0
- package/lib/Socket/dugong.js +810 -0
- package/lib/Socket/groups.d.ts +287 -0
- package/lib/Socket/groups.js +386 -0
- package/lib/Socket/index.d.ts +826 -0
- package/lib/Socket/index.js +35 -0
- package/lib/Socket/messages-recv.d.ts +613 -0
- package/lib/Socket/messages-recv.js +1851 -0
- package/lib/Socket/messages-send.d.ts +608 -0
- package/lib/Socket/messages-send.js +1574 -0
- package/lib/Socket/mex-fallback.d.ts +51 -0
- package/lib/Socket/mex-fallback.js +97 -0
- package/lib/Socket/mex.d.ts +1 -0
- package/lib/Socket/mex.js +41 -0
- package/lib/Socket/newsletter-ext.d.ts +47 -0
- package/lib/Socket/newsletter-ext.js +262 -0
- package/lib/Socket/newsletter.d.ts +285 -0
- package/lib/Socket/newsletter.js +223 -0
- package/lib/Socket/socket.d.ts +60 -0
- package/lib/Socket/socket.js +1001 -0
- package/lib/Socket/username.d.ts +842 -0
- package/lib/Socket/username.js +156 -0
- package/lib/Store/index.d.ts +3 -0
- package/lib/Store/index.js +3 -0
- package/lib/Store/make-in-memory-store.d.ts +62 -0
- package/lib/Store/make-in-memory-store.js +425 -0
- package/lib/Store/make-ordered-dictionary.d.ts +12 -0
- package/lib/Store/make-ordered-dictionary.js +78 -0
- package/lib/Store/object-repository.d.ts +10 -0
- package/lib/Store/object-repository.js +23 -0
- package/lib/Types/Auth.d.ts +1 -0
- package/lib/Types/Auth.js +1 -0
- package/lib/Types/Bussines.d.ts +1 -0
- package/lib/Types/Bussines.js +1 -0
- package/lib/Types/Call.d.ts +1 -0
- package/lib/Types/Call.js +1 -0
- package/lib/Types/Chat.d.ts +1 -0
- package/lib/Types/Chat.js +7 -0
- package/lib/Types/Contact.d.ts +1 -0
- package/lib/Types/Contact.js +1 -0
- package/lib/Types/Events.d.ts +1 -0
- package/lib/Types/Events.js +1 -0
- package/lib/Types/GroupMetadata.d.ts +1 -0
- package/lib/Types/GroupMetadata.js +1 -0
- package/lib/Types/Label.d.ts +2 -0
- package/lib/Types/Label.js +24 -0
- package/lib/Types/LabelAssociation.d.ts +2 -0
- package/lib/Types/LabelAssociation.js +6 -0
- package/lib/Types/Message.d.ts +11 -0
- package/lib/Types/Message.js +17 -0
- package/lib/Types/Mex.d.ts +2 -0
- package/lib/Types/Mex.js +38 -0
- package/lib/Types/Product.d.ts +1 -0
- package/lib/Types/Product.js +1 -0
- package/lib/Types/RichType.d.ts +2 -0
- package/lib/Types/RichType.js +22 -0
- package/lib/Types/Signal.d.ts +1 -0
- package/lib/Types/Signal.js +1 -0
- package/lib/Types/Socket.d.ts +1 -0
- package/lib/Types/Socket.js +1 -0
- package/lib/Types/State.d.ts +5 -0
- package/lib/Types/State.js +55 -0
- package/lib/Types/USync.d.ts +1 -0
- package/lib/Types/USync.js +1 -0
- package/lib/Types/index.d.ts +15 -0
- package/lib/Types/index.js +27 -0
- package/lib/Utils/PersistentStore.d.ts +83 -0
- package/lib/Utils/PersistentStore.js +592 -0
- package/lib/Utils/anchor-guard.d.ts +31 -0
- package/lib/Utils/anchor-guard.js +329 -0
- package/lib/Utils/android-stanza-id.d.ts +4 -0
- package/lib/Utils/android-stanza-id.js +21 -0
- package/lib/Utils/anti-delete.d.ts +62 -0
- package/lib/Utils/anti-delete.js +212 -0
- package/lib/Utils/auth-secure.d.ts +180 -0
- package/lib/Utils/auth-secure.js +791 -0
- package/lib/Utils/auth-utils.d.ts +59 -0
- package/lib/Utils/auth-utils.js +326 -0
- package/lib/Utils/auto-reconnect.d.ts +8 -0
- package/lib/Utils/auto-reconnect.js +204 -0
- package/lib/Utils/auto-reply.d.ts +35 -0
- package/lib/Utils/auto-reply.js +152 -0
- package/lib/Utils/bad-mac-handler.d.ts +59 -0
- package/lib/Utils/bad-mac-handler.js +119 -0
- package/lib/Utils/baileys-event-stream.d.ts +5 -0
- package/lib/Utils/baileys-event-stream.js +62 -0
- package/lib/Utils/browser-utils.d.ts +9 -0
- package/lib/Utils/browser-utils.js +29 -0
- package/lib/Utils/business.d.ts +49 -0
- package/lib/Utils/business.js +236 -0
- package/lib/Utils/button-helper-utils.d.ts +59 -0
- package/lib/Utils/button-helper-utils.js +266 -0
- package/lib/Utils/button-sender.d.ts +164 -0
- package/lib/Utils/button-sender.js +845 -0
- package/lib/Utils/chat-control.d.ts +98 -0
- package/lib/Utils/chat-control.js +231 -0
- package/lib/Utils/chat-history-helpers.d.ts +4 -0
- package/lib/Utils/chat-history-helpers.js +70 -0
- package/lib/Utils/chat-utils.d.ts +408 -0
- package/lib/Utils/chat-utils.js +879 -0
- package/lib/Utils/companion-reg-client-utils.d.ts +4 -0
- package/lib/Utils/companion-reg-client-utils.js +39 -0
- package/lib/Utils/connection-watchdog.d.ts +10 -0
- package/lib/Utils/connection-watchdog.js +74 -0
- package/lib/Utils/crypto.d.ts +41 -0
- package/lib/Utils/crypto.js +145 -0
- package/lib/Utils/decode-wa-message.d.ts +83 -0
- package/lib/Utils/decode-wa-message.js +315 -0
- package/lib/Utils/disconnect-reason.d.ts +13 -0
- package/lib/Utils/disconnect-reason.js +36 -0
- package/lib/Utils/event-buffer.d.ts +12 -0
- package/lib/Utils/event-buffer.js +640 -0
- package/lib/Utils/fetch-timeout.d.ts +4 -0
- package/lib/Utils/fetch-timeout.js +14 -0
- package/lib/Utils/ffmpeg-path.d.ts +5 -0
- package/lib/Utils/ffmpeg-path.js +130 -0
- package/lib/Utils/generics.d.ts +79 -0
- package/lib/Utils/generics.js +426 -0
- package/lib/Utils/group-metadata-cache.d.ts +3 -0
- package/lib/Utils/group-metadata-cache.js +25 -0
- package/lib/Utils/group-status-detection.d.ts +5 -0
- package/lib/Utils/group-status-detection.js +114 -0
- package/lib/Utils/history.d.ts +91 -0
- package/lib/Utils/history.js +144 -0
- package/lib/Utils/html-app.d.ts +14 -0
- package/lib/Utils/html-app.js +97 -0
- package/lib/Utils/html-multiplayer.d.ts +8 -0
- package/lib/Utils/html-multiplayer.js +90 -0
- package/lib/Utils/humanizer.d.ts +8 -0
- package/lib/Utils/humanizer.js +74 -0
- package/lib/Utils/identity-change-handler.d.ts +13 -0
- package/lib/Utils/identity-change-handler.js +49 -0
- package/lib/Utils/index.d.ts +88 -0
- package/lib/Utils/index.js +93 -0
- package/lib/Utils/jid-tools.d.ts +3 -0
- package/lib/Utils/jid-tools.js +78 -0
- package/lib/Utils/link-preview-metadata.d.ts +47 -0
- package/lib/Utils/link-preview-metadata.js +90 -0
- package/lib/Utils/link-preview.d.ts +12 -0
- package/lib/Utils/link-preview.js +84 -0
- package/lib/Utils/lock-manager.d.ts +5 -0
- package/lib/Utils/lock-manager.js +50 -0
- package/lib/Utils/logger.d.ts +2 -0
- package/lib/Utils/logger.js +2 -0
- package/lib/Utils/lt-hash.d.ts +12 -0
- package/lib/Utils/lt-hash.js +26 -0
- package/lib/Utils/make-mutex.d.ts +6 -0
- package/lib/Utils/make-mutex.js +32 -0
- package/lib/Utils/media-messages.d.ts +35 -0
- package/lib/Utils/media-messages.js +70 -0
- package/lib/Utils/media-processor.d.ts +6 -0
- package/lib/Utils/media-processor.js +174 -0
- package/lib/Utils/media-set.d.ts +6 -0
- package/lib/Utils/media-set.js +169 -0
- package/lib/Utils/message-kind.d.ts +26 -0
- package/lib/Utils/message-kind.js +138 -0
- package/lib/Utils/message-retry-manager.d.ts +79 -0
- package/lib/Utils/message-retry-manager.js +264 -0
- package/lib/Utils/message-search.d.ts +40 -0
- package/lib/Utils/message-search.js +181 -0
- package/lib/Utils/messages-media.d.ts +136 -0
- package/lib/Utils/messages-media.js +867 -0
- package/lib/Utils/messages.d.ts +66 -0
- package/lib/Utils/messages.js +2271 -0
- package/lib/Utils/meta-ai-msmsg.d.ts +3 -0
- package/lib/Utils/meta-ai-msmsg.js +132 -0
- package/lib/Utils/meta-ai.d.ts +4 -0
- package/lib/Utils/meta-ai.js +75 -0
- package/lib/Utils/migrate-auth-state.d.ts +23 -0
- package/lib/Utils/migrate-auth-state.js +126 -0
- package/lib/Utils/mini-app.d.ts +20 -0
- package/lib/Utils/mini-app.js +215 -0
- package/lib/Utils/mock-socket.d.ts +67 -0
- package/lib/Utils/mock-socket.js +254 -0
- package/lib/Utils/modern-messages.d.ts +64 -0
- package/lib/Utils/modern-messages.js +497 -0
- package/lib/Utils/native-flow.d.ts +19 -0
- package/lib/Utils/native-flow.js +112 -0
- package/lib/Utils/newsletter-status.d.ts +157 -0
- package/lib/Utils/newsletter-status.js +652 -0
- package/lib/Utils/noise-handler.d.ts +20 -0
- package/lib/Utils/noise-handler.js +200 -0
- package/lib/Utils/offline-node-processor.d.ts +9 -0
- package/lib/Utils/offline-node-processor.js +39 -0
- package/lib/Utils/pairing-utils.d.ts +5 -0
- package/lib/Utils/pairing-utils.js +29 -0
- package/lib/Utils/passkey.d.ts +4 -0
- package/lib/Utils/passkey.js +11 -0
- package/lib/Utils/past-participants.d.ts +2 -0
- package/lib/Utils/past-participants.js +40 -0
- package/lib/Utils/payment-detection.d.ts +40 -0
- package/lib/Utils/payment-detection.js +213 -0
- package/lib/Utils/payment-guard.d.ts +28 -0
- package/lib/Utils/payment-guard.js +143 -0
- package/lib/Utils/payment-messages.d.ts +42 -0
- package/lib/Utils/payment-messages.js +161 -0
- package/lib/Utils/payment-utils.d.ts +75 -0
- package/lib/Utils/payment-utils.js +145 -0
- package/lib/Utils/phone-utils.d.ts +3 -0
- package/lib/Utils/phone-utils.js +29 -0
- package/lib/Utils/pre-key-manager.d.ts +25 -0
- package/lib/Utils/pre-key-manager.js +105 -0
- package/lib/Utils/process-message.d.ts +103 -0
- package/lib/Utils/process-message.js +868 -0
- package/lib/Utils/qr-terminal.d.ts +1 -0
- package/lib/Utils/qr-terminal.js +16 -0
- package/lib/Utils/reconnect-backoff.d.ts +25 -0
- package/lib/Utils/reconnect-backoff.js +47 -0
- package/lib/Utils/reporting-utils.d.ts +12 -0
- package/lib/Utils/reporting-utils.js +257 -0
- package/lib/Utils/rich-message-utils.d.ts +54 -0
- package/lib/Utils/rich-message-utils.js +435 -0
- package/lib/Utils/rich-messages.d.ts +298 -0
- package/lib/Utils/rich-messages.js +1145 -0
- package/lib/Utils/scheduled-message.d.ts +81 -0
- package/lib/Utils/scheduled-message.js +101 -0
- package/lib/Utils/scheduling.d.ts +59 -0
- package/lib/Utils/scheduling.js +139 -0
- package/lib/Utils/signal.d.ts +82 -0
- package/lib/Utils/signal.js +200 -0
- package/lib/Utils/stanza-ack.d.ts +16 -0
- package/lib/Utils/stanza-ack.js +37 -0
- package/lib/Utils/status-stickers.d.ts +79 -0
- package/lib/Utils/status-stickers.js +261 -0
- package/lib/Utils/status.d.ts +107 -0
- package/lib/Utils/status.js +131 -0
- package/lib/Utils/sticker-pack-maker.d.ts +20 -0
- package/lib/Utils/sticker-pack-maker.js +112 -0
- package/lib/Utils/stickerpack.d.ts +18 -0
- package/lib/Utils/stickerpack.js +316 -0
- package/lib/Utils/sync-action-utils.d.ts +2 -0
- package/lib/Utils/sync-action-utils.js +48 -0
- package/lib/Utils/tag.d.ts +8 -0
- package/lib/Utils/tag.js +45 -0
- package/lib/Utils/tc-token-utils.d.ts +29 -0
- package/lib/Utils/tc-token-utils.js +162 -0
- package/lib/Utils/templates.d.ts +86 -0
- package/lib/Utils/templates.js +148 -0
- package/lib/Utils/text-format.d.ts +13 -0
- package/lib/Utils/text-format.js +81 -0
- package/lib/Utils/text-tools.d.ts +3 -0
- package/lib/Utils/text-tools.js +38 -0
- package/lib/Utils/ttl-cache.d.ts +29 -0
- package/lib/Utils/ttl-cache.js +123 -0
- package/lib/Utils/use-cache-manager-auth-state.d.ts +22 -0
- package/lib/Utils/use-cache-manager-auth-state.js +86 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +20 -0
- package/lib/Utils/use-multi-file-auth-state.js +201 -0
- package/lib/Utils/use-single-file-auth-state.d.ts +10 -0
- package/lib/Utils/use-single-file-auth-state.js +111 -0
- package/lib/Utils/use-sqlite-auth-state.d.ts +13 -0
- package/lib/Utils/use-sqlite-auth-state.js +171 -0
- package/lib/Utils/username.d.ts +22 -0
- package/lib/Utils/username.js +59 -0
- package/lib/Utils/validate-connection.d.ts +43 -0
- package/lib/Utils/validate-connection.js +197 -0
- package/lib/Utils/vcard.d.ts +40 -0
- package/lib/Utils/vcard.js +92 -0
- package/lib/Utils/voice-note.d.ts +13 -0
- package/lib/Utils/voice-note.js +47 -0
- package/lib/VoIP/audio-feeder.d.ts +15 -0
- package/lib/VoIP/audio-feeder.js +132 -0
- package/lib/VoIP/index.d.ts +22 -0
- package/lib/VoIP/index.js +277 -0
- package/lib/VoIP/relay-transport.d.ts +16 -0
- package/lib/VoIP/relay-transport.js +559 -0
- package/lib/VoIP/signaling.d.ts +16 -0
- package/lib/VoIP/signaling.js +624 -0
- package/lib/VoIP/types.d.ts +11 -0
- package/lib/VoIP/types.js +17 -0
- package/lib/VoIP/wasm-engine.d.ts +28 -0
- package/lib/VoIP/wasm-engine.js +1214 -0
- package/lib/VoIP/worker-bootstrap.d.ts +1 -0
- package/lib/VoIP/worker-bootstrap.js +1042 -0
- package/lib/WABinary/constants.d.ts +61 -0
- package/lib/WABinary/constants.js +1466 -0
- package/lib/WABinary/decode.d.ts +9 -0
- package/lib/WABinary/decode.js +261 -0
- package/lib/WABinary/encode.d.ts +2 -0
- package/lib/WABinary/encode.js +219 -0
- package/lib/WABinary/generic-utils.d.ts +45 -0
- package/lib/WABinary/generic-utils.js +285 -0
- package/lib/WABinary/index.d.ts +5 -0
- package/lib/WABinary/index.js +5 -0
- package/lib/WABinary/jid-utils.d.ts +32 -0
- package/lib/WABinary/jid-utils.js +102 -0
- package/lib/WABinary/types.d.ts +1 -0
- package/lib/WABinary/types.js +1 -0
- package/lib/WAM/BinaryInfo.d.ts +7 -0
- package/lib/WAM/BinaryInfo.js +9 -0
- package/lib/WAM/constants.d.ts +34926 -0
- package/lib/WAM/constants.js +22852 -0
- package/lib/WAM/encode.d.ts +1 -0
- package/lib/WAM/encode.js +149 -0
- package/lib/WAM/index.d.ts +3 -0
- package/lib/WAM/index.js +3 -0
- package/lib/WAUSync/Protocols/USyncBusinessProtocol.d.ts +43 -0
- package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +32 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +36 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +51 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +29 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +60 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +26 -0
- package/lib/WAUSync/Protocols/USyncFeatureProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +28 -0
- package/lib/WAUSync/Protocols/USyncPictureProtocol.d.ts +22 -0
- package/lib/WAUSync/Protocols/USyncPictureProtocol.js +28 -0
- package/lib/WAUSync/Protocols/USyncSidelistProtocol.d.ts +20 -0
- package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +23 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +37 -0
- package/lib/WAUSync/Protocols/USyncTextStatusProtocol.d.ts +14 -0
- package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +24 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +9 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +24 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +38 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +49 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +14 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +28 -0
- package/lib/WAUSync/Protocols/index.d.ts +12 -0
- package/lib/WAUSync/Protocols/index.js +12 -0
- package/lib/WAUSync/USyncQuery.d.ts +25 -0
- package/lib/WAUSync/USyncQuery.js +140 -0
- package/lib/WAUSync/USyncUser.d.ts +24 -0
- package/lib/WAUSync/USyncUser.js +47 -0
- package/lib/WAUSync/index.d.ts +3 -0
- package/lib/WAUSync/index.js +3 -0
- package/lib/assets/wasm/loader.js +5 -0
- package/lib/assets/wasm/whatsapp.wasm +0 -0
- package/lib/assets/wasm/worker-modules.js +273 -0
- package/lib/exports-extra.d.ts +45 -0
- package/lib/exports-extra.js +47 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.js +24 -0
- package/package.json +161 -4
|
@@ -0,0 +1,1021 @@
|
|
|
1
|
+
export function tokenizeCodeForRich(code: any, lang?: string): {
|
|
2
|
+
codeBlock: any[];
|
|
3
|
+
unified_codeBlock: {
|
|
4
|
+
content: any;
|
|
5
|
+
type: any;
|
|
6
|
+
}[];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* "Rich AI-response" style message builder: text with hyperlink/citation/latex
|
|
10
|
+
* inline entities, code blocks, tables, sources, image/video attachments,
|
|
11
|
+
* inline product/post cards, tip banners and quick-reply suggestions —
|
|
12
|
+
* everything ChatGPT/Gemini-in-WhatsApp-style bots typically render.
|
|
13
|
+
*
|
|
14
|
+
* Rewritten from MessageBuilder v4.7's `AIRich` reference implementation:
|
|
15
|
+
* same public API and message-building logic as v4.7, wired into this fork's
|
|
16
|
+
* `BaseBuilder` (title/footer/contextInfo/extraPayload) and the `withBlockTracking()` proxy
|
|
17
|
+
* defined at the top of this file (the `{ id, insertAt, replace }` mechanism on every add*()/set*() call) in
|
|
18
|
+
* place of v4.7's own `_nodes`/`_idIndex` bookkeeping.
|
|
19
|
+
*/
|
|
20
|
+
export class AIRich extends BaseBuilder {
|
|
21
|
+
/** @private Drop undefined/null/'' recursively so we never send explicit nulls (they can crash the WA renderer). */
|
|
22
|
+
private static _omitEmpty;
|
|
23
|
+
static toTableMetadata(arr: any, opts1?: { [key: string]: any;
|
|
24
|
+
hyperlink?: boolean;
|
|
25
|
+
citation?: boolean;
|
|
26
|
+
latex?: boolean;
|
|
27
|
+
}): {
|
|
28
|
+
title: string;
|
|
29
|
+
rows: {
|
|
30
|
+
isHeading?: boolean;
|
|
31
|
+
items: any[];
|
|
32
|
+
}[];
|
|
33
|
+
unified_rows: {
|
|
34
|
+
markdown_cells?: {
|
|
35
|
+
inline_entities?: any[] | ({
|
|
36
|
+
key: any;
|
|
37
|
+
metadata: {
|
|
38
|
+
display_name: any;
|
|
39
|
+
is_trusted: any;
|
|
40
|
+
url: any;
|
|
41
|
+
__typename: string;
|
|
42
|
+
deeplink_url?: undefined;
|
|
43
|
+
text?: undefined;
|
|
44
|
+
reference_id?: undefined;
|
|
45
|
+
reference_url?: undefined;
|
|
46
|
+
reference_title?: undefined;
|
|
47
|
+
reference_display_name?: undefined;
|
|
48
|
+
sources?: undefined;
|
|
49
|
+
latex_expression?: undefined;
|
|
50
|
+
latex_image?: undefined;
|
|
51
|
+
font_height?: undefined;
|
|
52
|
+
padding?: undefined;
|
|
53
|
+
};
|
|
54
|
+
} | {
|
|
55
|
+
key: any;
|
|
56
|
+
metadata: {
|
|
57
|
+
deeplink_url: any;
|
|
58
|
+
text: any;
|
|
59
|
+
__typename: string;
|
|
60
|
+
display_name?: undefined;
|
|
61
|
+
is_trusted?: undefined;
|
|
62
|
+
url?: undefined;
|
|
63
|
+
reference_id?: undefined;
|
|
64
|
+
reference_url?: undefined;
|
|
65
|
+
reference_title?: undefined;
|
|
66
|
+
reference_display_name?: undefined;
|
|
67
|
+
sources?: undefined;
|
|
68
|
+
latex_expression?: undefined;
|
|
69
|
+
latex_image?: undefined;
|
|
70
|
+
font_height?: undefined;
|
|
71
|
+
padding?: undefined;
|
|
72
|
+
};
|
|
73
|
+
} | {
|
|
74
|
+
key: any;
|
|
75
|
+
metadata: {
|
|
76
|
+
reference_id: any;
|
|
77
|
+
reference_url: any;
|
|
78
|
+
reference_title: any;
|
|
79
|
+
reference_display_name: any;
|
|
80
|
+
sources: any[];
|
|
81
|
+
__typename: string;
|
|
82
|
+
display_name?: undefined;
|
|
83
|
+
is_trusted?: undefined;
|
|
84
|
+
url?: undefined;
|
|
85
|
+
deeplink_url?: undefined;
|
|
86
|
+
text?: undefined;
|
|
87
|
+
latex_expression?: undefined;
|
|
88
|
+
latex_image?: undefined;
|
|
89
|
+
font_height?: undefined;
|
|
90
|
+
padding?: undefined;
|
|
91
|
+
};
|
|
92
|
+
} | {
|
|
93
|
+
key: any;
|
|
94
|
+
metadata: {
|
|
95
|
+
latex_expression: any;
|
|
96
|
+
latex_image: {
|
|
97
|
+
url: any;
|
|
98
|
+
width: number;
|
|
99
|
+
height: number;
|
|
100
|
+
};
|
|
101
|
+
font_height: number;
|
|
102
|
+
padding: number;
|
|
103
|
+
__typename: string;
|
|
104
|
+
display_name?: undefined;
|
|
105
|
+
is_trusted?: undefined;
|
|
106
|
+
url?: undefined;
|
|
107
|
+
deeplink_url?: undefined;
|
|
108
|
+
text?: undefined;
|
|
109
|
+
reference_id?: undefined;
|
|
110
|
+
reference_url?: undefined;
|
|
111
|
+
reference_title?: undefined;
|
|
112
|
+
reference_display_name?: undefined;
|
|
113
|
+
sources?: undefined;
|
|
114
|
+
};
|
|
115
|
+
})[];
|
|
116
|
+
text: any;
|
|
117
|
+
}[];
|
|
118
|
+
is_header: boolean;
|
|
119
|
+
cells: any[];
|
|
120
|
+
}[];
|
|
121
|
+
};
|
|
122
|
+
/** Build a raw submessage layout block by name — escape hatch for layouts not covered by the add*() helpers. */
|
|
123
|
+
static newLayout(name: any, data: any, extra?: {}): {
|
|
124
|
+
view_model: {
|
|
125
|
+
[x: string]: any;
|
|
126
|
+
__typename: string;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
/** Inline CSS+JS that pins an HTML app's body height and makes it internally scrollable — used by `addHTML()`'s `height` option. Ported alongside `addHTML()` (see that method's header comment for the source). */
|
|
130
|
+
static lockHeight(height: any): string;
|
|
131
|
+
/**
|
|
132
|
+
* Send an image and video as one paired-media unit (image sent first, video linked to it via
|
|
133
|
+
* `messageAssociation`). Distinct from a plain album — the client treats them as a single group.
|
|
134
|
+
* @param {import('../../WAProto/index.js').WASocket} client
|
|
135
|
+
* @param {string} jid
|
|
136
|
+
* @param {{ image: string|Buffer, video: string|Buffer }} media
|
|
137
|
+
*/
|
|
138
|
+
static sendPairedMedia(client: any, jid: string, opts2?: { [key: string]: any;
|
|
139
|
+
image: string | Buffer;
|
|
140
|
+
video: string | Buffer;
|
|
141
|
+
}): Promise<any>;
|
|
142
|
+
/**
|
|
143
|
+
* Send a support-ticket marker message (`messageContextInfo.supportPayload`) — a plain
|
|
144
|
+
* conversation message tagged as an AI/support-bot ticket, distinct from richResponseMessage.
|
|
145
|
+
* @param {import('../../WAProto/index.js').WASocket} client
|
|
146
|
+
* @param {string} jid
|
|
147
|
+
* @param {string} text
|
|
148
|
+
* @param {{ ticketId?: string, isAiMessage?: boolean, shouldShowSystemMessage?: boolean, version?: number }} [options]
|
|
149
|
+
*/
|
|
150
|
+
static sendSupportPayload(client: any, jid: string, text: string, opts3?: { [key: string]: any;
|
|
151
|
+
ticketId?: string;
|
|
152
|
+
isAiMessage?: boolean;
|
|
153
|
+
shouldShowSystemMessage?: boolean;
|
|
154
|
+
version?: number;
|
|
155
|
+
}): Promise<any>;
|
|
156
|
+
/**
|
|
157
|
+
* @param {import('../../WAProto/index.js').WASocket} client Active Baileys socket.
|
|
158
|
+
* @param {object} [options]
|
|
159
|
+
* @param {boolean} [options.dynamic=true] When true, `build()` mints a fresh `response_id`/
|
|
160
|
+
* `botResponseId` on every call instead of reusing the pinned ones.
|
|
161
|
+
* @param {boolean} [options.unsupportedTypeAlert=true] Gates `createAlert()` — see that method.
|
|
162
|
+
*/
|
|
163
|
+
constructor(client: any, opts4?: { [key: string]: any;
|
|
164
|
+
dynamic?: boolean;
|
|
165
|
+
unsupportedTypeAlert?: boolean;
|
|
166
|
+
});
|
|
167
|
+
_sections: any[];
|
|
168
|
+
_submessages: any[];
|
|
169
|
+
_unsupportedTypeAlert: boolean;
|
|
170
|
+
_dynamic: boolean;
|
|
171
|
+
_responseId: any;
|
|
172
|
+
_botResponseId: any;
|
|
173
|
+
_lastMessageKey: any;
|
|
174
|
+
_inlineImages: any[];
|
|
175
|
+
_botMetadataExtra: {};
|
|
176
|
+
_forwardBotJid: string;
|
|
177
|
+
_embeddedScreens: any[];
|
|
178
|
+
_verification: boolean;
|
|
179
|
+
_notification: boolean;
|
|
180
|
+
_notificationText: string;
|
|
181
|
+
_mentions: any[];
|
|
182
|
+
_quoted: any;
|
|
183
|
+
_quotedParticipant: string;
|
|
184
|
+
_noContextInfo: boolean;
|
|
185
|
+
_unifiedResponseData: any;
|
|
186
|
+
_messageSecret: boolean;
|
|
187
|
+
_bypassDownload: boolean;
|
|
188
|
+
_forwarded: boolean;
|
|
189
|
+
_includesUnifiedResponse: boolean;
|
|
190
|
+
_includesSubmessages: boolean;
|
|
191
|
+
_rawEnvelope: boolean;
|
|
192
|
+
_deferred: any[];
|
|
193
|
+
/**
|
|
194
|
+
* Reconstruct this builder's state from an already-built/sent AIRich message (e.g. one fetched
|
|
195
|
+
* back from your own message store), so it can be edited and re-sent via `sendEdit()`.
|
|
196
|
+
* @param {object} msg A raw WA message object — either `{ key, message }` (as stored/fetched) or
|
|
197
|
+
* just the `message` object itself. Must contain a `richResponseMessage` (nested under
|
|
198
|
+
* `botForwardedMessage.message`, `botForwardedMessage`, or at the top level).
|
|
199
|
+
*/
|
|
200
|
+
loadFrom(msg: object): this;
|
|
201
|
+
_blocks: Map<any, any>;
|
|
202
|
+
_lastBlock: any;
|
|
203
|
+
/** Pin `unifiedResponse.response_id` to a specific value instead of a fresh random one each build() — needed to re-send an edited version of an already-sent message in place. */
|
|
204
|
+
setResponseId(id: any): this;
|
|
205
|
+
/** Force a fresh random `response_id` on the next build(), discarding any pinned value. */
|
|
206
|
+
refreshResponseId(): this;
|
|
207
|
+
/** Pin `botMetadata.botResponseId` to a specific value (see setResponseId()). */
|
|
208
|
+
setBotResponseId(id: any): this;
|
|
209
|
+
/** Force a fresh random `botResponseId` on the next build(), discarding any pinned value. */
|
|
210
|
+
refreshBotResponseId(): this;
|
|
211
|
+
/** Set `botMetadata.messageDisclaimerText` — shown as the small title line above the response. */
|
|
212
|
+
setTitle(title: any): this;
|
|
213
|
+
/**
|
|
214
|
+
* Merge extra fields into `messageContextInfo.botMetadata` at build time (e.g.
|
|
215
|
+
* `{ unifiedResponseMutation: { mediaDetailsMetadataList: [...] } }`, needed for a file/media
|
|
216
|
+
* artifact whose preview comes from an uploaded media entry rather than a plain URL).
|
|
217
|
+
* @param {object} extra
|
|
218
|
+
*/
|
|
219
|
+
setBotMetadata(extra: object): this;
|
|
220
|
+
/**
|
|
221
|
+
* Override the `forwardedAiBotMessageInfo.botJid` stamped on forwarded builds (default: the
|
|
222
|
+
* Meta AI bot jid). Only used when `forwarded` is true (the default in send()/build()).
|
|
223
|
+
* @param {string} jid A `...@bot` jid.
|
|
224
|
+
*/
|
|
225
|
+
setForwardBotJid(jid: string): this;
|
|
226
|
+
/** Alias of `setForwardBotJid()` (README casing). */
|
|
227
|
+
setForwardBotJID(jid: any): this;
|
|
228
|
+
/**
|
|
229
|
+
* Toggle the `botMetadata.verificationMetadata` block that `build()` attaches. Default `false`. NOTE: the proof is
|
|
230
|
+
* random bytes, not a real Meta signature, so it is opt-in (the Go reference `MessageBuilderv2` also ships OFF).
|
|
231
|
+
* Call `setVerificationMetadata(true)` only if you explicitly want the placeholder proof attached.
|
|
232
|
+
* @param {boolean} [enabled=true]
|
|
233
|
+
*/
|
|
234
|
+
setVerificationMetadata(enabled?: boolean): this;
|
|
235
|
+
/**
|
|
236
|
+
* Default for `build({ notification })` / `send({ notification })`: attach `sessionTransparencyMetadata`.
|
|
237
|
+
* @param {boolean} [enabled=true]
|
|
238
|
+
* @param {string} [text] Disclaimer text shown to the recipient. Defaults to the `setTitle()` text; omitted if neither is set.
|
|
239
|
+
*/
|
|
240
|
+
setNotification(enabled?: boolean, text?: string): this;
|
|
241
|
+
/**
|
|
242
|
+
* Tag JIDs on the card (`contextInfo.mentionedJid`). Keep the `@<lid>` tokens in your text as-is —
|
|
243
|
+
* WhatsApp renders them as the contact's name. Use LID jids so they match the token.
|
|
244
|
+
* @param {...(string|string[])} jids
|
|
245
|
+
*/
|
|
246
|
+
setMentions(...jids: (string | string[])[]): this;
|
|
247
|
+
/**
|
|
248
|
+
* Default quoted message for `build()`/`send()` (same shapes `build({ quoted })` accepts).
|
|
249
|
+
* @param {object} quoted A WAMessage (`{ key, message }`) or `{ id, participant }`.
|
|
250
|
+
* @param {string} [participant]
|
|
251
|
+
*/
|
|
252
|
+
setQuoted(quoted: object, participant?: string): this;
|
|
253
|
+
/** Drop `contextInfo` from the rich response entirely (bare rich, as in captured native edits). */
|
|
254
|
+
setNoContextInfo(enabled?: boolean): this;
|
|
255
|
+
/** Mint a fresh `response_id`/`botResponseId` on every `build()` (same as the constructor's `dynamic` option). */
|
|
256
|
+
setDynamicIDs(enabled?: boolean): this;
|
|
257
|
+
/**
|
|
258
|
+
* Force `unifiedResponse.data` from a raw payload instead of the sections model.
|
|
259
|
+
* @param {object|string|Buffer|null} data Plain object (JSON-stringified), JSON string, or Buffer. `null` clears the override.
|
|
260
|
+
*/
|
|
261
|
+
setUnifiedResponseData(data: object | string | Buffer | null): this;
|
|
262
|
+
/** Stamp a random 32-byte `messageContextInfo.messageSecret` on every `build()`. */
|
|
263
|
+
setMessageSecret(enabled?: boolean): this;
|
|
264
|
+
/** Runtime toggle for the constructor's `unsupportedTypeAlert` option (gates `createAlert()`). */
|
|
265
|
+
setUnsupportedTypeAlert(enabled?: boolean): this;
|
|
266
|
+
/** Default for `send({ bypassDownload })` — auto `sendEdit()` after `send()`. Default `true`. */
|
|
267
|
+
setByPassDownload(enabled?: boolean): this;
|
|
268
|
+
/**
|
|
269
|
+
* Shortcut for `botMetadata.capabilityMetadata.capabilities`. Accepts `BotCapabilityType` enum
|
|
270
|
+
* names or numbers, e.g. `setCapabilities(['RICH_RESPONSE_UR_BLOKS_ENABLED'])`.
|
|
271
|
+
* @param {Array<string|number>} capabilities
|
|
272
|
+
*/
|
|
273
|
+
setCapabilities(capabilities: Array<string | number>): this;
|
|
274
|
+
/**
|
|
275
|
+
* Shortcut for `botMetadata.botRenderingConfigMetadata`.
|
|
276
|
+
* @param {string} bloksVersioningId
|
|
277
|
+
* @param {number} [pixelDensity=1]
|
|
278
|
+
*/
|
|
279
|
+
setBotRenderingConfig(bloksVersioningId: string, pixelDensity?: number): this;
|
|
280
|
+
/** Shortcut for `botMetadata.botThreadInfo.clientInfo.type` (`AIThreadType`: UNKNOWN / DEFAULT / INCOGNITO / SIDE_CHAT). */
|
|
281
|
+
setThreadType(type: any): this;
|
|
282
|
+
/** Shortcut for `botMetadata.imagineMetadata.imagineType`. */
|
|
283
|
+
setImagineType(type: any): this;
|
|
284
|
+
/** Shortcut for `botMetadata.subscriptionUpsellMetadata.requestType` (`AISubscriptionRequestType`: UNSPECIFIED / THINK_HARD / IMAGE_GEN / VIDEO_GEN). */
|
|
285
|
+
setSubscriptionUpsell(requestType: any): this;
|
|
286
|
+
/**
|
|
287
|
+
* Add a full-screen/bottom-sheet "embedded screen" — a tabbed view opened by tapping into the
|
|
288
|
+
* response, as opposed to a section rendered inline. Confirmed shape (`embedded_screens` array
|
|
289
|
+
* inside `unifiedResponse.data`, alongside `sections`) from yudzxml 7.6.6 / elaina 1.3.10's core
|
|
290
|
+
* `index.js`. Used by `addHTMLCard()` below; pass a raw screen object directly for anything
|
|
291
|
+
* beyond that.
|
|
292
|
+
* @param {{id?: string, title?: string, content?: object[], tabs?: object[]}} screen
|
|
293
|
+
*/
|
|
294
|
+
addEmbeddedScreen(screen: {
|
|
295
|
+
id?: string;
|
|
296
|
+
title?: string;
|
|
297
|
+
content?: object[];
|
|
298
|
+
tabs?: object[];
|
|
299
|
+
}): this;
|
|
300
|
+
/**
|
|
301
|
+
* Build a generic `[ UNSUPPORTED_TYPE - <type> ]` submessage fallback, or `undefined` if
|
|
302
|
+
* `unsupportedTypeAlert` was set to `false` in the constructor.
|
|
303
|
+
* @param {string} type The primitive's `__typename` (or any label), shown in the banner text.
|
|
304
|
+
*/
|
|
305
|
+
createAlert(type: string): {
|
|
306
|
+
messageType: number;
|
|
307
|
+
messageText: string;
|
|
308
|
+
};
|
|
309
|
+
/** Check whether a block id was registered by an earlier `add*()`/`set*()` call passing `{id}`. */
|
|
310
|
+
hasId(id: any): boolean;
|
|
311
|
+
/** List every block id registered so far, in no particular order. */
|
|
312
|
+
getIds(): any[];
|
|
313
|
+
/** Inspect a registered block without modifying it. Returns `null` if `id` isn't registered. */
|
|
314
|
+
peek(id: any): {
|
|
315
|
+
id: any;
|
|
316
|
+
sections: any[];
|
|
317
|
+
submessages: any[];
|
|
318
|
+
};
|
|
319
|
+
/** Remove a previously-added block (by the `id` passed to its `add*()`/`set*()` call) from the message. Throws if `id` isn't registered. */
|
|
320
|
+
delete(id: any): this;
|
|
321
|
+
/**
|
|
322
|
+
* Retroactively assign an id to the block most recently added by an add*()/set*() call that
|
|
323
|
+
* didn't pass its own `{id}`.
|
|
324
|
+
* @param {string} id
|
|
325
|
+
*/
|
|
326
|
+
assignId(id: string): this;
|
|
327
|
+
/** Push validated section(s)/submessage(s) onto the tracked arrays. `{ id, insertAt, replace }` bookkeeping is handled by the constructor's withBlockTracking() proxy — this only needs to append. */
|
|
328
|
+
_addContent(section: any, submessage: any): this;
|
|
329
|
+
/** Push a raw pre-built section wrapper (escape hatch for shapes not covered by the add*() helpers). */
|
|
330
|
+
addSection(section: any, options?: {}): this;
|
|
331
|
+
/** Push a raw pre-built submessage block (escape hatch for shapes not covered by the add*() helpers). */
|
|
332
|
+
addSubmessage(submessage: any, options?: {}): this;
|
|
333
|
+
addText(text: any, opts5?: { [key: string]: any;
|
|
334
|
+
hyperlink?: boolean;
|
|
335
|
+
citation?: boolean;
|
|
336
|
+
latex?: boolean;
|
|
337
|
+
}): this;
|
|
338
|
+
addFOAText(text: any, opts6?: { [key: string]: any; }): this;
|
|
339
|
+
addCode(language: any, code: any, opts7?: { [key: string]: any; }): this;
|
|
340
|
+
addTable(table: any, opts8?: { [key: string]: any;
|
|
341
|
+
hyperlink?: boolean;
|
|
342
|
+
citation?: boolean;
|
|
343
|
+
latex?: boolean;
|
|
344
|
+
}): this;
|
|
345
|
+
addSource(sources?: any[], opts9?: { [key: string]: any; }): this;
|
|
346
|
+
addReels(reelsItems?: any[], opts10?: { [key: string]: any; }): this;
|
|
347
|
+
addImage(imageUrl: any, opts11?: { [key: string]: any;
|
|
348
|
+
status?: string;
|
|
349
|
+
resolveUrl?: boolean;
|
|
350
|
+
}): this;
|
|
351
|
+
addVideo(videoUrl: any, opts12?: { [key: string]: any;
|
|
352
|
+
autoFill?: boolean;
|
|
353
|
+
status?: string;
|
|
354
|
+
}): this;
|
|
355
|
+
addProduct(data?: {}, opts13?: { [key: string]: any; }): this;
|
|
356
|
+
addPost(data?: {}, opts14?: { [key: string]: any; }): this;
|
|
357
|
+
addMetadata(text: any, opts15?: { [key: string]: any; }): this;
|
|
358
|
+
addTip(text: any, opts16?: { [key: string]: any; }): this;
|
|
359
|
+
addWidget(data: any, opts17?: { [key: string]: any; }): this;
|
|
360
|
+
addFooterAction(data: any, opts18?: { [key: string]: any; }): this;
|
|
361
|
+
addSuggest(suggestion: any, opts19?: { [key: string]: any;
|
|
362
|
+
scroll?: boolean;
|
|
363
|
+
}): this;
|
|
364
|
+
/**
|
|
365
|
+
* Image card with independent preview and full-resolution urls (`gridImageMetadata` + `GenAIImaginePrimitive`,
|
|
366
|
+
* the same layout `addImage()` uses). Reinstated in 2.1.13 — it was documented in the README but missing from source.
|
|
367
|
+
* @param {string|Buffer} previewUrl Thumbnail shown in the card.
|
|
368
|
+
* @param {string|Buffer} [fullUrl] Full-resolution image (defaults to `previewUrl`).
|
|
369
|
+
*/
|
|
370
|
+
addImageCard(previewUrl: string | Buffer, fullUrl?: string | Buffer, opts20?: { [key: string]: any;
|
|
371
|
+
status?: string;
|
|
372
|
+
resolveUrl?: boolean;
|
|
373
|
+
}): this;
|
|
374
|
+
/**
|
|
375
|
+
* Single comment line. Text-only rendering (markdown), same as the Go reference.
|
|
376
|
+
* @param {{actorName?: string, actor_name?: string, commentText?: string, comment_text?: string, subtitle?: string}} comment
|
|
377
|
+
*/
|
|
378
|
+
addComment(comment?: {
|
|
379
|
+
actorName?: string;
|
|
380
|
+
actor_name?: string;
|
|
381
|
+
commentText?: string;
|
|
382
|
+
comment_text?: string;
|
|
383
|
+
subtitle?: string;
|
|
384
|
+
}, opts21?: { [key: string]: any; }): this;
|
|
385
|
+
/**
|
|
386
|
+
* List of actions/links. Text-only rendering (`▸ title — subtitle` lines), same as the Go reference — the
|
|
387
|
+
* native `GenAIActionListPrimitive` wire shape has never been captured for this fork.
|
|
388
|
+
* @param {{title: string, subtitle?: string}[]} rows
|
|
389
|
+
*/
|
|
390
|
+
addActionList(rows: {
|
|
391
|
+
title: string;
|
|
392
|
+
subtitle?: string;
|
|
393
|
+
}[], opts22?: { [key: string]: any; }): this;
|
|
394
|
+
/** One reasoning step (bold title + body), text-only rendering like the Go reference. */
|
|
395
|
+
addChainOfThoughtStep(title: any, body: any, opts23?: { [key: string]: any; }): this;
|
|
396
|
+
/**
|
|
397
|
+
* "Thinking" banner using the `GenAIBotProgressStatusPrimitive` shape (icon `THINKING`) — the same primitive
|
|
398
|
+
* `addProgressStatus()` uses (confirmed rendering), unlike `addThinkingStatus()`'s own typename which stock
|
|
399
|
+
* WA clients render blank. Matches the Go reference's `AddThinking`.
|
|
400
|
+
*/
|
|
401
|
+
addThinking(title?: string, opts24?: { [key: string]: any;
|
|
402
|
+
icon?: string;
|
|
403
|
+
is_in_progress?: boolean;
|
|
404
|
+
}): this;
|
|
405
|
+
/**
|
|
406
|
+
* Generic escape hatch: push any `GenAI*` primitive as a `Single` layout (empty/null fields are dropped so
|
|
407
|
+
* they can't crash the client). Use for captured shapes that don't have a dedicated method yet, e.g.
|
|
408
|
+
* `addPrimitive('GenAISearchPlannerStepsPrimitive', {...})`.
|
|
409
|
+
* @param {string} typeName The primitive's `__typename`.
|
|
410
|
+
* @param {object} payload
|
|
411
|
+
*/
|
|
412
|
+
addPrimitive(typeName: string, payload: object, opts25?: { [key: string]: any; }): this;
|
|
413
|
+
/** Public door to `_addContent()` — insert a raw section (or sections) plus optional submessage(s), as-is. */
|
|
414
|
+
addContentRaw(section: any, submessage: any, opts26?: { [key: string]: any; }): this;
|
|
415
|
+
/** @private Push one `GenAI*` primitive as a `Single` layout, with the usual unsupported-type alert submessage. */
|
|
416
|
+
private _addSinglePrimitive;
|
|
417
|
+
/**
|
|
418
|
+
* Follow-up suggestion card with a title/image (richer sibling of `addSuggest()`), `GenAIChainingSuggestionPrimitive`.
|
|
419
|
+
* @param {{promptText: string, title?: string, imageUri?: string, externalConversationId?: string, topic?: string, cardId?: string}} options
|
|
420
|
+
*/
|
|
421
|
+
addChainingSuggestionV2(opts55?: { [key: string]: any;
|
|
422
|
+
promptText: string;
|
|
423
|
+
title?: string;
|
|
424
|
+
imageUri?: string;
|
|
425
|
+
externalConversationId?: string;
|
|
426
|
+
topic?: string;
|
|
427
|
+
cardId?: string;
|
|
428
|
+
}): this;
|
|
429
|
+
/**
|
|
430
|
+
* Place card (`GenAIPlaceEntityItem`).
|
|
431
|
+
* @param {{placeId?: string, name: string, imageUrl?: string, motivation?: string, key?: string, latitude?: number|string, longitude?: number|string, itemType?: string, address?: {streetAddress?: string, region?: string, country?: string, postalCode?: string, locality?: string, street?: string}, category?: {displayName?: string, categoryId?: string}, rating?: number|string}} place
|
|
432
|
+
*/
|
|
433
|
+
addPlaceEntity(opts56?: { [key: string]: any;
|
|
434
|
+
placeId?: string;
|
|
435
|
+
name: string;
|
|
436
|
+
imageUrl?: string;
|
|
437
|
+
motivation?: string;
|
|
438
|
+
key?: string;
|
|
439
|
+
latitude?: number | string;
|
|
440
|
+
longitude?: number | string;
|
|
441
|
+
itemType?: string;
|
|
442
|
+
address?: {
|
|
443
|
+
streetAddress?: string;
|
|
444
|
+
region?: string;
|
|
445
|
+
country?: string;
|
|
446
|
+
postalCode?: string;
|
|
447
|
+
locality?: string;
|
|
448
|
+
street?: string;
|
|
449
|
+
};
|
|
450
|
+
category?: {
|
|
451
|
+
displayName?: string;
|
|
452
|
+
categoryId?: string;
|
|
453
|
+
};
|
|
454
|
+
rating?: number | string;
|
|
455
|
+
}): this;
|
|
456
|
+
/**
|
|
457
|
+
* Social-search result card (`GenAISearchResultV2Primitive`).
|
|
458
|
+
* @param {{searchQuery?: string, metadata?: string, postId?: string, reelsUrl?: string, reelsDeeplink?: string, reelsTitle?: string, thumbnailUrl?: string, avatarUrl?: string, creator?: string, isVerified?: boolean, sourceApp?: string, timestamp?: string, originalWidth?: number, originalHeight?: number, primitives?: object[]}} result
|
|
459
|
+
*/
|
|
460
|
+
addSearchResultV2(opts57?: { [key: string]: any;
|
|
461
|
+
searchQuery?: string;
|
|
462
|
+
metadata?: string;
|
|
463
|
+
postId?: string;
|
|
464
|
+
reelsUrl?: string;
|
|
465
|
+
reelsDeeplink?: string;
|
|
466
|
+
reelsTitle?: string;
|
|
467
|
+
thumbnailUrl?: string;
|
|
468
|
+
avatarUrl?: string;
|
|
469
|
+
creator?: string;
|
|
470
|
+
isVerified?: boolean;
|
|
471
|
+
sourceApp?: string;
|
|
472
|
+
timestamp?: string;
|
|
473
|
+
originalWidth?: number;
|
|
474
|
+
originalHeight?: number;
|
|
475
|
+
primitives?: object[];
|
|
476
|
+
}): this;
|
|
477
|
+
/**
|
|
478
|
+
* Compact "sources" chip row (`GenAIContextualSourcesViewModel`).
|
|
479
|
+
* @param {Array<{faviconUri?: string, displayName: string, uri: string}>} sources
|
|
480
|
+
* @param {string|object} [contextualSources] Optional primary-source payload (objects are JSON-stringified).
|
|
481
|
+
*/
|
|
482
|
+
addContextualSources(sources: Array<{
|
|
483
|
+
faviconUri?: string;
|
|
484
|
+
displayName: string;
|
|
485
|
+
uri: string;
|
|
486
|
+
}>, contextualSources?: string | object, opts27?: { [key: string]: any; }): this;
|
|
487
|
+
/**
|
|
488
|
+
* Raw media item (`GenAIMediaItem`) — for media you already uploaded/host, addressed by url and/or `media_id`.
|
|
489
|
+
* @param {{url?: string, mimeType?: string, urlFallback?: string, mediaId?: string, fileLength?: number, width?: number, height?: number, durationMs?: number, expirationTimestampMs?: number, thumbnail?: string, encryption?: {mediaKey: string, directPath: string, fileSha256: string, fileEncSha256: string, scansSidecar?: string, scanLengths?: number[], mediaKeyTimestamp?: number, fileLength?: number}}} media
|
|
490
|
+
*/
|
|
491
|
+
addMediaItem(opts58?: { [key: string]: any;
|
|
492
|
+
url?: string;
|
|
493
|
+
mimeType?: string;
|
|
494
|
+
urlFallback?: string;
|
|
495
|
+
mediaId?: string;
|
|
496
|
+
fileLength?: number;
|
|
497
|
+
width?: number;
|
|
498
|
+
height?: number;
|
|
499
|
+
durationMs?: number;
|
|
500
|
+
expirationTimestampMs?: number;
|
|
501
|
+
thumbnail?: string;
|
|
502
|
+
encryption?: {
|
|
503
|
+
mediaKey: string;
|
|
504
|
+
directPath: string;
|
|
505
|
+
fileSha256: string;
|
|
506
|
+
fileEncSha256: string;
|
|
507
|
+
scansSidecar?: string;
|
|
508
|
+
scanLengths?: number[];
|
|
509
|
+
mediaKeyTimestamp?: number;
|
|
510
|
+
fileLength?: number;
|
|
511
|
+
};
|
|
512
|
+
}): this;
|
|
513
|
+
/**
|
|
514
|
+
* Build (but don't send) the full AI-rich message content, wrapped and ready for `relayMessage()`.
|
|
515
|
+
* @param {string} jid Destination chat/group jid.
|
|
516
|
+
*/
|
|
517
|
+
build(jid: string, opts28?: { [key: string]: any;
|
|
518
|
+
forwarded?: boolean;
|
|
519
|
+
notification?: boolean;
|
|
520
|
+
verificationMetadata?: boolean;
|
|
521
|
+
includesUnifiedResponse?: boolean;
|
|
522
|
+
includesSubmessages?: boolean;
|
|
523
|
+
quoted?: any;
|
|
524
|
+
quotedParticipant?: string;
|
|
525
|
+
noContextInfo?: boolean;
|
|
526
|
+
}): Promise<import("../../WAProto/index.js").proto.WebMessageInfo>;
|
|
527
|
+
/**
|
|
528
|
+
* Build a `protocolMessage` (type EDIT) that patches an already-sent AIRich message in place.
|
|
529
|
+
* @param {string} targetJid Chat the original message lives in.
|
|
530
|
+
* @param {string} targetId `key.id` of the original message.
|
|
531
|
+
* @param {object} [opts] Pass `{ msg }` to reuse an already-built message content instead of rebuilding via build().
|
|
532
|
+
*/
|
|
533
|
+
buildEdit(targetJid: string, targetId: string, opts29?: object): Promise<import("../../WAProto/index.js").proto.WebMessageInfo>;
|
|
534
|
+
/**
|
|
535
|
+
* Rebuild this AIRich message's current content and patch it into an already-sent message in
|
|
536
|
+
* place (WA edits the bubble instead of showing a new one). With no args, edits the message from
|
|
537
|
+
* the last send()/sendEdit() call.
|
|
538
|
+
* @param {string} [jid] Defaults to the jid from the last send()/sendEdit().
|
|
539
|
+
* @param {string} [id] Defaults to the message id from the last send()/sendEdit().
|
|
540
|
+
*/
|
|
541
|
+
sendEdit(jid?: string, id?: string, opts30?: { [key: string]: any;
|
|
542
|
+
additionalNodes?: any[];
|
|
543
|
+
}): Promise<import("../../WAProto/index.js").proto.WebMessageInfo>;
|
|
544
|
+
/**
|
|
545
|
+
* Build a *native-format* edit: a top-level `protocolMessage` (type EDIT) instead of the
|
|
546
|
+
* `botForwardedMessage`-wrapped edit that `buildEdit()` produces, with the bot-metadata
|
|
547
|
+
* (`botResponseId`, CLIPPY infrastructure backend) and non-E2EE account attestation a real Meta-AI
|
|
548
|
+
* edit carries. Use it when an edit made with `sendEdit()` doesn't re-render the bubble.
|
|
549
|
+
* @param {string} targetJid Chat the original message lives in.
|
|
550
|
+
* @param {string} targetId `key.id` of the original message.
|
|
551
|
+
* @param {object} [opts] Pass `{ msg }` to reuse an already-built message content instead of rebuilding via build().
|
|
552
|
+
*/
|
|
553
|
+
buildEditNative(targetJid: string, targetId: string, opts31?: object): Promise<import("../../WAProto/index.js").proto.WebMessageInfo>;
|
|
554
|
+
/** Same as `sendEdit()` but sends the native-format edit from `buildEditNative()`. Defaults to the last send()'s jid/id. */
|
|
555
|
+
sendEditNative(jid: any, id: any, opts32?: { [key: string]: any;
|
|
556
|
+
additionalNodes?: any[];
|
|
557
|
+
}): Promise<import("../../WAProto/index.js").proto.WebMessageInfo>;
|
|
558
|
+
/** Build and send this AI-rich message. @param {string} jid Destination chat/group jid. */
|
|
559
|
+
send(jid: string, opts33?: { [key: string]: any;
|
|
560
|
+
bypassDownload?: boolean;
|
|
561
|
+
forwarded?: boolean;
|
|
562
|
+
notification?: boolean;
|
|
563
|
+
includesUnifiedResponse?: boolean;
|
|
564
|
+
includesSubmessages?: boolean;
|
|
565
|
+
additionalNodes?: any[];
|
|
566
|
+
skipImageFallback?: boolean;
|
|
567
|
+
nativeEdit?: boolean;
|
|
568
|
+
}): Promise<import("../../WAProto/index.js").proto.WebMessageInfo>;
|
|
569
|
+
/** Flatten every primitive pushed into `_sections` so far into one array — lets you build a
|
|
570
|
+
* card set in one AIRich instance and re-embed it into another via addSection(AIRich.newLayout(...)). */
|
|
571
|
+
get items(): any[];
|
|
572
|
+
/** The `{ remoteJid, fromMe, id }` of the last message this instance sent/edited, or `null`. */
|
|
573
|
+
get lastMessageKey(): any;
|
|
574
|
+
/**
|
|
575
|
+
* Add a raw Bloks payload (`FOABloksPrimitive`) — Meta's internal UI-description format.
|
|
576
|
+
* Escape hatch: field meaning beyond what's passed through is undocumented, so this is the
|
|
577
|
+
* most experimental primitive in this block; pass whatever your captured traffic shows.
|
|
578
|
+
* @param {{type: string, data: string, uuid?: string, initial_response?: any, versioning_id?: string}} data
|
|
579
|
+
*/
|
|
580
|
+
addBloks(data?: {
|
|
581
|
+
type: string;
|
|
582
|
+
data: string;
|
|
583
|
+
uuid?: string;
|
|
584
|
+
initial_response?: any;
|
|
585
|
+
versioning_id?: string;
|
|
586
|
+
}): this;
|
|
587
|
+
/**
|
|
588
|
+
* Add an HTML mini-app card (`GenAIaeacdsnwHtmlPrimitive`, Android-only — see
|
|
589
|
+
* `AI_RICH_PRIMITIVES_ANDROID_ONLY` below). Confirmed independently in two forks'
|
|
590
|
+
* `MessageBuilder/extras.js` (yudzxml 7.6.6's `htmlSection()` and elaina 1.3.10's, both
|
|
591
|
+
* crediting the same original source) as the "proven wire shape": a `GenAIUnifiedResponseSection`
|
|
592
|
+
* wrapper around the html primitive. `options.url` sets the WebView's base origin (needed for
|
|
593
|
+
* WebSocket/fetch calls from inside the page to be allowed) — pass a real `https://` origin, not
|
|
594
|
+
* a data URI. `options.height` pins the page to a fixed height via `AIRich.lockHeight()`.
|
|
595
|
+
* @param {string} html
|
|
596
|
+
* @param {{trustedSources?: string[], height?: number, url?: string, textFallback?: boolean}} [options]
|
|
597
|
+
*/
|
|
598
|
+
addHTML(html: string, opts34?: { [key: string]: any;
|
|
599
|
+
trustedSources?: string[];
|
|
600
|
+
height?: number;
|
|
601
|
+
url?: string;
|
|
602
|
+
textFallback?: boolean;
|
|
603
|
+
}): this;
|
|
604
|
+
/**
|
|
605
|
+
* Add an HTML app inside a tappable bottom-sheet "card" (a title/teaser line in the main
|
|
606
|
+
* response that opens a tabbed embedded screen containing the HTML), instead of `addHTML()`'s
|
|
607
|
+
* inline-in-the-response form. Reproduces `sendHtmlApp()`'s `embedded: true` branch (yudzxml
|
|
608
|
+
* 7.6.6 / elaina 1.3.10's `MessageBuilder/extras.js`) using this class's own `setTitle()` /
|
|
609
|
+
* `addEmbeddedScreen()` / `addText()` instead of that helper's standalone-function form. Calling
|
|
610
|
+
* this sets the instance's title via `setTitle()` if `options.title` is given — don't call
|
|
611
|
+
* `setTitle()` again after this if you want a different top title than the sheet's.
|
|
612
|
+
* @param {string} html
|
|
613
|
+
* @param {{title?: string, label?: string, trustedSources?: string[], height?: number, url?: string, screenTitle?: string, tabHeader?: string, textFallback?: boolean}} [options]
|
|
614
|
+
*/
|
|
615
|
+
addHTMLCard(html: string, opts35?: { [key: string]: any;
|
|
616
|
+
title?: string;
|
|
617
|
+
label?: string;
|
|
618
|
+
trustedSources?: string[];
|
|
619
|
+
height?: number;
|
|
620
|
+
url?: string;
|
|
621
|
+
screenTitle?: string;
|
|
622
|
+
tabHeader?: string;
|
|
623
|
+
textFallback?: boolean;
|
|
624
|
+
}): this;
|
|
625
|
+
/**
|
|
626
|
+
* Add a downloadable-file card (`GenAIFilePrimitive`). Confirmed in the same two forks'
|
|
627
|
+
* `fileSection()`/`fileArtifact()` helpers. Takes a plain URL directly (no media upload) — for a
|
|
628
|
+
* file you're uploading through WhatsApp's own media servers first, use `sock.sendMessage(jid,
|
|
629
|
+
* { document: buffer, ... })` and attach the result separately; this primitive only points at an
|
|
630
|
+
* already-hosted URL.
|
|
631
|
+
* @param {string} url
|
|
632
|
+
* @param {{title?: string, fileExtension?: string, fileLength?: number, pageCount?: number, previewImage?: object, textFallback?: boolean}} [options]
|
|
633
|
+
*/
|
|
634
|
+
addFile(url: string, opts36?: { [key: string]: any;
|
|
635
|
+
title?: string;
|
|
636
|
+
fileExtension?: string;
|
|
637
|
+
fileLength?: number;
|
|
638
|
+
pageCount?: number;
|
|
639
|
+
previewImage?: object;
|
|
640
|
+
textFallback?: boolean;
|
|
641
|
+
}): this;
|
|
642
|
+
/**
|
|
643
|
+
* Upload local content through WhatsApp's own media servers and add it as a file card — the
|
|
644
|
+
* `prepareFileArtifact()`/`sendHtmlArtifact()` path from yudzxml 7.6.6 / elaina 1.3.10, folded
|
|
645
|
+
* into this class via `setBotMetadata()` instead of that helper's standalone-function form. Use
|
|
646
|
+
* this instead of `addFile()` when there's no hosted URL yet — e.g. an HTML app you built
|
|
647
|
+
* in-process and want to ship as a downloadable file rather than inline via `addHTML()`.
|
|
648
|
+
* @param {string|Buffer|Uint8Array} content File content (a string is encoded as UTF-8).
|
|
649
|
+
* @param {{mimetype?: string, fileName?: string, title?: string, id?: string, textFallback?: boolean}} [options]
|
|
650
|
+
* @returns {Promise<this>}
|
|
651
|
+
*/
|
|
652
|
+
addUploadedFile(content: string | Buffer | Uint8Array, opts37?: { [key: string]: any;
|
|
653
|
+
mimetype?: string;
|
|
654
|
+
fileName?: string;
|
|
655
|
+
title?: string;
|
|
656
|
+
id?: string;
|
|
657
|
+
textFallback?: boolean;
|
|
658
|
+
}): Promise<this>;
|
|
659
|
+
/**
|
|
660
|
+
* Wrap one or more already-built primitives (e.g. items from another `AIRich` instance's
|
|
661
|
+
* `.items` getter, or hand-built `{ ..., __typename }` objects) in an `AddonAction` layout —
|
|
662
|
+
* a row of action buttons/pills attached to the primitives rather than a primitive itself.
|
|
663
|
+
* Confirmed in elaina 1.3.10's `metaai.js` (`addonActionSection()` — its own layout name,
|
|
664
|
+
* `'AddonAction'`, is also listed in `AI_RICH_LAYOUTS` in both forks' `extras.js`).
|
|
665
|
+
* @param {object[]} primitives Typed primitive objects (each must carry its own `__typename`).
|
|
666
|
+
* @param {{actionType?: string, alignment?: 'START'|'END'}} [options]
|
|
667
|
+
*/
|
|
668
|
+
addAddonAction(primitives?: object[], opts38?: { [key: string]: any;
|
|
669
|
+
actionType?: string;
|
|
670
|
+
alignment?: "START" | "END";
|
|
671
|
+
}): this;
|
|
672
|
+
/** Add a raw rich-response content-items carousel, matching Baileys' `items` field. */
|
|
673
|
+
addContentItems(items?: any[]): this;
|
|
674
|
+
/** Add a plain horizontal divider line (`GenAIDividerPrimitive`, no content). */
|
|
675
|
+
addDivider(): this;
|
|
676
|
+
/**
|
|
677
|
+
* Add an "AI is generating..." placeholder card (`GenAIImaginePrimitive` with status
|
|
678
|
+
* GENERATING) — distinct from addImage()/addVideo() which always send status READY.
|
|
679
|
+
* Use this to show a pending-generation state before the real media is ready.
|
|
680
|
+
* @param {{ imagine_type?: 'IMAGE'|'ANIMATE', estimated_completion_time?: number }} [options]
|
|
681
|
+
*/
|
|
682
|
+
addGenerating(opts59?: { [key: string]: any;
|
|
683
|
+
imagine_type?: "IMAGE" | "ANIMATE";
|
|
684
|
+
estimated_completion_time?: number;
|
|
685
|
+
}): this;
|
|
686
|
+
/** Add a large heading-style text block (`FOATextPrimitive`) — visually distinct from `addText()`'s regular paragraph text. */
|
|
687
|
+
addHeading(text: any): this;
|
|
688
|
+
/** Add an image inline with the surrounding text flow (falls back to a plain imageMessage on send() if the client can't render inline images — see skipImageFallback). */
|
|
689
|
+
addInlineImage(imageUrl: any, opts39?: { [key: string]: any;
|
|
690
|
+
text?: string;
|
|
691
|
+
alignment?: string;
|
|
692
|
+
tapLinkUrl?: string;
|
|
693
|
+
resolveUrl?: boolean;
|
|
694
|
+
}): this;
|
|
695
|
+
/** Add Baileys-compatible inline-video marker. WhatsApp's current rich-response helper carries this as a text marker. */
|
|
696
|
+
addInlineVideo(): this;
|
|
697
|
+
/**
|
|
698
|
+
* Add a rendered LaTeX expression (`GenAILatexUXPrimitive`), with a real `AI_RICH_RESPONSE_LATEX`
|
|
699
|
+
* submessage (unlike most primitives in this block, this one has a proper proto type).
|
|
700
|
+
* @param {string} expression LaTeX source, e.g. `'$$E = mc^2$$'`.
|
|
701
|
+
*/
|
|
702
|
+
addLatex(expression: string): this;
|
|
703
|
+
/**
|
|
704
|
+
* Add a pre-rendered LaTeX expression: `addLatex()` ships the raw expression string for the
|
|
705
|
+
* client to typeset itself; this ships an already-rendered image of it instead (real proto
|
|
706
|
+
* fields — `proto.AIRichResponseLatexMetadata.AIRichResponseLatexExpression`: url/width/height/
|
|
707
|
+
* fontHeight/padding — verified against WAProto/index.js, not guessed), for a caller that
|
|
708
|
+
* rendered the LaTeX server-side (e.g. via a LaTeX-to-PNG pipeline) and just wants the image shown.
|
|
709
|
+
* @param {string} expression Raw LaTeX source, still sent alongside the image as a fallback/caption.
|
|
710
|
+
* @param {{url: string, width?: number, height?: number, fontHeight?: number, topPadding?: number, leadingPadding?: number, bottomPadding?: number, trailingPadding?: number}} image
|
|
711
|
+
*/
|
|
712
|
+
addLatexPro(expression: string, image?: {
|
|
713
|
+
url: string;
|
|
714
|
+
width?: number;
|
|
715
|
+
height?: number;
|
|
716
|
+
fontHeight?: number;
|
|
717
|
+
topPadding?: number;
|
|
718
|
+
leadingPadding?: number;
|
|
719
|
+
bottomPadding?: number;
|
|
720
|
+
trailingPadding?: number;
|
|
721
|
+
}): this;
|
|
722
|
+
/**
|
|
723
|
+
* Add map annotations (real proto — `proto.AIRichResponseMapMetadata`: centerLatitude/
|
|
724
|
+
* centerLongitude/latitudeDelta/longitudeDelta/annotations[]/showInfoList — verified against
|
|
725
|
+
* WAProto/index.js, not guessed).
|
|
726
|
+
* @param {{number: number, latitude: number, longitude: number, title?: string, body?: string}[]} annotations
|
|
727
|
+
* @param {{centerLatitude?: number, centerLongitude?: number, latitudeDelta?: number, longitudeDelta?: number, showInfoList?: boolean}} [options]
|
|
728
|
+
*/
|
|
729
|
+
addMap(annotations?: {
|
|
730
|
+
number: number;
|
|
731
|
+
latitude: number;
|
|
732
|
+
longitude: number;
|
|
733
|
+
title?: string;
|
|
734
|
+
body?: string;
|
|
735
|
+
}[], options?: {
|
|
736
|
+
centerLatitude?: number;
|
|
737
|
+
centerLongitude?: number;
|
|
738
|
+
latitudeDelta?: number;
|
|
739
|
+
longitudeDelta?: number;
|
|
740
|
+
showInfoList?: boolean;
|
|
741
|
+
}): this;
|
|
742
|
+
/**
|
|
743
|
+
* Add an animated GIF (real proto — `proto.AIRichResponseDynamicMetadata`, `type` = the GIF
|
|
744
|
+
* value of `AIRichResponseDynamicMetadataType` — verified against WAProto/index.js, not
|
|
745
|
+
* guessed; `AI_RICH_RESPONSE_DYNAMIC_METADATA_TYPE_GIF` = 2).
|
|
746
|
+
* @param {string} url
|
|
747
|
+
* @param {{loopCount?: number, version?: number|string}} [options]
|
|
748
|
+
*/
|
|
749
|
+
addGif(url: string, opts40?: { [key: string]: any;
|
|
750
|
+
loopCount?: number;
|
|
751
|
+
version?: number | string;
|
|
752
|
+
}): this;
|
|
753
|
+
/** Build rich-response citation/link submessages using the same shape as Baileys' `links` content shortcut. */
|
|
754
|
+
addLinks(links?: any[]): this;
|
|
755
|
+
/**
|
|
756
|
+
* Add a "searching/working" progress banner (`GenAIBotProgressStatusPrimitive`) — a one-shot
|
|
757
|
+
* status chip (unlike `addSuggest`, this isn't tappable). Distinct from `addThinkingStatus()`'s
|
|
758
|
+
* icon/typename.
|
|
759
|
+
* @param {string} title
|
|
760
|
+
* @param {{icon?: string, is_in_progress?: boolean}} [options]
|
|
761
|
+
*/
|
|
762
|
+
addProgressStatus(title: string, opts41?: { [key: string]: any;
|
|
763
|
+
icon?: string;
|
|
764
|
+
is_in_progress?: boolean;
|
|
765
|
+
}): this;
|
|
766
|
+
/**
|
|
767
|
+
* Add a subscription-quota-limit upsell card (`GenAIMetaSubsQuotaUpsellPrimitive`).
|
|
768
|
+
* @param {{title: string, body?: string, body_line1?: string, body_line2?: string, buttons?: {label: string, action?: string, deeplink?: string}[]}} data
|
|
769
|
+
*/
|
|
770
|
+
addQuotaUpsell(data?: {
|
|
771
|
+
title: string;
|
|
772
|
+
body?: string;
|
|
773
|
+
body_line1?: string;
|
|
774
|
+
body_line2?: string;
|
|
775
|
+
buttons?: {
|
|
776
|
+
label: string;
|
|
777
|
+
action?: string;
|
|
778
|
+
deeplink?: string;
|
|
779
|
+
}[];
|
|
780
|
+
}): this;
|
|
781
|
+
/**
|
|
782
|
+
* Add several subscription-quota-limit upsell cards as one carousel-style block (each card is
|
|
783
|
+
* the same `GenAIMetaSubsQuotaUpsellPrimitive` shape `addQuotaUpsell()` uses — this just
|
|
784
|
+
* pushes them as one `primitives` array on a single layout instead of one `primitive` each, and
|
|
785
|
+
* applies the same OPEN_URL/`url` vs OPEN_DEEPLINK/`deeplink` fix per card).
|
|
786
|
+
* @param {{title: string, body?: string, body_line1?: string, body_line2?: string, buttons?: {label: string, action?: string, deeplink?: string, url?: string}[]}[]} cards
|
|
787
|
+
*/
|
|
788
|
+
addQuotaUpsellCards(cards?: {
|
|
789
|
+
title: string;
|
|
790
|
+
body?: string;
|
|
791
|
+
body_line1?: string;
|
|
792
|
+
body_line2?: string;
|
|
793
|
+
buttons?: {
|
|
794
|
+
label: string;
|
|
795
|
+
action?: string;
|
|
796
|
+
deeplink?: string;
|
|
797
|
+
url?: string;
|
|
798
|
+
}[];
|
|
799
|
+
}[]): this;
|
|
800
|
+
/** Builder-level default for `forwarded` (the "Forwarded" label + `forwardedAiBotMessageInfo`). `send({ forwarded })` still overrides per call. */
|
|
801
|
+
setForwarded(enabled?: boolean): this;
|
|
802
|
+
/** Builder-level default for `includesUnifiedResponse` (the `unifiedResponse` payload + the follow-up edit that gets the card past "download"). */
|
|
803
|
+
setIncludesUnifiedResponse(enabled?: boolean): this;
|
|
804
|
+
/** Builder-level default for `includesSubmessages` (the legacy `submessages[]` array). */
|
|
805
|
+
setIncludesSubmessages(enabled?: boolean): this;
|
|
806
|
+
/** Markdown text WITHOUT hyperlink/citation/LaTeX entity parsing -- for sending `_italic_` / `**bold**` / `code` exactly as typed. */
|
|
807
|
+
addTextRaw(text: any, opts42?: { [key: string]: any; }): this;
|
|
808
|
+
/** "In progress" status card (`GenAIBotProgressStatusPrimitive`); same as `addProgressStatus()` with the Go reference's defaults. */
|
|
809
|
+
addProgress(title?: string, icon?: string, options?: {}): this;
|
|
810
|
+
/** Quota-upsell card with text only (no button). */
|
|
811
|
+
addQuotaUpsellPlain(title: any, line1?: string, line2?: string): this;
|
|
812
|
+
/**
|
|
813
|
+
* Quota-upsell card with one custom button. Unlike the Go reference there is no default target link -- pass `deeplink` or `url`.
|
|
814
|
+
* @param {{action?: 'OPEN_DEEPLINK'|'OPEN_URL', deeplink?: string, url?: string}} [target]
|
|
815
|
+
*/
|
|
816
|
+
addQuotaUpsellCustom(title: any, line1: any, line2: any, label: any, opts43?: { [key: string]: any; }): this;
|
|
817
|
+
/** Quota-upsell card that is ONLY a button (no title/body). Requires `deeplink` or `url`. */
|
|
818
|
+
addQuotaUpsellBtnOnly(label?: string, opts44?: { [key: string]: any; }): this;
|
|
819
|
+
/**
|
|
820
|
+
* "Strict" quota-upsell card: only the fields you pass are sent. `body` is the field the client renders as the card's
|
|
821
|
+
* content (confirmed in the Go reference's strict mode); title and button are optional.
|
|
822
|
+
*/
|
|
823
|
+
addQuotaUpsellStrict(opts60?: { [key: string]: any; }): this;
|
|
824
|
+
/** Sponsored-story card (`GenAISearchAdPrimitive`). */
|
|
825
|
+
addSearchAd(opts61?: { [key: string]: any; }, options?: {}): this;
|
|
826
|
+
/** Recursive unified-response container (`GenAINestedUnifiedResponse`). Each field is an array of raw section / screen objects. */
|
|
827
|
+
addNestedUnified(opts62?: { [key: string]: any; }, options?: {}): this;
|
|
828
|
+
/** Third-party account-linking upsell (`GenAI3PAccountLinkingUpsellPrimitive`). */
|
|
829
|
+
add3PAccountLinking(opts63?: { [key: string]: any; }, options?: {}): this;
|
|
830
|
+
/** Search-planner steps card (`GenAISearchPlannerStepsPrimitive`); `data` is the raw primitive body (step shapes vary). */
|
|
831
|
+
addSearchPlannerSteps(data?: {}, options?: {}): this;
|
|
832
|
+
/** One search-planner step snippet (`GenAISearchPlannerStepSnippetPrimitive`). @param {string} status @param {string} [header] @param {object[]} [instructions] */
|
|
833
|
+
addSearchPlannerStepSnippet(status: string, header?: string, instructions?: object[], options?: {}): this;
|
|
834
|
+
/** Orchestrator search-engine primitive (`GenAIOrchestratorSearchEngine`); raw body. */
|
|
835
|
+
addOrchestratorSearchEngine(data?: {}, options?: {}): this;
|
|
836
|
+
/** Professional-consent primitive (`GenAIProfessionalConsentPrimitive`); raw body (many label/url fields). */
|
|
837
|
+
addProfessionalConsent(data?: {}, options?: {}): this;
|
|
838
|
+
/** Embedded contextual screen (`GenAIEmbeddedContextualScreenContent`, the "bloks_attachment" payload). */
|
|
839
|
+
addEmbeddedContextualScreen(type: any, data?: {}, opts45?: { [key: string]: any; }, options?: {}): this;
|
|
840
|
+
/**
|
|
841
|
+
* Experimental real layout container: push several already-built `GenAI*` primitives as ONE layout section
|
|
842
|
+
* (`GenAI<name>LayoutViewModel`, `primitives[]`). `addMultipleResponse` / `addFlexibleGrid` / `addVStack` are named
|
|
843
|
+
* shortcuts. (The Go reference only flattens these to text; this sends the real layout -- eval-test before relying on it.)
|
|
844
|
+
* @param {string} name Layout name, e.g. 'HScroll', 'Grid', 'MultipleResponse', 'FlexibleCountGrid', 'VStack'.
|
|
845
|
+
* @param {object[]} primitives Primitive objects, each with its own `__typename`.
|
|
846
|
+
*/
|
|
847
|
+
addLayout(name: string, primitives: object[], opts46?: { [key: string]: any; }): this;
|
|
848
|
+
/** `GenAIMultipleResponseLayoutViewModel`. */
|
|
849
|
+
addMultipleResponse(primitives: any, options?: {}): this;
|
|
850
|
+
/** `GenAIFlexibleCountGridLayoutViewModel`. */
|
|
851
|
+
addFlexibleGrid(primitives: any, options?: {}): this;
|
|
852
|
+
/** `GenAIVStackLayoutViewModel` (experimental). */
|
|
853
|
+
addVStack(primitives: any, options?: {}): this;
|
|
854
|
+
/**
|
|
855
|
+
* Pending options for the NEXT `add*()` / `set*()` call (Go `Opts`). Accepts `{ id, insertAt, replace }` or the positional
|
|
856
|
+
* `(id, insertAt, replace)` form. Inline options on that call take priority; the pending options are consumed either way.
|
|
857
|
+
*/
|
|
858
|
+
opts(idOrOpts: any, insertAt: any, replace: any): this;
|
|
859
|
+
_pendingOpts: {
|
|
860
|
+
[k: string]: any;
|
|
861
|
+
};
|
|
862
|
+
/** Like `opts()` with an insert offset (Go `OptsAt`): `offset` 0 = after the `insertAtId` block, negative = before it (-1 = directly before). */
|
|
863
|
+
optsAt(id: any, insertAtId: any, offset: number, replace: any): this;
|
|
864
|
+
/** JSON snapshot for `JSON.stringify(rich)` (Go `MarshalJSON`): response id, title/footer, sections, submessages, embedded screens. */
|
|
865
|
+
toJSON(): {
|
|
866
|
+
response_id: any;
|
|
867
|
+
bot_response_id: any;
|
|
868
|
+
title: string;
|
|
869
|
+
footer: string;
|
|
870
|
+
sections: any[];
|
|
871
|
+
submessages: any[];
|
|
872
|
+
embedded_screens: any[];
|
|
873
|
+
};
|
|
874
|
+
/** Minimal botMetadata envelope: drops the notification fields so only disclaimer / response id / verification / extras remain (Go `SetRawEnvelope`). */
|
|
875
|
+
setRawEnvelope(enabled?: boolean): this;
|
|
876
|
+
/** Register async work (fetch, resolve, ...) that runs concurrently at the start of `build()` (Go `Defer`). @param {() => any} fn */
|
|
877
|
+
defer(fn: () => any): this;
|
|
878
|
+
/** Remove a block by id; unlike `delete(id)` this is a silent no-op when the id is unknown (Go `DeleteSection`). */
|
|
879
|
+
deleteSection(id: any): this;
|
|
880
|
+
/** Current unified-response id. */
|
|
881
|
+
get responseId(): any;
|
|
882
|
+
/** Current bot response id. */
|
|
883
|
+
get botResponseId(): any;
|
|
884
|
+
/** Option-object form of `addImage()` (Go `AddImageOpts`). @param {{urls: string|Buffer|Array<string|Buffer>, width?: number, height?: number, status?: string, updateText?: string}} o */
|
|
885
|
+
addImageOpts(opts64?: { [key: string]: any;
|
|
886
|
+
urls: string | Buffer | Array<string | Buffer>;
|
|
887
|
+
width?: number;
|
|
888
|
+
height?: number;
|
|
889
|
+
status?: string;
|
|
890
|
+
updateText?: string;
|
|
891
|
+
}): this;
|
|
892
|
+
/** Option-object form of `addVideo()` (Go `AddVideoOpts`). @param {string|Buffer|{url: string, file_length?: number, duration?: number, thumbnail?: any, mime_type?: string, status?: string, estimatedTime?: number}} v */
|
|
893
|
+
addVideoOpts(v: string | Buffer | {
|
|
894
|
+
url: string;
|
|
895
|
+
file_length?: number;
|
|
896
|
+
duration?: number;
|
|
897
|
+
thumbnail?: any;
|
|
898
|
+
mime_type?: string;
|
|
899
|
+
status?: string;
|
|
900
|
+
estimatedTime?: number;
|
|
901
|
+
}, extra?: {}): this;
|
|
902
|
+
/** Several videos in ONE block with a single alert (Go `AddVideos`). Same as passing an array to `addVideo()`. */
|
|
903
|
+
addVideos(videos: any, options?: {}): this;
|
|
904
|
+
/** Follow-up pills with an explicit layout (Go `AddSuggestLayout`). Same as `addSuggest(list, { scroll, layout })`. */
|
|
905
|
+
addSuggestLayout(suggestions: any, scroll: boolean, layout: any): this;
|
|
906
|
+
/** Single follow-up pill (Go `AddChainingSuggestion`; the Go prompt-id argument is unused there too). */
|
|
907
|
+
addChainingSuggestion(prompt: any, options?: {}): this;
|
|
908
|
+
/** Raw progress/thinking primitive: any extra fields pass through; `__typename` is forced to `GenAIBotProgressStatusPrimitive` (Go `AddThinkingFull`). */
|
|
909
|
+
addThinkingFull(primitive?: {}, opts47?: { [key: string]: any; }): this;
|
|
910
|
+
/** AI "thinking" status line (Go `AddBotThinking`). `status` THINKING/GENERATING render as in-progress, anything else as done. */
|
|
911
|
+
addBotThinking(status?: string, updateText?: string, opts48?: { [key: string]: any; }): this;
|
|
912
|
+
/** Source list with per-source subtitle (Go `AddSourceFull`). @param {{title: string, subtitle?: string, url: string, icon?: string|Buffer}[]} sources */
|
|
913
|
+
addSourceFull(sources?: {
|
|
914
|
+
title: string;
|
|
915
|
+
subtitle?: string;
|
|
916
|
+
url: string;
|
|
917
|
+
icon?: string | Buffer;
|
|
918
|
+
}[], opts49?: { [key: string]: any; }): this;
|
|
919
|
+
/**
|
|
920
|
+
* Compact entity card (`GenAICompactEntityPrimitive`: title / subtitle / secondary_subtitle / image / entity id+url+type / action type).
|
|
921
|
+
* Pass `{ asText: true }` for the Go reference's markdown fallback card instead (renders everywhere).
|
|
922
|
+
*/
|
|
923
|
+
addCompactEntity(opts65?: { [key: string]: any; }, opts50?: { [key: string]: any;
|
|
924
|
+
asText?: boolean;
|
|
925
|
+
}): this;
|
|
926
|
+
/** "Generating..." image placeholder (`GenAIImaginePrimitive`, imagine_type IMAGINE, status GENERATING; Go `AddGenerate`). Also sets `botMetadata.imagineMetadata`. */
|
|
927
|
+
addGenerate(updateText?: string, opts51?: { [key: string]: any; }): this;
|
|
928
|
+
/**
|
|
929
|
+
* Video via `GenAIVideoPrimitive` (media + optional music clip + delivery urls + lip-sync flag) -- distinct from `addVideo()`,
|
|
930
|
+
* which uses `GenAIImaginePrimitive`/ANIMATE (Go `AddVideoPrimitive`). Experimental.
|
|
931
|
+
* @param {{url?: string|Buffer, mimeType?: string, fileLength?: number, durationMs?: number, width?: number, height?: number, thumbnail?: string|Buffer,
|
|
932
|
+
* isLipSync?: boolean, musicClip?: {hasMusic?: boolean, songTitle?: string, artistName?: string, audioAssetId?: string, progressiveUri?: string, coverImageUri?: string},
|
|
933
|
+
* delivery?: {progressiveUrls?: string[], dashManifests?: string[], manifestXml?: string}}} v
|
|
934
|
+
*/
|
|
935
|
+
addVideoPrimitive(opts66?: { [key: string]: any;
|
|
936
|
+
url?: string | Buffer;
|
|
937
|
+
mimeType?: string;
|
|
938
|
+
fileLength?: number;
|
|
939
|
+
durationMs?: number;
|
|
940
|
+
width?: number;
|
|
941
|
+
height?: number;
|
|
942
|
+
thumbnail?: string | Buffer;
|
|
943
|
+
isLipSync?: boolean;
|
|
944
|
+
musicClip?: {
|
|
945
|
+
hasMusic?: boolean;
|
|
946
|
+
songTitle?: string;
|
|
947
|
+
artistName?: string;
|
|
948
|
+
audioAssetId?: string;
|
|
949
|
+
progressiveUri?: string;
|
|
950
|
+
coverImageUri?: string;
|
|
951
|
+
};
|
|
952
|
+
delivery?: {
|
|
953
|
+
progressiveUrls?: string[];
|
|
954
|
+
dashManifests?: string[];
|
|
955
|
+
manifestXml?: string;
|
|
956
|
+
};
|
|
957
|
+
}, options?: {}): this;
|
|
958
|
+
/**
|
|
959
|
+
* Pure-primitive LaTeX run (`GenAILatexUXPrimitive`: media + latex_expression + font_height + padding; Go `AddLatexUX`). Experimental --
|
|
960
|
+
* needs a pre-rendered equation image `url`; for the inline-entity mechanism that is known to render, use `addLatex()`.
|
|
961
|
+
*/
|
|
962
|
+
addLatexUX(opts67?: { [key: string]: any;
|
|
963
|
+
mimeType?: string;
|
|
964
|
+
}, options?: {}): this;
|
|
965
|
+
/** Sports match card as formatted text (Go `AddSportsWidget`). */
|
|
966
|
+
addSportsWidget(opts68?: { [key: string]: any; }, options?: {}): this;
|
|
967
|
+
/** Follow-up prompt card as text (Go `AddClippyFollowUp`). */
|
|
968
|
+
addClippyFollowUp(opts69?: { [key: string]: any; }, options?: {}): this;
|
|
969
|
+
/** Pinned header/subtitle card as text (Go `AddClippyWidget`). */
|
|
970
|
+
addClippyWidget(header: any, subtitle?: string, options?: {}): this;
|
|
971
|
+
/** Privacy/transparency note as text (Go `AddP13N`). */
|
|
972
|
+
addP13N(text?: string, options?: {}): this;
|
|
973
|
+
/** Location-permission prompt line as text (Go `AddLocationPermission`). */
|
|
974
|
+
addLocationPermission(placeholder?: string, options?: {}): this;
|
|
975
|
+
/** Timestamp placeholder line as text (Go `AddTimestampPlaceholder`). */
|
|
976
|
+
addTimestampPlaceholder(placeholder?: string, options?: {}): this;
|
|
977
|
+
/** Deep-link line as a markdown link (Go `AddDeeplinkItem`); falls back to the Android deeplink when `deepLinkUrl` is empty. */
|
|
978
|
+
addDeeplinkItem(deepLinkUrl: any, androidDeeplinkUrl: any, opts52?: { [key: string]: any;
|
|
979
|
+
label?: string;
|
|
980
|
+
}): this;
|
|
981
|
+
/** Go-name alias of `loadFrom()`. */
|
|
982
|
+
loadFromMessage(msg: any): this;
|
|
983
|
+
/** Add blank vertical spacing (`GenAISpacerPrimitive`). @param {number} [spacing=1] Spacing unit, per observed traffic. */
|
|
984
|
+
addSpacer(spacing?: number): this;
|
|
985
|
+
/**
|
|
986
|
+
* Add a task/checklist card (`GenAITaskPrimitive`).
|
|
987
|
+
* @param {{task_id?: string, title: string, subtitle?: string, status?: string}} data
|
|
988
|
+
*/
|
|
989
|
+
addTask(data?: {
|
|
990
|
+
task_id?: string;
|
|
991
|
+
title: string;
|
|
992
|
+
subtitle?: string;
|
|
993
|
+
status?: string;
|
|
994
|
+
}): this;
|
|
995
|
+
/**
|
|
996
|
+
* Batch version of `addTask()` — one or more task/checklist cards (`GenAITaskPrimitive`) pushed
|
|
997
|
+
* as a single `primitives` array on one layout, instead of one `addTask()` call (and one
|
|
998
|
+
* `_sections` entry) per task.
|
|
999
|
+
* @param {{task_id?: string, title: string, subtitle?: string, status?: string}[]} tasks
|
|
1000
|
+
* @param {{textFallback?: boolean}} [options]
|
|
1001
|
+
*/
|
|
1002
|
+
addTasks(tasks?: {
|
|
1003
|
+
task_id?: string;
|
|
1004
|
+
title: string;
|
|
1005
|
+
subtitle?: string;
|
|
1006
|
+
status?: string;
|
|
1007
|
+
}[], opts53?: { [key: string]: any;
|
|
1008
|
+
textFallback?: boolean;
|
|
1009
|
+
}): this;
|
|
1010
|
+
/** Add a "thinking" status banner (`GenAIBotThinkingStatusPrimitive`). See `addProgressStatus()`. */
|
|
1011
|
+
addThinkingStatus(title: any, opts54?: { [key: string]: any;
|
|
1012
|
+
icon?: string;
|
|
1013
|
+
is_in_progress?: boolean;
|
|
1014
|
+
textFallback?: boolean;
|
|
1015
|
+
}): this;
|
|
1016
|
+
#private;
|
|
1017
|
+
}
|
|
1018
|
+
/** Thin no-op subclass of `AIRich` — kept for drop-in compatibility with code ported from ourin-baileys that references `ORich` by name. */
|
|
1019
|
+
export class ORich extends AIRich {
|
|
1020
|
+
}
|
|
1021
|
+
import { BaseBuilder } from './shared.js';
|