@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.
@@ -0,0 +1,2 @@
1
+ import { t as e } from "./i18n-DyWy7n71.js";
2
+ export { e as default };
@@ -1274,8 +1274,8 @@ var oe = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#1
1274
1274
  }
1275
1275
  };
1276
1276
  }, $ = /* @__PURE__ */ Object.assign({
1277
- "./locales/en/translation.json": () => import("./translation-CsXAAc6O.js"),
1278
- "./locales/sk/translation.json": () => import("./translation-D0S7F5mA.js")
1277
+ "./locales/en/translation.json": () => import("./translation-B7absJaI.js"),
1278
+ "./locales/sk/translation.json": () => import("./translation-D2b_upNC.js")
1279
1279
  }), me = Array.from(new Set(Object.keys($).map((e) => e.split("/")[2]).filter((e) => !!e)));
1280
1280
  function he() {
1281
1281
  try {
@@ -1285,7 +1285,7 @@ function he() {
1285
1285
  if (t) return t;
1286
1286
  }
1287
1287
  } catch {}
1288
- return navigator.language.split("-")[0] ?? "en";
1288
+ return "en";
1289
1289
  }
1290
1290
  J.use(pe(async (e, t) => {
1291
1291
  let n = $[`./locales/${e}/${t}.json`];
@@ -1301,4 +1301,4 @@ var ge = J;
1301
1301
  //#endregion
1302
1302
  export { k as a, Y as i, fe as n, ue as r, ge as t };
1303
1303
 
1304
- //# sourceMappingURL=i18n-B0xhVAye.js.map
1304
+ //# sourceMappingURL=i18n-DyWy7n71.js.map
@@ -0,0 +1,130 @@
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
+ baseColor: "#0f1117",
8
+ accentColor: "#6366f1"
9
+ },
10
+ {
11
+ id: "ivory",
12
+ label: "Ivory",
13
+ baseColor: "#ffffff",
14
+ accentColor: "#4338ca"
15
+ },
16
+ {
17
+ id: "sunrise",
18
+ label: "Sunrise",
19
+ baseColor: "#ffffff",
20
+ accentColor: "#f97316"
21
+ },
22
+ {
23
+ id: "cosmos",
24
+ label: "Cosmos",
25
+ baseColor: "#0d0a1a",
26
+ accentColor: "#a855f7"
27
+ },
28
+ {
29
+ id: "forest",
30
+ label: "Forest",
31
+ baseColor: "#0a1410",
32
+ accentColor: "#22c55e"
33
+ },
34
+ {
35
+ id: "ocean",
36
+ label: "Ocean",
37
+ baseColor: "#060f1a",
38
+ accentColor: "#06b6d4"
39
+ },
40
+ {
41
+ id: "cherry",
42
+ label: "Cherry",
43
+ baseColor: "#ffffff",
44
+ accentColor: "#ef4444"
45
+ },
46
+ {
47
+ id: "navy",
48
+ label: "Navy",
49
+ baseColor: "#080f1e",
50
+ accentColor: "#3b82f6"
51
+ },
52
+ {
53
+ id: "lavender",
54
+ label: "Lavender",
55
+ baseColor: "#faf5ff",
56
+ accentColor: "#8b5cf6"
57
+ },
58
+ {
59
+ id: "amber",
60
+ label: "Amber",
61
+ baseColor: "#0f0a00",
62
+ accentColor: "#f59e0b"
63
+ }
64
+ ], r = "midnight";
65
+ function i(e) {
66
+ return n.find((t) => t.id === e) ?? n[0];
67
+ }
68
+ //#endregion
69
+ //#region src/store/settingsStore.ts
70
+ var a = {
71
+ webhookUrl: "",
72
+ chatInputKey: "chatInput",
73
+ chatSessionKey: "sessionId",
74
+ mode: "fullscreen",
75
+ showWelcomeScreen: !0,
76
+ streaming: !1,
77
+ botName: "Assistant",
78
+ showCta: !0,
79
+ ctaText: "Hi! How can I help you today?",
80
+ ctaDelay: 5e3,
81
+ ctaSound: !0,
82
+ hideSettings: !0,
83
+ fullscreenSheet: !1,
84
+ fullscreenSheetHeight: "75vh",
85
+ i18n: {
86
+ en: {
87
+ initialMessages: [],
88
+ ctaText: "Hi! How can I help you today?"
89
+ },
90
+ sk: {
91
+ initialMessages: [],
92
+ ctaText: "Dobrý deň! Ako vám môžem pomôcť?"
93
+ }
94
+ }
95
+ }, o = e()(t((e) => ({
96
+ config: a,
97
+ activeTheme: r,
98
+ language: "en",
99
+ setConfig(t) {
100
+ e((e) => ({ config: {
101
+ ...e.config,
102
+ ...t
103
+ } }));
104
+ },
105
+ setTheme(t) {
106
+ e({ activeTheme: t });
107
+ },
108
+ setLanguage(t) {
109
+ e({ language: t }), import("./i18n-BUYd0BSF.js").then((e) => {
110
+ e.default.changeLanguage(t);
111
+ });
112
+ }
113
+ }), {
114
+ name: "chatui-settings",
115
+ merge: (e, t) => {
116
+ let n = e;
117
+ return {
118
+ ...t,
119
+ ...n,
120
+ config: {
121
+ ...t.config,
122
+ ...n.config ?? {}
123
+ }
124
+ };
125
+ }
126
+ }));
127
+ //#endregion
128
+ export { i as n, n as r, o as t };
129
+
130
+ //# sourceMappingURL=settingsStore-BRK5844w.js.map
@@ -41,6 +41,7 @@ var e = {
41
41
  welcomeScreen: "Show welcome screen",
42
42
  sidebar: "Show conversation sidebar",
43
43
  fileUploads: "Allow file uploads",
44
+ allowedFileExtensions: "Allowed file extensions",
44
45
  mode: "Display mode",
45
46
  fullscreenSheet: "Bottom-sheet style (don't cover full screen)",
46
47
  fullscreenSheetHeight: "Sheet height (CSS length, e.g. 75vh, 600px)",
@@ -68,11 +69,14 @@ var e = {
68
69
  avatarUrlPlaceholder: "or paste a URL",
69
70
  avatarErrorType: "Please choose an image file.",
70
71
  avatarErrorSize: "Image is too large (max 500 KB).",
71
- poweredByLabel: "\"Powered by\" link text",
72
- poweredByUrl: "\"Powered by\" link URL",
73
- poweredByHide: "Hide \"Powered by\" footer",
74
72
  save: "Save",
75
- cancel: "Cancel"
73
+ cancel: "Cancel",
74
+ theme: "Theme",
75
+ exportConfig: "Export config",
76
+ exportHint: "Paste this into your host app's bootstrap file (e.g. <code>src/main.tsx</code>) before the first React render. See <code>example.html</code> for the full integration guide.",
77
+ back: "Back",
78
+ copyToClipboard: "Copy to clipboard",
79
+ copied: "Copied"
76
80
  }, c = {
77
81
  errors: e,
78
82
  welcome: t,
@@ -86,4 +90,4 @@ var e = {
86
90
  //#endregion
87
91
  export { c as default, e as errors, a as footer, r as header, n as input, s as settings, i as sidebar, o as tabs, t as welcome };
88
92
 
89
- //# sourceMappingURL=translation-CsXAAc6O.js.map
93
+ //# sourceMappingURL=translation-B7absJaI.js.map
@@ -41,6 +41,7 @@ var e = {
41
41
  welcomeScreen: "Zobraziť uvítaciu obrazovku",
42
42
  sidebar: "Zobraziť históriu konverzácií",
43
43
  fileUploads: "Povoliť nahrávanie súborov",
44
+ allowedFileExtensions: "Povolené prípony súborov",
44
45
  mode: "Režim zobrazenia",
45
46
  fullscreenSheet: "Štýl spodného panela (nepokryje celú obrazovku)",
46
47
  fullscreenSheetHeight: "Výška panela (CSS dĺžka, napr. 75vh, 600px)",
@@ -68,11 +69,14 @@ var e = {
68
69
  avatarUrlPlaceholder: "alebo vložte URL",
69
70
  avatarErrorType: "Vyberte súbor obrázka.",
70
71
  avatarErrorSize: "Obrázok je príliš veľký (max 500 KB).",
71
- poweredByLabel: "Text odkazu \"Poháňa\"",
72
- poweredByUrl: "URL odkazu \"Poháňa\"",
73
- poweredByHide: "Skryť pätičku \"Poháňa\"",
74
72
  save: "Uložiť",
75
- cancel: "Zrušiť"
73
+ cancel: "Zrušiť",
74
+ theme: "Téma",
75
+ exportConfig: "Exportovať konfiguráciu",
76
+ exportHint: "Vložte toto do bootstrap súboru vašej hostiteľskej aplikácie (napr. <code>src/main.tsx</code>) pred prvým renderom Reactu. Pozrite <code>example.html</code> pre kompletný návod na integráciu.",
77
+ back: "Späť",
78
+ copyToClipboard: "Kopírovať do schránky",
79
+ copied: "Skopírované"
76
80
  }, c = {
77
81
  errors: e,
78
82
  welcome: t,
@@ -86,4 +90,4 @@ var e = {
86
90
  //#endregion
87
91
  export { c as default, e as errors, a as footer, r as header, n as input, s as settings, i as sidebar, o as tabs, t as welcome };
88
92
 
89
- //# sourceMappingURL=translation-D0S7F5mA.js.map
93
+ //# sourceMappingURL=translation-D2b_upNC.js.map
@@ -1,5 +1,6 @@
1
+ import type { Attachment } from '../types/index.ts';
1
2
  interface Props {
2
- onSend: (text: string) => void;
3
+ onSend: (text: string, attachments?: Attachment[]) => void;
3
4
  disabled?: boolean;
4
5
  placeholder?: string;
5
6
  allowFileUploads?: boolean;
@@ -1,5 +1,6 @@
1
+ import type { Attachment } from '../types/index.ts';
1
2
  export declare function useChat(): {
2
- send: (text: string) => Promise<void>;
3
+ send: (text: string, attachments?: Attachment[]) => Promise<void>;
3
4
  retry: (messageId: string) => Promise<void>;
4
5
  isStreaming: boolean;
5
6
  };
@@ -1,5 +1,5 @@
1
1
  import type { ChatConfig } from '../types/index.ts';
2
- export declare function useCta(config: ChatConfig, language: string, isWindow: boolean): {
2
+ export declare function useCta(config: ChatConfig, language: string, enabled: boolean): {
3
3
  showCta: boolean;
4
4
  ctaText: string;
5
5
  dismiss: () => void;
@@ -1,4 +1,7 @@
1
- export declare function useTheme(): {
1
+ import { type RefObject } from 'react';
2
+ export declare function useTheme({ elementRef, }?: {
3
+ elementRef?: RefObject<HTMLElement | null>;
4
+ }): {
2
5
  activeTheme: string;
3
6
  setTheme: (id: string) => void;
4
7
  };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { App } from './App.tsx';
2
2
  export { createChat } from './createChat.ts';
3
3
  export type { CreateChatOptions, ChatInstance } from './createChat.ts';
4
- export type { ChatConfig, LangOverride, Message, Session, ThemeDef, ThemeVars, NotificationItem, NotificationTag, NotificationTagVariant, FaqItem, } from './types/index.ts';
4
+ export type { ChatConfig, LangOverride, Message, Session, ThemeDef, NotificationItem, NotificationTag, NotificationTagVariant, FaqItem, } from './types/index.ts';