@mordn/chat-widget 0.3.0 → 0.4.1
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/index.d.mts +19 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +17 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -6
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1411,7 +1411,7 @@ function useChatStorageKey() {
|
|
|
1411
1411
|
|
|
1412
1412
|
// src/components/interface.tsx
|
|
1413
1413
|
import { jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1414
|
-
function ChatInterface({ id, initialMessages, config, onClose } = {}) {
|
|
1414
|
+
function ChatInterface({ id, initialMessages, config, onClose, headerActions } = {}) {
|
|
1415
1415
|
const { storageKeyPrefix } = useChatStorageKey();
|
|
1416
1416
|
const storageKey = (key) => storageKeyPrefix ? `chat-${storageKeyPrefix}-${key}` : `chat-${key}`;
|
|
1417
1417
|
const themeMode = config?.theme?.mode || "light";
|
|
@@ -2082,6 +2082,7 @@ function ChatInterface({ id, initialMessages, config, onClose } = {}) {
|
|
|
2082
2082
|
] }, groupName)) }) })
|
|
2083
2083
|
] })
|
|
2084
2084
|
] }),
|
|
2085
|
+
headerActions,
|
|
2085
2086
|
onClose && /* @__PURE__ */ jsx20(
|
|
2086
2087
|
"button",
|
|
2087
2088
|
{
|
|
@@ -2113,7 +2114,7 @@ function ChatInterface({ id, initialMessages, config, onClose } = {}) {
|
|
|
2113
2114
|
] }),
|
|
2114
2115
|
/* @__PURE__ */ jsxs12("div", { className: "px-5 pb-5", children: [
|
|
2115
2116
|
uploadError && /* @__PURE__ */ jsx20("div", { className: "mb-3 px-4 py-3 bg-red-50 dark:bg-red-900/20 border border-red-200/60 dark:border-red-800/60 rounded-2xl text-sm text-red-700 dark:text-red-400 shadow-sm", children: uploadError }),
|
|
2116
|
-
messages.length === 0 && status !== "submitted" && config?.starterPrompts && /* @__PURE__ */ jsx20(
|
|
2117
|
+
isInitializing ? /* @__PURE__ */ jsx20("div", { className: "flex items-center justify-center py-8", role: "status", "aria-label": "Loading conversation", children: /* @__PURE__ */ jsx20("div", { className: "h-4 w-4 rounded-full border-2 border-current border-t-transparent animate-spin", style: { color: "hsl(var(--chat-text-muted))" } }) }) : messages.length === 0 && status !== "submitted" && config?.starterPrompts && /* @__PURE__ */ jsx20(
|
|
2117
2118
|
StarterMessages,
|
|
2118
2119
|
{
|
|
2119
2120
|
prompts: config.starterPrompts,
|
|
@@ -2195,7 +2196,9 @@ function ChatWidget({
|
|
|
2195
2196
|
theme,
|
|
2196
2197
|
features,
|
|
2197
2198
|
display,
|
|
2198
|
-
starterPrompts
|
|
2199
|
+
starterPrompts,
|
|
2200
|
+
onClose,
|
|
2201
|
+
headerActions
|
|
2199
2202
|
}) {
|
|
2200
2203
|
const layout = display?.layout || "popup";
|
|
2201
2204
|
const showToggleButton = display?.showToggleButton !== false;
|
|
@@ -2277,7 +2280,9 @@ function ChatWidget({
|
|
|
2277
2280
|
{
|
|
2278
2281
|
id: conversationId,
|
|
2279
2282
|
initialMessages,
|
|
2280
|
-
config
|
|
2283
|
+
config,
|
|
2284
|
+
onClose,
|
|
2285
|
+
headerActions
|
|
2281
2286
|
}
|
|
2282
2287
|
)
|
|
2283
2288
|
}
|
|
@@ -2295,7 +2300,9 @@ function ChatWidget({
|
|
|
2295
2300
|
{
|
|
2296
2301
|
id: conversationId,
|
|
2297
2302
|
initialMessages,
|
|
2298
|
-
config
|
|
2303
|
+
config,
|
|
2304
|
+
onClose,
|
|
2305
|
+
headerActions
|
|
2299
2306
|
}
|
|
2300
2307
|
)
|
|
2301
2308
|
}
|
|
@@ -2335,7 +2342,11 @@ function ChatWidget({
|
|
|
2335
2342
|
id: conversationId,
|
|
2336
2343
|
initialMessages,
|
|
2337
2344
|
config,
|
|
2338
|
-
onClose: () =>
|
|
2345
|
+
onClose: () => {
|
|
2346
|
+
setIsOpen(false);
|
|
2347
|
+
onClose?.();
|
|
2348
|
+
},
|
|
2349
|
+
headerActions
|
|
2339
2350
|
}
|
|
2340
2351
|
) })
|
|
2341
2352
|
]
|