@elia-assistant/chatui 1.0.10 → 1.0.12

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.
@@ -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-CpRkCJCy.js";
1
+ import { t as e } from "./chunks/settingsStore-Bqlj_GzJ.js";
2
2
  export { e as useSettingsStore };
@@ -58,7 +58,7 @@ 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
- allowedFilesMimeTypes?: string;
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;
@@ -114,11 +114,18 @@ export interface ChatConfig {
114
114
  };
115
115
  };
116
116
  }
117
+ export interface Attachment {
118
+ name: string;
119
+ url: string;
120
+ size?: number;
121
+ mimeType?: string;
122
+ }
117
123
  export interface Message {
118
124
  id: string;
119
125
  role: 'user' | 'bot';
120
126
  content: string;
121
127
  ts: number;
128
+ attachments?: Attachment[];
122
129
  /**
123
130
  * Delivery status for user messages. <c>undefined</c> on persisted history (treated as
124
131
  * <c>'sent'</c>) and on every bot message — bots don't have a sender-side delivery state.
@@ -133,19 +140,6 @@ export interface Session {
133
140
  export interface ThemeDef {
134
141
  id: string;
135
142
  label: string;
136
- scheme: 'dark' | 'light';
137
- vars: ThemeVars;
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;
143
+ baseColor: string;
144
+ accentColor: string;
151
145
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elia-assistant/chatui",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,2 +0,0 @@
1
- import { t as e } from "./i18n-B0xhVAye.js";
2
- export { e as default };
@@ -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