forked from openclaw/openclaw
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchannel-web.ts
More file actions
51 lines (44 loc) · 1.33 KB
/
channel-web.ts
File metadata and controls
51 lines (44 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Barrel exports for the web channel pieces. Splitting the original 900+ line
// module keeps responsibilities small and testable.
import { resolveWaWebAuthDir } from "./plugins/runtime/runtime-whatsapp-boundary.js";
export { HEARTBEAT_PROMPT } from "./auto-reply/heartbeat.js";
export { HEARTBEAT_TOKEN } from "./auto-reply/tokens.js";
export { loadWebMedia, optimizeImageToJpeg } from "./media/web-media.js";
export {
createWaSocket,
extractMediaPlaceholder,
extractText,
formatError,
getStatusCode,
logWebSelfId,
loginWeb,
logoutWeb,
monitorWebChannel,
monitorWebInbox,
pickWebChannel,
resolveHeartbeatRecipients,
runWebHeartbeatOnce,
sendMessageWhatsApp,
sendReactionWhatsApp,
waitForWaConnection,
webAuthExists,
} from "./plugins/runtime/runtime-whatsapp-boundary.js";
// Keep the historic constant surface available, but resolve it through the
// plugin boundary only when a caller actually coerces the value to string.
class LazyWhatsAppAuthDir {
#value: string | null = null;
#read(): string {
this.#value ??= resolveWaWebAuthDir();
return this.#value;
}
toString(): string {
return this.#read();
}
valueOf(): string {
return this.#read();
}
[Symbol.toPrimitive](): string {
return this.#read();
}
}
export const WA_WEB_AUTH_DIR = new LazyWhatsAppAuthDir() as unknown as string;