@chatwidgetai/chat-widget 0.3.6 → 0.3.9
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/ai-chat-widget.umd.js +1716 -1446
- package/dist/ai-chat-widget.umd.js.map +1 -1
- package/dist/api/client.d.ts +12 -2
- package/dist/api/client.d.ts.map +1 -1
- package/dist/components/ChatWidget/hooks/useWidgetAppearance.d.ts +37 -0
- package/dist/components/ChatWidget/hooks/useWidgetAppearance.d.ts.map +1 -0
- package/dist/components/ChatWidget/icons.d.ts +2 -0
- package/dist/components/ChatWidget/icons.d.ts.map +1 -0
- package/dist/components/ChatWidget/parts/WidgetTriggers.d.ts +25 -0
- package/dist/components/ChatWidget/parts/WidgetTriggers.d.ts.map +1 -0
- package/dist/components/ChatWidget.d.ts.map +1 -1
- package/dist/components/ChatWindow.d.ts +6 -6
- package/dist/components/ChatWindow.d.ts.map +1 -1
- package/dist/components/WelcomeBubble.d.ts +12 -0
- package/dist/components/WelcomeBubble.d.ts.map +1 -0
- package/dist/components/icons.d.ts +21 -0
- package/dist/components/icons.d.ts.map +1 -0
- package/dist/components/triggers/ButtonTrigger.d.ts +11 -0
- package/dist/components/triggers/ButtonTrigger.d.ts.map +1 -0
- package/dist/components/triggers/InputBarTrigger.d.ts +18 -0
- package/dist/components/triggers/InputBarTrigger.d.ts.map +1 -0
- package/dist/components/triggers/PillTrigger.d.ts +12 -0
- package/dist/components/triggers/PillTrigger.d.ts.map +1 -0
- package/dist/components/triggers/index.d.ts +8 -0
- package/dist/components/triggers/index.d.ts.map +1 -0
- package/dist/hooks/useChat/action-handler.d.ts +17 -1
- package/dist/hooks/useChat/action-handler.d.ts.map +1 -1
- package/dist/hooks/useChat/index.d.ts +6 -1
- package/dist/hooks/useChat/index.d.ts.map +1 -1
- package/dist/hooks/useChat/message-hydration.d.ts.map +1 -1
- package/dist/hooks/useChat/stream-buffer.d.ts +18 -0
- package/dist/hooks/useChat/stream-buffer.d.ts.map +1 -0
- package/dist/hooks/useChat/stream-handlers.d.ts +3 -3
- package/dist/hooks/useChat/stream-handlers.d.ts.map +1 -1
- package/dist/hooks/useChat/stream-state.d.ts.map +1 -1
- package/dist/hooks/useChat/types.d.ts +3 -0
- package/dist/hooks/useChat/types.d.ts.map +1 -1
- package/dist/index.esm.js +1716 -1446
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1716 -1446
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +7 -100
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* Widget Types
|
|
3
3
|
* Simplified appearance configuration
|
|
4
4
|
*/
|
|
5
|
+
import type { JsonValue, MessageRole, BaseMessage, ToolCallFunction, ToolCall, SystemMessage, UserMessage, DeveloperMessage, AssistantMessage, ToolMessage, AnyMessage, KbDocument, FollowUpSuggestion, ConversationMessage } from '@chatwidgetai/chat-components';
|
|
6
|
+
export type { JsonValue, MessageRole, BaseMessage, ToolCallFunction, ToolCall, SystemMessage, UserMessage, DeveloperMessage, AssistantMessage, ToolMessage, AnyMessage, KbDocument, FollowUpSuggestion, ConversationMessage, };
|
|
5
7
|
export type WidgetPosition = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
6
8
|
export type WidgetSize = 'small' | 'medium' | 'large';
|
|
7
9
|
export type WelcomeBubbleFrequency = 'always' | 'session' | 'weekly' | 'monthly';
|
|
@@ -20,19 +22,6 @@ export interface WidgetAppearance {
|
|
|
20
22
|
welcomeBubbleText?: string;
|
|
21
23
|
welcomeBubbleFrequency?: WelcomeBubbleFrequency;
|
|
22
24
|
}
|
|
23
|
-
export interface FollowUpSuggestion {
|
|
24
|
-
id: string;
|
|
25
|
-
text: string;
|
|
26
|
-
type: 'question' | 'action';
|
|
27
|
-
actionId?: string;
|
|
28
|
-
actionInput?: Record<string, unknown>;
|
|
29
|
-
}
|
|
30
|
-
export interface ActionPreset {
|
|
31
|
-
actionId: string;
|
|
32
|
-
displayText: string;
|
|
33
|
-
prefilledInput?: Record<string, unknown>;
|
|
34
|
-
enabled: boolean;
|
|
35
|
-
}
|
|
36
25
|
export interface WidgetSettings {
|
|
37
26
|
autoOpen: boolean;
|
|
38
27
|
autoOpenDelay?: number;
|
|
@@ -44,12 +33,8 @@ export interface WidgetSettings {
|
|
|
44
33
|
enableFileUpload: boolean;
|
|
45
34
|
enableFeedback: boolean;
|
|
46
35
|
maxMessagesPerSession?: number;
|
|
47
|
-
suggestedQuestions?:
|
|
48
|
-
text: string;
|
|
49
|
-
actionId?: string;
|
|
50
|
-
})[];
|
|
36
|
+
suggestedQuestions?: string[];
|
|
51
37
|
enableFollowUpSuggestions?: boolean;
|
|
52
|
-
actionPresets?: ActionPreset[];
|
|
53
38
|
showDataPolicy?: boolean;
|
|
54
39
|
}
|
|
55
40
|
export interface WidgetBehavior {
|
|
@@ -68,78 +53,6 @@ export interface FileAttachment {
|
|
|
68
53
|
size: number;
|
|
69
54
|
extension: string;
|
|
70
55
|
}
|
|
71
|
-
export type KbDocument = {
|
|
72
|
-
kbId: string;
|
|
73
|
-
score?: number;
|
|
74
|
-
doc: {
|
|
75
|
-
pageContent: string;
|
|
76
|
-
id: string;
|
|
77
|
-
metadata: Record<string, unknown>;
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
export type JsonValue = string | number | boolean | null | {
|
|
81
|
-
[key: string]: JsonValue;
|
|
82
|
-
} | JsonValue[];
|
|
83
|
-
export type MessageRole = "system" | "user" | "assistant" | "tool" | "developer";
|
|
84
|
-
export type MessageContent = string | null | undefined;
|
|
85
|
-
export interface BaseMessage {
|
|
86
|
-
role: MessageRole;
|
|
87
|
-
content?: MessageContent;
|
|
88
|
-
name?: string;
|
|
89
|
-
}
|
|
90
|
-
export interface ToolCallFunction {
|
|
91
|
-
name: string;
|
|
92
|
-
arguments: string;
|
|
93
|
-
}
|
|
94
|
-
export interface ToolCall {
|
|
95
|
-
id?: string;
|
|
96
|
-
type?: "function";
|
|
97
|
-
function: ToolCallFunction;
|
|
98
|
-
}
|
|
99
|
-
export interface SystemMessage extends BaseMessage {
|
|
100
|
-
role: "system";
|
|
101
|
-
content: string;
|
|
102
|
-
}
|
|
103
|
-
export interface UserMessage extends BaseMessage {
|
|
104
|
-
role: "user";
|
|
105
|
-
content: string;
|
|
106
|
-
}
|
|
107
|
-
export interface DeveloperMessage extends BaseMessage {
|
|
108
|
-
role: "developer";
|
|
109
|
-
content: string;
|
|
110
|
-
}
|
|
111
|
-
export interface AssistantMessage extends BaseMessage {
|
|
112
|
-
role: "assistant";
|
|
113
|
-
tool_calls?: ToolCall[];
|
|
114
|
-
}
|
|
115
|
-
export interface ToolMessage extends BaseMessage {
|
|
116
|
-
role: "tool";
|
|
117
|
-
tool_call_id: string;
|
|
118
|
-
}
|
|
119
|
-
export type AnyMessage = SystemMessage | UserMessage | DeveloperMessage | AssistantMessage | ToolMessage;
|
|
120
|
-
export interface ConversationMessage {
|
|
121
|
-
id: string;
|
|
122
|
-
message: AnyMessage;
|
|
123
|
-
timestamp: string;
|
|
124
|
-
sources: KbDocument[];
|
|
125
|
-
feedback?: "positive" | "negative";
|
|
126
|
-
isError?: boolean;
|
|
127
|
-
isStreaming?: boolean;
|
|
128
|
-
toolExecuting?: string;
|
|
129
|
-
toolCallToActionId?: Record<string, string>;
|
|
130
|
-
action?: {
|
|
131
|
-
implementation: string;
|
|
132
|
-
toolCallId: string;
|
|
133
|
-
actionId: string;
|
|
134
|
-
input: Record<string, JsonValue>;
|
|
135
|
-
state: Record<string, JsonValue>;
|
|
136
|
-
done?: boolean;
|
|
137
|
-
hidden?: boolean;
|
|
138
|
-
dismissedAt?: string;
|
|
139
|
-
dismissedBy?: "user";
|
|
140
|
-
};
|
|
141
|
-
suggestions?: FollowUpSuggestion[];
|
|
142
|
-
}
|
|
143
56
|
export type StreamEvent = {
|
|
144
57
|
type: "content";
|
|
145
58
|
content: string;
|
|
@@ -154,7 +67,6 @@ export type StreamEvent = {
|
|
|
154
67
|
tool_name: string;
|
|
155
68
|
tool_call_id: string;
|
|
156
69
|
timestamp: string;
|
|
157
|
-
state?: Record<string, JsonValue>;
|
|
158
70
|
input?: Record<string, JsonValue>;
|
|
159
71
|
action_id?: string;
|
|
160
72
|
implementation?: string;
|
|
@@ -179,7 +91,6 @@ export type StreamEvent = {
|
|
|
179
91
|
action_id: string;
|
|
180
92
|
implementation: string;
|
|
181
93
|
input: Record<string, JsonValue>;
|
|
182
|
-
state: Record<string, JsonValue>;
|
|
183
94
|
done: boolean;
|
|
184
95
|
messages: AnyMessage[];
|
|
185
96
|
tool_call_to_action_id: Record<string, string>;
|
|
@@ -203,10 +114,6 @@ export interface WidgetProps {
|
|
|
203
114
|
mode?: WidgetMode;
|
|
204
115
|
previewMode?: boolean;
|
|
205
116
|
previewConfig?: Partial<WidgetConfig>;
|
|
206
|
-
demoMode?: boolean;
|
|
207
|
-
demoInput?: string;
|
|
208
|
-
demoOutput?: string;
|
|
209
|
-
onDemoComplete?: () => void;
|
|
210
117
|
position?: WidgetPosition;
|
|
211
118
|
primaryColor?: string;
|
|
212
119
|
size?: WidgetSize;
|
|
@@ -218,15 +125,15 @@ export interface WidgetProps {
|
|
|
218
125
|
triggerType?: TriggerType;
|
|
219
126
|
triggerText?: string;
|
|
220
127
|
theme?: 'light' | 'dark';
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
actionId?: string;
|
|
224
|
-
})[];
|
|
128
|
+
triggerTheme?: 'light' | 'dark' | 'auto';
|
|
129
|
+
suggestedQuestions?: string[];
|
|
225
130
|
customStyles?: Record<string, string>;
|
|
226
131
|
currentRoute?: string;
|
|
227
132
|
defaultOpen?: boolean;
|
|
228
133
|
zIndex?: number;
|
|
229
134
|
containerMode?: boolean;
|
|
135
|
+
mobileMode?: boolean;
|
|
136
|
+
desktopMode?: boolean;
|
|
230
137
|
onOpen?: () => void;
|
|
231
138
|
onClose?: () => void;
|
|
232
139
|
onMessage?: (message: ConversationMessage) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,+BAA+B,CAAC;AAGvC,YAAY,EACV,SAAS,EACT,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,mBAAmB,GACpB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAC;AACvF,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AACtD,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AACjF,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,CAAC;AAG/D,MAAM,WAAW,gBAAgB;IAE/B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,cAAc,CAAC;IACzB,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC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