@chatwidgetai/chat-widget 0.3.1 → 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 +1890 -1018
- package/dist/ai-chat-widget.umd.js.map +1 -1
- package/dist/api/client.d.ts +21 -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 +5 -1
- package/dist/components/ChatWindow.d.ts.map +1 -1
- package/dist/components/DataPolicyView.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/action-lifecycle.d.ts.map +1 -1
- package/dist/hooks/useChat/index.d.ts +7 -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.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +1891 -1019
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1891 -1018
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +12 -85
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -2,31 +2,25 @@
|
|
|
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';
|
|
9
|
+
export type WelcomeBubbleFrequency = 'always' | 'session' | 'weekly' | 'monthly';
|
|
10
|
+
export type TriggerType = 'button' | 'pill-text' | 'input-bar';
|
|
7
11
|
export interface WidgetAppearance {
|
|
8
12
|
primaryColor: string;
|
|
9
13
|
position: WidgetPosition;
|
|
10
14
|
size: WidgetSize;
|
|
11
15
|
logo?: string;
|
|
16
|
+
triggerType?: TriggerType;
|
|
17
|
+
triggerText?: string;
|
|
12
18
|
headerTitle: string;
|
|
13
19
|
welcomeTitle?: string;
|
|
14
20
|
welcomeMessage: string;
|
|
15
21
|
placeholder: string;
|
|
16
22
|
welcomeBubbleText?: string;
|
|
17
|
-
|
|
18
|
-
export interface FollowUpSuggestion {
|
|
19
|
-
id: string;
|
|
20
|
-
text: string;
|
|
21
|
-
type: 'question' | 'action';
|
|
22
|
-
actionId?: string;
|
|
23
|
-
actionInput?: Record<string, unknown>;
|
|
24
|
-
}
|
|
25
|
-
export interface ActionPreset {
|
|
26
|
-
actionId: string;
|
|
27
|
-
displayText: string;
|
|
28
|
-
prefilledInput?: Record<string, unknown>;
|
|
29
|
-
enabled: boolean;
|
|
23
|
+
welcomeBubbleFrequency?: WelcomeBubbleFrequency;
|
|
30
24
|
}
|
|
31
25
|
export interface WidgetSettings {
|
|
32
26
|
autoOpen: boolean;
|
|
@@ -44,7 +38,6 @@ export interface WidgetSettings {
|
|
|
44
38
|
actionId?: string;
|
|
45
39
|
})[];
|
|
46
40
|
enableFollowUpSuggestions?: boolean;
|
|
47
|
-
actionPresets?: ActionPreset[];
|
|
48
41
|
showDataPolicy?: boolean;
|
|
49
42
|
}
|
|
50
43
|
export interface WidgetBehavior {
|
|
@@ -63,75 +56,6 @@ export interface FileAttachment {
|
|
|
63
56
|
size: number;
|
|
64
57
|
extension: string;
|
|
65
58
|
}
|
|
66
|
-
export type KbDocument = {
|
|
67
|
-
kbId: string;
|
|
68
|
-
score?: number;
|
|
69
|
-
doc: {
|
|
70
|
-
pageContent: string;
|
|
71
|
-
id: string;
|
|
72
|
-
metadata: Record<string, unknown>;
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
export type JsonValue = string | number | boolean | null | {
|
|
76
|
-
[key: string]: JsonValue;
|
|
77
|
-
} | JsonValue[];
|
|
78
|
-
export type MessageRole = "system" | "user" | "assistant" | "tool" | "developer";
|
|
79
|
-
export type MessageContent = string | null | undefined;
|
|
80
|
-
export interface BaseMessage {
|
|
81
|
-
role: MessageRole;
|
|
82
|
-
content?: MessageContent;
|
|
83
|
-
name?: string;
|
|
84
|
-
}
|
|
85
|
-
export interface ToolCallFunction {
|
|
86
|
-
name: string;
|
|
87
|
-
arguments: string;
|
|
88
|
-
}
|
|
89
|
-
export interface ToolCall {
|
|
90
|
-
id?: string;
|
|
91
|
-
type?: "function";
|
|
92
|
-
function: ToolCallFunction;
|
|
93
|
-
}
|
|
94
|
-
export interface SystemMessage extends BaseMessage {
|
|
95
|
-
role: "system";
|
|
96
|
-
content: string;
|
|
97
|
-
}
|
|
98
|
-
export interface UserMessage extends BaseMessage {
|
|
99
|
-
role: "user";
|
|
100
|
-
content: string;
|
|
101
|
-
}
|
|
102
|
-
export interface DeveloperMessage extends BaseMessage {
|
|
103
|
-
role: "developer";
|
|
104
|
-
content: string;
|
|
105
|
-
}
|
|
106
|
-
export interface AssistantMessage extends BaseMessage {
|
|
107
|
-
role: "assistant";
|
|
108
|
-
tool_calls?: ToolCall[];
|
|
109
|
-
}
|
|
110
|
-
export interface ToolMessage extends BaseMessage {
|
|
111
|
-
role: "tool";
|
|
112
|
-
tool_call_id: string;
|
|
113
|
-
}
|
|
114
|
-
export type AnyMessage = SystemMessage | UserMessage | DeveloperMessage | AssistantMessage | ToolMessage;
|
|
115
|
-
export interface ConversationMessage {
|
|
116
|
-
id: string;
|
|
117
|
-
message: AnyMessage;
|
|
118
|
-
timestamp: string;
|
|
119
|
-
sources: KbDocument[];
|
|
120
|
-
feedback?: "positive" | "negative";
|
|
121
|
-
isError?: boolean;
|
|
122
|
-
isStreaming?: boolean;
|
|
123
|
-
toolExecuting?: string;
|
|
124
|
-
toolCallToActionId?: Record<string, string>;
|
|
125
|
-
action?: {
|
|
126
|
-
implementation: string;
|
|
127
|
-
toolCallId: string;
|
|
128
|
-
actionId: string;
|
|
129
|
-
input: Record<string, JsonValue>;
|
|
130
|
-
state: Record<string, JsonValue>;
|
|
131
|
-
done?: boolean;
|
|
132
|
-
};
|
|
133
|
-
suggestions?: FollowUpSuggestion[];
|
|
134
|
-
}
|
|
135
59
|
export type StreamEvent = {
|
|
136
60
|
type: "content";
|
|
137
61
|
content: string;
|
|
@@ -146,7 +70,6 @@ export type StreamEvent = {
|
|
|
146
70
|
tool_name: string;
|
|
147
71
|
tool_call_id: string;
|
|
148
72
|
timestamp: string;
|
|
149
|
-
state?: Record<string, JsonValue>;
|
|
150
73
|
input?: Record<string, JsonValue>;
|
|
151
74
|
action_id?: string;
|
|
152
75
|
implementation?: string;
|
|
@@ -171,7 +94,6 @@ export type StreamEvent = {
|
|
|
171
94
|
action_id: string;
|
|
172
95
|
implementation: string;
|
|
173
96
|
input: Record<string, JsonValue>;
|
|
174
|
-
state: Record<string, JsonValue>;
|
|
175
97
|
done: boolean;
|
|
176
98
|
messages: AnyMessage[];
|
|
177
99
|
tool_call_to_action_id: Record<string, string>;
|
|
@@ -203,7 +125,10 @@ export interface WidgetProps {
|
|
|
203
125
|
welcomeMessage?: string;
|
|
204
126
|
placeholder?: string;
|
|
205
127
|
welcomeBubbleText?: string;
|
|
128
|
+
triggerType?: TriggerType;
|
|
129
|
+
triggerText?: string;
|
|
206
130
|
theme?: 'light' | 'dark';
|
|
131
|
+
triggerTheme?: 'light' | 'dark' | 'auto';
|
|
207
132
|
suggestedQuestions?: (string | {
|
|
208
133
|
text: string;
|
|
209
134
|
actionId?: string;
|
|
@@ -213,6 +138,8 @@ export interface WidgetProps {
|
|
|
213
138
|
defaultOpen?: boolean;
|
|
214
139
|
zIndex?: number;
|
|
215
140
|
containerMode?: boolean;
|
|
141
|
+
mobileMode?: boolean;
|
|
142
|
+
desktopMode?: boolean;
|
|
216
143
|
onOpen?: () => void;
|
|
217
144
|
onClose?: () => void;
|
|
218
145
|
onMessage?: (message: ConversationMessage) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;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