@enjoys/react-chatbot-plugin 1.9.0 → 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,22 @@ 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;
190
267
  /** Enable built-in markdown rendering in messages (bold, italic, code, links, lists).
191
268
  * Pass `true` for all features, or an options object to selectively enable. */
192
269
  markdown?: boolean | MarkdownOptions;
@@ -212,6 +289,10 @@ export declare interface ChatBotProps {
212
289
  icons?: Partial<ChatIconMap>;
213
290
  /** Live agent configuration — WebSocket or Socket.IO real-time chat with human agents */
214
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;
215
296
  }
216
297
 
217
298
  export declare const ChatBubbleIcon: default_2.FC<IconProps>;
@@ -229,6 +310,10 @@ export declare interface ChatCallbacks {
229
310
  onFlowEnd?: (collectedData: Record<string, unknown>) => void;
230
311
  onError?: (error: Error) => void;
231
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;
232
317
  /** Called when user types text the bot couldn't handle */
233
318
  onUnhandledMessage?: (text: string, context: {
234
319
  currentStepId: string | null;
@@ -288,6 +373,7 @@ declare interface ChatHeaderProps {
288
373
  onRestart?: () => void;
289
374
  logo?: string;
290
375
  logoWidth?: string;
376
+ onSearchChange?: (query: string) => void;
291
377
  }
292
378
 
293
379
  /** Map of all replaceable icons. Each value is a `ReactNode` so users can
@@ -303,6 +389,11 @@ export declare interface ChatIconMap {
303
389
  image: ReactNode;
304
390
  remove: ReactNode;
305
391
  restart: ReactNode;
392
+ search: ReactNode;
393
+ mic: ReactNode;
394
+ star: ReactNode;
395
+ edit: ReactNode;
396
+ trash: ReactNode;
306
397
  }
307
398
 
308
399
  export declare const ChatInput: default_2.FC<ChatInputProps>;
@@ -333,6 +424,12 @@ export declare interface ChatMessage {
333
424
  component?: string;
334
425
  /** Agent name for live agent messages */
335
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;
336
433
  }
337
434
 
338
435
  export declare interface ChatPlugin {
@@ -451,6 +548,19 @@ export declare interface CheckboxFieldRenderProps {
451
548
 
452
549
  export declare const CloseIcon: default_2.FC<IconProps>;
453
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
+
454
564
  /**
455
565
  * Component Plugin — injects custom component messages into chat via events
456
566
  */
@@ -459,6 +569,56 @@ export declare function componentPlugin(options?: {
459
569
  onRender?: (componentKey: string, ctx: PluginContext) => void;
460
570
  }): ChatPlugin;
461
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
+
462
622
  /**
463
623
  * CRM Plugin — pushes user/lead data to CRM systems
464
624
  */
@@ -533,6 +693,21 @@ declare interface EmojiPickerProps {
533
693
  primaryColor: string;
534
694
  }
535
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
+
536
711
  /** Props passed to file custom field renderers */
537
712
  export declare interface FileFieldRenderProps {
538
713
  type: 'file';
@@ -649,6 +824,10 @@ export declare class FlowEngine {
649
824
  /** Reset the engine to initial state */
650
825
  reset(): void;
651
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;
652
831
  /** Returns true if the step expects a quick reply (not free text) */
653
832
  stepExpectsQuickReply(step: FlowStep): boolean;
654
833
  /** Returns true if the step expects a form submission */
@@ -659,6 +838,9 @@ export declare class FlowEngine {
659
838
  private evaluate;
660
839
  }
661
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
+
662
844
  export declare interface FlowQuickReply {
663
845
  label: string;
664
846
  value: string;
@@ -682,6 +864,12 @@ export declare interface FlowStep {
682
864
  input?: FlowStepInput;
683
865
  /** Async action to run when this step is entered (API calls, verification, etc.) */
684
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;
685
873
  }
686
874
 
687
875
  /** Configuration for a free-text input step with optional validation */
@@ -741,7 +929,7 @@ export declare type FormFieldRenderMap = Partial<{
741
929
  /** Union of all field render props — discriminated by `type` */
742
930
  export declare type FormFieldRenderProps = TextFieldRenderProps | SelectFieldRenderProps | RadioFieldRenderProps | CheckboxFieldRenderProps | FileFieldRenderProps;
743
931
 
744
- 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';
745
933
 
746
934
  export declare interface FormFieldValidation {
747
935
  required?: boolean;
@@ -777,6 +965,36 @@ export declare interface HeaderSlotProps {
777
965
  component?: ReactNode;
778
966
  }
779
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
+
780
998
  /**
781
999
  * i18n Plugin — supports multiple languages with dynamic switching
782
1000
  */
@@ -825,6 +1043,14 @@ declare interface IntentRule {
825
1043
  matchType?: 'contains' | 'exact' | 'regex';
826
1044
  }
827
1045
 
1046
+ declare interface KBArticle {
1047
+ id: string;
1048
+ title: string;
1049
+ content: string;
1050
+ tags?: string[];
1051
+ url?: string;
1052
+ }
1053
+
828
1054
  /** Route configuration for keyword-based text matching */
829
1055
  export declare interface KeywordRoute {
830
1056
  /** Patterns to match against user text */
@@ -841,6 +1067,25 @@ export declare interface KeywordRoute {
841
1067
  priority?: number;
842
1068
  }
843
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
+
844
1089
  export declare const Launcher: default_2.FC<LauncherProps>;
845
1090
 
846
1091
  declare interface LauncherProps {
@@ -976,6 +1221,21 @@ export declare interface LiveAgentEvents {
976
1221
  */
977
1222
  export declare function liveAgentPlugin(config: LiveAgentConfig): ChatPlugin;
978
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
+
979
1239
  /**
980
1240
  * Logger Plugin — logs all chatbot events for debugging or auditing
981
1241
  */
@@ -1091,12 +1351,95 @@ declare interface MessageListProps {
1091
1351
  renderFormField?: FormFieldRenderMap;
1092
1352
  /** Slot overrides from customizeChat */
1093
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;
1094
1377
  }
1095
1378
 
1096
1379
  export declare type MessageSender = 'bot' | 'user' | 'system' | 'agent';
1097
1380
 
1381
+ declare type MessageStatus = 'sent' | 'delivered' | 'read';
1382
+
1098
1383
  export declare const MinimizeIcon: default_2.FC<IconProps>;
1099
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
+
1100
1443
  /**
1101
1444
  * Persistence Plugin — saves/restores full chat history via browser storage
1102
1445
  */
@@ -1107,6 +1450,35 @@ export declare function persistencePlugin(options?: {
1107
1450
  ttl?: number;
1108
1451
  }): ChatPlugin;
1109
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
+
1110
1482
  export declare interface PluginContext {
1111
1483
  /** Send a message programmatically */
1112
1484
  sendMessage: (text: string) => void;
@@ -1146,6 +1518,66 @@ export declare class PluginManager {
1146
1518
  private dispatchEvent;
1147
1519
  }
1148
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
+
1149
1581
  /**
1150
1582
  * Push Plugin — sends browser push notifications for new messages
1151
1583
  */
@@ -1205,6 +1637,25 @@ export declare function rateLimitPlugin(options?: {
1205
1637
  warningMessage?: string;
1206
1638
  }): ChatPlugin;
1207
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
+
1208
1659
  /**
1209
1660
  * Reminder Plugin — sends reminder messages to users after configured delays
1210
1661
  */
@@ -1252,6 +1703,13 @@ declare interface ScheduledMessage {
1252
1703
  interval?: number;
1253
1704
  }
1254
1705
 
1706
+ declare interface ScheduledMessage_2 {
1707
+ id: string;
1708
+ text: string;
1709
+ scheduledAt: number;
1710
+ sender?: 'bot' | 'user';
1711
+ }
1712
+
1255
1713
  /**
1256
1714
  * Scheduler Plugin — triggers bot messages at scheduled times or intervals
1257
1715
  */
@@ -1299,6 +1757,21 @@ export declare interface StepComponentProps {
1299
1757
  onComplete: (result?: FlowActionResult) => void;
1300
1758
  }
1301
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
+
1302
1775
  /**
1303
1776
  * Sync Plugin — syncs chat data with a backend endpoint
1304
1777
  */
@@ -1309,6 +1782,21 @@ export declare function syncPlugin(options: {
1309
1782
  sessionKey?: string;
1310
1783
  }): ChatPlugin;
1311
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
+
1312
1800
  export declare const TextField: default_2.FC<TextFieldProps>;
1313
1801
 
1314
1802
  declare interface TextFieldProps {
@@ -1337,6 +1825,43 @@ export declare function themePlugin(options?: {
1337
1825
  cssVariable?: string;
1338
1826
  }): ChatPlugin;
1339
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
+
1340
1865
  /**
1341
1866
  * Transfer Plugin — transfers chat to different departments/agents via API
1342
1867
  */
@@ -1349,6 +1874,27 @@ export declare function transferPlugin(options: {
1349
1874
  transferMessage?: string;
1350
1875
  }): ChatPlugin;
1351
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
+
1352
1898
  declare type Translations = Record<string, Record<string, string>>;
1353
1899
 
1354
1900
  declare type TriggerType = 'exitIntent' | 'idle' | 'scroll' | 'pageLoad' | 'custom';
@@ -1476,4 +2022,17 @@ export declare interface WelcomeScreenSlotProps {
1476
2022
  component?: ReactNode;
1477
2023
  }
1478
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
+
1479
2038
  export { }