@vanzxy/baileys 2.0.0
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/NOTICE.md +111 -0
- package/README.md +830 -0
- package/WAProto/index.d.ts +9 -0
- package/WAProto/index.js +142036 -0
- package/engine-requirements.js +13 -0
- package/lib/Defaults/index.d.ts +152 -0
- package/lib/Defaults/index.js +179 -0
- package/lib/Framework/Bot.js +209 -0
- package/lib/Framework/Context.js +90 -0
- package/lib/Framework/MediaManager.js +152 -0
- package/lib/Framework/SessionManager.js +34 -0
- package/lib/Framework/StatsManager.js +120 -0
- package/lib/Framework/Store/SQLiteStore.js +74 -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 +12 -0
- package/lib/Signal/Group/group-session-builder.d.ts +7 -0
- package/lib/Signal/Group/group-session-builder.js +30 -0
- package/lib/Signal/Group/group_cipher.d.ts +10 -0
- package/lib/Signal/Group/group_cipher.js +82 -0
- package/lib/Signal/Group/index.d.ts +11 -0
- package/lib/Signal/Group/index.js +12 -0
- package/lib/Signal/Group/keyhelper.d.ts +6 -0
- package/lib/Signal/Group/keyhelper.js +18 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
- package/lib/Signal/Group/sender-chain-key.js +26 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
- package/lib/Signal/Group/sender-key-message.d.ts +18 -0
- package/lib/Signal/Group/sender-key-message.js +66 -0
- package/lib/Signal/Group/sender-key-name.d.ts +11 -0
- package/lib/Signal/Group/sender-key-name.js +48 -0
- package/lib/Signal/Group/sender-key-record.d.ts +12 -0
- package/lib/Signal/Group/sender-key-record.js +41 -0
- package/lib/Signal/Group/sender-key-state.d.ts +16 -0
- package/lib/Signal/Group/sender-key-state.js +84 -0
- package/lib/Signal/Group/sender-message-key.d.ts +11 -0
- package/lib/Signal/Group/sender-message-key.js +26 -0
- package/lib/Signal/libsignal.d.ts +54 -0
- package/lib/Signal/libsignal.js +431 -0
- package/lib/Signal/lid-mapping.d.ts +20 -0
- package/lib/Signal/lid-mapping.js +277 -0
- package/lib/Socket/Client/index.d.ts +2 -0
- package/lib/Socket/Client/index.js +3 -0
- package/lib/Socket/Client/types.d.ts +5 -0
- package/lib/Socket/Client/types.js +11 -0
- package/lib/Socket/Client/websocket.d.ts +12 -0
- package/lib/Socket/Client/websocket.js +54 -0
- package/lib/Socket/business.d.ts +395 -0
- package/lib/Socket/business.js +380 -0
- package/lib/Socket/chats.d.ts +136 -0
- package/lib/Socket/chats.js +1328 -0
- package/lib/Socket/communities.d.ts +561 -0
- package/lib/Socket/communities.js +434 -0
- package/lib/Socket/dugong.d.ts +117 -0
- package/lib/Socket/dugong.js +799 -0
- package/lib/Socket/groups.d.ts +285 -0
- package/lib/Socket/groups.js +355 -0
- package/lib/Socket/index.d.ts +531 -0
- package/lib/Socket/index.js +34 -0
- package/lib/Socket/messages-recv.d.ts +333 -0
- package/lib/Socket/messages-recv.js +1782 -0
- package/lib/Socket/messages-send.d.ts +329 -0
- package/lib/Socket/messages-send.js +1383 -0
- package/lib/Socket/mex.d.ts +1 -0
- package/lib/Socket/mex.js +42 -0
- package/lib/Socket/newsletter.d.ts +281 -0
- package/lib/Socket/newsletter.js +321 -0
- package/lib/Socket/socket.d.ts +60 -0
- package/lib/Socket/socket.js +1001 -0
- package/lib/Socket/username.js +153 -0
- package/lib/Store/index.d.ts +3 -0
- package/lib/Store/index.js +4 -0
- package/lib/Store/make-in-memory-store.d.ts +62 -0
- package/lib/Store/make-in-memory-store.js +429 -0
- package/lib/Store/make-ordered-dictionary.d.ts +12 -0
- package/lib/Store/make-ordered-dictionary.js +79 -0
- package/lib/Store/object-repository.d.ts +10 -0
- package/lib/Store/object-repository.js +24 -0
- package/lib/Types/Auth.d.ts +117 -0
- package/lib/Types/Auth.js +2 -0
- package/lib/Types/Bussines.d.ts +25 -0
- package/lib/Types/Bussines.js +2 -0
- package/lib/Types/Call.d.ts +15 -0
- package/lib/Types/Call.js +2 -0
- package/lib/Types/Chat.d.ts +124 -0
- package/lib/Types/Chat.js +8 -0
- package/lib/Types/Contact.d.ts +26 -0
- package/lib/Types/Contact.js +2 -0
- package/lib/Types/Events.d.ts +256 -0
- package/lib/Types/Events.js +2 -0
- package/lib/Types/GroupMetadata.d.ts +71 -0
- package/lib/Types/GroupMetadata.js +2 -0
- package/lib/Types/Label.d.ts +2 -0
- package/lib/Types/Label.js +25 -0
- package/lib/Types/LabelAssociation.d.ts +2 -0
- package/lib/Types/LabelAssociation.js +7 -0
- package/lib/Types/Message.d.ts +11 -0
- package/lib/Types/Message.js +18 -0
- package/lib/Types/Mex.d.ts +2 -0
- package/lib/Types/Mex.js +39 -0
- package/lib/Types/Product.d.ts +79 -0
- package/lib/Types/Product.js +2 -0
- package/lib/Types/RichType.d.ts +2 -0
- package/lib/Types/RichType.js +23 -0
- package/lib/Types/Signal.d.ts +87 -0
- package/lib/Types/Signal.js +2 -0
- package/lib/Types/Socket.d.ts +136 -0
- package/lib/Types/Socket.js +2 -0
- package/lib/Types/State.d.ts +5 -0
- package/lib/Types/State.js +56 -0
- package/lib/Types/USync.d.ts +26 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/index.d.ts +66 -0
- package/lib/Types/index.js +26 -0
- package/lib/Utils/A2UI.js +277 -0
- package/lib/Utils/MessageBuilder.js +4405 -0
- package/lib/Utils/MessageBuilder_d.ts +411 -0
- package/lib/Utils/PersistentStore.js +592 -0
- package/lib/Utils/PersistentStore_d.ts +60 -0
- package/lib/Utils/anti-delete.d.ts +74 -0
- package/lib/Utils/anti-delete.js +222 -0
- package/lib/Utils/auth-utils.d.ts +57 -0
- package/lib/Utils/auth-utils.js +307 -0
- package/lib/Utils/auto-reply.d.ts +47 -0
- package/lib/Utils/auto-reply.js +158 -0
- package/lib/Utils/baileys-event-stream.d.ts +8 -0
- package/lib/Utils/baileys-event-stream.js +62 -0
- package/lib/Utils/browser-utils.d.ts +8 -0
- package/lib/Utils/browser-utils.js +28 -0
- package/lib/Utils/business.d.ts +49 -0
- package/lib/Utils/business.js +240 -0
- package/lib/Utils/button-helper-utils.js +314 -0
- package/lib/Utils/button-sender.js +824 -0
- package/lib/Utils/chat-control.d.ts +159 -0
- package/lib/Utils/chat-control.js +232 -0
- package/lib/Utils/chat-history-helpers.d.ts +21 -0
- package/lib/Utils/chat-history-helpers.js +71 -0
- package/lib/Utils/chat-utils.d.ts +407 -0
- package/lib/Utils/chat-utils.js +886 -0
- package/lib/Utils/companion-reg-client-utils.d.ts +4 -0
- package/lib/Utils/companion-reg-client-utils.js +40 -0
- package/lib/Utils/crypto.d.ts +41 -0
- package/lib/Utils/crypto.js +148 -0
- package/lib/Utils/decode-wa-message.d.ts +83 -0
- package/lib/Utils/decode-wa-message.js +317 -0
- package/lib/Utils/event-buffer.d.ts +12 -0
- package/lib/Utils/event-buffer.js +636 -0
- package/lib/Utils/generics.d.ts +69 -0
- package/lib/Utils/generics.js +439 -0
- package/lib/Utils/history.d.ts +90 -0
- package/lib/Utils/history.js +147 -0
- package/lib/Utils/identity-change-handler.d.ts +13 -0
- package/lib/Utils/identity-change-handler.js +50 -0
- package/lib/Utils/index.d.ts +39 -0
- package/lib/Utils/index.js +46 -0
- package/lib/Utils/link-preview.d.ts +12 -0
- package/lib/Utils/link-preview.js +85 -0
- package/lib/Utils/logger.d.ts +2 -0
- package/lib/Utils/logger.js +3 -0
- package/lib/Utils/lt-hash.d.ts +12 -0
- package/lib/Utils/lt-hash.js +27 -0
- package/lib/Utils/make-mutex.d.ts +6 -0
- package/lib/Utils/make-mutex.js +33 -0
- package/lib/Utils/media-messages.d.ts +18 -0
- package/lib/Utils/media-messages.js +71 -0
- package/lib/Utils/media-set.d.ts +13 -0
- package/lib/Utils/media-set.js +172 -0
- package/lib/Utils/message-kind.js +139 -0
- package/lib/Utils/message-retry-manager.d.ts +79 -0
- package/lib/Utils/message-retry-manager.js +265 -0
- package/lib/Utils/message-search.d.ts +44 -0
- package/lib/Utils/message-search.js +189 -0
- package/lib/Utils/messages-media.d.ts +135 -0
- package/lib/Utils/messages-media.js +869 -0
- package/lib/Utils/messages.d.ts +44 -0
- package/lib/Utils/messages.js +2155 -0
- package/lib/Utils/noise-handler.d.ts +20 -0
- package/lib/Utils/noise-handler.js +201 -0
- package/lib/Utils/offline-node-processor.d.ts +9 -0
- package/lib/Utils/offline-node-processor.js +40 -0
- package/lib/Utils/past-participants.d.ts +14 -0
- package/lib/Utils/past-participants.js +40 -0
- package/lib/Utils/pre-key-manager.d.ts +25 -0
- package/lib/Utils/pre-key-manager.js +106 -0
- package/lib/Utils/process-message.d.ts +82 -0
- package/lib/Utils/process-message.js +809 -0
- package/lib/Utils/reporting-utils.d.ts +12 -0
- package/lib/Utils/reporting-utils.js +258 -0
- package/lib/Utils/rich-message-utils.d.ts +48 -0
- package/lib/Utils/rich-message-utils.js +445 -0
- package/lib/Utils/scheduling.d.ts +42 -0
- package/lib/Utils/scheduling.js +140 -0
- package/lib/Utils/signal.d.ts +82 -0
- package/lib/Utils/signal.js +201 -0
- package/lib/Utils/stanza-ack.d.ts +16 -0
- package/lib/Utils/stanza-ack.js +38 -0
- package/lib/Utils/status.d.ts +50 -0
- package/lib/Utils/status.js +108 -0
- package/lib/Utils/stickerpack.d.ts +51 -0
- package/lib/Utils/stickerpack.js +275 -0
- package/lib/Utils/sync-action-utils.d.ts +2 -0
- package/lib/Utils/sync-action-utils.js +49 -0
- package/lib/Utils/tc-token-utils.d.ts +29 -0
- package/lib/Utils/tc-token-utils.js +163 -0
- package/lib/Utils/templates.d.ts +76 -0
- package/lib/Utils/templates.js +151 -0
- package/lib/Utils/use-cache-manager-auth-state.d.ts +13 -0
- package/lib/Utils/use-cache-manager-auth-state.js +82 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +10 -0
- package/lib/Utils/use-multi-file-auth-state.js +167 -0
- package/lib/Utils/use-single-file-auth-state.d.ts +10 -0
- package/lib/Utils/use-single-file-auth-state.js +114 -0
- package/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
- package/lib/Utils/use-sqlite-auth-state.js +170 -0
- package/lib/Utils/validate-connection.d.ts +42 -0
- package/lib/Utils/validate-connection.js +199 -0
- package/lib/Utils/vcard.d.ts +58 -0
- package/lib/Utils/vcard.js +105 -0
- package/lib/VoIP/audio-feeder.d.ts +15 -0
- package/lib/VoIP/audio-feeder.js +132 -0
- package/lib/VoIP/index.js +277 -0
- package/lib/VoIP/relay-transport.d.ts +43 -0
- package/lib/VoIP/relay-transport.js +559 -0
- package/lib/VoIP/signaling.js +624 -0
- package/lib/VoIP/types.d.ts +69 -0
- package/lib/VoIP/types.js +17 -0
- package/lib/VoIP/wasm-engine.d.ts +103 -0
- package/lib/VoIP/wasm-engine.js +1214 -0
- package/lib/VoIP/worker-bootstrap.js +1042 -0
- package/lib/WABinary/constants.d.ts +61 -0
- package/lib/WABinary/constants.js +1467 -0
- package/lib/WABinary/decode.d.ts +9 -0
- package/lib/WABinary/decode.js +262 -0
- package/lib/WABinary/encode.d.ts +2 -0
- package/lib/WABinary/encode.js +220 -0
- package/lib/WABinary/generic-utils.d.ts +74 -0
- package/lib/WABinary/generic-utils.js +277 -0
- package/lib/WABinary/index.d.ts +5 -0
- package/lib/WABinary/index.js +6 -0
- package/lib/WABinary/jid-utils.d.ts +28 -0
- package/lib/WABinary/jid-utils.js +96 -0
- package/lib/WABinary/types.d.ts +19 -0
- package/lib/WABinary/types.js +2 -0
- package/lib/WAM/BinaryInfo.d.ts +7 -0
- package/lib/WAM/BinaryInfo.js +10 -0
- package/lib/WAM/constants.d.ts +34926 -0
- package/lib/WAM/constants.js +22853 -0
- package/lib/WAM/encode.d.ts +1 -0
- package/lib/WAM/encode.js +150 -0
- package/lib/WAM/index.d.ts +3 -0
- package/lib/WAM/index.js +4 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +36 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +52 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +29 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +63 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +27 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +38 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +9 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +38 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +14 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
- package/lib/WAUSync/Protocols/index.d.ts +7 -0
- package/lib/WAUSync/Protocols/index.js +8 -0
- package/lib/WAUSync/USyncQuery.d.ts +20 -0
- package/lib/WAUSync/USyncQuery.js +122 -0
- package/lib/WAUSync/USyncUser.d.ts +16 -0
- package/lib/WAUSync/USyncUser.js +31 -0
- package/lib/WAUSync/index.d.ts +3 -0
- package/lib/WAUSync/index.js +4 -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/index.d.ts +12 -0
- package/lib/index.js +20 -0
- package/package.json +175 -0
- package/postinstall-banner.js +56 -0
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type declarations for lib/Utils/MessageBuilder.js
|
|
3
|
+
* Hand-written (this file had no .d.ts before — not shipped by upstream
|
|
4
|
+
* either). Public chaining API only; internal/private members omitted.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const MESSAGE_BUILDER_VERSION: string; // '4.7'
|
|
8
|
+
|
|
9
|
+
export abstract class BaseBuilder {
|
|
10
|
+
setTitle(title: string): this;
|
|
11
|
+
setSubtitle(subtitle: string): this;
|
|
12
|
+
setBody(body: string): this;
|
|
13
|
+
setFooter(footer: string): this;
|
|
14
|
+
setContextInfo(obj: Record<string, any>): this;
|
|
15
|
+
addPayload(obj: Record<string, any>): this;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface LimitedTimeOfferParams {
|
|
19
|
+
text?: string;
|
|
20
|
+
url?: string;
|
|
21
|
+
copy_code?: string;
|
|
22
|
+
expiration_time?: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface BottomSheetParams {
|
|
26
|
+
in_thread_buttons_limit?: number;
|
|
27
|
+
divider_indices?: number[];
|
|
28
|
+
list_title?: string;
|
|
29
|
+
button_title?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface TapTargetConfigurationParams {
|
|
33
|
+
title?: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
canonical_url?: string;
|
|
36
|
+
domain?: string;
|
|
37
|
+
buttonIndex?: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A2UI/Bloks "basic" catalog node types — confirmed from captured traffic (see
|
|
42
|
+
* /areas/vanzxy-baileys.md), not a public spec, so treat this as best-effort autocomplete
|
|
43
|
+
* rather than an exhaustive guarantee. `ref` is a builder-only tag (stripped before send) so
|
|
44
|
+
* another node can reference this one via `BloksRef`.
|
|
45
|
+
*/
|
|
46
|
+
export interface BloksRef {
|
|
47
|
+
$ref: string;
|
|
48
|
+
}
|
|
49
|
+
export interface BloksNodeBase {
|
|
50
|
+
/** Builder-only tag so another node can reference this one via `{ $ref: ref }`. Stripped before send. */
|
|
51
|
+
ref?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface ColumnRowNode extends BloksNodeBase {
|
|
54
|
+
component: 'Column' | 'Row';
|
|
55
|
+
weight?: number;
|
|
56
|
+
justify?: string;
|
|
57
|
+
children?: BloksNode[];
|
|
58
|
+
}
|
|
59
|
+
export interface TextNode extends BloksNodeBase {
|
|
60
|
+
component: 'Text';
|
|
61
|
+
text: string;
|
|
62
|
+
variant?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface IconNode extends BloksNodeBase {
|
|
65
|
+
component: 'Icon';
|
|
66
|
+
name: string;
|
|
67
|
+
}
|
|
68
|
+
export interface DividerNode extends BloksNodeBase {
|
|
69
|
+
component: 'Divider';
|
|
70
|
+
}
|
|
71
|
+
export interface ImageNode extends BloksNodeBase {
|
|
72
|
+
component: 'Image';
|
|
73
|
+
url: string;
|
|
74
|
+
variant?: string;
|
|
75
|
+
fit?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface VideoNode extends BloksNodeBase {
|
|
78
|
+
component: 'Video';
|
|
79
|
+
url: string;
|
|
80
|
+
}
|
|
81
|
+
export interface ListNode extends BloksNodeBase {
|
|
82
|
+
component: 'List';
|
|
83
|
+
children?: BloksNode[];
|
|
84
|
+
}
|
|
85
|
+
export interface TextFieldNode extends BloksNodeBase {
|
|
86
|
+
component: 'TextField';
|
|
87
|
+
label?: string;
|
|
88
|
+
value?: string;
|
|
89
|
+
variant?: string;
|
|
90
|
+
}
|
|
91
|
+
export interface DateTimeInputNode extends BloksNodeBase {
|
|
92
|
+
component: 'DateTimeInput';
|
|
93
|
+
label?: string;
|
|
94
|
+
value?: string;
|
|
95
|
+
enableDate?: boolean;
|
|
96
|
+
enableTime?: boolean;
|
|
97
|
+
}
|
|
98
|
+
export interface SliderNode extends BloksNodeBase {
|
|
99
|
+
component: 'Slider';
|
|
100
|
+
label?: string;
|
|
101
|
+
min?: number;
|
|
102
|
+
max?: number;
|
|
103
|
+
value?: number;
|
|
104
|
+
}
|
|
105
|
+
export interface CheckBoxNode extends BloksNodeBase {
|
|
106
|
+
component: 'CheckBox';
|
|
107
|
+
label?: string;
|
|
108
|
+
value?: boolean;
|
|
109
|
+
}
|
|
110
|
+
export interface ChoicePickerNode extends BloksNodeBase {
|
|
111
|
+
component: 'ChoicePicker';
|
|
112
|
+
label?: string;
|
|
113
|
+
variant?: string;
|
|
114
|
+
displayStyle?: string;
|
|
115
|
+
options?: Array<{ label: string; value: string }>;
|
|
116
|
+
value?: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Unlike the CTA/native-flow `Button` class elsewhere in this file, an A2UI Button node has no
|
|
120
|
+
* `label`/`type`+`name` — its label comes from a nested `child` (usually a `Text` node), and
|
|
121
|
+
* tapping it fires `action.call` (with `action.args`), not a native-flow button name.
|
|
122
|
+
*/
|
|
123
|
+
export interface BloksButtonNode extends BloksNodeBase {
|
|
124
|
+
component: 'Button';
|
|
125
|
+
child?: BloksNode;
|
|
126
|
+
variant?: string;
|
|
127
|
+
action?: { call: string; args?: Record<string, any> };
|
|
128
|
+
}
|
|
129
|
+
export interface ModalNode extends BloksNodeBase {
|
|
130
|
+
component: 'Modal';
|
|
131
|
+
trigger: string | BloksRef;
|
|
132
|
+
content: BloksNode | string | BloksRef;
|
|
133
|
+
}
|
|
134
|
+
export interface TabsNode extends BloksNodeBase {
|
|
135
|
+
component: 'Tabs';
|
|
136
|
+
tabs: Array<{ title: string; child: BloksNode }>;
|
|
137
|
+
}
|
|
138
|
+
export interface CardNode extends BloksNodeBase {
|
|
139
|
+
component: 'Card';
|
|
140
|
+
child?: BloksNode;
|
|
141
|
+
}
|
|
142
|
+
export interface AudioPlayerNode extends BloksNodeBase {
|
|
143
|
+
component: 'AudioPlayer';
|
|
144
|
+
url: string;
|
|
145
|
+
description?: string;
|
|
146
|
+
}
|
|
147
|
+
/** Fallback for components not yet confirmed on the wire — still works at runtime, just no prop-level autocomplete. */
|
|
148
|
+
export interface AnyBloksNode extends BloksNodeBase {
|
|
149
|
+
component: string;
|
|
150
|
+
[key: string]: any;
|
|
151
|
+
}
|
|
152
|
+
export type BloksNode =
|
|
153
|
+
| ColumnRowNode
|
|
154
|
+
| TextNode
|
|
155
|
+
| IconNode
|
|
156
|
+
| DividerNode
|
|
157
|
+
| ImageNode
|
|
158
|
+
| VideoNode
|
|
159
|
+
| ListNode
|
|
160
|
+
| TextFieldNode
|
|
161
|
+
| DateTimeInputNode
|
|
162
|
+
| SliderNode
|
|
163
|
+
| CheckBoxNode
|
|
164
|
+
| ChoicePickerNode
|
|
165
|
+
| BloksButtonNode
|
|
166
|
+
| ModalNode
|
|
167
|
+
| TabsNode
|
|
168
|
+
| CardNode
|
|
169
|
+
| AudioPlayerNode
|
|
170
|
+
| AnyBloksNode;
|
|
171
|
+
|
|
172
|
+
export class Button extends BaseBuilder {
|
|
173
|
+
constructor(client: any);
|
|
174
|
+
setVideo(path: string | Buffer, options?: Record<string, any>): this;
|
|
175
|
+
setImage(path: string | Buffer, options?: Record<string, any>): this;
|
|
176
|
+
setDocument(path: string | Buffer, options?: Record<string, any>): this;
|
|
177
|
+
setMedia(obj: Record<string, any>): this;
|
|
178
|
+
clearButtons(): this;
|
|
179
|
+
setParams(obj: Record<string, any>): this;
|
|
180
|
+
setBloksWidget(tree: BloksNode, options?: { uuid?: string; catalogId?: string; surfaceId?: string; version?: string }): this;
|
|
181
|
+
addButton(name: string, params: string | Record<string, any>): this;
|
|
182
|
+
makeRow(header?: string, title?: string, description?: string, id?: string): this;
|
|
183
|
+
makeSection(title?: string, highlight_label?: string): this;
|
|
184
|
+
addSelection(title: string, options?: Record<string, any>): this;
|
|
185
|
+
addReply(display_text: string, id: string, options?: Record<string, any>): this;
|
|
186
|
+
/** cta_call. Note (v4.7): keys on `phone_number`, not `id` — fixed from a prior version that silently mis-keyed this field. */
|
|
187
|
+
addCall(display_text: string, phone_number: string, options?: Record<string, any>): this;
|
|
188
|
+
addReminder(display_text: string, id: string, options?: Record<string, any>): this;
|
|
189
|
+
addCancelReminder(display_text: string, id: string, options?: Record<string, any>): this;
|
|
190
|
+
addAddress(display_text: string, id: string, options?: Record<string, any>): this;
|
|
191
|
+
addLocation(options?: Record<string, any>): this;
|
|
192
|
+
addUrl(display_text: string, url: string, webview_interaction?: boolean, options?: Record<string, any>): this;
|
|
193
|
+
addCopy(display_text: string, copy_code: string, options?: Record<string, any>): this;
|
|
194
|
+
/** open_webview — opens a titled in-app webview. */
|
|
195
|
+
addOpenWebview(title: string, url: string, options?: Record<string, any>): this;
|
|
196
|
+
/** cta_catalog — opens the sender's WhatsApp Business catalog. Business-account gated. */
|
|
197
|
+
addCatalog(display_text?: string, options?: Record<string, any>): this;
|
|
198
|
+
/** automated_greeting_message_view_catalog. Business-account gated. */
|
|
199
|
+
addViewCatalog(options?: Record<string, any>): this;
|
|
200
|
+
/** call_permission_request. */
|
|
201
|
+
addCallPermission(display_text?: string, options?: Record<string, any>): this;
|
|
202
|
+
/** payment_info — structured payment-settings payload (e.g. PIX). Payment-enabled accounts only. */
|
|
203
|
+
addPaymentInfo(payload?: Record<string, any>): this;
|
|
204
|
+
/** review_and_pay — order/payment summary flow. Server-validated by WhatsApp. */
|
|
205
|
+
addReviewAndPay(payload?: Record<string, any>): this;
|
|
206
|
+
/** wa_payment_transaction_details. */
|
|
207
|
+
addTransactionDetails(payload?: Record<string, any>): this;
|
|
208
|
+
/** mpm — multi-product message. Business-catalog accounts only. */
|
|
209
|
+
addMultiProduct(payload?: Record<string, any>): this;
|
|
210
|
+
addCardMessage(payload?: Record<string, any>): this;
|
|
211
|
+
addOrderDetails(payload?: Record<string, any>): this;
|
|
212
|
+
addOrderStatus(payload?: Record<string, any>): this;
|
|
213
|
+
addPaymentStatus(payload?: Record<string, any>): this;
|
|
214
|
+
addPaymentMethod(payload?: Record<string, any>): this;
|
|
215
|
+
addTrackOrder(id: string, display_text?: string): this;
|
|
216
|
+
addReorder(id: string, display_text?: string): this;
|
|
217
|
+
addCancelOrder(id: string, display_text?: string): this;
|
|
218
|
+
addClearChat(): this;
|
|
219
|
+
addNavigateToScreen(screen: string, data?: Record<string, any>): this;
|
|
220
|
+
addFlow(flow: Record<string, any>, display_text?: string): this;
|
|
221
|
+
addVoiceCall(id: string, display_text?: string): this;
|
|
222
|
+
addVideoCall(id: string, display_text?: string): this;
|
|
223
|
+
setLimitedTimeOffer(params?: LimitedTimeOfferParams): this;
|
|
224
|
+
setBottomSheet(params?: BottomSheetParams): this;
|
|
225
|
+
setTapTargetConfiguration(params?: TapTargetConfigurationParams): this;
|
|
226
|
+
toCard(): Promise<Record<string, any>>;
|
|
227
|
+
build(jid: string, options?: Record<string, any>): Promise<Record<string, any>>;
|
|
228
|
+
send(jid: string, options?: Record<string, any>): Promise<any>;
|
|
229
|
+
|
|
230
|
+
/** Native-flow names WA renders with a dedicated node instead of the generic v=9 "mixed" node. */
|
|
231
|
+
static SPECIAL_FLOW: Record<string, { v: string; name: string }>;
|
|
232
|
+
|
|
233
|
+
// Presets attached at runtime via attachPresets() from MessageKit.js.
|
|
234
|
+
static confirm?: (client: any, text: string, options?: Record<string, any>) => Button;
|
|
235
|
+
static yesNo?: (client: any, text: string, options?: Record<string, any>) => Button;
|
|
236
|
+
static menu?: (client: any, options?: Record<string, any>) => Button;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export class RowBuilder {
|
|
240
|
+
constructor();
|
|
241
|
+
buttons: Record<string, any>[];
|
|
242
|
+
button(displayText: string, buttonId?: string): this;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export class CardBuilder {
|
|
246
|
+
constructor(client: any);
|
|
247
|
+
title(text: string): this;
|
|
248
|
+
text(text: string): this;
|
|
249
|
+
image(path: string | Buffer, options?: Record<string, any>): this;
|
|
250
|
+
button(displayText: string, buttonId?: string): this;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export class ButtonV2 extends BaseBuilder {
|
|
254
|
+
constructor(client: any);
|
|
255
|
+
addButton(displayText: string, buttonId?: string): this;
|
|
256
|
+
/** Alias for addButton(). */
|
|
257
|
+
button(displayText: string, buttonId?: string): this;
|
|
258
|
+
/** Fluent row helper — group buttons via a callback instead of chaining addButton(). */
|
|
259
|
+
row(cb: (row: RowBuilder) => void): this;
|
|
260
|
+
addRawButton(obj: Record<string, any>): this;
|
|
261
|
+
setThumbnail(path: string | Buffer): this;
|
|
262
|
+
setMedia(obj: Record<string, any>): this;
|
|
263
|
+
/** @param options.viewOnce Default true — some clients require this for legacy buttonsMessage to render; pass false for a normal (non-disappearing) message. */
|
|
264
|
+
build(jid: string, options?: Record<string, any> & { viewOnce?: boolean }): Promise<Record<string, any>>;
|
|
265
|
+
send(jid: string, options?: Record<string, any> & { viewOnce?: boolean }): Promise<any>;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Legacy `templateMessage` / `hydratedFourRowTemplate` builder — WA's Generation-1
|
|
270
|
+
* button protocol (predates the nativeFlow format Button/ButtonV2 use). Capped at
|
|
271
|
+
* 3 buttons (quickReply/url/call only), no interactive list/flow support.
|
|
272
|
+
*/
|
|
273
|
+
export class ButtonV3 extends BaseBuilder {
|
|
274
|
+
constructor(client: any);
|
|
275
|
+
/** Load an existing templateMessage (e.g. from a fetched/quoted message) for editing. */
|
|
276
|
+
loadFrom(msg: Record<string, any>): this;
|
|
277
|
+
setImage(path: string | Buffer, options?: Record<string, any>): this;
|
|
278
|
+
setVideo(path: string | Buffer, options?: Record<string, any>): this;
|
|
279
|
+
setDocument(path: string | Buffer, options?: Record<string, any>): this;
|
|
280
|
+
setMedia(obj: Record<string, any>): this;
|
|
281
|
+
clearButtons(): this;
|
|
282
|
+
/** Max 3 buttons — throws past the limit. */
|
|
283
|
+
addButton(hydratedButton: Record<string, any>): this;
|
|
284
|
+
addReply(display_text?: string, id?: string): this;
|
|
285
|
+
addUrl(display_text?: string, url?: string, options?: Record<string, any>): this;
|
|
286
|
+
addCall(display_text?: string, phone_number?: string): this;
|
|
287
|
+
toTemplate(): Promise<Record<string, any>>;
|
|
288
|
+
build(jid: string, options?: Record<string, any>): Promise<Record<string, any>>;
|
|
289
|
+
send(jid: string, options?: Record<string, any>): Promise<any>;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export class Carousel extends BaseBuilder {
|
|
293
|
+
constructor(client: any);
|
|
294
|
+
/** WhatsApp caps carousels at this many cards (10); addCard() throws past it. */
|
|
295
|
+
static MAX_CARDS: number;
|
|
296
|
+
addCard(card: Record<string, any> | Record<string, any>[]): this;
|
|
297
|
+
build(jid: string, options?: Record<string, any>): Record<string, any>;
|
|
298
|
+
send(jid: string, options?: Record<string, any>): Promise<any>;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export class Poll extends BaseBuilder {
|
|
302
|
+
constructor(client: any);
|
|
303
|
+
setName(name: string): this;
|
|
304
|
+
addOption(name: string): this;
|
|
305
|
+
addOptions(names: string[]): this;
|
|
306
|
+
setSelectable(count: number): this;
|
|
307
|
+
setMultiSelect(canSelectMultiple?: boolean): this;
|
|
308
|
+
setHideVoter(hide?: boolean): this;
|
|
309
|
+
setCanAddOption(allow?: boolean): this;
|
|
310
|
+
setAnnouncementGroup(isAnnouncement?: boolean): this;
|
|
311
|
+
setEndDate(date: Date | string | number): this;
|
|
312
|
+
/** Defers hash/version handling to the socket's own sendMessage({poll}) logic — see .js docblock. */
|
|
313
|
+
setQuiz(correctOptionName: string): this;
|
|
314
|
+
build(): { poll: Record<string, any> };
|
|
315
|
+
send(jid: string, options?: Record<string, any>): Promise<any>;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export interface AddTextOptions {
|
|
319
|
+
hyperlink?: boolean;
|
|
320
|
+
citation?: boolean;
|
|
321
|
+
latex?: boolean;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
export interface AddInlineImageOptions {
|
|
325
|
+
text?: string;
|
|
326
|
+
alignment?: string;
|
|
327
|
+
tapLinkUrl?: string;
|
|
328
|
+
resolveUrl?: boolean;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export class AIRich extends BaseBuilder {
|
|
332
|
+
constructor(client: any);
|
|
333
|
+
addSubmessage(submessage: Record<string, any>): this;
|
|
334
|
+
addSection(section: Record<string, any>): this;
|
|
335
|
+
addText(text: string, options?: AddTextOptions): this;
|
|
336
|
+
addCode(language: string, code: string): this;
|
|
337
|
+
addTable(table: string[][], options?: AddTextOptions): this;
|
|
338
|
+
addPaymentKeyInfo(payload?: Record<string, any>): this;
|
|
339
|
+
addBookingConfirmation(payload?: Record<string, any>): this;
|
|
340
|
+
addLinks(links?: Record<string, any>[]): this;
|
|
341
|
+
addContentItems(items?: Record<string, any>[]): this;
|
|
342
|
+
addInlineVideo(): this;
|
|
343
|
+
addSource(sources?: Record<string, any>[], options?: { resolveUrl?: boolean }): this;
|
|
344
|
+
addReels(reelsItems?: Record<string, any>[], options?: { resolveUrl?: boolean }): this;
|
|
345
|
+
addImage(imageUrl: string, options?: { resolveUrl?: boolean }): this;
|
|
346
|
+
addInlineImage(imageUrl: string, options?: AddInlineImageOptions): this;
|
|
347
|
+
addVideo(videoUrl: string, options?: { autoFill?: boolean; resolveUrl?: boolean }): this;
|
|
348
|
+
addProduct(data?: Record<string, any>, options?: { resolveUrl?: boolean }): this;
|
|
349
|
+
addPost(data?: Record<string, any>, options?: { resolveUrl?: boolean }): this;
|
|
350
|
+
addTip(text: string): this;
|
|
351
|
+
addMetadata(text: string): this;
|
|
352
|
+
setResponseId(id: string): this;
|
|
353
|
+
refreshResponseId(): this;
|
|
354
|
+
setBotResponseId(id: string): this;
|
|
355
|
+
refreshBotResponseId(): this;
|
|
356
|
+
hasId(id: string): boolean;
|
|
357
|
+
getIds(): string[];
|
|
358
|
+
peek(id: string): { id: string; sections: any[]; submessages: any[] } | null;
|
|
359
|
+
delete(id: string): this;
|
|
360
|
+
/** FOATextPrimitive — large heading text, distinct from addText()'s paragraph text. */
|
|
361
|
+
addHeading(text: string): this;
|
|
362
|
+
/** GenAI3PExtWidgetPrimitive — experimental, reverse-engineered; see JSDoc in the .js file for caveats. */
|
|
363
|
+
addWidget(data: Record<string, any> | Record<string, any>[], options?: { layout?: 'Single' | 'HScroll' | 'ActionRow' | string }): this;
|
|
364
|
+
/** GenAIFooterActionPrimitive — footer action link chips (e.g. "Join our Group"). */
|
|
365
|
+
addFooterAction(actions: { text: string; url: string; type?: string } | { text: string; url: string; type?: string }[]): this;
|
|
366
|
+
/** GenAIDividerPrimitive — plain horizontal line, no content. */
|
|
367
|
+
addDivider(): this;
|
|
368
|
+
/** GenAISpacerPrimitive — blank vertical spacing. */
|
|
369
|
+
addSpacer(spacing?: number): this;
|
|
370
|
+
/** GenAILatexUXPrimitive — has a real AI_RICH_RESPONSE_LATEX submessage (unlike most primitives here). */
|
|
371
|
+
addLatex(expression: string): this;
|
|
372
|
+
/** GenAITaskPrimitive — task/checklist card. */
|
|
373
|
+
addTask(data: { task_id?: string; title: string; subtitle?: string; status?: string; textFallback?: boolean }): this;
|
|
374
|
+
/** GenAIBotProgressStatusPrimitive — one-shot "searching/working" status chip. */
|
|
375
|
+
addProgressStatus(title: string, options?: { icon?: string; is_in_progress?: boolean; target_secondary_screen_id?: string; target_secondary_screen_tab_id?: string }): this;
|
|
376
|
+
/** GenAIBotThinkingStatusPrimitive — one-shot "thinking" status chip. */
|
|
377
|
+
addThinkingStatus(title: string, options?: { icon?: string; is_in_progress?: boolean; target_secondary_screen_id?: string; target_secondary_screen_tab_id?: string; textFallback?: boolean }): this;
|
|
378
|
+
/** GenAIMetaSubsQuotaUpsellPrimitive — subscription-quota-limit upsell card. */
|
|
379
|
+
addQuotaUpsell(data: { title: string; body?: string; body_line1?: string; body_line2?: string; buttons?: { label: string; action?: string; deeplink?: string }[] }): this;
|
|
380
|
+
/** FOABloksPrimitive — raw Bloks payload; most experimental primitive, fields passed through as-is. */
|
|
381
|
+
addBloks(data: { type: string; data?: string; uuid?: string; initial_response?: any; versioning_id?: string; textFallback?: boolean }): this;
|
|
382
|
+
addSuggest(suggestion: Record<string, any>, options?: { scroll?: boolean; layout?: string }): this;
|
|
383
|
+
/** GenAIImaginePrimitive with status GENERATING — pending-generation placeholder, distinct from addImage()/addVideo()'s READY status. */
|
|
384
|
+
addGenerating(options?: { imagine_type?: 'IMAGE' | 'ANIMATE'; estimated_completion_time?: number; textFallback?: boolean }): this;
|
|
385
|
+
build(): Record<string, any>;
|
|
386
|
+
send(jid: string, options?: Record<string, any>): Promise<any>;
|
|
387
|
+
|
|
388
|
+
static tokenizer(code: string, lang?: string): Record<string, any>;
|
|
389
|
+
static toTableMetadata(arr: string[][], options?: AddTextOptions): Record<string, any>;
|
|
390
|
+
static newLayout(name: string, data: Record<string, any> | Record<string, any>[], extra?: Record<string, any>): Record<string, any>;
|
|
391
|
+
/** Send a support-ticket marker message (messageContextInfo.supportPayload). */
|
|
392
|
+
static sendSupportPayload(client: any, jid: string, text: string, options?: { ticketId?: string; isAiMessage?: boolean; shouldShowSystemMessage?: boolean; version?: number }): Promise<any>;
|
|
393
|
+
/** Send an image + video as one paired-media unit (messageAssociation). */
|
|
394
|
+
static sendPairedMedia(client: any, jid: string, media: { image: string | Buffer; video: string | Buffer }): Promise<any>;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// Same class as AIRich — exported under alternate names (see Vanz@Alias in
|
|
398
|
+
// MessageBuilder.js). All four are structurally identical to AIRich.
|
|
399
|
+
export { AIRich as AIVanzxy, AIRich as LeafRich, AIRich as VanzxyAI, AIRich as VanzxyRich };
|
|
400
|
+
|
|
401
|
+
/** `class ORich extends AIRich {}` — plain re-export alias, no additional members. */
|
|
402
|
+
export class ORich extends AIRich {}
|
|
403
|
+
|
|
404
|
+
export class Toolkit {
|
|
405
|
+
static extractIE(text: string, options?: AddTextOptions): Record<string, any>;
|
|
406
|
+
static getMp4Duration(buffer: Buffer, options?: { silent?: boolean }): Promise<number>;
|
|
407
|
+
static getMp4Preview(
|
|
408
|
+
videoBuffer: Buffer,
|
|
409
|
+
options?: { time?: number; result?: 'buffer' | string; resize?: boolean; width?: number; height?: number; silent?: boolean }
|
|
410
|
+
): Promise<Buffer | Record<string, any>>;
|
|
411
|
+
}
|