@iota-uz/sdk 0.1.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/LICENSE +201 -0
- package/README.MD +164 -0
- package/assets/fonts/Actay/Actay-Regular.otf +0 -0
- package/assets/fonts/Actay/Actay-RegularItalic.otf +0 -0
- package/assets/fonts/Actay/ActayCondensed-Thin.otf +0 -0
- package/assets/fonts/Actay/ActayCondensed-ThinItalic.otf +0 -0
- package/assets/fonts/Actay/ActayWide-Bold.otf +0 -0
- package/assets/fonts/Actay/ActayWide-BoldItalic.otf +0 -0
- package/assets/fonts/Gilroy/Gilroy-Black.woff2 +0 -0
- package/assets/fonts/Gilroy/Gilroy-BlackItalic.woff2 +0 -0
- package/assets/fonts/Gilroy/Gilroy-Bold.woff2 +0 -0
- package/assets/fonts/Gilroy/Gilroy-BoldItalic.woff2 +0 -0
- package/assets/fonts/Gilroy/Gilroy-Extrabold.woff2 +0 -0
- package/assets/fonts/Gilroy/Gilroy-ExtraboldItalic.woff2 +0 -0
- package/assets/fonts/Gilroy/Gilroy-Heavy.woff2 +0 -0
- package/assets/fonts/Gilroy/Gilroy-HeavyItalic.woff2 +0 -0
- package/assets/fonts/Gilroy/Gilroy-Light.woff2 +0 -0
- package/assets/fonts/Gilroy/Gilroy-LightItalic.woff2 +0 -0
- package/assets/fonts/Gilroy/Gilroy-Medium.woff2 +0 -0
- package/assets/fonts/Gilroy/Gilroy-MediumItalic.woff2 +0 -0
- package/assets/fonts/Gilroy/Gilroy-Regular.woff2 +0 -0
- package/assets/fonts/Gilroy/Gilroy-RegularItalic.woff2 +0 -0
- package/assets/fonts/Gilroy/Gilroy-Semibold.woff2 +0 -0
- package/assets/fonts/Gilroy/Gilroy-SemiboldItalic.woff2 +0 -0
- package/assets/fonts/Gilroy/Gilroy-Thin.woff2 +0 -0
- package/assets/fonts/Gilroy/Gilroy-ThinItalic.woff2 +0 -0
- package/assets/fonts/Gilroy/Gilroy-UltraLight.woff2 +0 -0
- package/assets/fonts/Gilroy/Gilroy-UltraLightItalic.woff2 +0 -0
- package/assets/fonts/Inter.var.woff2 +0 -0
- package/dist/bichat/index.cjs +3033 -0
- package/dist/bichat/index.cjs.map +1 -0
- package/dist/bichat/index.css +139 -0
- package/dist/bichat/index.css.map +1 -0
- package/dist/bichat/index.d.cts +1081 -0
- package/dist/bichat/index.d.ts +1081 -0
- package/dist/bichat/index.mjs +2959 -0
- package/dist/bichat/index.mjs.map +1 -0
- package/dist/bichat/styles.css +160 -0
- package/dist/index.cjs +191 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +237 -0
- package/dist/index.d.ts +237 -0
- package/dist/index.mjs +178 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +70 -0
- package/tailwind/create-config.cjs +142 -0
- package/tailwind/iota.css +1106 -0
- package/tailwind/main.css +2 -0
|
@@ -0,0 +1,1081 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Type definitions for BI-Chat UI components
|
|
7
|
+
*/
|
|
8
|
+
interface Session {
|
|
9
|
+
id: string;
|
|
10
|
+
title: string;
|
|
11
|
+
status: 'active' | 'archived';
|
|
12
|
+
pinned: boolean;
|
|
13
|
+
createdAt: string;
|
|
14
|
+
updatedAt: string;
|
|
15
|
+
}
|
|
16
|
+
declare enum MessageRole {
|
|
17
|
+
User = "user",
|
|
18
|
+
Assistant = "assistant",
|
|
19
|
+
System = "system",
|
|
20
|
+
Tool = "tool"
|
|
21
|
+
}
|
|
22
|
+
interface Message {
|
|
23
|
+
id: string;
|
|
24
|
+
sessionId: string;
|
|
25
|
+
role: MessageRole;
|
|
26
|
+
content: string;
|
|
27
|
+
createdAt: string;
|
|
28
|
+
toolCalls?: ToolCall[];
|
|
29
|
+
citations?: Citation[];
|
|
30
|
+
chartData?: ChartData;
|
|
31
|
+
artifacts?: Artifact[];
|
|
32
|
+
explanation?: string;
|
|
33
|
+
}
|
|
34
|
+
interface ToolCall {
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
arguments: string;
|
|
38
|
+
}
|
|
39
|
+
interface Citation {
|
|
40
|
+
id: string;
|
|
41
|
+
source: string;
|
|
42
|
+
url?: string;
|
|
43
|
+
excerpt?: string;
|
|
44
|
+
}
|
|
45
|
+
interface Attachment {
|
|
46
|
+
id: string;
|
|
47
|
+
filename: string;
|
|
48
|
+
mimeType: string;
|
|
49
|
+
sizeBytes: number;
|
|
50
|
+
base64Data?: string;
|
|
51
|
+
}
|
|
52
|
+
interface ImageAttachment {
|
|
53
|
+
filename: string;
|
|
54
|
+
mimeType: string;
|
|
55
|
+
sizeBytes: number;
|
|
56
|
+
base64Data: string;
|
|
57
|
+
preview: string;
|
|
58
|
+
}
|
|
59
|
+
interface CodeOutput {
|
|
60
|
+
type: 'image' | 'text' | 'error';
|
|
61
|
+
content: string | ImageAttachment;
|
|
62
|
+
}
|
|
63
|
+
interface QueuedMessage {
|
|
64
|
+
content: string;
|
|
65
|
+
attachments: ImageAttachment[];
|
|
66
|
+
}
|
|
67
|
+
interface ChartData {
|
|
68
|
+
type: 'bar' | 'line' | 'pie' | 'area';
|
|
69
|
+
title?: string;
|
|
70
|
+
data: any[];
|
|
71
|
+
xAxisKey?: string;
|
|
72
|
+
yAxisKey?: string;
|
|
73
|
+
}
|
|
74
|
+
interface Artifact {
|
|
75
|
+
type: 'excel' | 'pdf';
|
|
76
|
+
filename: string;
|
|
77
|
+
url: string;
|
|
78
|
+
sizeReadable?: string;
|
|
79
|
+
rowCount?: number;
|
|
80
|
+
description?: string;
|
|
81
|
+
}
|
|
82
|
+
interface PendingQuestion {
|
|
83
|
+
id: string;
|
|
84
|
+
turnId: string;
|
|
85
|
+
question: string;
|
|
86
|
+
type: 'MULTIPLE_CHOICE' | 'FREE_TEXT';
|
|
87
|
+
options?: string[];
|
|
88
|
+
status: 'PENDING' | 'ANSWERED' | 'CANCELLED';
|
|
89
|
+
}
|
|
90
|
+
type QuestionAnswers = Record<string, string>;
|
|
91
|
+
interface StreamChunk {
|
|
92
|
+
type: 'chunk' | 'error' | 'done' | 'user_message';
|
|
93
|
+
content?: string;
|
|
94
|
+
error?: string;
|
|
95
|
+
sessionId?: string;
|
|
96
|
+
}
|
|
97
|
+
interface ChatDataSource {
|
|
98
|
+
createSession(): Promise<Session>;
|
|
99
|
+
fetchSession(id: string): Promise<{
|
|
100
|
+
session: Session;
|
|
101
|
+
messages: Message[];
|
|
102
|
+
pendingQuestion?: PendingQuestion | null;
|
|
103
|
+
} | null>;
|
|
104
|
+
sendMessage(sessionId: string, content: string, attachments?: Attachment[], signal?: AbortSignal): AsyncGenerator<StreamChunk>;
|
|
105
|
+
submitQuestionAnswers(sessionId: string, questionId: string, answers: QuestionAnswers): Promise<{
|
|
106
|
+
success: boolean;
|
|
107
|
+
error?: string;
|
|
108
|
+
}>;
|
|
109
|
+
cancelPendingQuestion(questionId: string): Promise<{
|
|
110
|
+
success: boolean;
|
|
111
|
+
error?: string;
|
|
112
|
+
}>;
|
|
113
|
+
navigateToSession?(sessionId: string): void;
|
|
114
|
+
}
|
|
115
|
+
interface ChatSessionContextValue {
|
|
116
|
+
message: string;
|
|
117
|
+
messages: Message[];
|
|
118
|
+
loading: boolean;
|
|
119
|
+
error: string | null;
|
|
120
|
+
currentSessionId?: string;
|
|
121
|
+
pendingQuestion: PendingQuestion | null;
|
|
122
|
+
session: Session | null;
|
|
123
|
+
fetching: boolean;
|
|
124
|
+
streamingContent: string;
|
|
125
|
+
isStreaming: boolean;
|
|
126
|
+
messageQueue: QueuedMessage[];
|
|
127
|
+
codeOutputs: CodeOutput[];
|
|
128
|
+
setMessage: (message: string) => void;
|
|
129
|
+
setError: (error: string | null) => void;
|
|
130
|
+
setCodeOutputs: (outputs: CodeOutput[]) => void;
|
|
131
|
+
handleSubmit: (e: React.FormEvent, attachments?: ImageAttachment[]) => void;
|
|
132
|
+
handleRegenerate?: (messageId: string) => Promise<void>;
|
|
133
|
+
handleEdit?: (messageId: string, newContent: string) => Promise<void>;
|
|
134
|
+
handleCopy: (text: string) => Promise<void>;
|
|
135
|
+
handleSubmitQuestionAnswers: (answers: QuestionAnswers) => void;
|
|
136
|
+
handleCancelPendingQuestion: () => Promise<void>;
|
|
137
|
+
handleUnqueue: () => {
|
|
138
|
+
content: string;
|
|
139
|
+
attachments: ImageAttachment[];
|
|
140
|
+
} | null;
|
|
141
|
+
sendMessage: (content: string, attachments?: Attachment[]) => Promise<void>;
|
|
142
|
+
cancel: () => void;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
interface ChatSessionProps {
|
|
146
|
+
dataSource: ChatDataSource;
|
|
147
|
+
sessionId?: string;
|
|
148
|
+
isReadOnly?: boolean;
|
|
149
|
+
renderUserMessage?: (message: Message) => ReactNode;
|
|
150
|
+
renderAssistantMessage?: (message: Message) => ReactNode;
|
|
151
|
+
className?: string;
|
|
152
|
+
/** Custom content to display as header */
|
|
153
|
+
headerSlot?: ReactNode;
|
|
154
|
+
/** Custom welcome screen component (replaces default WelcomeContent) */
|
|
155
|
+
welcomeSlot?: ReactNode;
|
|
156
|
+
/** Custom logo for the header */
|
|
157
|
+
logoSlot?: ReactNode;
|
|
158
|
+
/** Custom action buttons for the header */
|
|
159
|
+
actionsSlot?: ReactNode;
|
|
160
|
+
/** Callback when user navigates back */
|
|
161
|
+
onBack?: () => void;
|
|
162
|
+
}
|
|
163
|
+
declare function ChatSession(props: ChatSessionProps): react_jsx_runtime.JSX.Element;
|
|
164
|
+
|
|
165
|
+
interface ChatHeaderProps {
|
|
166
|
+
session: Session | null;
|
|
167
|
+
onBack?: () => void;
|
|
168
|
+
/** Custom logo component to display */
|
|
169
|
+
logoSlot?: ReactNode;
|
|
170
|
+
/** Custom action buttons */
|
|
171
|
+
actionsSlot?: ReactNode;
|
|
172
|
+
}
|
|
173
|
+
declare function ChatHeader({ session, onBack, logoSlot, actionsSlot }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
|
|
174
|
+
|
|
175
|
+
interface MessageListProps {
|
|
176
|
+
renderUserMessage?: (message: Message) => ReactNode;
|
|
177
|
+
renderAssistantMessage?: (message: Message) => ReactNode;
|
|
178
|
+
}
|
|
179
|
+
declare function MessageList({ renderUserMessage, renderAssistantMessage }: MessageListProps): react_jsx_runtime.JSX.Element;
|
|
180
|
+
|
|
181
|
+
interface TurnBubbleProps {
|
|
182
|
+
message: Message;
|
|
183
|
+
renderUserMessage?: (message: Message) => ReactNode;
|
|
184
|
+
renderAssistantMessage?: (message: Message) => ReactNode;
|
|
185
|
+
}
|
|
186
|
+
declare function TurnBubble({ message, renderUserMessage, renderAssistantMessage, }: TurnBubbleProps): react_jsx_runtime.JSX.Element | null;
|
|
187
|
+
|
|
188
|
+
interface UserTurnViewProps {
|
|
189
|
+
message: Message & {
|
|
190
|
+
attachments?: ImageAttachment[];
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
declare function UserTurnView({ message }: UserTurnViewProps): react_jsx_runtime.JSX.Element;
|
|
194
|
+
|
|
195
|
+
interface AssistantTurnViewProps {
|
|
196
|
+
message: Message & {
|
|
197
|
+
codeOutputs?: CodeOutput[];
|
|
198
|
+
isStreaming?: boolean;
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
declare function AssistantTurnView({ message }: AssistantTurnViewProps): react_jsx_runtime.JSX.Element;
|
|
202
|
+
|
|
203
|
+
interface MarkdownRendererProps {
|
|
204
|
+
content: string;
|
|
205
|
+
citations?: Citation[] | null;
|
|
206
|
+
}
|
|
207
|
+
declare function MarkdownRenderer({ content }: MarkdownRendererProps): react_jsx_runtime.JSX.Element;
|
|
208
|
+
|
|
209
|
+
interface ChartCardProps {
|
|
210
|
+
chartData: ChartData;
|
|
211
|
+
}
|
|
212
|
+
declare function ChartCard({ chartData }: ChartCardProps): react_jsx_runtime.JSX.Element;
|
|
213
|
+
|
|
214
|
+
interface SourcesPanelProps {
|
|
215
|
+
citations: Citation[];
|
|
216
|
+
}
|
|
217
|
+
declare function SourcesPanel({ citations }: SourcesPanelProps): react_jsx_runtime.JSX.Element | null;
|
|
218
|
+
|
|
219
|
+
interface DownloadCardProps {
|
|
220
|
+
artifact: Artifact;
|
|
221
|
+
}
|
|
222
|
+
declare function DownloadCard({ artifact }: DownloadCardProps): react_jsx_runtime.JSX.Element;
|
|
223
|
+
|
|
224
|
+
interface InlineQuestionFormProps {
|
|
225
|
+
pendingQuestion: PendingQuestion;
|
|
226
|
+
}
|
|
227
|
+
declare function InlineQuestionForm({ pendingQuestion }: InlineQuestionFormProps): react_jsx_runtime.JSX.Element;
|
|
228
|
+
|
|
229
|
+
interface MessageInputRef {
|
|
230
|
+
focus: () => void;
|
|
231
|
+
clear: () => void;
|
|
232
|
+
}
|
|
233
|
+
interface MessageInputProps {
|
|
234
|
+
message: string;
|
|
235
|
+
loading: boolean;
|
|
236
|
+
fetching?: boolean;
|
|
237
|
+
disabled?: boolean;
|
|
238
|
+
messageQueue?: QueuedMessage[];
|
|
239
|
+
onMessageChange: (value: string) => void;
|
|
240
|
+
onSubmit: (e: React.FormEvent, attachments: ImageAttachment[]) => void;
|
|
241
|
+
onUnqueue?: () => {
|
|
242
|
+
content: string;
|
|
243
|
+
attachments: ImageAttachment[];
|
|
244
|
+
} | null;
|
|
245
|
+
placeholder?: string;
|
|
246
|
+
maxFiles?: number;
|
|
247
|
+
maxFileSize?: number;
|
|
248
|
+
containerClassName?: string;
|
|
249
|
+
}
|
|
250
|
+
declare const MessageInput: react.ForwardRefExoticComponent<MessageInputProps & react.RefAttributes<MessageInputRef>>;
|
|
251
|
+
|
|
252
|
+
interface AttachmentGridProps {
|
|
253
|
+
attachments: ImageAttachment[];
|
|
254
|
+
onRemove?: (index: number) => void;
|
|
255
|
+
onView?: (index: number) => void;
|
|
256
|
+
className?: string;
|
|
257
|
+
}
|
|
258
|
+
declare function AttachmentGrid({ attachments, onRemove, onView, className }: AttachmentGridProps): react_jsx_runtime.JSX.Element | null;
|
|
259
|
+
|
|
260
|
+
interface ImageModalProps {
|
|
261
|
+
images: ImageAttachment[];
|
|
262
|
+
initialIndex: number;
|
|
263
|
+
onClose: () => void;
|
|
264
|
+
}
|
|
265
|
+
declare function ImageModal({ images, initialIndex, onClose }: ImageModalProps): react_jsx_runtime.JSX.Element;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* WelcomeContent Component
|
|
269
|
+
* Landing page shown when starting a new chat session
|
|
270
|
+
* Clean, professional design for enterprise BI applications
|
|
271
|
+
*/
|
|
272
|
+
interface WelcomeContentProps {
|
|
273
|
+
onPromptSelect?: (prompt: string) => void;
|
|
274
|
+
title?: string;
|
|
275
|
+
description?: string;
|
|
276
|
+
disabled?: boolean;
|
|
277
|
+
}
|
|
278
|
+
declare function WelcomeContent({ onPromptSelect, title, description, disabled }: WelcomeContentProps): react_jsx_runtime.JSX.Element;
|
|
279
|
+
|
|
280
|
+
interface CodeOutputsPanelProps {
|
|
281
|
+
outputs: CodeOutput[];
|
|
282
|
+
}
|
|
283
|
+
declare function CodeOutputsPanel({ outputs }: CodeOutputsPanelProps): react_jsx_runtime.JSX.Element | null;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* StreamingCursor Component
|
|
287
|
+
* Animated cursor shown during AI response streaming
|
|
288
|
+
*/
|
|
289
|
+
declare function StreamingCursor(): react_jsx_runtime.JSX.Element;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* ScrollToBottomButton Component
|
|
293
|
+
* Floating button to scroll chat to bottom, shown when user scrolls up
|
|
294
|
+
*/
|
|
295
|
+
interface ScrollToBottomButtonProps {
|
|
296
|
+
show: boolean;
|
|
297
|
+
onClick: () => void;
|
|
298
|
+
unreadCount?: number;
|
|
299
|
+
}
|
|
300
|
+
declare function ScrollToBottomButton({ show, onClick, unreadCount }: ScrollToBottomButtonProps): react_jsx_runtime.JSX.Element;
|
|
301
|
+
|
|
302
|
+
interface EmptyStateProps {
|
|
303
|
+
/** Optional icon to display */
|
|
304
|
+
icon?: ReactNode;
|
|
305
|
+
/** Main title text */
|
|
306
|
+
title: string;
|
|
307
|
+
/** Optional description text */
|
|
308
|
+
description?: string;
|
|
309
|
+
/** Optional action element (button, link, etc.) */
|
|
310
|
+
action?: ReactNode;
|
|
311
|
+
/** Additional CSS classes */
|
|
312
|
+
className?: string;
|
|
313
|
+
/** Size variant */
|
|
314
|
+
size?: 'sm' | 'md' | 'lg';
|
|
315
|
+
}
|
|
316
|
+
declare function EmptyState({ icon, title, description, action, className, size, }: EmptyStateProps): react_jsx_runtime.JSX.Element;
|
|
317
|
+
declare const _default$3: react.MemoExoticComponent<typeof EmptyState>;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* EditableText Component
|
|
321
|
+
* Inline editable text with double-click to edit
|
|
322
|
+
* Features: auto-focus, auto-select, Enter to save, Escape to cancel
|
|
323
|
+
* Can be triggered programmatically via ref.startEditing()
|
|
324
|
+
*/
|
|
325
|
+
interface EditableTextProps {
|
|
326
|
+
/** Current text value */
|
|
327
|
+
value: string;
|
|
328
|
+
/** Callback when text is saved */
|
|
329
|
+
onSave: (newValue: string) => void;
|
|
330
|
+
/** Maximum character length */
|
|
331
|
+
maxLength?: number;
|
|
332
|
+
/** Whether the component is in loading state */
|
|
333
|
+
isLoading?: boolean;
|
|
334
|
+
/** Placeholder text when empty */
|
|
335
|
+
placeholder?: string;
|
|
336
|
+
/** Additional CSS classes for the text display */
|
|
337
|
+
className?: string;
|
|
338
|
+
/** Additional CSS classes for the input */
|
|
339
|
+
inputClassName?: string;
|
|
340
|
+
/** Font size variant */
|
|
341
|
+
size?: 'sm' | 'md' | 'lg';
|
|
342
|
+
}
|
|
343
|
+
interface EditableTextRef {
|
|
344
|
+
/** Programmatically start editing mode */
|
|
345
|
+
startEditing: () => void;
|
|
346
|
+
/** Programmatically cancel editing */
|
|
347
|
+
cancelEditing: () => void;
|
|
348
|
+
}
|
|
349
|
+
declare const _default$2: react.MemoExoticComponent<react.ForwardRefExoticComponent<EditableTextProps & react.RefAttributes<EditableTextRef>>>;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* SearchInput Component
|
|
353
|
+
* Reusable search input with icon, clear button, and keyboard shortcuts
|
|
354
|
+
*/
|
|
355
|
+
interface SearchInputProps {
|
|
356
|
+
/** Current search value */
|
|
357
|
+
value: string;
|
|
358
|
+
/** Callback when value changes */
|
|
359
|
+
onChange: (value: string) => void;
|
|
360
|
+
/** Placeholder text */
|
|
361
|
+
placeholder?: string;
|
|
362
|
+
/** Auto-focus on mount */
|
|
363
|
+
autoFocus?: boolean;
|
|
364
|
+
/** Callback when Enter is pressed */
|
|
365
|
+
onSubmit?: (value: string) => void;
|
|
366
|
+
/** Callback when Escape is pressed */
|
|
367
|
+
onEscape?: () => void;
|
|
368
|
+
/** Additional CSS classes for the container */
|
|
369
|
+
className?: string;
|
|
370
|
+
/** Size variant */
|
|
371
|
+
size?: 'sm' | 'md' | 'lg';
|
|
372
|
+
/** Disable the input */
|
|
373
|
+
disabled?: boolean;
|
|
374
|
+
/** ARIA label for accessibility */
|
|
375
|
+
ariaLabel?: string;
|
|
376
|
+
}
|
|
377
|
+
declare function SearchInput({ value, onChange, placeholder, autoFocus, onSubmit, onEscape, className, size, disabled, ariaLabel, }: SearchInputProps): react_jsx_runtime.JSX.Element;
|
|
378
|
+
declare const _default$1: react.MemoExoticComponent<typeof SearchInput>;
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Skeleton Component
|
|
382
|
+
* Reusable loading skeleton with multiple variants
|
|
383
|
+
*/
|
|
384
|
+
interface SkeletonProps {
|
|
385
|
+
/** Skeleton variant */
|
|
386
|
+
variant?: 'text' | 'circular' | 'rectangular' | 'rounded';
|
|
387
|
+
/** Width (CSS value or number for pixels) */
|
|
388
|
+
width?: string | number;
|
|
389
|
+
/** Height (CSS value or number for pixels) */
|
|
390
|
+
height?: string | number;
|
|
391
|
+
/** Additional CSS classes */
|
|
392
|
+
className?: string;
|
|
393
|
+
/** Enable animation */
|
|
394
|
+
animate?: boolean;
|
|
395
|
+
}
|
|
396
|
+
interface SkeletonGroupProps {
|
|
397
|
+
/** Number of skeleton items to render */
|
|
398
|
+
count?: number;
|
|
399
|
+
/** Gap between items */
|
|
400
|
+
gap?: 'sm' | 'md' | 'lg';
|
|
401
|
+
/** Additional CSS classes for the container */
|
|
402
|
+
className?: string;
|
|
403
|
+
/** Render function for each skeleton item */
|
|
404
|
+
children?: (index: number) => React.ReactNode;
|
|
405
|
+
}
|
|
406
|
+
declare function Skeleton({ variant, width, height, className, animate, }: SkeletonProps): react_jsx_runtime.JSX.Element;
|
|
407
|
+
/**
|
|
408
|
+
* SkeletonGroup - Renders multiple skeleton items
|
|
409
|
+
*/
|
|
410
|
+
declare function SkeletonGroup({ count, gap, className, children, }: SkeletonGroupProps): react_jsx_runtime.JSX.Element;
|
|
411
|
+
/**
|
|
412
|
+
* SkeletonText - Text line skeleton with configurable width
|
|
413
|
+
*/
|
|
414
|
+
declare function SkeletonText({ lines, className, }: {
|
|
415
|
+
lines?: number;
|
|
416
|
+
className?: string;
|
|
417
|
+
}): react_jsx_runtime.JSX.Element;
|
|
418
|
+
/**
|
|
419
|
+
* SkeletonAvatar - Circular avatar skeleton
|
|
420
|
+
*/
|
|
421
|
+
declare function SkeletonAvatar({ size, className, }: {
|
|
422
|
+
size?: number;
|
|
423
|
+
className?: string;
|
|
424
|
+
}): react_jsx_runtime.JSX.Element;
|
|
425
|
+
/**
|
|
426
|
+
* SkeletonCard - Card-shaped skeleton
|
|
427
|
+
*/
|
|
428
|
+
declare function SkeletonCard({ width, height, className, }: {
|
|
429
|
+
width?: string | number;
|
|
430
|
+
height?: string | number;
|
|
431
|
+
className?: string;
|
|
432
|
+
}): react_jsx_runtime.JSX.Element;
|
|
433
|
+
/**
|
|
434
|
+
* ListItemSkeleton - Common list item skeleton with icon and text
|
|
435
|
+
*/
|
|
436
|
+
declare function ListItemSkeleton({ className }: {
|
|
437
|
+
className?: string;
|
|
438
|
+
}): react_jsx_runtime.JSX.Element;
|
|
439
|
+
declare const _default: react.MemoExoticComponent<typeof Skeleton>;
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Framer Motion animation variants for BiChat UI
|
|
443
|
+
* Subtle, professional animations for enterprise applications
|
|
444
|
+
* Respects prefers-reduced-motion for accessibility
|
|
445
|
+
*/
|
|
446
|
+
/**
|
|
447
|
+
* Fade in animation
|
|
448
|
+
*/
|
|
449
|
+
declare const fadeInVariants: {
|
|
450
|
+
initial: {
|
|
451
|
+
opacity: number;
|
|
452
|
+
};
|
|
453
|
+
animate: {
|
|
454
|
+
opacity: number;
|
|
455
|
+
transition: {
|
|
456
|
+
duration: number;
|
|
457
|
+
};
|
|
458
|
+
};
|
|
459
|
+
exit: {
|
|
460
|
+
opacity: number;
|
|
461
|
+
transition: {
|
|
462
|
+
duration: number;
|
|
463
|
+
};
|
|
464
|
+
};
|
|
465
|
+
};
|
|
466
|
+
/**
|
|
467
|
+
* Fade in with subtle slide up
|
|
468
|
+
*/
|
|
469
|
+
declare const fadeInUpVariants: {
|
|
470
|
+
initial: {
|
|
471
|
+
opacity: number;
|
|
472
|
+
y: number;
|
|
473
|
+
};
|
|
474
|
+
animate: {
|
|
475
|
+
opacity: number;
|
|
476
|
+
y: number;
|
|
477
|
+
transition: {
|
|
478
|
+
duration: number;
|
|
479
|
+
ease: number[];
|
|
480
|
+
};
|
|
481
|
+
};
|
|
482
|
+
exit: {
|
|
483
|
+
opacity: number;
|
|
484
|
+
y: number;
|
|
485
|
+
transition: {
|
|
486
|
+
duration: number;
|
|
487
|
+
};
|
|
488
|
+
};
|
|
489
|
+
};
|
|
490
|
+
/**
|
|
491
|
+
* Scale fade for modals and popups
|
|
492
|
+
*/
|
|
493
|
+
declare const scaleFadeVariants: {
|
|
494
|
+
initial: {
|
|
495
|
+
opacity: number;
|
|
496
|
+
scale: number;
|
|
497
|
+
};
|
|
498
|
+
animate: {
|
|
499
|
+
opacity: number;
|
|
500
|
+
scale: number;
|
|
501
|
+
transition: {
|
|
502
|
+
duration: number;
|
|
503
|
+
};
|
|
504
|
+
};
|
|
505
|
+
exit: {
|
|
506
|
+
opacity: number;
|
|
507
|
+
scale: number;
|
|
508
|
+
transition: {
|
|
509
|
+
duration: number;
|
|
510
|
+
};
|
|
511
|
+
};
|
|
512
|
+
};
|
|
513
|
+
/**
|
|
514
|
+
* Modal backdrop
|
|
515
|
+
*/
|
|
516
|
+
declare const backdropVariants: {
|
|
517
|
+
initial: {
|
|
518
|
+
opacity: number;
|
|
519
|
+
};
|
|
520
|
+
animate: {
|
|
521
|
+
opacity: number;
|
|
522
|
+
transition: {
|
|
523
|
+
duration: number;
|
|
524
|
+
};
|
|
525
|
+
};
|
|
526
|
+
exit: {
|
|
527
|
+
opacity: number;
|
|
528
|
+
transition: {
|
|
529
|
+
duration: number;
|
|
530
|
+
};
|
|
531
|
+
};
|
|
532
|
+
};
|
|
533
|
+
/**
|
|
534
|
+
* Button press feedback
|
|
535
|
+
*/
|
|
536
|
+
declare const buttonVariants: {
|
|
537
|
+
tap: {
|
|
538
|
+
scale: number;
|
|
539
|
+
};
|
|
540
|
+
};
|
|
541
|
+
/**
|
|
542
|
+
* Stagger container for lists
|
|
543
|
+
*/
|
|
544
|
+
declare const staggerContainerVariants: {
|
|
545
|
+
hidden: {
|
|
546
|
+
opacity: number;
|
|
547
|
+
};
|
|
548
|
+
visible: {
|
|
549
|
+
opacity: number;
|
|
550
|
+
transition: {
|
|
551
|
+
staggerChildren: number;
|
|
552
|
+
delayChildren: number;
|
|
553
|
+
};
|
|
554
|
+
};
|
|
555
|
+
};
|
|
556
|
+
/**
|
|
557
|
+
* List item animation
|
|
558
|
+
*/
|
|
559
|
+
declare const listItemVariants: {
|
|
560
|
+
initial: {
|
|
561
|
+
opacity: number;
|
|
562
|
+
x: number;
|
|
563
|
+
};
|
|
564
|
+
animate: {
|
|
565
|
+
opacity: number;
|
|
566
|
+
x: number;
|
|
567
|
+
transition: {
|
|
568
|
+
duration: number;
|
|
569
|
+
};
|
|
570
|
+
};
|
|
571
|
+
exit: {
|
|
572
|
+
opacity: number;
|
|
573
|
+
x: number;
|
|
574
|
+
transition: {
|
|
575
|
+
duration: number;
|
|
576
|
+
};
|
|
577
|
+
};
|
|
578
|
+
};
|
|
579
|
+
/**
|
|
580
|
+
* Message entrance animation
|
|
581
|
+
*/
|
|
582
|
+
declare const messageVariants: {
|
|
583
|
+
initial: {
|
|
584
|
+
opacity: number;
|
|
585
|
+
y: number;
|
|
586
|
+
};
|
|
587
|
+
animate: {
|
|
588
|
+
opacity: number;
|
|
589
|
+
y: number;
|
|
590
|
+
transition: {
|
|
591
|
+
duration: number;
|
|
592
|
+
ease: number[];
|
|
593
|
+
};
|
|
594
|
+
};
|
|
595
|
+
exit: {
|
|
596
|
+
opacity: number;
|
|
597
|
+
transition: {
|
|
598
|
+
duration: number;
|
|
599
|
+
};
|
|
600
|
+
};
|
|
601
|
+
};
|
|
602
|
+
/**
|
|
603
|
+
* Container for staggered messages
|
|
604
|
+
*/
|
|
605
|
+
declare const messageContainerVariants: {
|
|
606
|
+
initial: {
|
|
607
|
+
opacity: number;
|
|
608
|
+
};
|
|
609
|
+
animate: {
|
|
610
|
+
opacity: number;
|
|
611
|
+
transition: {
|
|
612
|
+
staggerChildren: number;
|
|
613
|
+
delayChildren: number;
|
|
614
|
+
};
|
|
615
|
+
};
|
|
616
|
+
};
|
|
617
|
+
/**
|
|
618
|
+
* Typing indicator dots
|
|
619
|
+
*/
|
|
620
|
+
declare const typingDotVariants: {
|
|
621
|
+
initial: {
|
|
622
|
+
opacity: number;
|
|
623
|
+
};
|
|
624
|
+
animate: {
|
|
625
|
+
opacity: number[];
|
|
626
|
+
transition: {
|
|
627
|
+
duration: number;
|
|
628
|
+
repeat: number;
|
|
629
|
+
ease: string;
|
|
630
|
+
};
|
|
631
|
+
};
|
|
632
|
+
};
|
|
633
|
+
/**
|
|
634
|
+
* Floating button (scroll to bottom, etc.)
|
|
635
|
+
*/
|
|
636
|
+
declare const floatingButtonVariants: {
|
|
637
|
+
initial: {
|
|
638
|
+
opacity: number;
|
|
639
|
+
scale: number;
|
|
640
|
+
};
|
|
641
|
+
animate: {
|
|
642
|
+
opacity: number;
|
|
643
|
+
scale: number;
|
|
644
|
+
transition: {
|
|
645
|
+
duration: number;
|
|
646
|
+
};
|
|
647
|
+
};
|
|
648
|
+
exit: {
|
|
649
|
+
opacity: number;
|
|
650
|
+
scale: number;
|
|
651
|
+
transition: {
|
|
652
|
+
duration: number;
|
|
653
|
+
};
|
|
654
|
+
};
|
|
655
|
+
};
|
|
656
|
+
/**
|
|
657
|
+
* Dropdown menu
|
|
658
|
+
*/
|
|
659
|
+
declare const dropdownVariants: {
|
|
660
|
+
initial: {
|
|
661
|
+
opacity: number;
|
|
662
|
+
y: number;
|
|
663
|
+
};
|
|
664
|
+
animate: {
|
|
665
|
+
opacity: number;
|
|
666
|
+
y: number;
|
|
667
|
+
transition: {
|
|
668
|
+
duration: number;
|
|
669
|
+
};
|
|
670
|
+
};
|
|
671
|
+
exit: {
|
|
672
|
+
opacity: number;
|
|
673
|
+
y: number;
|
|
674
|
+
transition: {
|
|
675
|
+
duration: number;
|
|
676
|
+
};
|
|
677
|
+
};
|
|
678
|
+
};
|
|
679
|
+
/**
|
|
680
|
+
* Toast notification
|
|
681
|
+
*/
|
|
682
|
+
declare const toastVariants: {
|
|
683
|
+
initial: {
|
|
684
|
+
opacity: number;
|
|
685
|
+
y: number;
|
|
686
|
+
};
|
|
687
|
+
animate: {
|
|
688
|
+
opacity: number;
|
|
689
|
+
y: number;
|
|
690
|
+
transition: {
|
|
691
|
+
duration: number;
|
|
692
|
+
};
|
|
693
|
+
};
|
|
694
|
+
exit: {
|
|
695
|
+
opacity: number;
|
|
696
|
+
y: number;
|
|
697
|
+
transition: {
|
|
698
|
+
duration: number;
|
|
699
|
+
};
|
|
700
|
+
};
|
|
701
|
+
};
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Per-session rate limiter
|
|
705
|
+
* Prevents excessive requests within a time window
|
|
706
|
+
*/
|
|
707
|
+
interface RateLimiterConfig {
|
|
708
|
+
maxRequests: number;
|
|
709
|
+
windowMs: number;
|
|
710
|
+
}
|
|
711
|
+
declare class RateLimiter {
|
|
712
|
+
private timestamps;
|
|
713
|
+
private maxRequests;
|
|
714
|
+
private windowMs;
|
|
715
|
+
constructor(config: RateLimiterConfig);
|
|
716
|
+
/**
|
|
717
|
+
* Check if a request can be made
|
|
718
|
+
* Updates internal state if request is allowed
|
|
719
|
+
*/
|
|
720
|
+
canMakeRequest(): boolean;
|
|
721
|
+
/**
|
|
722
|
+
* Get milliseconds until next request is allowed
|
|
723
|
+
* Returns 0 if request can be made immediately
|
|
724
|
+
*/
|
|
725
|
+
getTimeUntilNextRequest(): number;
|
|
726
|
+
/**
|
|
727
|
+
* Reset the rate limiter state
|
|
728
|
+
*/
|
|
729
|
+
reset(): void;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
interface ChatSessionProviderProps {
|
|
733
|
+
dataSource: ChatDataSource;
|
|
734
|
+
sessionId?: string;
|
|
735
|
+
rateLimiter?: RateLimiter;
|
|
736
|
+
children: ReactNode;
|
|
737
|
+
}
|
|
738
|
+
declare function ChatSessionProvider({ dataSource, sessionId, rateLimiter: externalRateLimiter, children }: ChatSessionProviderProps): react_jsx_runtime.JSX.Element;
|
|
739
|
+
declare function useChat(): ChatSessionContextValue;
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Type definitions matching Go structs for server-side context
|
|
743
|
+
*/
|
|
744
|
+
interface UserContext {
|
|
745
|
+
id: number;
|
|
746
|
+
email: string;
|
|
747
|
+
firstName: string;
|
|
748
|
+
lastName: string;
|
|
749
|
+
permissions: string[];
|
|
750
|
+
}
|
|
751
|
+
interface TenantContext {
|
|
752
|
+
id: string;
|
|
753
|
+
name: string;
|
|
754
|
+
}
|
|
755
|
+
interface LocaleContext {
|
|
756
|
+
language: string;
|
|
757
|
+
translations: Record<string, string>;
|
|
758
|
+
}
|
|
759
|
+
interface AppConfig {
|
|
760
|
+
graphQLEndpoint: string;
|
|
761
|
+
streamEndpoint: string;
|
|
762
|
+
}
|
|
763
|
+
interface Extensions {
|
|
764
|
+
branding?: {
|
|
765
|
+
appName?: string;
|
|
766
|
+
logoUrl?: string;
|
|
767
|
+
theme?: {
|
|
768
|
+
primary?: string;
|
|
769
|
+
secondary?: string;
|
|
770
|
+
accent?: string;
|
|
771
|
+
};
|
|
772
|
+
welcome?: {
|
|
773
|
+
title?: string;
|
|
774
|
+
description?: string;
|
|
775
|
+
examplePrompts?: Array<{
|
|
776
|
+
category: string;
|
|
777
|
+
text: string;
|
|
778
|
+
icon: string;
|
|
779
|
+
}>;
|
|
780
|
+
};
|
|
781
|
+
colors?: {
|
|
782
|
+
primary?: string;
|
|
783
|
+
secondary?: string;
|
|
784
|
+
accent?: string;
|
|
785
|
+
};
|
|
786
|
+
logo?: {
|
|
787
|
+
src?: string;
|
|
788
|
+
alt?: string;
|
|
789
|
+
};
|
|
790
|
+
};
|
|
791
|
+
features?: {
|
|
792
|
+
vision?: boolean;
|
|
793
|
+
webSearch?: boolean;
|
|
794
|
+
codeInterpreter?: boolean;
|
|
795
|
+
multiAgent?: boolean;
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
interface IotaContext {
|
|
799
|
+
user: UserContext;
|
|
800
|
+
tenant: TenantContext;
|
|
801
|
+
locale: LocaleContext;
|
|
802
|
+
config: AppConfig;
|
|
803
|
+
extensions?: Extensions;
|
|
804
|
+
}
|
|
805
|
+
declare global {
|
|
806
|
+
interface Window {
|
|
807
|
+
__BICHAT_CONTEXT__: IotaContext;
|
|
808
|
+
__CSRF_TOKEN__: string;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
interface IotaContextProviderProps {
|
|
813
|
+
children: ReactNode;
|
|
814
|
+
}
|
|
815
|
+
declare function IotaContextProvider({ children }: IotaContextProviderProps): react_jsx_runtime.JSX.Element;
|
|
816
|
+
declare function useIotaContext(): IotaContext;
|
|
817
|
+
/**
|
|
818
|
+
* Check if user has a specific permission
|
|
819
|
+
*/
|
|
820
|
+
declare function hasPermission$1(permission: string): boolean;
|
|
821
|
+
|
|
822
|
+
interface BiChatConfig {
|
|
823
|
+
user: {
|
|
824
|
+
id: string;
|
|
825
|
+
email: string;
|
|
826
|
+
firstName: string;
|
|
827
|
+
lastName: string;
|
|
828
|
+
permissions: string[];
|
|
829
|
+
};
|
|
830
|
+
tenant: {
|
|
831
|
+
id: string;
|
|
832
|
+
name: string;
|
|
833
|
+
};
|
|
834
|
+
locale: {
|
|
835
|
+
language: string;
|
|
836
|
+
translations: Record<string, string>;
|
|
837
|
+
};
|
|
838
|
+
endpoints: {
|
|
839
|
+
graphQL: string;
|
|
840
|
+
stream: string;
|
|
841
|
+
};
|
|
842
|
+
csrfToken?: string;
|
|
843
|
+
}
|
|
844
|
+
interface ConfigProviderProps {
|
|
845
|
+
config?: BiChatConfig;
|
|
846
|
+
useGlobalConfig?: boolean;
|
|
847
|
+
children: ReactNode;
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* ConfigProvider component
|
|
851
|
+
* Provides configuration to the BiChat library
|
|
852
|
+
*
|
|
853
|
+
* @param config - Configuration object (preferred method)
|
|
854
|
+
* @param useGlobalConfig - If true, falls back to window.__BICHAT_CONTEXT__ when config is not provided
|
|
855
|
+
* @param children - React children
|
|
856
|
+
*/
|
|
857
|
+
declare function ConfigProvider({ config, useGlobalConfig, children }: ConfigProviderProps): react_jsx_runtime.JSX.Element;
|
|
858
|
+
/**
|
|
859
|
+
* Hook to access BiChat configuration
|
|
860
|
+
* Returns null if no configuration is available
|
|
861
|
+
*/
|
|
862
|
+
declare function useConfig(): BiChatConfig | null;
|
|
863
|
+
/**
|
|
864
|
+
* Hook to access BiChat configuration (required)
|
|
865
|
+
* Throws an error if configuration is not available
|
|
866
|
+
*/
|
|
867
|
+
declare function useRequiredConfig(): BiChatConfig;
|
|
868
|
+
/**
|
|
869
|
+
* Check if user has a specific permission
|
|
870
|
+
*/
|
|
871
|
+
declare function hasPermission(config: BiChatConfig | null, permission: string): boolean;
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* useStreaming hook
|
|
875
|
+
* Handles AsyncGenerator streaming responses with cancellation support
|
|
876
|
+
*/
|
|
877
|
+
|
|
878
|
+
interface UseStreamingOptions {
|
|
879
|
+
onChunk?: (content: string) => void;
|
|
880
|
+
onError?: (error: string) => void;
|
|
881
|
+
onDone?: () => void;
|
|
882
|
+
}
|
|
883
|
+
declare function useStreaming(options?: UseStreamingOptions): {
|
|
884
|
+
content: string;
|
|
885
|
+
isStreaming: boolean;
|
|
886
|
+
error: Error | null;
|
|
887
|
+
processStream: (stream: AsyncGenerator<StreamChunk>, signal?: AbortSignal) => Promise<void>;
|
|
888
|
+
cancel: () => void;
|
|
889
|
+
reset: () => void;
|
|
890
|
+
};
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* Translation hook using locale from IotaContext
|
|
894
|
+
*/
|
|
895
|
+
declare function useTranslation(): {
|
|
896
|
+
t: (key: string, params?: Record<string, any>) => string;
|
|
897
|
+
locale: string;
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* Theme system type definitions
|
|
902
|
+
*/
|
|
903
|
+
interface Theme {
|
|
904
|
+
name: string;
|
|
905
|
+
colors: ThemeColors;
|
|
906
|
+
spacing: ThemeSpacing;
|
|
907
|
+
borderRadius: ThemeBorderRadius;
|
|
908
|
+
}
|
|
909
|
+
interface ThemeColors {
|
|
910
|
+
background: string;
|
|
911
|
+
surface: string;
|
|
912
|
+
primary: string;
|
|
913
|
+
secondary: string;
|
|
914
|
+
text: string;
|
|
915
|
+
textMuted: string;
|
|
916
|
+
border: string;
|
|
917
|
+
error: string;
|
|
918
|
+
success: string;
|
|
919
|
+
warning: string;
|
|
920
|
+
userBubble: string;
|
|
921
|
+
assistantBubble: string;
|
|
922
|
+
userText: string;
|
|
923
|
+
assistantText: string;
|
|
924
|
+
}
|
|
925
|
+
interface ThemeSpacing {
|
|
926
|
+
xs: string;
|
|
927
|
+
sm: string;
|
|
928
|
+
md: string;
|
|
929
|
+
lg: string;
|
|
930
|
+
xl: string;
|
|
931
|
+
}
|
|
932
|
+
interface ThemeBorderRadius {
|
|
933
|
+
sm: string;
|
|
934
|
+
md: string;
|
|
935
|
+
lg: string;
|
|
936
|
+
full: string;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
interface ThemeProviderProps {
|
|
940
|
+
theme?: Theme | 'light' | 'dark' | 'system';
|
|
941
|
+
children: ReactNode;
|
|
942
|
+
}
|
|
943
|
+
/**
|
|
944
|
+
* Theme provider component
|
|
945
|
+
* Wraps the application and provides theme context
|
|
946
|
+
*/
|
|
947
|
+
declare function ThemeProvider({ theme, children }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
948
|
+
/**
|
|
949
|
+
* Hook to access current theme
|
|
950
|
+
*/
|
|
951
|
+
declare function useTheme(): Theme;
|
|
952
|
+
|
|
953
|
+
/**
|
|
954
|
+
* Predefined theme configurations
|
|
955
|
+
*/
|
|
956
|
+
|
|
957
|
+
declare const lightTheme: Theme;
|
|
958
|
+
declare const darkTheme: Theme;
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* CSRF token management for API requests
|
|
962
|
+
*/
|
|
963
|
+
/**
|
|
964
|
+
* Get CSRF token from window object
|
|
965
|
+
* @returns CSRF token string
|
|
966
|
+
*/
|
|
967
|
+
declare function getCSRFToken(): string;
|
|
968
|
+
/**
|
|
969
|
+
* Add CSRF token to request headers
|
|
970
|
+
* @param headers - Headers object to modify
|
|
971
|
+
* @returns Modified headers object
|
|
972
|
+
*/
|
|
973
|
+
declare function addCSRFHeader(headers: Headers): Headers;
|
|
974
|
+
/**
|
|
975
|
+
* Create headers with CSRF token
|
|
976
|
+
* @param init - Optional initial headers
|
|
977
|
+
* @returns Headers object with CSRF token
|
|
978
|
+
*/
|
|
979
|
+
declare function createHeadersWithCSRF(init?: HeadersInit): Headers;
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* Built-in HTTP data source with SSE streaming and AbortController
|
|
983
|
+
* Implements ChatDataSource interface with real HTTP/GraphQL calls
|
|
984
|
+
*/
|
|
985
|
+
|
|
986
|
+
interface HttpDataSourceConfig {
|
|
987
|
+
baseUrl: string;
|
|
988
|
+
graphQLEndpoint?: string;
|
|
989
|
+
streamEndpoint?: string;
|
|
990
|
+
csrfToken?: string | (() => string);
|
|
991
|
+
headers?: Record<string, string>;
|
|
992
|
+
timeout?: number;
|
|
993
|
+
}
|
|
994
|
+
interface SessionState {
|
|
995
|
+
session: Session;
|
|
996
|
+
messages: Message[];
|
|
997
|
+
pendingQuestion?: PendingQuestion | null;
|
|
998
|
+
}
|
|
999
|
+
interface Result<T> {
|
|
1000
|
+
success: boolean;
|
|
1001
|
+
data?: T;
|
|
1002
|
+
error?: string;
|
|
1003
|
+
}
|
|
1004
|
+
declare class HttpDataSource implements ChatDataSource {
|
|
1005
|
+
private config;
|
|
1006
|
+
private abortController;
|
|
1007
|
+
constructor(config: HttpDataSourceConfig);
|
|
1008
|
+
/**
|
|
1009
|
+
* Get CSRF token from config
|
|
1010
|
+
*/
|
|
1011
|
+
private getCSRFToken;
|
|
1012
|
+
/**
|
|
1013
|
+
* Create headers for HTTP requests
|
|
1014
|
+
*/
|
|
1015
|
+
private createHeaders;
|
|
1016
|
+
/**
|
|
1017
|
+
* Execute GraphQL query
|
|
1018
|
+
*/
|
|
1019
|
+
private graphql;
|
|
1020
|
+
/**
|
|
1021
|
+
* Create a new chat session
|
|
1022
|
+
*/
|
|
1023
|
+
createSession(): Promise<Session>;
|
|
1024
|
+
/**
|
|
1025
|
+
* Fetch an existing session with messages
|
|
1026
|
+
*/
|
|
1027
|
+
fetchSession(id: string): Promise<SessionState | null>;
|
|
1028
|
+
/**
|
|
1029
|
+
* Send a message and stream the response using SSE
|
|
1030
|
+
*/
|
|
1031
|
+
sendMessage(sessionId: string, content: string, attachments?: Attachment[], signal?: AbortSignal): AsyncGenerator<StreamChunk>;
|
|
1032
|
+
/**
|
|
1033
|
+
* Cancel ongoing stream
|
|
1034
|
+
*/
|
|
1035
|
+
cancelStream(): void;
|
|
1036
|
+
/**
|
|
1037
|
+
* Submit answers to a pending question
|
|
1038
|
+
*/
|
|
1039
|
+
submitQuestionAnswers(sessionId: string, questionId: string, answers: QuestionAnswers): Promise<Result<void>>;
|
|
1040
|
+
/**
|
|
1041
|
+
* Cancel a pending question
|
|
1042
|
+
*/
|
|
1043
|
+
cancelPendingQuestion(questionId: string): Promise<Result<void>>;
|
|
1044
|
+
/**
|
|
1045
|
+
* Navigate to a session (optional, for SPA routing)
|
|
1046
|
+
*/
|
|
1047
|
+
navigateToSession?(sessionId: string): void;
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Factory function to create HttpDataSource
|
|
1051
|
+
*/
|
|
1052
|
+
declare function createHttpDataSource(config: HttpDataSourceConfig): ChatDataSource;
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* File Utilities
|
|
1056
|
+
* Validation, conversion, and formatting for file attachments
|
|
1057
|
+
*/
|
|
1058
|
+
/**
|
|
1059
|
+
* Validates an image file against size and type constraints
|
|
1060
|
+
* @throws Error if validation fails
|
|
1061
|
+
*/
|
|
1062
|
+
declare function validateImageFile(file: File, maxSizeBytes?: number): void;
|
|
1063
|
+
/**
|
|
1064
|
+
* Converts a file to base64 string (without data URL prefix)
|
|
1065
|
+
*/
|
|
1066
|
+
declare function convertToBase64(file: File): Promise<string>;
|
|
1067
|
+
/**
|
|
1068
|
+
* Creates a data URL from base64 string and MIME type
|
|
1069
|
+
*/
|
|
1070
|
+
declare function createDataUrl(base64: string, mimeType: string): string;
|
|
1071
|
+
/**
|
|
1072
|
+
* Formats file size in human-readable format
|
|
1073
|
+
*/
|
|
1074
|
+
declare function formatFileSize(bytes: number): string;
|
|
1075
|
+
/**
|
|
1076
|
+
* Validates multiple files don't exceed count limit
|
|
1077
|
+
* @throws Error if count exceeds limit
|
|
1078
|
+
*/
|
|
1079
|
+
declare function validateFileCount(currentCount: number, newCount: number, maxCount?: number): void;
|
|
1080
|
+
|
|
1081
|
+
export { type AppConfig, type Artifact, AssistantTurnView, type Attachment, AttachmentGrid, type BiChatConfig, ChartCard, type ChartData, type ChatDataSource, ChatHeader, ChatSession, type ChatSessionContextValue, ChatSessionProvider, type Citation, type CodeOutput, CodeOutputsPanel, ConfigProvider, DownloadCard, _default$2 as EditableText, type EditableTextProps, type EditableTextRef, _default$3 as EmptyState, type EmptyStateProps, HttpDataSource, type HttpDataSourceConfig, type ImageAttachment, ImageModal, InlineQuestionForm, type IotaContext, IotaContextProvider, ListItemSkeleton, type LocaleContext, MarkdownRenderer, type Message, MessageInput, type MessageInputProps, type MessageInputRef, MessageList, MessageRole, type PendingQuestion, type QuestionAnswers, type QueuedMessage, RateLimiter, type RateLimiterConfig, ScrollToBottomButton, _default$1 as SearchInput, type SearchInputProps, type Session, _default as Skeleton, SkeletonAvatar, SkeletonCard, SkeletonGroup, type SkeletonGroupProps, type SkeletonProps, SkeletonText, SourcesPanel, type StreamChunk, StreamingCursor, type TenantContext, type Theme, type ThemeBorderRadius, type ThemeColors, ThemeProvider, type ThemeSpacing, type ToolCall, TurnBubble, type UserContext, UserTurnView, WelcomeContent, addCSRFHeader, backdropVariants, buttonVariants, convertToBase64, createDataUrl, createHeadersWithCSRF, createHttpDataSource, darkTheme, dropdownVariants, fadeInUpVariants, fadeInVariants, floatingButtonVariants, formatFileSize, getCSRFToken, hasPermission as hasConfigPermission, hasPermission$1 as hasPermission, lightTheme, listItemVariants, messageContainerVariants, messageVariants, scaleFadeVariants, staggerContainerVariants, toastVariants, typingDotVariants, useChat, useConfig, useIotaContext, useRequiredConfig, useStreaming, useTheme, useTranslation, validateFileCount, validateImageFile };
|