@usecrow/ui 0.1.0 → 0.1.1

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/dist/index.d.ts CHANGED
@@ -1,42 +1,224 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { CrowClientConfig, IdentifyOptions, ToolHandlers, CrowClient, StreamEvent, Message, Conversation } from '@usecrow/client';
3
- export { ActiveWorkflow, Citation, ContextData, Conversation, CrowClientConfig, IdentifyOptions, Message, StreamEvent, ToolHandler, ToolHandlers, ToolResult, WorkflowTodo } from '@usecrow/client';
2
+ import { CrowClientConfig } from '@usecrow/client';
3
+ import * as react from 'react';
4
+ import react__default, { ReactNode } from 'react';
4
5
 
5
- interface CrowWidgetProps extends CrowClientConfig {
6
- /** Agent name shown in header */
7
- agentName?: string;
8
- /** Initial collapsed state */
9
- defaultCollapsed?: boolean;
10
- /** Callback when user needs to be identified */
11
- onIdentify?: (identify: (options: IdentifyOptions) => void) => void;
12
- /** Client-side tool handlers */
13
- tools?: ToolHandlers;
14
- /** Custom class name for the widget container */
15
- className?: string;
16
- /** Z-index for the widget (default: 999999) */
17
- zIndex?: number;
6
+ /**
7
+ * Widget and Copilot Style Configuration Types
8
+ *
9
+ * These TypeScript interfaces define all customizable styling options
10
+ * for both the floating widget and the copilot sidebar.
11
+ */
12
+ interface ColorsConfig {
13
+ /** Primary accent color */
14
+ primary?: string;
15
+ /** Main background color */
16
+ background?: string;
17
+ /** Primary text color */
18
+ text?: string;
19
+ /** Border color */
20
+ border?: string;
21
+ /** Bot message bubble background */
22
+ botBubble?: string;
23
+ /** Bot message text color */
24
+ botText?: string;
25
+ /** User message bubble background */
26
+ userBubble?: string;
27
+ /** User message text color */
28
+ userText?: string;
29
+ /** User message bubble border */
30
+ userBorder?: string;
31
+ /** Messages container background */
32
+ messagesBackground?: string;
33
+ /** Floating chat bubble background */
34
+ bubbleBackground?: string;
35
+ /** Floating chat bubble border */
36
+ bubbleBorder?: string;
37
+ /** Floating chat bubble icon color */
38
+ bubbleIcon?: string;
39
+ }
40
+ interface TypographyConfig {
41
+ /** Font family (e.g., "Inter, sans-serif") */
42
+ fontFamily?: string;
43
+ /** Base font size in pixels */
44
+ fontSize?: number;
45
+ /** Header font size in pixels */
46
+ headerFontSize?: number;
47
+ }
48
+ interface AnimationsConfig {
49
+ /** Animation duration in seconds */
50
+ duration?: number;
51
+ /** Easing function (e.g., "easeInOut") */
52
+ easing?: string;
53
+ }
54
+ interface WidgetDimensionsConfig {
55
+ /** Widget width in pixels */
56
+ width?: number;
57
+ /** Max height for floating widget in pixels */
58
+ maxHeight?: number;
59
+ /** Border radius in pixels */
60
+ borderRadius?: number;
61
+ /** Inner padding in pixels */
62
+ padding?: number;
63
+ /** Messages container max height in pixels */
64
+ messagesMaxHeight?: number;
65
+ /** Fixed height for preview/embedded mode in pixels */
66
+ previewHeight?: number;
67
+ }
68
+ interface WidgetPositionConfig {
69
+ /** Distance from right edge in pixels */
70
+ right?: number;
71
+ /** Distance from bottom in pixels */
72
+ bottom?: number;
73
+ /** Bubble distance from right in pixels */
74
+ bubbleRight?: number;
75
+ /** Bubble distance from bottom in pixels */
76
+ bubbleBottom?: number;
77
+ }
78
+ interface WidgetBubbleConfig {
79
+ /** Bubble button size in pixels */
80
+ size?: number;
81
+ /** Icon size inside bubble in pixels */
82
+ iconSize?: number;
83
+ }
84
+ interface WidgetShadowsConfig {
85
+ /** Widget container shadow (CSS box-shadow) */
86
+ widget?: string;
87
+ /** Chat bubble shadow (CSS box-shadow) */
88
+ bubble?: string;
89
+ }
90
+ interface WidgetBrandingConfig {
91
+ /** Show "Powered by" badge */
92
+ showPoweredBy?: boolean;
93
+ /** Custom "Powered by" text */
94
+ poweredByText?: string;
95
+ /** Show logo in badge */
96
+ showLogo?: boolean;
97
+ /** Custom logo URL */
98
+ logoUrl?: string;
99
+ }
100
+ /**
101
+ * Complete widget style configuration.
102
+ *
103
+ * All fields are optional - only specified fields override defaults.
104
+ * This allows partial updates and deep merging with defaults.
105
+ */
106
+ interface WidgetStyleConfig {
107
+ colors?: ColorsConfig;
108
+ typography?: TypographyConfig;
109
+ animations?: AnimationsConfig;
110
+ dimensions?: WidgetDimensionsConfig;
111
+ position?: WidgetPositionConfig;
112
+ bubble?: WidgetBubbleConfig;
113
+ shadows?: WidgetShadowsConfig;
114
+ branding?: WidgetBrandingConfig;
115
+ }
116
+ interface CopilotDimensionsConfig {
117
+ /** Copilot width in pixels */
118
+ width?: number;
119
+ /** Header height in pixels */
120
+ headerHeight?: number;
121
+ /** Border radius in pixels */
122
+ borderRadius?: number;
123
+ /** Inner padding in pixels */
124
+ padding?: number;
125
+ }
126
+ interface CopilotPositionConfig {
127
+ /** Which side to show on */
128
+ side?: 'left' | 'right';
129
+ }
130
+ interface CopilotBrandingConfig {
131
+ /** Show "Powered by" badge */
132
+ showPoweredBy?: boolean;
133
+ /** Custom "Powered by" text */
134
+ poweredByText?: string;
135
+ }
136
+ /**
137
+ * Complete copilot style configuration.
138
+ *
139
+ * All fields are optional - only specified fields override defaults.
140
+ */
141
+ interface CopilotStyleConfig {
142
+ colors?: ColorsConfig;
143
+ typography?: TypographyConfig;
144
+ animations?: AnimationsConfig;
145
+ dimensions?: CopilotDimensionsConfig;
146
+ position?: CopilotPositionConfig;
147
+ branding?: CopilotBrandingConfig;
148
+ }
149
+ /**
150
+ * Fully resolved widget styles with all defaults applied.
151
+ * This is what components actually use for rendering.
152
+ */
153
+ interface ResolvedWidgetStyles {
154
+ colors: Required<ColorsConfig>;
155
+ typography: Required<TypographyConfig>;
156
+ animations: Required<AnimationsConfig>;
157
+ dimensions: Required<WidgetDimensionsConfig>;
158
+ position: Required<WidgetPositionConfig>;
159
+ bubble: Required<WidgetBubbleConfig>;
160
+ shadows: Required<WidgetShadowsConfig>;
161
+ branding: Required<WidgetBrandingConfig>;
162
+ }
163
+ /**
164
+ * Fully resolved copilot styles with all defaults applied.
165
+ */
166
+ interface ResolvedCopilotStyles {
167
+ colors: Required<ColorsConfig>;
168
+ typography: Required<TypographyConfig>;
169
+ animations: Required<AnimationsConfig>;
170
+ dimensions: Required<CopilotDimensionsConfig>;
171
+ position: Required<CopilotPositionConfig>;
172
+ branding: Required<CopilotBrandingConfig>;
173
+ }
174
+ interface WidgetConfigResponse {
175
+ productId: string;
176
+ agentName: string;
177
+ widgetStyles: WidgetStyleConfig;
178
+ copilotStyles: CopilotStyleConfig;
18
179
  }
19
- declare function CrowWidget({ productId, apiUrl, model, agentName, defaultCollapsed, onIdentify, tools, className, zIndex, }: CrowWidgetProps): react_jsx_runtime.JSX.Element;
20
180
 
21
- interface CrowCopilotProps extends Partial<CrowClientConfig> {
181
+ interface CrowWidgetProps {
182
+ /** Product ID for this widget */
183
+ productId: string;
184
+ /** API URL (defaults to relative path) */
185
+ apiUrl?: string;
186
+ /** Widget variant: floating (with bubble) or embedded (for preview) */
187
+ variant?: "floating" | "embedded";
188
+ /** Custom styles to override DB and default styles */
189
+ styles?: Partial<WidgetStyleConfig>;
190
+ /** Skip fetching styles from API (use for preview mode with local state) */
191
+ previewMode?: boolean;
192
+ /** Callback when widget is ready */
193
+ onReady?: () => void;
194
+ }
195
+ declare function CrowWidget({ productId, apiUrl, variant, styles: propStyles, previewMode, onReady, }: CrowWidgetProps): react_jsx_runtime.JSX.Element;
196
+
197
+ interface CrowCopilotProps {
198
+ /** Product ID for this copilot */
199
+ productId: string;
200
+ /** API URL (defaults to relative path) */
201
+ apiUrl?: string;
22
202
  /** Title shown in header */
23
203
  title?: string;
24
204
  /** Position of the sidebar */
25
- position?: 'left' | 'right';
205
+ position?: "left" | "right";
26
206
  /** Width of the sidebar */
27
207
  width?: number | string;
28
208
  /** Show close button */
29
209
  showClose?: boolean;
30
210
  /** Callback when close is clicked */
31
211
  onClose?: () => void;
32
- /** Callback when user needs to be identified */
33
- onIdentify?: (identify: (options: IdentifyOptions) => void) => void;
34
- /** Client-side tool handlers */
35
- tools?: ToolHandlers;
212
+ /** Custom styles to override DB and default styles */
213
+ styles?: Partial<CopilotStyleConfig>;
214
+ /** Skip fetching styles from API (use for preview mode) */
215
+ previewMode?: boolean;
36
216
  /** Custom class name */
37
217
  className?: string;
218
+ /** Callback when copilot is ready */
219
+ onReady?: () => void;
38
220
  }
39
- declare function CrowCopilot({ productId, apiUrl, model, title, position, width, showClose, onClose, onIdentify, tools, className, }: CrowCopilotProps): react_jsx_runtime.JSX.Element | null;
221
+ declare function CrowCopilot({ productId, apiUrl, title, position, width, showClose, onClose, styles: propStyles, previewMode, className, onReady, }: CrowCopilotProps): react_jsx_runtime.JSX.Element;
40
222
 
41
223
  interface CrowProviderProps extends CrowClientConfig {
42
224
  children: React.ReactNode;
@@ -45,122 +227,543 @@ interface CrowProviderProps extends CrowClientConfig {
45
227
  * Provider component that creates and shares a CrowClient instance
46
228
  */
47
229
  declare function CrowProvider({ children, productId, apiUrl, model, }: CrowProviderProps): react_jsx_runtime.JSX.Element;
230
+
48
231
  /**
49
- * Hook to access the CrowClient from context
232
+ * Default Widget and Copilot Styles
233
+ *
234
+ * These are the default values used when no custom styles are provided.
235
+ * All values can be overridden via the Supabase database or SDK props.
50
236
  */
51
- declare function useCrowClient(): CrowClient;
237
+
238
+ /**
239
+ * Default widget styles - matches the mature widget implementation
240
+ */
241
+ declare const DEFAULT_WIDGET_STYLES: ResolvedWidgetStyles;
52
242
  /**
53
- * Hook to optionally access the CrowClient (returns null if not in provider)
243
+ * Default copilot styles
54
244
  */
55
- declare function useCrowClientOptional(): CrowClient | null;
245
+ declare const DEFAULT_COPILOT_STYLES: ResolvedCopilotStyles;
56
246
 
57
247
  /**
58
- * useChat - React hook for chat functionality
248
+ * Style Merging Utilities
249
+ *
250
+ * Functions for deep merging style configurations with proper precedence:
251
+ * defaults < DB styles < SDK props
59
252
  */
60
253
 
254
+ /**
255
+ * Merge widget styles with precedence: defaults < dbStyles < propStyles
256
+ *
257
+ * @param dbStyles - Styles fetched from the database (per product)
258
+ * @param propStyles - Styles passed via SDK props (developer overrides)
259
+ * @returns Fully resolved styles with all defaults applied
260
+ *
261
+ * @example
262
+ * ```tsx
263
+ * const styles = mergeWidgetStyles(
264
+ * { colors: { primary: '#blue' } }, // from DB
265
+ * { colors: { primary: '#red' } } // from props - wins!
266
+ * );
267
+ * // styles.colors.primary === '#red'
268
+ * ```
269
+ */
270
+ declare function mergeWidgetStyles(dbStyles?: WidgetStyleConfig, propStyles?: WidgetStyleConfig): ResolvedWidgetStyles;
271
+ /**
272
+ * Merge copilot styles with precedence: defaults < dbStyles < propStyles
273
+ *
274
+ * @param dbStyles - Styles fetched from the database (per product)
275
+ * @param propStyles - Styles passed via SDK props (developer overrides)
276
+ * @returns Fully resolved styles with all defaults applied
277
+ */
278
+ declare function mergeCopilotStyles(dbStyles?: CopilotStyleConfig, propStyles?: CopilotStyleConfig): ResolvedCopilotStyles;
279
+ /**
280
+ * Convert styles to CSS custom properties for use with CSS variables
281
+ *
282
+ * @example
283
+ * ```tsx
284
+ * const cssVars = stylesToCSSVariables(styles);
285
+ * // { '--crow-primary': '#000', '--crow-bg': '#fff', ... }
286
+ * ```
287
+ */
288
+ declare function stylesToCSSVariables(styles: ResolvedWidgetStyles | ResolvedCopilotStyles): Record<string, string | number>;
289
+
290
+ /**
291
+ * Shared TypeScript interfaces for the widget and copilot
292
+ */
293
+ interface Message {
294
+ id: string;
295
+ content: string;
296
+ isBot: boolean;
297
+ timestamp: Date;
298
+ citations?: Citation[];
299
+ thinking?: string;
300
+ thinkingComplete?: boolean;
301
+ }
302
+ interface Citation {
303
+ document_id: string;
304
+ filename: string;
305
+ similarity?: number;
306
+ image_url?: string;
307
+ page?: number;
308
+ }
309
+ interface Conversation {
310
+ id: string;
311
+ name: string | null;
312
+ created_at: string;
313
+ updated_at: string;
314
+ }
315
+ interface ToolCall {
316
+ id: string;
317
+ name: string;
318
+ arguments: Record<string, unknown>;
319
+ status: "executing" | "complete" | "error";
320
+ timestamp: Date;
321
+ }
322
+ interface WorkflowTodo {
323
+ id: string;
324
+ text: string;
325
+ status: "pending" | "completed";
326
+ }
327
+ interface ActiveWorkflow {
328
+ name: string;
329
+ todos: WorkflowTodo[];
330
+ isComplete?: boolean;
331
+ }
332
+ interface Model {
333
+ id: string;
334
+ name: string;
335
+ provider: "OpenAI" | "Anthropic";
336
+ }
337
+ interface WidgetProps {
338
+ productId: string;
339
+ apiUrl?: string;
340
+ agentName?: string;
341
+ }
342
+ interface JourneyEvent {
343
+ type: "run_started" | "step_started" | "step_completed" | "step_failed" | "needs_input" | "run_completed" | "error";
344
+ run_id?: string;
345
+ step_index?: number;
346
+ step_id?: string;
347
+ tool?: string;
348
+ description?: string;
349
+ output?: unknown;
350
+ error?: string;
351
+ missing_params?: Array<{
352
+ key: string;
353
+ description: string;
354
+ }>;
355
+ }
356
+ type ClientToolHandler = (args: Record<string, unknown>) => Promise<{
357
+ status: string;
358
+ data?: unknown;
359
+ error?: string;
360
+ }> | {
361
+ status: string;
362
+ data?: unknown;
363
+ error?: string;
364
+ };
365
+ declare global {
366
+ interface Window {
367
+ crow: (command: string, options?: unknown) => void;
368
+ __crow_identity_token?: string;
369
+ __crow_public_metadata?: Record<string, unknown>;
370
+ __crow_journey_callback?: (event: JourneyEvent) => void;
371
+ __crow_client_tools?: Record<string, ClientToolHandler>;
372
+ }
373
+ }
374
+
375
+ interface WorkflowEvent {
376
+ type: "started" | "todo_updated" | "ended" | "complete_prompt";
377
+ name?: string;
378
+ todos?: Array<{
379
+ id: string;
380
+ text: string;
381
+ status: "pending" | "completed";
382
+ }>;
383
+ todoId?: string;
384
+ todoStatus?: "pending" | "completed";
385
+ }
386
+ interface ToolCallEvent {
387
+ type: "start" | "complete" | "client_call";
388
+ toolName: string;
389
+ arguments?: Record<string, unknown>;
390
+ success?: boolean;
391
+ }
61
392
  interface UseChatOptions {
62
- client: CrowClient;
63
- onStreamEvent?: (event: StreamEvent) => void;
393
+ productId: string;
394
+ apiUrl?: string;
395
+ onVerificationStatus?: (isVerified: boolean) => void;
396
+ onConversationId?: (id: string) => void;
397
+ onWorkflowEvent?: (event: WorkflowEvent) => void;
398
+ onToolCall?: (toolCall: ToolCallEvent) => void;
399
+ onRestoredConversation?: (conversationId: string) => void;
64
400
  }
65
- interface UseChatReturn {
401
+ declare function useChat({ productId, apiUrl, onVerificationStatus, onConversationId, onWorkflowEvent, onToolCall, onRestoredConversation, }: UseChatOptions): {
66
402
  messages: Message[];
67
403
  isLoading: boolean;
68
- sendMessage: (content: string) => Promise<void>;
69
- stop: () => void;
70
- clearMessages: () => void;
404
+ activeToolCalls: ToolCall[];
405
+ conversationId: string | null;
406
+ selectedModel: string;
407
+ setSelectedModel: react.Dispatch<react.SetStateAction<string>>;
408
+ setConversationId: react.Dispatch<react.SetStateAction<string | null>>;
409
+ sendMessage: (content: string) => {
410
+ userMsgId: string;
411
+ botMsgId: string;
412
+ };
413
+ stopGeneration: () => void;
414
+ resetMessages: () => void;
415
+ loadMessages: (historyMessages: Message[]) => void;
416
+ };
417
+
418
+ /**
419
+ * useConversations - Manages conversation list and history
420
+ */
421
+
422
+ interface UseConversationsOptions {
423
+ productId: string;
424
+ apiUrl?: string;
71
425
  }
426
+ declare function useConversations({ productId, apiUrl }: UseConversationsOptions): {
427
+ conversations: Conversation[];
428
+ isLoadingHistory: boolean;
429
+ loadConversations: () => Promise<void>;
430
+ loadConversationHistory: (conversationId: string) => Promise<Message[]>;
431
+ loadAnonymousConversationHistory: (conversationId: string) => Promise<Message[]>;
432
+ };
433
+
72
434
  /**
73
- * React hook that wraps CrowClient chat functionality
435
+ * useWorkflow - Manages workflow state and actions
74
436
  */
75
- declare function useChat({ client, onStreamEvent }: UseChatOptions): UseChatReturn;
76
437
 
438
+ interface UseWorkflowOptions {
439
+ productId: string;
440
+ apiUrl?: string;
441
+ conversationId: string | null;
442
+ selectedModel: string;
443
+ onMessage?: (content: string) => void;
444
+ }
445
+ declare function useWorkflow({ productId, apiUrl, conversationId, selectedModel, onMessage, }: UseWorkflowOptions): {
446
+ activeWorkflow: ActiveWorkflow | null;
447
+ startWorkflow: (name: string, todos: ActiveWorkflow["todos"]) => void;
448
+ updateTodo: (todoId: string, status: "pending" | "completed") => void;
449
+ markComplete: () => void;
450
+ endWorkflow: (delay?: number) => void;
451
+ exitWorkflow: () => Promise<void>;
452
+ };
453
+
454
+ /**
455
+ * useCrowAPI - Sets up window.crow() API for identity and tools
456
+ */
457
+ interface UseCrowAPIOptions {
458
+ onIdentified?: () => void;
459
+ onReset?: () => void;
460
+ }
461
+ declare function useCrowAPI({ onIdentified, onReset }?: UseCrowAPIOptions): {
462
+ executeClientTool: (toolName: string, args: Record<string, unknown>) => Promise<{
463
+ status: string;
464
+ data?: unknown;
465
+ error?: string;
466
+ }>;
467
+ };
468
+
469
+ /**
470
+ * useWidgetStyles Hook
471
+ *
472
+ * Fetches widget/copilot styles from the API and merges them with defaults and props.
473
+ * Handles caching to avoid redundant fetches.
474
+ */
475
+
476
+ interface UseWidgetStylesOptions {
477
+ /** Product ID to fetch styles for */
478
+ productId: string;
479
+ /** API URL (defaults to relative path) */
480
+ apiUrl?: string;
481
+ /** Styles passed via props (override DB styles) */
482
+ propStyles?: WidgetStyleConfig;
483
+ /** Skip fetching from API (use for preview mode) */
484
+ skip?: boolean;
485
+ /** Cache key override (defaults to productId) */
486
+ cacheKey?: string;
487
+ }
488
+ interface UseWidgetStylesResult {
489
+ /** Fully resolved styles ready for use */
490
+ styles: ResolvedWidgetStyles;
491
+ /** Whether styles are currently loading */
492
+ isLoading: boolean;
493
+ /** Error if fetch failed */
494
+ error: Error | null;
495
+ /** Agent name from product config */
496
+ agentName: string;
497
+ /** Refetch styles from API */
498
+ refetch: () => Promise<void>;
499
+ }
500
+ interface UseCopilotStylesOptions {
501
+ /** Product ID to fetch styles for */
502
+ productId: string;
503
+ /** API URL (defaults to relative path) */
504
+ apiUrl?: string;
505
+ /** Styles passed via props (override DB styles) */
506
+ propStyles?: CopilotStyleConfig;
507
+ /** Skip fetching from API (use for preview mode) */
508
+ skip?: boolean;
509
+ /** Cache key override (defaults to productId) */
510
+ cacheKey?: string;
511
+ }
512
+ interface UseCopilotStylesResult {
513
+ /** Fully resolved styles ready for use */
514
+ styles: ResolvedCopilotStyles;
515
+ /** Whether styles are currently loading */
516
+ isLoading: boolean;
517
+ /** Error if fetch failed */
518
+ error: Error | null;
519
+ /** Agent name from product config */
520
+ agentName: string;
521
+ /** Refetch styles from API */
522
+ refetch: () => Promise<void>;
523
+ }
524
+ /**
525
+ * Hook to fetch and merge widget styles
526
+ *
527
+ * @example
528
+ * ```tsx
529
+ * const { styles, isLoading } = useWidgetStyles({
530
+ * productId: 'my-product',
531
+ * propStyles: { colors: { primary: '#blue' } },
532
+ * });
533
+ * ```
534
+ */
535
+ declare function useWidgetStyles$1({ productId, apiUrl, propStyles, skip, cacheKey, }: UseWidgetStylesOptions): UseWidgetStylesResult;
77
536
  /**
78
- * useIdentity - React hook for identity management
537
+ * Hook to fetch and merge copilot styles
538
+ *
539
+ * @example
540
+ * ```tsx
541
+ * const { styles, isLoading } = useCopilotStyles({
542
+ * productId: 'my-product',
543
+ * propStyles: { position: { side: 'left' } },
544
+ * });
545
+ * ```
79
546
  */
547
+ declare function useCopilotStyles$1({ productId, apiUrl, propStyles, skip, cacheKey, }: UseCopilotStylesOptions): UseCopilotStylesResult;
548
+ /**
549
+ * Clear the style cache (useful for testing or forcing refetch)
550
+ */
551
+ declare function clearStyleCache(productId?: string): void;
552
+ /**
553
+ * Hook for preview mode - uses provided styles directly without fetching
554
+ *
555
+ * @example
556
+ * ```tsx
557
+ * // In dashboard style editor
558
+ * const { styles } = usePreviewStyles({
559
+ * styles: localEditorState,
560
+ * });
561
+ * ```
562
+ */
563
+ declare function usePreviewWidgetStyles(previewStyles: WidgetStyleConfig): {
564
+ styles: ResolvedWidgetStyles;
565
+ };
566
+ declare function usePreviewCopilotStyles(previewStyles: CopilotStyleConfig): {
567
+ styles: ResolvedCopilotStyles;
568
+ };
80
569
 
81
- interface UseIdentityOptions {
82
- client: CrowClient;
570
+ interface WidgetStyleContextValue {
571
+ styles: ResolvedWidgetStyles;
572
+ agentName: string;
573
+ isLoading: boolean;
574
+ variant: 'floating' | 'embedded';
83
575
  }
84
- interface UseIdentityReturn {
85
- isIdentified: boolean;
86
- isVerified: boolean;
87
- identify: (options: IdentifyOptions) => void;
88
- resetUser: () => void;
576
+ interface WidgetStyleProviderProps {
577
+ children: react__default.ReactNode;
578
+ styles: ResolvedWidgetStyles;
579
+ agentName?: string;
580
+ isLoading?: boolean;
581
+ variant?: 'floating' | 'embedded';
89
582
  }
90
583
  /**
91
- * React hook for managing user identity
584
+ * Provider for widget styles
585
+ */
586
+ declare function WidgetStyleProvider({ children, styles, agentName, isLoading, variant, }: WidgetStyleProviderProps): react_jsx_runtime.JSX.Element;
587
+ /**
588
+ * Hook to access widget styles from context
589
+ *
590
+ * @throws Error if used outside of WidgetStyleProvider
591
+ */
592
+ declare function useWidgetStyleContext(): WidgetStyleContextValue;
593
+ /**
594
+ * Hook to access widget styles, with fallback to defaults if not in context
595
+ *
596
+ * Use this in components that might be used both inside and outside the widget.
92
597
  */
93
- declare function useIdentity({ client }: UseIdentityOptions): UseIdentityReturn;
598
+ declare function useWidgetStyles(): ResolvedWidgetStyles;
599
+ interface CopilotStyleContextValue {
600
+ styles: ResolvedCopilotStyles;
601
+ agentName: string;
602
+ isLoading: boolean;
603
+ }
604
+ interface CopilotStyleProviderProps {
605
+ children: react__default.ReactNode;
606
+ styles: ResolvedCopilotStyles;
607
+ agentName?: string;
608
+ isLoading?: boolean;
609
+ }
610
+ /**
611
+ * Provider for copilot styles
612
+ */
613
+ declare function CopilotStyleProvider({ children, styles, agentName, isLoading, }: CopilotStyleProviderProps): react_jsx_runtime.JSX.Element;
614
+ /**
615
+ * Hook to access copilot styles from context
616
+ *
617
+ * @throws Error if used outside of CopilotStyleProvider
618
+ */
619
+ declare function useCopilotStyleContext(): CopilotStyleContextValue;
620
+ /**
621
+ * Hook to access copilot styles, with fallback to defaults if not in context
622
+ */
623
+ declare function useCopilotStyles(): ResolvedCopilotStyles;
94
624
 
95
625
  /**
96
- * useConversations - React hook for conversation management
626
+ * Static configuration values
97
627
  */
98
628
 
99
- interface UseConversationsOptions {
100
- client: CrowClient;
629
+ declare const AVAILABLE_MODELS: Model[];
630
+ declare const DEFAULT_MODEL = "claude-sonnet-4-5-20250929";
631
+ declare const DEFAULT_WELCOME_MESSAGE = "Hi! How can I help you today?";
632
+ declare const MESSAGES_CONTAINER_ID = "crow-messages-container";
633
+
634
+ /**
635
+ * GlassCard - Glassmorphism card component
636
+ */
637
+ interface GlassCardProps extends React.HTMLAttributes<HTMLDivElement> {
638
+ children: React.ReactNode;
101
639
  }
102
- interface UseConversationsReturn {
103
- conversations: Conversation[];
104
- isLoadingConversations: boolean;
105
- isLoadingHistory: boolean;
106
- currentConversationId: string | null;
107
- loadConversations: () => Promise<void>;
108
- loadHistory: (conversationId: string) => Promise<Message[]>;
109
- switchConversation: (conversationId: string) => Promise<void>;
110
- startNewConversation: () => void;
640
+ declare const GlassCard: react.ForwardRefExoticComponent<GlassCardProps & react.RefAttributes<HTMLDivElement>>;
641
+
642
+ /**
643
+ * StreamingText - Simple streaming text with blinking cursor
644
+ */
645
+ interface StreamingTextProps {
646
+ content: string;
647
+ isStreaming?: boolean;
111
648
  }
649
+ declare function StreamingText({ content, isStreaming, }: StreamingTextProps): react_jsx_runtime.JSX.Element;
650
+
651
+ /**
652
+ * ThinkingIndicator - Shimmer effect for thinking state
653
+ */
654
+ declare function ThinkingIndicator(): react_jsx_runtime.JSX.Element;
655
+
112
656
  /**
113
- * React hook for managing conversations
657
+ * LoadingHistory - Loading animation for conversation history
114
658
  */
115
- declare function useConversations({ client, }: UseConversationsOptions): UseConversationsReturn;
659
+ declare function LoadingHistory(): react_jsx_runtime.JSX.Element;
660
+
661
+ interface ReasoningTraceProps {
662
+ thinking?: string;
663
+ isComplete?: boolean;
664
+ toolCalls?: ToolCall[];
665
+ isWaiting?: boolean;
666
+ }
667
+ declare function ReasoningTrace({ thinking, isComplete, toolCalls, isWaiting }: ReasoningTraceProps): react_jsx_runtime.JSX.Element | null;
116
668
 
117
669
  interface MessageBubbleProps {
118
670
  message: Message;
119
- isStreaming?: boolean;
671
+ toolCalls?: ToolCall[];
672
+ isLoading?: boolean;
120
673
  }
121
- declare function MessageBubble({ message, isStreaming }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
674
+ declare function MessageBubble({ message, toolCalls, isLoading, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
122
675
 
123
676
  interface MessageListProps {
124
677
  messages: Message[];
125
- isLoading?: boolean;
126
- className?: string;
678
+ activeToolCalls: ToolCall[];
679
+ isLoadingHistory: boolean;
680
+ isGenerating?: boolean;
681
+ }
682
+ declare function MessageList({ messages, activeToolCalls, isLoadingHistory, isGenerating, }: MessageListProps): react_jsx_runtime.JSX.Element;
683
+
684
+ interface MessagesContainerProps {
685
+ children: ReactNode;
686
+ maxHeight?: number;
687
+ }
688
+ declare const MessagesContainer: react.ForwardRefExoticComponent<MessagesContainerProps & react.RefAttributes<HTMLDivElement>>;
689
+
690
+ interface ConversationListProps {
691
+ conversations: Conversation[];
692
+ currentConversationId: string | null;
693
+ onSelect: (id: string) => void;
694
+ onClose: () => void;
695
+ }
696
+ declare function ConversationList({ conversations, currentConversationId, onSelect, onClose, }: ConversationListProps): react_jsx_runtime.JSX.Element;
697
+
698
+ interface WorkflowPanelProps {
699
+ workflow: ActiveWorkflow;
700
+ onExit: () => void;
701
+ }
702
+ declare function WorkflowPanel({ workflow, onExit }: WorkflowPanelProps): react_jsx_runtime.JSX.Element;
703
+
704
+ /**
705
+ * PoweredByBadge - Branding badge at bottom
706
+ */
707
+ interface PoweredByBadgeProps {
708
+ apiUrl?: string;
127
709
  }
128
- declare function MessageList({ messages, isLoading, className }: MessageListProps): react_jsx_runtime.JSX.Element;
710
+ declare function PoweredByBadge({ apiUrl }: PoweredByBadgeProps): react_jsx_runtime.JSX.Element | null;
129
711
 
130
712
  /**
131
- * PromptInput - Chat input component with send/stop button
713
+ * ModelSelector - Dropdown for selecting AI models
132
714
  */
133
- interface PromptInputProps {
134
- onSend: (message: string) => void;
715
+
716
+ interface ModelSelectorProps {
717
+ models: Model[];
718
+ selectedModel: string;
719
+ onModelChange: (modelId: string) => void;
720
+ disabled?: boolean;
721
+ }
722
+ declare const ModelSelector: react__default.FC<ModelSelectorProps>;
723
+
724
+ /**
725
+ * PromptInputBox - Main input component for user messages
726
+ */
727
+
728
+ interface PromptInputBoxProps {
729
+ onSend?: (message: string) => void;
135
730
  onStop?: () => void;
136
731
  isLoading?: boolean;
137
732
  placeholder?: string;
138
- disabled?: boolean;
139
733
  className?: string;
734
+ selectedModel?: string;
735
+ onModelChange?: (model: string) => void;
736
+ availableModels?: Model[];
140
737
  }
141
- declare function PromptInput({ onSend, onStop, isLoading, placeholder, disabled, className, }: PromptInputProps): react_jsx_runtime.JSX.Element;
738
+ declare const PromptInputBox: react__default.ForwardRefExoticComponent<PromptInputBoxProps & react__default.RefAttributes<HTMLDivElement>>;
142
739
 
143
740
  /**
144
- * ChatBubble - Floating action button to open/close widget
741
+ * ChatBubble - Floating button to toggle widget
145
742
  */
146
743
  interface ChatBubbleProps {
147
- isOpen: boolean;
744
+ isExpanded: boolean;
148
745
  onClick: () => void;
746
+ }
747
+ declare function ChatBubble({ isExpanded, onClick }: ChatBubbleProps): react_jsx_runtime.JSX.Element;
748
+
749
+ interface WidgetShellProps {
750
+ children: ReactNode;
149
751
  className?: string;
150
752
  }
151
- declare function ChatBubble({ isOpen, onClick, className }: ChatBubbleProps): react_jsx_runtime.JSX.Element;
753
+ declare const WidgetShell: react.ForwardRefExoticComponent<WidgetShellProps & react.RefAttributes<HTMLDivElement>>;
152
754
 
153
755
  /**
154
- * WidgetHeader - Header bar for widget/copilot
756
+ * WidgetHeader - Header bar for widget
155
757
  */
156
758
  interface WidgetHeaderProps {
157
- title?: string;
158
- onNewChat?: () => void;
159
- onClose?: () => void;
160
- showNewChat?: boolean;
161
- showClose?: boolean;
162
- className?: string;
759
+ isVerifiedUser: boolean;
760
+ showConversationList: boolean;
761
+ onNewChat: () => void;
762
+ onToggleHistory: () => void;
763
+ showMinimize?: boolean;
764
+ isMinimized?: boolean;
765
+ onToggleMinimize?: () => void;
163
766
  }
164
- declare function WidgetHeader({ title, onNewChat, onClose, showNewChat, showClose, className, }: WidgetHeaderProps): react_jsx_runtime.JSX.Element;
767
+ declare function WidgetHeader({ isVerifiedUser, showConversationList, onNewChat, onToggleHistory, showMinimize, isMinimized, onToggleMinimize, }: WidgetHeaderProps): react_jsx_runtime.JSX.Element;
165
768
 
166
- export { ChatBubble, CrowCopilot, type CrowCopilotProps, CrowProvider, type CrowProviderProps, CrowWidget, type CrowWidgetProps, MessageBubble, MessageList, PromptInput, WidgetHeader, useChat, useConversations, useCrowClient, useCrowClientOptional, useIdentity };
769
+ export { AVAILABLE_MODELS, type ActiveWorkflow, type AnimationsConfig, ChatBubble, type Citation, type ClientToolHandler, type ColorsConfig, type Conversation, ConversationList, type CopilotBrandingConfig, type CopilotDimensionsConfig, type CopilotPositionConfig, type CopilotStyleConfig, CopilotStyleProvider, CrowCopilot, type CrowCopilotProps, CrowProvider, CrowWidget, type CrowWidgetProps, DEFAULT_COPILOT_STYLES, DEFAULT_MODEL, DEFAULT_WELCOME_MESSAGE, DEFAULT_WIDGET_STYLES, GlassCard, type JourneyEvent, LoadingHistory, MESSAGES_CONTAINER_ID, type Message, MessageBubble, MessageList, MessagesContainer, type Model, ModelSelector, PoweredByBadge, PromptInputBox, ReasoningTrace, type ResolvedCopilotStyles, type ResolvedWidgetStyles, StreamingText, ThinkingIndicator, type ToolCall, type TypographyConfig, type WidgetBrandingConfig, type WidgetBubbleConfig, type WidgetConfigResponse, type WidgetDimensionsConfig, WidgetHeader, type WidgetPositionConfig, type WidgetProps, type WidgetShadowsConfig, WidgetShell, type WidgetStyleConfig, WidgetStyleProvider, WorkflowPanel, type WorkflowTodo, clearStyleCache, mergeCopilotStyles, mergeWidgetStyles, stylesToCSSVariables, useChat, useConversations, useCopilotStyleContext, useCopilotStyles$1 as useCopilotStyles, useCopilotStyles as useCopilotStylesContext, useCrowAPI, usePreviewCopilotStyles, usePreviewWidgetStyles, useWidgetStyleContext, useWidgetStyles$1 as useWidgetStyles, useWidgetStyles as useWidgetStylesContext, useWorkflow };