@kite-copilot/chat-panel 0.2.16 → 0.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto.cjs +1502 -1015
- package/dist/auto.d.cts +1 -1
- package/dist/auto.d.ts +1 -1
- package/dist/auto.js +1 -1
- package/dist/{chunk-RUEKV5AV.js → chunk-YUCUEKGB.js} +1517 -1016
- package/dist/{createKiteChat-CFo7NUHz.d.cts → createKiteChat-BMLaQQQk.d.cts} +3 -3
- package/dist/{createKiteChat-CFo7NUHz.d.ts → createKiteChat-BMLaQQQk.d.ts} +3 -3
- package/dist/embed.global.js +18 -18
- package/dist/index.cjs +1502 -1015
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/auto.cjs
CHANGED
|
@@ -887,7 +887,7 @@ function DataRenderer({ type, data }) {
|
|
|
887
887
|
// src/ChatPanel.tsx
|
|
888
888
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
889
889
|
var DEFAULT_AGENT_URL = "http://localhost:5002";
|
|
890
|
-
var PANEL_WIDTH =
|
|
890
|
+
var PANEL_WIDTH = 400;
|
|
891
891
|
function renderMarkdown(text) {
|
|
892
892
|
if (!text) return null;
|
|
893
893
|
const lines = text.split("\n");
|
|
@@ -904,7 +904,14 @@ function renderMarkdown(text) {
|
|
|
904
904
|
const codeMatch = remaining.match(/^`([^`]+)`/);
|
|
905
905
|
if (codeMatch) {
|
|
906
906
|
parts.push(
|
|
907
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
907
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
908
|
+
"code",
|
|
909
|
+
{
|
|
910
|
+
className: "bg-gray-100 px-1 py-0.5 rounded text-xs font-mono",
|
|
911
|
+
children: codeMatch[1]
|
|
912
|
+
},
|
|
913
|
+
keyIndex++
|
|
914
|
+
)
|
|
908
915
|
);
|
|
909
916
|
remaining = remaining.slice(codeMatch[0].length);
|
|
910
917
|
continue;
|
|
@@ -924,7 +931,17 @@ function renderMarkdown(text) {
|
|
|
924
931
|
const linkMatch = remaining.match(/^\[([^\]]+)\]\(([^)]+)\)/);
|
|
925
932
|
if (linkMatch) {
|
|
926
933
|
parts.push(
|
|
927
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
934
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
935
|
+
"a",
|
|
936
|
+
{
|
|
937
|
+
href: linkMatch[2],
|
|
938
|
+
className: "text-blue-600 hover:underline",
|
|
939
|
+
target: "_blank",
|
|
940
|
+
rel: "noopener noreferrer",
|
|
941
|
+
children: linkMatch[1]
|
|
942
|
+
},
|
|
943
|
+
keyIndex++
|
|
944
|
+
)
|
|
928
945
|
);
|
|
929
946
|
remaining = remaining.slice(linkMatch[0].length);
|
|
930
947
|
continue;
|
|
@@ -947,7 +964,14 @@ function renderMarkdown(text) {
|
|
|
947
964
|
if (currentList) {
|
|
948
965
|
const ListTag = currentList.type === "ul" ? "ul" : "ol";
|
|
949
966
|
elements.push(
|
|
950
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
967
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
968
|
+
ListTag,
|
|
969
|
+
{
|
|
970
|
+
className: `${currentList.type === "ul" ? "list-disc" : "list-decimal"} ml-4 my-1`,
|
|
971
|
+
children: currentList.items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("li", { className: "ml-2", children: item }, i))
|
|
972
|
+
},
|
|
973
|
+
elements.length
|
|
974
|
+
)
|
|
951
975
|
);
|
|
952
976
|
currentList = null;
|
|
953
977
|
}
|
|
@@ -957,7 +981,14 @@ function renderMarkdown(text) {
|
|
|
957
981
|
if (line.startsWith("```")) {
|
|
958
982
|
if (inCodeBlock) {
|
|
959
983
|
elements.push(
|
|
960
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
984
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
985
|
+
"pre",
|
|
986
|
+
{
|
|
987
|
+
className: "bg-gray-100 rounded p-2 my-1 overflow-x-auto",
|
|
988
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("code", { className: "text-xs font-mono", children: codeContent.join("\n") })
|
|
989
|
+
},
|
|
990
|
+
elements.length
|
|
991
|
+
)
|
|
961
992
|
);
|
|
962
993
|
inCodeBlock = false;
|
|
963
994
|
codeContent = [];
|
|
@@ -979,7 +1010,9 @@ function renderMarkdown(text) {
|
|
|
979
1010
|
const level = headerMatch[1].length;
|
|
980
1011
|
const content = processInlineFormatting(headerMatch[2]);
|
|
981
1012
|
const className = level === 1 ? "text-lg font-bold my-1" : level === 2 ? "text-base font-bold my-1" : "text-sm font-semibold my-1";
|
|
982
|
-
elements.push(
|
|
1013
|
+
elements.push(
|
|
1014
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className, children: content }, elements.length)
|
|
1015
|
+
);
|
|
983
1016
|
continue;
|
|
984
1017
|
}
|
|
985
1018
|
const ulMatch = line.match(/^[-*]\s+(.+)/);
|
|
@@ -1007,11 +1040,15 @@ function renderMarkdown(text) {
|
|
|
1007
1040
|
}
|
|
1008
1041
|
if (line.match(/^[-*_]{3,}$/)) {
|
|
1009
1042
|
flushList();
|
|
1010
|
-
elements.push(
|
|
1043
|
+
elements.push(
|
|
1044
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("hr", { className: "my-2 border-gray-200" }, elements.length)
|
|
1045
|
+
);
|
|
1011
1046
|
continue;
|
|
1012
1047
|
}
|
|
1013
1048
|
flushList();
|
|
1014
|
-
elements.push(
|
|
1049
|
+
elements.push(
|
|
1050
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: processInlineFormatting(line) }, elements.length)
|
|
1051
|
+
);
|
|
1015
1052
|
}
|
|
1016
1053
|
flushList();
|
|
1017
1054
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: elements });
|
|
@@ -1041,31 +1078,59 @@ var folders = [
|
|
|
1041
1078
|
id: "customers",
|
|
1042
1079
|
title: "Customer Management",
|
|
1043
1080
|
topics: [
|
|
1044
|
-
{
|
|
1045
|
-
|
|
1081
|
+
{
|
|
1082
|
+
id: "add-customer",
|
|
1083
|
+
label: "Add a new customer",
|
|
1084
|
+
prompt: "How do I add a new customer to the system and what information is required?"
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
id: "customer-details",
|
|
1088
|
+
label: "View customer details",
|
|
1089
|
+
prompt: "Show me how to view and edit customer information and their payment history."
|
|
1090
|
+
}
|
|
1046
1091
|
]
|
|
1047
1092
|
},
|
|
1048
1093
|
{
|
|
1049
1094
|
id: "payments",
|
|
1050
1095
|
title: "Payment Processing",
|
|
1051
1096
|
topics: [
|
|
1052
|
-
{
|
|
1053
|
-
|
|
1097
|
+
{
|
|
1098
|
+
id: "process-payment",
|
|
1099
|
+
label: "Process a payment",
|
|
1100
|
+
prompt: "How do I process a one-time payment for a customer?"
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
id: "refund-payment",
|
|
1104
|
+
label: "Issue a refund",
|
|
1105
|
+
prompt: "Walk me through issuing a refund for a customer payment."
|
|
1106
|
+
}
|
|
1054
1107
|
]
|
|
1055
1108
|
},
|
|
1056
1109
|
{
|
|
1057
1110
|
id: "subscriptions",
|
|
1058
1111
|
title: "Subscription Management",
|
|
1059
1112
|
topics: [
|
|
1060
|
-
{
|
|
1061
|
-
|
|
1113
|
+
{
|
|
1114
|
+
id: "create-subscription",
|
|
1115
|
+
label: "Create a subscription",
|
|
1116
|
+
prompt: "How do I set up a new subscription plan for a customer?"
|
|
1117
|
+
},
|
|
1118
|
+
{
|
|
1119
|
+
id: "update-subscription",
|
|
1120
|
+
label: "Update subscription tier",
|
|
1121
|
+
prompt: "How can I change a customer's subscription plan or upgrade them?"
|
|
1122
|
+
}
|
|
1062
1123
|
]
|
|
1063
1124
|
},
|
|
1064
1125
|
{
|
|
1065
1126
|
id: "billing",
|
|
1066
1127
|
title: "Billing",
|
|
1067
1128
|
topics: [
|
|
1068
|
-
{
|
|
1129
|
+
{
|
|
1130
|
+
id: "payment-methods",
|
|
1131
|
+
label: "Manage payment methods",
|
|
1132
|
+
prompt: "How do customers add or update their payment methods?"
|
|
1133
|
+
}
|
|
1069
1134
|
]
|
|
1070
1135
|
}
|
|
1071
1136
|
];
|
|
@@ -1211,18 +1276,21 @@ function ChatPanel({
|
|
|
1211
1276
|
} = {}) {
|
|
1212
1277
|
const [messages, setMessages] = React4.useState(initialMessages);
|
|
1213
1278
|
const [input, setInput] = React4.useState("");
|
|
1214
|
-
const [sessionId] = React4.useState(() => crypto.randomUUID());
|
|
1279
|
+
const [sessionId, setSessionId] = React4.useState(() => crypto.randomUUID());
|
|
1280
|
+
const resetSession = React4.useCallback(() => {
|
|
1281
|
+
setSessionId(crypto.randomUUID());
|
|
1282
|
+
}, []);
|
|
1215
1283
|
const streamIntervals = React4.useRef({});
|
|
1216
1284
|
const isEmpty = messages.length === 0;
|
|
1217
1285
|
const [phase, setPhase] = React4.useState("idle");
|
|
1218
1286
|
const [progressSteps, setProgressSteps] = React4.useState([]);
|
|
1219
1287
|
const phaseTimers = React4.useRef([]);
|
|
1220
1288
|
const lastRole = messages.length ? messages[messages.length - 1].role : void 0;
|
|
1221
|
-
const [panelView, setPanelView] = React4.useState(
|
|
1222
|
-
|
|
1223
|
-
const [startingQuestions, setStartingQuestions] = React4.useState(
|
|
1224
|
-
startingQuestionsProp || defaultStartingQuestions
|
|
1289
|
+
const [panelView, setPanelView] = React4.useState(
|
|
1290
|
+
"landing"
|
|
1225
1291
|
);
|
|
1292
|
+
const [currentFolderId, setCurrentFolderId] = React4.useState(void 0);
|
|
1293
|
+
const [startingQuestions, setStartingQuestions] = React4.useState(startingQuestionsProp || defaultStartingQuestions);
|
|
1226
1294
|
const [loadingQuestions, setLoadingQuestions] = React4.useState(false);
|
|
1227
1295
|
React4.useEffect(() => {
|
|
1228
1296
|
if (startingQuestionsEndpoint && !startingQuestionsProp) {
|
|
@@ -1246,10 +1314,11 @@ function ChatPanel({
|
|
|
1246
1314
|
const latestBulkSummaryNavigationRef = React4.useRef(null);
|
|
1247
1315
|
const [guideComplete, setGuideComplete] = React4.useState(false);
|
|
1248
1316
|
React4.useEffect(() => {
|
|
1249
|
-
;
|
|
1250
1317
|
window.resetIntegrationNotification = () => {
|
|
1251
1318
|
localStorage.removeItem("gmailNotificationSeen");
|
|
1252
|
-
console.log(
|
|
1319
|
+
console.log(
|
|
1320
|
+
"Integration notification reset! Click the Integrations tab to see it again."
|
|
1321
|
+
);
|
|
1253
1322
|
};
|
|
1254
1323
|
const handleIntegrationTabClick = () => {
|
|
1255
1324
|
const hasSeenNotification = localStorage.getItem("gmailNotificationSeen");
|
|
@@ -1272,7 +1341,10 @@ function ChatPanel({
|
|
|
1272
1341
|
};
|
|
1273
1342
|
window.addEventListener("integrationTabClicked", handleIntegrationTabClick);
|
|
1274
1343
|
return () => {
|
|
1275
|
-
window.removeEventListener(
|
|
1344
|
+
window.removeEventListener(
|
|
1345
|
+
"integrationTabClicked",
|
|
1346
|
+
handleIntegrationTabClick
|
|
1347
|
+
);
|
|
1276
1348
|
};
|
|
1277
1349
|
}, []);
|
|
1278
1350
|
React4.useEffect(() => {
|
|
@@ -1307,7 +1379,12 @@ function ChatPanel({
|
|
|
1307
1379
|
const id = Date.now() + 1;
|
|
1308
1380
|
setMessages((prev) => [
|
|
1309
1381
|
...prev,
|
|
1310
|
-
{
|
|
1382
|
+
{
|
|
1383
|
+
id,
|
|
1384
|
+
role: "assistant",
|
|
1385
|
+
kind: "guideComplete",
|
|
1386
|
+
content: "Perfect! The dialog is now open. You can enter a name and create your API key."
|
|
1387
|
+
}
|
|
1311
1388
|
]);
|
|
1312
1389
|
setActiveGuide(void 0);
|
|
1313
1390
|
setGuideComplete(true);
|
|
@@ -1318,7 +1395,9 @@ function ChatPanel({
|
|
|
1318
1395
|
}, [activeGuide, hide]);
|
|
1319
1396
|
React4.useEffect(() => {
|
|
1320
1397
|
return () => {
|
|
1321
|
-
Object.values(streamIntervals.current).forEach(
|
|
1398
|
+
Object.values(streamIntervals.current).forEach(
|
|
1399
|
+
(id) => window.clearInterval(id)
|
|
1400
|
+
);
|
|
1322
1401
|
streamIntervals.current = {};
|
|
1323
1402
|
phaseTimers.current.forEach((id) => window.clearTimeout(id));
|
|
1324
1403
|
phaseTimers.current = [];
|
|
@@ -1379,9 +1458,17 @@ function ChatPanel({
|
|
|
1379
1458
|
return;
|
|
1380
1459
|
}
|
|
1381
1460
|
const currentBulkNav = latestBulkSummaryNavigationRef.current;
|
|
1382
|
-
console.log(
|
|
1461
|
+
console.log(
|
|
1462
|
+
"[DEBUG] Keyboard handler - latestBulkSummaryNavigation:",
|
|
1463
|
+
currentBulkNav,
|
|
1464
|
+
"onNavigate:",
|
|
1465
|
+
!!onNavigate
|
|
1466
|
+
);
|
|
1383
1467
|
if (currentBulkNav && onNavigate) {
|
|
1384
|
-
console.log(
|
|
1468
|
+
console.log(
|
|
1469
|
+
"[DEBUG] Navigating via keyboard to:",
|
|
1470
|
+
currentBulkNav.page
|
|
1471
|
+
);
|
|
1385
1472
|
e.preventDefault();
|
|
1386
1473
|
e.stopPropagation();
|
|
1387
1474
|
onNavigate(currentBulkNav.page, currentBulkNav.subtab);
|
|
@@ -1404,21 +1491,57 @@ function ChatPanel({
|
|
|
1404
1491
|
};
|
|
1405
1492
|
window.addEventListener("keydown", handleKeyDown);
|
|
1406
1493
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
1407
|
-
}, [
|
|
1494
|
+
}, [
|
|
1495
|
+
pendingAction,
|
|
1496
|
+
pendingNavigation,
|
|
1497
|
+
activeGuide,
|
|
1498
|
+
guideComplete,
|
|
1499
|
+
onNavigate
|
|
1500
|
+
]);
|
|
1408
1501
|
function streamAssistantMessage(messageId, fullText, followups) {
|
|
1409
|
-
|
|
1502
|
+
let textToStream = fullText;
|
|
1503
|
+
let extractedFollowups = followups;
|
|
1504
|
+
if (fullText && fullText.startsWith("{") && fullText.includes('"response"')) {
|
|
1505
|
+
try {
|
|
1506
|
+
let depth = 0, endIdx = 0;
|
|
1507
|
+
for (let i2 = 0; i2 < fullText.length; i2++) {
|
|
1508
|
+
if (fullText[i2] === "{") depth++;
|
|
1509
|
+
else if (fullText[i2] === "}") {
|
|
1510
|
+
depth--;
|
|
1511
|
+
if (depth === 0) {
|
|
1512
|
+
endIdx = i2 + 1;
|
|
1513
|
+
break;
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
const firstJson = endIdx > 0 ? fullText.slice(0, endIdx) : fullText;
|
|
1518
|
+
const parsed = JSON.parse(firstJson);
|
|
1519
|
+
if (parsed.response && typeof parsed.response === "string") {
|
|
1520
|
+
textToStream = parsed.response;
|
|
1521
|
+
if (!extractedFollowups && parsed.followups) {
|
|
1522
|
+
extractedFollowups = parsed.followups;
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
} catch {
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
const tokens = textToStream.split(" ");
|
|
1410
1529
|
let i = 0;
|
|
1411
1530
|
const intervalId = window.setInterval(() => {
|
|
1412
1531
|
i += 1;
|
|
1413
1532
|
setMessages(
|
|
1414
|
-
(prev) => prev.map(
|
|
1533
|
+
(prev) => prev.map(
|
|
1534
|
+
(m) => m.id === messageId ? { ...m, content: tokens.slice(0, i).join(" ") } : m
|
|
1535
|
+
)
|
|
1415
1536
|
);
|
|
1416
1537
|
if (i >= tokens.length) {
|
|
1417
1538
|
window.clearInterval(intervalId);
|
|
1418
1539
|
delete streamIntervals.current[messageId];
|
|
1419
|
-
if (
|
|
1540
|
+
if (extractedFollowups && extractedFollowups.length > 0) {
|
|
1420
1541
|
setMessages(
|
|
1421
|
-
(prev) => prev.map(
|
|
1542
|
+
(prev) => prev.map(
|
|
1543
|
+
(m) => m.id === messageId ? { ...m, followups: extractedFollowups } : m
|
|
1544
|
+
)
|
|
1422
1545
|
);
|
|
1423
1546
|
}
|
|
1424
1547
|
setPhase("idle");
|
|
@@ -1428,16 +1551,21 @@ function ChatPanel({
|
|
|
1428
1551
|
}
|
|
1429
1552
|
function handleFollowupClick(messageId, followup) {
|
|
1430
1553
|
setMessages(
|
|
1431
|
-
(prev) => prev.map(
|
|
1554
|
+
(prev) => prev.map(
|
|
1555
|
+
(m) => m.id === messageId ? { ...m, followupSelected: true } : m
|
|
1556
|
+
)
|
|
1432
1557
|
);
|
|
1433
1558
|
startChatFlow(followup.label);
|
|
1434
1559
|
}
|
|
1435
1560
|
function handleBack() {
|
|
1436
|
-
Object.values(streamIntervals.current).forEach(
|
|
1561
|
+
Object.values(streamIntervals.current).forEach(
|
|
1562
|
+
(id) => window.clearInterval(id)
|
|
1563
|
+
);
|
|
1437
1564
|
streamIntervals.current = {};
|
|
1438
1565
|
phaseTimers.current.forEach((id) => window.clearTimeout(id));
|
|
1439
1566
|
phaseTimers.current = [];
|
|
1440
1567
|
hide();
|
|
1568
|
+
resetSession();
|
|
1441
1569
|
setMessages([]);
|
|
1442
1570
|
setInput("");
|
|
1443
1571
|
setPhase("idle");
|
|
@@ -1597,7 +1725,10 @@ function ChatPanel({
|
|
|
1597
1725
|
content: ""
|
|
1598
1726
|
};
|
|
1599
1727
|
setMessages((prev) => [...prev, thankYouMessage]);
|
|
1600
|
-
streamAssistantMessage(
|
|
1728
|
+
streamAssistantMessage(
|
|
1729
|
+
thankYouMessageId,
|
|
1730
|
+
"Thank you, your feedback is saved."
|
|
1731
|
+
);
|
|
1601
1732
|
return;
|
|
1602
1733
|
}
|
|
1603
1734
|
setPendingNavigation(null);
|
|
@@ -1655,7 +1786,10 @@ function ChatPanel({
|
|
|
1655
1786
|
} else if (data.status === "executing") {
|
|
1656
1787
|
setPhase("executing");
|
|
1657
1788
|
setProgressSteps((prev) => {
|
|
1658
|
-
const updated = prev.map((step) => ({
|
|
1789
|
+
const updated = prev.map((step) => ({
|
|
1790
|
+
...step,
|
|
1791
|
+
completed: true
|
|
1792
|
+
}));
|
|
1659
1793
|
const lastStep = updated[updated.length - 1];
|
|
1660
1794
|
if (!lastStep || lastStep.message !== data.message) {
|
|
1661
1795
|
updated.push({ message: data.message, completed: false });
|
|
@@ -1664,7 +1798,9 @@ function ChatPanel({
|
|
|
1664
1798
|
});
|
|
1665
1799
|
} else if (data.status === "responding") {
|
|
1666
1800
|
setPhase("responding");
|
|
1667
|
-
setProgressSteps(
|
|
1801
|
+
setProgressSteps(
|
|
1802
|
+
(prev) => prev.map((step) => ({ ...step, completed: true }))
|
|
1803
|
+
);
|
|
1668
1804
|
}
|
|
1669
1805
|
} else if (eventType === "response") {
|
|
1670
1806
|
setProgressSteps([]);
|
|
@@ -1710,7 +1846,11 @@ function ChatPanel({
|
|
|
1710
1846
|
content: ""
|
|
1711
1847
|
};
|
|
1712
1848
|
setMessages((prev) => [...prev, assistantMessage]);
|
|
1713
|
-
streamAssistantMessage(
|
|
1849
|
+
streamAssistantMessage(
|
|
1850
|
+
assistantMessageId,
|
|
1851
|
+
agentResponse.response || agentResponse.message || "For bulk operations, you can upload a CSV file - just click the \u{1F4CE} button!",
|
|
1852
|
+
agentResponse.followups
|
|
1853
|
+
);
|
|
1714
1854
|
streamCompleted = true;
|
|
1715
1855
|
} else if (agentResponse.action === "bulk_preview") {
|
|
1716
1856
|
setPendingBulkSession(agentResponse.bulk_session_id);
|
|
@@ -1742,12 +1882,18 @@ function ChatPanel({
|
|
|
1742
1882
|
structuredData: agentResponse.structuredData || void 0
|
|
1743
1883
|
};
|
|
1744
1884
|
setMessages((prev) => [...prev, assistantMessage]);
|
|
1745
|
-
streamAssistantMessage(
|
|
1885
|
+
streamAssistantMessage(
|
|
1886
|
+
assistantMessageId,
|
|
1887
|
+
agentResponse.response,
|
|
1888
|
+
agentResponse.followups
|
|
1889
|
+
);
|
|
1746
1890
|
streamCompleted = true;
|
|
1747
1891
|
setTimeout(() => {
|
|
1748
|
-
window.dispatchEvent(
|
|
1749
|
-
|
|
1750
|
-
|
|
1892
|
+
window.dispatchEvent(
|
|
1893
|
+
new CustomEvent("agentActionComplete", {
|
|
1894
|
+
detail: { result: agentResponse.executionResult }
|
|
1895
|
+
})
|
|
1896
|
+
);
|
|
1751
1897
|
}, 100);
|
|
1752
1898
|
} else {
|
|
1753
1899
|
const assistantMessageId = now + 1;
|
|
@@ -1758,7 +1904,11 @@ function ChatPanel({
|
|
|
1758
1904
|
content: ""
|
|
1759
1905
|
};
|
|
1760
1906
|
setMessages((prev) => [...prev, assistantMessage]);
|
|
1761
|
-
streamAssistantMessage(
|
|
1907
|
+
streamAssistantMessage(
|
|
1908
|
+
assistantMessageId,
|
|
1909
|
+
agentResponse.response,
|
|
1910
|
+
agentResponse.followups
|
|
1911
|
+
);
|
|
1762
1912
|
streamCompleted = true;
|
|
1763
1913
|
}
|
|
1764
1914
|
} else if (eventType === "error") {
|
|
@@ -1773,7 +1923,10 @@ function ChatPanel({
|
|
|
1773
1923
|
content: ""
|
|
1774
1924
|
};
|
|
1775
1925
|
setMessages((prev) => [...prev, errorMessage]);
|
|
1776
|
-
streamAssistantMessage(
|
|
1926
|
+
streamAssistantMessage(
|
|
1927
|
+
errorMessageId,
|
|
1928
|
+
data.message || "An error occurred processing your request."
|
|
1929
|
+
);
|
|
1777
1930
|
} else if (eventType === "done") {
|
|
1778
1931
|
setProgressSteps([]);
|
|
1779
1932
|
setPhase("idle");
|
|
@@ -1799,7 +1952,18 @@ function ChatPanel({
|
|
|
1799
1952
|
content: ""
|
|
1800
1953
|
};
|
|
1801
1954
|
setMessages((prev) => [...prev, errorMessage]);
|
|
1802
|
-
|
|
1955
|
+
let errorText = "I'm having trouble connecting to my backend.";
|
|
1956
|
+
if (error instanceof Error) {
|
|
1957
|
+
if (error.name === "AbortError") {
|
|
1958
|
+
errorText = "The request timed out. The server might be busy - please try again.";
|
|
1959
|
+
} else if (error.message.includes("Failed to fetch") || error.message.includes("NetworkError")) {
|
|
1960
|
+
errorText = "I'm having trouble connecting to my backend. Please make sure the agent server is running on port 5002.";
|
|
1961
|
+
} else if (error.message.includes("Agent request failed:")) {
|
|
1962
|
+
errorText = "The server encountered an error. Please try again.";
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
errorText += " For simple navigation requests, I can still help you locally.";
|
|
1966
|
+
streamAssistantMessage(errorMessageId, errorText);
|
|
1803
1967
|
} finally {
|
|
1804
1968
|
setProgressSteps([]);
|
|
1805
1969
|
}
|
|
@@ -1883,33 +2047,41 @@ ${userText}`
|
|
|
1883
2047
|
setMessages((prev) => [...prev, previewMessage]);
|
|
1884
2048
|
} else if (eventType === "progress") {
|
|
1885
2049
|
setPhase("executing");
|
|
1886
|
-
setProgressSteps([
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
2050
|
+
setProgressSteps([
|
|
2051
|
+
{
|
|
2052
|
+
message: `Processing row ${data.row} of ${data.total}...`,
|
|
2053
|
+
completed: false
|
|
2054
|
+
}
|
|
2055
|
+
]);
|
|
1890
2056
|
setMessages((prev) => {
|
|
1891
2057
|
const lastMsg = prev[prev.length - 1];
|
|
1892
2058
|
if (lastMsg?.kind === "bulkProgress") {
|
|
1893
2059
|
return prev.map(
|
|
1894
|
-
(m, i) => i === prev.length - 1 ? {
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
2060
|
+
(m, i) => i === prev.length - 1 ? {
|
|
2061
|
+
...m,
|
|
2062
|
+
bulkProgress: {
|
|
2063
|
+
processed: data.row,
|
|
2064
|
+
total: data.total,
|
|
2065
|
+
successes: data.successes || 0,
|
|
2066
|
+
failures: data.failures || 0
|
|
2067
|
+
}
|
|
2068
|
+
} : m
|
|
1900
2069
|
);
|
|
1901
2070
|
} else {
|
|
1902
|
-
return [
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
2071
|
+
return [
|
|
2072
|
+
...prev,
|
|
2073
|
+
{
|
|
2074
|
+
id: Date.now(),
|
|
2075
|
+
role: "assistant",
|
|
2076
|
+
kind: "bulkProgress",
|
|
2077
|
+
bulkProgress: {
|
|
2078
|
+
processed: data.row,
|
|
2079
|
+
total: data.total,
|
|
2080
|
+
successes: data.successes || 0,
|
|
2081
|
+
failures: data.failures || 0
|
|
2082
|
+
}
|
|
1911
2083
|
}
|
|
1912
|
-
|
|
2084
|
+
];
|
|
1913
2085
|
}
|
|
1914
2086
|
});
|
|
1915
2087
|
} else if (eventType === "summary") {
|
|
@@ -1918,23 +2090,34 @@ ${userText}`
|
|
|
1918
2090
|
setPendingBulkSession(null);
|
|
1919
2091
|
setMessages((prev) => {
|
|
1920
2092
|
const filtered = prev.filter((m) => m.kind !== "bulkProgress");
|
|
1921
|
-
return [
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
2093
|
+
return [
|
|
2094
|
+
...filtered,
|
|
2095
|
+
{
|
|
2096
|
+
id: Date.now(),
|
|
2097
|
+
role: "assistant",
|
|
2098
|
+
kind: "bulkSummary",
|
|
2099
|
+
content: data.message,
|
|
2100
|
+
bulkSummary: {
|
|
2101
|
+
total: data.total,
|
|
2102
|
+
successes: data.successes,
|
|
2103
|
+
failures: data.failures || [],
|
|
2104
|
+
navigationPage: data.navigationPage
|
|
2105
|
+
}
|
|
1931
2106
|
}
|
|
1932
|
-
|
|
2107
|
+
];
|
|
1933
2108
|
});
|
|
1934
2109
|
setTimeout(() => {
|
|
1935
|
-
window.dispatchEvent(
|
|
1936
|
-
|
|
1937
|
-
|
|
2110
|
+
window.dispatchEvent(
|
|
2111
|
+
new CustomEvent("agentActionComplete", {
|
|
2112
|
+
detail: {
|
|
2113
|
+
result: {
|
|
2114
|
+
bulk: true,
|
|
2115
|
+
total: data.total,
|
|
2116
|
+
successes: data.successes
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
})
|
|
2120
|
+
);
|
|
1938
2121
|
}, 100);
|
|
1939
2122
|
} else if (eventType === "error") {
|
|
1940
2123
|
setPhase("idle");
|
|
@@ -1962,18 +2145,31 @@ ${userText}`
|
|
|
1962
2145
|
console.error("Bulk upload failed:", error);
|
|
1963
2146
|
setProgressSteps([]);
|
|
1964
2147
|
setPhase("idle");
|
|
2148
|
+
let errorText = "I'm having trouble processing your CSV file.";
|
|
2149
|
+
if (error instanceof Error) {
|
|
2150
|
+
if (error.name === "AbortError") {
|
|
2151
|
+
errorText = "The bulk upload request timed out. The file might be too large or the server is busy - please try again.";
|
|
2152
|
+
} else if (error.message.includes("Failed to fetch") || error.message.includes("NetworkError")) {
|
|
2153
|
+
errorText = "I'm having trouble connecting to my backend. Please make sure the agent server is running on port 5002.";
|
|
2154
|
+
} else if (error.message.includes("Bulk upload failed:")) {
|
|
2155
|
+
errorText = "The server encountered an error processing your CSV file. Please try again.";
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
errorText += " Please try again.";
|
|
1965
2159
|
const errorMessage = {
|
|
1966
2160
|
id: now + 1,
|
|
1967
2161
|
role: "assistant",
|
|
1968
2162
|
kind: "text",
|
|
1969
|
-
content:
|
|
2163
|
+
content: errorText
|
|
1970
2164
|
};
|
|
1971
2165
|
setMessages((prev) => [...prev, errorMessage]);
|
|
1972
2166
|
}
|
|
1973
2167
|
}
|
|
1974
2168
|
async function confirmBulkOperation(bulkSessionId) {
|
|
1975
2169
|
setPhase("executing");
|
|
1976
|
-
setProgressSteps([
|
|
2170
|
+
setProgressSteps([
|
|
2171
|
+
{ message: "Starting bulk operation...", completed: false }
|
|
2172
|
+
]);
|
|
1977
2173
|
try {
|
|
1978
2174
|
const response = await fetch(`${agentUrl}/chat/bulk/confirm`, {
|
|
1979
2175
|
method: "POST",
|
|
@@ -2009,43 +2205,56 @@ ${userText}`
|
|
|
2009
2205
|
try {
|
|
2010
2206
|
const data = JSON.parse(eventData);
|
|
2011
2207
|
if (eventType === "progress") {
|
|
2012
|
-
setProgressSteps([
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2208
|
+
setProgressSteps([
|
|
2209
|
+
{
|
|
2210
|
+
message: `Processing row ${data.row} of ${data.total}...`,
|
|
2211
|
+
completed: false
|
|
2212
|
+
}
|
|
2213
|
+
]);
|
|
2016
2214
|
setMessages((prev) => {
|
|
2017
2215
|
const lastMsg = prev[prev.length - 1];
|
|
2018
2216
|
if (lastMsg?.kind === "bulkProgress") {
|
|
2019
2217
|
return prev.map(
|
|
2020
|
-
(m, i) => i === prev.length - 1 ? {
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2218
|
+
(m, i) => i === prev.length - 1 ? {
|
|
2219
|
+
...m,
|
|
2220
|
+
bulkProgress: {
|
|
2221
|
+
processed: data.row,
|
|
2222
|
+
total: data.total,
|
|
2223
|
+
successes: data.successes || 0,
|
|
2224
|
+
failures: data.failures || 0
|
|
2225
|
+
}
|
|
2226
|
+
} : m
|
|
2026
2227
|
);
|
|
2027
2228
|
} else {
|
|
2028
|
-
return [
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2229
|
+
return [
|
|
2230
|
+
...prev,
|
|
2231
|
+
{
|
|
2232
|
+
id: Date.now(),
|
|
2233
|
+
role: "assistant",
|
|
2234
|
+
kind: "bulkProgress",
|
|
2235
|
+
bulkProgress: {
|
|
2236
|
+
processed: data.row,
|
|
2237
|
+
total: data.total,
|
|
2238
|
+
successes: data.successes || 0,
|
|
2239
|
+
failures: data.failures || 0
|
|
2240
|
+
}
|
|
2037
2241
|
}
|
|
2038
|
-
|
|
2242
|
+
];
|
|
2039
2243
|
}
|
|
2040
2244
|
});
|
|
2041
2245
|
} else if (eventType === "summary") {
|
|
2042
2246
|
console.log("[DEBUG] Received summary event - data:", data);
|
|
2043
|
-
console.log(
|
|
2247
|
+
console.log(
|
|
2248
|
+
"[DEBUG] navigationPage from backend:",
|
|
2249
|
+
data.navigationPage
|
|
2250
|
+
);
|
|
2044
2251
|
setPhase("idle");
|
|
2045
2252
|
setProgressSteps([]);
|
|
2046
2253
|
setPendingBulkSession(null);
|
|
2047
2254
|
setMessages((prev) => {
|
|
2048
|
-
const filtered = prev.filter(
|
|
2255
|
+
const filtered = prev.filter(
|
|
2256
|
+
(m) => m.kind !== "bulkProgress" && m.kind !== "bulkPreview"
|
|
2257
|
+
);
|
|
2049
2258
|
const newMsg = {
|
|
2050
2259
|
id: Date.now(),
|
|
2051
2260
|
role: "assistant",
|
|
@@ -2062,9 +2271,17 @@ ${userText}`
|
|
|
2062
2271
|
return [...filtered, newMsg];
|
|
2063
2272
|
});
|
|
2064
2273
|
setTimeout(() => {
|
|
2065
|
-
window.dispatchEvent(
|
|
2066
|
-
|
|
2067
|
-
|
|
2274
|
+
window.dispatchEvent(
|
|
2275
|
+
new CustomEvent("agentActionComplete", {
|
|
2276
|
+
detail: {
|
|
2277
|
+
result: {
|
|
2278
|
+
bulk: true,
|
|
2279
|
+
total: data.total,
|
|
2280
|
+
successes: data.successes
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
})
|
|
2284
|
+
);
|
|
2068
2285
|
}, 100);
|
|
2069
2286
|
} else if (eventType === "error") {
|
|
2070
2287
|
setPhase("idle");
|
|
@@ -2106,7 +2323,10 @@ ${userText}`
|
|
|
2106
2323
|
}
|
|
2107
2324
|
function appendAssistantText(text) {
|
|
2108
2325
|
const id = Date.now() + Math.floor(Math.random() * 1e3);
|
|
2109
|
-
setMessages((prev) => [
|
|
2326
|
+
setMessages((prev) => [
|
|
2327
|
+
...prev,
|
|
2328
|
+
{ id, role: "assistant", kind: "text", content: text }
|
|
2329
|
+
]);
|
|
2110
2330
|
}
|
|
2111
2331
|
function startGuide(guideId) {
|
|
2112
2332
|
const guide = guides[guideId];
|
|
@@ -2119,7 +2339,9 @@ ${userText}`
|
|
|
2119
2339
|
appendAssistantText(`I'll help you with ${guide.title}.`);
|
|
2120
2340
|
const firstStep = guide.steps[0];
|
|
2121
2341
|
const isNavigationButton = firstStep.cursorTarget?.selector.includes("[data-page=");
|
|
2122
|
-
const isTabButton = firstStep.cursorTarget?.selector.includes(
|
|
2342
|
+
const isTabButton = firstStep.cursorTarget?.selector.includes(
|
|
2343
|
+
"[data-settings-tab="
|
|
2344
|
+
);
|
|
2123
2345
|
if (firstStep.cursorTarget && (isNavigationButton || isTabButton)) {
|
|
2124
2346
|
const cursorTarget = firstStep.cursorTarget;
|
|
2125
2347
|
if (isTabButton && firstStep.navigation && onNavigate) {
|
|
@@ -2128,7 +2350,9 @@ ${userText}`
|
|
|
2128
2350
|
const initialDelay = isTabButton ? 800 : 400;
|
|
2129
2351
|
setTimeout(() => {
|
|
2130
2352
|
const waitForElement = () => {
|
|
2131
|
-
const element = document.querySelector(
|
|
2353
|
+
const element = document.querySelector(
|
|
2354
|
+
cursorTarget.selector
|
|
2355
|
+
);
|
|
2132
2356
|
if (element && element.offsetParent !== null) {
|
|
2133
2357
|
moveTo(cursorTarget);
|
|
2134
2358
|
if (cursorTarget.onClick) {
|
|
@@ -2153,7 +2377,9 @@ ${userText}`
|
|
|
2153
2377
|
const initialDelay = isDialogElement ? 700 : isSettingsTab ? 600 : 400;
|
|
2154
2378
|
setTimeout(() => {
|
|
2155
2379
|
const waitForElement = () => {
|
|
2156
|
-
const element = document.querySelector(
|
|
2380
|
+
const element = document.querySelector(
|
|
2381
|
+
cursorTarget.selector
|
|
2382
|
+
);
|
|
2157
2383
|
if (element && element.offsetParent !== null) {
|
|
2158
2384
|
moveTo(cursorTarget);
|
|
2159
2385
|
if (cursorTarget.onClick) {
|
|
@@ -2167,7 +2393,9 @@ ${userText}`
|
|
|
2167
2393
|
moveTo(cursorTarget);
|
|
2168
2394
|
if (cursorTarget.onClick) {
|
|
2169
2395
|
setTimeout(() => {
|
|
2170
|
-
const el = document.querySelector(
|
|
2396
|
+
const el = document.querySelector(
|
|
2397
|
+
cursorTarget.selector
|
|
2398
|
+
);
|
|
2171
2399
|
if (el) el.click();
|
|
2172
2400
|
}, 1e3);
|
|
2173
2401
|
}
|
|
@@ -2204,7 +2432,12 @@ ${userText}`
|
|
|
2204
2432
|
const id = Date.now() + 1;
|
|
2205
2433
|
setMessages((prev) => [
|
|
2206
2434
|
...prev,
|
|
2207
|
-
{
|
|
2435
|
+
{
|
|
2436
|
+
id,
|
|
2437
|
+
role: "assistant",
|
|
2438
|
+
kind: "guideComplete",
|
|
2439
|
+
content: "Guide Complete"
|
|
2440
|
+
}
|
|
2208
2441
|
]);
|
|
2209
2442
|
setActiveGuide(void 0);
|
|
2210
2443
|
setGuideComplete(true);
|
|
@@ -2223,7 +2456,9 @@ ${userText}`
|
|
|
2223
2456
|
};
|
|
2224
2457
|
setMessages((prev) => [...prev, draft]);
|
|
2225
2458
|
const isNavigationButton = nextStep.cursorTarget?.selector.includes("[data-page=");
|
|
2226
|
-
const isTabButton = nextStep.cursorTarget?.selector.includes(
|
|
2459
|
+
const isTabButton = nextStep.cursorTarget?.selector.includes(
|
|
2460
|
+
"[data-settings-tab="
|
|
2461
|
+
);
|
|
2227
2462
|
if (nextStep.cursorTarget && (isNavigationButton || isTabButton)) {
|
|
2228
2463
|
const cursorTarget = nextStep.cursorTarget;
|
|
2229
2464
|
if (isTabButton && nextStep.navigation && onNavigate) {
|
|
@@ -2240,7 +2475,9 @@ ${userText}`
|
|
|
2240
2475
|
if (!currentGuide3 || currentGuide3.id !== guide.id || currentGuide3.stepIndex !== nextIndex) {
|
|
2241
2476
|
return;
|
|
2242
2477
|
}
|
|
2243
|
-
const element = document.querySelector(
|
|
2478
|
+
const element = document.querySelector(
|
|
2479
|
+
cursorTarget.selector
|
|
2480
|
+
);
|
|
2244
2481
|
if (element && element.offsetParent !== null) {
|
|
2245
2482
|
moveTo(cursorTarget);
|
|
2246
2483
|
if (cursorTarget.onClick) {
|
|
@@ -2266,7 +2503,9 @@ ${userText}`
|
|
|
2266
2503
|
const cursorTarget = nextStep.cursorTarget;
|
|
2267
2504
|
const isDialogElement = cursorTarget.selector.includes("dialog") || cursorTarget.selector.includes("api-key-name-input");
|
|
2268
2505
|
const isSettingsTab = cursorTarget.selector.includes("data-settings-tab");
|
|
2269
|
-
const navigationSetTab = nextStep.navigation?.subtab && isSettingsTab && cursorTarget.selector.includes(
|
|
2506
|
+
const navigationSetTab = nextStep.navigation?.subtab && isSettingsTab && cursorTarget.selector.includes(
|
|
2507
|
+
`data-settings-tab="${nextStep.navigation.subtab}"`
|
|
2508
|
+
);
|
|
2270
2509
|
const shouldAutoClick = cursorTarget.onClick && !navigationSetTab;
|
|
2271
2510
|
const hasNavigation = !!nextStep.navigation;
|
|
2272
2511
|
const hasSubtab = !!nextStep.navigation?.subtab;
|
|
@@ -2282,7 +2521,9 @@ ${userText}`
|
|
|
2282
2521
|
if (!currentGuide3 || currentGuide3.id !== guide.id || currentGuide3.stepIndex !== nextIndex) {
|
|
2283
2522
|
return;
|
|
2284
2523
|
}
|
|
2285
|
-
const element = document.querySelector(
|
|
2524
|
+
const element = document.querySelector(
|
|
2525
|
+
cursorTarget.selector
|
|
2526
|
+
);
|
|
2286
2527
|
if (element && element.offsetParent !== null) {
|
|
2287
2528
|
moveTo(cursorTarget);
|
|
2288
2529
|
if (shouldAutoClick) {
|
|
@@ -2304,7 +2545,9 @@ ${userText}`
|
|
|
2304
2545
|
if (!currentGuide4 || currentGuide4.id !== guide.id || currentGuide4.stepIndex !== nextIndex) {
|
|
2305
2546
|
return;
|
|
2306
2547
|
}
|
|
2307
|
-
const el = document.querySelector(
|
|
2548
|
+
const el = document.querySelector(
|
|
2549
|
+
cursorTarget.selector
|
|
2550
|
+
);
|
|
2308
2551
|
if (el) el.click();
|
|
2309
2552
|
}, 1e3);
|
|
2310
2553
|
}
|
|
@@ -2336,10 +2579,17 @@ ${userText}`
|
|
|
2336
2579
|
} else {
|
|
2337
2580
|
hide();
|
|
2338
2581
|
}
|
|
2339
|
-
const existingMessages = messages.filter(
|
|
2582
|
+
const existingMessages = messages.filter(
|
|
2583
|
+
(m) => m.kind !== "guideStep" && m.kind !== "guideComplete"
|
|
2584
|
+
);
|
|
2340
2585
|
setMessages([
|
|
2341
2586
|
...existingMessages,
|
|
2342
|
-
{
|
|
2587
|
+
{
|
|
2588
|
+
id: Date.now(),
|
|
2589
|
+
role: "assistant",
|
|
2590
|
+
kind: "guideStep",
|
|
2591
|
+
content: prevStep.text
|
|
2592
|
+
}
|
|
2343
2593
|
]);
|
|
2344
2594
|
}
|
|
2345
2595
|
}
|
|
@@ -2362,6 +2612,7 @@ ${userText}`
|
|
|
2362
2612
|
size: "sm",
|
|
2363
2613
|
className: "h-7 w-7 p-0 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-full",
|
|
2364
2614
|
onClick: () => {
|
|
2615
|
+
resetSession();
|
|
2365
2616
|
setMessages([]);
|
|
2366
2617
|
setPanelView("landing");
|
|
2367
2618
|
setCurrentFolderId(void 0);
|
|
@@ -2384,919 +2635,1161 @@ ${userText}`
|
|
|
2384
2635
|
)
|
|
2385
2636
|
] })
|
|
2386
2637
|
] }),
|
|
2387
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
{
|
|
2395
|
-
type: "button",
|
|
2396
|
-
size: "sm",
|
|
2397
|
-
variant: "ghost",
|
|
2398
|
-
className: "w-full justify-start rounded-lg px-3 py-1.5 text-xs text-gray-700 hover:bg-gray-100 h-auto",
|
|
2399
|
-
onClick: () => sendTopic(question.prompt),
|
|
2400
|
-
children: [
|
|
2401
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: `mr-2 inline-block h-1.5 w-1.5 rounded-full ${iconColors[index % iconColors.length]}` }),
|
|
2402
|
-
question.label
|
|
2403
|
-
]
|
|
2404
|
-
},
|
|
2405
|
-
question.id
|
|
2406
|
-
);
|
|
2407
|
-
}) }) }),
|
|
2408
|
-
panelView === "folder" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2409
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mb-3 flex items-center gap-2", children: [
|
|
2410
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2411
|
-
Button,
|
|
2412
|
-
{
|
|
2413
|
-
type: "button",
|
|
2414
|
-
size: "icon",
|
|
2415
|
-
variant: "ghost",
|
|
2416
|
-
className: "h-7 w-7 rounded-full hover:bg-gray-100",
|
|
2417
|
-
onClick: closeFolder,
|
|
2418
|
-
"aria-label": "Back to suggestions",
|
|
2419
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.ArrowLeft, { className: "h-4 w-4 text-gray-500" })
|
|
2420
|
-
}
|
|
2421
|
-
),
|
|
2422
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs font-medium uppercase tracking-wide text-gray-400", children: "Topics" })
|
|
2638
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2639
|
+
"div",
|
|
2640
|
+
{
|
|
2641
|
+
className: isEmpty ? "grid flex-1 place-items-center transition-all duration-300" : "flex flex-1 flex-col transition-all duration-300 min-h-0 overflow-hidden",
|
|
2642
|
+
children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w-full overflow-y-auto px-4", children: [
|
|
2643
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "py-3 transition-all duration-300", children: [
|
|
2644
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h2", { className: "text-center text-2xl font-semibold text-gray-900", children: panelView === "folder" ? folders.find((f) => f.id === currentFolderId)?.title || "" : "What can I help with?" }),
|
|
2645
|
+
panelView === "landing" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "mt-1 text-center text-xs text-gray-500", children: "Ask me anything about your account" })
|
|
2423
2646
|
] }),
|
|
2424
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
] })
|
|
2438
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ScrollArea, { ref: messagesContainerRef, className: "h-full", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col gap-2 px-4 py-3", children: [
|
|
2439
|
-
messages.map((message, index) => {
|
|
2440
|
-
const isUser = message.role === "user";
|
|
2441
|
-
const previousRole = index > 0 ? messages[index - 1].role : void 0;
|
|
2442
|
-
const isRoleChange = previousRole !== void 0 && previousRole !== message.role;
|
|
2443
|
-
const currentGuide = activeGuideRef.current || activeGuide;
|
|
2444
|
-
let isCurrentGuideStep = false;
|
|
2445
|
-
if (currentGuide && message.kind === "guideStep") {
|
|
2446
|
-
if (message.guideStepIndex !== void 0) {
|
|
2447
|
-
isCurrentGuideStep = message.guideStepIndex === currentGuide.stepIndex;
|
|
2448
|
-
} else {
|
|
2449
|
-
isCurrentGuideStep = index === messages.length - 1;
|
|
2450
|
-
}
|
|
2451
|
-
} else if (message.kind === "guideComplete") {
|
|
2452
|
-
isCurrentGuideStep = index === messages.length - 1;
|
|
2453
|
-
}
|
|
2454
|
-
if (message.kind === "guideStep" && !isCurrentGuideStep) {
|
|
2455
|
-
return null;
|
|
2456
|
-
}
|
|
2457
|
-
if (isUser) {
|
|
2458
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `flex justify-end ${isRoleChange ? "mt-3" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "max-w-[260px] rounded-2xl rounded-br-md bg-gray-900 px-3.5 py-2.5 text-sm text-white shadow-sm", children: message.content }) }, message.id);
|
|
2459
|
-
}
|
|
2460
|
-
if (message.kind === "searchSummary") {
|
|
2461
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `${isRoleChange ? "mt-3" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AssistantSearchSummary, { title: message.title ?? "Search results", links: message.links ?? [] }) }, message.id);
|
|
2462
|
-
}
|
|
2463
|
-
if (message.kind === "guideComplete") {
|
|
2464
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2465
|
-
"div",
|
|
2466
|
-
{
|
|
2467
|
-
ref: isCurrentGuideStep ? currentStepRef : null,
|
|
2468
|
-
className: `${isRoleChange ? "mt-3" : ""}`,
|
|
2469
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2 rounded-xl bg-green-50 border border-green-200 px-3 py-2.5 text-sm leading-6", children: [
|
|
2470
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CheckCircle2, { className: "h-5 w-5 text-green-600 flex-shrink-0" }),
|
|
2471
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-medium text-green-800", children: message.content })
|
|
2472
|
-
] })
|
|
2473
|
-
},
|
|
2474
|
-
message.id
|
|
2475
|
-
);
|
|
2476
|
-
}
|
|
2477
|
-
if (message.kind === "navigationAction") {
|
|
2478
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `${isRoleChange ? "mt-3" : ""}`, children: [
|
|
2479
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-2 text-gray-700", children: message.content || "" }),
|
|
2480
|
-
message.navigationTarget && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2481
|
-
Button,
|
|
2482
|
-
{
|
|
2483
|
-
type: "button",
|
|
2484
|
-
size: "sm",
|
|
2485
|
-
variant: "secondary",
|
|
2486
|
-
className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
|
|
2487
|
-
onClick: () => message.navigationTarget && handleConfirmNavigation(message.navigationTarget),
|
|
2488
|
-
children: [
|
|
2489
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "Confirm" }),
|
|
2490
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
|
|
2491
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
|
|
2492
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
|
|
2493
|
-
] })
|
|
2494
|
-
]
|
|
2495
|
-
}
|
|
2496
|
-
) })
|
|
2497
|
-
] }, message.id);
|
|
2498
|
-
}
|
|
2499
|
-
if (message.kind === "actionForm") {
|
|
2500
|
-
const actionType = message.actionType;
|
|
2501
|
-
const formData = Object.keys(actionFormData).length > 0 ? actionFormData : message.actionData || {};
|
|
2502
|
-
if (message.isSubmitted) {
|
|
2503
|
-
let successContent = "";
|
|
2504
|
-
if (actionType === "updateCompanyInfo") {
|
|
2505
|
-
successContent = "Company information has been updated successfully.";
|
|
2506
|
-
} else if (actionType === "addApiKey") {
|
|
2507
|
-
successContent = "API key has been added successfully.";
|
|
2508
|
-
} else if (actionType === "addCustomer") {
|
|
2509
|
-
successContent = "Customer has been added successfully.";
|
|
2510
|
-
} else if (actionType === "enable2FA") {
|
|
2511
|
-
successContent = "Two-factor authentication has been enabled successfully.";
|
|
2512
|
-
} else if (actionType === "disable2FA") {
|
|
2513
|
-
successContent = "Two-factor authentication has been disabled successfully.";
|
|
2514
|
-
} else if (actionType === "changePassword") {
|
|
2515
|
-
successContent = "Your password has been changed successfully.";
|
|
2516
|
-
} else if (actionType === "revokeSession") {
|
|
2517
|
-
successContent = "Session has been revoked successfully.";
|
|
2518
|
-
} else if (actionType === "toggleNotification") {
|
|
2519
|
-
successContent = "Notification preferences have been updated successfully.";
|
|
2520
|
-
} else if (actionType === "connectIntegration") {
|
|
2521
|
-
successContent = "Integration has been connected successfully.";
|
|
2522
|
-
} else if (actionType === "disconnectIntegration") {
|
|
2523
|
-
successContent = "Integration has been disconnected successfully.";
|
|
2524
|
-
} else if (actionType === "addPaymentMethod") {
|
|
2525
|
-
successContent = "Payment method has been added successfully.";
|
|
2526
|
-
} else if (actionType === "removePaymentMethod") {
|
|
2527
|
-
successContent = "Payment method has been removed successfully.";
|
|
2528
|
-
} else if (actionType === "deleteApiKey") {
|
|
2529
|
-
successContent = "API key has been deleted successfully.";
|
|
2530
|
-
} else if (actionType === "addWebhook") {
|
|
2531
|
-
successContent = "Webhook endpoint has been added successfully.";
|
|
2532
|
-
} else if (actionType === "updateCurrency") {
|
|
2533
|
-
successContent = "Currency preference has been updated successfully.";
|
|
2534
|
-
} else if (actionType === "updateTimezone") {
|
|
2535
|
-
successContent = "Timezone has been updated successfully.";
|
|
2536
|
-
} else if (actionType === "refundPayment") {
|
|
2537
|
-
successContent = "Refund has been processed successfully.";
|
|
2538
|
-
} else if (actionType === "exportCertificate") {
|
|
2539
|
-
successContent = "Certificate of Incorporation has been downloaded successfully.";
|
|
2540
|
-
} else if (actionType === "createSubscription") {
|
|
2541
|
-
successContent = "Subscription has been created successfully.";
|
|
2542
|
-
} else if (actionType === "toggleBlockRule" || actionType === "enableBlockRule" || actionType === "disableBlockRule") {
|
|
2543
|
-
successContent = "Block rule has been updated successfully.";
|
|
2544
|
-
} else {
|
|
2545
|
-
successContent = "Action completed successfully.";
|
|
2546
|
-
}
|
|
2547
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `${isRoleChange ? "mt-3" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 text-gray-700", children: successContent }) }, message.id);
|
|
2548
|
-
}
|
|
2549
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `min-w-0 ${isRoleChange ? "mt-3" : ""}`, children: [
|
|
2550
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
|
|
2551
|
-
actionType === "updateCompanyInfo" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-2 bg-gray-50 rounded-lg p-2 border border-gray-200 overflow-hidden", children: [
|
|
2552
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
2553
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2554
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
|
|
2555
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2556
|
-
Input,
|
|
2557
|
-
{
|
|
2558
|
-
placeholder: "Acme Corporation",
|
|
2559
|
-
value: formData.companyName || "",
|
|
2560
|
-
onChange: (e) => setActionFormData({ ...actionFormData, companyName: e.target.value }),
|
|
2561
|
-
className: "h-8 text-xs border-gray-200"
|
|
2562
|
-
}
|
|
2563
|
-
)
|
|
2564
|
-
] }),
|
|
2565
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2566
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
|
|
2567
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2568
|
-
Input,
|
|
2569
|
-
{
|
|
2570
|
-
type: "email",
|
|
2571
|
-
placeholder: "contact@acme.com",
|
|
2572
|
-
value: formData.email || "",
|
|
2573
|
-
onChange: (e) => setActionFormData({ ...actionFormData, email: e.target.value }),
|
|
2574
|
-
className: "h-8 text-xs border-gray-200"
|
|
2575
|
-
}
|
|
2576
|
-
)
|
|
2577
|
-
] })
|
|
2578
|
-
] }),
|
|
2579
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2580
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Address" }),
|
|
2581
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2582
|
-
Input,
|
|
2647
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "pb-4 px-4", children: [
|
|
2648
|
+
panelView === "landing" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2649
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mb-2 text-[10px] font-semibold uppercase tracking-wider text-gray-400", children: "Suggested Questions" }),
|
|
2650
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex flex-col gap-1", children: loadingQuestions ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Loader2, { className: "h-4 w-4 animate-spin text-gray-400" }) }) : startingQuestions.map((question, index) => {
|
|
2651
|
+
const iconColors = [
|
|
2652
|
+
"bg-blue-400",
|
|
2653
|
+
"bg-green-400",
|
|
2654
|
+
"bg-purple-400",
|
|
2655
|
+
"bg-orange-400",
|
|
2656
|
+
"bg-pink-400"
|
|
2657
|
+
];
|
|
2658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2659
|
+
Button,
|
|
2583
2660
|
{
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
className: "
|
|
2588
|
-
|
|
2589
|
-
)
|
|
2590
|
-
] }),
|
|
2591
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
2592
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2593
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Phone" }),
|
|
2594
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2595
|
-
Input,
|
|
2596
|
-
{
|
|
2597
|
-
type: "tel",
|
|
2598
|
-
placeholder: "+1 (555) 123-4567",
|
|
2599
|
-
value: formData.phone || "",
|
|
2600
|
-
onChange: (e) => setActionFormData({ ...actionFormData, phone: e.target.value }),
|
|
2601
|
-
className: "h-8 text-xs border-gray-200"
|
|
2602
|
-
}
|
|
2603
|
-
)
|
|
2604
|
-
] }),
|
|
2605
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2606
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Website" }),
|
|
2607
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2608
|
-
Input,
|
|
2609
|
-
{
|
|
2610
|
-
type: "url",
|
|
2611
|
-
placeholder: "https://acme.com",
|
|
2612
|
-
value: formData.website || "",
|
|
2613
|
-
onChange: (e) => setActionFormData({ ...actionFormData, website: e.target.value }),
|
|
2614
|
-
className: "h-8 text-xs border-gray-200"
|
|
2615
|
-
}
|
|
2616
|
-
)
|
|
2617
|
-
] })
|
|
2618
|
-
] })
|
|
2619
|
-
] }),
|
|
2620
|
-
actionType === "addApiKey" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2621
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name" }),
|
|
2622
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2623
|
-
Input,
|
|
2624
|
-
{
|
|
2625
|
-
placeholder: "Production Key",
|
|
2626
|
-
value: formData.name || "",
|
|
2627
|
-
onChange: (e) => setActionFormData({ ...actionFormData, name: e.target.value }),
|
|
2628
|
-
className: "h-8 text-xs border-gray-200"
|
|
2629
|
-
}
|
|
2630
|
-
)
|
|
2631
|
-
] }) }),
|
|
2632
|
-
actionType === "addCustomer" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-2 bg-gray-50 rounded-lg p-2 border border-gray-200 overflow-hidden", children: [
|
|
2633
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
2634
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2635
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
|
|
2636
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2637
|
-
Input,
|
|
2638
|
-
{
|
|
2639
|
-
placeholder: "Acme Corporation",
|
|
2640
|
-
value: formData.name || "",
|
|
2641
|
-
onChange: (e) => setActionFormData({ ...actionFormData, name: e.target.value }),
|
|
2642
|
-
className: "h-8 text-xs border-gray-200"
|
|
2643
|
-
}
|
|
2644
|
-
)
|
|
2645
|
-
] }),
|
|
2646
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2647
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
|
|
2648
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2649
|
-
Input,
|
|
2650
|
-
{
|
|
2651
|
-
type: "email",
|
|
2652
|
-
placeholder: "contact@acme.com",
|
|
2653
|
-
value: formData.email || "",
|
|
2654
|
-
onChange: (e) => setActionFormData({ ...actionFormData, email: e.target.value }),
|
|
2655
|
-
className: "h-8 text-xs border-gray-200"
|
|
2656
|
-
}
|
|
2657
|
-
)
|
|
2658
|
-
] })
|
|
2659
|
-
] }),
|
|
2660
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2661
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Location" }),
|
|
2662
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2663
|
-
Input,
|
|
2664
|
-
{
|
|
2665
|
-
placeholder: "San Francisco, CA",
|
|
2666
|
-
value: formData.location || "",
|
|
2667
|
-
onChange: (e) => setActionFormData({ ...actionFormData, location: e.target.value }),
|
|
2668
|
-
className: "h-8 text-xs border-gray-200"
|
|
2669
|
-
}
|
|
2670
|
-
)
|
|
2671
|
-
] }),
|
|
2672
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2673
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Subscription Tier" }),
|
|
2674
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2675
|
-
"select",
|
|
2676
|
-
{
|
|
2677
|
-
value: formData.subscription || "Starter",
|
|
2678
|
-
onChange: (e) => setActionFormData({ ...actionFormData, subscription: e.target.value }),
|
|
2679
|
-
className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
|
|
2661
|
+
type: "button",
|
|
2662
|
+
size: "sm",
|
|
2663
|
+
variant: "ghost",
|
|
2664
|
+
className: "w-full justify-start rounded-lg px-3 py-1.5 text-xs text-gray-700 hover:bg-gray-100 h-auto",
|
|
2665
|
+
onClick: () => sendTopic(question.prompt),
|
|
2680
2666
|
children: [
|
|
2681
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2682
|
-
|
|
2683
|
-
|
|
2667
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2668
|
+
"span",
|
|
2669
|
+
{
|
|
2670
|
+
className: `mr-2 inline-block h-1.5 w-1.5 rounded-full ${iconColors[index % iconColors.length]}`
|
|
2671
|
+
}
|
|
2672
|
+
),
|
|
2673
|
+
question.label
|
|
2684
2674
|
]
|
|
2685
|
-
}
|
|
2686
|
-
|
|
2687
|
-
|
|
2675
|
+
},
|
|
2676
|
+
question.id
|
|
2677
|
+
);
|
|
2678
|
+
}) })
|
|
2688
2679
|
] }),
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2692
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Current Password" }),
|
|
2693
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2694
|
-
Input,
|
|
2695
|
-
{
|
|
2696
|
-
type: "password",
|
|
2697
|
-
value: formData.currentPassword || "",
|
|
2698
|
-
onChange: (e) => setActionFormData({ ...actionFormData, currentPassword: e.target.value }),
|
|
2699
|
-
className: "h-8 text-xs border-gray-200"
|
|
2700
|
-
}
|
|
2701
|
-
)
|
|
2702
|
-
] }),
|
|
2703
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2704
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "New Password" }),
|
|
2680
|
+
panelView === "folder" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2681
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mb-3 flex items-center gap-2", children: [
|
|
2705
2682
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2706
|
-
|
|
2683
|
+
Button,
|
|
2707
2684
|
{
|
|
2708
|
-
type: "
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
className: "h-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2716
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Confirm New Password" }),
|
|
2717
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2718
|
-
Input,
|
|
2719
|
-
{
|
|
2720
|
-
type: "password",
|
|
2721
|
-
value: formData.confirmPassword || "",
|
|
2722
|
-
onChange: (e) => setActionFormData({ ...actionFormData, confirmPassword: e.target.value }),
|
|
2723
|
-
className: "h-8 text-xs border-gray-200"
|
|
2724
|
-
}
|
|
2725
|
-
)
|
|
2726
|
-
] })
|
|
2727
|
-
] }),
|
|
2728
|
-
actionType === "toggleNotification" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
2729
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2730
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Notification Type" }),
|
|
2731
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2732
|
-
"select",
|
|
2733
|
-
{
|
|
2734
|
-
value: formData.notificationType || "paymentReceived",
|
|
2735
|
-
onChange: (e) => setActionFormData({ ...actionFormData, notificationType: e.target.value }),
|
|
2736
|
-
className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
|
|
2737
|
-
children: [
|
|
2738
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "paymentReceived", children: "Payment Received" }),
|
|
2739
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "paymentFailed", children: "Payment Failed" }),
|
|
2740
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "invoicePaid", children: "Invoice Paid" }),
|
|
2741
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "monthlySummary", children: "Monthly Summary" }),
|
|
2742
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "productUpdates", children: "Product Updates" })
|
|
2743
|
-
]
|
|
2744
|
-
}
|
|
2745
|
-
)
|
|
2746
|
-
] }),
|
|
2747
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2748
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2749
|
-
"input",
|
|
2750
|
-
{
|
|
2751
|
-
type: "checkbox",
|
|
2752
|
-
checked: formData.enabled !== false,
|
|
2753
|
-
onChange: (e) => setActionFormData({ ...actionFormData, enabled: e.target.checked }),
|
|
2754
|
-
className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
|
|
2685
|
+
type: "button",
|
|
2686
|
+
size: "icon",
|
|
2687
|
+
variant: "ghost",
|
|
2688
|
+
className: "h-7 w-7 rounded-full hover:bg-gray-100",
|
|
2689
|
+
onClick: closeFolder,
|
|
2690
|
+
"aria-label": "Back to suggestions",
|
|
2691
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.ArrowLeft, { className: "h-4 w-4 text-gray-500" })
|
|
2755
2692
|
}
|
|
2756
2693
|
),
|
|
2757
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("
|
|
2758
|
-
] })
|
|
2759
|
-
] }),
|
|
2760
|
-
(actionType === "connectIntegration" || actionType === "disconnectIntegration") && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2761
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Integration" }),
|
|
2762
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2763
|
-
"select",
|
|
2764
|
-
{
|
|
2765
|
-
value: formData.integrationName || "Slack",
|
|
2766
|
-
onChange: (e) => setActionFormData({ ...actionFormData, integrationName: e.target.value }),
|
|
2767
|
-
className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
|
|
2768
|
-
children: [
|
|
2769
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Slack", children: "Slack" }),
|
|
2770
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Zapier", children: "Zapier" }),
|
|
2771
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Webhook", children: "Webhook" })
|
|
2772
|
-
]
|
|
2773
|
-
}
|
|
2774
|
-
)
|
|
2775
|
-
] }) }),
|
|
2776
|
-
actionType === "addPaymentMethod" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
2777
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2778
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Card Number" }),
|
|
2779
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2780
|
-
Input,
|
|
2781
|
-
{
|
|
2782
|
-
placeholder: "1234 5678 9012 3456",
|
|
2783
|
-
value: formData.cardNumber || "",
|
|
2784
|
-
onChange: (e) => setActionFormData({ ...actionFormData, cardNumber: e.target.value }),
|
|
2785
|
-
className: "h-8 text-xs border-gray-200"
|
|
2786
|
-
}
|
|
2787
|
-
)
|
|
2788
|
-
] }),
|
|
2789
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2790
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Expiry Date" }),
|
|
2791
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2792
|
-
Input,
|
|
2793
|
-
{
|
|
2794
|
-
placeholder: "MM/YY",
|
|
2795
|
-
value: formData.expiryDate || "",
|
|
2796
|
-
onChange: (e) => setActionFormData({ ...actionFormData, expiryDate: e.target.value }),
|
|
2797
|
-
className: "h-8 text-xs border-gray-200"
|
|
2798
|
-
}
|
|
2799
|
-
)
|
|
2800
|
-
] })
|
|
2801
|
-
] }),
|
|
2802
|
-
actionType === "removePaymentMethod" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-black", children: "This will remove the default payment method from your account." }) }),
|
|
2803
|
-
actionType === "refundPayment" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
2804
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2805
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Transaction ID or Customer Name" }),
|
|
2806
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2807
|
-
Input,
|
|
2808
|
-
{
|
|
2809
|
-
placeholder: "e.g., txn_1234 or Acme Corp",
|
|
2810
|
-
value: formData.transactionId || formData.customer || "",
|
|
2811
|
-
onChange: (e) => {
|
|
2812
|
-
const value = e.target.value;
|
|
2813
|
-
if (value.startsWith("txn_") || /^\d+$/.test(value)) {
|
|
2814
|
-
setActionFormData({ ...actionFormData, transactionId: value, customer: void 0 });
|
|
2815
|
-
} else {
|
|
2816
|
-
setActionFormData({ ...actionFormData, customer: value, transactionId: void 0 });
|
|
2817
|
-
}
|
|
2818
|
-
},
|
|
2819
|
-
className: "h-8 text-xs border-gray-200"
|
|
2820
|
-
}
|
|
2821
|
-
)
|
|
2822
|
-
] }),
|
|
2823
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2824
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Amount (optional)" }),
|
|
2825
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2826
|
-
Input,
|
|
2827
|
-
{
|
|
2828
|
-
placeholder: "$0.00",
|
|
2829
|
-
value: formData.amount || "",
|
|
2830
|
-
onChange: (e) => setActionFormData({ ...actionFormData, amount: e.target.value }),
|
|
2831
|
-
className: "h-8 text-xs border-gray-200"
|
|
2832
|
-
}
|
|
2833
|
-
)
|
|
2834
|
-
] }),
|
|
2835
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2836
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Reason (optional)" }),
|
|
2837
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2838
|
-
Input,
|
|
2839
|
-
{
|
|
2840
|
-
placeholder: "e.g., Customer request",
|
|
2841
|
-
value: formData.reason || "",
|
|
2842
|
-
onChange: (e) => setActionFormData({ ...actionFormData, reason: e.target.value }),
|
|
2843
|
-
className: "h-8 text-xs border-gray-200"
|
|
2844
|
-
}
|
|
2845
|
-
)
|
|
2846
|
-
] })
|
|
2847
|
-
] }),
|
|
2848
|
-
actionType === "deleteApiKey" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
2849
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2850
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name or ID" }),
|
|
2851
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2852
|
-
Input,
|
|
2853
|
-
{
|
|
2854
|
-
placeholder: "Production Key",
|
|
2855
|
-
value: formData.keyId || formData.name || "",
|
|
2856
|
-
onChange: (e) => setActionFormData({ ...actionFormData, keyId: e.target.value, name: e.target.value }),
|
|
2857
|
-
className: "h-8 text-xs border-gray-200"
|
|
2858
|
-
}
|
|
2859
|
-
)
|
|
2860
|
-
] }),
|
|
2861
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-red-600", children: "Warning: This action cannot be undone. The API key will be permanently deleted." })
|
|
2862
|
-
] }),
|
|
2863
|
-
actionType === "addWebhook" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
2864
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2865
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Webhook URL" }),
|
|
2866
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2867
|
-
Input,
|
|
2868
|
-
{
|
|
2869
|
-
type: "url",
|
|
2870
|
-
placeholder: "https://example.com/webhook",
|
|
2871
|
-
value: formData.url || "",
|
|
2872
|
-
onChange: (e) => setActionFormData({ ...actionFormData, url: e.target.value }),
|
|
2873
|
-
className: "h-8 text-xs border-gray-200"
|
|
2874
|
-
}
|
|
2875
|
-
)
|
|
2694
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs font-medium uppercase tracking-wide text-gray-400", children: "Topics" })
|
|
2876
2695
|
] }),
|
|
2877
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.
|
|
2878
|
-
|
|
2879
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2880
|
-
Input,
|
|
2881
|
-
{
|
|
2882
|
-
placeholder: "Production Webhook",
|
|
2883
|
-
value: formData.name || "",
|
|
2884
|
-
onChange: (e) => setActionFormData({ ...actionFormData, name: e.target.value }),
|
|
2885
|
-
className: "h-8 text-xs border-gray-200"
|
|
2886
|
-
}
|
|
2887
|
-
)
|
|
2888
|
-
] })
|
|
2889
|
-
] }),
|
|
2890
|
-
actionType === "updateCurrency" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2891
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Currency" }),
|
|
2892
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2893
|
-
"select",
|
|
2696
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex flex-col gap-1.5", children: folders.find((f) => f.id === currentFolderId)?.topics.map((topic) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2697
|
+
Button,
|
|
2894
2698
|
{
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2699
|
+
type: "button",
|
|
2700
|
+
size: "sm",
|
|
2701
|
+
variant: "secondary",
|
|
2702
|
+
className: "justify-start rounded-xl border border-gray-200 bg-gray-50 px-3 py-2.5 text-xs text-gray-700 shadow-none transition-all hover:bg-gray-100 hover:border-gray-300 h-auto",
|
|
2703
|
+
onClick: () => sendTopic(topic.prompt),
|
|
2704
|
+
children: topic.label
|
|
2705
|
+
},
|
|
2706
|
+
topic.id
|
|
2707
|
+
)) })
|
|
2708
|
+
] })
|
|
2709
|
+
] })
|
|
2710
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ScrollArea, { ref: messagesContainerRef, className: "h-full", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col gap-2 px-4 py-3", children: [
|
|
2711
|
+
messages.map((message, index) => {
|
|
2712
|
+
const isUser = message.role === "user";
|
|
2713
|
+
const previousRole = index > 0 ? messages[index - 1].role : void 0;
|
|
2714
|
+
const isRoleChange = previousRole !== void 0 && previousRole !== message.role;
|
|
2715
|
+
const currentGuide = activeGuideRef.current || activeGuide;
|
|
2716
|
+
let isCurrentGuideStep = false;
|
|
2717
|
+
if (currentGuide && message.kind === "guideStep") {
|
|
2718
|
+
if (message.guideStepIndex !== void 0) {
|
|
2719
|
+
isCurrentGuideStep = message.guideStepIndex === currentGuide.stepIndex;
|
|
2720
|
+
} else {
|
|
2721
|
+
isCurrentGuideStep = index === messages.length - 1;
|
|
2722
|
+
}
|
|
2723
|
+
} else if (message.kind === "guideComplete") {
|
|
2724
|
+
isCurrentGuideStep = index === messages.length - 1;
|
|
2725
|
+
}
|
|
2726
|
+
if (message.kind === "guideStep" && !isCurrentGuideStep) {
|
|
2727
|
+
return null;
|
|
2728
|
+
}
|
|
2729
|
+
if (isUser) {
|
|
2730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2731
|
+
"div",
|
|
2732
|
+
{
|
|
2733
|
+
className: `flex justify-end ${isRoleChange ? "mt-3" : ""}`,
|
|
2734
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "max-w-[280px] rounded-2xl rounded-br-md bg-gray-900 px-3.5 py-2.5 text-sm text-white shadow-sm", children: message.content })
|
|
2735
|
+
},
|
|
2736
|
+
message.id
|
|
2737
|
+
);
|
|
2738
|
+
}
|
|
2739
|
+
if (message.kind === "searchSummary") {
|
|
2740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2741
|
+
"div",
|
|
2742
|
+
{
|
|
2743
|
+
className: `${isRoleChange ? "mt-3" : ""}`,
|
|
2744
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2745
|
+
AssistantSearchSummary,
|
|
2746
|
+
{
|
|
2747
|
+
title: message.title ?? "Search results",
|
|
2748
|
+
links: message.links ?? []
|
|
2749
|
+
}
|
|
2750
|
+
)
|
|
2751
|
+
},
|
|
2752
|
+
message.id
|
|
2753
|
+
);
|
|
2754
|
+
}
|
|
2755
|
+
if (message.kind === "guideComplete") {
|
|
2756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2757
|
+
"div",
|
|
2911
2758
|
{
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
className: "
|
|
2759
|
+
ref: isCurrentGuideStep ? currentStepRef : null,
|
|
2760
|
+
className: `${isRoleChange ? "mt-3" : ""}`,
|
|
2761
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2 rounded-xl bg-green-50 border border-green-200 px-3 py-2.5 text-sm leading-6", children: [
|
|
2762
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CheckCircle2, { className: "h-5 w-5 text-green-600 flex-shrink-0" }),
|
|
2763
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-medium text-green-800", children: message.content })
|
|
2764
|
+
] })
|
|
2765
|
+
},
|
|
2766
|
+
message.id
|
|
2767
|
+
);
|
|
2768
|
+
}
|
|
2769
|
+
if (message.kind === "navigationAction") {
|
|
2770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2771
|
+
"div",
|
|
2772
|
+
{
|
|
2773
|
+
className: `${isRoleChange ? "mt-3" : ""}`,
|
|
2915
2774
|
children: [
|
|
2916
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("
|
|
2917
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("
|
|
2918
|
-
|
|
2919
|
-
|
|
2775
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-2 text-gray-700", children: message.content || "" }),
|
|
2776
|
+
message.navigationTarget && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2777
|
+
Button,
|
|
2778
|
+
{
|
|
2779
|
+
type: "button",
|
|
2780
|
+
size: "sm",
|
|
2781
|
+
variant: "secondary",
|
|
2782
|
+
className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
|
|
2783
|
+
onClick: () => message.navigationTarget && handleConfirmNavigation(
|
|
2784
|
+
message.navigationTarget
|
|
2785
|
+
),
|
|
2786
|
+
children: [
|
|
2787
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "Confirm" }),
|
|
2788
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
|
|
2789
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
|
|
2790
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
|
|
2791
|
+
] })
|
|
2792
|
+
]
|
|
2793
|
+
}
|
|
2794
|
+
) })
|
|
2920
2795
|
]
|
|
2796
|
+
},
|
|
2797
|
+
message.id
|
|
2798
|
+
);
|
|
2799
|
+
}
|
|
2800
|
+
if (message.kind === "actionForm") {
|
|
2801
|
+
const actionType = message.actionType;
|
|
2802
|
+
const formData = Object.keys(actionFormData).length > 0 ? actionFormData : message.actionData || {};
|
|
2803
|
+
if (message.isSubmitted) {
|
|
2804
|
+
let successContent = "";
|
|
2805
|
+
if (actionType === "updateCompanyInfo") {
|
|
2806
|
+
successContent = "Company information has been updated successfully.";
|
|
2807
|
+
} else if (actionType === "addApiKey") {
|
|
2808
|
+
successContent = "API key has been added successfully.";
|
|
2809
|
+
} else if (actionType === "addCustomer") {
|
|
2810
|
+
successContent = "Customer has been added successfully.";
|
|
2811
|
+
} else if (actionType === "enable2FA") {
|
|
2812
|
+
successContent = "Two-factor authentication has been enabled successfully.";
|
|
2813
|
+
} else if (actionType === "disable2FA") {
|
|
2814
|
+
successContent = "Two-factor authentication has been disabled successfully.";
|
|
2815
|
+
} else if (actionType === "changePassword") {
|
|
2816
|
+
successContent = "Your password has been changed successfully.";
|
|
2817
|
+
} else if (actionType === "revokeSession") {
|
|
2818
|
+
successContent = "Session has been revoked successfully.";
|
|
2819
|
+
} else if (actionType === "toggleNotification") {
|
|
2820
|
+
successContent = "Notification preferences have been updated successfully.";
|
|
2821
|
+
} else if (actionType === "connectIntegration") {
|
|
2822
|
+
successContent = "Integration has been connected successfully.";
|
|
2823
|
+
} else if (actionType === "disconnectIntegration") {
|
|
2824
|
+
successContent = "Integration has been disconnected successfully.";
|
|
2825
|
+
} else if (actionType === "addPaymentMethod") {
|
|
2826
|
+
successContent = "Payment method has been added successfully.";
|
|
2827
|
+
} else if (actionType === "removePaymentMethod") {
|
|
2828
|
+
successContent = "Payment method has been removed successfully.";
|
|
2829
|
+
} else if (actionType === "deleteApiKey") {
|
|
2830
|
+
successContent = "API key has been deleted successfully.";
|
|
2831
|
+
} else if (actionType === "addWebhook") {
|
|
2832
|
+
successContent = "Webhook endpoint has been added successfully.";
|
|
2833
|
+
} else if (actionType === "updateCurrency") {
|
|
2834
|
+
successContent = "Currency preference has been updated successfully.";
|
|
2835
|
+
} else if (actionType === "updateTimezone") {
|
|
2836
|
+
successContent = "Timezone has been updated successfully.";
|
|
2837
|
+
} else if (actionType === "refundPayment") {
|
|
2838
|
+
successContent = "Refund has been processed successfully.";
|
|
2839
|
+
} else if (actionType === "exportCertificate") {
|
|
2840
|
+
successContent = "Certificate of Incorporation has been downloaded successfully.";
|
|
2841
|
+
} else if (actionType === "createSubscription") {
|
|
2842
|
+
successContent = "Subscription has been created successfully.";
|
|
2843
|
+
} else if (actionType === "toggleBlockRule" || actionType === "enableBlockRule" || actionType === "disableBlockRule") {
|
|
2844
|
+
successContent = "Block rule has been updated successfully.";
|
|
2845
|
+
} else {
|
|
2846
|
+
successContent = "Action completed successfully.";
|
|
2921
2847
|
}
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
actionType === "revokeSession" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
2925
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2926
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Device/Session" }),
|
|
2927
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2928
|
-
Input,
|
|
2929
|
-
{
|
|
2930
|
-
placeholder: "MacBook Pro",
|
|
2931
|
-
value: formData.device || "",
|
|
2932
|
-
onChange: (e) => setActionFormData({ ...actionFormData, device: e.target.value }),
|
|
2933
|
-
className: "h-8 text-xs border-gray-200"
|
|
2934
|
-
}
|
|
2935
|
-
)
|
|
2936
|
-
] }),
|
|
2937
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-black", children: "This will sign out the device and invalidate its session." })
|
|
2938
|
-
] }),
|
|
2939
|
-
actionType === "createSubscription" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
2940
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2941
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Customer Email" }),
|
|
2942
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2943
|
-
Input,
|
|
2944
|
-
{
|
|
2945
|
-
type: "email",
|
|
2946
|
-
placeholder: "customer@example.com",
|
|
2947
|
-
value: formData.customerEmail || "",
|
|
2948
|
-
onChange: (e) => setActionFormData({ ...actionFormData, customerEmail: e.target.value }),
|
|
2949
|
-
className: "h-8 text-xs border-gray-200"
|
|
2950
|
-
}
|
|
2951
|
-
)
|
|
2952
|
-
] }),
|
|
2953
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2954
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Plan" }),
|
|
2955
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2956
|
-
"select",
|
|
2957
|
-
{
|
|
2958
|
-
value: formData.plan || "Starter",
|
|
2959
|
-
onChange: (e) => setActionFormData({ ...actionFormData, plan: e.target.value }),
|
|
2960
|
-
className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
|
|
2961
|
-
children: [
|
|
2962
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Starter", children: "Starter ($29/mo)" }),
|
|
2963
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Professional", children: "Professional ($99/mo)" }),
|
|
2964
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Enterprise", children: "Enterprise ($299/mo)" })
|
|
2965
|
-
]
|
|
2966
|
-
}
|
|
2967
|
-
)
|
|
2968
|
-
] }),
|
|
2969
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2970
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Billing Cycle" }),
|
|
2971
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2972
|
-
"select",
|
|
2973
|
-
{
|
|
2974
|
-
value: formData.billingCycle || "monthly",
|
|
2975
|
-
onChange: (e) => setActionFormData({ ...actionFormData, billingCycle: e.target.value }),
|
|
2976
|
-
className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
|
|
2977
|
-
children: [
|
|
2978
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "monthly", children: "Monthly" }),
|
|
2979
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "yearly", children: "Yearly (Save 15%)" })
|
|
2980
|
-
]
|
|
2981
|
-
}
|
|
2982
|
-
)
|
|
2983
|
-
] })
|
|
2984
|
-
] }),
|
|
2985
|
-
actionType === "exportCertificate" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
2986
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-black", children: "This will export your certificate of incorporation document." }),
|
|
2987
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2988
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Format" }),
|
|
2989
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2990
|
-
"select",
|
|
2848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2849
|
+
"div",
|
|
2991
2850
|
{
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "json", children: "JSON" })
|
|
2998
|
-
]
|
|
2999
|
-
}
|
|
3000
|
-
)
|
|
3001
|
-
] })
|
|
3002
|
-
] }),
|
|
3003
|
-
(actionType === "toggleBlockRule" || actionType === "enableBlockRule" || actionType === "disableBlockRule") && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
3004
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3005
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Block Rule" }),
|
|
3006
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3007
|
-
"select",
|
|
3008
|
-
{
|
|
3009
|
-
value: formData.ruleId || "rule_1",
|
|
3010
|
-
onChange: (e) => setActionFormData({ ...actionFormData, ruleId: e.target.value }),
|
|
3011
|
-
className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
|
|
3012
|
-
children: [
|
|
3013
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "rule_1", children: "Block if risk level = 'highest'" }),
|
|
3014
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "rule_2", children: "Block if matches Stripe block lists" }),
|
|
3015
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "rule_3", children: "Block if CVC verification fails" }),
|
|
3016
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "rule_4", children: "Block if Postal code verification fails" })
|
|
3017
|
-
]
|
|
3018
|
-
}
|
|
3019
|
-
)
|
|
3020
|
-
] }),
|
|
3021
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-black", children: actionType === "enableBlockRule" ? "This will enable the selected block rule to actively block matching payments." : actionType === "disableBlockRule" ? "This will disable the selected block rule. Matching payments will no longer be blocked." : "This will toggle the selected block rule's state." })
|
|
3022
|
-
] }),
|
|
3023
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3024
|
-
Button,
|
|
3025
|
-
{
|
|
3026
|
-
type: "button",
|
|
3027
|
-
size: "sm",
|
|
3028
|
-
variant: "secondary",
|
|
3029
|
-
className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
|
|
3030
|
-
onClick: handleActionSubmit,
|
|
3031
|
-
children: [
|
|
3032
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "Confirm" }),
|
|
3033
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
|
|
3034
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
|
|
3035
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
|
|
3036
|
-
] })
|
|
3037
|
-
]
|
|
2851
|
+
className: `${isRoleChange ? "mt-3" : ""}`,
|
|
2852
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 text-gray-700", children: successContent })
|
|
2853
|
+
},
|
|
2854
|
+
message.id
|
|
2855
|
+
);
|
|
3038
2856
|
}
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
2857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2858
|
+
"div",
|
|
2859
|
+
{
|
|
2860
|
+
className: `min-w-0 ${isRoleChange ? "mt-3" : ""}`,
|
|
2861
|
+
children: [
|
|
2862
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
|
|
2863
|
+
actionType === "updateCompanyInfo" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-2 bg-gray-50 rounded-lg p-2 border border-gray-200 overflow-hidden", children: [
|
|
2864
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
2865
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2866
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
|
|
2867
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2868
|
+
Input,
|
|
2869
|
+
{
|
|
2870
|
+
placeholder: "Acme Corporation",
|
|
2871
|
+
value: formData.companyName || "",
|
|
2872
|
+
onChange: (e) => setActionFormData({
|
|
2873
|
+
...actionFormData,
|
|
2874
|
+
companyName: e.target.value
|
|
2875
|
+
}),
|
|
2876
|
+
className: "h-8 text-xs border-gray-200"
|
|
2877
|
+
}
|
|
2878
|
+
)
|
|
2879
|
+
] }),
|
|
2880
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2881
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
|
|
2882
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2883
|
+
Input,
|
|
2884
|
+
{
|
|
2885
|
+
type: "email",
|
|
2886
|
+
placeholder: "contact@acme.com",
|
|
2887
|
+
value: formData.email || "",
|
|
2888
|
+
onChange: (e) => setActionFormData({
|
|
2889
|
+
...actionFormData,
|
|
2890
|
+
email: e.target.value
|
|
2891
|
+
}),
|
|
2892
|
+
className: "h-8 text-xs border-gray-200"
|
|
2893
|
+
}
|
|
2894
|
+
)
|
|
2895
|
+
] })
|
|
2896
|
+
] }),
|
|
2897
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2898
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Address" }),
|
|
2899
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2900
|
+
Input,
|
|
2901
|
+
{
|
|
2902
|
+
placeholder: "123 Main St, San Francisco, CA",
|
|
2903
|
+
value: formData.address || "",
|
|
2904
|
+
onChange: (e) => setActionFormData({
|
|
2905
|
+
...actionFormData,
|
|
2906
|
+
address: e.target.value
|
|
2907
|
+
}),
|
|
2908
|
+
className: "h-8 text-xs border-gray-200"
|
|
2909
|
+
}
|
|
2910
|
+
)
|
|
2911
|
+
] }),
|
|
2912
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
2913
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2914
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Phone" }),
|
|
2915
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2916
|
+
Input,
|
|
2917
|
+
{
|
|
2918
|
+
type: "tel",
|
|
2919
|
+
placeholder: "+1 (555) 123-4567",
|
|
2920
|
+
value: formData.phone || "",
|
|
2921
|
+
onChange: (e) => setActionFormData({
|
|
2922
|
+
...actionFormData,
|
|
2923
|
+
phone: e.target.value
|
|
2924
|
+
}),
|
|
2925
|
+
className: "h-8 text-xs border-gray-200"
|
|
2926
|
+
}
|
|
2927
|
+
)
|
|
2928
|
+
] }),
|
|
2929
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2930
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Website" }),
|
|
2931
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2932
|
+
Input,
|
|
2933
|
+
{
|
|
2934
|
+
type: "url",
|
|
2935
|
+
placeholder: "https://acme.com",
|
|
2936
|
+
value: formData.website || "",
|
|
2937
|
+
onChange: (e) => setActionFormData({
|
|
2938
|
+
...actionFormData,
|
|
2939
|
+
website: e.target.value
|
|
2940
|
+
}),
|
|
2941
|
+
className: "h-8 text-xs border-gray-200"
|
|
2942
|
+
}
|
|
2943
|
+
)
|
|
2944
|
+
] })
|
|
2945
|
+
] })
|
|
3067
2946
|
] }),
|
|
3068
|
-
" ",
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
2947
|
+
actionType === "addApiKey" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2948
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name" }),
|
|
2949
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2950
|
+
Input,
|
|
2951
|
+
{
|
|
2952
|
+
placeholder: "Production Key",
|
|
2953
|
+
value: formData.name || "",
|
|
2954
|
+
onChange: (e) => setActionFormData({
|
|
2955
|
+
...actionFormData,
|
|
2956
|
+
name: e.target.value
|
|
2957
|
+
}),
|
|
2958
|
+
className: "h-8 text-xs border-gray-200"
|
|
2959
|
+
}
|
|
2960
|
+
)
|
|
2961
|
+
] }) }),
|
|
2962
|
+
actionType === "addCustomer" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-2 bg-gray-50 rounded-lg p-2 border border-gray-200 overflow-hidden", children: [
|
|
2963
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
2964
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2965
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
|
|
2966
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2967
|
+
Input,
|
|
2968
|
+
{
|
|
2969
|
+
placeholder: "Acme Corporation",
|
|
2970
|
+
value: formData.name || "",
|
|
2971
|
+
onChange: (e) => setActionFormData({
|
|
2972
|
+
...actionFormData,
|
|
2973
|
+
name: e.target.value
|
|
2974
|
+
}),
|
|
2975
|
+
className: "h-8 text-xs border-gray-200"
|
|
2976
|
+
}
|
|
2977
|
+
)
|
|
2978
|
+
] }),
|
|
2979
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2980
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
|
|
2981
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2982
|
+
Input,
|
|
2983
|
+
{
|
|
2984
|
+
type: "email",
|
|
2985
|
+
placeholder: "contact@acme.com",
|
|
2986
|
+
value: formData.email || "",
|
|
2987
|
+
onChange: (e) => setActionFormData({
|
|
2988
|
+
...actionFormData,
|
|
2989
|
+
email: e.target.value
|
|
2990
|
+
}),
|
|
2991
|
+
className: "h-8 text-xs border-gray-200"
|
|
2992
|
+
}
|
|
2993
|
+
)
|
|
2994
|
+
] })
|
|
2995
|
+
] }),
|
|
2996
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2997
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Location" }),
|
|
2998
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2999
|
+
Input,
|
|
3000
|
+
{
|
|
3001
|
+
placeholder: "San Francisco, CA",
|
|
3002
|
+
value: formData.location || "",
|
|
3003
|
+
onChange: (e) => setActionFormData({
|
|
3004
|
+
...actionFormData,
|
|
3005
|
+
location: e.target.value
|
|
3006
|
+
}),
|
|
3007
|
+
className: "h-8 text-xs border-gray-200"
|
|
3008
|
+
}
|
|
3009
|
+
)
|
|
3010
|
+
] }),
|
|
3011
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3012
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Subscription Tier" }),
|
|
3013
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3014
|
+
"select",
|
|
3015
|
+
{
|
|
3016
|
+
value: formData.subscription || "Starter",
|
|
3017
|
+
onChange: (e) => setActionFormData({
|
|
3018
|
+
...actionFormData,
|
|
3019
|
+
subscription: e.target.value
|
|
3020
|
+
}),
|
|
3021
|
+
className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
|
|
3022
|
+
children: [
|
|
3023
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Starter", children: "Starter" }),
|
|
3024
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Professional", children: "Professional" }),
|
|
3025
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Enterprise", children: "Enterprise" })
|
|
3026
|
+
]
|
|
3027
|
+
}
|
|
3028
|
+
)
|
|
3029
|
+
] })
|
|
3030
|
+
] }),
|
|
3031
|
+
(actionType === "enable2FA" || actionType === "disable2FA") && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-black", children: actionType === "enable2FA" ? "This will enable two-factor authentication for your account. You'll need to set up an authenticator app." : "This will disable two-factor authentication for your account. Your account will be less secure." }) }),
|
|
3032
|
+
actionType === "changePassword" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
3033
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3034
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Current Password" }),
|
|
3035
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3036
|
+
Input,
|
|
3037
|
+
{
|
|
3038
|
+
type: "password",
|
|
3039
|
+
value: formData.currentPassword || "",
|
|
3040
|
+
onChange: (e) => setActionFormData({
|
|
3041
|
+
...actionFormData,
|
|
3042
|
+
currentPassword: e.target.value
|
|
3043
|
+
}),
|
|
3044
|
+
className: "h-8 text-xs border-gray-200"
|
|
3045
|
+
}
|
|
3046
|
+
)
|
|
3047
|
+
] }),
|
|
3048
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3049
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "New Password" }),
|
|
3050
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3051
|
+
Input,
|
|
3052
|
+
{
|
|
3053
|
+
type: "password",
|
|
3054
|
+
value: formData.newPassword || "",
|
|
3055
|
+
onChange: (e) => setActionFormData({
|
|
3056
|
+
...actionFormData,
|
|
3057
|
+
newPassword: e.target.value
|
|
3058
|
+
}),
|
|
3059
|
+
className: "h-8 text-xs border-gray-200"
|
|
3060
|
+
}
|
|
3061
|
+
)
|
|
3062
|
+
] }),
|
|
3063
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3064
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Confirm New Password" }),
|
|
3065
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3066
|
+
Input,
|
|
3067
|
+
{
|
|
3068
|
+
type: "password",
|
|
3069
|
+
value: formData.confirmPassword || "",
|
|
3070
|
+
onChange: (e) => setActionFormData({
|
|
3071
|
+
...actionFormData,
|
|
3072
|
+
confirmPassword: e.target.value
|
|
3073
|
+
}),
|
|
3074
|
+
className: "h-8 text-xs border-gray-200"
|
|
3075
|
+
}
|
|
3076
|
+
)
|
|
3077
|
+
] })
|
|
3078
|
+
] }),
|
|
3079
|
+
actionType === "toggleNotification" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
3080
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3081
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Notification Type" }),
|
|
3082
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3083
|
+
"select",
|
|
3084
|
+
{
|
|
3085
|
+
value: formData.notificationType || "paymentReceived",
|
|
3086
|
+
onChange: (e) => setActionFormData({
|
|
3087
|
+
...actionFormData,
|
|
3088
|
+
notificationType: e.target.value
|
|
3089
|
+
}),
|
|
3090
|
+
className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
|
|
3091
|
+
children: [
|
|
3092
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "paymentReceived", children: "Payment Received" }),
|
|
3093
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "paymentFailed", children: "Payment Failed" }),
|
|
3094
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "invoicePaid", children: "Invoice Paid" }),
|
|
3095
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "monthlySummary", children: "Monthly Summary" }),
|
|
3096
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "productUpdates", children: "Product Updates" })
|
|
3097
|
+
]
|
|
3098
|
+
}
|
|
3099
|
+
)
|
|
3100
|
+
] }),
|
|
3101
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3102
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3103
|
+
"input",
|
|
3104
|
+
{
|
|
3105
|
+
type: "checkbox",
|
|
3106
|
+
checked: formData.enabled !== false,
|
|
3107
|
+
onChange: (e) => setActionFormData({
|
|
3108
|
+
...actionFormData,
|
|
3109
|
+
enabled: e.target.checked
|
|
3110
|
+
}),
|
|
3111
|
+
className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
|
|
3112
|
+
}
|
|
3113
|
+
),
|
|
3114
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs text-black", children: "Enable this notification" })
|
|
3115
|
+
] })
|
|
3116
|
+
] }),
|
|
3117
|
+
(actionType === "connectIntegration" || actionType === "disconnectIntegration") && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3118
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Integration" }),
|
|
3119
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3120
|
+
"select",
|
|
3121
|
+
{
|
|
3122
|
+
value: formData.integrationName || "Slack",
|
|
3123
|
+
onChange: (e) => setActionFormData({
|
|
3124
|
+
...actionFormData,
|
|
3125
|
+
integrationName: e.target.value
|
|
3126
|
+
}),
|
|
3127
|
+
className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
|
|
3128
|
+
children: [
|
|
3129
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Slack", children: "Slack" }),
|
|
3130
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Zapier", children: "Zapier" }),
|
|
3131
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Webhook", children: "Webhook" })
|
|
3132
|
+
]
|
|
3133
|
+
}
|
|
3134
|
+
)
|
|
3135
|
+
] }) }),
|
|
3136
|
+
actionType === "addPaymentMethod" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
3137
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3138
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Card Number" }),
|
|
3139
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3140
|
+
Input,
|
|
3141
|
+
{
|
|
3142
|
+
placeholder: "1234 5678 9012 3456",
|
|
3143
|
+
value: formData.cardNumber || "",
|
|
3144
|
+
onChange: (e) => setActionFormData({
|
|
3145
|
+
...actionFormData,
|
|
3146
|
+
cardNumber: e.target.value
|
|
3147
|
+
}),
|
|
3148
|
+
className: "h-8 text-xs border-gray-200"
|
|
3149
|
+
}
|
|
3150
|
+
)
|
|
3151
|
+
] }),
|
|
3152
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3153
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Expiry Date" }),
|
|
3154
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3155
|
+
Input,
|
|
3156
|
+
{
|
|
3157
|
+
placeholder: "MM/YY",
|
|
3158
|
+
value: formData.expiryDate || "",
|
|
3159
|
+
onChange: (e) => setActionFormData({
|
|
3160
|
+
...actionFormData,
|
|
3161
|
+
expiryDate: e.target.value
|
|
3162
|
+
}),
|
|
3163
|
+
className: "h-8 text-xs border-gray-200"
|
|
3164
|
+
}
|
|
3165
|
+
)
|
|
3166
|
+
] })
|
|
3167
|
+
] }),
|
|
3168
|
+
actionType === "removePaymentMethod" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-black", children: "This will remove the default payment method from your account." }) }),
|
|
3169
|
+
actionType === "refundPayment" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
3170
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3171
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Transaction ID or Customer Name" }),
|
|
3172
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3173
|
+
Input,
|
|
3174
|
+
{
|
|
3175
|
+
placeholder: "e.g., txn_1234 or Acme Corp",
|
|
3176
|
+
value: formData.transactionId || formData.customer || "",
|
|
3177
|
+
onChange: (e) => {
|
|
3178
|
+
const value = e.target.value;
|
|
3179
|
+
if (value.startsWith("txn_") || /^\d+$/.test(value)) {
|
|
3180
|
+
setActionFormData({
|
|
3181
|
+
...actionFormData,
|
|
3182
|
+
transactionId: value,
|
|
3183
|
+
customer: void 0
|
|
3184
|
+
});
|
|
3185
|
+
} else {
|
|
3186
|
+
setActionFormData({
|
|
3187
|
+
...actionFormData,
|
|
3188
|
+
customer: value,
|
|
3189
|
+
transactionId: void 0
|
|
3190
|
+
});
|
|
3191
|
+
}
|
|
3192
|
+
},
|
|
3193
|
+
className: "h-8 text-xs border-gray-200"
|
|
3194
|
+
}
|
|
3195
|
+
)
|
|
3196
|
+
] }),
|
|
3197
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3198
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Amount (optional)" }),
|
|
3199
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3200
|
+
Input,
|
|
3201
|
+
{
|
|
3202
|
+
placeholder: "$0.00",
|
|
3203
|
+
value: formData.amount || "",
|
|
3204
|
+
onChange: (e) => setActionFormData({
|
|
3205
|
+
...actionFormData,
|
|
3206
|
+
amount: e.target.value
|
|
3207
|
+
}),
|
|
3208
|
+
className: "h-8 text-xs border-gray-200"
|
|
3209
|
+
}
|
|
3210
|
+
)
|
|
3211
|
+
] }),
|
|
3212
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3213
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Reason (optional)" }),
|
|
3214
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3215
|
+
Input,
|
|
3216
|
+
{
|
|
3217
|
+
placeholder: "e.g., Customer request",
|
|
3218
|
+
value: formData.reason || "",
|
|
3219
|
+
onChange: (e) => setActionFormData({
|
|
3220
|
+
...actionFormData,
|
|
3221
|
+
reason: e.target.value
|
|
3222
|
+
}),
|
|
3223
|
+
className: "h-8 text-xs border-gray-200"
|
|
3224
|
+
}
|
|
3225
|
+
)
|
|
3226
|
+
] })
|
|
3227
|
+
] }),
|
|
3228
|
+
actionType === "deleteApiKey" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
3229
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3230
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name or ID" }),
|
|
3231
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3232
|
+
Input,
|
|
3233
|
+
{
|
|
3234
|
+
placeholder: "Production Key",
|
|
3235
|
+
value: formData.keyId || formData.name || "",
|
|
3236
|
+
onChange: (e) => setActionFormData({
|
|
3237
|
+
...actionFormData,
|
|
3238
|
+
keyId: e.target.value,
|
|
3239
|
+
name: e.target.value
|
|
3240
|
+
}),
|
|
3241
|
+
className: "h-8 text-xs border-gray-200"
|
|
3242
|
+
}
|
|
3243
|
+
)
|
|
3244
|
+
] }),
|
|
3245
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-red-600", children: "Warning: This action cannot be undone. The API key will be permanently deleted." })
|
|
3246
|
+
] }),
|
|
3247
|
+
actionType === "addWebhook" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
3248
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3249
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Webhook URL" }),
|
|
3250
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3251
|
+
Input,
|
|
3252
|
+
{
|
|
3253
|
+
type: "url",
|
|
3254
|
+
placeholder: "https://example.com/webhook",
|
|
3255
|
+
value: formData.url || "",
|
|
3256
|
+
onChange: (e) => setActionFormData({
|
|
3257
|
+
...actionFormData,
|
|
3258
|
+
url: e.target.value
|
|
3259
|
+
}),
|
|
3260
|
+
className: "h-8 text-xs border-gray-200"
|
|
3261
|
+
}
|
|
3262
|
+
)
|
|
3263
|
+
] }),
|
|
3264
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3265
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Name (optional)" }),
|
|
3266
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3267
|
+
Input,
|
|
3268
|
+
{
|
|
3269
|
+
placeholder: "Production Webhook",
|
|
3270
|
+
value: formData.name || "",
|
|
3271
|
+
onChange: (e) => setActionFormData({
|
|
3272
|
+
...actionFormData,
|
|
3273
|
+
name: e.target.value
|
|
3274
|
+
}),
|
|
3275
|
+
className: "h-8 text-xs border-gray-200"
|
|
3276
|
+
}
|
|
3277
|
+
)
|
|
3278
|
+
] })
|
|
3279
|
+
] }),
|
|
3280
|
+
actionType === "updateCurrency" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3281
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Currency" }),
|
|
3282
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3283
|
+
"select",
|
|
3284
|
+
{
|
|
3285
|
+
value: formData.currency || "USD",
|
|
3286
|
+
onChange: (e) => setActionFormData({
|
|
3287
|
+
...actionFormData,
|
|
3288
|
+
currency: e.target.value
|
|
3289
|
+
}),
|
|
3290
|
+
className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
|
|
3291
|
+
children: [
|
|
3292
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "USD", children: "USD ($)" }),
|
|
3293
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "EUR", children: "EUR (\u20AC)" }),
|
|
3294
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "GBP", children: "GBP (\xA3)" }),
|
|
3295
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "JPY", children: "JPY (\xA5)" })
|
|
3296
|
+
]
|
|
3297
|
+
}
|
|
3298
|
+
)
|
|
3299
|
+
] }) }),
|
|
3300
|
+
actionType === "updateTimezone" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3301
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Timezone" }),
|
|
3302
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3303
|
+
"select",
|
|
3304
|
+
{
|
|
3305
|
+
value: formData.timezone || "America/Los_Angeles",
|
|
3306
|
+
onChange: (e) => setActionFormData({
|
|
3307
|
+
...actionFormData,
|
|
3308
|
+
timezone: e.target.value
|
|
3309
|
+
}),
|
|
3310
|
+
className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
|
|
3311
|
+
children: [
|
|
3312
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "America/Los_Angeles", children: "Pacific Time (PT)" }),
|
|
3313
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "America/New_York", children: "Eastern Time (ET)" }),
|
|
3314
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Europe/London", children: "GMT" }),
|
|
3315
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Asia/Tokyo", children: "JST" })
|
|
3316
|
+
]
|
|
3317
|
+
}
|
|
3318
|
+
)
|
|
3319
|
+
] }) }),
|
|
3320
|
+
actionType === "revokeSession" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
3321
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3322
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Device/Session" }),
|
|
3323
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3324
|
+
Input,
|
|
3325
|
+
{
|
|
3326
|
+
placeholder: "MacBook Pro",
|
|
3327
|
+
value: formData.device || "",
|
|
3328
|
+
onChange: (e) => setActionFormData({
|
|
3329
|
+
...actionFormData,
|
|
3330
|
+
device: e.target.value
|
|
3331
|
+
}),
|
|
3332
|
+
className: "h-8 text-xs border-gray-200"
|
|
3333
|
+
}
|
|
3334
|
+
)
|
|
3335
|
+
] }),
|
|
3336
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-black", children: "This will sign out the device and invalidate its session." })
|
|
3337
|
+
] }),
|
|
3338
|
+
actionType === "createSubscription" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
3339
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3340
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Customer Email" }),
|
|
3341
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3342
|
+
Input,
|
|
3343
|
+
{
|
|
3344
|
+
type: "email",
|
|
3345
|
+
placeholder: "customer@example.com",
|
|
3346
|
+
value: formData.customerEmail || "",
|
|
3347
|
+
onChange: (e) => setActionFormData({
|
|
3348
|
+
...actionFormData,
|
|
3349
|
+
customerEmail: e.target.value
|
|
3350
|
+
}),
|
|
3351
|
+
className: "h-8 text-xs border-gray-200"
|
|
3352
|
+
}
|
|
3353
|
+
)
|
|
3354
|
+
] }),
|
|
3355
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3356
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Plan" }),
|
|
3357
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3358
|
+
"select",
|
|
3359
|
+
{
|
|
3360
|
+
value: formData.plan || "Starter",
|
|
3361
|
+
onChange: (e) => setActionFormData({
|
|
3362
|
+
...actionFormData,
|
|
3363
|
+
plan: e.target.value
|
|
3364
|
+
}),
|
|
3365
|
+
className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
|
|
3366
|
+
children: [
|
|
3367
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Starter", children: "Starter ($29/mo)" }),
|
|
3368
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Professional", children: "Professional ($99/mo)" }),
|
|
3369
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Enterprise", children: "Enterprise ($299/mo)" })
|
|
3370
|
+
]
|
|
3371
|
+
}
|
|
3372
|
+
)
|
|
3373
|
+
] }),
|
|
3374
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3375
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Billing Cycle" }),
|
|
3376
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3377
|
+
"select",
|
|
3378
|
+
{
|
|
3379
|
+
value: formData.billingCycle || "monthly",
|
|
3380
|
+
onChange: (e) => setActionFormData({
|
|
3381
|
+
...actionFormData,
|
|
3382
|
+
billingCycle: e.target.value
|
|
3383
|
+
}),
|
|
3384
|
+
className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
|
|
3385
|
+
children: [
|
|
3386
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "monthly", children: "Monthly" }),
|
|
3387
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "yearly", children: "Yearly (Save 15%)" })
|
|
3388
|
+
]
|
|
3389
|
+
}
|
|
3390
|
+
)
|
|
3391
|
+
] })
|
|
3392
|
+
] }),
|
|
3393
|
+
actionType === "exportCertificate" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
3394
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-black", children: "This will export your certificate of incorporation document." }),
|
|
3395
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3396
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Format" }),
|
|
3397
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3398
|
+
"select",
|
|
3399
|
+
{
|
|
3400
|
+
value: formData.format || "pdf",
|
|
3401
|
+
onChange: (e) => setActionFormData({
|
|
3402
|
+
...actionFormData,
|
|
3403
|
+
format: e.target.value
|
|
3404
|
+
}),
|
|
3405
|
+
className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
|
|
3406
|
+
children: [
|
|
3407
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "pdf", children: "PDF" }),
|
|
3408
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "json", children: "JSON" })
|
|
3409
|
+
]
|
|
3410
|
+
}
|
|
3411
|
+
)
|
|
3412
|
+
] })
|
|
3413
|
+
] }),
|
|
3414
|
+
(actionType === "toggleBlockRule" || actionType === "enableBlockRule" || actionType === "disableBlockRule") && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
|
|
3415
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3416
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Block Rule" }),
|
|
3417
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3418
|
+
"select",
|
|
3419
|
+
{
|
|
3420
|
+
value: formData.ruleId || "rule_1",
|
|
3421
|
+
onChange: (e) => setActionFormData({
|
|
3422
|
+
...actionFormData,
|
|
3423
|
+
ruleId: e.target.value
|
|
3424
|
+
}),
|
|
3425
|
+
className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
|
|
3426
|
+
children: [
|
|
3427
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "rule_1", children: "Block if risk level = 'highest'" }),
|
|
3428
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "rule_2", children: "Block if matches Stripe block lists" }),
|
|
3429
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "rule_3", children: "Block if CVC verification fails" }),
|
|
3430
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "rule_4", children: "Block if Postal code verification fails" })
|
|
3431
|
+
]
|
|
3432
|
+
}
|
|
3433
|
+
)
|
|
3434
|
+
] }),
|
|
3435
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-black", children: actionType === "enableBlockRule" ? "This will enable the selected block rule to actively block matching payments." : actionType === "disableBlockRule" ? "This will disable the selected block rule. Matching payments will no longer be blocked." : "This will toggle the selected block rule's state." })
|
|
3436
|
+
] }),
|
|
3437
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3438
|
+
Button,
|
|
3439
|
+
{
|
|
3440
|
+
type: "button",
|
|
3441
|
+
size: "sm",
|
|
3442
|
+
variant: "secondary",
|
|
3443
|
+
className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
|
|
3444
|
+
onClick: handleActionSubmit,
|
|
3445
|
+
children: [
|
|
3446
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "Confirm" }),
|
|
3447
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
|
|
3448
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
|
|
3449
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
|
|
3450
|
+
] })
|
|
3451
|
+
]
|
|
3452
|
+
}
|
|
3453
|
+
) })
|
|
3454
|
+
]
|
|
3455
|
+
},
|
|
3456
|
+
message.id
|
|
3457
|
+
);
|
|
3458
|
+
}
|
|
3459
|
+
if (message.kind === "bulkPreview" && message.csvData) {
|
|
3460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3461
|
+
"div",
|
|
3082
3462
|
{
|
|
3083
|
-
|
|
3084
|
-
size: "sm",
|
|
3085
|
-
variant: "secondary",
|
|
3086
|
-
className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
|
|
3087
|
-
onClick: () => message.bulkSessionId && confirmBulkOperation(message.bulkSessionId),
|
|
3463
|
+
className: `${isRoleChange ? "mt-3" : ""}`,
|
|
3088
3464
|
children: [
|
|
3089
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3465
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
|
|
3466
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "bg-gray-50 rounded-lg border border-gray-200 overflow-hidden", children: [
|
|
3467
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "bg-gray-100 px-3 py-2 border-b border-gray-200 flex items-center gap-2", children: [
|
|
3468
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.FileSpreadsheet, { className: "h-4 w-4 text-gray-600" }),
|
|
3469
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs font-medium text-gray-700", children: message.csvData.fileName }),
|
|
3470
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-xs text-gray-500", children: [
|
|
3471
|
+
"\u2022 ",
|
|
3472
|
+
message.csvData.rowCount,
|
|
3473
|
+
" rows"
|
|
3474
|
+
] })
|
|
3475
|
+
] }),
|
|
3476
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "px-3 py-2 border-b border-gray-100", children: [
|
|
3477
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-gray-500 mb-1", children: "Columns" }),
|
|
3478
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex flex-wrap gap-1", children: message.csvData.columns.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3479
|
+
"span",
|
|
3480
|
+
{
|
|
3481
|
+
className: "text-xs bg-blue-100 text-blue-700 px-1.5 py-0.5 rounded",
|
|
3482
|
+
children: col
|
|
3483
|
+
},
|
|
3484
|
+
i
|
|
3485
|
+
)) })
|
|
3486
|
+
] }),
|
|
3487
|
+
message.csvData.sampleRows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "px-3 py-2", children: [
|
|
3488
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-gray-500 mb-1", children: "Sample Data" }),
|
|
3489
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "space-y-1", children: message.csvData.sampleRows.slice(0, 3).map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3490
|
+
"div",
|
|
3491
|
+
{
|
|
3492
|
+
className: "text-xs text-gray-600 bg-white rounded px-2 py-1 border border-gray-100",
|
|
3493
|
+
children: [
|
|
3494
|
+
Object.entries(row).slice(0, 3).map(([key, val], j) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
|
|
3495
|
+
j > 0 && " \u2022 ",
|
|
3496
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-gray-400", children: [
|
|
3497
|
+
key,
|
|
3498
|
+
":"
|
|
3499
|
+
] }),
|
|
3500
|
+
" ",
|
|
3501
|
+
val
|
|
3502
|
+
] }, key)),
|
|
3503
|
+
Object.keys(row).length > 3 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-gray-400", children: [
|
|
3504
|
+
" ",
|
|
3505
|
+
"..."
|
|
3506
|
+
] })
|
|
3507
|
+
]
|
|
3508
|
+
},
|
|
3509
|
+
i
|
|
3510
|
+
)) })
|
|
3511
|
+
] }),
|
|
3512
|
+
message.suggestedAction && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "px-3 py-2 bg-blue-50 border-t border-blue-100", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-xs text-blue-700", children: [
|
|
3513
|
+
"Suggested action:",
|
|
3514
|
+
" ",
|
|
3515
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { children: message.suggestedAction.replace(/_/g, " ") })
|
|
3516
|
+
] }) })
|
|
3093
3517
|
] }),
|
|
3094
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("
|
|
3095
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.
|
|
3096
|
-
|
|
3518
|
+
message.bulkSessionId && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
|
|
3519
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3520
|
+
Button,
|
|
3521
|
+
{
|
|
3522
|
+
type: "button",
|
|
3523
|
+
size: "sm",
|
|
3524
|
+
variant: "secondary",
|
|
3525
|
+
className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
|
|
3526
|
+
onClick: () => message.bulkSessionId && confirmBulkOperation(message.bulkSessionId),
|
|
3527
|
+
children: [
|
|
3528
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
|
|
3529
|
+
"Process ",
|
|
3530
|
+
message.csvData.rowCount,
|
|
3531
|
+
" rows"
|
|
3532
|
+
] }),
|
|
3533
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
|
|
3534
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
|
|
3535
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
|
|
3536
|
+
] })
|
|
3537
|
+
]
|
|
3538
|
+
}
|
|
3539
|
+
),
|
|
3540
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3541
|
+
Button,
|
|
3542
|
+
{
|
|
3543
|
+
type: "button",
|
|
3544
|
+
size: "sm",
|
|
3545
|
+
variant: "ghost",
|
|
3546
|
+
className: "h-8 rounded-xl px-3 text-xs text-gray-500 hover:text-gray-700 hover:bg-gray-100",
|
|
3547
|
+
onClick: cancelBulkOperation,
|
|
3548
|
+
children: "Cancel"
|
|
3549
|
+
}
|
|
3550
|
+
)
|
|
3097
3551
|
] })
|
|
3098
3552
|
]
|
|
3099
|
-
}
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3553
|
+
},
|
|
3554
|
+
message.id
|
|
3555
|
+
);
|
|
3556
|
+
}
|
|
3557
|
+
if (message.kind === "bulkProgress" && message.bulkProgress) {
|
|
3558
|
+
const { processed, total, successes, failures } = message.bulkProgress;
|
|
3559
|
+
const percentage = Math.round(processed / total * 100);
|
|
3560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3561
|
+
"div",
|
|
3103
3562
|
{
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3563
|
+
className: `${isRoleChange ? "mt-3" : ""}`,
|
|
3564
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "bg-gray-50 rounded-lg border border-gray-200 p-3", children: [
|
|
3565
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
3566
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Loader2, { className: "h-4 w-4 animate-spin text-blue-600" }),
|
|
3567
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-sm font-medium text-gray-700", children: [
|
|
3568
|
+
"Processing... ",
|
|
3569
|
+
processed,
|
|
3570
|
+
" of ",
|
|
3571
|
+
total
|
|
3572
|
+
] })
|
|
3573
|
+
] }),
|
|
3574
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "h-2 bg-gray-200 rounded-full overflow-hidden mb-2", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3575
|
+
"div",
|
|
3576
|
+
{
|
|
3577
|
+
className: "h-full bg-blue-600 transition-all duration-300",
|
|
3578
|
+
style: { width: `${percentage}%` }
|
|
3579
|
+
}
|
|
3580
|
+
) }),
|
|
3581
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-3 text-xs text-gray-600", children: [
|
|
3582
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-1", children: [
|
|
3583
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CheckCircle2, { className: "h-3 w-3 text-green-600" }),
|
|
3584
|
+
successes,
|
|
3585
|
+
" successful"
|
|
3586
|
+
] }),
|
|
3587
|
+
failures > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-1 text-red-600", children: [
|
|
3588
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.X, { className: "h-3 w-3" }),
|
|
3589
|
+
failures,
|
|
3590
|
+
" failed"
|
|
3591
|
+
] })
|
|
3592
|
+
] })
|
|
3593
|
+
] })
|
|
3594
|
+
},
|
|
3595
|
+
message.id
|
|
3596
|
+
);
|
|
3597
|
+
}
|
|
3598
|
+
if (message.kind === "bulkSummary" && message.bulkSummary) {
|
|
3599
|
+
const { total, successes, failures, navigationPage } = message.bulkSummary;
|
|
3600
|
+
const hasFailures = failures.length > 0;
|
|
3601
|
+
const pageLabel = navigationPage?.page === "customers" ? "Customers" : navigationPage?.page === "dashboard" ? "Dashboard" : navigationPage?.page === "settings" ? "Settings" : "Results";
|
|
3602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3603
|
+
"div",
|
|
3604
|
+
{
|
|
3605
|
+
className: `${isRoleChange ? "mt-3" : ""}`,
|
|
3606
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3607
|
+
"div",
|
|
3608
|
+
{
|
|
3609
|
+
className: `rounded-lg border p-3 ${hasFailures ? "bg-amber-50 border-amber-200" : "bg-green-50 border-green-200"}`,
|
|
3610
|
+
children: [
|
|
3611
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
3612
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3613
|
+
import_lucide_react4.CheckCircle2,
|
|
3614
|
+
{
|
|
3615
|
+
className: `h-5 w-5 ${hasFailures ? "text-amber-600" : "text-green-600"}`
|
|
3616
|
+
}
|
|
3617
|
+
),
|
|
3618
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-medium text-gray-800", children: "Bulk operation complete" })
|
|
3619
|
+
] }),
|
|
3620
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-sm text-gray-600 mb-2", children: message.content || `Processed ${total} rows: ${successes} successful${hasFailures ? `, ${failures.length} failed` : ""}.` }),
|
|
3621
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-4 text-xs", children: [
|
|
3622
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-1 text-green-700", children: [
|
|
3623
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CheckCircle2, { className: "h-3 w-3" }),
|
|
3624
|
+
successes,
|
|
3625
|
+
" successful"
|
|
3626
|
+
] }),
|
|
3627
|
+
hasFailures && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-1 text-red-600", children: [
|
|
3628
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.X, { className: "h-3 w-3" }),
|
|
3629
|
+
failures.length,
|
|
3630
|
+
" failed"
|
|
3631
|
+
] })
|
|
3632
|
+
] }),
|
|
3633
|
+
hasFailures && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mt-3 pt-2 border-t border-amber-200", children: [
|
|
3634
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-amber-700 mb-1", children: "Failed Rows" }),
|
|
3635
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-1 max-h-32 overflow-y-auto", children: [
|
|
3636
|
+
failures.slice(0, 5).map((failure, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3637
|
+
"div",
|
|
3638
|
+
{
|
|
3639
|
+
className: "text-xs text-red-700 bg-red-50 rounded px-2 py-1",
|
|
3640
|
+
children: [
|
|
3641
|
+
"Row ",
|
|
3642
|
+
failure.row,
|
|
3643
|
+
":",
|
|
3644
|
+
" ",
|
|
3645
|
+
failure.error || "Unknown error"
|
|
3646
|
+
]
|
|
3647
|
+
},
|
|
3648
|
+
i
|
|
3649
|
+
)),
|
|
3650
|
+
failures.length > 5 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "text-xs text-amber-600", children: [
|
|
3651
|
+
"...and ",
|
|
3652
|
+
failures.length - 5,
|
|
3653
|
+
" more"
|
|
3654
|
+
] })
|
|
3655
|
+
] })
|
|
3656
|
+
] }),
|
|
3657
|
+
navigationPage && successes > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-3 pt-2 border-t border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3658
|
+
"button",
|
|
3659
|
+
{
|
|
3660
|
+
type: "button",
|
|
3661
|
+
onClick: (e) => {
|
|
3662
|
+
e.preventDefault();
|
|
3663
|
+
e.stopPropagation();
|
|
3664
|
+
console.log(
|
|
3665
|
+
"[DEBUG] Button clicked - navigationPage:",
|
|
3666
|
+
navigationPage,
|
|
3667
|
+
"onNavigate:",
|
|
3668
|
+
!!onNavigate
|
|
3669
|
+
);
|
|
3670
|
+
if (onNavigate && navigationPage.page) {
|
|
3671
|
+
console.log(
|
|
3672
|
+
"[DEBUG] Calling onNavigate with page:",
|
|
3673
|
+
navigationPage.page
|
|
3674
|
+
);
|
|
3675
|
+
onNavigate(
|
|
3676
|
+
navigationPage.page,
|
|
3677
|
+
navigationPage.subtab
|
|
3678
|
+
);
|
|
3679
|
+
} else {
|
|
3680
|
+
console.log(
|
|
3681
|
+
"[DEBUG] Condition failed - onNavigate:",
|
|
3682
|
+
!!onNavigate,
|
|
3683
|
+
"navigationPage.page:",
|
|
3684
|
+
navigationPage.page
|
|
3685
|
+
);
|
|
3686
|
+
}
|
|
3687
|
+
},
|
|
3688
|
+
className: "flex items-center gap-2 text-xs text-gray-500 hover:text-gray-700 transition-colors group cursor-pointer",
|
|
3689
|
+
children: [
|
|
3690
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-1 px-1.5 py-0.5 bg-gray-100 rounded text-[10px] font-medium text-gray-600 group-hover:bg-gray-200", children: [
|
|
3691
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Command, { className: "h-2.5 w-2.5" }),
|
|
3692
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "+" }),
|
|
3693
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-2.5 w-2.5" })
|
|
3694
|
+
] }),
|
|
3695
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
|
|
3696
|
+
"View ",
|
|
3697
|
+
pageLabel
|
|
3698
|
+
] })
|
|
3699
|
+
]
|
|
3700
|
+
}
|
|
3701
|
+
) })
|
|
3702
|
+
]
|
|
3703
|
+
}
|
|
3704
|
+
)
|
|
3705
|
+
},
|
|
3706
|
+
message.id
|
|
3707
|
+
);
|
|
3708
|
+
}
|
|
3709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(React4.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3129
3710
|
"div",
|
|
3130
3711
|
{
|
|
3131
|
-
|
|
3132
|
-
|
|
3712
|
+
ref: isCurrentGuideStep ? currentStepRef : null,
|
|
3713
|
+
className: `${isRoleChange ? "mt-3" : ""}`,
|
|
3714
|
+
children: [
|
|
3715
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-sm leading-6 text-gray-700", children: (() => {
|
|
3716
|
+
const text = message.content || "";
|
|
3717
|
+
if (message.kind === "guideStep") {
|
|
3718
|
+
const m = text.match(/^(Step\s+\d+:)([\s\S]*)/);
|
|
3719
|
+
if (m) {
|
|
3720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
3721
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { children: m[1] }),
|
|
3722
|
+
m[2]
|
|
3723
|
+
] });
|
|
3724
|
+
}
|
|
3725
|
+
}
|
|
3726
|
+
if (message.role === "assistant" && text) {
|
|
3727
|
+
return renderMarkdown(text);
|
|
3728
|
+
}
|
|
3729
|
+
return text || /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "opacity-70", children: "Thinking\u2026" });
|
|
3730
|
+
})() }),
|
|
3731
|
+
message.role === "assistant" && message.structuredData && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3732
|
+
DataRenderer,
|
|
3733
|
+
{
|
|
3734
|
+
type: message.structuredData.type,
|
|
3735
|
+
data: message.structuredData.data
|
|
3736
|
+
}
|
|
3737
|
+
) }),
|
|
3738
|
+
message.role === "assistant" && message.followups && message.followups.length > 0 && !message.followupSelected && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-3 flex flex-wrap gap-1.5", children: message.followups.map((followup) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3739
|
+
"button",
|
|
3740
|
+
{
|
|
3741
|
+
type: "button",
|
|
3742
|
+
onClick: () => handleFollowupClick(message.id, followup),
|
|
3743
|
+
className: "inline-flex items-center px-3 py-1.5 text-xs font-medium rounded-xl\n bg-white hover:bg-gray-50 text-gray-600 hover:text-gray-800\n border border-gray-200 hover:border-gray-300 shadow-sm\n transition-all duration-150 ease-in-out",
|
|
3744
|
+
children: followup.label
|
|
3745
|
+
},
|
|
3746
|
+
followup.id
|
|
3747
|
+
)) })
|
|
3748
|
+
]
|
|
3133
3749
|
}
|
|
3134
|
-
) })
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
" successful"
|
|
3140
|
-
] }),
|
|
3141
|
-
failures > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-1 text-red-600", children: [
|
|
3142
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.X, { className: "h-3 w-3" }),
|
|
3143
|
-
failures,
|
|
3144
|
-
" failed"
|
|
3145
|
-
] })
|
|
3146
|
-
] })
|
|
3147
|
-
] }) }, message.id);
|
|
3148
|
-
}
|
|
3149
|
-
if (message.kind === "bulkSummary" && message.bulkSummary) {
|
|
3150
|
-
const { total, successes, failures, navigationPage } = message.bulkSummary;
|
|
3151
|
-
const hasFailures = failures.length > 0;
|
|
3152
|
-
const pageLabel = navigationPage?.page === "customers" ? "Customers" : navigationPage?.page === "dashboard" ? "Dashboard" : navigationPage?.page === "settings" ? "Settings" : "Results";
|
|
3153
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `${isRoleChange ? "mt-3" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `rounded-lg border p-3 ${hasFailures ? "bg-amber-50 border-amber-200" : "bg-green-50 border-green-200"}`, children: [
|
|
3154
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
3155
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CheckCircle2, { className: `h-5 w-5 ${hasFailures ? "text-amber-600" : "text-green-600"}` }),
|
|
3156
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-medium text-gray-800", children: "Bulk operation complete" })
|
|
3157
|
-
] }),
|
|
3158
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-sm text-gray-600 mb-2", children: message.content || `Processed ${total} rows: ${successes} successful${hasFailures ? `, ${failures.length} failed` : ""}.` }),
|
|
3159
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-4 text-xs", children: [
|
|
3160
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-1 text-green-700", children: [
|
|
3161
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CheckCircle2, { className: "h-3 w-3" }),
|
|
3162
|
-
successes,
|
|
3163
|
-
" successful"
|
|
3164
|
-
] }),
|
|
3165
|
-
hasFailures && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-1 text-red-600", children: [
|
|
3166
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.X, { className: "h-3 w-3" }),
|
|
3167
|
-
failures.length,
|
|
3168
|
-
" failed"
|
|
3169
|
-
] })
|
|
3170
|
-
] }),
|
|
3171
|
-
hasFailures && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mt-3 pt-2 border-t border-amber-200", children: [
|
|
3172
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-amber-700 mb-1", children: "Failed Rows" }),
|
|
3173
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-1 max-h-32 overflow-y-auto", children: [
|
|
3174
|
-
failures.slice(0, 5).map((failure, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "text-xs text-red-700 bg-red-50 rounded px-2 py-1", children: [
|
|
3175
|
-
"Row ",
|
|
3176
|
-
failure.row,
|
|
3177
|
-
": ",
|
|
3178
|
-
failure.error || "Unknown error"
|
|
3179
|
-
] }, i)),
|
|
3180
|
-
failures.length > 5 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "text-xs text-amber-600", children: [
|
|
3181
|
-
"...and ",
|
|
3182
|
-
failures.length - 5,
|
|
3183
|
-
" more"
|
|
3184
|
-
] })
|
|
3185
|
-
] })
|
|
3186
|
-
] }),
|
|
3187
|
-
navigationPage && successes > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-3 pt-2 border-t border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3188
|
-
"button",
|
|
3750
|
+
) }, message.id);
|
|
3751
|
+
}),
|
|
3752
|
+
(activeGuide || guideComplete) && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
|
|
3753
|
+
activeGuide && activeGuide.stepIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3754
|
+
Button,
|
|
3189
3755
|
{
|
|
3190
3756
|
type: "button",
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3757
|
+
size: "sm",
|
|
3758
|
+
variant: "secondary",
|
|
3759
|
+
className: "h-7 w-7 rounded-full p-0 bg-gray-100 hover:bg-gray-200 border border-gray-200",
|
|
3760
|
+
onClick: goBackGuide,
|
|
3761
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.ArrowLeft, { className: "h-3.5 w-3.5 text-gray-600" })
|
|
3762
|
+
}
|
|
3763
|
+
),
|
|
3764
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3765
|
+
Button,
|
|
3766
|
+
{
|
|
3767
|
+
type: "button",
|
|
3768
|
+
size: "sm",
|
|
3769
|
+
variant: "secondary",
|
|
3770
|
+
className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
|
|
3771
|
+
onClick: guideComplete ? handleBack : advanceGuide,
|
|
3203
3772
|
children: [
|
|
3204
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.
|
|
3205
|
-
|
|
3206
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3207
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-
|
|
3208
|
-
] }),
|
|
3209
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
|
|
3210
|
-
"View ",
|
|
3211
|
-
pageLabel
|
|
3773
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: guideComplete ? "Done" : "Next" }),
|
|
3774
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
|
|
3775
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
|
|
3776
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
|
|
3212
3777
|
] })
|
|
3213
3778
|
]
|
|
3214
3779
|
}
|
|
3215
|
-
)
|
|
3216
|
-
] })
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
if (m) {
|
|
3229
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
3230
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { children: m[1] }),
|
|
3231
|
-
m[2]
|
|
3232
|
-
] });
|
|
3233
|
-
}
|
|
3234
|
-
}
|
|
3235
|
-
if (message.role === "assistant" && text) {
|
|
3236
|
-
return renderMarkdown(text);
|
|
3237
|
-
}
|
|
3238
|
-
return text || /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "opacity-70", children: "Thinking\u2026" });
|
|
3239
|
-
})() }),
|
|
3240
|
-
message.role === "assistant" && message.structuredData && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3241
|
-
DataRenderer,
|
|
3242
|
-
{
|
|
3243
|
-
type: message.structuredData.type,
|
|
3244
|
-
data: message.structuredData.data
|
|
3245
|
-
}
|
|
3246
|
-
) }),
|
|
3247
|
-
message.role === "assistant" && message.followups && message.followups.length > 0 && !message.followupSelected && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-3 flex flex-wrap gap-1.5", children: message.followups.map((followup) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3248
|
-
"button",
|
|
3249
|
-
{
|
|
3250
|
-
type: "button",
|
|
3251
|
-
onClick: () => handleFollowupClick(message.id, followup),
|
|
3252
|
-
className: "inline-flex items-center px-3 py-1.5 text-xs font-medium rounded-xl\n bg-white hover:bg-gray-50 text-gray-600 hover:text-gray-800\n border border-gray-200 hover:border-gray-300 shadow-sm\n transition-all duration-150 ease-in-out",
|
|
3253
|
-
children: followup.label
|
|
3254
|
-
},
|
|
3255
|
-
followup.id
|
|
3256
|
-
)) })
|
|
3257
|
-
]
|
|
3258
|
-
}
|
|
3259
|
-
) }, message.id);
|
|
3260
|
-
}),
|
|
3261
|
-
(activeGuide || guideComplete) && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
|
|
3262
|
-
activeGuide && activeGuide.stepIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3263
|
-
Button,
|
|
3264
|
-
{
|
|
3265
|
-
type: "button",
|
|
3266
|
-
size: "sm",
|
|
3267
|
-
variant: "secondary",
|
|
3268
|
-
className: "h-7 w-7 rounded-full p-0 bg-gray-100 hover:bg-gray-200 border border-gray-200",
|
|
3269
|
-
onClick: goBackGuide,
|
|
3270
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.ArrowLeft, { className: "h-3.5 w-3.5 text-gray-600" })
|
|
3271
|
-
}
|
|
3272
|
-
),
|
|
3273
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3274
|
-
Button,
|
|
3275
|
-
{
|
|
3276
|
-
type: "button",
|
|
3277
|
-
size: "sm",
|
|
3278
|
-
variant: "secondary",
|
|
3279
|
-
className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
|
|
3280
|
-
onClick: guideComplete ? handleBack : advanceGuide,
|
|
3281
|
-
children: [
|
|
3282
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: guideComplete ? "Done" : "Next" }),
|
|
3283
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
|
|
3284
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
|
|
3285
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
|
|
3286
|
-
] })
|
|
3287
|
-
]
|
|
3288
|
-
}
|
|
3289
|
-
)
|
|
3290
|
-
] }),
|
|
3291
|
-
(phase === "thinking" || phase === "searching" || phase === "executing" || phase === "responding") && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `${lastRole === "user" ? "mt-3" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3292
|
-
AssistantActivity,
|
|
3293
|
-
{
|
|
3294
|
-
phase,
|
|
3295
|
-
progressSteps
|
|
3296
|
-
}
|
|
3297
|
-
) }),
|
|
3298
|
-
!activeGuide && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { ref: messagesEndRef })
|
|
3299
|
-
] }) }) }) }) }),
|
|
3780
|
+
)
|
|
3781
|
+
] }),
|
|
3782
|
+
(phase === "thinking" || phase === "searching" || phase === "executing" || phase === "responding") && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `${lastRole === "user" ? "mt-3" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3783
|
+
AssistantActivity,
|
|
3784
|
+
{
|
|
3785
|
+
phase,
|
|
3786
|
+
progressSteps
|
|
3787
|
+
}
|
|
3788
|
+
) }),
|
|
3789
|
+
!activeGuide && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { ref: messagesEndRef })
|
|
3790
|
+
] }) }) }) })
|
|
3791
|
+
}
|
|
3792
|
+
),
|
|
3300
3793
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "px-4 py-3 border-t border-gray-100 bg-gray-50/50 shrink-0", children: [
|
|
3301
3794
|
pendingFile && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mb-2 flex items-center gap-2 rounded-xl bg-blue-50 border border-blue-200 px-3 py-2", children: [
|
|
3302
3795
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.FileSpreadsheet, { className: "h-4 w-4 text-blue-600" }),
|
|
@@ -3348,14 +3841,10 @@ ${userText}`
|
|
|
3348
3841
|
{
|
|
3349
3842
|
placeholder: pendingFile ? "Describe what to do with this CSV..." : "Ask anything...",
|
|
3350
3843
|
value: input,
|
|
3351
|
-
onChange: (e) =>
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
onInput: (e) => {
|
|
3356
|
-
const target = e.target;
|
|
3357
|
-
target.style.height = "auto";
|
|
3358
|
-
target.style.height = Math.min(target.scrollHeight, 120) + "px";
|
|
3844
|
+
onChange: (e) => {
|
|
3845
|
+
setInput(e.target.value);
|
|
3846
|
+
e.target.style.height = "24px";
|
|
3847
|
+
e.target.style.height = `${Math.min(120, e.target.scrollHeight)}px`;
|
|
3359
3848
|
},
|
|
3360
3849
|
onKeyDown: (e) => {
|
|
3361
3850
|
if (e.key === "Enter" && !e.shiftKey && !e.metaKey && !e.ctrlKey) {
|
|
@@ -3425,7 +3914,11 @@ ${userText}`
|
|
|
3425
3914
|
}
|
|
3426
3915
|
);
|
|
3427
3916
|
}
|
|
3428
|
-
function PanelToggle({
|
|
3917
|
+
function PanelToggle({
|
|
3918
|
+
isOpen,
|
|
3919
|
+
onClick,
|
|
3920
|
+
className = ""
|
|
3921
|
+
}) {
|
|
3429
3922
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3430
3923
|
"button",
|
|
3431
3924
|
{
|
|
@@ -3471,13 +3964,7 @@ function ChatPanelWithToggle({
|
|
|
3471
3964
|
};
|
|
3472
3965
|
}, [isOpen]);
|
|
3473
3966
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
3474
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3475
|
-
PanelToggle,
|
|
3476
|
-
{
|
|
3477
|
-
isOpen,
|
|
3478
|
-
onClick: () => setIsOpen(!isOpen)
|
|
3479
|
-
}
|
|
3480
|
-
),
|
|
3967
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PanelToggle, { isOpen, onClick: () => setIsOpen(!isOpen) }),
|
|
3481
3968
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3482
3969
|
ChatPanel,
|
|
3483
3970
|
{
|