@aomi-labs/widget-lib 0.2.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/README.md +310 -0
- package/dist/core/AomiChatWidget.d.ts +41 -0
- package/dist/core/AomiChatWidget.d.ts.map +1 -0
- package/dist/core/ChatManager.d.ts +81 -0
- package/dist/core/ChatManager.d.ts.map +1 -0
- package/dist/core/ThemeManager.d.ts +80 -0
- package/dist/core/ThemeManager.d.ts.map +1 -0
- package/dist/core/WalletManager.d.ts +105 -0
- package/dist/core/WalletManager.d.ts.map +1 -0
- package/dist/index.d.ts +816 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3289 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3215 -0
- package/dist/index.mjs.map +1 -0
- package/dist/index.umd.js +3295 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/types/constants.d.ts +91 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/errors.d.ts +102 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/index.d.ts +263 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/index.d.ts +99 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/package.json +89 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,816 @@
|
|
|
1
|
+
import { EventEmitter } from 'eventemitter3';
|
|
2
|
+
|
|
3
|
+
declare const DEFAULT_WIDGET_WIDTH = "400px";
|
|
4
|
+
declare const DEFAULT_WIDGET_HEIGHT = "600px";
|
|
5
|
+
declare const DEFAULT_MAX_HEIGHT = 800;
|
|
6
|
+
declare const DEFAULT_MESSAGE_LENGTH = 2000;
|
|
7
|
+
declare const DEFAULT_RECONNECT_ATTEMPTS = 5;
|
|
8
|
+
declare const DEFAULT_RECONNECT_DELAY = 3000;
|
|
9
|
+
declare const SUPPORTED_CHAINS: Record<SupportedChainId, string>;
|
|
10
|
+
declare const DEFAULT_CHAIN_ID: SupportedChainId;
|
|
11
|
+
declare const THEME_PALETTES: Record<string, AomiChatWidgetPaletteColors>;
|
|
12
|
+
declare const PREDEFINED_THEMES: Record<string, ThemeDefinition>;
|
|
13
|
+
declare const ERROR_CODES: {
|
|
14
|
+
readonly INVALID_CONFIG: "INVALID_CONFIG";
|
|
15
|
+
readonly MISSING_APP_CODE: "MISSING_APP_CODE";
|
|
16
|
+
readonly INVALID_THEME: "INVALID_THEME";
|
|
17
|
+
readonly INVALID_DIMENSIONS: "INVALID_DIMENSIONS";
|
|
18
|
+
readonly CONNECTION_FAILED: "CONNECTION_FAILED";
|
|
19
|
+
readonly CONNECTION_TIMEOUT: "CONNECTION_TIMEOUT";
|
|
20
|
+
readonly BACKEND_UNAVAILABLE: "BACKEND_UNAVAILABLE";
|
|
21
|
+
readonly AUTHENTICATION_FAILED: "AUTHENTICATION_FAILED";
|
|
22
|
+
readonly WALLET_NOT_CONNECTED: "WALLET_NOT_CONNECTED";
|
|
23
|
+
readonly WALLET_CONNECTION_FAILED: "WALLET_CONNECTION_FAILED";
|
|
24
|
+
readonly UNSUPPORTED_NETWORK: "UNSUPPORTED_NETWORK";
|
|
25
|
+
readonly TRANSACTION_FAILED: "TRANSACTION_FAILED";
|
|
26
|
+
readonly TRANSACTION_REJECTED: "TRANSACTION_REJECTED";
|
|
27
|
+
readonly MESSAGE_TOO_LONG: "MESSAGE_TOO_LONG";
|
|
28
|
+
readonly RATE_LIMITED: "RATE_LIMITED";
|
|
29
|
+
readonly INVALID_MESSAGE: "INVALID_MESSAGE";
|
|
30
|
+
readonly SESSION_EXPIRED: "SESSION_EXPIRED";
|
|
31
|
+
readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
|
|
32
|
+
readonly INITIALIZATION_FAILED: "INITIALIZATION_FAILED";
|
|
33
|
+
readonly PROVIDER_ERROR: "PROVIDER_ERROR";
|
|
34
|
+
};
|
|
35
|
+
declare const WIDGET_EVENTS: {
|
|
36
|
+
readonly READY: "ready";
|
|
37
|
+
readonly DESTROY: "destroy";
|
|
38
|
+
readonly RESIZE: "resize";
|
|
39
|
+
readonly MESSAGE: "message";
|
|
40
|
+
readonly TYPING_CHANGE: "typingChange";
|
|
41
|
+
readonly PROCESSING_CHANGE: "processingChange";
|
|
42
|
+
readonly CONNECTION_CHANGE: "connectionChange";
|
|
43
|
+
readonly SESSION_START: "sessionStart";
|
|
44
|
+
readonly SESSION_END: "sessionEnd";
|
|
45
|
+
readonly WALLET_CONNECT: "walletConnect";
|
|
46
|
+
readonly WALLET_DISCONNECT: "walletDisconnect";
|
|
47
|
+
readonly NETWORK_CHANGE: "networkChange";
|
|
48
|
+
readonly TRANSACTION_REQUEST: "transactionRequest";
|
|
49
|
+
readonly ERROR: "error";
|
|
50
|
+
};
|
|
51
|
+
declare const CSS_CLASSES: {
|
|
52
|
+
readonly WIDGET_ROOT: "aomi-chat-widget";
|
|
53
|
+
readonly WIDGET_CONTAINER: "aomi-chat-container";
|
|
54
|
+
readonly WIDGET_IFRAME: "aomi-chat-iframe";
|
|
55
|
+
readonly THEME_LIGHT: "aomi-theme-light";
|
|
56
|
+
readonly THEME_DARK: "aomi-theme-dark";
|
|
57
|
+
readonly THEME_TERMINAL: "aomi-theme-terminal";
|
|
58
|
+
readonly THEME_NEON: "aomi-theme-neon";
|
|
59
|
+
readonly THEME_MINIMAL: "aomi-theme-minimal";
|
|
60
|
+
readonly MODE_FULL: "aomi-mode-full";
|
|
61
|
+
readonly MODE_MINIMAL: "aomi-mode-minimal";
|
|
62
|
+
readonly MODE_COMPACT: "aomi-mode-compact";
|
|
63
|
+
readonly MODE_TERMINAL: "aomi-mode-terminal";
|
|
64
|
+
readonly CHAT_INTERFACE: "aomi-chat-interface";
|
|
65
|
+
readonly CHAT_HEADER: "aomi-chat-header";
|
|
66
|
+
readonly CHAT_TITLE: "aomi-chat-title";
|
|
67
|
+
readonly CHAT_BODY: "aomi-chat-body";
|
|
68
|
+
readonly STATUS_BADGE: "aomi-status-badge";
|
|
69
|
+
readonly MESSAGE_LIST: "aomi-message-list";
|
|
70
|
+
readonly MESSAGE_CONTAINER: "aomi-message-container";
|
|
71
|
+
readonly MESSAGE_BUBBLE: "aomi-message";
|
|
72
|
+
readonly MESSAGE_USER: "aomi-message-user";
|
|
73
|
+
readonly MESSAGE_ASSISTANT: "aomi-message-assistant";
|
|
74
|
+
readonly MESSAGE_SYSTEM: "aomi-message-system";
|
|
75
|
+
readonly ACTION_BAR: "aomi-action-bar";
|
|
76
|
+
readonly MESSAGE_INPUT: "aomi-message-input";
|
|
77
|
+
readonly INPUT_FORM: "aomi-chat-input-form";
|
|
78
|
+
readonly INPUT_FIELD: "aomi-chat-input-field";
|
|
79
|
+
readonly SEND_BUTTON: "aomi-chat-send-button";
|
|
80
|
+
readonly WALLET_STATUS: "aomi-wallet-status";
|
|
81
|
+
readonly TYPING_INDICATOR: "aomi-typing-indicator";
|
|
82
|
+
readonly LOADING: "aomi-loading";
|
|
83
|
+
readonly ERROR: "aomi-error";
|
|
84
|
+
readonly DISABLED: "aomi-disabled";
|
|
85
|
+
readonly CONNECTED: "aomi-connected";
|
|
86
|
+
readonly DISCONNECTED: "aomi-disconnected";
|
|
87
|
+
};
|
|
88
|
+
declare const API_ENDPOINTS: {
|
|
89
|
+
readonly CHAT: "/api/chat";
|
|
90
|
+
readonly CHAT_STREAM: "/api/chat/stream";
|
|
91
|
+
readonly STATE: "/api/state";
|
|
92
|
+
readonly INTERRUPT: "/api/interrupt";
|
|
93
|
+
readonly SYSTEM: "/api/system";
|
|
94
|
+
readonly MCP_COMMAND: "/api/mcp-command";
|
|
95
|
+
readonly HEALTH: "/health";
|
|
96
|
+
};
|
|
97
|
+
declare const TIMING: {
|
|
98
|
+
readonly TYPING_INDICATOR_DELAY: 100;
|
|
99
|
+
readonly MESSAGE_ANIMATION_DURATION: 300;
|
|
100
|
+
readonly CONNECTION_TIMEOUT: 10000;
|
|
101
|
+
readonly RETRY_DELAY: 1000;
|
|
102
|
+
readonly HEARTBEAT_INTERVAL: 30000;
|
|
103
|
+
readonly SESSION_TIMEOUT: 3600000;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
declare class AomiChatError$1 extends Error {
|
|
107
|
+
readonly code: string;
|
|
108
|
+
readonly timestamp: Date;
|
|
109
|
+
readonly details?: unknown;
|
|
110
|
+
constructor(code: string, message: string, details?: unknown);
|
|
111
|
+
toJSON(): {
|
|
112
|
+
name: string;
|
|
113
|
+
code: string;
|
|
114
|
+
message: string;
|
|
115
|
+
timestamp: string;
|
|
116
|
+
details: unknown;
|
|
117
|
+
stack: string | undefined;
|
|
118
|
+
};
|
|
119
|
+
toString(): string;
|
|
120
|
+
}
|
|
121
|
+
declare class ConfigurationError extends AomiChatError$1 {
|
|
122
|
+
constructor(message: string, details?: unknown);
|
|
123
|
+
}
|
|
124
|
+
declare class ConnectionError extends AomiChatError$1 {
|
|
125
|
+
constructor(message: string, details?: unknown);
|
|
126
|
+
}
|
|
127
|
+
declare class WalletError extends AomiChatError$1 {
|
|
128
|
+
constructor(code: string, message: string, details?: unknown);
|
|
129
|
+
}
|
|
130
|
+
declare class TransactionError extends WalletError {
|
|
131
|
+
constructor(message: string, details?: unknown);
|
|
132
|
+
}
|
|
133
|
+
declare class ChatError extends AomiChatError$1 {
|
|
134
|
+
constructor(code: string, message: string, details?: unknown);
|
|
135
|
+
}
|
|
136
|
+
declare class RateLimitError extends ChatError {
|
|
137
|
+
constructor(message: string, details?: unknown);
|
|
138
|
+
}
|
|
139
|
+
declare class SessionError extends AomiChatError$1 {
|
|
140
|
+
constructor(message: string, details?: unknown);
|
|
141
|
+
}
|
|
142
|
+
declare function createConfigurationError(message: string, details?: unknown): ConfigurationError;
|
|
143
|
+
declare function createConnectionError(message: string, details?: unknown): ConnectionError;
|
|
144
|
+
declare function createWalletError(code: string, message: string, details?: unknown): WalletError;
|
|
145
|
+
declare function createTransactionError(message: string, details?: unknown): TransactionError;
|
|
146
|
+
declare function createChatError(code: string, message: string, details?: unknown): ChatError;
|
|
147
|
+
declare function createRateLimitError(message: string, details?: unknown): RateLimitError;
|
|
148
|
+
declare function createSessionError(message: string, details?: unknown): SessionError;
|
|
149
|
+
declare function isAomiChatError(error: unknown): error is AomiChatError$1;
|
|
150
|
+
declare function isConfigurationError(error: unknown): error is ConfigurationError;
|
|
151
|
+
declare function isConnectionError(error: unknown): error is ConnectionError;
|
|
152
|
+
declare function isWalletError(error: unknown): error is WalletError;
|
|
153
|
+
declare function isTransactionError(error: unknown): error is TransactionError;
|
|
154
|
+
declare function isChatError(error: unknown): error is ChatError;
|
|
155
|
+
declare function isRateLimitError(error: unknown): error is RateLimitError;
|
|
156
|
+
declare function isSessionError(error: unknown): error is SessionError;
|
|
157
|
+
|
|
158
|
+
type SupportedChainId = 1 | 5 | 10 | 100 | 1337 | 31337 | 137 | 42161 | 59140 | 59144 | 8453 | 11155111;
|
|
159
|
+
type PerNetworkConfig<T> = Partial<Record<SupportedChainId, T>>;
|
|
160
|
+
type PerModeConfig<T> = Partial<Record<AomiChatMode, T>>;
|
|
161
|
+
type FlexibleConfig<T> = T | PerNetworkConfig<T> | PerModeConfig<T> | PerModeConfig<PerNetworkConfig<T>> | PerNetworkConfig<PerModeConfig<T>>;
|
|
162
|
+
interface ChatMessage {
|
|
163
|
+
id: string;
|
|
164
|
+
type: 'user' | 'assistant' | 'system';
|
|
165
|
+
content: string;
|
|
166
|
+
timestamp: Date;
|
|
167
|
+
toolStream?: {
|
|
168
|
+
topic: string;
|
|
169
|
+
content: string;
|
|
170
|
+
};
|
|
171
|
+
metadata?: Record<string, unknown>;
|
|
172
|
+
}
|
|
173
|
+
interface WalletTransaction {
|
|
174
|
+
to: string;
|
|
175
|
+
value: string;
|
|
176
|
+
data: string;
|
|
177
|
+
gas?: string;
|
|
178
|
+
description: string;
|
|
179
|
+
timestamp: string;
|
|
180
|
+
}
|
|
181
|
+
type AomiChatMode = 'full' | 'minimal' | 'compact' | 'terminal';
|
|
182
|
+
type AomiChatTheme = 'light' | 'dark' | 'terminal' | 'neon' | 'minimal';
|
|
183
|
+
interface AomiChatWidgetPaletteColors {
|
|
184
|
+
primary: string;
|
|
185
|
+
background: string;
|
|
186
|
+
surface: string;
|
|
187
|
+
text: string;
|
|
188
|
+
textSecondary: string;
|
|
189
|
+
border: string;
|
|
190
|
+
success: string;
|
|
191
|
+
error: string;
|
|
192
|
+
warning: string;
|
|
193
|
+
accent: string;
|
|
194
|
+
}
|
|
195
|
+
interface AomiChatWidgetPalette extends AomiChatWidgetPaletteColors {
|
|
196
|
+
baseTheme: AomiChatTheme;
|
|
197
|
+
}
|
|
198
|
+
interface RateLimitConfig {
|
|
199
|
+
maxMessages?: number;
|
|
200
|
+
windowMs?: number;
|
|
201
|
+
skipWhenConnected?: boolean;
|
|
202
|
+
}
|
|
203
|
+
interface AnalyticsConfig {
|
|
204
|
+
trackEvents?: boolean;
|
|
205
|
+
customId?: string;
|
|
206
|
+
excludeContent?: boolean;
|
|
207
|
+
}
|
|
208
|
+
interface ChatCommand {
|
|
209
|
+
command: string;
|
|
210
|
+
description: string;
|
|
211
|
+
handler: (args: string[]) => Promise<void> | void;
|
|
212
|
+
}
|
|
213
|
+
interface AomiChatWidgetParams {
|
|
214
|
+
appCode: string;
|
|
215
|
+
width?: string;
|
|
216
|
+
height?: string;
|
|
217
|
+
maxHeight?: number;
|
|
218
|
+
baseUrl?: string;
|
|
219
|
+
sessionId?: string;
|
|
220
|
+
theme?: AomiChatTheme | AomiChatWidgetPalette;
|
|
221
|
+
mode?: AomiChatMode;
|
|
222
|
+
welcomeMessage?: string;
|
|
223
|
+
placeholder?: string;
|
|
224
|
+
showWalletStatus?: boolean;
|
|
225
|
+
showNetworkSelector?: boolean;
|
|
226
|
+
hideHeader?: boolean;
|
|
227
|
+
hideFooter?: boolean;
|
|
228
|
+
chainId?: SupportedChainId;
|
|
229
|
+
supportedChains?: SupportedChainId[];
|
|
230
|
+
enableTransactions?: boolean;
|
|
231
|
+
requireWalletConnection?: boolean;
|
|
232
|
+
sessionPersistence?: boolean;
|
|
233
|
+
autoConnect?: boolean;
|
|
234
|
+
standaloneMode?: boolean;
|
|
235
|
+
customCommands?: ChatCommand[];
|
|
236
|
+
rateLimiting?: FlexibleConfig<RateLimitConfig>;
|
|
237
|
+
apiKey?: string;
|
|
238
|
+
webhookUrl?: string;
|
|
239
|
+
analytics?: AnalyticsConfig;
|
|
240
|
+
sounds?: {
|
|
241
|
+
messageReceived?: string | null;
|
|
242
|
+
messageSent?: string | null;
|
|
243
|
+
transactionSuccess?: string | null;
|
|
244
|
+
transactionError?: string | null;
|
|
245
|
+
};
|
|
246
|
+
content?: {
|
|
247
|
+
welcomeTitle?: string;
|
|
248
|
+
connectWalletText?: string;
|
|
249
|
+
disconnectText?: string;
|
|
250
|
+
networkSwitchText?: string;
|
|
251
|
+
errorMessages?: Record<string, string>;
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
declare enum ConnectionStatus {
|
|
255
|
+
CONNECTING = "connecting",
|
|
256
|
+
CONNECTED = "connected",
|
|
257
|
+
DISCONNECTED = "disconnected",
|
|
258
|
+
ERROR = "error",
|
|
259
|
+
RECONNECTING = "reconnecting"
|
|
260
|
+
}
|
|
261
|
+
declare enum ReadinessPhase {
|
|
262
|
+
INITIALIZING = "initializing",
|
|
263
|
+
CONNECTING_MCP = "connecting_mcp",
|
|
264
|
+
VALIDATING_ANTHROPIC = "validating_anthropic",
|
|
265
|
+
READY = "ready",
|
|
266
|
+
MISSING_API_KEY = "missing_api_key",
|
|
267
|
+
ERROR = "error"
|
|
268
|
+
}
|
|
269
|
+
interface BackendReadiness {
|
|
270
|
+
phase: ReadinessPhase;
|
|
271
|
+
detail?: string;
|
|
272
|
+
retryCount?: number;
|
|
273
|
+
}
|
|
274
|
+
interface WalletState {
|
|
275
|
+
isConnected: boolean;
|
|
276
|
+
address?: string;
|
|
277
|
+
chainId?: SupportedChainId;
|
|
278
|
+
networkName?: string;
|
|
279
|
+
balance?: string;
|
|
280
|
+
}
|
|
281
|
+
interface ChatState {
|
|
282
|
+
messages: ChatMessage[];
|
|
283
|
+
isTyping: boolean;
|
|
284
|
+
isProcessing: boolean;
|
|
285
|
+
connectionStatus: ConnectionStatus;
|
|
286
|
+
readiness: BackendReadiness;
|
|
287
|
+
walletState: WalletState;
|
|
288
|
+
sessionId: string;
|
|
289
|
+
pendingTransaction?: WalletTransaction;
|
|
290
|
+
}
|
|
291
|
+
interface AomiChatEventListeners {
|
|
292
|
+
onReady?: () => void;
|
|
293
|
+
onMessage?: (message: ChatMessage) => void;
|
|
294
|
+
onTransactionRequest?: (transaction: WalletTransaction) => void;
|
|
295
|
+
onError?: (error: AomiChatError) => void;
|
|
296
|
+
onSessionStart?: (sessionId: string) => void;
|
|
297
|
+
onSessionEnd?: (sessionId: string) => void;
|
|
298
|
+
onNetworkChange?: (chainId: SupportedChainId) => void;
|
|
299
|
+
onWalletConnect?: (address: string) => void;
|
|
300
|
+
onWalletDisconnect?: () => void;
|
|
301
|
+
onTypingChange?: (isTyping: boolean) => void;
|
|
302
|
+
onProcessingChange?: (isProcessing: boolean) => void;
|
|
303
|
+
onConnectionChange?: (status: ConnectionStatus) => void;
|
|
304
|
+
onResize?: (dimensions: {
|
|
305
|
+
width: number;
|
|
306
|
+
height: number;
|
|
307
|
+
}) => void;
|
|
308
|
+
}
|
|
309
|
+
interface AomiChatError {
|
|
310
|
+
code: string;
|
|
311
|
+
message: string;
|
|
312
|
+
details?: unknown;
|
|
313
|
+
timestamp: Date;
|
|
314
|
+
}
|
|
315
|
+
interface AomiChatWidgetHandler {
|
|
316
|
+
sendMessage: (message: string) => Promise<void>;
|
|
317
|
+
updateParams: (params: Partial<AomiChatWidgetParams>) => void;
|
|
318
|
+
updateProvider: (provider?: EthereumProvider) => void;
|
|
319
|
+
destroy: () => void;
|
|
320
|
+
getState: () => ChatState;
|
|
321
|
+
getSessionId: () => string;
|
|
322
|
+
isReady: () => boolean;
|
|
323
|
+
on: <K extends keyof AomiChatEventListeners>(event: K, listener: NonNullable<AomiChatEventListeners[K]>) => AomiChatWidgetHandler;
|
|
324
|
+
off: <K extends keyof AomiChatEventListeners>(event: K, listener: NonNullable<AomiChatEventListeners[K]>) => AomiChatWidgetHandler;
|
|
325
|
+
clearChat: () => void;
|
|
326
|
+
exportChat: () => ChatMessage[];
|
|
327
|
+
resize: (width?: string, height?: string) => void;
|
|
328
|
+
focus: () => void;
|
|
329
|
+
}
|
|
330
|
+
interface JsonRpcRequest {
|
|
331
|
+
id: number;
|
|
332
|
+
method: string;
|
|
333
|
+
params: unknown[];
|
|
334
|
+
}
|
|
335
|
+
interface EthereumProvider {
|
|
336
|
+
request<T>(params: JsonRpcRequest): Promise<T>;
|
|
337
|
+
on(event: string, handler: (...args: unknown[]) => void): void;
|
|
338
|
+
removeListener?(event: string, handler: (...args: unknown[]) => void): void;
|
|
339
|
+
isMetaMask?: boolean;
|
|
340
|
+
isWalletConnect?: boolean;
|
|
341
|
+
}
|
|
342
|
+
interface WidgetConfig {
|
|
343
|
+
params: AomiChatWidgetParams;
|
|
344
|
+
provider?: EthereumProvider;
|
|
345
|
+
listeners?: AomiChatEventListeners;
|
|
346
|
+
}
|
|
347
|
+
interface ChatManagerConfig {
|
|
348
|
+
backendUrl: string;
|
|
349
|
+
sessionId: string;
|
|
350
|
+
maxMessageLength?: number;
|
|
351
|
+
reconnectAttempts?: number;
|
|
352
|
+
reconnectDelay?: number;
|
|
353
|
+
}
|
|
354
|
+
interface ChatInterfaceProps {
|
|
355
|
+
messages: ChatMessage[];
|
|
356
|
+
isTyping: boolean;
|
|
357
|
+
isProcessing: boolean;
|
|
358
|
+
onSendMessage: (message: string) => void;
|
|
359
|
+
placeholder?: string;
|
|
360
|
+
disabled?: boolean;
|
|
361
|
+
className?: string;
|
|
362
|
+
}
|
|
363
|
+
interface MessageListProps {
|
|
364
|
+
messages: ChatMessage[];
|
|
365
|
+
isTyping: boolean;
|
|
366
|
+
className?: string;
|
|
367
|
+
}
|
|
368
|
+
interface MessageInputProps {
|
|
369
|
+
onSendMessage: (message: string) => void;
|
|
370
|
+
placeholder?: string;
|
|
371
|
+
disabled?: boolean;
|
|
372
|
+
maxLength?: number;
|
|
373
|
+
className?: string;
|
|
374
|
+
}
|
|
375
|
+
interface WalletStatusProps {
|
|
376
|
+
walletState: WalletState;
|
|
377
|
+
onConnect?: () => void;
|
|
378
|
+
onDisconnect?: () => void;
|
|
379
|
+
onNetworkSwitch?: (chainId: SupportedChainId) => void;
|
|
380
|
+
showNetworkSelector?: boolean;
|
|
381
|
+
className?: string;
|
|
382
|
+
}
|
|
383
|
+
interface TypingIndicatorProps {
|
|
384
|
+
isTyping: boolean;
|
|
385
|
+
className?: string;
|
|
386
|
+
}
|
|
387
|
+
interface ThemeDefinition {
|
|
388
|
+
name: string;
|
|
389
|
+
palette: AomiChatWidgetPaletteColors;
|
|
390
|
+
fonts?: {
|
|
391
|
+
primary?: string;
|
|
392
|
+
monospace?: string;
|
|
393
|
+
};
|
|
394
|
+
spacing?: {
|
|
395
|
+
xs?: string;
|
|
396
|
+
sm?: string;
|
|
397
|
+
md?: string;
|
|
398
|
+
lg?: string;
|
|
399
|
+
xl?: string;
|
|
400
|
+
};
|
|
401
|
+
borderRadius?: {
|
|
402
|
+
sm?: string;
|
|
403
|
+
md?: string;
|
|
404
|
+
lg?: string;
|
|
405
|
+
};
|
|
406
|
+
shadows?: {
|
|
407
|
+
sm?: string;
|
|
408
|
+
md?: string;
|
|
409
|
+
lg?: string;
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
type DeepPartial<T> = {
|
|
413
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
414
|
+
};
|
|
415
|
+
type RequiredKeys<T, K extends keyof T> = T & Required<Pick<T, K>>;
|
|
416
|
+
type OptionalKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Creates and initializes an Aomi Chat Widget
|
|
420
|
+
*/
|
|
421
|
+
declare function createAomiChatWidget(container: HTMLElement, config: WidgetConfig): AomiChatWidgetHandler;
|
|
422
|
+
|
|
423
|
+
interface ChatManagerEvents {
|
|
424
|
+
stateChange: [ChatState];
|
|
425
|
+
message: [ChatMessage];
|
|
426
|
+
error: [AomiChatError];
|
|
427
|
+
connectionChange: [ConnectionStatus];
|
|
428
|
+
transactionRequest: [WalletTransaction];
|
|
429
|
+
}
|
|
430
|
+
type NetworkSwitchResult = {
|
|
431
|
+
success: boolean;
|
|
432
|
+
message: string;
|
|
433
|
+
data?: Record<string, unknown>;
|
|
434
|
+
};
|
|
435
|
+
declare class ChatManager extends EventEmitter<ChatManagerEvents> {
|
|
436
|
+
private config;
|
|
437
|
+
private state;
|
|
438
|
+
private eventSource;
|
|
439
|
+
private reconnectAttempt;
|
|
440
|
+
private reconnectTimer;
|
|
441
|
+
private heartbeatTimer;
|
|
442
|
+
private lastPendingTransactionRaw;
|
|
443
|
+
constructor(config?: Partial<ChatManagerConfig>);
|
|
444
|
+
getState(): ChatState;
|
|
445
|
+
getSessionId(): string;
|
|
446
|
+
setSessionId(sessionId: string): void;
|
|
447
|
+
connectSSE(): Promise<void>;
|
|
448
|
+
disconnectSSE(): void;
|
|
449
|
+
sendMessage(message: string): Promise<void>;
|
|
450
|
+
sendSystemMessage(message: string): Promise<void>;
|
|
451
|
+
interrupt(): Promise<void>;
|
|
452
|
+
sendNetworkSwitchRequest(networkName: string): Promise<NetworkSwitchResult>;
|
|
453
|
+
sendTransactionResult(success: boolean, transactionHash?: string, error?: string): Promise<void>;
|
|
454
|
+
clearPendingTransaction(): void;
|
|
455
|
+
clearMessages(): void;
|
|
456
|
+
updateWalletState(walletState: Partial<WalletState>): void;
|
|
457
|
+
destroy(): void;
|
|
458
|
+
private processBackendPayload;
|
|
459
|
+
private buildMessages;
|
|
460
|
+
private normaliseSender;
|
|
461
|
+
private parseTimestamp;
|
|
462
|
+
private normaliseReadiness;
|
|
463
|
+
private updateReadiness;
|
|
464
|
+
private setConnectionStatus;
|
|
465
|
+
private emitStateChange;
|
|
466
|
+
private postToBackend;
|
|
467
|
+
private refreshState;
|
|
468
|
+
private handleConnectionError;
|
|
469
|
+
private scheduleReconnect;
|
|
470
|
+
private clearReconnectTimer;
|
|
471
|
+
private startHeartbeat;
|
|
472
|
+
private stopHeartbeat;
|
|
473
|
+
private teardownEventSource;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
declare class ThemeManager {
|
|
477
|
+
private currentTheme;
|
|
478
|
+
private customPalette;
|
|
479
|
+
constructor(theme?: AomiChatTheme | AomiChatWidgetPalette);
|
|
480
|
+
/**
|
|
481
|
+
* Updates the current theme
|
|
482
|
+
*/
|
|
483
|
+
updateTheme(theme?: AomiChatTheme | AomiChatWidgetPalette): void;
|
|
484
|
+
/**
|
|
485
|
+
* Gets the current computed theme
|
|
486
|
+
*/
|
|
487
|
+
getComputedTheme(): ThemeDefinition;
|
|
488
|
+
/**
|
|
489
|
+
* Gets a specific color from the current theme
|
|
490
|
+
*/
|
|
491
|
+
getColor(colorKey: keyof AomiChatWidgetPaletteColors): string;
|
|
492
|
+
/**
|
|
493
|
+
* Gets the CSS class name for the current theme
|
|
494
|
+
*/
|
|
495
|
+
getThemeClass(): string;
|
|
496
|
+
/**
|
|
497
|
+
* Gets the font family for the current theme
|
|
498
|
+
*/
|
|
499
|
+
getFontFamily(): string;
|
|
500
|
+
/**
|
|
501
|
+
* Gets the monospace font family for the current theme
|
|
502
|
+
*/
|
|
503
|
+
getMonospaceFontFamily(): string;
|
|
504
|
+
/**
|
|
505
|
+
* Gets a spacing value for the current theme
|
|
506
|
+
*/
|
|
507
|
+
getSpacing(size: 'xs' | 'sm' | 'md' | 'lg' | 'xl'): string;
|
|
508
|
+
/**
|
|
509
|
+
* Gets a border radius value for the current theme
|
|
510
|
+
*/
|
|
511
|
+
getBorderRadius(size: 'sm' | 'md' | 'lg'): string;
|
|
512
|
+
/**
|
|
513
|
+
* Gets a shadow value for the current theme
|
|
514
|
+
*/
|
|
515
|
+
getShadow(size: 'sm' | 'md' | 'lg'): string;
|
|
516
|
+
/**
|
|
517
|
+
* Generates CSS custom properties for the current theme
|
|
518
|
+
*/
|
|
519
|
+
getCSSCustomProperties(): Record<string, string>;
|
|
520
|
+
/**
|
|
521
|
+
* Applies the theme to a DOM element
|
|
522
|
+
*/
|
|
523
|
+
applyThemeToElement(element: HTMLElement): void;
|
|
524
|
+
/**
|
|
525
|
+
* Generates CSS string for the current theme
|
|
526
|
+
*/
|
|
527
|
+
generateCSS(selector?: string): string;
|
|
528
|
+
/**
|
|
529
|
+
* Destroys the theme manager
|
|
530
|
+
*/
|
|
531
|
+
destroy(): void;
|
|
532
|
+
private resolveTheme;
|
|
533
|
+
private isCustomPalette;
|
|
534
|
+
private getBaseThemeName;
|
|
535
|
+
private isPaletteEqual;
|
|
536
|
+
private generateComponentCSS;
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Creates a theme manager instance
|
|
540
|
+
*/
|
|
541
|
+
declare function createThemeManager(theme?: AomiChatTheme | AomiChatWidgetPalette): ThemeManager;
|
|
542
|
+
/**
|
|
543
|
+
* Gets all available predefined themes
|
|
544
|
+
*/
|
|
545
|
+
declare function getAvailableThemes(): Record<string, ThemeDefinition>;
|
|
546
|
+
/**
|
|
547
|
+
* Validates a custom palette
|
|
548
|
+
*/
|
|
549
|
+
declare function validateCustomPalette(palette: unknown): palette is AomiChatWidgetPalette;
|
|
550
|
+
/**
|
|
551
|
+
* Creates a custom palette from a base theme
|
|
552
|
+
*/
|
|
553
|
+
declare function createCustomPalette(baseTheme: AomiChatTheme, overrides: Partial<AomiChatWidgetPaletteColors>): AomiChatWidgetPalette;
|
|
554
|
+
|
|
555
|
+
interface TransactionRequest {
|
|
556
|
+
to: string;
|
|
557
|
+
value: string;
|
|
558
|
+
data: string;
|
|
559
|
+
gas?: string;
|
|
560
|
+
}
|
|
561
|
+
interface WalletManagerEvents {
|
|
562
|
+
connect: [string];
|
|
563
|
+
disconnect: [];
|
|
564
|
+
chainChange: [SupportedChainId];
|
|
565
|
+
accountsChange: [string[]];
|
|
566
|
+
error: [AomiChatError];
|
|
567
|
+
}
|
|
568
|
+
declare class WalletManager extends EventEmitter<WalletManagerEvents> {
|
|
569
|
+
private provider;
|
|
570
|
+
private currentAccount;
|
|
571
|
+
private currentChainId;
|
|
572
|
+
private isConnected;
|
|
573
|
+
constructor(provider: EthereumProvider);
|
|
574
|
+
/**
|
|
575
|
+
* Gets the current connected account
|
|
576
|
+
*/
|
|
577
|
+
getCurrentAccount(): string | null;
|
|
578
|
+
/**
|
|
579
|
+
* Gets the current chain ID
|
|
580
|
+
*/
|
|
581
|
+
getCurrentChainId(): SupportedChainId | null;
|
|
582
|
+
/**
|
|
583
|
+
* Gets the current network name
|
|
584
|
+
*/
|
|
585
|
+
getCurrentNetworkName(): string | null;
|
|
586
|
+
/**
|
|
587
|
+
* Checks if wallet is connected
|
|
588
|
+
*/
|
|
589
|
+
getIsConnected(): boolean;
|
|
590
|
+
/**
|
|
591
|
+
* Connects to the wallet
|
|
592
|
+
*/
|
|
593
|
+
connect(): Promise<string>;
|
|
594
|
+
/**
|
|
595
|
+
* Disconnects from the wallet
|
|
596
|
+
*/
|
|
597
|
+
disconnect(): void;
|
|
598
|
+
/**
|
|
599
|
+
* Switches to a specific network
|
|
600
|
+
*/
|
|
601
|
+
switchNetwork(chainId: SupportedChainId): Promise<void>;
|
|
602
|
+
/**
|
|
603
|
+
* Sends a transaction
|
|
604
|
+
*/
|
|
605
|
+
sendTransaction(transaction: TransactionRequest): Promise<string>;
|
|
606
|
+
/**
|
|
607
|
+
* Signs a message
|
|
608
|
+
*/
|
|
609
|
+
signMessage(message: string): Promise<string>;
|
|
610
|
+
/**
|
|
611
|
+
* Gets account balance
|
|
612
|
+
*/
|
|
613
|
+
getBalance(address?: string): Promise<string>;
|
|
614
|
+
/**
|
|
615
|
+
* Updates the provider
|
|
616
|
+
*/
|
|
617
|
+
updateProvider(provider: EthereumProvider): void;
|
|
618
|
+
/**
|
|
619
|
+
* Destroys the wallet manager
|
|
620
|
+
*/
|
|
621
|
+
destroy(): void;
|
|
622
|
+
private initializeState;
|
|
623
|
+
private updateChainId;
|
|
624
|
+
private setupEventListeners;
|
|
625
|
+
private removeProviderListeners;
|
|
626
|
+
private handleAccountsChanged;
|
|
627
|
+
private handleChainChanged;
|
|
628
|
+
private handleDisconnect;
|
|
629
|
+
private validateTransaction;
|
|
630
|
+
private addNetwork;
|
|
631
|
+
private getNetworkConfig;
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* Creates a wallet manager instance
|
|
635
|
+
*/
|
|
636
|
+
declare function createWalletManager(provider: EthereumProvider): WalletManager;
|
|
637
|
+
/**
|
|
638
|
+
* Checks if a provider supports the required methods
|
|
639
|
+
*/
|
|
640
|
+
declare function isValidProvider(provider: unknown): provider is EthereumProvider;
|
|
641
|
+
/**
|
|
642
|
+
* Detects available wallets
|
|
643
|
+
*/
|
|
644
|
+
declare function detectWallets(): Array<{
|
|
645
|
+
name: string;
|
|
646
|
+
provider: EthereumProvider;
|
|
647
|
+
}>;
|
|
648
|
+
declare global {
|
|
649
|
+
interface Window {
|
|
650
|
+
ethereum?: EthereumProvider & {
|
|
651
|
+
isMetaMask?: boolean;
|
|
652
|
+
isWalletConnect?: boolean;
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Resolves a flexible configuration value based on chain ID and mode
|
|
659
|
+
*/
|
|
660
|
+
declare function resolveFlexibleConfig<T>(config: FlexibleConfig<T>, chainId: SupportedChainId, mode: AomiChatMode): T | undefined;
|
|
661
|
+
/**
|
|
662
|
+
* Validates widget configuration parameters
|
|
663
|
+
*/
|
|
664
|
+
declare function validateWidgetParams(params: AomiChatWidgetParams): string[];
|
|
665
|
+
/**
|
|
666
|
+
* Generates a unique session ID
|
|
667
|
+
*/
|
|
668
|
+
declare function generateSessionId(): string;
|
|
669
|
+
/**
|
|
670
|
+
* Validates a session ID format
|
|
671
|
+
*/
|
|
672
|
+
declare function isValidSessionId(sessionId: string): boolean;
|
|
673
|
+
/**
|
|
674
|
+
* Builds widget URL with parameters
|
|
675
|
+
*/
|
|
676
|
+
declare function buildWidgetUrl(baseUrl: string, params: AomiChatWidgetParams): string;
|
|
677
|
+
/**
|
|
678
|
+
* Parses widget parameters from URL search params
|
|
679
|
+
*/
|
|
680
|
+
declare function parseWidgetParams(searchParams: URLSearchParams): Partial<AomiChatWidgetParams>;
|
|
681
|
+
/**
|
|
682
|
+
* Creates a DOM element with classes and attributes
|
|
683
|
+
*/
|
|
684
|
+
declare function createElement<K extends keyof HTMLElementTagNameMap>(tagName: K, options?: {
|
|
685
|
+
className?: string | string[];
|
|
686
|
+
attributes?: Record<string, string>;
|
|
687
|
+
styles?: Partial<CSSStyleDeclaration>;
|
|
688
|
+
children?: (HTMLElement | string)[];
|
|
689
|
+
}): HTMLElementTagNameMap[K];
|
|
690
|
+
/**
|
|
691
|
+
* Checks if an element is visible in the viewport
|
|
692
|
+
*/
|
|
693
|
+
declare function isElementVisible(element: HTMLElement): boolean;
|
|
694
|
+
/**
|
|
695
|
+
* Type guard to check if a value is a valid Ethereum address
|
|
696
|
+
*/
|
|
697
|
+
declare function isEthereumAddress(value: unknown): value is string;
|
|
698
|
+
/**
|
|
699
|
+
* Type guard to check if a value is a valid transaction hash
|
|
700
|
+
*/
|
|
701
|
+
declare function isTransactionHash(value: unknown): value is string;
|
|
702
|
+
/**
|
|
703
|
+
* Type guard to check if an object has a specific property
|
|
704
|
+
*/
|
|
705
|
+
declare function hasProperty<T extends object, K extends string | number | symbol>(obj: T, prop: K): obj is T & Record<K, unknown>;
|
|
706
|
+
/**
|
|
707
|
+
* Delays execution for a specified number of milliseconds
|
|
708
|
+
*/
|
|
709
|
+
declare function delay(ms: number): Promise<void>;
|
|
710
|
+
/**
|
|
711
|
+
* Creates a promise that rejects after a timeout
|
|
712
|
+
*/
|
|
713
|
+
declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number): Promise<T>;
|
|
714
|
+
/**
|
|
715
|
+
* Retries a function with exponential backoff
|
|
716
|
+
*/
|
|
717
|
+
declare function retry<T>(fn: () => Promise<T>, options?: {
|
|
718
|
+
maxAttempts?: number;
|
|
719
|
+
delay?: number;
|
|
720
|
+
backoffFactor?: number;
|
|
721
|
+
shouldRetry?: (error: unknown) => boolean;
|
|
722
|
+
}): Promise<T>;
|
|
723
|
+
/**
|
|
724
|
+
* Detects if running in a browser environment
|
|
725
|
+
*/
|
|
726
|
+
declare function isBrowser(): boolean;
|
|
727
|
+
/**
|
|
728
|
+
* Detects if running on a mobile device
|
|
729
|
+
*/
|
|
730
|
+
declare function isMobile(): boolean;
|
|
731
|
+
/**
|
|
732
|
+
* Gets the current viewport dimensions
|
|
733
|
+
*/
|
|
734
|
+
declare function getViewportDimensions(): {
|
|
735
|
+
width: number;
|
|
736
|
+
height: number;
|
|
737
|
+
};
|
|
738
|
+
/**
|
|
739
|
+
* Formats a timestamp as a human-readable string
|
|
740
|
+
*/
|
|
741
|
+
declare function formatTimestamp(timestamp: Date): string;
|
|
742
|
+
/**
|
|
743
|
+
* Truncates an Ethereum address for display
|
|
744
|
+
*/
|
|
745
|
+
declare function truncateAddress(address: string, startChars?: number, endChars?: number): string;
|
|
746
|
+
/**
|
|
747
|
+
* Formats a number with appropriate decimal places
|
|
748
|
+
*/
|
|
749
|
+
declare function formatNumber(value: number, options?: {
|
|
750
|
+
decimals?: number;
|
|
751
|
+
compact?: boolean;
|
|
752
|
+
currency?: string;
|
|
753
|
+
}): string;
|
|
754
|
+
|
|
755
|
+
declare const VERSION = "0.1.0";
|
|
756
|
+
|
|
757
|
+
interface CreateChatWidgetOptions {
|
|
758
|
+
appCode: string;
|
|
759
|
+
theme?: AomiChatTheme | AomiChatWidgetPalette;
|
|
760
|
+
width?: string;
|
|
761
|
+
height?: string;
|
|
762
|
+
baseUrl?: string;
|
|
763
|
+
provider?: EthereumProvider;
|
|
764
|
+
onReady?: () => void;
|
|
765
|
+
onMessage?: (message: ChatMessage) => void;
|
|
766
|
+
onError?: (error: AomiChatError) => void;
|
|
767
|
+
}
|
|
768
|
+
declare function createChatWidget(containerId: string | HTMLElement, options: CreateChatWidgetOptions): AomiChatWidgetHandler;
|
|
769
|
+
declare const _default: {
|
|
770
|
+
createChatWidget: typeof createChatWidget;
|
|
771
|
+
createAomiChatWidget: typeof createAomiChatWidget;
|
|
772
|
+
VERSION: string;
|
|
773
|
+
SUPPORTED_CHAINS: Record<SupportedChainId, string>;
|
|
774
|
+
PREDEFINED_THEMES: Record<string, ThemeDefinition>;
|
|
775
|
+
ERROR_CODES: {
|
|
776
|
+
readonly INVALID_CONFIG: "INVALID_CONFIG";
|
|
777
|
+
readonly MISSING_APP_CODE: "MISSING_APP_CODE";
|
|
778
|
+
readonly INVALID_THEME: "INVALID_THEME";
|
|
779
|
+
readonly INVALID_DIMENSIONS: "INVALID_DIMENSIONS";
|
|
780
|
+
readonly CONNECTION_FAILED: "CONNECTION_FAILED";
|
|
781
|
+
readonly CONNECTION_TIMEOUT: "CONNECTION_TIMEOUT";
|
|
782
|
+
readonly BACKEND_UNAVAILABLE: "BACKEND_UNAVAILABLE";
|
|
783
|
+
readonly AUTHENTICATION_FAILED: "AUTHENTICATION_FAILED";
|
|
784
|
+
readonly WALLET_NOT_CONNECTED: "WALLET_NOT_CONNECTED";
|
|
785
|
+
readonly WALLET_CONNECTION_FAILED: "WALLET_CONNECTION_FAILED";
|
|
786
|
+
readonly UNSUPPORTED_NETWORK: "UNSUPPORTED_NETWORK";
|
|
787
|
+
readonly TRANSACTION_FAILED: "TRANSACTION_FAILED";
|
|
788
|
+
readonly TRANSACTION_REJECTED: "TRANSACTION_REJECTED";
|
|
789
|
+
readonly MESSAGE_TOO_LONG: "MESSAGE_TOO_LONG";
|
|
790
|
+
readonly RATE_LIMITED: "RATE_LIMITED";
|
|
791
|
+
readonly INVALID_MESSAGE: "INVALID_MESSAGE";
|
|
792
|
+
readonly SESSION_EXPIRED: "SESSION_EXPIRED";
|
|
793
|
+
readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
|
|
794
|
+
readonly INITIALIZATION_FAILED: "INITIALIZATION_FAILED";
|
|
795
|
+
readonly PROVIDER_ERROR: "PROVIDER_ERROR";
|
|
796
|
+
};
|
|
797
|
+
WIDGET_EVENTS: {
|
|
798
|
+
readonly READY: "ready";
|
|
799
|
+
readonly DESTROY: "destroy";
|
|
800
|
+
readonly RESIZE: "resize";
|
|
801
|
+
readonly MESSAGE: "message";
|
|
802
|
+
readonly TYPING_CHANGE: "typingChange";
|
|
803
|
+
readonly PROCESSING_CHANGE: "processingChange";
|
|
804
|
+
readonly CONNECTION_CHANGE: "connectionChange";
|
|
805
|
+
readonly SESSION_START: "sessionStart";
|
|
806
|
+
readonly SESSION_END: "sessionEnd";
|
|
807
|
+
readonly WALLET_CONNECT: "walletConnect";
|
|
808
|
+
readonly WALLET_DISCONNECT: "walletDisconnect";
|
|
809
|
+
readonly NETWORK_CHANGE: "networkChange";
|
|
810
|
+
readonly TRANSACTION_REQUEST: "transactionRequest";
|
|
811
|
+
readonly ERROR: "error";
|
|
812
|
+
};
|
|
813
|
+
};
|
|
814
|
+
|
|
815
|
+
export { API_ENDPOINTS, AomiChatError$1 as AomiChatError, CSS_CLASSES, ChatError, ChatManager, ConfigurationError, ConnectionError, ConnectionStatus, DEFAULT_CHAIN_ID, DEFAULT_MAX_HEIGHT, DEFAULT_MESSAGE_LENGTH, DEFAULT_RECONNECT_ATTEMPTS, DEFAULT_RECONNECT_DELAY, DEFAULT_WIDGET_HEIGHT, DEFAULT_WIDGET_WIDTH, ERROR_CODES, PREDEFINED_THEMES, RateLimitError, ReadinessPhase, SUPPORTED_CHAINS, SessionError, THEME_PALETTES, TIMING, ThemeManager, TransactionError, VERSION, WIDGET_EVENTS, WalletError, WalletManager, buildWidgetUrl, createAomiChatWidget, createChatError, createChatWidget, createConfigurationError, createConnectionError, createCustomPalette, createElement, createRateLimitError, createSessionError, createThemeManager, createTransactionError, createWalletError, createWalletManager, _default as default, delay, detectWallets, formatNumber, formatTimestamp, generateSessionId, getAvailableThemes, getViewportDimensions, hasProperty, isAomiChatError, isBrowser, isChatError, isConfigurationError, isConnectionError, isElementVisible, isEthereumAddress, isMobile, isRateLimitError, isSessionError, isTransactionError, isTransactionHash, isValidProvider, isValidSessionId, isWalletError, parseWidgetParams, resolveFlexibleConfig, retry, truncateAddress, validateCustomPalette, validateWidgetParams, withTimeout };
|
|
816
|
+
export type { AomiChatEventListeners, AomiChatMode, AomiChatTheme, AomiChatWidgetHandler, AomiChatWidgetPalette, AomiChatWidgetPaletteColors, AomiChatWidgetParams, BackendReadiness, ChatInterfaceProps, ChatMessage, ChatState, DeepPartial, EthereumProvider, FlexibleConfig, JsonRpcRequest, MessageInputProps, MessageListProps, OptionalKeys, RequiredKeys, SupportedChainId, ThemeDefinition, TypingIndicatorProps, WalletState, WalletStatusProps, WalletTransaction, WidgetConfig };
|