@knowbl_ai/nexus-chat 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1456 @@
1
+ import type { ChatStore } from "../store/chatStore";
2
+ export interface VoiceConfig {
3
+ enabled: boolean;
4
+ language?: string;
5
+ continuous?: boolean;
6
+ interimResults?: boolean;
7
+ maxAlternatives?: number;
8
+ }
9
+ export interface SpeechSynthesisConfig {
10
+ engine?: "elevenlabs" | "openai" | "google" | "aws" | "browser";
11
+ voiceId?: string;
12
+ modelId?: string;
13
+ greetingText?: string;
14
+ language?: string;
15
+ volume?: number;
16
+ stability?: number;
17
+ similarityBoost?: number;
18
+ style?: number;
19
+ useSpeakerBoost?: boolean;
20
+ speed?: number;
21
+ rate?: number;
22
+ pitch?: number;
23
+ outputFormat?: string;
24
+ }
25
+ export interface TTSConfig {
26
+ enabled: boolean;
27
+ defaultOn?: boolean;
28
+ /**
29
+ * Speech synthesis configuration (used for both server and fallback browser)
30
+ * @internal
31
+ */
32
+ synthesisConfig?: SpeechSynthesisConfig;
33
+ }
34
+ export interface CopyButtonConfig {
35
+ enabled: boolean;
36
+ position?: "top" | "bottom" | "inline" | "top-right";
37
+ showLabel?: boolean;
38
+ showIcon?: boolean;
39
+ style?: "default" | "minimal" | "outline" | "ghost";
40
+ size?: "small" | "medium" | "large";
41
+ className?: string;
42
+ iconColor?: string;
43
+ textColor?: string;
44
+ backgroundColor?: string;
45
+ hoverBackgroundColor?: string;
46
+ copyIcon?: string;
47
+ copiedIcon?: string;
48
+ copiedDuration?: number;
49
+ tooltipText?: string;
50
+ copiedText?: string;
51
+ }
52
+ export interface FeedbackConfig {
53
+ enabled: boolean;
54
+ position?: "inline" | "bottom" | "top";
55
+ style?: "thumbs" | "stars" | "emoji" | "custom";
56
+ showOnAssistantMessages?: boolean;
57
+ showOnAgentMessages?: boolean;
58
+ requireComment?: boolean;
59
+ commentPrompt?: string;
60
+ buttons?: {
61
+ size?: "small" | "medium" | "large";
62
+ spacing?: string;
63
+ showLabels?: boolean;
64
+ animation?: "none" | "scale" | "fade";
65
+ positive?: {
66
+ icon?: string;
67
+ label?: string;
68
+ color?: string;
69
+ activeColor?: string;
70
+ hoverColor?: string;
71
+ backgroundColor?: string;
72
+ activeBackgroundColor?: string;
73
+ };
74
+ negative?: {
75
+ icon?: string;
76
+ label?: string;
77
+ color?: string;
78
+ activeColor?: string;
79
+ hoverColor?: string;
80
+ backgroundColor?: string;
81
+ activeBackgroundColor?: string;
82
+ };
83
+ starCount?: number;
84
+ starColor?: string;
85
+ starActiveColor?: string;
86
+ emojis?: Array<{
87
+ value: string;
88
+ icon: string;
89
+ label?: string;
90
+ }>;
91
+ };
92
+ behavior?: {
93
+ allowChange?: boolean;
94
+ showConfirmation?: boolean;
95
+ confirmationMessage?: string;
96
+ confirmationDuration?: number;
97
+ persistFeedback?: boolean;
98
+ };
99
+ api?: {
100
+ endpoint?: string;
101
+ includeContext?: boolean;
102
+ additionalData?: Record<string, any>;
103
+ };
104
+ }
105
+ /**
106
+ * Font weight presets for text styling
107
+ */
108
+ export type FontWeight = "light" | "normal" | "medium" | "semibold" | "bold";
109
+ /**
110
+ * Font size presets for text styling
111
+ * Maps to common CSS font-size values
112
+ * Accepts preset values: "xs" (12px), "sm" (14px), "base" (16px), "lg" (18px), "xl" (20px)
113
+ * Or any custom CSS value: "14px", "1.5rem", "1.2em", etc.
114
+ */
115
+ export type FontSize = string;
116
+ /**
117
+ * Avatar size: preset or custom CSS value
118
+ * Accepts preset values: "xs" (20px), "sm" (24px), "md" (32px), "lg" (40px), "xl" (48px)
119
+ * Or any custom CSS value: "32px", "2rem", etc.
120
+ * @example "md"
121
+ * @example "xs"
122
+ * @example "32px"
123
+ * @example "2rem"
124
+ */
125
+ export type AvatarSize = string;
126
+ /**
127
+ * Avatar border radius: preset or custom CSS value
128
+ * Accepts preset values: "circle" (fully rounded), "rounded" (8px), "square" (0px)
129
+ * Or any custom CSS value: "8px", "50%", etc.
130
+ * @example "circle"
131
+ * @example "rounded"
132
+ * @example "8px"
133
+ * @example "50%"
134
+ */
135
+ export type AvatarBorderRadius = string;
136
+ /**
137
+ * Avatar styling configuration
138
+ */
139
+ export interface AvatarConfig {
140
+ /**
141
+ * Whether to show the avatar
142
+ * @default true
143
+ */
144
+ enabled?: boolean;
145
+ /**
146
+ * Avatar image URL
147
+ * If not provided, falls back to default avatar icon
148
+ * @example "https://api.dicebear.com/7.x/avataaars/svg?seed=agent"
149
+ */
150
+ url?: string;
151
+ /**
152
+ * Avatar size
153
+ * Presets: "xs" (20px), "sm" (24px), "md" (32px), "lg" (40px), "xl" (48px)
154
+ * Or provide custom CSS value: "40px", "2.5rem", etc.
155
+ */
156
+ size?: AvatarSize;
157
+ /**
158
+ * Avatar border radius
159
+ * Presets: "circle" (fully rounded), "rounded" (8px), "square" (0px)
160
+ * Or provide custom CSS value: "50%", "12px", etc.
161
+ */
162
+ borderRadius?: AvatarBorderRadius;
163
+ /**
164
+ * Avatar border (shorthand)
165
+ * @example "2px solid #e5e7eb"
166
+ */
167
+ border?: string;
168
+ /**
169
+ * Avatar border width (granular)
170
+ * @example "2px"
171
+ */
172
+ borderWidth?: string;
173
+ /**
174
+ * Avatar border color (granular)
175
+ * @example "#10b981"
176
+ */
177
+ borderColor?: string;
178
+ /**
179
+ * Avatar border style (granular)
180
+ * @example "solid", "dashed", "dotted"
181
+ */
182
+ borderStyle?: string;
183
+ /**
184
+ * Avatar margin (spacing around avatar)
185
+ * @example "0 12px 0 0"
186
+ * @default "0 12px 0 0" (message bubbles)
187
+ */
188
+ margin?: string;
189
+ }
190
+ /**
191
+ * Shared styling configuration for event rendering
192
+ * Applies to sessionStart, sessionEnd, and agentHandover events
193
+ */
194
+ export interface EventStylingConfig {
195
+ /** Font size for event text (preset or custom CSS value) */
196
+ fontSize?: FontSize;
197
+ /** Font family for event text */
198
+ fontFamily?: string;
199
+ /** Font style for event text (normal, italic, oblique) */
200
+ fontStyle?: "normal" | "italic" | "oblique";
201
+ /** Text color for event content */
202
+ textColor?: string;
203
+ /** Background color for event container */
204
+ backgroundColor?: string;
205
+ /** Border radius for event container */
206
+ borderRadius?: string;
207
+ /** Padding inside event container (CSS shorthand) */
208
+ padding?: string;
209
+ /**
210
+ * Default avatar styling for all events
211
+ */
212
+ avatar?: AvatarConfig;
213
+ }
214
+ /**
215
+ * Configuration for the send button styling
216
+ */
217
+ export interface SendButtonConfig {
218
+ /**
219
+ * Base color for the send button (used for background in filled mode, text in text mode)
220
+ * @example "#3B82F6"
221
+ */
222
+ color?: string;
223
+ /**
224
+ * Custom text label for the send button (replaces default icon)
225
+ * @example "Send"
226
+ */
227
+ text?: string;
228
+ /**
229
+ * Font family for send button text
230
+ * @example "Arial, sans-serif"
231
+ */
232
+ fontFamily?: string;
233
+ /**
234
+ * Font size for send button text
235
+ * @example "base"
236
+ * @example "14px"
237
+ */
238
+ fontSize?: FontSize;
239
+ /**
240
+ * Font weight for send button text
241
+ * @example "semibold"
242
+ */
243
+ fontWeight?: FontWeight;
244
+ /**
245
+ * Padding inside the send button
246
+ * @example "8px 16px"
247
+ */
248
+ padding?: string;
249
+ /**
250
+ * Button appearance mode
251
+ * - "filled": Solid background with contrasting text (default)
252
+ * - "text": Transparent background with colored text
253
+ * @default "filled"
254
+ */
255
+ style?: "filled" | "text";
256
+ /**
257
+ * Background color (overrides color for filled mode, allows transparent)
258
+ * @example "#3B82F6"
259
+ * @example "transparent"
260
+ */
261
+ backgroundColor?: string;
262
+ /**
263
+ * Border for send button
264
+ * @example "1px solid #ccc"
265
+ * @example "none"
266
+ */
267
+ border?: string;
268
+ /**
269
+ * Border radius for send button
270
+ * Falls back to input.borderRadius if not specified
271
+ * @example "8px"
272
+ * @example "50%"
273
+ */
274
+ borderRadius?: string;
275
+ /**
276
+ * Text/icon color for send button
277
+ * @example "#ffffff"
278
+ */
279
+ textColor?: string;
280
+ /**
281
+ * Opacity when button is disabled
282
+ * @default "0.5"
283
+ */
284
+ disabledOpacity?: string;
285
+ /**
286
+ * Text/icon color when button is disabled
287
+ * @example "rgba(0, 0, 0, 0.3)"
288
+ */
289
+ disabledTextColor?: string;
290
+ }
291
+ /**
292
+ * Configuration for link styling in markdown content
293
+ */
294
+ export interface LinkConfig {
295
+ /**
296
+ * Link text color (CSS color value)
297
+ * @example "#0066cc"
298
+ * @example "rgb(0, 102, 204)"
299
+ */
300
+ color?: string;
301
+ /**
302
+ * Link hover state color (CSS color value)
303
+ * Defaults to the same color as `color` if not specified
304
+ * @example "#0052a3"
305
+ */
306
+ hoverColor?: string;
307
+ /**
308
+ * Whether to underline links
309
+ * @default true
310
+ */
311
+ underline?: boolean;
312
+ /**
313
+ * Whether links should open in a new tab
314
+ * @default true
315
+ */
316
+ openInNewTab?: boolean;
317
+ /**
318
+ * Font weight for link text
319
+ * Uses named presets that map to standard CSS font-weight values
320
+ * @example "bold"
321
+ * @example "normal"
322
+ * @default undefined (inherits from parent styles)
323
+ */
324
+ fontWeight?: FontWeight;
325
+ /**
326
+ * Font size for link text
327
+ * Uses named presets or custom CSS values
328
+ * @example "sm"
329
+ * @example "16px"
330
+ * @example "1.25rem"
331
+ * @default undefined (inherits base font size)
332
+ */
333
+ fontSize?: FontSize;
334
+ }
335
+ export interface InputConfig {
336
+ placeholder?: string;
337
+ placeholderColor?: string;
338
+ placeholderFontStyle?: string;
339
+ backgroundColor?: string;
340
+ textColor?: string;
341
+ borderColor?: string;
342
+ borderRadius?: string;
343
+ borderWidth?: string;
344
+ fontFamily?: string;
345
+ /**
346
+ * Font size for input text
347
+ * @example "base"
348
+ * @example "14px"
349
+ * @default undefined (inherits base font size)
350
+ */
351
+ fontSize?: FontSize;
352
+ /**
353
+ * Send button configuration
354
+ * Groups all send button styling properties
355
+ */
356
+ sendButton?: SendButtonConfig;
357
+ /**
358
+ * @deprecated Use `sendButton.color` instead
359
+ */
360
+ sendButtonColor?: string;
361
+ /**
362
+ * Color for microphone button (not yet implemented)
363
+ */
364
+ micButtonColor?: string;
365
+ /**
366
+ * @deprecated Use `sendButton.text` instead
367
+ */
368
+ sendButtonText?: string;
369
+ /**
370
+ * @deprecated Use `sendButton.fontFamily` instead
371
+ */
372
+ sendButtonFontFamily?: string;
373
+ /**
374
+ * Font size for send button text (when sendButtonText is set)
375
+ * @deprecated Use `sendButton.fontSize` instead
376
+ * @example "base"
377
+ * @example "14px"
378
+ * @example "1.5rem"
379
+ */
380
+ sendButtonFontSize?: FontSize;
381
+ /**
382
+ * Font weight for send button text (when sendButtonText is set)
383
+ * @deprecated Use `sendButton.fontWeight` instead
384
+ * @example "bold"
385
+ * @example "semibold"
386
+ */
387
+ sendButtonFontWeight?: FontWeight;
388
+ maxRows?: number;
389
+ maxHeight?: string;
390
+ minRows?: number;
391
+ padding?: string;
392
+ gap?: string;
393
+ /**
394
+ * @deprecated Use `sendButton.padding` instead
395
+ */
396
+ sendButtonPadding?: string;
397
+ /**
398
+ * @deprecated Use `sendButton.style` instead
399
+ */
400
+ sendButtonStyle?: "filled" | "text";
401
+ /**
402
+ * @deprecated Use `sendButton.backgroundColor` instead
403
+ */
404
+ sendButtonBackgroundColor?: string;
405
+ /**
406
+ * @deprecated Use `sendButton.border` instead
407
+ */
408
+ sendButtonBorder?: string;
409
+ /**
410
+ * @deprecated Use `sendButton.textColor` instead
411
+ */
412
+ sendButtonTextColor?: string;
413
+ /**
414
+ * @deprecated Use `sendButton.disabledOpacity` instead
415
+ */
416
+ sendButtonDisabledOpacity?: string;
417
+ /**
418
+ * @deprecated Use `sendButton.disabledTextColor` instead
419
+ */
420
+ sendButtonDisabledTextColor?: string;
421
+ integratedButton?: boolean;
422
+ /**
423
+ * Configuration for the border above the input area.
424
+ * - Set to `false` to hide the border
425
+ * - Set to `true` or omit to show the default border (maintains current behavior)
426
+ * - Set to object for full customization
427
+ * @default true
428
+ */
429
+ topBorder?: boolean | {
430
+ /**
431
+ * Whether to show the border
432
+ * @default true
433
+ */
434
+ show?: boolean;
435
+ /**
436
+ * Custom border color (CSS color value)
437
+ * @default Theme-based gray (#e5e7eb in light mode, #374151 in dark mode)
438
+ */
439
+ color?: string;
440
+ /**
441
+ * Border width (CSS width value)
442
+ * @default "1px"
443
+ */
444
+ width?: string;
445
+ };
446
+ /**
447
+ * Whether to autofocus the input field when the widget first loads.
448
+ * @default false
449
+ */
450
+ autofocusOnLoad?: boolean;
451
+ /**
452
+ * Whether to autofocus the input field after receiving a bot response.
453
+ * Useful to disable on demo pages with multiple widgets to prevent focus conflicts.
454
+ * @default true
455
+ */
456
+ autofocusAfterResponse?: boolean;
457
+ }
458
+ /**
459
+ * Configuration for scrollbar styling in the message container.
460
+ * All properties are optional. When not provided, browser default scrollbar is used.
461
+ *
462
+ * @example
463
+ * ```typescript
464
+ * scrollbar: {
465
+ * width: "8px",
466
+ * trackColor: "#f1f1f1",
467
+ * thumbColor: "#888",
468
+ * thumbHoverColor: "#555",
469
+ * borderRadius: "4px",
470
+ * autoHide: true,
471
+ * autoHideDelay: 1000
472
+ * }
473
+ * ```
474
+ */
475
+ export interface ScrollbarConfig {
476
+ /**
477
+ * Width of the scrollbar. Can be a pixel value (e.g., "8px") or "thin".
478
+ * Maps to custom scrollbar size across all browsers.
479
+ * @default Browser default
480
+ */
481
+ width?: string;
482
+ /**
483
+ * Background color of the scrollbar track.
484
+ * Works consistently across all browsers.
485
+ * @default Browser default
486
+ */
487
+ trackColor?: string;
488
+ /**
489
+ * Color of the scrollbar thumb.
490
+ * Works consistently across all browsers.
491
+ * @default Browser default
492
+ */
493
+ thumbColor?: string;
494
+ /**
495
+ * Color of the scrollbar thumb on hover.
496
+ * Works consistently across all browsers.
497
+ * @default thumbColor or browser default
498
+ */
499
+ thumbHoverColor?: string;
500
+ /**
501
+ * Border radius of the scrollbar thumb and track.
502
+ * Works consistently across all browsers.
503
+ * @default Browser default
504
+ */
505
+ borderRadius?: string;
506
+ /**
507
+ * Enable auto-hide scrollbar behavior.
508
+ * When enabled, scrollbar automatically hides after a period of inactivity
509
+ * and reappears on scroll or hover.
510
+ * Works consistently across all browsers via JavaScript implementation.
511
+ * @default false
512
+ */
513
+ autoHide?: boolean;
514
+ /**
515
+ * Delay in milliseconds before auto-hiding the scrollbar.
516
+ * Only applies when autoHide is enabled.
517
+ * @default 1000
518
+ */
519
+ autoHideDelay?: number;
520
+ }
521
+ export interface WidgetConfig {
522
+ experienceId: string;
523
+ apiUrl: string;
524
+ accessToken?: string;
525
+ theme?: "light" | "dark";
526
+ /**
527
+ * Global typography settings
528
+ * These provide base values that can be overridden by component-specific settings
529
+ */
530
+ typography?: {
531
+ /**
532
+ * Base font size for the entire widget
533
+ * This sets the root font size from which all relative sizes are calculated
534
+ * @example "base" (16px)
535
+ * @example "14px"
536
+ * @example "1rem"
537
+ * @default "base" (16px)
538
+ */
539
+ baseFontSize?: FontSize;
540
+ };
541
+ embedded?: boolean;
542
+ /**
543
+ * Enable Shadow DOM for complete CSS isolation.
544
+ * When true, the widget renders inside a Shadow DOM boundary, providing:
545
+ * - Complete bidirectional CSS isolation
546
+ * - No selector conflicts with host page
547
+ * - Protection from hostile CSS overrides
548
+ *
549
+ * Trade-offs:
550
+ * - Some third-party tools may not work (analytics that query DOM)
551
+ * - Inherited CSS properties (color, font-family) still cascade in
552
+ *
553
+ * @default false
554
+ */
555
+ useShadowDOM?: boolean;
556
+ /**
557
+ * Disable cross-tab synchronization.
558
+ * When false (the default), the widget synchronizes session, messages, and state
559
+ * across multiple browser tabs using BroadcastChannel API with localStorage fallback.
560
+ *
561
+ * Set to true when:
562
+ * - Different pages serve different purposes (multi-context applications)
563
+ * - Testing widget behavior in isolation
564
+ * - Users may have different accounts open in different tabs
565
+ * - Privacy requirements prevent state sharing between tabs
566
+ *
567
+ * @default false
568
+ */
569
+ disableTabSync?: boolean;
570
+ button?: {
571
+ position?: "bottom-right" | "bottom-left";
572
+ text?: string;
573
+ backgroundColor?: string;
574
+ textColor?: string;
575
+ hoverBackgroundColor?: string;
576
+ borderRadius?: string;
577
+ size?: "small" | "medium" | "large";
578
+ iconUrl?: string;
579
+ };
580
+ window?: {
581
+ width?: string;
582
+ height?: string;
583
+ backgroundColor?: string;
584
+ borderRadius?: string;
585
+ boxShadow?: string;
586
+ topAccentColor?: string;
587
+ topAccentHeight?: string;
588
+ sizing?: {
589
+ allowResize?: boolean;
590
+ modes?: Array<{
591
+ name: string;
592
+ width: string;
593
+ height: string;
594
+ icon?: string;
595
+ }>;
596
+ defaultMode?: string;
597
+ showToggle?: boolean;
598
+ rememberSize?: boolean;
599
+ disableAutoMobile?: boolean;
600
+ };
601
+ header?: {
602
+ show?: boolean;
603
+ backgroundColor?: string;
604
+ textColor?: string;
605
+ fontFamily?: string;
606
+ /**
607
+ * Font size for header title text
608
+ * @example "lg"
609
+ * @example "18px"
610
+ * @default undefined (inherits base font size)
611
+ */
612
+ fontSize?: FontSize;
613
+ iconColor?: string;
614
+ title?: string;
615
+ showCloseButton?: boolean;
616
+ showSizeToggle?: boolean;
617
+ padding?: string;
618
+ /**
619
+ * Header bottom border shorthand
620
+ * Set to "none" to remove border entirely
621
+ * @example "1px solid #e5e7eb"
622
+ * @example "none"
623
+ */
624
+ border?: string;
625
+ /**
626
+ * Header bottom border color
627
+ * @example "#e5e7eb"
628
+ * @example "transparent"
629
+ */
630
+ borderColor?: string;
631
+ /**
632
+ * Header bottom border width
633
+ * @default "1px"
634
+ * @example "2px"
635
+ * @example "0"
636
+ */
637
+ borderWidth?: string;
638
+ };
639
+ };
640
+ bubbles?: {
641
+ defaultMaxWidth?: string;
642
+ /**
643
+ * Default avatar styling for all message bubbles
644
+ * Can be overridden by role-specific avatar configs
645
+ */
646
+ defaultAvatar?: AvatarConfig;
647
+ user?: {
648
+ backgroundColor?: string;
649
+ backgroundColorHover?: string;
650
+ enableHoverEffect?: boolean;
651
+ textColor?: string;
652
+ fontFamily?: string;
653
+ /**
654
+ * Font size for user message text
655
+ * @example "base"
656
+ * @example "15px"
657
+ * @default undefined (inherits base font size)
658
+ */
659
+ fontSize?: FontSize;
660
+ borderRadius?: string;
661
+ border?: string;
662
+ borderWidth?: string;
663
+ borderColor?: string;
664
+ borderStyle?: string;
665
+ alignment?: "left" | "right";
666
+ maxWidth?: string;
667
+ padding?: string;
668
+ };
669
+ assistant?: {
670
+ backgroundColor?: string;
671
+ backgroundColorHover?: string;
672
+ enableHoverEffect?: boolean;
673
+ textColor?: string;
674
+ fontFamily?: string;
675
+ /**
676
+ * Font size for assistant message text
677
+ * @example "base"
678
+ * @example "15px"
679
+ * @default undefined (inherits base font size)
680
+ */
681
+ fontSize?: FontSize;
682
+ borderRadius?: string;
683
+ border?: string;
684
+ borderWidth?: string;
685
+ borderColor?: string;
686
+ borderStyle?: string;
687
+ /**
688
+ * @deprecated Use `avatar.enabled` instead
689
+ */
690
+ showAvatar?: boolean;
691
+ /**
692
+ * @deprecated Use `avatar.url` instead
693
+ */
694
+ avatarUrl?: string;
695
+ avatar?: AvatarConfig;
696
+ maxWidth?: string;
697
+ padding?: string;
698
+ };
699
+ agent?: {
700
+ backgroundColor?: string;
701
+ backgroundColorHover?: string;
702
+ enableHoverEffect?: boolean;
703
+ textColor?: string;
704
+ fontFamily?: string;
705
+ /**
706
+ * Font size for agent message text
707
+ * @example "base"
708
+ * @example "15px"
709
+ * @default undefined (inherits base font size)
710
+ */
711
+ fontSize?: FontSize;
712
+ borderRadius?: string;
713
+ border?: string;
714
+ borderWidth?: string;
715
+ borderColor?: string;
716
+ borderStyle?: string;
717
+ /**
718
+ * @deprecated Use `avatar.enabled` instead
719
+ */
720
+ showAvatar?: boolean;
721
+ /**
722
+ * @deprecated Use `avatar.url` instead
723
+ */
724
+ avatarUrl?: string;
725
+ avatar?: AvatarConfig;
726
+ showAgentBadge?: boolean;
727
+ badgeText?: string;
728
+ badgeColor?: string;
729
+ maxWidth?: string;
730
+ padding?: string;
731
+ };
732
+ spacing?: string;
733
+ animation?: "fade" | "slide" | "none";
734
+ showTimestamps?: boolean;
735
+ };
736
+ input?: InputConfig;
737
+ messages?: {
738
+ welcomeMessage?: string;
739
+ welcomeMessageDisplay?: "static" | "bubble";
740
+ welcomeMessageShowAvatar?: boolean;
741
+ welcomeMessagePersistent?: boolean;
742
+ welcomeActions?: ActionsConfig;
743
+ errorMessage?: string;
744
+ offlineMessage?: string;
745
+ typingIndicatorText?: string;
746
+ loadingAnimation?: "dots" | "pulse" | "typing";
747
+ loadingAnimationColor?: string;
748
+ /**
749
+ * Link styling configuration
750
+ * Applies to all links in markdown content across all message types
751
+ */
752
+ links?: LinkConfig;
753
+ /**
754
+ * Markdown rendering configuration
755
+ */
756
+ markdown?: {
757
+ /**
758
+ * Apply semantic typography sizes to markdown elements (headings, code)
759
+ * When true: h1 uses xl, h2 uses lg, h3 uses base, h4-h6 use sm, code uses sm
760
+ * When false: all elements inherit the bubble's fontSize configuration
761
+ * @default false
762
+ */
763
+ applyTypographySizes?: boolean;
764
+ };
765
+ /**
766
+ * Whether to automatically scroll to the bottom when new messages are added.
767
+ * Useful to disable on demo pages with multiple widgets to prevent unexpected scrolling.
768
+ * @default true
769
+ */
770
+ autoscroll?: boolean;
771
+ };
772
+ disclaimer?: {
773
+ content?: string;
774
+ contentFormat?: "markdown" | "html" | "text";
775
+ /**
776
+ * Display mode for the disclaimer.
777
+ * - "footer": Fixed at bottom of widget (default, current behavior)
778
+ * - "modal": Blocking overlay requiring acceptance (when required: true)
779
+ * - "event": Scrollable event at top of message stream
780
+ * @default "footer"
781
+ */
782
+ displayMode?: "footer" | "modal" | "event";
783
+ collapsible?: boolean;
784
+ defaultExpanded?: boolean;
785
+ backgroundColor?: string;
786
+ textColor?: string;
787
+ borderColor?: string;
788
+ acceptButton?: boolean;
789
+ acceptButtonText?: string;
790
+ /**
791
+ * When true, displays a blocking modal that requires acceptance before interaction.
792
+ * Acceptance is persisted per-experience in localStorage.
793
+ * @default false
794
+ */
795
+ required?: boolean;
796
+ /**
797
+ * Title displayed at the top of the blocking modal.
798
+ * Only applies when required is true.
799
+ * @default "Disclaimer"
800
+ */
801
+ requiredTitle?: string;
802
+ /**
803
+ * Text for the accept button in the blocking modal.
804
+ * Only applies when required is true.
805
+ * @default "I Accept"
806
+ */
807
+ requiredAcceptButtonText?: string;
808
+ /**
809
+ * When displayMode is "event" and this is true, input is disabled
810
+ * until the disclaimer is accepted. Similar to required modal but inline.
811
+ * @default false
812
+ */
813
+ eventRequiresAcceptance?: boolean;
814
+ };
815
+ branding?: {
816
+ show?: boolean;
817
+ text?: string;
818
+ logoUrl?: string;
819
+ position?: "header" | "footer";
820
+ };
821
+ features?: {
822
+ voice?: VoiceConfig;
823
+ tts?: TTSConfig;
824
+ /**
825
+ * Not yet implemented
826
+ * @internal
827
+ */
828
+ fileUpload?: boolean;
829
+ emoji?: boolean;
830
+ copyButton?: CopyButtonConfig;
831
+ feedback?: FeedbackConfig;
832
+ format?: "markdown" | "html" | "text";
833
+ /**
834
+ * Clear Conversation menu option configuration
835
+ */
836
+ clearConversation?: {
837
+ /**
838
+ * Whether to show the "Clear Conversation" menu option
839
+ * @default true
840
+ */
841
+ enabled?: boolean;
842
+ /**
843
+ * Custom label text for the menu option
844
+ * @default "Clear Conversation"
845
+ */
846
+ label?: string;
847
+ };
848
+ };
849
+ events?: {
850
+ /**
851
+ * Default styling configuration for all events
852
+ * Can be overridden by individual event type configurations
853
+ */
854
+ default?: EventStylingConfig;
855
+ sessionStart?: EventStylingConfig & {
856
+ enabled?: boolean;
857
+ showBadge?: boolean;
858
+ showTimestamp?: boolean;
859
+ layout?: "vertical" | "horizontal";
860
+ message?: string;
861
+ messageFormat?: "markdown" | "html" | "text";
862
+ badgeColor?: string;
863
+ badgeTextColor?: string;
864
+ badgeText?: string;
865
+ iconColor?: string;
866
+ };
867
+ sessionEnd?: EventStylingConfig & {
868
+ enabled?: boolean;
869
+ showBadge?: boolean;
870
+ showTimestamp?: boolean;
871
+ showDuration?: boolean;
872
+ layout?: "vertical" | "horizontal";
873
+ message?: string;
874
+ messageFormat?: "markdown" | "html" | "text";
875
+ badgeColor?: string;
876
+ badgeTextColor?: string;
877
+ iconColor?: string;
878
+ };
879
+ agentHandover?: EventStylingConfig & {
880
+ enabled?: boolean;
881
+ showCard?: boolean;
882
+ /**
883
+ * @deprecated Use `avatar.enabled` instead
884
+ */
885
+ showAvatar?: boolean;
886
+ showTimestamp?: boolean;
887
+ layout?: "vertical" | "horizontal";
888
+ message?: string;
889
+ messageFormat?: "markdown" | "html" | "text";
890
+ cardBackgroundColor?: string;
891
+ cardBorderColor?: string;
892
+ cardTextColor?: string;
893
+ /**
894
+ * Avatar styling for agent handover events
895
+ * Overrides events.default.avatar if specified
896
+ */
897
+ avatar?: AvatarConfig;
898
+ };
899
+ typing?: {
900
+ enabled?: boolean;
901
+ text?: string;
902
+ };
903
+ system?: {
904
+ enabled?: boolean;
905
+ showIcon?: boolean;
906
+ };
907
+ disclaimer?: {
908
+ enabled?: boolean;
909
+ showIcon?: boolean;
910
+ iconColor?: string;
911
+ backgroundColor?: string;
912
+ textColor?: string;
913
+ borderColor?: string;
914
+ borderRadius?: string;
915
+ padding?: string;
916
+ fontSize?: string;
917
+ acceptButtonBackgroundColor?: string;
918
+ acceptButtonTextColor?: string;
919
+ acceptButtonBorderRadius?: string;
920
+ acceptButtonPadding?: string;
921
+ acceptButtonFontSize?: string;
922
+ showAcknowledged?: boolean;
923
+ acknowledgedText?: string;
924
+ acknowledgedTextColor?: string;
925
+ };
926
+ };
927
+ /**
928
+ * Scrollbar styling configuration for the message container.
929
+ * Allows customization of scrollbar appearance (width, colors, border-radius)
930
+ * and auto-hide behavior.
931
+ *
932
+ * When not provided, browser default scrollbar is used.
933
+ *
934
+ * @example
935
+ * ```typescript
936
+ * scrollbar: {
937
+ * width: "8px",
938
+ * thumbColor: "#888",
939
+ * trackColor: "#f1f1f1",
940
+ * autoHide: true
941
+ * }
942
+ * ```
943
+ */
944
+ scrollbar?: ScrollbarConfig;
945
+ advanced?: {
946
+ widgetId?: string;
947
+ /**
948
+ * Optional user identifier to associate with the session.
949
+ * Accepts flexible formats: UUID, email address, numeric ID, or custom string (max 255 characters).
950
+ * Normalized to lowercase for storage and comparison.
951
+ * @example "user@example.com", "550e8400-e29b-41d4-a716-446655440000", "customer-123"
952
+ */
953
+ userId?: string;
954
+ /**
955
+ * Optional session ID to initialize the widget with an existing session.
956
+ * Must be a valid UUID v4 format.
957
+ * Use this to resume a session across page reloads or coordinate multiple widgets.
958
+ * @example "550e8400-e29b-41d4-a716-446655440000"
959
+ */
960
+ sessionId?: string;
961
+ metadata?: Record<string, any>;
962
+ readOnly?: boolean;
963
+ initialEvents?: ChatEvent[];
964
+ /**
965
+ * not used or implemented
966
+ * @internal
967
+ */
968
+ maxMessageLength?: number;
969
+ persistStore?: boolean;
970
+ storeKey?: string;
971
+ /**
972
+ * Message interceptor function for custom routing
973
+ * Called before each message is sent to Nexus backend
974
+ */
975
+ messageInterceptor?: MessageInterceptor;
976
+ /**
977
+ * Timeout for message interceptor in milliseconds
978
+ * @default 30000 (30 seconds)
979
+ */
980
+ interceptorTimeout?: number;
981
+ /**
982
+ * Timeout for all message operations (including backend requests) in milliseconds
983
+ * @default 60000 (60 seconds)
984
+ */
985
+ messageTimeout?: number;
986
+ };
987
+ }
988
+ export type EventKind = "message" | "session_start" | "agent_handover" | "session_end" | "typing" | "system" | "disclaimer";
989
+ export interface BaseEvent {
990
+ id: string;
991
+ kind: EventKind;
992
+ timestamp: Date;
993
+ metadata?: Record<string, any>;
994
+ }
995
+ export interface MessageEvent extends BaseEvent {
996
+ kind: "message";
997
+ role: "user" | "assistant" | "agent";
998
+ content: string;
999
+ format?: "markdown" | "html" | "text";
1000
+ isStreaming?: boolean;
1001
+ feedback?: {
1002
+ value: string | number;
1003
+ comment?: string;
1004
+ timestamp?: Date;
1005
+ };
1006
+ metadata?: {
1007
+ citations?: Array<{
1008
+ content_id: string;
1009
+ title: string;
1010
+ url?: string;
1011
+ excerpt: string;
1012
+ }>;
1013
+ intent?: string;
1014
+ confidence?: number;
1015
+ actions?: ActionsConfig;
1016
+ actionStates?: ActionState[];
1017
+ confirmationMessage?: string;
1018
+ confirmationMessageFormat?: "markdown" | "html" | "text";
1019
+ confirmationMessageAlignment?: "left" | "center" | "right";
1020
+ confirmationMessageColor?: string;
1021
+ confirmationIcon?: ActionIcon;
1022
+ showConfirmationIcon?: boolean;
1023
+ isWelcomeBubble?: boolean;
1024
+ isPersistentWelcome?: boolean;
1025
+ };
1026
+ }
1027
+ export interface SessionStartEvent extends BaseEvent {
1028
+ kind: "session_start";
1029
+ sessionId: string;
1030
+ message?: string;
1031
+ metadata?: {
1032
+ userId?: string;
1033
+ source?: string;
1034
+ initialContext?: Record<string, any>;
1035
+ };
1036
+ }
1037
+ export interface AgentHandoverEvent extends BaseEvent {
1038
+ kind: "agent_handover";
1039
+ agentInfo?: {
1040
+ id?: string;
1041
+ name?: string;
1042
+ avatarUrl?: string;
1043
+ };
1044
+ reason?: string;
1045
+ message?: string;
1046
+ }
1047
+ export interface SessionEndEvent extends BaseEvent {
1048
+ kind: "session_end";
1049
+ reason?: "user_initiated" | "agent_initiated" | "timeout" | "error";
1050
+ message?: string;
1051
+ metadata?: {
1052
+ duration?: number;
1053
+ messageCount?: number;
1054
+ resolved?: boolean;
1055
+ };
1056
+ }
1057
+ export interface TypingEvent extends BaseEvent {
1058
+ kind: "typing";
1059
+ role: "user" | "assistant" | "agent";
1060
+ isTyping: boolean;
1061
+ }
1062
+ export interface SystemEvent extends BaseEvent {
1063
+ kind: "system";
1064
+ type: "info" | "warning" | "error" | "success";
1065
+ message: string;
1066
+ details?: any;
1067
+ }
1068
+ export interface DisclaimerEvent extends BaseEvent {
1069
+ kind: "disclaimer";
1070
+ content: string;
1071
+ contentFormat?: "markdown" | "html" | "text";
1072
+ metadata?: {
1073
+ isPersistentDisclaimer: true;
1074
+ requiresAcceptance?: boolean;
1075
+ accepted?: boolean;
1076
+ acceptedAt?: string;
1077
+ acceptButtonText?: string;
1078
+ };
1079
+ }
1080
+ export type ChatEvent = MessageEvent | SessionStartEvent | AgentHandoverEvent | SessionEndEvent | TypingEvent | SystemEvent | DisclaimerEvent;
1081
+ export interface ChatSession {
1082
+ id: string;
1083
+ experienceId: string;
1084
+ events: ChatEvent[];
1085
+ createdAt: Date;
1086
+ lastMessageAt: Date;
1087
+ }
1088
+ /**
1089
+ * Context provided to message interceptor with access to widget state
1090
+ */
1091
+ export interface MessageInterceptorContext {
1092
+ /** Current session ID (null if no session started yet) */
1093
+ sessionId: string | null;
1094
+ /** Experience ID from widget config */
1095
+ experienceId: string;
1096
+ /** Optional user ID from widget config */
1097
+ userId?: string;
1098
+ /** Direct access to chat store for reading/writing state */
1099
+ store: ChatStore;
1100
+ /** Optional metadata from widget config */
1101
+ metadata?: Record<string, any>;
1102
+ /** Whether the message is being sent during an agent handover */
1103
+ inAgentHandover: boolean;
1104
+ }
1105
+ /**
1106
+ * Message object passed to interceptor
1107
+ */
1108
+ export interface InterceptorMessage {
1109
+ /** Message text content */
1110
+ text: string;
1111
+ /** Timestamp when message was created */
1112
+ timestamp: Date;
1113
+ /** Turn index */
1114
+ turnIndex: number;
1115
+ }
1116
+ export interface InterceptorPassthroughMessage {
1117
+ /** Message text content */
1118
+ text: string;
1119
+ /** Optional metadata to include with message */
1120
+ metadata?: Record<string, any>;
1121
+ }
1122
+ /**
1123
+ * Assistant/agent message returned by interceptor
1124
+ */
1125
+ export interface InterceptorAssistantMessage {
1126
+ /** Response text to display */
1127
+ text: string;
1128
+ /** Message role (assistant or agent) */
1129
+ role: "assistant" | "agent";
1130
+ /** Optional metadata (citations, confidence, etc.) */
1131
+ metadata?: Record<string, any>;
1132
+ /** Optional format override */
1133
+ format?: "markdown" | "html" | "text";
1134
+ /** NEW: Interceptor can provide actions */
1135
+ actions?: ActionsConfig;
1136
+ }
1137
+ /**
1138
+ * Result returned by interceptor to control message flow
1139
+ */
1140
+ export type MessageInterceptorResult = {
1141
+ /** Interceptor handled the message completely */
1142
+ handled: true;
1143
+ /** Custom response to display in widget */
1144
+ response: InterceptorAssistantMessage;
1145
+ } | {
1146
+ /** Interceptor handled the message but encountered error */
1147
+ handled: true;
1148
+ /** Error message to display, or true to use config.messages?.errorMessage */
1149
+ error: string | true;
1150
+ /** Optional format for error message */
1151
+ format?: "markdown" | "html" | "text";
1152
+ } | {
1153
+ /** Interceptor modified message, continue with default Nexus routing */
1154
+ handled: false;
1155
+ /** Modified message to send to Nexus (optional) */
1156
+ message?: InterceptorPassthroughMessage;
1157
+ };
1158
+ /**
1159
+ * Message interceptor function type
1160
+ *
1161
+ * Called before every message is sent to Nexus backend.
1162
+ * Can intercept and handle messages, modify them, or let them pass through.
1163
+ *
1164
+ * @param message - The message about to be sent
1165
+ * @param context - Context with session ID, store access, etc.
1166
+ * @returns Result indicating how to handle the message, or null/undefined to use default
1167
+ */
1168
+ export type MessageInterceptor = (message: InterceptorMessage, context: MessageInterceptorContext) => Promise<MessageInterceptorResult | null | undefined>;
1169
+ /**
1170
+ * Return type of the initWidget function
1171
+ */
1172
+ export interface WidgetAPI {
1173
+ destroy: () => void;
1174
+ open: () => void;
1175
+ close: () => void;
1176
+ toggle: () => void;
1177
+ clearChat: () => void;
1178
+ /**
1179
+ * Start a new session, optionally with a specific session ID
1180
+ * @param sessionId - Optional UUID v4 to use for the new session. If not provided, generates a new UUID.
1181
+ * @returns The sessionId of the newly created session
1182
+ * @throws Error if sessionId is provided but not a valid UUID
1183
+ */
1184
+ startNewSession: (sessionId?: string) => string;
1185
+ updateAccessToken: (token: string | undefined) => void;
1186
+ store: ChatStore;
1187
+ on: <T extends WidgetEventName>(eventName: T, callback: WidgetEventListener<T>) => void;
1188
+ once: <T extends WidgetEventName>(eventName: T, callback: WidgetEventListener<T>) => void;
1189
+ off: <T extends WidgetEventName>(eventName: T, callback: WidgetEventListener<T>) => void;
1190
+ removeAllListeners: (eventName?: WidgetEventName) => void;
1191
+ }
1192
+ /**
1193
+ * Event names that can be emitted by the widget
1194
+ */
1195
+ export type WidgetEventName = "open" | "close" | "minimize" | "maximize" | "sessionStart" | "sessionEnd" | "sessionClear" | "messageStart" | "messageComplete" | "messageChunk" | "typing" | "typingStop" | "feedback" | "copy" | "actionClick" | "handover" | "customAction" | "sendQuery" | "disclaimerAccept" | "voiceStart" | "voiceEnd" | "ttsStart" | "ttsEnd" | "error";
1196
+ /**
1197
+ * Base interface for all widget events
1198
+ */
1199
+ export interface WidgetEventBase {
1200
+ timestamp: string;
1201
+ sessionId?: string | null;
1202
+ }
1203
+ /**
1204
+ * Event data structures for each event type
1205
+ */
1206
+ export interface WidgetEventData {
1207
+ open: WidgetEventBase;
1208
+ close: WidgetEventBase;
1209
+ minimize: WidgetEventBase & {
1210
+ previousMode: string;
1211
+ };
1212
+ maximize: WidgetEventBase & {
1213
+ previousMode: string;
1214
+ };
1215
+ sessionStart: WidgetEventBase & {
1216
+ sessionId: string;
1217
+ };
1218
+ sessionEnd: WidgetEventBase & {
1219
+ sessionId: string;
1220
+ duration?: number;
1221
+ messageCount?: number;
1222
+ };
1223
+ sessionClear: WidgetEventBase & {
1224
+ messageCount?: number;
1225
+ };
1226
+ messageStart: WidgetEventBase & {
1227
+ message: string;
1228
+ };
1229
+ messageComplete: WidgetEventBase & {
1230
+ queryId?: string;
1231
+ answer: string;
1232
+ duration?: number;
1233
+ };
1234
+ messageChunk: WidgetEventBase & {
1235
+ text: string;
1236
+ complete: boolean;
1237
+ };
1238
+ typing: WidgetEventBase & {
1239
+ text: string;
1240
+ length: number;
1241
+ };
1242
+ typingStop: WidgetEventBase;
1243
+ feedback: WidgetEventBase & {
1244
+ rating: string | number;
1245
+ queryId?: string;
1246
+ messageId: string;
1247
+ comment?: string;
1248
+ };
1249
+ copy: WidgetEventBase & {
1250
+ content: string;
1251
+ messageId: string;
1252
+ };
1253
+ actionClick: WidgetEventBase & {
1254
+ messageId: string;
1255
+ actionId: string;
1256
+ actionType: string;
1257
+ actionLabel: string;
1258
+ };
1259
+ handover: WidgetEventBase & {
1260
+ reason: string;
1261
+ priority: "low" | "normal" | "high";
1262
+ metadata?: Record<string, unknown>;
1263
+ };
1264
+ customAction: WidgetEventBase & {
1265
+ actionId: string;
1266
+ eventName: string;
1267
+ eventData: Record<string, unknown>;
1268
+ };
1269
+ sendQuery: WidgetEventBase & {
1270
+ actionId: string;
1271
+ queryText: string;
1272
+ displayText?: string;
1273
+ };
1274
+ disclaimerAccept: WidgetEventBase & {
1275
+ experienceId: string;
1276
+ };
1277
+ voiceStart: WidgetEventBase & {
1278
+ language?: string;
1279
+ };
1280
+ voiceEnd: WidgetEventBase & {
1281
+ transcript?: string;
1282
+ duration?: number;
1283
+ };
1284
+ ttsStart: WidgetEventBase & {
1285
+ text: string;
1286
+ messageId: string;
1287
+ };
1288
+ ttsEnd: WidgetEventBase & {
1289
+ messageId: string;
1290
+ duration?: number;
1291
+ };
1292
+ error: WidgetEventBase & {
1293
+ type: string;
1294
+ message: string;
1295
+ stack?: string;
1296
+ details?: any;
1297
+ };
1298
+ }
1299
+ /**
1300
+ * Event listener callback type
1301
+ */
1302
+ export type WidgetEventListener<T extends WidgetEventName> = (data: WidgetEventData[T]) => void;
1303
+ /**
1304
+ * Generic event listener (for wildcard listeners if implemented)
1305
+ */
1306
+ export type GenericEventListener = (eventName: WidgetEventName, data: WidgetEventData[WidgetEventName]) => void;
1307
+ export type ActionType = "trigger_handover" | "open_url" | "send_event" | "send_query";
1308
+ export type ActionIconType = "svg" | "url" | "emoji";
1309
+ export interface ActionIcon {
1310
+ type: ActionIconType;
1311
+ content: string;
1312
+ }
1313
+ export interface ActionStyle {
1314
+ size?: "small" | "medium" | "large";
1315
+ backgroundColor?: string;
1316
+ disabledBackgroundColor?: string;
1317
+ iconColor?: string;
1318
+ textColor?: string;
1319
+ hoverBackgroundColor?: string;
1320
+ borderRadius?: string;
1321
+ /**
1322
+ * Action button border (shorthand)
1323
+ * @example "2px solid #e5e7eb"
1324
+ */
1325
+ border?: string;
1326
+ /**
1327
+ * Action button border width (granular)
1328
+ * @example "2px"
1329
+ */
1330
+ borderWidth?: string;
1331
+ /**
1332
+ * Action button border color (granular)
1333
+ * @example "#10b981"
1334
+ */
1335
+ borderColor?: string;
1336
+ /**
1337
+ * Action button border style (granular)
1338
+ * @example "solid", "dashed", "dotted"
1339
+ */
1340
+ borderStyle?: string;
1341
+ }
1342
+ export interface ActionBehavior {
1343
+ oneTimeUse?: boolean;
1344
+ disableAllOnClick?: boolean;
1345
+ expiresAfterTurns?: number;
1346
+ disabled?: boolean;
1347
+ disabledReason?: string;
1348
+ postClickBehavior?: PostClickBehavior;
1349
+ }
1350
+ /**
1351
+ * Configuration for action button post-click behavior
1352
+ */
1353
+ export interface PostClickBehavior {
1354
+ /** Remove all action buttons after this action is clicked */
1355
+ removeOnClick?: boolean;
1356
+ /** Confirmation message to display after action click */
1357
+ confirmationMessage?: string;
1358
+ /** Format of the confirmation message (default: "markdown") */
1359
+ confirmationMessageFormat?: "markdown" | "html" | "text";
1360
+ /** Alignment of confirmation message (default: "center") */
1361
+ confirmationMessageAlignment?: "left" | "center" | "right";
1362
+ /** Text color for confirmation message (CSS color value) */
1363
+ confirmationMessageColor?: string;
1364
+ /** Icon to display with confirmation message */
1365
+ confirmationIcon?: ActionIcon;
1366
+ /** Whether to show the icon (default: true if confirmationIcon provided) */
1367
+ showIcon?: boolean;
1368
+ /** Show a system event in the chat history (default: false) */
1369
+ showSystemEvent?: boolean;
1370
+ /** Custom message for the system event (defaults to action-specific message) */
1371
+ systemEventMessage?: string;
1372
+ /** Type of system event to show (default: "info") */
1373
+ systemEventType?: "info" | "success" | "warning" | "error";
1374
+ }
1375
+ /**
1376
+ * Default green checkmark icon for confirmation messages
1377
+ */
1378
+ export declare const DEFAULT_CONFIRMATION_ICON: ActionIcon;
1379
+ export interface ActionVisibility {
1380
+ showLabel?: boolean;
1381
+ showIcon?: boolean;
1382
+ showTooltip?: boolean;
1383
+ tooltipText?: string;
1384
+ }
1385
+ export interface TriggerHandoverAction {
1386
+ type: "trigger_handover";
1387
+ payload?: {
1388
+ reason?: string;
1389
+ priority?: "low" | "normal" | "high";
1390
+ metadata?: Record<string, unknown>;
1391
+ message?: string;
1392
+ };
1393
+ }
1394
+ export interface OpenUrlAction {
1395
+ type: "open_url";
1396
+ url: string;
1397
+ target?: "_blank" | "_self" | "_parent" | "_top";
1398
+ }
1399
+ export interface SendEventAction {
1400
+ type: "send_event";
1401
+ eventName: string;
1402
+ eventData?: Record<string, unknown>;
1403
+ }
1404
+ export interface SendQueryAction {
1405
+ type: "send_query";
1406
+ queryText: string;
1407
+ displayText?: string;
1408
+ }
1409
+ export type ActionDefinition = TriggerHandoverAction | OpenUrlAction | SendEventAction | SendQueryAction;
1410
+ export interface ActionConfig {
1411
+ id: string;
1412
+ label: string;
1413
+ icon?: ActionIcon;
1414
+ action: ActionDefinition;
1415
+ style?: ActionStyle;
1416
+ behavior?: ActionBehavior;
1417
+ visibility?: ActionVisibility;
1418
+ }
1419
+ export type ActionAlignment = "left" | "center" | "right";
1420
+ export interface ActionsConfig {
1421
+ position?: "bottom";
1422
+ alignment?: ActionAlignment;
1423
+ spacing?: string;
1424
+ actions: ActionConfig[];
1425
+ }
1426
+ export interface ActionState {
1427
+ actionId: string;
1428
+ messageId: string;
1429
+ disabled: boolean;
1430
+ disabledReason?: "used" | "expired" | "outdated" | "manual";
1431
+ loading?: boolean;
1432
+ error?: string;
1433
+ usedAt?: Date;
1434
+ }
1435
+ /**
1436
+ * Global NexusChatWidget object available on window
1437
+ */
1438
+ export interface NexusChatWidgetGlobal {
1439
+ init: (config: WidgetConfig) => WidgetAPI;
1440
+ storeManager: {
1441
+ getStore: (key: string) => ChatStore;
1442
+ hasStore: (key: string) => boolean;
1443
+ clearStore: (key: string) => void;
1444
+ clearAllStores: () => void;
1445
+ };
1446
+ }
1447
+ /**
1448
+ * Global window interface extensions for NexusChatWidget
1449
+ */
1450
+ declare global {
1451
+ interface Window {
1452
+ NexusChatWidget?: NexusChatWidgetGlobal;
1453
+ "nexus-chat"?: (action: string, config: WidgetConfig) => void;
1454
+ }
1455
+ }
1456
+ //# sourceMappingURL=index.d.ts.map