@xcelsior/ui-chat 2.0.1 → 2.0.2
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.js +225 -182
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +225 -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/dist/index.js
CHANGED
|
@@ -963,7 +963,50 @@ function ChatHeader({ agent, onClose, onMinimize, theme }) {
|
|
|
963
963
|
|
|
964
964
|
// src/components/MessageList.tsx
|
|
965
965
|
var import_react7 = require("react");
|
|
966
|
-
|
|
966
|
+
|
|
967
|
+
// src/components/Spinner.tsx
|
|
968
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
969
|
+
var SIZE_MAP = {
|
|
970
|
+
sm: 16,
|
|
971
|
+
md: 24,
|
|
972
|
+
lg: 36
|
|
973
|
+
};
|
|
974
|
+
var BORDER_MAP = {
|
|
975
|
+
sm: 2,
|
|
976
|
+
md: 2,
|
|
977
|
+
lg: 3
|
|
978
|
+
};
|
|
979
|
+
function Spinner({ size = "md", color = "currentColor" }) {
|
|
980
|
+
const px = SIZE_MAP[size];
|
|
981
|
+
const border = BORDER_MAP[size];
|
|
982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
983
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("style", { children: `
|
|
984
|
+
@keyframes xchat-spin {
|
|
985
|
+
to { transform: rotate(360deg); }
|
|
986
|
+
}
|
|
987
|
+
.xchat-spinner {
|
|
988
|
+
animation: xchat-spin 0.75s linear infinite;
|
|
989
|
+
border-radius: 50%;
|
|
990
|
+
display: inline-block;
|
|
991
|
+
flex-shrink: 0;
|
|
992
|
+
}
|
|
993
|
+
` }),
|
|
994
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
995
|
+
"span",
|
|
996
|
+
{
|
|
997
|
+
className: "xchat-spinner",
|
|
998
|
+
role: "status",
|
|
999
|
+
"aria-label": "Loading",
|
|
1000
|
+
style: {
|
|
1001
|
+
width: px,
|
|
1002
|
+
height: px,
|
|
1003
|
+
border: `${border}px solid rgba(128,128,128,0.25)`,
|
|
1004
|
+
borderTopColor: color
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
)
|
|
1008
|
+
] });
|
|
1009
|
+
}
|
|
967
1010
|
|
|
968
1011
|
// src/components/MessageItem.tsx
|
|
969
1012
|
var import_date_fns = require("date-fns");
|
|
@@ -1058,7 +1101,7 @@ function getMarkdownStyles(theme, isLightTheme) {
|
|
|
1058
1101
|
}
|
|
1059
1102
|
|
|
1060
1103
|
// src/components/MarkdownMessage.tsx
|
|
1061
|
-
var
|
|
1104
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1062
1105
|
function computeIsLightTheme(theme) {
|
|
1063
1106
|
const bgColor = theme?.background || "#00001a";
|
|
1064
1107
|
if (!bgColor.startsWith("#")) return false;
|
|
@@ -1077,18 +1120,18 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1077
1120
|
// inside the bubble.
|
|
1078
1121
|
display: "block"
|
|
1079
1122
|
};
|
|
1080
|
-
return /* @__PURE__ */ (0,
|
|
1123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: wrapperStyle, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1081
1124
|
import_react_markdown.default,
|
|
1082
1125
|
{
|
|
1083
1126
|
components: {
|
|
1084
1127
|
// Paragraphs
|
|
1085
|
-
p: ({ children }) => /* @__PURE__ */ (0,
|
|
1128
|
+
p: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: styles.paragraph, children }),
|
|
1086
1129
|
// Bold
|
|
1087
|
-
strong: ({ children }) => /* @__PURE__ */ (0,
|
|
1130
|
+
strong: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { style: styles.strong, children }),
|
|
1088
1131
|
// Italic
|
|
1089
|
-
em: ({ children }) => /* @__PURE__ */ (0,
|
|
1132
|
+
em: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("em", { style: styles.emphasis, children }),
|
|
1090
1133
|
// Links — open in new tab
|
|
1091
|
-
a: ({ href, children }) => /* @__PURE__ */ (0,
|
|
1134
|
+
a: ({ href, children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1092
1135
|
"a",
|
|
1093
1136
|
{
|
|
1094
1137
|
href,
|
|
@@ -1099,9 +1142,9 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1099
1142
|
}
|
|
1100
1143
|
),
|
|
1101
1144
|
// Unordered list
|
|
1102
|
-
ul: ({ children }) => /* @__PURE__ */ (0,
|
|
1145
|
+
ul: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { style: { ...styles.list, listStyleType: "disc" }, children }),
|
|
1103
1146
|
// Ordered list
|
|
1104
|
-
ol: ({ children }) => /* @__PURE__ */ (0,
|
|
1147
|
+
ol: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1105
1148
|
"ol",
|
|
1106
1149
|
{
|
|
1107
1150
|
style: { ...styles.list, listStyleType: "decimal" },
|
|
@@ -1109,7 +1152,7 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1109
1152
|
}
|
|
1110
1153
|
),
|
|
1111
1154
|
// List item
|
|
1112
|
-
li: ({ children }) => /* @__PURE__ */ (0,
|
|
1155
|
+
li: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", { style: styles.listItem, children }),
|
|
1113
1156
|
// Inline code vs code block — react-markdown wraps fenced
|
|
1114
1157
|
// code blocks as <pre><code className="language-*">. The
|
|
1115
1158
|
// cleanest heuristic: if the className starts with
|
|
@@ -1119,7 +1162,7 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1119
1162
|
className?.startsWith("language-")
|
|
1120
1163
|
);
|
|
1121
1164
|
if (isBlock) {
|
|
1122
|
-
return /* @__PURE__ */ (0,
|
|
1165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1123
1166
|
"code",
|
|
1124
1167
|
{
|
|
1125
1168
|
className,
|
|
@@ -1128,10 +1171,10 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1128
1171
|
}
|
|
1129
1172
|
);
|
|
1130
1173
|
}
|
|
1131
|
-
return /* @__PURE__ */ (0,
|
|
1174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { style: styles.code, children });
|
|
1132
1175
|
}),
|
|
1133
1176
|
// Pre wrapper for code blocks
|
|
1134
|
-
pre: ({ children }) => /* @__PURE__ */ (0,
|
|
1177
|
+
pre: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1135
1178
|
"pre",
|
|
1136
1179
|
{
|
|
1137
1180
|
style: {
|
|
@@ -1145,7 +1188,7 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1145
1188
|
}
|
|
1146
1189
|
),
|
|
1147
1190
|
// Headings — h1 through h6 with progressive size reduction
|
|
1148
|
-
h1: ({ children }) => /* @__PURE__ */ (0,
|
|
1191
|
+
h1: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1149
1192
|
"h1",
|
|
1150
1193
|
{
|
|
1151
1194
|
style: {
|
|
@@ -1155,7 +1198,7 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1155
1198
|
children
|
|
1156
1199
|
}
|
|
1157
1200
|
),
|
|
1158
|
-
h2: ({ children }) => /* @__PURE__ */ (0,
|
|
1201
|
+
h2: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1159
1202
|
"h2",
|
|
1160
1203
|
{
|
|
1161
1204
|
style: {
|
|
@@ -1165,7 +1208,7 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1165
1208
|
children
|
|
1166
1209
|
}
|
|
1167
1210
|
),
|
|
1168
|
-
h3: ({ children }) => /* @__PURE__ */ (0,
|
|
1211
|
+
h3: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1169
1212
|
"h3",
|
|
1170
1213
|
{
|
|
1171
1214
|
style: {
|
|
@@ -1175,8 +1218,8 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1175
1218
|
children
|
|
1176
1219
|
}
|
|
1177
1220
|
),
|
|
1178
|
-
h4: ({ children }) => /* @__PURE__ */ (0,
|
|
1179
|
-
h5: ({ children }) => /* @__PURE__ */ (0,
|
|
1221
|
+
h4: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h4", { style: { ...styles.heading, fontSize: "1em" }, children }),
|
|
1222
|
+
h5: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1180
1223
|
"h5",
|
|
1181
1224
|
{
|
|
1182
1225
|
style: {
|
|
@@ -1186,7 +1229,7 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1186
1229
|
children
|
|
1187
1230
|
}
|
|
1188
1231
|
),
|
|
1189
|
-
h6: ({ children }) => /* @__PURE__ */ (0,
|
|
1232
|
+
h6: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1190
1233
|
"h6",
|
|
1191
1234
|
{
|
|
1192
1235
|
style: {
|
|
@@ -1197,9 +1240,9 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1197
1240
|
}
|
|
1198
1241
|
),
|
|
1199
1242
|
// Blockquote
|
|
1200
|
-
blockquote: ({ children }) => /* @__PURE__ */ (0,
|
|
1243
|
+
blockquote: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("blockquote", { style: styles.blockquote, children }),
|
|
1201
1244
|
// Horizontal rule
|
|
1202
|
-
hr: () => /* @__PURE__ */ (0,
|
|
1245
|
+
hr: () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("hr", { style: styles.hr })
|
|
1203
1246
|
},
|
|
1204
1247
|
children: content
|
|
1205
1248
|
}
|
|
@@ -1207,7 +1250,7 @@ function MarkdownMessage({ content, theme }) {
|
|
|
1207
1250
|
}
|
|
1208
1251
|
|
|
1209
1252
|
// src/components/MessageItem.tsx
|
|
1210
|
-
var
|
|
1253
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1211
1254
|
function MessageItem({
|
|
1212
1255
|
message,
|
|
1213
1256
|
currentUser,
|
|
@@ -1233,7 +1276,7 @@ function MessageItem({
|
|
|
1233
1276
|
const textColor = theme?.text || (isLightTheme ? "#1a1a2e" : "#f7f7f8");
|
|
1234
1277
|
const textMuted = theme?.textMuted || (isLightTheme ? "rgba(0,0,0,0.35)" : "rgba(247,247,248,0.35)");
|
|
1235
1278
|
if (isSystemMessage) {
|
|
1236
|
-
return /* @__PURE__ */ (0,
|
|
1279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex justify-center my-3", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1237
1280
|
"div",
|
|
1238
1281
|
{
|
|
1239
1282
|
className: "px-4 py-1.5 rounded-full",
|
|
@@ -1241,7 +1284,7 @@ function MessageItem({
|
|
|
1241
1284
|
backgroundColor: isLightTheme ? "rgba(0,0,0,0.04)" : "rgba(255,255,255,0.03)",
|
|
1242
1285
|
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
1286
|
},
|
|
1244
|
-
children: /* @__PURE__ */ (0,
|
|
1287
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1245
1288
|
"p",
|
|
1246
1289
|
{
|
|
1247
1290
|
style: {
|
|
@@ -1280,12 +1323,12 @@ function MessageItem({
|
|
|
1280
1323
|
borderRadius: "18px 18px 18px 4px",
|
|
1281
1324
|
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
1325
|
};
|
|
1283
|
-
return /* @__PURE__ */ (0,
|
|
1326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1284
1327
|
"div",
|
|
1285
1328
|
{
|
|
1286
1329
|
className: `flex gap-2.5 mb-3 ${isOwnMessage ? "flex-row-reverse" : "flex-row"}`,
|
|
1287
1330
|
children: [
|
|
1288
|
-
showAvatar && !isOwnMessage && /* @__PURE__ */ (0,
|
|
1331
|
+
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
1332
|
"div",
|
|
1290
1333
|
{
|
|
1291
1334
|
className: "h-7 w-7 rounded-full flex items-center justify-center",
|
|
@@ -1293,7 +1336,7 @@ function MessageItem({
|
|
|
1293
1336
|
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
1337
|
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
1338
|
},
|
|
1296
|
-
children: /* @__PURE__ */ (0,
|
|
1339
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1297
1340
|
"svg",
|
|
1298
1341
|
{
|
|
1299
1342
|
width: "14",
|
|
@@ -1306,21 +1349,21 @@ function MessageItem({
|
|
|
1306
1349
|
strokeLinejoin: "round",
|
|
1307
1350
|
"aria-hidden": "true",
|
|
1308
1351
|
children: [
|
|
1309
|
-
/* @__PURE__ */ (0,
|
|
1310
|
-
/* @__PURE__ */ (0,
|
|
1311
|
-
/* @__PURE__ */ (0,
|
|
1352
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("title", { children: "Agent" }),
|
|
1353
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M3 18v-6a9 9 0 0 1 18 0v6" }),
|
|
1354
|
+
/* @__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
1355
|
]
|
|
1313
1356
|
}
|
|
1314
1357
|
)
|
|
1315
1358
|
}
|
|
1316
1359
|
) }),
|
|
1317
|
-
showAvatar && isOwnMessage && /* @__PURE__ */ (0,
|
|
1318
|
-
/* @__PURE__ */ (0,
|
|
1360
|
+
showAvatar && isOwnMessage && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "w-7 flex-shrink-0" }),
|
|
1361
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1319
1362
|
"div",
|
|
1320
1363
|
{
|
|
1321
1364
|
className: `flex flex-col max-w-[75%] ${isOwnMessage ? "items-end" : "items-start"}`,
|
|
1322
1365
|
children: [
|
|
1323
|
-
senderLabel && /* @__PURE__ */ (0,
|
|
1366
|
+
senderLabel && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1324
1367
|
"span",
|
|
1325
1368
|
{
|
|
1326
1369
|
className: "mb-1 px-1 font-medium",
|
|
@@ -1332,7 +1375,7 @@ function MessageItem({
|
|
|
1332
1375
|
children: senderLabel
|
|
1333
1376
|
}
|
|
1334
1377
|
),
|
|
1335
|
-
/* @__PURE__ */ (0,
|
|
1378
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1336
1379
|
"div",
|
|
1337
1380
|
{
|
|
1338
1381
|
className: "px-4 py-2.5",
|
|
@@ -1345,12 +1388,12 @@ function MessageItem({
|
|
|
1345
1388
|
children: [
|
|
1346
1389
|
message.messageType === "text" && (isOwnMessage ? (
|
|
1347
1390
|
// User messages: plain text — no markdown parsing
|
|
1348
|
-
/* @__PURE__ */ (0,
|
|
1391
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { whiteSpace: "pre-wrap", wordBreak: "break-word" }, children: message.content })
|
|
1349
1392
|
) : (
|
|
1350
1393
|
// Bot / agent messages: full markdown rendering
|
|
1351
|
-
/* @__PURE__ */ (0,
|
|
1394
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(MarkdownMessage, { content: message.content, theme })
|
|
1352
1395
|
)),
|
|
1353
|
-
message.messageType === "image" && /* @__PURE__ */ (0,
|
|
1396
|
+
message.messageType === "image" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1354
1397
|
"img",
|
|
1355
1398
|
{
|
|
1356
1399
|
src: message.content,
|
|
@@ -1359,8 +1402,8 @@ function MessageItem({
|
|
|
1359
1402
|
loading: "lazy"
|
|
1360
1403
|
}
|
|
1361
1404
|
) }),
|
|
1362
|
-
message.messageType === "file" && /* @__PURE__ */ (0,
|
|
1363
|
-
/* @__PURE__ */ (0,
|
|
1405
|
+
message.messageType === "file" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1406
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1364
1407
|
"svg",
|
|
1365
1408
|
{
|
|
1366
1409
|
width: "18",
|
|
@@ -1373,12 +1416,12 @@ function MessageItem({
|
|
|
1373
1416
|
strokeLinejoin: "round",
|
|
1374
1417
|
"aria-hidden": "true",
|
|
1375
1418
|
children: [
|
|
1376
|
-
/* @__PURE__ */ (0,
|
|
1377
|
-
/* @__PURE__ */ (0,
|
|
1419
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("title", { children: "File" }),
|
|
1420
|
+
/* @__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
1421
|
]
|
|
1379
1422
|
}
|
|
1380
1423
|
),
|
|
1381
|
-
/* @__PURE__ */ (0,
|
|
1424
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1382
1425
|
"a",
|
|
1383
1426
|
{
|
|
1384
1427
|
href: message.content,
|
|
@@ -1396,12 +1439,12 @@ function MessageItem({
|
|
|
1396
1439
|
]
|
|
1397
1440
|
}
|
|
1398
1441
|
),
|
|
1399
|
-
showTimestamp && /* @__PURE__ */ (0,
|
|
1442
|
+
showTimestamp && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1400
1443
|
"div",
|
|
1401
1444
|
{
|
|
1402
1445
|
className: `flex items-center gap-1.5 mt-1 px-1 ${isOwnMessage ? "flex-row-reverse" : "flex-row"}`,
|
|
1403
1446
|
children: [
|
|
1404
|
-
/* @__PURE__ */ (0,
|
|
1447
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1405
1448
|
"span",
|
|
1406
1449
|
{
|
|
1407
1450
|
style: {
|
|
@@ -1414,8 +1457,8 @@ function MessageItem({
|
|
|
1414
1457
|
})
|
|
1415
1458
|
}
|
|
1416
1459
|
),
|
|
1417
|
-
isOwnMessage && message.status && /* @__PURE__ */ (0,
|
|
1418
|
-
message.status === "sent" && /* @__PURE__ */ (0,
|
|
1460
|
+
isOwnMessage && message.status && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: { color: textMuted }, children: [
|
|
1461
|
+
message.status === "sent" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1419
1462
|
"svg",
|
|
1420
1463
|
{
|
|
1421
1464
|
width: "14",
|
|
@@ -1428,12 +1471,12 @@ function MessageItem({
|
|
|
1428
1471
|
strokeLinejoin: "round",
|
|
1429
1472
|
"aria-hidden": "true",
|
|
1430
1473
|
children: [
|
|
1431
|
-
/* @__PURE__ */ (0,
|
|
1432
|
-
/* @__PURE__ */ (0,
|
|
1474
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("title", { children: "Sent" }),
|
|
1475
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("polyline", { points: "20 6 9 17 4 12" })
|
|
1433
1476
|
]
|
|
1434
1477
|
}
|
|
1435
1478
|
),
|
|
1436
|
-
message.status === "delivered" && /* @__PURE__ */ (0,
|
|
1479
|
+
message.status === "delivered" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1437
1480
|
"svg",
|
|
1438
1481
|
{
|
|
1439
1482
|
width: "14",
|
|
@@ -1446,13 +1489,13 @@ function MessageItem({
|
|
|
1446
1489
|
strokeLinejoin: "round",
|
|
1447
1490
|
"aria-hidden": "true",
|
|
1448
1491
|
children: [
|
|
1449
|
-
/* @__PURE__ */ (0,
|
|
1450
|
-
/* @__PURE__ */ (0,
|
|
1451
|
-
/* @__PURE__ */ (0,
|
|
1492
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("title", { children: "Delivered" }),
|
|
1493
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("polyline", { points: "18 6 7 17 2 12" }),
|
|
1494
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("polyline", { points: "22 6 11 17" })
|
|
1452
1495
|
]
|
|
1453
1496
|
}
|
|
1454
1497
|
),
|
|
1455
|
-
message.status === "read" && /* @__PURE__ */ (0,
|
|
1498
|
+
message.status === "read" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1456
1499
|
"svg",
|
|
1457
1500
|
{
|
|
1458
1501
|
width: "14",
|
|
@@ -1465,9 +1508,9 @@ function MessageItem({
|
|
|
1465
1508
|
strokeLinejoin: "round",
|
|
1466
1509
|
"aria-hidden": "true",
|
|
1467
1510
|
children: [
|
|
1468
|
-
/* @__PURE__ */ (0,
|
|
1469
|
-
/* @__PURE__ */ (0,
|
|
1470
|
-
/* @__PURE__ */ (0,
|
|
1511
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("title", { children: "Read" }),
|
|
1512
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("polyline", { points: "18 6 7 17 2 12" }),
|
|
1513
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("polyline", { points: "22 6 11 17" })
|
|
1471
1514
|
]
|
|
1472
1515
|
}
|
|
1473
1516
|
)
|
|
@@ -1485,7 +1528,7 @@ function MessageItem({
|
|
|
1485
1528
|
|
|
1486
1529
|
// src/components/ThinkingIndicator.tsx
|
|
1487
1530
|
var import_react6 = require("react");
|
|
1488
|
-
var
|
|
1531
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1489
1532
|
var PHRASE_POOLS = {
|
|
1490
1533
|
// ── Greetings & small talk ──
|
|
1491
1534
|
greeting: [
|
|
@@ -1704,7 +1747,7 @@ function ThinkingIndicator({
|
|
|
1704
1747
|
}
|
|
1705
1748
|
return () => clearTimeout(timeout);
|
|
1706
1749
|
}, [displayText, isDeleting, phraseIndex]);
|
|
1707
|
-
return /* @__PURE__ */ (0,
|
|
1750
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1708
1751
|
"div",
|
|
1709
1752
|
{
|
|
1710
1753
|
className: "flex gap-2.5 mb-3",
|
|
@@ -1712,8 +1755,8 @@ function ThinkingIndicator({
|
|
|
1712
1755
|
"aria-live": "polite",
|
|
1713
1756
|
"aria-label": "Xcelsior is thinking",
|
|
1714
1757
|
children: [
|
|
1715
|
-
showAvatar && /* @__PURE__ */ (0,
|
|
1716
|
-
/* @__PURE__ */ (0,
|
|
1758
|
+
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 }) }),
|
|
1759
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex flex-col items-start", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1717
1760
|
"div",
|
|
1718
1761
|
{
|
|
1719
1762
|
style: {
|
|
@@ -1723,8 +1766,8 @@ function ThinkingIndicator({
|
|
|
1723
1766
|
padding: "12px 16px",
|
|
1724
1767
|
minWidth: 160
|
|
1725
1768
|
},
|
|
1726
|
-
children: /* @__PURE__ */ (0,
|
|
1727
|
-
/* @__PURE__ */ (0,
|
|
1769
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
1770
|
+
/* @__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
1771
|
"span",
|
|
1729
1772
|
{
|
|
1730
1773
|
style: {
|
|
@@ -1738,7 +1781,7 @@ function ThinkingIndicator({
|
|
|
1738
1781
|
},
|
|
1739
1782
|
i
|
|
1740
1783
|
)) }),
|
|
1741
|
-
/* @__PURE__ */ (0,
|
|
1784
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1742
1785
|
"span",
|
|
1743
1786
|
{
|
|
1744
1787
|
style: {
|
|
@@ -1749,7 +1792,7 @@ function ThinkingIndicator({
|
|
|
1749
1792
|
},
|
|
1750
1793
|
children: [
|
|
1751
1794
|
displayText,
|
|
1752
|
-
/* @__PURE__ */ (0,
|
|
1795
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1753
1796
|
"span",
|
|
1754
1797
|
{
|
|
1755
1798
|
style: {
|
|
@@ -1775,7 +1818,7 @@ function ThinkingIndicator({
|
|
|
1775
1818
|
}
|
|
1776
1819
|
|
|
1777
1820
|
// src/components/MessageList.tsx
|
|
1778
|
-
var
|
|
1821
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1779
1822
|
function MessageList({
|
|
1780
1823
|
messages,
|
|
1781
1824
|
currentUser,
|
|
@@ -1856,11 +1899,11 @@ function MessageList({
|
|
|
1856
1899
|
return () => container.removeEventListener("scroll", handleScroll);
|
|
1857
1900
|
}, [handleScroll]);
|
|
1858
1901
|
if (isLoading) {
|
|
1859
|
-
return /* @__PURE__ */ (0,
|
|
1902
|
+
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
1903
|
}
|
|
1861
1904
|
if (messages.length === 0) {
|
|
1862
|
-
return /* @__PURE__ */ (0,
|
|
1863
|
-
/* @__PURE__ */ (0,
|
|
1905
|
+
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: [
|
|
1906
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1864
1907
|
"h3",
|
|
1865
1908
|
{
|
|
1866
1909
|
className: "font-semibold mb-2",
|
|
@@ -1872,7 +1915,7 @@ function MessageList({
|
|
|
1872
1915
|
children: "How can we help?"
|
|
1873
1916
|
}
|
|
1874
1917
|
),
|
|
1875
|
-
/* @__PURE__ */ (0,
|
|
1918
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1876
1919
|
"p",
|
|
1877
1920
|
{
|
|
1878
1921
|
className: "max-w-[240px]",
|
|
@@ -1886,11 +1929,11 @@ function MessageList({
|
|
|
1886
1929
|
children: "Ask us anything. We are here to help you get the most out of Xcelsior."
|
|
1887
1930
|
}
|
|
1888
1931
|
),
|
|
1889
|
-
/* @__PURE__ */ (0,
|
|
1932
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex flex-wrap justify-center gap-2", children: [
|
|
1890
1933
|
{ label: "Our services", message: "What services does Xcelsior offer?" },
|
|
1891
1934
|
{ label: "Get a quote", message: "I would like to get a quote for a project" },
|
|
1892
1935
|
{ label: "Support", message: "I need help with something" }
|
|
1893
|
-
].map((action) => /* @__PURE__ */ (0,
|
|
1936
|
+
].map((action) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1894
1937
|
"button",
|
|
1895
1938
|
{
|
|
1896
1939
|
type: "button",
|
|
@@ -1922,14 +1965,14 @@ function MessageList({
|
|
|
1922
1965
|
)) })
|
|
1923
1966
|
] });
|
|
1924
1967
|
}
|
|
1925
|
-
return /* @__PURE__ */ (0,
|
|
1968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1926
1969
|
"div",
|
|
1927
1970
|
{
|
|
1928
1971
|
ref: containerRef,
|
|
1929
1972
|
className: "flex-1 overflow-y-auto px-4 py-3",
|
|
1930
1973
|
style: { scrollBehavior: "smooth" },
|
|
1931
1974
|
children: [
|
|
1932
|
-
/* @__PURE__ */ (0,
|
|
1975
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("style", { children: `
|
|
1933
1976
|
@keyframes thinkingPulse {
|
|
1934
1977
|
0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
|
|
1935
1978
|
30% { opacity: 1; transform: scale(1); }
|
|
@@ -1939,9 +1982,9 @@ function MessageList({
|
|
|
1939
1982
|
50% { opacity: 0; }
|
|
1940
1983
|
}
|
|
1941
1984
|
` }),
|
|
1942
|
-
isLoadingMore && /* @__PURE__ */ (0,
|
|
1943
|
-
/* @__PURE__ */ (0,
|
|
1944
|
-
messages.map((message) => /* @__PURE__ */ (0,
|
|
1985
|
+
isLoadingMore && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex justify-center py-3", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Spinner, { size: "sm" }) }),
|
|
1986
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref: loadMoreTriggerRef }),
|
|
1987
|
+
messages.map((message) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1945
1988
|
MessageItem,
|
|
1946
1989
|
{
|
|
1947
1990
|
message,
|
|
@@ -1952,10 +1995,10 @@ function MessageList({
|
|
|
1952
1995
|
},
|
|
1953
1996
|
message.id
|
|
1954
1997
|
)),
|
|
1955
|
-
isTyping && /* @__PURE__ */ (0,
|
|
1956
|
-
/* @__PURE__ */ (0,
|
|
1957
|
-
/* @__PURE__ */ (0,
|
|
1958
|
-
/* @__PURE__ */ (0,
|
|
1998
|
+
isTyping && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex gap-2.5 mb-3", children: [
|
|
1999
|
+
/* @__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 }) }),
|
|
2000
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col items-start", children: [
|
|
2001
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1959
2002
|
"div",
|
|
1960
2003
|
{
|
|
1961
2004
|
className: "px-4 py-3",
|
|
@@ -1964,7 +2007,7 @@ function MessageList({
|
|
|
1964
2007
|
borderRadius: "18px 18px 18px 4px",
|
|
1965
2008
|
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
2009
|
},
|
|
1967
|
-
children: /* @__PURE__ */ (0,
|
|
2010
|
+
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
2011
|
"span",
|
|
1969
2012
|
{
|
|
1970
2013
|
className: "rounded-full animate-bounce",
|
|
@@ -1980,7 +2023,7 @@ function MessageList({
|
|
|
1980
2023
|
)) })
|
|
1981
2024
|
}
|
|
1982
2025
|
),
|
|
1983
|
-
typingUser && /* @__PURE__ */ (0,
|
|
2026
|
+
typingUser && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1984
2027
|
"span",
|
|
1985
2028
|
{
|
|
1986
2029
|
className: "mt-1 px-1",
|
|
@@ -1997,14 +2040,14 @@ function MessageList({
|
|
|
1997
2040
|
)
|
|
1998
2041
|
] })
|
|
1999
2042
|
] }),
|
|
2000
|
-
isBotThinking && !isTyping && /* @__PURE__ */ (0,
|
|
2043
|
+
isBotThinking && !isTyping && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2001
2044
|
ThinkingIndicator,
|
|
2002
2045
|
{
|
|
2003
2046
|
theme,
|
|
2004
2047
|
lastUserMessage: messages.filter((m) => m.senderType === "customer").pop()?.content
|
|
2005
2048
|
}
|
|
2006
2049
|
),
|
|
2007
|
-
/* @__PURE__ */ (0,
|
|
2050
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref: messagesEndRef })
|
|
2008
2051
|
]
|
|
2009
2052
|
}
|
|
2010
2053
|
);
|
|
@@ -2014,7 +2057,7 @@ function MessageList({
|
|
|
2014
2057
|
var import_react8 = require("react");
|
|
2015
2058
|
var import_react_dom = require("react-dom");
|
|
2016
2059
|
var import_react9 = __toESM(require("@emoji-mart/react"));
|
|
2017
|
-
var
|
|
2060
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2018
2061
|
function isLightColor(color) {
|
|
2019
2062
|
let r = 0, g = 0, b = 0;
|
|
2020
2063
|
if (color.startsWith("#")) {
|
|
@@ -2192,7 +2235,7 @@ ${uploadedFile.markdown}
|
|
|
2192
2235
|
};
|
|
2193
2236
|
const canSend = message.trim().length > 0 && !disabled;
|
|
2194
2237
|
const placeholderColor = isLightTheme ? "rgba(0,0,0,0.35)" : "rgba(247,247,248,0.3)";
|
|
2195
|
-
return /* @__PURE__ */ (0,
|
|
2238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2196
2239
|
"div",
|
|
2197
2240
|
{
|
|
2198
2241
|
className: "px-4 py-3",
|
|
@@ -2200,7 +2243,7 @@ ${uploadedFile.markdown}
|
|
|
2200
2243
|
borderTop: isLightTheme ? "1px solid rgba(0,0,0,0.06)" : "1px solid rgba(255,255,255,0.06)"
|
|
2201
2244
|
},
|
|
2202
2245
|
children: [
|
|
2203
|
-
/* @__PURE__ */ (0,
|
|
2246
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2204
2247
|
"div",
|
|
2205
2248
|
{
|
|
2206
2249
|
className: "relative flex items-center rounded-full transition-all duration-200",
|
|
@@ -2212,8 +2255,8 @@ ${uploadedFile.markdown}
|
|
|
2212
2255
|
backdropFilter: "blur(32px)"
|
|
2213
2256
|
},
|
|
2214
2257
|
children: [
|
|
2215
|
-
/* @__PURE__ */ (0,
|
|
2216
|
-
/* @__PURE__ */ (0,
|
|
2258
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("style", { children: `.xchat-input::placeholder { color: ${placeholderColor}; }` }),
|
|
2259
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2217
2260
|
"textarea",
|
|
2218
2261
|
{
|
|
2219
2262
|
ref: textAreaRef,
|
|
@@ -2242,8 +2285,8 @@ ${uploadedFile.markdown}
|
|
|
2242
2285
|
disabled
|
|
2243
2286
|
}
|
|
2244
2287
|
),
|
|
2245
|
-
/* @__PURE__ */ (0,
|
|
2246
|
-
enableEmoji && /* @__PURE__ */ (0,
|
|
2288
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1 px-2 shrink-0", children: [
|
|
2289
|
+
enableEmoji && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2247
2290
|
"button",
|
|
2248
2291
|
{
|
|
2249
2292
|
ref: emojiButtonRef,
|
|
@@ -2273,7 +2316,7 @@ ${uploadedFile.markdown}
|
|
|
2273
2316
|
},
|
|
2274
2317
|
disabled,
|
|
2275
2318
|
"aria-label": "Add emoji",
|
|
2276
|
-
children: /* @__PURE__ */ (0,
|
|
2319
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2277
2320
|
"svg",
|
|
2278
2321
|
{
|
|
2279
2322
|
width: "18",
|
|
@@ -2286,18 +2329,18 @@ ${uploadedFile.markdown}
|
|
|
2286
2329
|
strokeLinejoin: "round",
|
|
2287
2330
|
"aria-hidden": "true",
|
|
2288
2331
|
children: [
|
|
2289
|
-
/* @__PURE__ */ (0,
|
|
2290
|
-
/* @__PURE__ */ (0,
|
|
2291
|
-
/* @__PURE__ */ (0,
|
|
2292
|
-
/* @__PURE__ */ (0,
|
|
2293
|
-
/* @__PURE__ */ (0,
|
|
2332
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("title", { children: "Emoji" }),
|
|
2333
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
2334
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M8 14s1.5 2 4 2 4-2 4-2" }),
|
|
2335
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "9", y1: "9", x2: "9.01", y2: "9" }),
|
|
2336
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "15", y1: "9", x2: "15.01", y2: "9" })
|
|
2294
2337
|
]
|
|
2295
2338
|
}
|
|
2296
2339
|
)
|
|
2297
2340
|
}
|
|
2298
2341
|
),
|
|
2299
|
-
enableFileUpload && fileUpload.canUpload && /* @__PURE__ */ (0,
|
|
2300
|
-
/* @__PURE__ */ (0,
|
|
2342
|
+
enableFileUpload && fileUpload.canUpload && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
2343
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2301
2344
|
"button",
|
|
2302
2345
|
{
|
|
2303
2346
|
type: "button",
|
|
@@ -2317,7 +2360,7 @@ ${uploadedFile.markdown}
|
|
|
2317
2360
|
},
|
|
2318
2361
|
disabled: disabled || fileUpload.isUploading,
|
|
2319
2362
|
"aria-label": "Attach file",
|
|
2320
|
-
children: fileUpload.isUploading ? /* @__PURE__ */ (0,
|
|
2363
|
+
children: fileUpload.isUploading ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2321
2364
|
"svg",
|
|
2322
2365
|
{
|
|
2323
2366
|
width: "18",
|
|
@@ -2329,11 +2372,11 @@ ${uploadedFile.markdown}
|
|
|
2329
2372
|
className: "animate-spin",
|
|
2330
2373
|
"aria-hidden": "true",
|
|
2331
2374
|
children: [
|
|
2332
|
-
/* @__PURE__ */ (0,
|
|
2333
|
-
/* @__PURE__ */ (0,
|
|
2375
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("title", { children: "Uploading" }),
|
|
2376
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M21 12a9 9 0 11-6.219-8.56" })
|
|
2334
2377
|
]
|
|
2335
2378
|
}
|
|
2336
|
-
) : /* @__PURE__ */ (0,
|
|
2379
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2337
2380
|
"svg",
|
|
2338
2381
|
{
|
|
2339
2382
|
width: "18",
|
|
@@ -2346,14 +2389,14 @@ ${uploadedFile.markdown}
|
|
|
2346
2389
|
strokeLinejoin: "round",
|
|
2347
2390
|
"aria-hidden": "true",
|
|
2348
2391
|
children: [
|
|
2349
|
-
/* @__PURE__ */ (0,
|
|
2350
|
-
/* @__PURE__ */ (0,
|
|
2392
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("title", { children: "Attach file" }),
|
|
2393
|
+
/* @__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
2394
|
]
|
|
2352
2395
|
}
|
|
2353
2396
|
)
|
|
2354
2397
|
}
|
|
2355
2398
|
),
|
|
2356
|
-
/* @__PURE__ */ (0,
|
|
2399
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2357
2400
|
"input",
|
|
2358
2401
|
{
|
|
2359
2402
|
ref: fileInputRef,
|
|
@@ -2364,7 +2407,7 @@ ${uploadedFile.markdown}
|
|
|
2364
2407
|
}
|
|
2365
2408
|
)
|
|
2366
2409
|
] }),
|
|
2367
|
-
/* @__PURE__ */ (0,
|
|
2410
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2368
2411
|
"button",
|
|
2369
2412
|
{
|
|
2370
2413
|
type: "button",
|
|
@@ -2379,7 +2422,7 @@ ${uploadedFile.markdown}
|
|
|
2379
2422
|
boxShadow: canSend ? `0 2px 8px -2px ${primaryColor}60` : "none"
|
|
2380
2423
|
},
|
|
2381
2424
|
"aria-label": "Send message",
|
|
2382
|
-
children: /* @__PURE__ */ (0,
|
|
2425
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2383
2426
|
"svg",
|
|
2384
2427
|
{
|
|
2385
2428
|
width: "18",
|
|
@@ -2392,9 +2435,9 @@ ${uploadedFile.markdown}
|
|
|
2392
2435
|
strokeLinejoin: "round",
|
|
2393
2436
|
"aria-hidden": "true",
|
|
2394
2437
|
children: [
|
|
2395
|
-
/* @__PURE__ */ (0,
|
|
2396
|
-
/* @__PURE__ */ (0,
|
|
2397
|
-
/* @__PURE__ */ (0,
|
|
2438
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("title", { children: "Send" }),
|
|
2439
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "22", y1: "2", x2: "11", y2: "13" }),
|
|
2440
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polygon", { points: "22 2 15 22 11 13 2 9 22 2" })
|
|
2398
2441
|
]
|
|
2399
2442
|
}
|
|
2400
2443
|
)
|
|
@@ -2404,8 +2447,8 @@ ${uploadedFile.markdown}
|
|
|
2404
2447
|
]
|
|
2405
2448
|
}
|
|
2406
2449
|
),
|
|
2407
|
-
fileUpload.isUploading && /* @__PURE__ */ (0,
|
|
2408
|
-
/* @__PURE__ */ (0,
|
|
2450
|
+
fileUpload.isUploading && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "mt-2 px-1", children: [
|
|
2451
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2409
2452
|
"div",
|
|
2410
2453
|
{
|
|
2411
2454
|
className: "w-full rounded-full overflow-hidden",
|
|
@@ -2413,7 +2456,7 @@ ${uploadedFile.markdown}
|
|
|
2413
2456
|
height: 3,
|
|
2414
2457
|
backgroundColor: isLightTheme ? "rgba(0,0,0,0.06)" : "rgba(255,255,255,0.06)"
|
|
2415
2458
|
},
|
|
2416
|
-
children: /* @__PURE__ */ (0,
|
|
2459
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2417
2460
|
"div",
|
|
2418
2461
|
{
|
|
2419
2462
|
className: "h-full rounded-full transition-all duration-300",
|
|
@@ -2425,7 +2468,7 @@ ${uploadedFile.markdown}
|
|
|
2425
2468
|
)
|
|
2426
2469
|
}
|
|
2427
2470
|
),
|
|
2428
|
-
/* @__PURE__ */ (0,
|
|
2471
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2429
2472
|
"p",
|
|
2430
2473
|
{
|
|
2431
2474
|
className: "mt-1",
|
|
@@ -2443,7 +2486,7 @@ ${uploadedFile.markdown}
|
|
|
2443
2486
|
)
|
|
2444
2487
|
] }),
|
|
2445
2488
|
showEmojiPicker && emojiData && emojiPickerPosition && typeof document !== "undefined" && (0, import_react_dom.createPortal)(
|
|
2446
|
-
/* @__PURE__ */ (0,
|
|
2489
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2447
2490
|
"div",
|
|
2448
2491
|
{
|
|
2449
2492
|
ref: emojiPickerRef,
|
|
@@ -2458,7 +2501,7 @@ ${uploadedFile.markdown}
|
|
|
2458
2501
|
"0 16px 48px -8px rgba(0,0,0,0.5)"
|
|
2459
2502
|
].join(", ")
|
|
2460
2503
|
},
|
|
2461
|
-
children: /* @__PURE__ */ (0,
|
|
2504
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2462
2505
|
import_react9.default,
|
|
2463
2506
|
{
|
|
2464
2507
|
data: emojiData,
|
|
@@ -2484,7 +2527,7 @@ ${uploadedFile.markdown}
|
|
|
2484
2527
|
}
|
|
2485
2528
|
|
|
2486
2529
|
// src/components/ChatWidget.tsx
|
|
2487
|
-
var
|
|
2530
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2488
2531
|
function getAnonymousUser() {
|
|
2489
2532
|
let anonId;
|
|
2490
2533
|
try {
|
|
@@ -2618,14 +2661,14 @@ function ChatWidget({
|
|
|
2618
2661
|
outlineOffset: -1,
|
|
2619
2662
|
transition: "outline 150ms ease"
|
|
2620
2663
|
};
|
|
2621
|
-
return /* @__PURE__ */ (0,
|
|
2664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2622
2665
|
"div",
|
|
2623
2666
|
{
|
|
2624
2667
|
className: isFullPage ? `flex flex-col h-full ${className}` : `fixed bottom-20 ${positionClass} z-50 flex flex-col overflow-hidden ${className}`,
|
|
2625
2668
|
style: { ...containerStyle, ...dotGridBg, ...edgeHintStyle },
|
|
2626
2669
|
...!isFullPage ? containerResizeProps : {},
|
|
2627
2670
|
children: [
|
|
2628
|
-
!isFullPage && /* @__PURE__ */ (0,
|
|
2671
|
+
!isFullPage && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2629
2672
|
ChatHeader,
|
|
2630
2673
|
{
|
|
2631
2674
|
agent: effectiveUser.type === "customer" ? {
|
|
@@ -2639,7 +2682,7 @@ function ChatWidget({
|
|
|
2639
2682
|
theme: config.theme
|
|
2640
2683
|
}
|
|
2641
2684
|
),
|
|
2642
|
-
!websocket.isConnected && /* @__PURE__ */ (0,
|
|
2685
|
+
!websocket.isConnected && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2643
2686
|
"div",
|
|
2644
2687
|
{
|
|
2645
2688
|
className: "px-4 py-2",
|
|
@@ -2647,15 +2690,15 @@ function ChatWidget({
|
|
|
2647
2690
|
backgroundColor: isLightTheme ? "rgba(255,169,56,0.08)" : "rgba(255,169,56,0.06)",
|
|
2648
2691
|
borderBottom: `1px solid rgba(255,169,56,${isLightTheme ? "0.15" : "0.12"})`
|
|
2649
2692
|
},
|
|
2650
|
-
children: /* @__PURE__ */ (0,
|
|
2651
|
-
/* @__PURE__ */ (0,
|
|
2693
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2694
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2652
2695
|
"div",
|
|
2653
2696
|
{
|
|
2654
2697
|
className: "w-1.5 h-1.5 rounded-full animate-pulse",
|
|
2655
2698
|
style: { backgroundColor: config.theme?.statusCaution || "#ffa938" }
|
|
2656
2699
|
}
|
|
2657
2700
|
),
|
|
2658
|
-
/* @__PURE__ */ (0,
|
|
2701
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2659
2702
|
"span",
|
|
2660
2703
|
{
|
|
2661
2704
|
style: {
|
|
@@ -2666,7 +2709,7 @@ function ChatWidget({
|
|
|
2666
2709
|
children: "Reconnecting..."
|
|
2667
2710
|
}
|
|
2668
2711
|
),
|
|
2669
|
-
/* @__PURE__ */ (0,
|
|
2712
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2670
2713
|
"button",
|
|
2671
2714
|
{
|
|
2672
2715
|
type: "button",
|
|
@@ -2690,8 +2733,8 @@ function ChatWidget({
|
|
|
2690
2733
|
] })
|
|
2691
2734
|
}
|
|
2692
2735
|
),
|
|
2693
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
2694
|
-
/* @__PURE__ */ (0,
|
|
2736
|
+
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: [
|
|
2737
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2695
2738
|
"div",
|
|
2696
2739
|
{
|
|
2697
2740
|
className: "w-7 h-7 border-2 border-t-transparent rounded-full animate-spin mx-auto mb-3",
|
|
@@ -2701,7 +2744,7 @@ function ChatWidget({
|
|
|
2701
2744
|
}
|
|
2702
2745
|
}
|
|
2703
2746
|
),
|
|
2704
|
-
/* @__PURE__ */ (0,
|
|
2747
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2705
2748
|
"p",
|
|
2706
2749
|
{
|
|
2707
2750
|
style: {
|
|
@@ -2712,7 +2755,7 @@ function ChatWidget({
|
|
|
2712
2755
|
children: "Loading messages..."
|
|
2713
2756
|
}
|
|
2714
2757
|
)
|
|
2715
|
-
] }) }) : /* @__PURE__ */ (0,
|
|
2758
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2716
2759
|
MessageList,
|
|
2717
2760
|
{
|
|
2718
2761
|
messages,
|
|
@@ -2728,7 +2771,7 @@ function ChatWidget({
|
|
|
2728
2771
|
isBotThinking
|
|
2729
2772
|
}
|
|
2730
2773
|
),
|
|
2731
|
-
/* @__PURE__ */ (0,
|
|
2774
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2732
2775
|
ChatInput,
|
|
2733
2776
|
{
|
|
2734
2777
|
onSend: handleSendMessage,
|
|
@@ -2738,7 +2781,7 @@ function ChatWidget({
|
|
|
2738
2781
|
disabled: !websocket.isConnected
|
|
2739
2782
|
}
|
|
2740
2783
|
),
|
|
2741
|
-
!isFullPage && /* @__PURE__ */ (0,
|
|
2784
|
+
!isFullPage && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2742
2785
|
"div",
|
|
2743
2786
|
{
|
|
2744
2787
|
className: "px-4 py-1.5 text-center",
|
|
@@ -2746,7 +2789,7 @@ function ChatWidget({
|
|
|
2746
2789
|
borderTop: isLightTheme ? "1px solid rgba(0,0,0,0.06)" : "1px solid rgba(255,255,255,0.06)",
|
|
2747
2790
|
backgroundColor: isLightTheme ? "rgba(0,0,0,0.03)" : "rgba(0,0,0,0.2)"
|
|
2748
2791
|
},
|
|
2749
|
-
children: /* @__PURE__ */ (0,
|
|
2792
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2750
2793
|
"p",
|
|
2751
2794
|
{
|
|
2752
2795
|
style: {
|
|
@@ -2757,7 +2800,7 @@ function ChatWidget({
|
|
|
2757
2800
|
children: [
|
|
2758
2801
|
"Powered by",
|
|
2759
2802
|
" ",
|
|
2760
|
-
/* @__PURE__ */ (0,
|
|
2803
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: {
|
|
2761
2804
|
fontWeight: 600,
|
|
2762
2805
|
color: isLightTheme ? "rgba(0,0,0,0.5)" : "rgba(247,247,248,0.45)"
|
|
2763
2806
|
}, children: "Xcelsior" })
|
|
@@ -2776,7 +2819,7 @@ var import_react14 = require("react");
|
|
|
2776
2819
|
|
|
2777
2820
|
// src/components/PreChatForm.tsx
|
|
2778
2821
|
var import_react11 = require("react");
|
|
2779
|
-
var
|
|
2822
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2780
2823
|
function PreChatForm({
|
|
2781
2824
|
onSubmit,
|
|
2782
2825
|
className = "",
|
|
@@ -2837,7 +2880,7 @@ function PreChatForm({
|
|
|
2837
2880
|
transition: "box-shadow 0.2s ease",
|
|
2838
2881
|
caretColor: "#337eff"
|
|
2839
2882
|
});
|
|
2840
|
-
return /* @__PURE__ */ (0,
|
|
2883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2841
2884
|
"div",
|
|
2842
2885
|
{
|
|
2843
2886
|
className: `fixed bottom-4 right-4 z-50 flex flex-col overflow-hidden ${className}`,
|
|
@@ -2857,7 +2900,7 @@ function PreChatForm({
|
|
|
2857
2900
|
backgroundSize: "24px 24px"
|
|
2858
2901
|
},
|
|
2859
2902
|
children: [
|
|
2860
|
-
/* @__PURE__ */ (0,
|
|
2903
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2861
2904
|
"div",
|
|
2862
2905
|
{
|
|
2863
2906
|
className: "relative text-white overflow-hidden",
|
|
@@ -2865,7 +2908,7 @@ function PreChatForm({
|
|
|
2865
2908
|
background: "linear-gradient(135deg, #337eff 0%, #005eff 50%, #001a66 100%)"
|
|
2866
2909
|
},
|
|
2867
2910
|
children: [
|
|
2868
|
-
/* @__PURE__ */ (0,
|
|
2911
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2869
2912
|
"div",
|
|
2870
2913
|
{
|
|
2871
2914
|
className: "absolute inset-0 pointer-events-none",
|
|
@@ -2874,9 +2917,9 @@ function PreChatForm({
|
|
|
2874
2917
|
}
|
|
2875
2918
|
}
|
|
2876
2919
|
),
|
|
2877
|
-
/* @__PURE__ */ (0,
|
|
2878
|
-
/* @__PURE__ */ (0,
|
|
2879
|
-
/* @__PURE__ */ (0,
|
|
2920
|
+
/* @__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: [
|
|
2921
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex-1", children: [
|
|
2922
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2880
2923
|
"h2",
|
|
2881
2924
|
{
|
|
2882
2925
|
className: "font-semibold",
|
|
@@ -2887,7 +2930,7 @@ function PreChatForm({
|
|
|
2887
2930
|
children: "Start a Conversation"
|
|
2888
2931
|
}
|
|
2889
2932
|
),
|
|
2890
|
-
/* @__PURE__ */ (0,
|
|
2933
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2891
2934
|
"p",
|
|
2892
2935
|
{
|
|
2893
2936
|
className: "mt-1",
|
|
@@ -2900,8 +2943,8 @@ function PreChatForm({
|
|
|
2900
2943
|
}
|
|
2901
2944
|
)
|
|
2902
2945
|
] }),
|
|
2903
|
-
/* @__PURE__ */ (0,
|
|
2904
|
-
/* @__PURE__ */ (0,
|
|
2946
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex gap-1 ml-2", children: [
|
|
2947
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2905
2948
|
"button",
|
|
2906
2949
|
{
|
|
2907
2950
|
type: "button",
|
|
@@ -2915,7 +2958,7 @@ function PreChatForm({
|
|
|
2915
2958
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
2916
2959
|
},
|
|
2917
2960
|
"aria-label": "Minimize chat",
|
|
2918
|
-
children: /* @__PURE__ */ (0,
|
|
2961
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2919
2962
|
"svg",
|
|
2920
2963
|
{
|
|
2921
2964
|
width: "18",
|
|
@@ -2924,8 +2967,8 @@ function PreChatForm({
|
|
|
2924
2967
|
stroke: "currentColor",
|
|
2925
2968
|
viewBox: "0 0 24 24",
|
|
2926
2969
|
children: [
|
|
2927
|
-
/* @__PURE__ */ (0,
|
|
2928
|
-
/* @__PURE__ */ (0,
|
|
2970
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("title", { children: "Minimize" }),
|
|
2971
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2929
2972
|
"path",
|
|
2930
2973
|
{
|
|
2931
2974
|
strokeLinecap: "round",
|
|
@@ -2939,7 +2982,7 @@ function PreChatForm({
|
|
|
2939
2982
|
)
|
|
2940
2983
|
}
|
|
2941
2984
|
),
|
|
2942
|
-
/* @__PURE__ */ (0,
|
|
2985
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2943
2986
|
"button",
|
|
2944
2987
|
{
|
|
2945
2988
|
type: "button",
|
|
@@ -2953,7 +2996,7 @@ function PreChatForm({
|
|
|
2953
2996
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
2954
2997
|
},
|
|
2955
2998
|
"aria-label": "Close chat",
|
|
2956
|
-
children: /* @__PURE__ */ (0,
|
|
2999
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2957
3000
|
"svg",
|
|
2958
3001
|
{
|
|
2959
3002
|
width: "18",
|
|
@@ -2962,8 +3005,8 @@ function PreChatForm({
|
|
|
2962
3005
|
stroke: "currentColor",
|
|
2963
3006
|
viewBox: "0 0 24 24",
|
|
2964
3007
|
children: [
|
|
2965
|
-
/* @__PURE__ */ (0,
|
|
2966
|
-
/* @__PURE__ */ (0,
|
|
3008
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("title", { children: "Close" }),
|
|
3009
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2967
3010
|
"path",
|
|
2968
3011
|
{
|
|
2969
3012
|
strokeLinecap: "round",
|
|
@@ -2979,7 +3022,7 @@ function PreChatForm({
|
|
|
2979
3022
|
)
|
|
2980
3023
|
] })
|
|
2981
3024
|
] }) }),
|
|
2982
|
-
/* @__PURE__ */ (0,
|
|
3025
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2983
3026
|
"div",
|
|
2984
3027
|
{
|
|
2985
3028
|
className: "h-px",
|
|
@@ -2991,9 +3034,9 @@ function PreChatForm({
|
|
|
2991
3034
|
]
|
|
2992
3035
|
}
|
|
2993
3036
|
),
|
|
2994
|
-
/* @__PURE__ */ (0,
|
|
2995
|
-
/* @__PURE__ */ (0,
|
|
2996
|
-
/* @__PURE__ */ (0,
|
|
3037
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("form", { onSubmit: handleSubmit, className: "p-5 flex flex-col gap-4", children: [
|
|
3038
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
|
|
3039
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2997
3040
|
"label",
|
|
2998
3041
|
{
|
|
2999
3042
|
htmlFor: "chat-name",
|
|
@@ -3005,11 +3048,11 @@ function PreChatForm({
|
|
|
3005
3048
|
},
|
|
3006
3049
|
children: [
|
|
3007
3050
|
"Name ",
|
|
3008
|
-
/* @__PURE__ */ (0,
|
|
3051
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { color: "#ff6363" }, children: "*" })
|
|
3009
3052
|
]
|
|
3010
3053
|
}
|
|
3011
3054
|
),
|
|
3012
|
-
/* @__PURE__ */ (0,
|
|
3055
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3013
3056
|
"input",
|
|
3014
3057
|
{
|
|
3015
3058
|
type: "text",
|
|
@@ -3029,7 +3072,7 @@ function PreChatForm({
|
|
|
3029
3072
|
autoComplete: "name"
|
|
3030
3073
|
}
|
|
3031
3074
|
),
|
|
3032
|
-
errors.name && /* @__PURE__ */ (0,
|
|
3075
|
+
errors.name && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3033
3076
|
"p",
|
|
3034
3077
|
{
|
|
3035
3078
|
className: "mt-1.5",
|
|
@@ -3043,8 +3086,8 @@ function PreChatForm({
|
|
|
3043
3086
|
}
|
|
3044
3087
|
)
|
|
3045
3088
|
] }),
|
|
3046
|
-
/* @__PURE__ */ (0,
|
|
3047
|
-
/* @__PURE__ */ (0,
|
|
3089
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
|
|
3090
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3048
3091
|
"label",
|
|
3049
3092
|
{
|
|
3050
3093
|
htmlFor: "chat-email",
|
|
@@ -3056,11 +3099,11 @@ function PreChatForm({
|
|
|
3056
3099
|
},
|
|
3057
3100
|
children: [
|
|
3058
3101
|
"Email ",
|
|
3059
|
-
/* @__PURE__ */ (0,
|
|
3102
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { color: "#ff6363" }, children: "*" })
|
|
3060
3103
|
]
|
|
3061
3104
|
}
|
|
3062
3105
|
),
|
|
3063
|
-
/* @__PURE__ */ (0,
|
|
3106
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3064
3107
|
"input",
|
|
3065
3108
|
{
|
|
3066
3109
|
type: "email",
|
|
@@ -3080,7 +3123,7 @@ function PreChatForm({
|
|
|
3080
3123
|
autoComplete: "email"
|
|
3081
3124
|
}
|
|
3082
3125
|
),
|
|
3083
|
-
errors.email && /* @__PURE__ */ (0,
|
|
3126
|
+
errors.email && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3084
3127
|
"p",
|
|
3085
3128
|
{
|
|
3086
3129
|
className: "mt-1.5",
|
|
@@ -3094,7 +3137,7 @@ function PreChatForm({
|
|
|
3094
3137
|
}
|
|
3095
3138
|
)
|
|
3096
3139
|
] }),
|
|
3097
|
-
/* @__PURE__ */ (0,
|
|
3140
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3098
3141
|
"button",
|
|
3099
3142
|
{
|
|
3100
3143
|
type: "submit",
|
|
@@ -3116,8 +3159,8 @@ function PreChatForm({
|
|
|
3116
3159
|
onMouseLeave: (e) => {
|
|
3117
3160
|
e.currentTarget.style.boxShadow = "0 4px 16px -4px rgba(51,126,255,0.4)";
|
|
3118
3161
|
},
|
|
3119
|
-
children: isSubmitting ? /* @__PURE__ */ (0,
|
|
3120
|
-
/* @__PURE__ */ (0,
|
|
3162
|
+
children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center justify-center gap-2", children: [
|
|
3163
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3121
3164
|
"svg",
|
|
3122
3165
|
{
|
|
3123
3166
|
className: "animate-spin",
|
|
@@ -3129,8 +3172,8 @@ function PreChatForm({
|
|
|
3129
3172
|
strokeWidth: "2",
|
|
3130
3173
|
"aria-label": "Loading",
|
|
3131
3174
|
children: [
|
|
3132
|
-
/* @__PURE__ */ (0,
|
|
3133
|
-
/* @__PURE__ */ (0,
|
|
3175
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("title", { children: "Loading" }),
|
|
3176
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M21 12a9 9 0 11-6.219-8.56" })
|
|
3134
3177
|
]
|
|
3135
3178
|
}
|
|
3136
3179
|
),
|
|
@@ -3138,7 +3181,7 @@ function PreChatForm({
|
|
|
3138
3181
|
] }) : "Start Chat"
|
|
3139
3182
|
}
|
|
3140
3183
|
),
|
|
3141
|
-
/* @__PURE__ */ (0,
|
|
3184
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3142
3185
|
"p",
|
|
3143
3186
|
{
|
|
3144
3187
|
className: "text-center",
|
|
@@ -3151,7 +3194,7 @@ function PreChatForm({
|
|
|
3151
3194
|
}
|
|
3152
3195
|
)
|
|
3153
3196
|
] }),
|
|
3154
|
-
/* @__PURE__ */ (0,
|
|
3197
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3155
3198
|
"div",
|
|
3156
3199
|
{
|
|
3157
3200
|
className: "px-4 py-1.5 text-center",
|
|
@@ -3159,7 +3202,7 @@ function PreChatForm({
|
|
|
3159
3202
|
borderTop: "1px solid rgba(255,255,255,0.06)",
|
|
3160
3203
|
backgroundColor: "rgba(0,0,0,0.2)"
|
|
3161
3204
|
},
|
|
3162
|
-
children: /* @__PURE__ */ (0,
|
|
3205
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3163
3206
|
"p",
|
|
3164
3207
|
{
|
|
3165
3208
|
style: {
|
|
@@ -3170,7 +3213,7 @@ function PreChatForm({
|
|
|
3170
3213
|
children: [
|
|
3171
3214
|
"Powered by",
|
|
3172
3215
|
" ",
|
|
3173
|
-
/* @__PURE__ */ (0,
|
|
3216
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontWeight: 600, color: "rgba(247,247,248,0.45)" }, children: "Xcelsior" })
|
|
3174
3217
|
]
|
|
3175
3218
|
}
|
|
3176
3219
|
)
|
|
@@ -3284,7 +3327,7 @@ function useChatWidgetState({
|
|
|
3284
3327
|
}
|
|
3285
3328
|
|
|
3286
3329
|
// src/components/Chat.tsx
|
|
3287
|
-
var
|
|
3330
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
3288
3331
|
function generateSessionId() {
|
|
3289
3332
|
if (typeof crypto !== "undefined" && crypto.randomUUID) {
|
|
3290
3333
|
return crypto.randomUUID();
|
|
@@ -3415,7 +3458,7 @@ function Chat({
|
|
|
3415
3458
|
const primaryColor = config.theme?.primary || "#337eff";
|
|
3416
3459
|
const primaryStrong = config.theme?.primaryStrong || "#005eff";
|
|
3417
3460
|
if (currentState === "minimized") {
|
|
3418
|
-
return /* @__PURE__ */ (0,
|
|
3461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: `fixed bottom-5 ${positionClass} z-50 ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
3419
3462
|
"button",
|
|
3420
3463
|
{
|
|
3421
3464
|
type: "button",
|
|
@@ -3440,8 +3483,8 @@ function Chat({
|
|
|
3440
3483
|
"aria-label": "Open chat",
|
|
3441
3484
|
...handlers,
|
|
3442
3485
|
children: [
|
|
3443
|
-
/* @__PURE__ */ (0,
|
|
3444
|
-
/* @__PURE__ */ (0,
|
|
3486
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChatBubbleIcon, { size: 28, color: "white", className: "pointer-events-none" }),
|
|
3487
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3445
3488
|
"span",
|
|
3446
3489
|
{
|
|
3447
3490
|
className: "absolute inset-0 rounded-full animate-ping pointer-events-none",
|
|
@@ -3457,7 +3500,7 @@ function Chat({
|
|
|
3457
3500
|
) });
|
|
3458
3501
|
}
|
|
3459
3502
|
if (identityMode === "form" && (!userInfo || !userInfo.email || !userInfo.name)) {
|
|
3460
|
-
return /* @__PURE__ */ (0,
|
|
3503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3461
3504
|
PreChatForm,
|
|
3462
3505
|
{
|
|
3463
3506
|
onSubmit: handlePreChatSubmit,
|
|
@@ -3483,7 +3526,7 @@ function Chat({
|
|
|
3483
3526
|
transform: "translateY(12px) scale(0.97)",
|
|
3484
3527
|
transition: "opacity 0.2s ease-in, transform 0.2s ease-in"
|
|
3485
3528
|
};
|
|
3486
|
-
return /* @__PURE__ */ (0,
|
|
3529
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: widgetAnimationStyle, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3487
3530
|
ChatWidget,
|
|
3488
3531
|
{
|
|
3489
3532
|
config: fullConfig,
|
|
@@ -3496,12 +3539,12 @@ function Chat({
|
|
|
3496
3539
|
}
|
|
3497
3540
|
|
|
3498
3541
|
// src/components/TypingIndicator.tsx
|
|
3499
|
-
var
|
|
3542
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
3500
3543
|
function TypingIndicator({ isTyping, userName }) {
|
|
3501
3544
|
if (!isTyping) {
|
|
3502
3545
|
return null;
|
|
3503
3546
|
}
|
|
3504
|
-
return /* @__PURE__ */ (0,
|
|
3547
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3505
3548
|
"div",
|
|
3506
3549
|
{
|
|
3507
3550
|
className: "px-4 py-2",
|
|
@@ -3509,8 +3552,8 @@ function TypingIndicator({ isTyping, userName }) {
|
|
|
3509
3552
|
borderTop: "1px solid rgba(255,255,255,0.06)",
|
|
3510
3553
|
backgroundColor: "rgba(0,0,0,0.15)"
|
|
3511
3554
|
},
|
|
3512
|
-
children: /* @__PURE__ */ (0,
|
|
3513
|
-
/* @__PURE__ */ (0,
|
|
3555
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3556
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex gap-1", children: [0, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3514
3557
|
"span",
|
|
3515
3558
|
{
|
|
3516
3559
|
className: "rounded-full animate-bounce",
|
|
@@ -3524,7 +3567,7 @@ function TypingIndicator({ isTyping, userName }) {
|
|
|
3524
3567
|
},
|
|
3525
3568
|
i
|
|
3526
3569
|
)) }),
|
|
3527
|
-
/* @__PURE__ */ (0,
|
|
3570
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3528
3571
|
"span",
|
|
3529
3572
|
{
|
|
3530
3573
|
style: {
|