@enjoys/react-chatbot-plugin 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -5
- package/dist/index.cjs +17 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +342 -7
- package/dist/index.mjs +17 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -12,14 +12,64 @@ export declare interface ActionContext {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Agent Plugin — enables live human agent takeover of the chat
|
|
16
|
+
*/
|
|
17
|
+
export declare function agentPlugin(options: {
|
|
18
|
+
socketUrl?: string;
|
|
19
|
+
onAgentConnect?: (ctx: PluginContext) => void;
|
|
20
|
+
onAgentDisconnect?: (ctx: PluginContext) => void;
|
|
21
|
+
onAgentMessage?: (text: string, ctx: PluginContext) => void;
|
|
22
|
+
connectMessage?: string;
|
|
23
|
+
disconnectMessage?: string;
|
|
24
|
+
}): ChatPlugin;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* AI Plugin — generates bot responses using external AI providers (OpenAI, Anthropic, custom)
|
|
28
|
+
*/
|
|
29
|
+
export declare function aiPlugin(options: {
|
|
30
|
+
provider?: 'openai' | 'anthropic' | 'custom';
|
|
31
|
+
endpoint?: string;
|
|
32
|
+
apiKey?: string;
|
|
33
|
+
model?: string;
|
|
34
|
+
systemPrompt?: string;
|
|
35
|
+
headers?: Record<string, string>;
|
|
36
|
+
shouldRespond?: (text: string) => boolean;
|
|
37
|
+
parseResponse?: (response: unknown) => string;
|
|
38
|
+
timeout?: number;
|
|
39
|
+
}): ChatPlugin;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Analytics Plugin — tracks sessions, messages, forms, timing, and step progression
|
|
16
43
|
*/
|
|
17
44
|
export declare function analyticsPlugin(options?: {
|
|
18
45
|
onTrack?: (event: string, data?: unknown) => void;
|
|
46
|
+
sessionId?: string;
|
|
19
47
|
}): ChatPlugin;
|
|
20
48
|
|
|
21
49
|
export declare const AttachmentIcon: default_2.FC<IconProps>;
|
|
22
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Auth Plugin — manages user authentication and identity
|
|
53
|
+
*/
|
|
54
|
+
export declare function authPlugin(options: {
|
|
55
|
+
type?: 'jwt' | 'session' | 'custom';
|
|
56
|
+
tokenKey?: string;
|
|
57
|
+
storage?: 'local' | 'session';
|
|
58
|
+
onAuth?: (token: string, ctx: PluginContext) => void;
|
|
59
|
+
onAuthExpired?: (ctx: PluginContext) => void;
|
|
60
|
+
validateToken?: (token: string) => boolean;
|
|
61
|
+
}): ChatPlugin;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Auto Reply Plugin — sends automated replies when user is inactive
|
|
65
|
+
*/
|
|
66
|
+
export declare function autoReplyPlugin(options?: {
|
|
67
|
+
timeout?: number;
|
|
68
|
+
message?: string;
|
|
69
|
+
maxReplies?: number;
|
|
70
|
+
onlyWhenOpen?: boolean;
|
|
71
|
+
}): ChatPlugin;
|
|
72
|
+
|
|
23
73
|
export declare const Branding: default_2.FC<BrandingProps>;
|
|
24
74
|
|
|
25
75
|
export declare interface BrandingConfig {
|
|
@@ -4376,6 +4426,22 @@ export declare function buildStyles(theme: Required<ChatTheme>, overrides?: Chat
|
|
|
4376
4426
|
};
|
|
4377
4427
|
};
|
|
4378
4428
|
|
|
4429
|
+
declare interface CampaignConfig {
|
|
4430
|
+
trigger: TriggerType;
|
|
4431
|
+
message: string;
|
|
4432
|
+
delay?: number;
|
|
4433
|
+
maxShows?: number;
|
|
4434
|
+
flowStep?: string;
|
|
4435
|
+
}
|
|
4436
|
+
|
|
4437
|
+
/**
|
|
4438
|
+
* Campaign Plugin — starts flows or shows messages based on user behavior triggers
|
|
4439
|
+
*/
|
|
4440
|
+
export declare function campaignPlugin(options: {
|
|
4441
|
+
campaigns: CampaignConfig[];
|
|
4442
|
+
onTrigger?: (campaign: CampaignConfig, ctx: PluginContext) => void;
|
|
4443
|
+
}): ChatPlugin;
|
|
4444
|
+
|
|
4379
4445
|
declare type ChatAction = {
|
|
4380
4446
|
type: 'TOGGLE_OPEN';
|
|
4381
4447
|
} | {
|
|
@@ -4630,6 +4696,54 @@ export declare interface CheckboxFieldRenderProps {
|
|
|
4630
4696
|
|
|
4631
4697
|
export declare const CloseIcon: default_2.FC<IconProps>;
|
|
4632
4698
|
|
|
4699
|
+
/**
|
|
4700
|
+
* Component Plugin — injects custom component messages into chat via events
|
|
4701
|
+
*/
|
|
4702
|
+
export declare function componentPlugin(options?: {
|
|
4703
|
+
components?: Record<string, string>;
|
|
4704
|
+
onRender?: (componentKey: string, ctx: PluginContext) => void;
|
|
4705
|
+
}): ChatPlugin;
|
|
4706
|
+
|
|
4707
|
+
/**
|
|
4708
|
+
* CRM Plugin — pushes user/lead data to CRM systems
|
|
4709
|
+
*/
|
|
4710
|
+
export declare function crmPlugin(options: {
|
|
4711
|
+
endpoint: string;
|
|
4712
|
+
provider?: string;
|
|
4713
|
+
headers?: Record<string, string>;
|
|
4714
|
+
mapFields?: (data: Record<string, unknown>) => Record<string, unknown>;
|
|
4715
|
+
events?: ('submit' | 'flowEnd' | 'login')[];
|
|
4716
|
+
}): ChatPlugin;
|
|
4717
|
+
|
|
4718
|
+
/**
|
|
4719
|
+
* Debug Plugin — exposes internal state and flow progression for debugging
|
|
4720
|
+
*/
|
|
4721
|
+
export declare function debugPlugin(options?: {
|
|
4722
|
+
logState?: boolean;
|
|
4723
|
+
logEvents?: boolean;
|
|
4724
|
+
logMessages?: boolean;
|
|
4725
|
+
groupName?: string;
|
|
4726
|
+
}): ChatPlugin;
|
|
4727
|
+
|
|
4728
|
+
/**
|
|
4729
|
+
* DevTools Plugin — provides a visual debugging panel overlay
|
|
4730
|
+
*/
|
|
4731
|
+
export declare function devtoolsPlugin(options?: {
|
|
4732
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
4733
|
+
shortcutKey?: string;
|
|
4734
|
+
onStateUpdate?: (state: DevToolsState) => void;
|
|
4735
|
+
}): ChatPlugin;
|
|
4736
|
+
|
|
4737
|
+
declare interface DevToolsState {
|
|
4738
|
+
messages: number;
|
|
4739
|
+
events: Array<{
|
|
4740
|
+
type: string;
|
|
4741
|
+
time: number;
|
|
4742
|
+
}>;
|
|
4743
|
+
data: Record<string, unknown>;
|
|
4744
|
+
currentStep: string | null;
|
|
4745
|
+
}
|
|
4746
|
+
|
|
4633
4747
|
export declare const DynamicForm: default_2.FC<DynamicFormProps>;
|
|
4634
4748
|
|
|
4635
4749
|
declare interface DynamicFormProps {
|
|
@@ -4639,6 +4753,17 @@ declare interface DynamicFormProps {
|
|
|
4639
4753
|
renderFormField?: FormFieldRenderMap;
|
|
4640
4754
|
}
|
|
4641
4755
|
|
|
4756
|
+
/**
|
|
4757
|
+
* Email Plugin — triggers emails via external API when chat events occur
|
|
4758
|
+
*/
|
|
4759
|
+
export declare function emailPlugin(options: {
|
|
4760
|
+
endpoint: string;
|
|
4761
|
+
template?: string;
|
|
4762
|
+
headers?: Record<string, string>;
|
|
4763
|
+
triggers?: ('submit' | 'flowEnd' | 'login')[];
|
|
4764
|
+
mapPayload?: (data: Record<string, unknown>) => Record<string, unknown>;
|
|
4765
|
+
}): ChatPlugin;
|
|
4766
|
+
|
|
4642
4767
|
export declare const EmojiIcon: default_2.FC<IconProps>;
|
|
4643
4768
|
|
|
4644
4769
|
export declare const EmojiPicker: default_2.FC<EmojiPickerProps>;
|
|
@@ -4749,8 +4874,6 @@ export declare class FlowEngine {
|
|
|
4749
4874
|
private steps;
|
|
4750
4875
|
private startStep;
|
|
4751
4876
|
private collectedData;
|
|
4752
|
-
private idCounter;
|
|
4753
|
-
private uid;
|
|
4754
4877
|
private stepHistory;
|
|
4755
4878
|
constructor(flow: FlowConfig);
|
|
4756
4879
|
getStartStepId(): string;
|
|
@@ -4881,6 +5004,16 @@ export declare interface HeaderConfig {
|
|
|
4881
5004
|
showRestart?: boolean;
|
|
4882
5005
|
}
|
|
4883
5006
|
|
|
5007
|
+
/**
|
|
5008
|
+
* i18n Plugin — supports multiple languages with dynamic switching
|
|
5009
|
+
*/
|
|
5010
|
+
export declare function i18nPlugin(options: {
|
|
5011
|
+
defaultLocale?: string;
|
|
5012
|
+
translations: Translations;
|
|
5013
|
+
storageKey?: string;
|
|
5014
|
+
onLocaleChange?: (locale: string, ctx: PluginContext) => void;
|
|
5015
|
+
}): ChatPlugin;
|
|
5016
|
+
|
|
4884
5017
|
declare interface IconProps {
|
|
4885
5018
|
size?: number;
|
|
4886
5019
|
color?: string;
|
|
@@ -4889,6 +5022,21 @@ declare interface IconProps {
|
|
|
4889
5022
|
|
|
4890
5023
|
export declare const ImageIcon: default_2.FC<IconProps>;
|
|
4891
5024
|
|
|
5025
|
+
/**
|
|
5026
|
+
* Intent Plugin — detects user intent from text and emits intent events for dynamic routing
|
|
5027
|
+
*/
|
|
5028
|
+
export declare function intentPlugin(options?: {
|
|
5029
|
+
rules?: IntentRule[];
|
|
5030
|
+
onIntentDetected?: (intent: string, text: string, ctx: PluginContext) => void;
|
|
5031
|
+
fallbackIntent?: string;
|
|
5032
|
+
}): ChatPlugin;
|
|
5033
|
+
|
|
5034
|
+
declare interface IntentRule {
|
|
5035
|
+
intent: string;
|
|
5036
|
+
patterns: string[];
|
|
5037
|
+
matchType?: 'contains' | 'exact' | 'regex';
|
|
5038
|
+
}
|
|
5039
|
+
|
|
4892
5040
|
/** Route configuration for keyword-based text matching */
|
|
4893
5041
|
export declare interface KeywordRoute {
|
|
4894
5042
|
/** Patterns to match against user text */
|
|
@@ -4917,6 +5065,26 @@ declare interface LauncherProps {
|
|
|
4917
5065
|
zIndex?: number;
|
|
4918
5066
|
}
|
|
4919
5067
|
|
|
5068
|
+
/**
|
|
5069
|
+
* Lead Plugin — captures and stores user information as leads
|
|
5070
|
+
*/
|
|
5071
|
+
export declare function leadPlugin(options: {
|
|
5072
|
+
fields?: string[];
|
|
5073
|
+
endpoint?: string;
|
|
5074
|
+
headers?: Record<string, string>;
|
|
5075
|
+
storageKey?: string;
|
|
5076
|
+
onLeadCaptured?: (lead: Record<string, unknown>, ctx: PluginContext) => void;
|
|
5077
|
+
}): ChatPlugin;
|
|
5078
|
+
|
|
5079
|
+
/**
|
|
5080
|
+
* Logger Plugin — logs all chatbot events for debugging or auditing
|
|
5081
|
+
*/
|
|
5082
|
+
export declare function loggerPlugin(options?: {
|
|
5083
|
+
level?: LogLevel;
|
|
5084
|
+
prefix?: string;
|
|
5085
|
+
logger?: Pick<Console, 'debug' | 'info' | 'warn' | 'error'>;
|
|
5086
|
+
}): ChatPlugin;
|
|
5087
|
+
|
|
4920
5088
|
export declare const LoginScreen: default_2.FC<LoginScreenProps>;
|
|
4921
5089
|
|
|
4922
5090
|
declare interface LoginScreenProps {
|
|
@@ -4926,6 +5094,29 @@ declare interface LoginScreenProps {
|
|
|
4926
5094
|
renderFormField?: FormFieldRenderMap;
|
|
4927
5095
|
}
|
|
4928
5096
|
|
|
5097
|
+
declare type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
5098
|
+
|
|
5099
|
+
/**
|
|
5100
|
+
* Markdown Plugin — transforms markdown syntax in bot messages to HTML
|
|
5101
|
+
* Lightweight built-in renderer, no external dependencies.
|
|
5102
|
+
*/
|
|
5103
|
+
export declare function markdownPlugin(options?: {
|
|
5104
|
+
enableBold?: boolean;
|
|
5105
|
+
enableItalic?: boolean;
|
|
5106
|
+
enableCode?: boolean;
|
|
5107
|
+
enableLinks?: boolean;
|
|
5108
|
+
enableLists?: boolean;
|
|
5109
|
+
enableLineBreaks?: boolean;
|
|
5110
|
+
}): ChatPlugin;
|
|
5111
|
+
|
|
5112
|
+
/**
|
|
5113
|
+
* Media Plugin — adds support for rich media messages (images, videos, cards)
|
|
5114
|
+
*/
|
|
5115
|
+
export declare function mediaPlugin(options?: {
|
|
5116
|
+
allowedTypes?: ('image' | 'video' | 'audio' | 'card')[];
|
|
5117
|
+
onMediaRender?: (type: string, url: string) => void;
|
|
5118
|
+
}): ChatPlugin;
|
|
5119
|
+
|
|
4929
5120
|
export declare interface MessageAttachment {
|
|
4930
5121
|
name: string;
|
|
4931
5122
|
url: string;
|
|
@@ -4967,11 +5158,13 @@ export declare type MessageSender = 'bot' | 'user' | 'system';
|
|
|
4967
5158
|
export declare const MinimizeIcon: default_2.FC<IconProps>;
|
|
4968
5159
|
|
|
4969
5160
|
/**
|
|
4970
|
-
* Persistence Plugin — saves/restores chat history via
|
|
5161
|
+
* Persistence Plugin — saves/restores full chat history via browser storage
|
|
4971
5162
|
*/
|
|
4972
5163
|
export declare function persistencePlugin(options?: {
|
|
4973
5164
|
storageKey?: string;
|
|
4974
5165
|
storage?: 'local' | 'session';
|
|
5166
|
+
maxMessages?: number;
|
|
5167
|
+
ttl?: number;
|
|
4975
5168
|
}): ChatPlugin;
|
|
4976
5169
|
|
|
4977
5170
|
export declare interface PluginContext {
|
|
@@ -5001,15 +5194,28 @@ export declare class PluginManager {
|
|
|
5001
5194
|
private eventHandlers;
|
|
5002
5195
|
register(plugins: ChatPlugin[]): void;
|
|
5003
5196
|
setContext(ctx: Omit<PluginContext, 'on' | 'emit'>): void;
|
|
5197
|
+
getContext(): PluginContext | null;
|
|
5004
5198
|
private on;
|
|
5005
5199
|
private emit;
|
|
5006
5200
|
init(): Promise<void>;
|
|
5007
5201
|
onMessage(message: ChatMessage): Promise<ChatMessage>;
|
|
5008
5202
|
onSubmit(data: Record<string, unknown>): Promise<void>;
|
|
5203
|
+
/** Emit a lifecycle event to all plugins (open, close, flowEnd, stepChange, quickReply, etc.) */
|
|
5204
|
+
emitEvent(type: string, payload?: unknown): void;
|
|
5009
5205
|
destroy(): Promise<void>;
|
|
5010
5206
|
private dispatchEvent;
|
|
5011
5207
|
}
|
|
5012
5208
|
|
|
5209
|
+
/**
|
|
5210
|
+
* Push Plugin — sends browser push notifications for new messages
|
|
5211
|
+
*/
|
|
5212
|
+
export declare function pushPlugin(options?: {
|
|
5213
|
+
title?: string;
|
|
5214
|
+
icon?: string;
|
|
5215
|
+
onlyWhenHidden?: boolean;
|
|
5216
|
+
requestPermission?: boolean;
|
|
5217
|
+
}): ChatPlugin;
|
|
5218
|
+
|
|
5013
5219
|
export declare const QuickReplies: default_2.FC<QuickRepliesProps>;
|
|
5014
5220
|
|
|
5015
5221
|
declare interface QuickRepliesProps {
|
|
@@ -5036,12 +5242,49 @@ export declare interface RadioFieldRenderProps {
|
|
|
5036
5242
|
error?: string;
|
|
5037
5243
|
}
|
|
5038
5244
|
|
|
5245
|
+
/**
|
|
5246
|
+
* Rate Limit Plugin — prevents spam by limiting message frequency
|
|
5247
|
+
*/
|
|
5248
|
+
export declare function rateLimitPlugin(options?: {
|
|
5249
|
+
limit?: number;
|
|
5250
|
+
window?: number;
|
|
5251
|
+
onLimited?: (remaining: number) => void;
|
|
5252
|
+
warningMessage?: string;
|
|
5253
|
+
}): ChatPlugin;
|
|
5254
|
+
|
|
5255
|
+
/**
|
|
5256
|
+
* Reminder Plugin — sends reminder messages to users after configured delays
|
|
5257
|
+
*/
|
|
5258
|
+
export declare function reminderPlugin(options?: {
|
|
5259
|
+
reminders?: Array<{
|
|
5260
|
+
message: string;
|
|
5261
|
+
delay: number;
|
|
5262
|
+
condition?: string;
|
|
5263
|
+
}>;
|
|
5264
|
+
onReminder?: (message: string) => void;
|
|
5265
|
+
}): ChatPlugin;
|
|
5266
|
+
|
|
5039
5267
|
export declare const RemoveIcon: default_2.FC<IconProps>;
|
|
5040
5268
|
|
|
5041
5269
|
export declare function resolveTheme(theme?: ChatTheme): Required<ChatTheme>;
|
|
5042
5270
|
|
|
5043
5271
|
export declare const RestartIcon: default_2.FC<IconProps>;
|
|
5044
5272
|
|
|
5273
|
+
declare interface ScheduledMessage {
|
|
5274
|
+
message: string;
|
|
5275
|
+
delay: number;
|
|
5276
|
+
repeat?: boolean;
|
|
5277
|
+
interval?: number;
|
|
5278
|
+
}
|
|
5279
|
+
|
|
5280
|
+
/**
|
|
5281
|
+
* Scheduler Plugin — triggers bot messages at scheduled times or intervals
|
|
5282
|
+
*/
|
|
5283
|
+
export declare function schedulerPlugin(options: {
|
|
5284
|
+
messages?: ScheduledMessage[];
|
|
5285
|
+
onScheduledMessage?: (message: string) => void;
|
|
5286
|
+
}): ChatPlugin;
|
|
5287
|
+
|
|
5045
5288
|
export declare const SelectField: default_2.FC<SelectFieldProps>;
|
|
5046
5289
|
|
|
5047
5290
|
declare interface SelectFieldProps {
|
|
@@ -5062,6 +5305,15 @@ export declare interface SelectFieldRenderProps {
|
|
|
5062
5305
|
|
|
5063
5306
|
export declare const SendIcon: default_2.FC<IconProps>;
|
|
5064
5307
|
|
|
5308
|
+
/**
|
|
5309
|
+
* Sound Plugin — plays sound on new bot messages
|
|
5310
|
+
*/
|
|
5311
|
+
export declare function soundPlugin(options?: {
|
|
5312
|
+
src?: string;
|
|
5313
|
+
volume?: number;
|
|
5314
|
+
onlyWhenHidden?: boolean;
|
|
5315
|
+
}): ChatPlugin;
|
|
5316
|
+
|
|
5065
5317
|
/** Props passed to custom components rendered in flow steps */
|
|
5066
5318
|
export declare interface StepComponentProps {
|
|
5067
5319
|
/** The step ID that owns this component */
|
|
@@ -5072,6 +5324,16 @@ export declare interface StepComponentProps {
|
|
|
5072
5324
|
onComplete: (result?: FlowActionResult) => void;
|
|
5073
5325
|
}
|
|
5074
5326
|
|
|
5327
|
+
/**
|
|
5328
|
+
* Sync Plugin — syncs chat data with a backend endpoint
|
|
5329
|
+
*/
|
|
5330
|
+
export declare function syncPlugin(options: {
|
|
5331
|
+
endpoint: string;
|
|
5332
|
+
headers?: Record<string, string>;
|
|
5333
|
+
syncInterval?: number;
|
|
5334
|
+
sessionKey?: string;
|
|
5335
|
+
}): ChatPlugin;
|
|
5336
|
+
|
|
5075
5337
|
export declare const TextField: default_2.FC<TextFieldProps>;
|
|
5076
5338
|
|
|
5077
5339
|
declare interface TextFieldProps {
|
|
@@ -5090,17 +5352,74 @@ export declare interface TextFieldRenderProps {
|
|
|
5090
5352
|
error?: string;
|
|
5091
5353
|
}
|
|
5092
5354
|
|
|
5355
|
+
/**
|
|
5356
|
+
* Theme Plugin — switches themes dynamically and persists preference
|
|
5357
|
+
*/
|
|
5358
|
+
export declare function themePlugin(options?: {
|
|
5359
|
+
defaultMode?: 'light' | 'dark';
|
|
5360
|
+
storageKey?: string;
|
|
5361
|
+
onThemeChange?: (mode: string, ctx: PluginContext) => void;
|
|
5362
|
+
cssVariable?: string;
|
|
5363
|
+
}): ChatPlugin;
|
|
5364
|
+
|
|
5365
|
+
/**
|
|
5366
|
+
* Transfer Plugin — transfers chat to different departments/agents via API
|
|
5367
|
+
*/
|
|
5368
|
+
export declare function transferPlugin(options: {
|
|
5369
|
+
endpoint: string;
|
|
5370
|
+
headers?: Record<string, string>;
|
|
5371
|
+
departments?: string[];
|
|
5372
|
+
onTransfer?: (department: string, ctx: PluginContext) => void;
|
|
5373
|
+
onTransferComplete?: (result: unknown, ctx: PluginContext) => void;
|
|
5374
|
+
transferMessage?: string;
|
|
5375
|
+
}): ChatPlugin;
|
|
5376
|
+
|
|
5377
|
+
declare type Translations = Record<string, Record<string, string>>;
|
|
5378
|
+
|
|
5379
|
+
declare type TriggerType = 'exitIntent' | 'idle' | 'scroll' | 'pageLoad' | 'custom';
|
|
5380
|
+
|
|
5093
5381
|
export declare const TypingIndicator: default_2.FC<TypingIndicatorProps>;
|
|
5094
5382
|
|
|
5095
5383
|
declare interface TypingIndicatorProps {
|
|
5096
5384
|
color: string;
|
|
5097
5385
|
}
|
|
5098
5386
|
|
|
5387
|
+
/**
|
|
5388
|
+
* Typing Plugin — adds configurable typing delay before bot messages are shown
|
|
5389
|
+
*/
|
|
5390
|
+
export declare function typingPlugin(options?: {
|
|
5391
|
+
delay?: number;
|
|
5392
|
+
onTypingStart?: () => void;
|
|
5393
|
+
onTypingEnd?: () => void;
|
|
5394
|
+
}): ChatPlugin;
|
|
5395
|
+
|
|
5396
|
+
/**
|
|
5397
|
+
* Upload Plugin — handles file uploads to external storage (S3, etc.)
|
|
5398
|
+
*/
|
|
5399
|
+
export declare function uploadPlugin(options: {
|
|
5400
|
+
endpoint: string;
|
|
5401
|
+
storage?: 's3' | 'gcs' | 'azure' | 'custom';
|
|
5402
|
+
headers?: Record<string, string>;
|
|
5403
|
+
maxSize?: number;
|
|
5404
|
+
allowedTypes?: string[];
|
|
5405
|
+
onUploadStart?: (file: {
|
|
5406
|
+
name: string;
|
|
5407
|
+
size: number;
|
|
5408
|
+
}) => void;
|
|
5409
|
+
onUploadComplete?: (file: {
|
|
5410
|
+
name: string;
|
|
5411
|
+
url: string;
|
|
5412
|
+
}) => void;
|
|
5413
|
+
onUploadError?: (file: {
|
|
5414
|
+
name: string;
|
|
5415
|
+
}, error: Error) => void;
|
|
5416
|
+
}): ChatPlugin;
|
|
5417
|
+
|
|
5099
5418
|
export declare function useChat(): {
|
|
5100
5419
|
state: ChatState;
|
|
5101
5420
|
sendMessage: (text: string) => Promise<void>;
|
|
5102
5421
|
addBotMessage: (text: string, extras?: Partial<ChatMessage>) => Promise<void>;
|
|
5103
|
-
handleQuickReply: (value: string, label: string) => void
|
|
5422
|
+
handleQuickReply: (value: string, label: string) => Promise<void>;
|
|
5104
5423
|
handleFormSubmit: (formId: string, data: Record<string, unknown>) => Promise<void>;
|
|
5105
5424
|
handleLogin: (data: Record<string, unknown>) => Promise<void>;
|
|
5106
5425
|
toggleChat: () => void;
|
|
@@ -5115,12 +5434,28 @@ export declare function useChat(): {
|
|
|
5115
5434
|
export declare function useChatContext(): ChatContextValue;
|
|
5116
5435
|
|
|
5117
5436
|
/**
|
|
5118
|
-
*
|
|
5437
|
+
* Validation Plugin — adds advanced validation rules for user inputs
|
|
5438
|
+
*/
|
|
5439
|
+
export declare function validationPlugin(options?: {
|
|
5440
|
+
validators?: Record<string, Validator>;
|
|
5441
|
+
sanitize?: boolean;
|
|
5442
|
+
blockProfanity?: boolean;
|
|
5443
|
+
profanityList?: string[];
|
|
5444
|
+
onValidationFail?: (text: string, error: string) => void;
|
|
5445
|
+
}): ChatPlugin;
|
|
5446
|
+
|
|
5447
|
+
declare type Validator = (text: string) => string | null;
|
|
5448
|
+
|
|
5449
|
+
declare type WebhookEventType = 'message' | 'submit' | 'init' | 'destroy' | 'open' | 'close' | 'flowEnd' | 'stepChange' | 'quickReply' | 'login';
|
|
5450
|
+
|
|
5451
|
+
/**
|
|
5452
|
+
* Webhook Plugin — sends messages/submissions/lifecycle events to an external endpoint
|
|
5119
5453
|
*/
|
|
5120
5454
|
export declare function webhookPlugin(options: {
|
|
5121
5455
|
url: string;
|
|
5122
5456
|
headers?: Record<string, string>;
|
|
5123
|
-
events?:
|
|
5457
|
+
events?: WebhookEventType[];
|
|
5458
|
+
timeout?: number;
|
|
5124
5459
|
}): ChatPlugin;
|
|
5125
5460
|
|
|
5126
5461
|
export declare const WelcomeScreen: default_2.FC<WelcomeScreenProps>;
|