@elia-assistant/chatui 1.0.11 → 1.0.13
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 +1 -10
- package/dist/chat-store.js +10 -0
- package/dist/chatui.css +2 -2
- package/dist/chatui.iife.css +2 -2
- package/dist/chatui.iife.js +27 -27
- package/dist/chunks/i18n-BUYd0BSF.js +2 -0
- package/dist/chunks/{i18n-B0xhVAye.js → i18n-DyWy7n71.js} +4 -4
- package/dist/chunks/settingsStore-BRK5844w.js +130 -0
- package/dist/chunks/{translation-CsXAAc6O.js → translation-B7absJaI.js} +9 -5
- package/dist/chunks/{translation-D0S7F5mA.js → translation-D2b_upNC.js} +9 -5
- package/dist/components/InputArea.d.ts +2 -1
- package/dist/hooks/useChat.d.ts +2 -1
- package/dist/hooks/useCta.d.ts +1 -1
- package/dist/hooks/useTheme.d.ts +4 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1145 -996
- package/dist/lib/n8nClient.d.ts +2 -2
- package/dist/store/chatStore.d.ts +5 -0
- package/dist/store.js +1 -1
- package/dist/types/index.d.ts +12 -23
- package/package.json +6 -4
- package/dist/chunks/i18n-23dPrR-0.js +0 -2
- package/dist/chunks/settingsStore-CpRkCJCy.js +0 -254
package/dist/lib/n8nClient.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChatConfig } from '../types/index.ts';
|
|
1
|
+
import type { ChatConfig, Attachment } from '../types/index.ts';
|
|
2
2
|
export declare class N8nApiError extends Error {
|
|
3
3
|
readonly status?: number;
|
|
4
4
|
/**
|
|
@@ -26,4 +26,4 @@ export declare class N8nApiError extends Error {
|
|
|
26
26
|
* @param onChunk Called with each streaming chunk (enables streaming mode)
|
|
27
27
|
* @returns Full bot response text
|
|
28
28
|
*/
|
|
29
|
-
export declare function sendMessage(config: ChatConfig, sessionId: string, text: string, language?: string, onChunk?: (chunk: string) => void): Promise<string>;
|
|
29
|
+
export declare function sendMessage(config: ChatConfig, sessionId: string, text: string, language?: string, attachments?: Attachment[], onChunk?: (chunk: string) => void): Promise<string>;
|
|
@@ -5,6 +5,10 @@ interface ChatState {
|
|
|
5
5
|
messages: Record<string, Message[]>;
|
|
6
6
|
isStreaming: boolean;
|
|
7
7
|
awaitingAgentReply: Record<string, boolean>;
|
|
8
|
+
tokens: Record<string, {
|
|
9
|
+
token: string;
|
|
10
|
+
expiresAt: number;
|
|
11
|
+
}>;
|
|
8
12
|
createSession(): string;
|
|
9
13
|
setActiveSession(id: string): void;
|
|
10
14
|
addMessage(sessionId: string, msg: Message): void;
|
|
@@ -12,6 +16,7 @@ interface ChatState {
|
|
|
12
16
|
removeLastBotIfEmpty(sessionId: string): void;
|
|
13
17
|
setStreaming(val: boolean): void;
|
|
14
18
|
setAwaitingAgentReply(sessionId: string, val: boolean): void;
|
|
19
|
+
setToken(sessionId: string, token: string, expiresAt: number): void;
|
|
15
20
|
updateMessageStatus(sessionId: string, messageId: string, status: NonNullable<Message['status']>): void;
|
|
16
21
|
deleteSession(id: string): void;
|
|
17
22
|
renameSession(id: string, title: string): void;
|
package/dist/store.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "./chunks/settingsStore-
|
|
1
|
+
import { t as e } from "./chunks/settingsStore-BRK5844w.js";
|
|
2
2
|
export { e as useSettingsStore };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -58,13 +58,14 @@ export interface ChatConfig {
|
|
|
58
58
|
/** Global fallback initial messages — per-language overrides live in i18n[lang].initialMessages */
|
|
59
59
|
initialMessages?: string[];
|
|
60
60
|
allowFileUploads?: boolean;
|
|
61
|
-
|
|
61
|
+
allowedFileExtensions?: string;
|
|
62
62
|
/** Per-language content: initial messages, CTA text, bot name, welcome subtitle */
|
|
63
63
|
i18n?: Record<string, LangOverride>;
|
|
64
64
|
streaming?: boolean;
|
|
65
65
|
botName?: string;
|
|
66
66
|
theme?: string;
|
|
67
|
-
|
|
67
|
+
/** Override individual CSS variables on the widget root, e.g. { '--t-avatar-bg': '#ff0000' } */
|
|
68
|
+
cssVars?: Record<string, string>;
|
|
68
69
|
mode?: 'window' | 'fullscreen' | 'mixed';
|
|
69
70
|
showCta?: boolean;
|
|
70
71
|
ctaText?: string;
|
|
@@ -76,12 +77,6 @@ export interface ChatConfig {
|
|
|
76
77
|
botAvatar?: string;
|
|
77
78
|
/** Popup toggle button icon (window mode). Built-in id, URL, or data URL. */
|
|
78
79
|
toggleButtonIcon?: string;
|
|
79
|
-
/** Link text shown after the localized "Powered by" prefix. Default: 'ELIA AI Assistant'. */
|
|
80
|
-
poweredByLabel?: string;
|
|
81
|
-
/** Link target URL. Default: 'https://www.elia-asistent.com'. */
|
|
82
|
-
poweredByUrl?: string;
|
|
83
|
-
/** Hide the entire "Powered by" footer line. */
|
|
84
|
-
poweredByHide?: boolean;
|
|
85
80
|
/** In fullscreen layout, present the chat as a bottom sheet (rounded top, drag handle, dimmed
|
|
86
81
|
* backdrop above) instead of fully covering the viewport. Applies to mode 'fullscreen' and to
|
|
87
82
|
* 'mixed' on mobile. Default: false. */
|
|
@@ -114,11 +109,18 @@ export interface ChatConfig {
|
|
|
114
109
|
};
|
|
115
110
|
};
|
|
116
111
|
}
|
|
112
|
+
export interface Attachment {
|
|
113
|
+
name: string;
|
|
114
|
+
url: string;
|
|
115
|
+
size?: number;
|
|
116
|
+
mimeType?: string;
|
|
117
|
+
}
|
|
117
118
|
export interface Message {
|
|
118
119
|
id: string;
|
|
119
120
|
role: 'user' | 'bot';
|
|
120
121
|
content: string;
|
|
121
122
|
ts: number;
|
|
123
|
+
attachments?: Attachment[];
|
|
122
124
|
/**
|
|
123
125
|
* Delivery status for user messages. <c>undefined</c> on persisted history (treated as
|
|
124
126
|
* <c>'sent'</c>) and on every bot message — bots don't have a sender-side delivery state.
|
|
@@ -133,19 +135,6 @@ export interface Session {
|
|
|
133
135
|
export interface ThemeDef {
|
|
134
136
|
id: string;
|
|
135
137
|
label: string;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
export interface ThemeVars {
|
|
140
|
-
bgBase: string;
|
|
141
|
-
bgSurface: string;
|
|
142
|
-
bgSurface2: string;
|
|
143
|
-
bgBorder: string;
|
|
144
|
-
accent: string;
|
|
145
|
-
accentFg: string;
|
|
146
|
-
fgPrimary: string;
|
|
147
|
-
fgSecondary: string;
|
|
148
|
-
fgMuted: string;
|
|
149
|
-
userBubble: string;
|
|
150
|
-
userBubbleFg: string;
|
|
138
|
+
baseColor: string;
|
|
139
|
+
accentColor: string;
|
|
151
140
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elia-assistant/chatui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"react-dom": "^19.0.0"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
+
"@tailwindcss/postcss": "^4.3.0",
|
|
54
55
|
"i18next": "^25.0.0",
|
|
55
56
|
"i18next-resources-to-backend": "^1.2.0",
|
|
56
57
|
"react-i18next": "^16.0.0",
|
|
@@ -60,16 +61,17 @@
|
|
|
60
61
|
},
|
|
61
62
|
"devDependencies": {
|
|
62
63
|
"@rollup/plugin-commonjs": "^29.0.2",
|
|
63
|
-
"@tailwindcss/vite": "^4.
|
|
64
|
+
"@tailwindcss/vite": "^4.3.0",
|
|
64
65
|
"@types/node": "^25.6.0",
|
|
65
66
|
"@types/react": "^19.0.0",
|
|
66
67
|
"@types/react-dom": "^19.0.0",
|
|
67
68
|
"@vitejs/plugin-react": "^6.0.0",
|
|
69
|
+
"postcss-prefix-selector": "^2.1.1",
|
|
68
70
|
"react": "^19.0.0",
|
|
69
71
|
"react-dom": "^19.0.0",
|
|
70
|
-
"tailwindcss": "^4.
|
|
72
|
+
"tailwindcss": "^4.3.0",
|
|
71
73
|
"typescript": "~5.9.0",
|
|
72
74
|
"vite": "^8.0.0",
|
|
73
75
|
"vite-plugin-dts": "^4.5.4"
|
|
74
76
|
}
|
|
75
|
-
}
|
|
77
|
+
}
|
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
import { n as e, t } from "./middleware-DgE1WAsA.js";
|
|
2
|
-
//#region src/themes.ts
|
|
3
|
-
var n = [
|
|
4
|
-
{
|
|
5
|
-
id: "midnight",
|
|
6
|
-
label: "Midnight",
|
|
7
|
-
scheme: "dark",
|
|
8
|
-
vars: {
|
|
9
|
-
bgBase: "#0f1117",
|
|
10
|
-
bgSurface: "#1a1d27",
|
|
11
|
-
bgSurface2: "#22263a",
|
|
12
|
-
bgBorder: "#2d3142",
|
|
13
|
-
accent: "#6366f1",
|
|
14
|
-
accentFg: "#ffffff",
|
|
15
|
-
fgPrimary: "#ffffff",
|
|
16
|
-
fgSecondary: "#94a3b8",
|
|
17
|
-
fgMuted: "#64748b",
|
|
18
|
-
userBubble: "#6366f1",
|
|
19
|
-
userBubbleFg: "#ffffff"
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: "ivory",
|
|
24
|
-
label: "Ivory",
|
|
25
|
-
scheme: "light",
|
|
26
|
-
vars: {
|
|
27
|
-
bgBase: "#ffffff",
|
|
28
|
-
bgSurface: "#f1f5f9",
|
|
29
|
-
bgSurface2: "#e2e8f0",
|
|
30
|
-
bgBorder: "#cbd5e1",
|
|
31
|
-
accent: "#4338ca",
|
|
32
|
-
accentFg: "#ffffff",
|
|
33
|
-
fgPrimary: "#0f172a",
|
|
34
|
-
fgSecondary: "#334155",
|
|
35
|
-
fgMuted: "#64748b",
|
|
36
|
-
userBubble: "#4338ca",
|
|
37
|
-
userBubbleFg: "#ffffff"
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
id: "sunrise",
|
|
42
|
-
label: "Sunrise",
|
|
43
|
-
scheme: "light",
|
|
44
|
-
vars: {
|
|
45
|
-
bgBase: "#ffffff",
|
|
46
|
-
bgSurface: "#fff7ed",
|
|
47
|
-
bgSurface2: "#ffedd5",
|
|
48
|
-
bgBorder: "#fed7aa",
|
|
49
|
-
accent: "#f97316",
|
|
50
|
-
accentFg: "#ffffff",
|
|
51
|
-
fgPrimary: "#1c0a00",
|
|
52
|
-
fgSecondary: "#431407",
|
|
53
|
-
fgMuted: "#9a3412",
|
|
54
|
-
userBubble: "#f97316",
|
|
55
|
-
userBubbleFg: "#ffffff"
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
id: "cosmos",
|
|
60
|
-
label: "Cosmos",
|
|
61
|
-
scheme: "dark",
|
|
62
|
-
vars: {
|
|
63
|
-
bgBase: "#0d0a1a",
|
|
64
|
-
bgSurface: "#15102b",
|
|
65
|
-
bgSurface2: "#1e1840",
|
|
66
|
-
bgBorder: "#2e2555",
|
|
67
|
-
accent: "#a855f7",
|
|
68
|
-
accentFg: "#ffffff",
|
|
69
|
-
fgPrimary: "#f3e8ff",
|
|
70
|
-
fgSecondary: "#c4b5fd",
|
|
71
|
-
fgMuted: "#7c3aed",
|
|
72
|
-
userBubble: "#a855f7",
|
|
73
|
-
userBubbleFg: "#ffffff"
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
id: "forest",
|
|
78
|
-
label: "Forest",
|
|
79
|
-
scheme: "dark",
|
|
80
|
-
vars: {
|
|
81
|
-
bgBase: "#0a1410",
|
|
82
|
-
bgSurface: "#111f18",
|
|
83
|
-
bgSurface2: "#162b1f",
|
|
84
|
-
bgBorder: "#1e3a2a",
|
|
85
|
-
accent: "#22c55e",
|
|
86
|
-
accentFg: "#ffffff",
|
|
87
|
-
fgPrimary: "#dcfce7",
|
|
88
|
-
fgSecondary: "#86efac",
|
|
89
|
-
fgMuted: "#4ade80",
|
|
90
|
-
userBubble: "#16a34a",
|
|
91
|
-
userBubbleFg: "#ffffff"
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
id: "ocean",
|
|
96
|
-
label: "Ocean",
|
|
97
|
-
scheme: "dark",
|
|
98
|
-
vars: {
|
|
99
|
-
bgBase: "#060f1a",
|
|
100
|
-
bgSurface: "#0c1b2e",
|
|
101
|
-
bgSurface2: "#112440",
|
|
102
|
-
bgBorder: "#163354",
|
|
103
|
-
accent: "#06b6d4",
|
|
104
|
-
accentFg: "#ffffff",
|
|
105
|
-
fgPrimary: "#e0f7fa",
|
|
106
|
-
fgSecondary: "#67e8f9",
|
|
107
|
-
fgMuted: "#0891b2",
|
|
108
|
-
userBubble: "#0891b2",
|
|
109
|
-
userBubbleFg: "#ffffff"
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
id: "cherry",
|
|
114
|
-
label: "Cherry",
|
|
115
|
-
scheme: "light",
|
|
116
|
-
vars: {
|
|
117
|
-
bgBase: "#ffffff",
|
|
118
|
-
bgSurface: "#fff1f2",
|
|
119
|
-
bgSurface2: "#ffe4e6",
|
|
120
|
-
bgBorder: "#fecdd3",
|
|
121
|
-
accent: "#e11d48",
|
|
122
|
-
accentFg: "#ffffff",
|
|
123
|
-
fgPrimary: "#1a0005",
|
|
124
|
-
fgSecondary: "#4c0519",
|
|
125
|
-
fgMuted: "#9f1239",
|
|
126
|
-
userBubble: "#e11d48",
|
|
127
|
-
userBubbleFg: "#ffffff"
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
id: "navy",
|
|
132
|
-
label: "Navy",
|
|
133
|
-
scheme: "dark",
|
|
134
|
-
vars: {
|
|
135
|
-
bgBase: "#080f1e",
|
|
136
|
-
bgSurface: "#0f1a33",
|
|
137
|
-
bgSurface2: "#162348",
|
|
138
|
-
bgBorder: "#1e3060",
|
|
139
|
-
accent: "#3b82f6",
|
|
140
|
-
accentFg: "#ffffff",
|
|
141
|
-
fgPrimary: "#dbeafe",
|
|
142
|
-
fgSecondary: "#93c5fd",
|
|
143
|
-
fgMuted: "#60a5fa",
|
|
144
|
-
userBubble: "#2563eb",
|
|
145
|
-
userBubbleFg: "#ffffff"
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
id: "lavender",
|
|
150
|
-
label: "Lavender",
|
|
151
|
-
scheme: "light",
|
|
152
|
-
vars: {
|
|
153
|
-
bgBase: "#faf5ff",
|
|
154
|
-
bgSurface: "#f3e8ff",
|
|
155
|
-
bgSurface2: "#e9d5ff",
|
|
156
|
-
bgBorder: "#d8b4fe",
|
|
157
|
-
accent: "#8b5cf6",
|
|
158
|
-
accentFg: "#ffffff",
|
|
159
|
-
fgPrimary: "#2e1065",
|
|
160
|
-
fgSecondary: "#4c1d95",
|
|
161
|
-
fgMuted: "#7c3aed",
|
|
162
|
-
userBubble: "#7c3aed",
|
|
163
|
-
userBubbleFg: "#ffffff"
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
id: "amber",
|
|
168
|
-
label: "Amber",
|
|
169
|
-
scheme: "dark",
|
|
170
|
-
vars: {
|
|
171
|
-
bgBase: "#0f0a00",
|
|
172
|
-
bgSurface: "#1c1400",
|
|
173
|
-
bgSurface2: "#2a1d00",
|
|
174
|
-
bgBorder: "#3d2c00",
|
|
175
|
-
accent: "#f59e0b",
|
|
176
|
-
accentFg: "#000000",
|
|
177
|
-
fgPrimary: "#fef3c7",
|
|
178
|
-
fgSecondary: "#fcd34d",
|
|
179
|
-
fgMuted: "#d97706",
|
|
180
|
-
userBubble: "#d97706",
|
|
181
|
-
userBubbleFg: "#000000"
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
], r = "midnight";
|
|
185
|
-
function i(e) {
|
|
186
|
-
return n.find((t) => t.id === e) ?? n[0];
|
|
187
|
-
}
|
|
188
|
-
//#endregion
|
|
189
|
-
//#region src/store/settingsStore.ts
|
|
190
|
-
var a = {
|
|
191
|
-
webhookUrl: "",
|
|
192
|
-
chatInputKey: "chatInput",
|
|
193
|
-
chatSessionKey: "sessionId",
|
|
194
|
-
mode: "fullscreen",
|
|
195
|
-
showSidebar: !1,
|
|
196
|
-
showWelcomeScreen: !0,
|
|
197
|
-
streaming: !1,
|
|
198
|
-
botName: "Assistant",
|
|
199
|
-
showCta: !0,
|
|
200
|
-
ctaText: "Hi! How can I help you today?",
|
|
201
|
-
ctaDelay: 5e3,
|
|
202
|
-
ctaSound: !0,
|
|
203
|
-
hideSettings: !0,
|
|
204
|
-
poweredByLabel: "ELIA AI Assistant",
|
|
205
|
-
poweredByUrl: "https://www.elia-asistent.com",
|
|
206
|
-
poweredByHide: !1,
|
|
207
|
-
fullscreenSheet: !1,
|
|
208
|
-
fullscreenSheetHeight: "75vh",
|
|
209
|
-
i18n: {
|
|
210
|
-
en: {
|
|
211
|
-
initialMessages: [],
|
|
212
|
-
ctaText: "Hi! How can I help you today?"
|
|
213
|
-
},
|
|
214
|
-
sk: {
|
|
215
|
-
initialMessages: [],
|
|
216
|
-
ctaText: "Dobrý deň! Ako vám môžem pomôcť?"
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}, o = e()(t((e) => ({
|
|
220
|
-
config: a,
|
|
221
|
-
activeTheme: r,
|
|
222
|
-
language: "en",
|
|
223
|
-
setConfig(t) {
|
|
224
|
-
e((e) => ({ config: {
|
|
225
|
-
...e.config,
|
|
226
|
-
...t
|
|
227
|
-
} }));
|
|
228
|
-
},
|
|
229
|
-
setTheme(t) {
|
|
230
|
-
e({ activeTheme: t });
|
|
231
|
-
},
|
|
232
|
-
setLanguage(t) {
|
|
233
|
-
e({ language: t }), import("./i18n-23dPrR-0.js").then((e) => {
|
|
234
|
-
e.default.changeLanguage(t);
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
}), {
|
|
238
|
-
name: "chatui-settings",
|
|
239
|
-
merge: (e, t) => {
|
|
240
|
-
let n = e;
|
|
241
|
-
return {
|
|
242
|
-
...t,
|
|
243
|
-
...n,
|
|
244
|
-
config: {
|
|
245
|
-
...t.config,
|
|
246
|
-
...n.config ?? {}
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
}));
|
|
251
|
-
//#endregion
|
|
252
|
-
export { i as n, n as r, o as t };
|
|
253
|
-
|
|
254
|
-
//# sourceMappingURL=settingsStore-CpRkCJCy.js.map
|