@xcelsior/ui-chat 2.0.1 → 2.0.3
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 -1
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +236 -182
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +236 -182
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -6
- package/src/components/MessageList.tsx +1 -1
- package/src/components/Spinner.tsx +50 -0
- package/src/hooks/useWebSocket.ts +18 -1
package/dist/index.js
CHANGED
|
@@ -62,6 +62,7 @@ function useWebSocket(config, externalWebSocket) {
|
|
|
62
62
|
const reconnectTimeoutRef = (0, import_react.useRef)(null);
|
|
63
63
|
const reconnectAttemptsRef = (0, import_react.useRef)(0);
|
|
64
64
|
const messageHandlerRef = (0, import_react.useRef)(null);
|
|
65
|
+
const abortedRef = (0, import_react.useRef)(false);
|
|
65
66
|
const maxReconnectAttempts = 5;
|
|
66
67
|
const reconnectDelay = 3e3;
|
|
67
68
|
const isUsingExternalWs = !!externalWebSocket;
|
|
@@ -94,6 +95,7 @@ function useWebSocket(config, externalWebSocket) {
|
|
|
94
95
|
};
|
|
95
96
|
}, []);
|
|
96
97
|
const connect = (0, import_react.useCallback)(() => {
|
|
98
|
+
if (abortedRef.current) return;
|
|
97
99
|
console.log("connecting to WebSocket...", config.currentUser, config.conversationId);
|
|
98
100
|
try {
|
|
99
101
|
if (wsRef.current) {
|
|
@@ -113,6 +115,10 @@ function useWebSocket(config, externalWebSocket) {
|
|
|
113
115
|
}
|
|
114
116
|
const ws = new WebSocket(url.toString());
|
|
115
117
|
ws.onopen = () => {
|
|
118
|
+
if (abortedRef.current) {
|
|
119
|
+
ws.close(1e3, "Effect cleaned up");
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
116
122
|
console.log("WebSocket connected");
|
|
117
123
|
setIsConnected(true);
|
|
118
124
|
setError(null);
|
|
@@ -120,12 +126,14 @@ function useWebSocket(config, externalWebSocket) {
|
|
|
120
126
|
config.onConnectionChange?.(true);
|
|
121
127
|
};
|
|
122
128
|
ws.onerror = (event) => {
|
|
129
|
+
if (abortedRef.current) return;
|
|
123
130
|
console.error("WebSocket error:", event);
|
|
124
131
|
const err = new Error("WebSocket connection error");
|
|
125
132
|
setError(err);
|
|
126
133
|
config.onError?.(err);
|
|
127
134
|
};
|
|
128
135
|
ws.onclose = (event) => {
|
|
136
|
+
if (abortedRef.current) return;
|
|
129
137
|
console.log("WebSocket closed:", event.code, event.reason);
|
|
130
138
|
setIsConnected(false);
|
|
131
139
|
config.onConnectionChange?.(false);
|
|
@@ -174,6 +182,7 @@ function useWebSocket(config, externalWebSocket) {
|
|
|
174
182
|
);
|
|
175
183
|
const reconnect = (0, import_react.useCallback)(() => {
|
|
176
184
|
reconnectAttemptsRef.current = 0;
|
|
185
|
+
abortedRef.current = false;
|
|
177
186
|
connect();
|
|
178
187
|
}, [connect]);
|
|
179
188
|
(0, import_react.useEffect)(() => {
|
|
@@ -183,8 +192,10 @@ function useWebSocket(config, externalWebSocket) {
|
|
|
183
192
|
const cleanup = subscribeToMessage(externalWebSocket);
|
|
184
193
|
return cleanup;
|
|
185
194
|
}
|
|
195
|
+
abortedRef.current = false;
|
|
186
196
|
connect();
|
|
187
197
|
return () => {
|
|
198
|
+
abortedRef.current = true;
|
|
188
199
|
if (reconnectTimeoutRef.current) {
|
|
189
200
|
clearTimeout(reconnectTimeoutRef.current);
|
|
190
201
|
}
|
|
@@ -963,7 +974,50 @@ function ChatHeader({ agent, onClose, onMinimize, theme }) {
|
|
|
963
974
|
|
|
964
975
|
// src/components/MessageList.tsx
|
|
965
976
|
var import_react7 = require("react");
|
|
966
|
-
|
|
977
|
+
|
|
978
|
+
// src/components/Spinner.tsx
|
|
979
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
980
|
+
var SIZE_MAP = {
|
|
981
|
+
sm: 16,
|
|
982
|
+
md: 24,
|
|
983
|
+
lg: 36
|
|
984
|
+
};
|
|
985
|
+
var BORDER_MAP = {
|
|
986
|
+
sm: 2,
|
|
987
|
+
md: 2,
|
|
988
|
+
lg: 3
|
|
989
|
+
};
|
|
990
|
+
function Spinner({ size = "md", color = "currentColor" }) {
|
|
991
|
+
const px = SIZE_MAP[size];
|
|
992
|
+
const border = BORDER_MAP[size];
|
|
993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
994
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("style", { children: `
|
|
995
|
+
@keyframes xchat-spin {
|
|
996
|
+
to { transform: rotate(360deg); }
|
|
997
|
+
}
|
|
998
|
+
.xchat-spinner {
|
|
999
|
+
animation: xchat-spin 0.75s linear infinite;
|
|
1000
|
+
border-radius: 50%;
|
|
1001
|
+
display: inline-block;
|
|
1002
|
+
flex-shrink: 0;
|
|
1003
|
+
}
|
|
1004
|
+
` }),
|
|
1005
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1006
|
+
"span",
|
|
1007
|
+
{
|
|
1008
|
+
className: "xchat-spinner",
|
|
1009
|
+
role: "status",
|
|
1010
|
+
"aria-label": "Loading",
|
|
1011
|
+
style: {
|
|
1012
|
+
width: px,
|
|
1013
|
+
height: px,
|
|
1014
|
+
border: `${border}px solid rgba(128,128,128,0.25)`,
|
|
1015
|
+
borderTopColor: color
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
)
|
|
1019
|
+
] });
|
|
1020
|
+
}
|
|
967
1021
|
|
|
968
1022
|
// src/components/MessageItem.tsx
|
|
969
1023
|
var import_date_fns = require("date-fns");
|
|
@@ -1058,7 +1112,7 @@ function getMarkdownStyles(theme, isLightTheme) {
|
|
|
1058
1112
|
}
|
|
1059
1113
|
|
|
1060
1114
|
// src/components/MarkdownMessage.tsx
|
|
1061
|
-
var
|
|
1115
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1062
1116
|
function computeIsLightTheme(theme) {
|
|
1063
1117
|
const bgColor = theme?.background || "#00001a";
|
|
1064
1118
|
if (!bgColor.startsWith("#")) return false;
|
|
@@ -1077,18 +1131,18 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1077
1131
|
// inside the bubble.
|
|
1078
1132
|
display: "block"
|
|
1079
1133
|
};
|
|
1080
|
-
return /* @__PURE__ */ (0,
|
|
1134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: wrapperStyle, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1081
1135
|
import_react_markdown.default,
|
|
1082
1136
|
{
|
|
1083
1137
|
components: {
|
|
1084
1138
|
// Paragraphs
|
|
1085
|
-
p: ({ children }) => /* @__PURE__ */ (0,
|
|
1139
|
+
p: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: styles.paragraph, children }),
|
|
1086
1140
|
// Bold
|
|
1087
|
-
strong: ({ children }) => /* @__PURE__ */ (0,
|
|
1141
|
+
strong: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { style: styles.strong, children }),
|
|
1088
1142
|
// Italic
|
|
1089
|
-
em: ({ children }) => /* @__PURE__ */ (0,
|
|
1143
|
+
em: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("em", { style: styles.emphasis, children }),
|
|
1090
1144
|
// Links — open in new tab
|
|
1091
|
-
a: ({ href, children }) => /* @__PURE__ */ (0,
|
|
1145
|
+
a: ({ href, children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1092
1146
|
"a",
|
|
1093
1147
|
{
|
|
1094
1148
|
href,
|
|
@@ -1099,9 +1153,9 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1099
1153
|
}
|
|
1100
1154
|
),
|
|
1101
1155
|
// Unordered list
|
|
1102
|
-
ul: ({ children }) => /* @__PURE__ */ (0,
|
|
1156
|
+
ul: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { style: { ...styles.list, listStyleType: "disc" }, children }),
|
|
1103
1157
|
// Ordered list
|
|
1104
|
-
ol: ({ children }) => /* @__PURE__ */ (0,
|
|
1158
|
+
ol: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1105
1159
|
"ol",
|
|
1106
1160
|
{
|
|
1107
1161
|
style: { ...styles.list, listStyleType: "decimal" },
|
|
@@ -1109,7 +1163,7 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1109
1163
|
}
|
|
1110
1164
|
),
|
|
1111
1165
|
// List item
|
|
1112
|
-
li: ({ children }) => /* @__PURE__ */ (0,
|
|
1166
|
+
li: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", { style: styles.listItem, children }),
|
|
1113
1167
|
// Inline code vs code block — react-markdown wraps fenced
|
|
1114
1168
|
// code blocks as <pre><code className="language-*">. The
|
|
1115
1169
|
// cleanest heuristic: if the className starts with
|
|
@@ -1119,7 +1173,7 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1119
1173
|
className?.startsWith("language-")
|
|
1120
1174
|
);
|
|
1121
1175
|
if (isBlock) {
|
|
1122
|
-
return /* @__PURE__ */ (0,
|
|
1176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1123
1177
|
"code",
|
|
1124
1178
|
{
|
|
1125
1179
|
className,
|
|
@@ -1128,10 +1182,10 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1128
1182
|
}
|
|
1129
1183
|
);
|
|
1130
1184
|
}
|
|
1131
|
-
return /* @__PURE__ */ (0,
|
|
1185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { style: styles.code, children });
|
|
1132
1186
|
}),
|
|
1133
1187
|
// Pre wrapper for code blocks
|
|
1134
|
-
pre: ({ children }) => /* @__PURE__ */ (0,
|
|
1188
|
+
pre: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1135
1189
|
"pre",
|
|
1136
1190
|
{
|
|
1137
1191
|
style: {
|
|
@@ -1145,7 +1199,7 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1145
1199
|
}
|
|
1146
1200
|
),
|
|
1147
1201
|
// Headings — h1 through h6 with progressive size reduction
|
|
1148
|
-
h1: ({ children }) => /* @__PURE__ */ (0,
|
|
1202
|
+
h1: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1149
1203
|
"h1",
|
|
1150
1204
|
{
|
|
1151
1205
|
style: {
|
|
@@ -1155,7 +1209,7 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1155
1209
|
children
|
|
1156
1210
|
}
|
|
1157
1211
|
),
|
|
1158
|
-
h2: ({ children }) => /* @__PURE__ */ (0,
|
|
1212
|
+
h2: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1159
1213
|
"h2",
|
|
1160
1214
|
{
|
|
1161
1215
|
style: {
|
|
@@ -1165,7 +1219,7 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1165
1219
|
children
|
|
1166
1220
|
}
|
|
1167
1221
|
),
|
|
1168
|
-
h3: ({ children }) => /* @__PURE__ */ (0,
|
|
1222
|
+
h3: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1169
1223
|
"h3",
|
|
1170
1224
|
{
|
|
1171
1225
|
style: {
|
|
@@ -1175,8 +1229,8 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1175
1229
|
children
|
|
1176
1230
|
}
|
|
1177
1231
|
),
|
|
1178
|
-
h4: ({ children }) => /* @__PURE__ */ (0,
|
|
1179
|
-
h5: ({ children }) => /* @__PURE__ */ (0,
|
|
1232
|
+
h4: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h4", { style: { ...styles.heading, fontSize: "1em" }, children }),
|
|
1233
|
+
h5: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1180
1234
|
"h5",
|
|
1181
1235
|
{
|
|
1182
1236
|
style: {
|
|
@@ -1186,7 +1240,7 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1186
1240
|
children
|
|
1187
1241
|
}
|
|
1188
1242
|
),
|
|
1189
|
-
h6: ({ children }) => /* @__PURE__ */ (0,
|
|
1243
|
+
h6: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1190
1244
|
"h6",
|
|
1191
1245
|
{
|
|
1192
1246
|
style: {
|
|
@@ -1197,9 +1251,9 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1197
1251
|
}
|
|
1198
1252
|
),
|
|
1199
1253
|
// Blockquote
|
|
1200
|
-
blockquote: ({ children }) => /* @__PURE__ */ (0,
|
|
1254
|
+
blockquote: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("blockquote", { style: styles.blockquote, children }),
|
|
1201
1255
|
// Horizontal rule
|
|
1202
|
-
hr: () => /* @__PURE__ */ (0,
|
|
1256
|
+
hr: () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("hr", { style: styles.hr })
|
|
1203
1257
|
},
|
|
1204
1258
|
children: content
|
|
1205
1259
|
}
|
|
@@ -1207,7 +1261,7 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1207
1261
|
}
|
|
1208
1262
|
|
|
1209
1263
|
// src/components/MessageItem.tsx
|
|
1210
|
-
var
|
|
1264
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1211
1265
|
function MessageItem({
|
|
1212
1266
|
message,
|
|
1213
1267
|
currentUser,
|
|
@@ -1233,7 +1287,7 @@ function MessageItem({
|
|
|
1233
1287
|
const textColor = theme?.text || (isLightTheme ? "#1a1a2e" : "#f7f7f8");
|
|
1234
1288
|
const textMuted = theme?.textMuted || (isLightTheme ? "rgba(0,0,0,0.35)" : "rgba(247,247,248,0.35)");
|
|
1235
1289
|
if (isSystemMessage) {
|
|
1236
|
-
return /* @__PURE__ */ (0,
|
|
1290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex justify-center my-3", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1237
1291
|
"div",
|
|
1238
1292
|
{
|
|
1239
1293
|
className: "px-4 py-1.5 rounded-full",
|
|
@@ -1241,7 +1295,7 @@ function MessageItem({
|
|
|
1241
1295
|
backgroundColor: isLightTheme ? "rgba(0,0,0,0.04)" : "rgba(255,255,255,0.03)",
|
|
1242
1296
|
boxShadow: isLightTheme ? "inset 0 0 0 1px rgba(0,0,0,0.06)" : "inset 0 0 0 0.5px rgba(255,255,255,0.06)"
|
|
1243
1297
|
},
|
|
1244
|
-
children: /* @__PURE__ */ (0,
|
|
1298
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1245
1299
|
"p",
|
|
1246
1300
|
{
|
|
1247
1301
|
style: {
|
|
@@ -1280,12 +1334,12 @@ function MessageItem({
|
|
|
1280
1334
|
borderRadius: "18px 18px 18px 4px",
|
|
1281
1335
|
boxShadow: "inset 0 0 0 0.5px rgba(255,255,255,0.06), inset 0 1px 0 0 rgba(255,255,255,0.08)"
|
|
1282
1336
|
};
|
|
1283
|
-
return /* @__PURE__ */ (0,
|
|
1337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1284
1338
|
"div",
|
|
1285
1339
|
{
|
|
1286
1340
|
className: `flex gap-2.5 mb-3 ${isOwnMessage ? "flex-row-reverse" : "flex-row"}`,
|
|
1287
1341
|
children: [
|
|
1288
|
-
showAvatar && !isOwnMessage && /* @__PURE__ */ (0,
|
|
1342
|
+
showAvatar && !isOwnMessage && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex-shrink-0 mt-auto mb-5", children: isBotMessage || isAIMessage ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(XcelsiorAvatar, { size: 28 }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1289
1343
|
"div",
|
|
1290
1344
|
{
|
|
1291
1345
|
className: "h-7 w-7 rounded-full flex items-center justify-center",
|
|
@@ -1293,7 +1347,7 @@ function MessageItem({
|
|
|
1293
1347
|
background: isLightTheme ? `linear-gradient(135deg, ${primaryColor}30, rgba(0,0,0,0.04))` : `linear-gradient(135deg, ${primaryColor}60, rgba(255,255,255,0.06))`,
|
|
1294
1348
|
boxShadow: isLightTheme ? "inset 0 0 0 1px rgba(0,0,0,0.08)" : "inset 0 0 0 0.5px rgba(255,255,255,0.1)"
|
|
1295
1349
|
},
|
|
1296
|
-
children: /* @__PURE__ */ (0,
|
|
1350
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1297
1351
|
"svg",
|
|
1298
1352
|
{
|
|
1299
1353
|
width: "14",
|
|
@@ -1306,21 +1360,21 @@ function MessageItem({
|
|
|
1306
1360
|
strokeLinejoin: "round",
|
|
1307
1361
|
"aria-hidden": "true",
|
|
1308
1362
|
children: [
|
|
1309
|
-
/* @__PURE__ */ (0,
|
|
1310
|
-
/* @__PURE__ */ (0,
|
|
1311
|
-
/* @__PURE__ */ (0,
|
|
1363
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("title", { children: "Agent" }),
|
|
1364
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M3 18v-6a9 9 0 0 1 18 0v6" }),
|
|
1365
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M21 19a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3zM3 19a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2H3z" })
|
|
1312
1366
|
]
|
|
1313
1367
|
}
|
|
1314
1368
|
)
|
|
1315
1369
|
}
|
|
1316
1370
|
) }),
|
|
1317
|
-
showAvatar && isOwnMessage && /* @__PURE__ */ (0,
|
|
1318
|
-
/* @__PURE__ */ (0,
|
|
1371
|
+
showAvatar && isOwnMessage && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "w-7 flex-shrink-0" }),
|
|
1372
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1319
1373
|
"div",
|
|
1320
1374
|
{
|
|
1321
1375
|
className: `flex flex-col max-w-[75%] ${isOwnMessage ? "items-end" : "items-start"}`,
|
|
1322
1376
|
children: [
|
|
1323
|
-
senderLabel && /* @__PURE__ */ (0,
|
|
1377
|
+
senderLabel && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1324
1378
|
"span",
|
|
1325
1379
|
{
|
|
1326
1380
|
className: "mb-1 px-1 font-medium",
|
|
@@ -1332,7 +1386,7 @@ function MessageItem({
|
|
|
1332
1386
|
children: senderLabel
|
|
1333
1387
|
}
|
|
1334
1388
|
),
|
|
1335
|
-
/* @__PURE__ */ (0,
|
|
1389
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1336
1390
|
"div",
|
|
1337
1391
|
{
|
|
1338
1392
|
className: "px-4 py-2.5",
|
|
@@ -1345,12 +1399,12 @@ function MessageItem({
|
|
|
1345
1399
|
children: [
|
|
1346
1400
|
message.messageType === "text" && (isOwnMessage ? (
|
|
1347
1401
|
// User messages: plain text — no markdown parsing
|
|
1348
|
-
/* @__PURE__ */ (0,
|
|
1402
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { whiteSpace: "pre-wrap", wordBreak: "break-word" }, children: message.content })
|
|
1349
1403
|
) : (
|
|
1350
1404
|
// Bot / agent messages: full markdown rendering
|
|
1351
|
-
/* @__PURE__ */ (0,
|
|
1405
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(MarkdownMessage, { content: message.content, theme })
|
|
1352
1406
|
)),
|
|
1353
|
-
message.messageType === "image" && /* @__PURE__ */ (0,
|
|
1407
|
+
message.messageType === "image" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1354
1408
|
"img",
|
|
1355
1409
|
{
|
|
1356
1410
|
src: message.content,
|
|
@@ -1359,8 +1413,8 @@ function MessageItem({
|
|
|
1359
1413
|
loading: "lazy"
|
|
1360
1414
|
}
|
|
1361
1415
|
) }),
|
|
1362
|
-
message.messageType === "file" && /* @__PURE__ */ (0,
|
|
1363
|
-
/* @__PURE__ */ (0,
|
|
1416
|
+
message.messageType === "file" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1417
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1364
1418
|
"svg",
|
|
1365
1419
|
{
|
|
1366
1420
|
width: "18",
|
|
@@ -1373,12 +1427,12 @@ function MessageItem({
|
|
|
1373
1427
|
strokeLinejoin: "round",
|
|
1374
1428
|
"aria-hidden": "true",
|
|
1375
1429
|
children: [
|
|
1376
|
-
/* @__PURE__ */ (0,
|
|
1377
|
-
/* @__PURE__ */ (0,
|
|
1430
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("title", { children: "File" }),
|
|
1431
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48" })
|
|
1378
1432
|
]
|
|
1379
1433
|
}
|
|
1380
1434
|
),
|
|
1381
|
-
/* @__PURE__ */ (0,
|
|
1435
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1382
1436
|
"a",
|
|
1383
1437
|
{
|
|
1384
1438
|
href: message.content,
|
|
@@ -1396,12 +1450,12 @@ function MessageItem({
|
|
|
1396
1450
|
]
|
|
1397
1451
|
}
|
|
1398
1452
|
),
|
|
1399
|
-
showTimestamp && /* @__PURE__ */ (0,
|
|
1453
|
+
showTimestamp && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1400
1454
|
"div",
|
|
1401
1455
|
{
|
|
1402
1456
|
className: `flex items-center gap-1.5 mt-1 px-1 ${isOwnMessage ? "flex-row-reverse" : "flex-row"}`,
|
|
1403
1457
|
children: [
|
|
1404
|
-
/* @__PURE__ */ (0,
|
|
1458
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1405
1459
|
"span",
|
|
1406
1460
|
{
|
|
1407
1461
|
style: {
|
|
@@ -1414,8 +1468,8 @@ function MessageItem({
|
|
|
1414
1468
|
})
|
|
1415
1469
|
}
|
|
1416
1470
|
),
|
|
1417
|
-
isOwnMessage && message.status && /* @__PURE__ */ (0,
|
|
1418
|
-
message.status === "sent" && /* @__PURE__ */ (0,
|
|
1471
|
+
isOwnMessage && message.status && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: { color: textMuted }, children: [
|
|
1472
|
+
message.status === "sent" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1419
1473
|
"svg",
|
|
1420
1474
|
{
|
|
1421
1475
|
width: "14",
|
|
@@ -1428,12 +1482,12 @@ function MessageItem({
|
|
|
1428
1482
|
strokeLinejoin: "round",
|
|
1429
1483
|
"aria-hidden": "true",
|
|
1430
1484
|
children: [
|
|
1431
|
-
/* @__PURE__ */ (0,
|
|
1432
|
-
/* @__PURE__ */ (0,
|
|
1485
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("title", { children: "Sent" }),
|
|
1486
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("polyline", { points: "20 6 9 17 4 12" })
|
|
1433
1487
|
]
|
|
1434
1488
|
}
|
|
1435
1489
|
),
|
|
1436
|
-
message.status === "delivered" && /* @__PURE__ */ (0,
|
|
1490
|
+
message.status === "delivered" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1437
1491
|
"svg",
|
|
1438
1492
|
{
|
|
1439
1493
|
width: "14",
|
|
@@ -1446,13 +1500,13 @@ function MessageItem({
|
|
|
1446
1500
|
strokeLinejoin: "round",
|
|
1447
1501
|
"aria-hidden": "true",
|
|
1448
1502
|
children: [
|
|
1449
|
-
/* @__PURE__ */ (0,
|
|
1450
|
-
/* @__PURE__ */ (0,
|
|
1451
|
-
/* @__PURE__ */ (0,
|
|
1503
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("title", { children: "Delivered" }),
|
|
1504
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("polyline", { points: "18 6 7 17 2 12" }),
|
|
1505
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("polyline", { points: "22 6 11 17" })
|
|
1452
1506
|
]
|
|
1453
1507
|
}
|
|
1454
1508
|
),
|
|
1455
|
-
message.status === "read" && /* @__PURE__ */ (0,
|
|
1509
|
+
message.status === "read" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1456
1510
|
"svg",
|
|
1457
1511
|
{
|
|
1458
1512
|
width: "14",
|
|
@@ -1465,9 +1519,9 @@ function MessageItem({
|
|
|
1465
1519
|
strokeLinejoin: "round",
|
|
1466
1520
|
"aria-hidden": "true",
|
|
1467
1521
|
children: [
|
|
1468
|
-
/* @__PURE__ */ (0,
|
|
1469
|
-
/* @__PURE__ */ (0,
|
|
1470
|
-
/* @__PURE__ */ (0,
|
|
1522
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("title", { children: "Read" }),
|
|
1523
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("polyline", { points: "18 6 7 17 2 12" }),
|
|
1524
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("polyline", { points: "22 6 11 17" })
|
|
1471
1525
|
]
|
|
1472
1526
|
}
|
|
1473
1527
|
)
|
|
@@ -1485,7 +1539,7 @@ function MessageItem({
|
|
|
1485
1539
|
|
|
1486
1540
|
// src/components/ThinkingIndicator.tsx
|
|
1487
1541
|
var import_react6 = require("react");
|
|
1488
|
-
var
|
|
1542
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1489
1543
|
var PHRASE_POOLS = {
|
|
1490
1544
|
// ── Greetings & small talk ──
|
|
1491
1545
|
greeting: [
|
|
@@ -1704,7 +1758,7 @@ function ThinkingIndicator({
|
|
|
1704
1758
|
}
|
|
1705
1759
|
return () => clearTimeout(timeout);
|
|
1706
1760
|
}, [displayText, isDeleting, phraseIndex]);
|
|
1707
|
-
return /* @__PURE__ */ (0,
|
|
1761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1708
1762
|
"div",
|
|
1709
1763
|
{
|
|
1710
1764
|
className: "flex gap-2.5 mb-3",
|
|
@@ -1712,8 +1766,8 @@ function ThinkingIndicator({
|
|
|
1712
1766
|
"aria-live": "polite",
|
|
1713
1767
|
"aria-label": "Xcelsior is thinking",
|
|
1714
1768
|
children: [
|
|
1715
|
-
showAvatar && /* @__PURE__ */ (0,
|
|
1716
|
-
/* @__PURE__ */ (0,
|
|
1769
|
+
showAvatar && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex-shrink-0 mt-auto mb-5", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(XcelsiorAvatar, { size: 28 }) }),
|
|
1770
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex flex-col items-start", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1717
1771
|
"div",
|
|
1718
1772
|
{
|
|
1719
1773
|
style: {
|
|
@@ -1723,8 +1777,8 @@ function ThinkingIndicator({
|
|
|
1723
1777
|
padding: "12px 16px",
|
|
1724
1778
|
minWidth: 160
|
|
1725
1779
|
},
|
|
1726
|
-
children: /* @__PURE__ */ (0,
|
|
1727
|
-
/* @__PURE__ */ (0,
|
|
1780
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
1781
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { display: "flex", gap: 4, alignItems: "center" }, children: [0, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1728
1782
|
"span",
|
|
1729
1783
|
{
|
|
1730
1784
|
style: {
|
|
@@ -1738,7 +1792,7 @@ function ThinkingIndicator({
|
|
|
1738
1792
|
},
|
|
1739
1793
|
i
|
|
1740
1794
|
)) }),
|
|
1741
|
-
/* @__PURE__ */ (0,
|
|
1795
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1742
1796
|
"span",
|
|
1743
1797
|
{
|
|
1744
1798
|
style: {
|
|
@@ -1749,7 +1803,7 @@ function ThinkingIndicator({
|
|
|
1749
1803
|
},
|
|
1750
1804
|
children: [
|
|
1751
1805
|
displayText,
|
|
1752
|
-
/* @__PURE__ */ (0,
|
|
1806
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1753
1807
|
"span",
|
|
1754
1808
|
{
|
|
1755
1809
|
style: {
|
|
@@ -1775,7 +1829,7 @@ function ThinkingIndicator({
|
|
|
1775
1829
|
}
|
|
1776
1830
|
|
|
1777
1831
|
// src/components/MessageList.tsx
|
|
1778
|
-
var
|
|
1832
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1779
1833
|
function MessageList({
|
|
1780
1834
|
messages,
|
|
1781
1835
|
currentUser,
|
|
@@ -1856,11 +1910,11 @@ function MessageList({
|
|
|
1856
1910
|
return () => container.removeEventListener("scroll", handleScroll);
|
|
1857
1911
|
}, [handleScroll]);
|
|
1858
1912
|
if (isLoading) {
|
|
1859
|
-
return /* @__PURE__ */ (0,
|
|
1913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Spinner, { size: "lg" }) });
|
|
1860
1914
|
}
|
|
1861
1915
|
if (messages.length === 0) {
|
|
1862
|
-
return /* @__PURE__ */ (0,
|
|
1863
|
-
/* @__PURE__ */ (0,
|
|
1916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col items-center justify-center h-full text-center", style: { padding: "40px 32px" }, children: [
|
|
1917
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1864
1918
|
"h3",
|
|
1865
1919
|
{
|
|
1866
1920
|
className: "font-semibold mb-2",
|
|
@@ -1872,7 +1926,7 @@ function MessageList({
|
|
|
1872
1926
|
children: "How can we help?"
|
|
1873
1927
|
}
|
|
1874
1928
|
),
|
|
1875
|
-
/* @__PURE__ */ (0,
|
|
1929
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1876
1930
|
"p",
|
|
1877
1931
|
{
|
|
1878
1932
|
className: "max-w-[240px]",
|
|
@@ -1886,11 +1940,11 @@ function MessageList({
|
|
|
1886
1940
|
children: "Ask us anything. We are here to help you get the most out of Xcelsior."
|
|
1887
1941
|
}
|
|
1888
1942
|
),
|
|
1889
|
-
/* @__PURE__ */ (0,
|
|
1943
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex flex-wrap justify-center gap-2", children: [
|
|
1890
1944
|
{ label: "Our services", message: "What services does Xcelsior offer?" },
|
|
1891
1945
|
{ label: "Get a quote", message: "I would like to get a quote for a project" },
|
|
1892
1946
|
{ label: "Support", message: "I need help with something" }
|
|
1893
|
-
].map((action) => /* @__PURE__ */ (0,
|
|
1947
|
+
].map((action) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1894
1948
|
"button",
|
|
1895
1949
|
{
|
|
1896
1950
|
type: "button",
|
|
@@ -1922,14 +1976,14 @@ function MessageList({
|
|
|
1922
1976
|
)) })
|
|
1923
1977
|
] });
|
|
1924
1978
|
}
|
|
1925
|
-
return /* @__PURE__ */ (0,
|
|
1979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1926
1980
|
"div",
|
|
1927
1981
|
{
|
|
1928
1982
|
ref: containerRef,
|
|
1929
1983
|
className: "flex-1 overflow-y-auto px-4 py-3",
|
|
1930
1984
|
style: { scrollBehavior: "smooth" },
|
|
1931
1985
|
children: [
|
|
1932
|
-
/* @__PURE__ */ (0,
|
|
1986
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("style", { children: `
|
|
1933
1987
|
@keyframes thinkingPulse {
|
|
1934
1988
|
0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
|
|
1935
1989
|
30% { opacity: 1; transform: scale(1); }
|
|
@@ -1939,9 +1993,9 @@ function MessageList({
|
|
|
1939
1993
|
50% { opacity: 0; }
|
|
1940
1994
|
}
|
|
1941
1995
|
` }),
|
|
1942
|
-
isLoadingMore && /* @__PURE__ */ (0,
|
|
1943
|
-
/* @__PURE__ */ (0,
|
|
1944
|
-
messages.map((message) => /* @__PURE__ */ (0,
|
|
1996
|
+
isLoadingMore && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex justify-center py-3", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Spinner, { size: "sm" }) }),
|
|
1997
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref: loadMoreTriggerRef }),
|
|
1998
|
+
messages.map((message) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1945
1999
|
MessageItem,
|
|
1946
2000
|
{
|
|
1947
2001
|
message,
|
|
@@ -1952,10 +2006,10 @@ function MessageList({
|
|
|
1952
2006
|
},
|
|
1953
2007
|
message.id
|
|
1954
2008
|
)),
|
|
1955
|
-
isTyping && /* @__PURE__ */ (0,
|
|
1956
|
-
/* @__PURE__ */ (0,
|
|
1957
|
-
/* @__PURE__ */ (0,
|
|
1958
|
-
/* @__PURE__ */ (0,
|
|
2009
|
+
isTyping && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex gap-2.5 mb-3", children: [
|
|
2010
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex-shrink-0 mt-auto mb-5", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(XcelsiorAvatar, { size: 28 }) }),
|
|
2011
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col items-start", children: [
|
|
2012
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1959
2013
|
"div",
|
|
1960
2014
|
{
|
|
1961
2015
|
className: "px-4 py-3",
|
|
@@ -1964,7 +2018,7 @@ function MessageList({
|
|
|
1964
2018
|
borderRadius: "18px 18px 18px 4px",
|
|
1965
2019
|
boxShadow: isLightTheme ? "inset 0 0 0 1px rgba(0,0,0,0.06)" : "inset 0 0 0 0.5px rgba(255,255,255,0.06), inset 0 1px 0 0 rgba(255,255,255,0.08)"
|
|
1966
2020
|
},
|
|
1967
|
-
children: /* @__PURE__ */ (0,
|
|
2021
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex gap-1.5 items-center", style: { height: 16 }, children: [0, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1968
2022
|
"span",
|
|
1969
2023
|
{
|
|
1970
2024
|
className: "rounded-full animate-bounce",
|
|
@@ -1980,7 +2034,7 @@ function MessageList({
|
|
|
1980
2034
|
)) })
|
|
1981
2035
|
}
|
|
1982
2036
|
),
|
|
1983
|
-
typingUser && /* @__PURE__ */ (0,
|
|
2037
|
+
typingUser && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1984
2038
|
"span",
|
|
1985
2039
|
{
|
|
1986
2040
|
className: "mt-1 px-1",
|
|
@@ -1997,14 +2051,14 @@ function MessageList({
|
|
|
1997
2051
|
)
|
|
1998
2052
|
] })
|
|
1999
2053
|
] }),
|
|
2000
|
-
isBotThinking && !isTyping && /* @__PURE__ */ (0,
|
|
2054
|
+
isBotThinking && !isTyping && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2001
2055
|
ThinkingIndicator,
|
|
2002
2056
|
{
|
|
2003
2057
|
theme,
|
|
2004
2058
|
lastUserMessage: messages.filter((m) => m.senderType === "customer").pop()?.content
|
|
2005
2059
|
}
|
|
2006
2060
|
),
|
|
2007
|
-
/* @__PURE__ */ (0,
|
|
2061
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref: messagesEndRef })
|
|
2008
2062
|
]
|
|
2009
2063
|
}
|
|
2010
2064
|
);
|
|
@@ -2014,7 +2068,7 @@ function MessageList({
|
|
|
2014
2068
|
var import_react8 = require("react");
|
|
2015
2069
|
var import_react_dom = require("react-dom");
|
|
2016
2070
|
var import_react9 = __toESM(require("@emoji-mart/react"));
|
|
2017
|
-
var
|
|
2071
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2018
2072
|
function isLightColor(color) {
|
|
2019
2073
|
let r = 0, g = 0, b = 0;
|
|
2020
2074
|
if (color.startsWith("#")) {
|
|
@@ -2192,7 +2246,7 @@ ${uploadedFile.markdown}
|
|
|
2192
2246
|
};
|
|
2193
2247
|
const canSend = message.trim().length > 0 && !disabled;
|
|
2194
2248
|
const placeholderColor = isLightTheme ? "rgba(0,0,0,0.35)" : "rgba(247,247,248,0.3)";
|
|
2195
|
-
return /* @__PURE__ */ (0,
|
|
2249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2196
2250
|
"div",
|
|
2197
2251
|
{
|
|
2198
2252
|
className: "px-4 py-3",
|
|
@@ -2200,7 +2254,7 @@ ${uploadedFile.markdown}
|
|
|
2200
2254
|
borderTop: isLightTheme ? "1px solid rgba(0,0,0,0.06)" : "1px solid rgba(255,255,255,0.06)"
|
|
2201
2255
|
},
|
|
2202
2256
|
children: [
|
|
2203
|
-
/* @__PURE__ */ (0,
|
|
2257
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2204
2258
|
"div",
|
|
2205
2259
|
{
|
|
2206
2260
|
className: "relative flex items-center rounded-full transition-all duration-200",
|
|
@@ -2212,8 +2266,8 @@ ${uploadedFile.markdown}
|
|
|
2212
2266
|
backdropFilter: "blur(32px)"
|
|
2213
2267
|
},
|
|
2214
2268
|
children: [
|
|
2215
|
-
/* @__PURE__ */ (0,
|
|
2216
|
-
/* @__PURE__ */ (0,
|
|
2269
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("style", { children: `.xchat-input::placeholder { color: ${placeholderColor}; }` }),
|
|
2270
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2217
2271
|
"textarea",
|
|
2218
2272
|
{
|
|
2219
2273
|
ref: textAreaRef,
|
|
@@ -2242,8 +2296,8 @@ ${uploadedFile.markdown}
|
|
|
2242
2296
|
disabled
|
|
2243
2297
|
}
|
|
2244
2298
|
),
|
|
2245
|
-
/* @__PURE__ */ (0,
|
|
2246
|
-
enableEmoji && /* @__PURE__ */ (0,
|
|
2299
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1 px-2 shrink-0", children: [
|
|
2300
|
+
enableEmoji && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2247
2301
|
"button",
|
|
2248
2302
|
{
|
|
2249
2303
|
ref: emojiButtonRef,
|
|
@@ -2273,7 +2327,7 @@ ${uploadedFile.markdown}
|
|
|
2273
2327
|
},
|
|
2274
2328
|
disabled,
|
|
2275
2329
|
"aria-label": "Add emoji",
|
|
2276
|
-
children: /* @__PURE__ */ (0,
|
|
2330
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2277
2331
|
"svg",
|
|
2278
2332
|
{
|
|
2279
2333
|
width: "18",
|
|
@@ -2286,18 +2340,18 @@ ${uploadedFile.markdown}
|
|
|
2286
2340
|
strokeLinejoin: "round",
|
|
2287
2341
|
"aria-hidden": "true",
|
|
2288
2342
|
children: [
|
|
2289
|
-
/* @__PURE__ */ (0,
|
|
2290
|
-
/* @__PURE__ */ (0,
|
|
2291
|
-
/* @__PURE__ */ (0,
|
|
2292
|
-
/* @__PURE__ */ (0,
|
|
2293
|
-
/* @__PURE__ */ (0,
|
|
2343
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("title", { children: "Emoji" }),
|
|
2344
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
2345
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M8 14s1.5 2 4 2 4-2 4-2" }),
|
|
2346
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "9", y1: "9", x2: "9.01", y2: "9" }),
|
|
2347
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "15", y1: "9", x2: "15.01", y2: "9" })
|
|
2294
2348
|
]
|
|
2295
2349
|
}
|
|
2296
2350
|
)
|
|
2297
2351
|
}
|
|
2298
2352
|
),
|
|
2299
|
-
enableFileUpload && fileUpload.canUpload && /* @__PURE__ */ (0,
|
|
2300
|
-
/* @__PURE__ */ (0,
|
|
2353
|
+
enableFileUpload && fileUpload.canUpload && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
2354
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2301
2355
|
"button",
|
|
2302
2356
|
{
|
|
2303
2357
|
type: "button",
|
|
@@ -2317,7 +2371,7 @@ ${uploadedFile.markdown}
|
|
|
2317
2371
|
},
|
|
2318
2372
|
disabled: disabled || fileUpload.isUploading,
|
|
2319
2373
|
"aria-label": "Attach file",
|
|
2320
|
-
children: fileUpload.isUploading ? /* @__PURE__ */ (0,
|
|
2374
|
+
children: fileUpload.isUploading ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2321
2375
|
"svg",
|
|
2322
2376
|
{
|
|
2323
2377
|
width: "18",
|
|
@@ -2329,11 +2383,11 @@ ${uploadedFile.markdown}
|
|
|
2329
2383
|
className: "animate-spin",
|
|
2330
2384
|
"aria-hidden": "true",
|
|
2331
2385
|
children: [
|
|
2332
|
-
/* @__PURE__ */ (0,
|
|
2333
|
-
/* @__PURE__ */ (0,
|
|
2386
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("title", { children: "Uploading" }),
|
|
2387
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M21 12a9 9 0 11-6.219-8.56" })
|
|
2334
2388
|
]
|
|
2335
2389
|
}
|
|
2336
|
-
) : /* @__PURE__ */ (0,
|
|
2390
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2337
2391
|
"svg",
|
|
2338
2392
|
{
|
|
2339
2393
|
width: "18",
|
|
@@ -2346,14 +2400,14 @@ ${uploadedFile.markdown}
|
|
|
2346
2400
|
strokeLinejoin: "round",
|
|
2347
2401
|
"aria-hidden": "true",
|
|
2348
2402
|
children: [
|
|
2349
|
-
/* @__PURE__ */ (0,
|
|
2350
|
-
/* @__PURE__ */ (0,
|
|
2403
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("title", { children: "Attach file" }),
|
|
2404
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48" })
|
|
2351
2405
|
]
|
|
2352
2406
|
}
|
|
2353
2407
|
)
|
|
2354
2408
|
}
|
|
2355
2409
|
),
|
|
2356
|
-
/* @__PURE__ */ (0,
|
|
2410
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2357
2411
|
"input",
|
|
2358
2412
|
{
|
|
2359
2413
|
ref: fileInputRef,
|
|
@@ -2364,7 +2418,7 @@ ${uploadedFile.markdown}
|
|
|
2364
2418
|
}
|
|
2365
2419
|
)
|
|
2366
2420
|
] }),
|
|
2367
|
-
/* @__PURE__ */ (0,
|
|
2421
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2368
2422
|
"button",
|
|
2369
2423
|
{
|
|
2370
2424
|
type: "button",
|
|
@@ -2379,7 +2433,7 @@ ${uploadedFile.markdown}
|
|
|
2379
2433
|
boxShadow: canSend ? `0 2px 8px -2px ${primaryColor}60` : "none"
|
|
2380
2434
|
},
|
|
2381
2435
|
"aria-label": "Send message",
|
|
2382
|
-
children: /* @__PURE__ */ (0,
|
|
2436
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2383
2437
|
"svg",
|
|
2384
2438
|
{
|
|
2385
2439
|
width: "18",
|
|
@@ -2392,9 +2446,9 @@ ${uploadedFile.markdown}
|
|
|
2392
2446
|
strokeLinejoin: "round",
|
|
2393
2447
|
"aria-hidden": "true",
|
|
2394
2448
|
children: [
|
|
2395
|
-
/* @__PURE__ */ (0,
|
|
2396
|
-
/* @__PURE__ */ (0,
|
|
2397
|
-
/* @__PURE__ */ (0,
|
|
2449
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("title", { children: "Send" }),
|
|
2450
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "22", y1: "2", x2: "11", y2: "13" }),
|
|
2451
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polygon", { points: "22 2 15 22 11 13 2 9 22 2" })
|
|
2398
2452
|
]
|
|
2399
2453
|
}
|
|
2400
2454
|
)
|
|
@@ -2404,8 +2458,8 @@ ${uploadedFile.markdown}
|
|
|
2404
2458
|
]
|
|
2405
2459
|
}
|
|
2406
2460
|
),
|
|
2407
|
-
fileUpload.isUploading && /* @__PURE__ */ (0,
|
|
2408
|
-
/* @__PURE__ */ (0,
|
|
2461
|
+
fileUpload.isUploading && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "mt-2 px-1", children: [
|
|
2462
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2409
2463
|
"div",
|
|
2410
2464
|
{
|
|
2411
2465
|
className: "w-full rounded-full overflow-hidden",
|
|
@@ -2413,7 +2467,7 @@ ${uploadedFile.markdown}
|
|
|
2413
2467
|
height: 3,
|
|
2414
2468
|
backgroundColor: isLightTheme ? "rgba(0,0,0,0.06)" : "rgba(255,255,255,0.06)"
|
|
2415
2469
|
},
|
|
2416
|
-
children: /* @__PURE__ */ (0,
|
|
2470
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2417
2471
|
"div",
|
|
2418
2472
|
{
|
|
2419
2473
|
className: "h-full rounded-full transition-all duration-300",
|
|
@@ -2425,7 +2479,7 @@ ${uploadedFile.markdown}
|
|
|
2425
2479
|
)
|
|
2426
2480
|
}
|
|
2427
2481
|
),
|
|
2428
|
-
/* @__PURE__ */ (0,
|
|
2482
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2429
2483
|
"p",
|
|
2430
2484
|
{
|
|
2431
2485
|
className: "mt-1",
|
|
@@ -2443,7 +2497,7 @@ ${uploadedFile.markdown}
|
|
|
2443
2497
|
)
|
|
2444
2498
|
] }),
|
|
2445
2499
|
showEmojiPicker && emojiData && emojiPickerPosition && typeof document !== "undefined" && (0, import_react_dom.createPortal)(
|
|
2446
|
-
/* @__PURE__ */ (0,
|
|
2500
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2447
2501
|
"div",
|
|
2448
2502
|
{
|
|
2449
2503
|
ref: emojiPickerRef,
|
|
@@ -2458,7 +2512,7 @@ ${uploadedFile.markdown}
|
|
|
2458
2512
|
"0 16px 48px -8px rgba(0,0,0,0.5)"
|
|
2459
2513
|
].join(", ")
|
|
2460
2514
|
},
|
|
2461
|
-
children: /* @__PURE__ */ (0,
|
|
2515
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2462
2516
|
import_react9.default,
|
|
2463
2517
|
{
|
|
2464
2518
|
data: emojiData,
|
|
@@ -2484,7 +2538,7 @@ ${uploadedFile.markdown}
|
|
|
2484
2538
|
}
|
|
2485
2539
|
|
|
2486
2540
|
// src/components/ChatWidget.tsx
|
|
2487
|
-
var
|
|
2541
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2488
2542
|
function getAnonymousUser() {
|
|
2489
2543
|
let anonId;
|
|
2490
2544
|
try {
|
|
@@ -2618,14 +2672,14 @@ function ChatWidget({
|
|
|
2618
2672
|
outlineOffset: -1,
|
|
2619
2673
|
transition: "outline 150ms ease"
|
|
2620
2674
|
};
|
|
2621
|
-
return /* @__PURE__ */ (0,
|
|
2675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2622
2676
|
"div",
|
|
2623
2677
|
{
|
|
2624
2678
|
className: isFullPage ? `flex flex-col h-full ${className}` : `fixed bottom-20 ${positionClass} z-50 flex flex-col overflow-hidden ${className}`,
|
|
2625
2679
|
style: { ...containerStyle, ...dotGridBg, ...edgeHintStyle },
|
|
2626
2680
|
...!isFullPage ? containerResizeProps : {},
|
|
2627
2681
|
children: [
|
|
2628
|
-
!isFullPage && /* @__PURE__ */ (0,
|
|
2682
|
+
!isFullPage && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2629
2683
|
ChatHeader,
|
|
2630
2684
|
{
|
|
2631
2685
|
agent: effectiveUser.type === "customer" ? {
|
|
@@ -2639,7 +2693,7 @@ function ChatWidget({
|
|
|
2639
2693
|
theme: config.theme
|
|
2640
2694
|
}
|
|
2641
2695
|
),
|
|
2642
|
-
!websocket.isConnected && /* @__PURE__ */ (0,
|
|
2696
|
+
!websocket.isConnected && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2643
2697
|
"div",
|
|
2644
2698
|
{
|
|
2645
2699
|
className: "px-4 py-2",
|
|
@@ -2647,15 +2701,15 @@ function ChatWidget({
|
|
|
2647
2701
|
backgroundColor: isLightTheme ? "rgba(255,169,56,0.08)" : "rgba(255,169,56,0.06)",
|
|
2648
2702
|
borderBottom: `1px solid rgba(255,169,56,${isLightTheme ? "0.15" : "0.12"})`
|
|
2649
2703
|
},
|
|
2650
|
-
children: /* @__PURE__ */ (0,
|
|
2651
|
-
/* @__PURE__ */ (0,
|
|
2704
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2705
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2652
2706
|
"div",
|
|
2653
2707
|
{
|
|
2654
2708
|
className: "w-1.5 h-1.5 rounded-full animate-pulse",
|
|
2655
2709
|
style: { backgroundColor: config.theme?.statusCaution || "#ffa938" }
|
|
2656
2710
|
}
|
|
2657
2711
|
),
|
|
2658
|
-
/* @__PURE__ */ (0,
|
|
2712
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2659
2713
|
"span",
|
|
2660
2714
|
{
|
|
2661
2715
|
style: {
|
|
@@ -2666,7 +2720,7 @@ function ChatWidget({
|
|
|
2666
2720
|
children: "Reconnecting..."
|
|
2667
2721
|
}
|
|
2668
2722
|
),
|
|
2669
|
-
/* @__PURE__ */ (0,
|
|
2723
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2670
2724
|
"button",
|
|
2671
2725
|
{
|
|
2672
2726
|
type: "button",
|
|
@@ -2690,8 +2744,8 @@ function ChatWidget({
|
|
|
2690
2744
|
] })
|
|
2691
2745
|
}
|
|
2692
2746
|
),
|
|
2693
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
2694
|
-
/* @__PURE__ */ (0,
|
|
2747
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "text-center", children: [
|
|
2748
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2695
2749
|
"div",
|
|
2696
2750
|
{
|
|
2697
2751
|
className: "w-7 h-7 border-2 border-t-transparent rounded-full animate-spin mx-auto mb-3",
|
|
@@ -2701,7 +2755,7 @@ function ChatWidget({
|
|
|
2701
2755
|
}
|
|
2702
2756
|
}
|
|
2703
2757
|
),
|
|
2704
|
-
/* @__PURE__ */ (0,
|
|
2758
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2705
2759
|
"p",
|
|
2706
2760
|
{
|
|
2707
2761
|
style: {
|
|
@@ -2712,7 +2766,7 @@ function ChatWidget({
|
|
|
2712
2766
|
children: "Loading messages..."
|
|
2713
2767
|
}
|
|
2714
2768
|
)
|
|
2715
|
-
] }) }) : /* @__PURE__ */ (0,
|
|
2769
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2716
2770
|
MessageList,
|
|
2717
2771
|
{
|
|
2718
2772
|
messages,
|
|
@@ -2728,7 +2782,7 @@ function ChatWidget({
|
|
|
2728
2782
|
isBotThinking
|
|
2729
2783
|
}
|
|
2730
2784
|
),
|
|
2731
|
-
/* @__PURE__ */ (0,
|
|
2785
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2732
2786
|
ChatInput,
|
|
2733
2787
|
{
|
|
2734
2788
|
onSend: handleSendMessage,
|
|
@@ -2738,7 +2792,7 @@ function ChatWidget({
|
|
|
2738
2792
|
disabled: !websocket.isConnected
|
|
2739
2793
|
}
|
|
2740
2794
|
),
|
|
2741
|
-
!isFullPage && /* @__PURE__ */ (0,
|
|
2795
|
+
!isFullPage && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2742
2796
|
"div",
|
|
2743
2797
|
{
|
|
2744
2798
|
className: "px-4 py-1.5 text-center",
|
|
@@ -2746,7 +2800,7 @@ function ChatWidget({
|
|
|
2746
2800
|
borderTop: isLightTheme ? "1px solid rgba(0,0,0,0.06)" : "1px solid rgba(255,255,255,0.06)",
|
|
2747
2801
|
backgroundColor: isLightTheme ? "rgba(0,0,0,0.03)" : "rgba(0,0,0,0.2)"
|
|
2748
2802
|
},
|
|
2749
|
-
children: /* @__PURE__ */ (0,
|
|
2803
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2750
2804
|
"p",
|
|
2751
2805
|
{
|
|
2752
2806
|
style: {
|
|
@@ -2757,7 +2811,7 @@ function ChatWidget({
|
|
|
2757
2811
|
children: [
|
|
2758
2812
|
"Powered by",
|
|
2759
2813
|
" ",
|
|
2760
|
-
/* @__PURE__ */ (0,
|
|
2814
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: {
|
|
2761
2815
|
fontWeight: 600,
|
|
2762
2816
|
color: isLightTheme ? "rgba(0,0,0,0.5)" : "rgba(247,247,248,0.45)"
|
|
2763
2817
|
}, children: "Xcelsior" })
|
|
@@ -2776,7 +2830,7 @@ var import_react14 = require("react");
|
|
|
2776
2830
|
|
|
2777
2831
|
// src/components/PreChatForm.tsx
|
|
2778
2832
|
var import_react11 = require("react");
|
|
2779
|
-
var
|
|
2833
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2780
2834
|
function PreChatForm({
|
|
2781
2835
|
onSubmit,
|
|
2782
2836
|
className = "",
|
|
@@ -2837,7 +2891,7 @@ function PreChatForm({
|
|
|
2837
2891
|
transition: "box-shadow 0.2s ease",
|
|
2838
2892
|
caretColor: "#337eff"
|
|
2839
2893
|
});
|
|
2840
|
-
return /* @__PURE__ */ (0,
|
|
2894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2841
2895
|
"div",
|
|
2842
2896
|
{
|
|
2843
2897
|
className: `fixed bottom-4 right-4 z-50 flex flex-col overflow-hidden ${className}`,
|
|
@@ -2857,7 +2911,7 @@ function PreChatForm({
|
|
|
2857
2911
|
backgroundSize: "24px 24px"
|
|
2858
2912
|
},
|
|
2859
2913
|
children: [
|
|
2860
|
-
/* @__PURE__ */ (0,
|
|
2914
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2861
2915
|
"div",
|
|
2862
2916
|
{
|
|
2863
2917
|
className: "relative text-white overflow-hidden",
|
|
@@ -2865,7 +2919,7 @@ function PreChatForm({
|
|
|
2865
2919
|
background: "linear-gradient(135deg, #337eff 0%, #005eff 50%, #001a66 100%)"
|
|
2866
2920
|
},
|
|
2867
2921
|
children: [
|
|
2868
|
-
/* @__PURE__ */ (0,
|
|
2922
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2869
2923
|
"div",
|
|
2870
2924
|
{
|
|
2871
2925
|
className: "absolute inset-0 pointer-events-none",
|
|
@@ -2874,9 +2928,9 @@ function PreChatForm({
|
|
|
2874
2928
|
}
|
|
2875
2929
|
}
|
|
2876
2930
|
),
|
|
2877
|
-
/* @__PURE__ */ (0,
|
|
2878
|
-
/* @__PURE__ */ (0,
|
|
2879
|
-
/* @__PURE__ */ (0,
|
|
2931
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "relative px-5 py-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-start justify-between", children: [
|
|
2932
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex-1", children: [
|
|
2933
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2880
2934
|
"h2",
|
|
2881
2935
|
{
|
|
2882
2936
|
className: "font-semibold",
|
|
@@ -2887,7 +2941,7 @@ function PreChatForm({
|
|
|
2887
2941
|
children: "Start a Conversation"
|
|
2888
2942
|
}
|
|
2889
2943
|
),
|
|
2890
|
-
/* @__PURE__ */ (0,
|
|
2944
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2891
2945
|
"p",
|
|
2892
2946
|
{
|
|
2893
2947
|
className: "mt-1",
|
|
@@ -2900,8 +2954,8 @@ function PreChatForm({
|
|
|
2900
2954
|
}
|
|
2901
2955
|
)
|
|
2902
2956
|
] }),
|
|
2903
|
-
/* @__PURE__ */ (0,
|
|
2904
|
-
/* @__PURE__ */ (0,
|
|
2957
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex gap-1 ml-2", children: [
|
|
2958
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2905
2959
|
"button",
|
|
2906
2960
|
{
|
|
2907
2961
|
type: "button",
|
|
@@ -2915,7 +2969,7 @@ function PreChatForm({
|
|
|
2915
2969
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
2916
2970
|
},
|
|
2917
2971
|
"aria-label": "Minimize chat",
|
|
2918
|
-
children: /* @__PURE__ */ (0,
|
|
2972
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2919
2973
|
"svg",
|
|
2920
2974
|
{
|
|
2921
2975
|
width: "18",
|
|
@@ -2924,8 +2978,8 @@ function PreChatForm({
|
|
|
2924
2978
|
stroke: "currentColor",
|
|
2925
2979
|
viewBox: "0 0 24 24",
|
|
2926
2980
|
children: [
|
|
2927
|
-
/* @__PURE__ */ (0,
|
|
2928
|
-
/* @__PURE__ */ (0,
|
|
2981
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("title", { children: "Minimize" }),
|
|
2982
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2929
2983
|
"path",
|
|
2930
2984
|
{
|
|
2931
2985
|
strokeLinecap: "round",
|
|
@@ -2939,7 +2993,7 @@ function PreChatForm({
|
|
|
2939
2993
|
)
|
|
2940
2994
|
}
|
|
2941
2995
|
),
|
|
2942
|
-
/* @__PURE__ */ (0,
|
|
2996
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2943
2997
|
"button",
|
|
2944
2998
|
{
|
|
2945
2999
|
type: "button",
|
|
@@ -2953,7 +3007,7 @@ function PreChatForm({
|
|
|
2953
3007
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
2954
3008
|
},
|
|
2955
3009
|
"aria-label": "Close chat",
|
|
2956
|
-
children: /* @__PURE__ */ (0,
|
|
3010
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2957
3011
|
"svg",
|
|
2958
3012
|
{
|
|
2959
3013
|
width: "18",
|
|
@@ -2962,8 +3016,8 @@ function PreChatForm({
|
|
|
2962
3016
|
stroke: "currentColor",
|
|
2963
3017
|
viewBox: "0 0 24 24",
|
|
2964
3018
|
children: [
|
|
2965
|
-
/* @__PURE__ */ (0,
|
|
2966
|
-
/* @__PURE__ */ (0,
|
|
3019
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("title", { children: "Close" }),
|
|
3020
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2967
3021
|
"path",
|
|
2968
3022
|
{
|
|
2969
3023
|
strokeLinecap: "round",
|
|
@@ -2979,7 +3033,7 @@ function PreChatForm({
|
|
|
2979
3033
|
)
|
|
2980
3034
|
] })
|
|
2981
3035
|
] }) }),
|
|
2982
|
-
/* @__PURE__ */ (0,
|
|
3036
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2983
3037
|
"div",
|
|
2984
3038
|
{
|
|
2985
3039
|
className: "h-px",
|
|
@@ -2991,9 +3045,9 @@ function PreChatForm({
|
|
|
2991
3045
|
]
|
|
2992
3046
|
}
|
|
2993
3047
|
),
|
|
2994
|
-
/* @__PURE__ */ (0,
|
|
2995
|
-
/* @__PURE__ */ (0,
|
|
2996
|
-
/* @__PURE__ */ (0,
|
|
3048
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("form", { onSubmit: handleSubmit, className: "p-5 flex flex-col gap-4", children: [
|
|
3049
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
|
|
3050
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2997
3051
|
"label",
|
|
2998
3052
|
{
|
|
2999
3053
|
htmlFor: "chat-name",
|
|
@@ -3005,11 +3059,11 @@ function PreChatForm({
|
|
|
3005
3059
|
},
|
|
3006
3060
|
children: [
|
|
3007
3061
|
"Name ",
|
|
3008
|
-
/* @__PURE__ */ (0,
|
|
3062
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { color: "#ff6363" }, children: "*" })
|
|
3009
3063
|
]
|
|
3010
3064
|
}
|
|
3011
3065
|
),
|
|
3012
|
-
/* @__PURE__ */ (0,
|
|
3066
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3013
3067
|
"input",
|
|
3014
3068
|
{
|
|
3015
3069
|
type: "text",
|
|
@@ -3029,7 +3083,7 @@ function PreChatForm({
|
|
|
3029
3083
|
autoComplete: "name"
|
|
3030
3084
|
}
|
|
3031
3085
|
),
|
|
3032
|
-
errors.name && /* @__PURE__ */ (0,
|
|
3086
|
+
errors.name && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3033
3087
|
"p",
|
|
3034
3088
|
{
|
|
3035
3089
|
className: "mt-1.5",
|
|
@@ -3043,8 +3097,8 @@ function PreChatForm({
|
|
|
3043
3097
|
}
|
|
3044
3098
|
)
|
|
3045
3099
|
] }),
|
|
3046
|
-
/* @__PURE__ */ (0,
|
|
3047
|
-
/* @__PURE__ */ (0,
|
|
3100
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
|
|
3101
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3048
3102
|
"label",
|
|
3049
3103
|
{
|
|
3050
3104
|
htmlFor: "chat-email",
|
|
@@ -3056,11 +3110,11 @@ function PreChatForm({
|
|
|
3056
3110
|
},
|
|
3057
3111
|
children: [
|
|
3058
3112
|
"Email ",
|
|
3059
|
-
/* @__PURE__ */ (0,
|
|
3113
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { color: "#ff6363" }, children: "*" })
|
|
3060
3114
|
]
|
|
3061
3115
|
}
|
|
3062
3116
|
),
|
|
3063
|
-
/* @__PURE__ */ (0,
|
|
3117
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3064
3118
|
"input",
|
|
3065
3119
|
{
|
|
3066
3120
|
type: "email",
|
|
@@ -3080,7 +3134,7 @@ function PreChatForm({
|
|
|
3080
3134
|
autoComplete: "email"
|
|
3081
3135
|
}
|
|
3082
3136
|
),
|
|
3083
|
-
errors.email && /* @__PURE__ */ (0,
|
|
3137
|
+
errors.email && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3084
3138
|
"p",
|
|
3085
3139
|
{
|
|
3086
3140
|
className: "mt-1.5",
|
|
@@ -3094,7 +3148,7 @@ function PreChatForm({
|
|
|
3094
3148
|
}
|
|
3095
3149
|
)
|
|
3096
3150
|
] }),
|
|
3097
|
-
/* @__PURE__ */ (0,
|
|
3151
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3098
3152
|
"button",
|
|
3099
3153
|
{
|
|
3100
3154
|
type: "submit",
|
|
@@ -3116,8 +3170,8 @@ function PreChatForm({
|
|
|
3116
3170
|
onMouseLeave: (e) => {
|
|
3117
3171
|
e.currentTarget.style.boxShadow = "0 4px 16px -4px rgba(51,126,255,0.4)";
|
|
3118
3172
|
},
|
|
3119
|
-
children: isSubmitting ? /* @__PURE__ */ (0,
|
|
3120
|
-
/* @__PURE__ */ (0,
|
|
3173
|
+
children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center justify-center gap-2", children: [
|
|
3174
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3121
3175
|
"svg",
|
|
3122
3176
|
{
|
|
3123
3177
|
className: "animate-spin",
|
|
@@ -3129,8 +3183,8 @@ function PreChatForm({
|
|
|
3129
3183
|
strokeWidth: "2",
|
|
3130
3184
|
"aria-label": "Loading",
|
|
3131
3185
|
children: [
|
|
3132
|
-
/* @__PURE__ */ (0,
|
|
3133
|
-
/* @__PURE__ */ (0,
|
|
3186
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("title", { children: "Loading" }),
|
|
3187
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M21 12a9 9 0 11-6.219-8.56" })
|
|
3134
3188
|
]
|
|
3135
3189
|
}
|
|
3136
3190
|
),
|
|
@@ -3138,7 +3192,7 @@ function PreChatForm({
|
|
|
3138
3192
|
] }) : "Start Chat"
|
|
3139
3193
|
}
|
|
3140
3194
|
),
|
|
3141
|
-
/* @__PURE__ */ (0,
|
|
3195
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3142
3196
|
"p",
|
|
3143
3197
|
{
|
|
3144
3198
|
className: "text-center",
|
|
@@ -3151,7 +3205,7 @@ function PreChatForm({
|
|
|
3151
3205
|
}
|
|
3152
3206
|
)
|
|
3153
3207
|
] }),
|
|
3154
|
-
/* @__PURE__ */ (0,
|
|
3208
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3155
3209
|
"div",
|
|
3156
3210
|
{
|
|
3157
3211
|
className: "px-4 py-1.5 text-center",
|
|
@@ -3159,7 +3213,7 @@ function PreChatForm({
|
|
|
3159
3213
|
borderTop: "1px solid rgba(255,255,255,0.06)",
|
|
3160
3214
|
backgroundColor: "rgba(0,0,0,0.2)"
|
|
3161
3215
|
},
|
|
3162
|
-
children: /* @__PURE__ */ (0,
|
|
3216
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3163
3217
|
"p",
|
|
3164
3218
|
{
|
|
3165
3219
|
style: {
|
|
@@ -3170,7 +3224,7 @@ function PreChatForm({
|
|
|
3170
3224
|
children: [
|
|
3171
3225
|
"Powered by",
|
|
3172
3226
|
" ",
|
|
3173
|
-
/* @__PURE__ */ (0,
|
|
3227
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontWeight: 600, color: "rgba(247,247,248,0.45)" }, children: "Xcelsior" })
|
|
3174
3228
|
]
|
|
3175
3229
|
}
|
|
3176
3230
|
)
|
|
@@ -3284,7 +3338,7 @@ function useChatWidgetState({
|
|
|
3284
3338
|
}
|
|
3285
3339
|
|
|
3286
3340
|
// src/components/Chat.tsx
|
|
3287
|
-
var
|
|
3341
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
3288
3342
|
function generateSessionId() {
|
|
3289
3343
|
if (typeof crypto !== "undefined" && crypto.randomUUID) {
|
|
3290
3344
|
return crypto.randomUUID();
|
|
@@ -3415,7 +3469,7 @@ function Chat({
|
|
|
3415
3469
|
const primaryColor = config.theme?.primary || "#337eff";
|
|
3416
3470
|
const primaryStrong = config.theme?.primaryStrong || "#005eff";
|
|
3417
3471
|
if (currentState === "minimized") {
|
|
3418
|
-
return /* @__PURE__ */ (0,
|
|
3472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: `fixed bottom-5 ${positionClass} z-50 ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
3419
3473
|
"button",
|
|
3420
3474
|
{
|
|
3421
3475
|
type: "button",
|
|
@@ -3440,8 +3494,8 @@ function Chat({
|
|
|
3440
3494
|
"aria-label": "Open chat",
|
|
3441
3495
|
...handlers,
|
|
3442
3496
|
children: [
|
|
3443
|
-
/* @__PURE__ */ (0,
|
|
3444
|
-
/* @__PURE__ */ (0,
|
|
3497
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChatBubbleIcon, { size: 28, color: "white", className: "pointer-events-none" }),
|
|
3498
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3445
3499
|
"span",
|
|
3446
3500
|
{
|
|
3447
3501
|
className: "absolute inset-0 rounded-full animate-ping pointer-events-none",
|
|
@@ -3457,7 +3511,7 @@ function Chat({
|
|
|
3457
3511
|
) });
|
|
3458
3512
|
}
|
|
3459
3513
|
if (identityMode === "form" && (!userInfo || !userInfo.email || !userInfo.name)) {
|
|
3460
|
-
return /* @__PURE__ */ (0,
|
|
3514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3461
3515
|
PreChatForm,
|
|
3462
3516
|
{
|
|
3463
3517
|
onSubmit: handlePreChatSubmit,
|
|
@@ -3483,7 +3537,7 @@ function Chat({
|
|
|
3483
3537
|
transform: "translateY(12px) scale(0.97)",
|
|
3484
3538
|
transition: "opacity 0.2s ease-in, transform 0.2s ease-in"
|
|
3485
3539
|
};
|
|
3486
|
-
return /* @__PURE__ */ (0,
|
|
3540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: widgetAnimationStyle, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3487
3541
|
ChatWidget,
|
|
3488
3542
|
{
|
|
3489
3543
|
config: fullConfig,
|
|
@@ -3496,12 +3550,12 @@ function Chat({
|
|
|
3496
3550
|
}
|
|
3497
3551
|
|
|
3498
3552
|
// src/components/TypingIndicator.tsx
|
|
3499
|
-
var
|
|
3553
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
3500
3554
|
function TypingIndicator({ isTyping, userName }) {
|
|
3501
3555
|
if (!isTyping) {
|
|
3502
3556
|
return null;
|
|
3503
3557
|
}
|
|
3504
|
-
return /* @__PURE__ */ (0,
|
|
3558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3505
3559
|
"div",
|
|
3506
3560
|
{
|
|
3507
3561
|
className: "px-4 py-2",
|
|
@@ -3509,8 +3563,8 @@ function TypingIndicator({ isTyping, userName }) {
|
|
|
3509
3563
|
borderTop: "1px solid rgba(255,255,255,0.06)",
|
|
3510
3564
|
backgroundColor: "rgba(0,0,0,0.15)"
|
|
3511
3565
|
},
|
|
3512
|
-
children: /* @__PURE__ */ (0,
|
|
3513
|
-
/* @__PURE__ */ (0,
|
|
3566
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3567
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex gap-1", children: [0, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3514
3568
|
"span",
|
|
3515
3569
|
{
|
|
3516
3570
|
className: "rounded-full animate-bounce",
|
|
@@ -3524,7 +3578,7 @@ function TypingIndicator({ isTyping, userName }) {
|
|
|
3524
3578
|
},
|
|
3525
3579
|
i
|
|
3526
3580
|
)) }),
|
|
3527
|
-
/* @__PURE__ */ (0,
|
|
3581
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3528
3582
|
"span",
|
|
3529
3583
|
{
|
|
3530
3584
|
style: {
|