@chatwidgetai/chat-widget 0.3.6 → 0.3.8
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 +1562 -1380
- 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 +4 -1
- 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 +5 -0
- 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 +2 -0
- package/dist/hooks/useChat/types.d.ts.map +1 -1
- package/dist/index.esm.js +1562 -1380
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1562 -1380
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +5 -92
- 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;
|
|
@@ -49,7 +38,6 @@ export interface WidgetSettings {
|
|
|
49
38
|
actionId?: string;
|
|
50
39
|
})[];
|
|
51
40
|
enableFollowUpSuggestions?: boolean;
|
|
52
|
-
actionPresets?: ActionPreset[];
|
|
53
41
|
showDataPolicy?: boolean;
|
|
54
42
|
}
|
|
55
43
|
export interface WidgetBehavior {
|
|
@@ -68,78 +56,6 @@ export interface FileAttachment {
|
|
|
68
56
|
size: number;
|
|
69
57
|
extension: string;
|
|
70
58
|
}
|
|
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
59
|
export type StreamEvent = {
|
|
144
60
|
type: "content";
|
|
145
61
|
content: string;
|
|
@@ -154,7 +70,6 @@ export type StreamEvent = {
|
|
|
154
70
|
tool_name: string;
|
|
155
71
|
tool_call_id: string;
|
|
156
72
|
timestamp: string;
|
|
157
|
-
state?: Record<string, JsonValue>;
|
|
158
73
|
input?: Record<string, JsonValue>;
|
|
159
74
|
action_id?: string;
|
|
160
75
|
implementation?: string;
|
|
@@ -179,7 +94,6 @@ export type StreamEvent = {
|
|
|
179
94
|
action_id: string;
|
|
180
95
|
implementation: string;
|
|
181
96
|
input: Record<string, JsonValue>;
|
|
182
|
-
state: Record<string, JsonValue>;
|
|
183
97
|
done: boolean;
|
|
184
98
|
messages: AnyMessage[];
|
|
185
99
|
tool_call_to_action_id: Record<string, string>;
|
|
@@ -203,10 +117,6 @@ export interface WidgetProps {
|
|
|
203
117
|
mode?: WidgetMode;
|
|
204
118
|
previewMode?: boolean;
|
|
205
119
|
previewConfig?: Partial<WidgetConfig>;
|
|
206
|
-
demoMode?: boolean;
|
|
207
|
-
demoInput?: string;
|
|
208
|
-
demoOutput?: string;
|
|
209
|
-
onDemoComplete?: () => void;
|
|
210
120
|
position?: WidgetPosition;
|
|
211
121
|
primaryColor?: string;
|
|
212
122
|
size?: WidgetSize;
|
|
@@ -218,6 +128,7 @@ export interface WidgetProps {
|
|
|
218
128
|
triggerType?: TriggerType;
|
|
219
129
|
triggerText?: string;
|
|
220
130
|
theme?: 'light' | 'dark';
|
|
131
|
+
triggerTheme?: 'light' | 'dark' | 'auto';
|
|
221
132
|
suggestedQuestions?: (string | {
|
|
222
133
|
text: string;
|
|
223
134
|
actionId?: string;
|
|
@@ -227,6 +138,8 @@ export interface WidgetProps {
|
|
|
227
138
|
defaultOpen?: boolean;
|
|
228
139
|
zIndex?: number;
|
|
229
140
|
containerMode?: boolean;
|
|
141
|
+
mobileMode?: boolean;
|
|
142
|
+
desktopMode?: boolean;
|
|
230
143
|
onOpen?: () => void;
|
|
231
144
|
onClose?: () => void;
|
|
232
145
|
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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