@enjoys/react-chatbot-plugin 1.8.2 → 1.23.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/dist/index.d.ts CHANGED
@@ -76,6 +76,50 @@ export declare function autoReplyPlugin(options?: {
76
76
  onlyWhenOpen?: boolean;
77
77
  }): ChatPlugin;
78
78
 
79
+ declare interface BookingConfirmation {
80
+ bookingId: string;
81
+ date: string;
82
+ time: string;
83
+ status: 'confirmed' | 'pending' | 'cancelled';
84
+ }
85
+
86
+ export declare function bookingPlugin(options: BookingPluginOptions): ChatPlugin;
87
+
88
+ declare interface BookingPluginOptions {
89
+ /** API endpoint to fetch available slots (GET ?date=YYYY-MM-DD) */
90
+ slotsEndpoint: string;
91
+ /** API endpoint to confirm booking (POST) */
92
+ bookEndpoint: string;
93
+ /** Request headers */
94
+ headers?: Record<string, string>;
95
+ /** Callback on successful booking */
96
+ onBooked?: (confirmation: BookingConfirmation) => void;
97
+ /** Callback on cancelled booking */
98
+ onCancelled?: (bookingId: string) => void;
99
+ /** Flow step after booking confirmed */
100
+ successStep?: string;
101
+ /** Custom message format for available slots */
102
+ slotsMessage?: (slots: TimeSlot[]) => string;
103
+ }
104
+
105
+ declare interface BotPersona {
106
+ /** Unique persona identifier */
107
+ id: string;
108
+ /** Display name */
109
+ name: string;
110
+ /** Avatar URL */
111
+ avatar?: string;
112
+ /** Greeting message when switching to this persona */
113
+ greeting?: string;
114
+ /** Theme overrides */
115
+ theme?: {
116
+ primaryColor?: string;
117
+ headerBg?: string;
118
+ };
119
+ /** Flow config ID to activate */
120
+ flowId?: string;
121
+ }
122
+
79
123
  export declare const Branding: default_2.FC<BrandingProps>;
80
124
 
81
125
  export declare interface BrandingConfig {
@@ -124,6 +168,23 @@ export declare function campaignPlugin(options: {
124
168
  onTrigger?: (campaign: CampaignConfig, ctx: PluginContext) => void;
125
169
  }): ChatPlugin;
126
170
 
171
+ declare interface CardButton {
172
+ label: string;
173
+ /** Quick reply value — triggers onQuickReply */
174
+ value?: string;
175
+ /** URL to open in a new tab */
176
+ url?: string;
177
+ /** Flow step to jump to */
178
+ next?: string;
179
+ }
180
+
181
+ declare interface CarouselCard {
182
+ title: string;
183
+ subtitle?: string;
184
+ image?: string;
185
+ buttons?: CardButton[];
186
+ }
187
+
127
188
  declare type ChatAction = {
128
189
  type: 'TOGGLE_OPEN';
129
190
  } | {
@@ -187,6 +248,25 @@ export declare interface ChatBotProps {
187
248
  zIndex?: number;
188
249
  /** Enable emoji picker */
189
250
  enableEmoji?: boolean;
251
+ /** Enable message reactions (👍👎 on bot/agent messages).
252
+ * Pass `true` for default emojis, or an array of custom emoji strings. */
253
+ enableReactions?: boolean | string[];
254
+ /** Enable message search — adds a search icon in the header */
255
+ enableSearch?: boolean;
256
+ /** Enable voice input (speech-to-text) via Web Speech API */
257
+ enableVoice?: boolean | {
258
+ lang?: string;
259
+ continuous?: boolean;
260
+ };
261
+ /** Show "User is typing..." to the bot/agent side — emits typing events */
262
+ showUserTyping?: boolean;
263
+ /** Allow user to edit/delete their sent messages */
264
+ allowMessageEdit?: boolean;
265
+ /** Show read receipt indicators (✓ sent, ✓✓ delivered, ✓✓ read) */
266
+ showReadReceipts?: boolean;
267
+ /** Enable built-in markdown rendering in messages (bold, italic, code, links, lists).
268
+ * Pass `true` for all features, or an options object to selectively enable. */
269
+ markdown?: boolean | MarkdownOptions;
190
270
  /** File upload configuration */
191
271
  fileUpload?: FileUploadConfig;
192
272
  /** Map of custom components that can be rendered in flow steps (key = step.component) */
@@ -209,6 +289,10 @@ export declare interface ChatBotProps {
209
289
  icons?: Partial<ChatIconMap>;
210
290
  /** Live agent configuration — WebSocket or Socket.IO real-time chat with human agents */
211
291
  liveAgent?: LiveAgentConfig;
292
+ /** Middleware pipeline — functions that intercept/transform messages before processing */
293
+ middleware?: FlowMiddleware[];
294
+ /** Headless mode — hides all UI, exposes only the engine & plugin system via ref */
295
+ headless?: boolean;
212
296
  }
213
297
 
214
298
  export declare const ChatBubbleIcon: default_2.FC<IconProps>;
@@ -226,6 +310,10 @@ export declare interface ChatCallbacks {
226
310
  onFlowEnd?: (collectedData: Record<string, unknown>) => void;
227
311
  onError?: (error: Error) => void;
228
312
  onEvent?: (event: string, payload?: unknown) => void;
313
+ /** Called when user reacts to a message */
314
+ onReaction?: (messageId: string, emoji: string, reacted: boolean) => void;
315
+ /** Called when user starts/stops typing */
316
+ onUserTyping?: (isTyping: boolean) => void;
229
317
  /** Called when user types text the bot couldn't handle */
230
318
  onUnhandledMessage?: (text: string, context: {
231
319
  currentStepId: string | null;
@@ -285,11 +373,12 @@ declare interface ChatHeaderProps {
285
373
  onRestart?: () => void;
286
374
  logo?: string;
287
375
  logoWidth?: string;
376
+ onSearchChange?: (query: string) => void;
288
377
  }
289
378
 
290
379
  /** Map of all replaceable icons. Each value is a `ReactNode` so users can
291
380
  * supply any JSX element (SVG, image, icon-library component, etc.). */
292
- declare interface ChatIconMap {
381
+ export declare interface ChatIconMap {
293
382
  send: ReactNode;
294
383
  chatBubble: ReactNode;
295
384
  close: ReactNode;
@@ -300,6 +389,11 @@ declare interface ChatIconMap {
300
389
  image: ReactNode;
301
390
  remove: ReactNode;
302
391
  restart: ReactNode;
392
+ search: ReactNode;
393
+ mic: ReactNode;
394
+ star: ReactNode;
395
+ edit: ReactNode;
396
+ trash: ReactNode;
303
397
  }
304
398
 
305
399
  export declare const ChatInput: default_2.FC<ChatInputProps>;
@@ -330,6 +424,12 @@ export declare interface ChatMessage {
330
424
  component?: string;
331
425
  /** Agent name for live agent messages */
332
426
  agentName?: string;
427
+ /** Carousel cards — renders horizontally scrollable rich cards */
428
+ cards?: CarouselCard[];
429
+ /** Reactions on this message */
430
+ reactions?: MessageReaction[];
431
+ /** Message delivery status */
432
+ status?: MessageStatus;
333
433
  }
334
434
 
335
435
  export declare interface ChatPlugin {
@@ -448,6 +548,19 @@ export declare interface CheckboxFieldRenderProps {
448
548
 
449
549
  export declare const CloseIcon: default_2.FC<IconProps>;
450
550
 
551
+ export declare function codeHighlightPlugin(options?: CodeHighlightPluginOptions): ChatPlugin;
552
+
553
+ declare interface CodeHighlightPluginOptions {
554
+ /** Theme: 'dark' | 'light' (default: 'dark') — applies CSS class */
555
+ theme?: 'dark' | 'light';
556
+ /** Add copy button to code blocks (default: true) */
557
+ copyButton?: boolean;
558
+ /** Max height for code blocks in px (default: 300) */
559
+ maxHeight?: number;
560
+ /** Languages to auto-detect (informational) */
561
+ languages?: string[];
562
+ }
563
+
451
564
  /**
452
565
  * Component Plugin — injects custom component messages into chat via events
453
566
  */
@@ -456,6 +569,56 @@ export declare function componentPlugin(options?: {
456
569
  onRender?: (componentKey: string, ctx: PluginContext) => void;
457
570
  }): ChatPlugin;
458
571
 
572
+ export declare function confettiPlugin(options?: ConfettiPluginOptions): ChatPlugin;
573
+
574
+ declare interface ConfettiPluginOptions {
575
+ /** Events that auto-trigger confetti (default: ['flowEnd']) */
576
+ triggers?: string[];
577
+ /** Duration in ms (default: 3000) */
578
+ duration?: number;
579
+ /** Number of particles (default: 50) */
580
+ particleCount?: number;
581
+ /** Custom colors */
582
+ colors?: string[];
583
+ /** Callback when confetti fires */
584
+ onFire?: () => void;
585
+ }
586
+
587
+ declare type ConversationPriority = 'low' | 'medium' | 'high' | 'urgent';
588
+
589
+ /**
590
+ * Create a standalone event bus instance.
591
+ *
592
+ * @example
593
+ * ```ts
594
+ * import { createEventBus } from '@enjoys/react-chatbot-plugin';
595
+ *
596
+ * const bus = createEventBus();
597
+ * bus.on('user:login', (data) => console.log(data));
598
+ * bus.emit('user:login', { name: 'Alice' });
599
+ * ```
600
+ */
601
+ export declare function createEventBus(): EventBus;
602
+
603
+ /**
604
+ * Create a headless chatbot instance (no UI).
605
+ *
606
+ * @example
607
+ * ```ts
608
+ * import { createHeadlessBot } from '@enjoys/react-chatbot-plugin';
609
+ *
610
+ * const bot = createHeadlessBot({
611
+ * flow: myFlow,
612
+ * plugins: [loggerPlugin()],
613
+ * onMessage: (msg) => console.log(msg.sender, msg.text),
614
+ * });
615
+ *
616
+ * await bot.sendMessage('hello');
617
+ * console.log(bot.getMessages());
618
+ * ```
619
+ */
620
+ export declare function createHeadlessBot(options?: HeadlessBotOptions): HeadlessBot;
621
+
459
622
  /**
460
623
  * CRM Plugin — pushes user/lead data to CRM systems
461
624
  */
@@ -530,6 +693,21 @@ declare interface EmojiPickerProps {
530
693
  primaryColor: string;
531
694
  }
532
695
 
696
+ export declare interface EventBus {
697
+ /** Subscribe to an event */
698
+ on(event: string, handler: EventHandler): () => void;
699
+ /** Subscribe once — auto-removes after first call */
700
+ once(event: string, handler: EventHandler): () => void;
701
+ /** Emit an event to all subscribers */
702
+ emit(event: string, ...args: unknown[]): void;
703
+ /** Remove a specific handler */
704
+ off(event: string, handler: EventHandler): void;
705
+ /** Remove all handlers for an event (or all events if no event specified) */
706
+ clear(event?: string): void;
707
+ }
708
+
709
+ export declare type EventHandler = (...args: unknown[]) => void;
710
+
533
711
  /** Props passed to file custom field renderers */
534
712
  export declare interface FileFieldRenderProps {
535
713
  type: 'file';
@@ -646,6 +824,10 @@ export declare class FlowEngine {
646
824
  /** Reset the engine to initial state */
647
825
  reset(): void;
648
826
  resolveNext(step: FlowStep, userValue?: string): string | undefined;
827
+ /** Check if a step should be visible based on its `visibleIf` condition */
828
+ isStepVisible(step: FlowStep): boolean;
829
+ /** Resolve a sub-flow's start step (for flow composition) */
830
+ getSubFlowStartStep(step: FlowStep): FlowStep | undefined;
649
831
  /** Returns true if the step expects a quick reply (not free text) */
650
832
  stepExpectsQuickReply(step: FlowStep): boolean;
651
833
  /** Returns true if the step expects a form submission */
@@ -656,6 +838,9 @@ export declare class FlowEngine {
656
838
  private evaluate;
657
839
  }
658
840
 
841
+ /** Middleware function — can transform messages or short-circuit */
842
+ export declare type FlowMiddleware = (message: ChatMessage, data: Record<string, unknown>, next: () => void) => void | ChatMessage;
843
+
659
844
  export declare interface FlowQuickReply {
660
845
  label: string;
661
846
  value: string;
@@ -679,6 +864,12 @@ export declare interface FlowStep {
679
864
  input?: FlowStepInput;
680
865
  /** Async action to run when this step is entered (API calls, verification, etc.) */
681
866
  asyncAction?: FlowAsyncAction;
867
+ /** Only show this step when condition is met (conditional rendering) */
868
+ visibleIf?: FlowCondition;
869
+ /** Sub-flow composition — inline another flow's steps */
870
+ subFlow?: FlowConfig;
871
+ /** Step to go to after sub-flow completes */
872
+ onSubFlowComplete?: string;
682
873
  }
683
874
 
684
875
  /** Configuration for a free-text input step with optional validation */
@@ -738,7 +929,7 @@ export declare type FormFieldRenderMap = Partial<{
738
929
  /** Union of all field render props — discriminated by `type` */
739
930
  export declare type FormFieldRenderProps = TextFieldRenderProps | SelectFieldRenderProps | RadioFieldRenderProps | CheckboxFieldRenderProps | FileFieldRenderProps;
740
931
 
741
- export declare type FormFieldType = 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'textarea' | 'select' | 'multiselect' | 'radio' | 'checkbox' | 'file' | 'date' | 'time' | 'hidden';
932
+ export declare type FormFieldType = 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'textarea' | 'select' | 'multiselect' | 'radio' | 'checkbox' | 'file' | 'date' | 'time' | 'datetime' | 'color' | 'range' | 'hidden';
742
933
 
743
934
  export declare interface FormFieldValidation {
744
935
  required?: boolean;
@@ -774,6 +965,36 @@ export declare interface HeaderSlotProps {
774
965
  component?: ReactNode;
775
966
  }
776
967
 
968
+ export declare interface HeadlessBot {
969
+ /** Send a user message into the bot */
970
+ sendMessage: (text: string) => Promise<void>;
971
+ /** Programmatically add a bot message */
972
+ addBotMessage: (text: string) => void;
973
+ /** Get all messages in the conversation */
974
+ getMessages: () => ChatMessage[];
975
+ /** Get collected data */
976
+ getData: () => Record<string, unknown>;
977
+ /** Set a data field */
978
+ setData: (key: string, value: unknown) => void;
979
+ /** Get the current step ID (null if no flow) */
980
+ getCurrentStep: () => string | null;
981
+ /** Go to a specific flow step */
982
+ goToStep: (stepId: string) => Promise<void>;
983
+ /** Reset the bot state */
984
+ reset: () => void;
985
+ /** The event bus for this instance */
986
+ bus: EventBus;
987
+ /** Destroy the bot — cleans up plugins */
988
+ destroy: () => Promise<void>;
989
+ }
990
+
991
+ export declare interface HeadlessBotOptions {
992
+ flow?: FlowConfig;
993
+ plugins?: ChatPlugin[];
994
+ initialMessages?: ChatMessage[];
995
+ onMessage?: (message: ChatMessage) => void;
996
+ }
997
+
777
998
  /**
778
999
  * i18n Plugin — supports multiple languages with dynamic switching
779
1000
  */
@@ -822,6 +1043,14 @@ declare interface IntentRule {
822
1043
  matchType?: 'contains' | 'exact' | 'regex';
823
1044
  }
824
1045
 
1046
+ declare interface KBArticle {
1047
+ id: string;
1048
+ title: string;
1049
+ content: string;
1050
+ tags?: string[];
1051
+ url?: string;
1052
+ }
1053
+
825
1054
  /** Route configuration for keyword-based text matching */
826
1055
  export declare interface KeywordRoute {
827
1056
  /** Patterns to match against user text */
@@ -838,6 +1067,25 @@ export declare interface KeywordRoute {
838
1067
  priority?: number;
839
1068
  }
840
1069
 
1070
+ export declare function knowledgeBasePlugin(options?: KnowledgeBasePluginOptions): ChatPlugin;
1071
+
1072
+ declare interface KnowledgeBasePluginOptions {
1073
+ /** Local articles for fuzzy search */
1074
+ articles?: KBArticle[];
1075
+ /** Remote search endpoint (GET with ?q= param) */
1076
+ endpoint?: string;
1077
+ /** Request headers */
1078
+ headers?: Record<string, string>;
1079
+ /** Auto-search user messages against KB (default: false) */
1080
+ autoSearch?: boolean;
1081
+ /** Minimum confidence to show result (0-1, default: 0.3) */
1082
+ threshold?: number;
1083
+ /** Max results to show (default: 3) */
1084
+ maxResults?: number;
1085
+ /** Callback on search result */
1086
+ onResult?: (articles: KBArticle[]) => void;
1087
+ }
1088
+
841
1089
  export declare const Launcher: default_2.FC<LauncherProps>;
842
1090
 
843
1091
  declare interface LauncherProps {
@@ -973,6 +1221,21 @@ export declare interface LiveAgentEvents {
973
1221
  */
974
1222
  export declare function liveAgentPlugin(config: LiveAgentConfig): ChatPlugin;
975
1223
 
1224
+ export declare function locationPlugin(options?: LocationPluginOptions): ChatPlugin;
1225
+
1226
+ declare interface LocationPluginOptions {
1227
+ /** Map provider for link generation (default: 'google') */
1228
+ mapProvider?: 'google' | 'openstreetmap' | 'apple';
1229
+ /** High accuracy GPS (default: false) */
1230
+ highAccuracy?: boolean;
1231
+ /** Timeout in ms (default: 10000) */
1232
+ timeout?: number;
1233
+ /** Callback with location data */
1234
+ onLocation?: (lat: number, lng: number) => void;
1235
+ /** Custom message format */
1236
+ messageFormat?: (lat: number, lng: number, url: string) => string;
1237
+ }
1238
+
976
1239
  /**
977
1240
  * Logger Plugin — logs all chatbot events for debugging or auditing
978
1241
  */
@@ -1003,6 +1266,23 @@ export declare interface LoginScreenSlotProps {
1003
1266
 
1004
1267
  declare type LogLevel = 'debug' | 'info' | 'warn' | 'error';
1005
1268
 
1269
+ export declare interface MarkdownOptions {
1270
+ /** Render **bold** and __bold__ (default: true) */
1271
+ bold?: boolean;
1272
+ /** Render *italic* and _italic_ (default: true) */
1273
+ italic?: boolean;
1274
+ /** Render `inline code` and ```code blocks``` (default: true) */
1275
+ code?: boolean;
1276
+ /** Render [text](url) as links (default: true) */
1277
+ links?: boolean;
1278
+ /** Render - / * / • list items (default: true) */
1279
+ lists?: boolean;
1280
+ /** Render ~~strikethrough~~ (default: true) */
1281
+ strikethrough?: boolean;
1282
+ /** Render headings # ## ### (default: false) */
1283
+ headings?: boolean;
1284
+ }
1285
+
1006
1286
  /**
1007
1287
  * Markdown Plugin — transforms markdown syntax in bot messages to HTML
1008
1288
  * Lightweight built-in renderer, no external dependencies.
@@ -1071,12 +1351,95 @@ declare interface MessageListProps {
1071
1351
  renderFormField?: FormFieldRenderMap;
1072
1352
  /** Slot overrides from customizeChat */
1073
1353
  customizeChat?: ChatCustomizeChat;
1354
+ /** Search filter query */
1355
+ searchQuery?: string;
1356
+ }
1357
+
1358
+ declare interface MessageReaction {
1359
+ emoji: string;
1360
+ count: number;
1361
+ reacted: boolean;
1362
+ }
1363
+
1364
+ export declare function messageSchedulePlugin(options?: MessageSchedulePluginOptions): ChatPlugin;
1365
+
1366
+ declare interface MessageSchedulePluginOptions {
1367
+ /** Polling interval in ms (default: 1000) */
1368
+ checkInterval?: number;
1369
+ /** Max scheduled messages (default: 20) */
1370
+ maxScheduled?: number;
1371
+ /** Persist in localStorage */
1372
+ persist?: boolean;
1373
+ /** Storage key */
1374
+ storageKey?: string;
1375
+ /** Callback when a scheduled message fires */
1376
+ onFire?: (msg: ScheduledMessage_2) => void;
1074
1377
  }
1075
1378
 
1076
1379
  export declare type MessageSender = 'bot' | 'user' | 'system' | 'agent';
1077
1380
 
1381
+ declare type MessageStatus = 'sent' | 'delivered' | 'read';
1382
+
1078
1383
  export declare const MinimizeIcon: default_2.FC<IconProps>;
1079
1384
 
1385
+ export declare function notificationBadgePlugin(options?: NotificationBadgePluginOptions): ChatPlugin;
1386
+
1387
+ declare interface NotificationBadgePluginOptions {
1388
+ /** Play sound on new message (default: false) */
1389
+ playSound?: boolean;
1390
+ /** Sound URL */
1391
+ soundUrl?: string;
1392
+ /** Show browser notification (default: false) */
1393
+ browserNotification?: boolean;
1394
+ /** Update document.title with count (default: false) */
1395
+ updateTitle?: boolean;
1396
+ /** Original page title */
1397
+ originalTitle?: string;
1398
+ }
1399
+
1400
+ /**
1401
+ * Offline Plugin — queues messages when device is offline and sends them on reconnect.
1402
+ */
1403
+ export declare function offlinePlugin(options?: {
1404
+ /** Storage key for queued messages (default: 'cb_offline_queue') */
1405
+ storageKey?: string;
1406
+ /** Show indicator when offline */
1407
+ showOfflineIndicator?: boolean;
1408
+ /** Called when messages are flushed on reconnect */
1409
+ onFlush?: (count: number) => void;
1410
+ }): ChatPlugin;
1411
+
1412
+ export declare function paymentPlugin(options: PaymentPluginOptions): ChatPlugin;
1413
+
1414
+ declare interface PaymentPluginOptions {
1415
+ /** Payment gateway: 'stripe' | 'razorpay' | 'custom' */
1416
+ gateway: 'stripe' | 'razorpay' | 'custom';
1417
+ /** API endpoint for creating payment intent/order */
1418
+ endpoint: string;
1419
+ /** Request headers (API keys etc.) */
1420
+ headers?: Record<string, string>;
1421
+ /** Stripe publishable key (if gateway = 'stripe') */
1422
+ stripeKey?: string;
1423
+ /** Razorpay key ID (if gateway = 'razorpay') */
1424
+ razorpayKey?: string;
1425
+ /** Callback on successful payment */
1426
+ onSuccess?: (result: PaymentResult) => void;
1427
+ /** Callback on failed payment */
1428
+ onError?: (error: string) => void;
1429
+ /** Flow step to go to on success */
1430
+ successStep?: string;
1431
+ /** Flow step to go to on failure */
1432
+ errorStep?: string;
1433
+ }
1434
+
1435
+ declare interface PaymentResult {
1436
+ success: boolean;
1437
+ transactionId?: string;
1438
+ error?: string;
1439
+ amount: number;
1440
+ currency: string;
1441
+ }
1442
+
1080
1443
  /**
1081
1444
  * Persistence Plugin — saves/restores full chat history via browser storage
1082
1445
  */
@@ -1087,6 +1450,35 @@ export declare function persistencePlugin(options?: {
1087
1450
  ttl?: number;
1088
1451
  }): ChatPlugin;
1089
1452
 
1453
+ /**
1454
+ * Persona Plugin — switch between different bot personalities in one widget.
1455
+ * Each persona has a name, avatar, greeting, and optionally a different theme/flow.
1456
+ */
1457
+ export declare function personaPlugin(options: {
1458
+ personas: BotPersona[];
1459
+ /** Default persona ID (defaults to first) */
1460
+ defaultPersona?: string;
1461
+ /** Storage key for current persona (default: 'cb_persona') */
1462
+ storageKey?: string;
1463
+ /** Called when persona switches */
1464
+ onSwitch?: (persona: BotPersona) => void;
1465
+ }): ChatPlugin;
1466
+
1467
+ export declare function pinPlugin(options?: PinPluginOptions): ChatPlugin;
1468
+
1469
+ declare interface PinPluginOptions {
1470
+ /** Max pinned messages (default: 10) */
1471
+ maxPins?: number;
1472
+ /** Persist pins in localStorage */
1473
+ persist?: boolean;
1474
+ /** Storage key */
1475
+ storageKey?: string;
1476
+ /** Callback when a message is pinned */
1477
+ onPin?: (messageId: string) => void;
1478
+ /** Callback when a message is unpinned */
1479
+ onUnpin?: (messageId: string) => void;
1480
+ }
1481
+
1090
1482
  export declare interface PluginContext {
1091
1483
  /** Send a message programmatically */
1092
1484
  sendMessage: (text: string) => void;
@@ -1126,6 +1518,66 @@ export declare class PluginManager {
1126
1518
  private dispatchEvent;
1127
1519
  }
1128
1520
 
1521
+ export declare function pollPlugin(options?: PollPluginOptions): ChatPlugin;
1522
+
1523
+ declare interface PollPluginOptions {
1524
+ /** Callback when vote is cast */
1525
+ onVote?: (pollId: string, value: string) => void;
1526
+ /** Callback when poll closes */
1527
+ onClose?: (result: PollResult) => void;
1528
+ /** Webhook to report results */
1529
+ webhookUrl?: string;
1530
+ }
1531
+
1532
+ declare interface PollResult {
1533
+ pollId: string;
1534
+ votes: Record<string, number>;
1535
+ totalVotes: number;
1536
+ userVote?: string | string[];
1537
+ }
1538
+
1539
+ export declare function priorityPlugin(options?: PriorityPluginOptions): ChatPlugin;
1540
+
1541
+ declare interface PriorityPluginOptions {
1542
+ /** Default priority (default: 'medium') */
1543
+ defaultPriority?: ConversationPriority;
1544
+ /** Max labels per conversation (default: 5) */
1545
+ maxLabels?: number;
1546
+ /** Persist in localStorage */
1547
+ persist?: boolean;
1548
+ /** Storage key */
1549
+ storageKey?: string;
1550
+ /** Callback on priority change */
1551
+ onPriorityChange?: (priority: ConversationPriority) => void;
1552
+ /** Callback on label change */
1553
+ onLabelsChange?: (labels: string[]) => void;
1554
+ /** Webhook URL to notify on priority change */
1555
+ webhookUrl?: string;
1556
+ }
1557
+
1558
+ /**
1559
+ * Proactive Plugin — triggers bot messages based on user behavior.
1560
+ * Supports: idle, scroll depth, exit intent, page load, custom events.
1561
+ */
1562
+ export declare function proactivePlugin(options: {
1563
+ rules: ProactiveRule[];
1564
+ /** Called when a proactive message is triggered */
1565
+ onTrigger?: (rule: ProactiveRule) => void;
1566
+ }): ChatPlugin;
1567
+
1568
+ declare interface ProactiveRule {
1569
+ /** Trigger type */
1570
+ trigger: 'idle' | 'scroll' | 'exitIntent' | 'pageLoad' | 'custom';
1571
+ /** Message to show */
1572
+ message: string;
1573
+ /** Delay in ms before showing (default: 5000) */
1574
+ delay?: number;
1575
+ /** Max number of times to show (default: 1) */
1576
+ maxShows?: number;
1577
+ /** Jump to flow step when user clicks */
1578
+ flowStep?: string;
1579
+ }
1580
+
1129
1581
  /**
1130
1582
  * Push Plugin — sends browser push notifications for new messages
1131
1583
  */
@@ -1185,6 +1637,25 @@ export declare function rateLimitPlugin(options?: {
1185
1637
  warningMessage?: string;
1186
1638
  }): ChatPlugin;
1187
1639
 
1640
+ /**
1641
+ * Rating Plugin — shows a satisfaction survey at end of conversation.
1642
+ * Triggered on flow end or agent disconnect.
1643
+ */
1644
+ export declare function ratingPlugin(options?: {
1645
+ /** Rating scale (default: 5) */
1646
+ scale?: number;
1647
+ /** Prompt text shown to user */
1648
+ prompt?: string;
1649
+ /** Trigger events that show the rating (default: ['flowEnd']) */
1650
+ triggers?: ('flowEnd' | 'agentDisconnect' | 'custom')[];
1651
+ /** Called when user submits a rating */
1652
+ onRate?: (rating: number, feedback?: string) => void;
1653
+ /** Endpoint to POST rating data */
1654
+ endpoint?: string;
1655
+ /** Custom headers for the POST */
1656
+ headers?: Record<string, string>;
1657
+ }): ChatPlugin;
1658
+
1188
1659
  /**
1189
1660
  * Reminder Plugin — sends reminder messages to users after configured delays
1190
1661
  */
@@ -1199,6 +1670,13 @@ export declare function reminderPlugin(options?: {
1199
1670
 
1200
1671
  export declare const RemoveIcon: default_2.FC<IconProps>;
1201
1672
 
1673
+ /**
1674
+ * Lightweight markdown-to-JSX renderer. No external dependencies.
1675
+ * Supports: bold, italic, code (inline + block), links, lists,
1676
+ * strikethrough, headings, and line breaks.
1677
+ */
1678
+ export declare function renderMarkdown(text: string, options?: MarkdownOptions): default_2.ReactNode;
1679
+
1202
1680
  /** Resolved event names with defaults applied */
1203
1681
  export declare interface ResolvedLiveAgentEvents {
1204
1682
  agentMessage: string;
@@ -1225,6 +1703,13 @@ declare interface ScheduledMessage {
1225
1703
  interval?: number;
1226
1704
  }
1227
1705
 
1706
+ declare interface ScheduledMessage_2 {
1707
+ id: string;
1708
+ text: string;
1709
+ scheduledAt: number;
1710
+ sender?: 'bot' | 'user';
1711
+ }
1712
+
1228
1713
  /**
1229
1714
  * Scheduler Plugin — triggers bot messages at scheduled times or intervals
1230
1715
  */
@@ -1272,6 +1757,21 @@ export declare interface StepComponentProps {
1272
1757
  onComplete: (result?: FlowActionResult) => void;
1273
1758
  }
1274
1759
 
1760
+ export declare function summaryPlugin(options?: SummaryPluginOptions): ChatPlugin;
1761
+
1762
+ declare interface SummaryPluginOptions {
1763
+ /** AI endpoint for summarization (POST with { messages } body) */
1764
+ endpoint?: string;
1765
+ /** Request headers */
1766
+ headers?: Record<string, string>;
1767
+ /** Fallback: extract key points from messages locally (default: true) */
1768
+ localFallback?: boolean;
1769
+ /** Max messages to include in summary request (default: 50) */
1770
+ maxMessages?: number;
1771
+ /** Callback with generated summary */
1772
+ onSummary?: (summary: string) => void;
1773
+ }
1774
+
1275
1775
  /**
1276
1776
  * Sync Plugin — syncs chat data with a backend endpoint
1277
1777
  */
@@ -1282,6 +1782,21 @@ export declare function syncPlugin(options: {
1282
1782
  sessionKey?: string;
1283
1783
  }): ChatPlugin;
1284
1784
 
1785
+ /**
1786
+ * Tags Plugin — allows tagging conversations by topic for multi-flow bots.
1787
+ * Tags are stored in metadata and can be used for routing/analytics.
1788
+ */
1789
+ export declare function tagsPlugin(options?: {
1790
+ /** Predefined tags users can assign */
1791
+ availableTags?: string[];
1792
+ /** Storage key for persisting tags */
1793
+ storageKey?: string;
1794
+ /** Called when a tag is added */
1795
+ onTagAdded?: (tag: string, messageId?: string) => void;
1796
+ /** Called when a tag is removed */
1797
+ onTagRemoved?: (tag: string) => void;
1798
+ }): ChatPlugin;
1799
+
1285
1800
  export declare const TextField: default_2.FC<TextFieldProps>;
1286
1801
 
1287
1802
  declare interface TextFieldProps {
@@ -1310,6 +1825,43 @@ export declare function themePlugin(options?: {
1310
1825
  cssVariable?: string;
1311
1826
  }): ChatPlugin;
1312
1827
 
1828
+ export declare function themeTogglePlugin(options?: ThemeTogglePluginOptions): ChatPlugin;
1829
+
1830
+ declare interface ThemeTogglePluginOptions {
1831
+ /** Default mode (default: 'light') */
1832
+ defaultMode?: 'light' | 'dark';
1833
+ /** Persist preference in localStorage */
1834
+ persist?: boolean;
1835
+ /** Storage key */
1836
+ storageKey?: string;
1837
+ /** Callback on toggle */
1838
+ onToggle?: (mode: 'light' | 'dark') => void;
1839
+ }
1840
+
1841
+ declare interface TimeSlot {
1842
+ id: string;
1843
+ date: string;
1844
+ time: string;
1845
+ available: boolean;
1846
+ }
1847
+
1848
+ export declare function transcriptExportPlugin(options?: TranscriptExportPluginOptions): ChatPlugin;
1849
+
1850
+ declare interface TranscriptExportPluginOptions {
1851
+ /** Export format (default: 'text') */
1852
+ format?: TranscriptFormat;
1853
+ /** Filename prefix (default: 'chat-transcript') */
1854
+ filename?: string;
1855
+ /** Include timestamps (default: true) */
1856
+ includeTimestamps?: boolean;
1857
+ /** Callback with exported content */
1858
+ onExport?: (content: string, format: TranscriptFormat) => void;
1859
+ /** Custom header text in exported file */
1860
+ header?: string;
1861
+ }
1862
+
1863
+ declare type TranscriptFormat = 'text' | 'json' | 'csv' | 'html';
1864
+
1313
1865
  /**
1314
1866
  * Transfer Plugin — transfers chat to different departments/agents via API
1315
1867
  */
@@ -1322,6 +1874,27 @@ export declare function transferPlugin(options: {
1322
1874
  transferMessage?: string;
1323
1875
  }): ChatPlugin;
1324
1876
 
1877
+ export declare function translationPlugin(options: TranslationPluginOptions): ChatPlugin;
1878
+
1879
+ declare interface TranslationPluginOptions {
1880
+ /** Translation API endpoint (POST with { text, from, to } body) */
1881
+ endpoint: string;
1882
+ /** Request headers (e.g., API key) */
1883
+ headers?: Record<string, string>;
1884
+ /** Source language (default: 'auto') */
1885
+ sourceLang?: string;
1886
+ /** Target language (default: 'en') */
1887
+ targetLang?: string;
1888
+ /** Translate bot messages for user (default: true) */
1889
+ translateIncoming?: boolean;
1890
+ /** Translate user messages for bot/agent (default: false) */
1891
+ translateOutgoing?: boolean;
1892
+ /** Show original text alongside translation (default: false) */
1893
+ showOriginal?: boolean;
1894
+ /** Callback with translation result */
1895
+ onTranslate?: (original: string, translated: string, lang: string) => void;
1896
+ }
1897
+
1325
1898
  declare type Translations = Record<string, Record<string, string>>;
1326
1899
 
1327
1900
  declare type TriggerType = 'exitIntent' | 'idle' | 'scroll' | 'pageLoad' | 'custom';
@@ -1449,4 +2022,17 @@ export declare interface WelcomeScreenSlotProps {
1449
2022
  component?: ReactNode;
1450
2023
  }
1451
2024
 
2025
+ export declare function whisperPlugin(options?: WhisperPluginOptions): ChatPlugin;
2026
+
2027
+ declare interface WhisperPluginOptions {
2028
+ /** Role that can see whispers (default: 'agent') */
2029
+ visibleTo?: string;
2030
+ /** Current viewer role — set to 'agent' for agents, 'user' for end-users */
2031
+ viewerRole?: 'agent' | 'supervisor' | 'user';
2032
+ /** Callback when whisper is sent */
2033
+ onWhisper?: (message: ChatMessage) => void;
2034
+ /** Webhook to forward whispers to */
2035
+ webhookUrl?: string;
2036
+ }
2037
+
1452
2038
  export { }