@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/index.cjs
CHANGED
|
@@ -941,7 +941,7 @@ function DataRenderer({ type, data }) {
|
|
|
941
941
|
// src/ChatPanel.tsx
|
|
942
942
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
943
943
|
var DEFAULT_AGENT_URL = "http://localhost:5002";
|
|
944
|
-
var PANEL_WIDTH =
|
|
944
|
+
var PANEL_WIDTH = 400;
|
|
945
945
|
function renderMarkdown(text) {
|
|
946
946
|
if (!text) return null;
|
|
947
947
|
const lines = text.split("\n");
|
|
@@ -958,7 +958,14 @@ function renderMarkdown(text) {
|
|
|
958
958
|
const codeMatch = remaining.match(/^`([^`]+)`/);
|
|
959
959
|
if (codeMatch) {
|
|
960
960
|
parts.push(
|
|
961
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
961
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
962
|
+
"code",
|
|
963
|
+
{
|
|
964
|
+
className: "bg-gray-100 px-1 py-0.5 rounded text-xs font-mono",
|
|
965
|
+
children: codeMatch[1]
|
|
966
|
+
},
|
|
967
|
+
keyIndex++
|
|
968
|
+
)
|
|
962
969
|
);
|
|
963
970
|
remaining = remaining.slice(codeMatch[0].length);
|
|
964
971
|
continue;
|
|
@@ -978,7 +985,17 @@ function renderMarkdown(text) {
|
|
|
978
985
|
const linkMatch = remaining.match(/^\[([^\]]+)\]\(([^)]+)\)/);
|
|
979
986
|
if (linkMatch) {
|
|
980
987
|
parts.push(
|
|
981
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
988
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
989
|
+
"a",
|
|
990
|
+
{
|
|
991
|
+
href: linkMatch[2],
|
|
992
|
+
className: "text-blue-600 hover:underline",
|
|
993
|
+
target: "_blank",
|
|
994
|
+
rel: "noopener noreferrer",
|
|
995
|
+
children: linkMatch[1]
|
|
996
|
+
},
|
|
997
|
+
keyIndex++
|
|
998
|
+
)
|
|
982
999
|
);
|
|
983
1000
|
remaining = remaining.slice(linkMatch[0].length);
|
|
984
1001
|
continue;
|
|
@@ -1001,7 +1018,14 @@ function renderMarkdown(text) {
|
|
|
1001
1018
|
if (currentList) {
|
|
1002
1019
|
const ListTag = currentList.type === "ul" ? "ul" : "ol";
|
|
1003
1020
|
elements.push(
|
|
1004
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1021
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1022
|
+
ListTag,
|
|
1023
|
+
{
|
|
1024
|
+
className: `${currentList.type === "ul" ? "list-disc" : "list-decimal"} ml-4 my-1`,
|
|
1025
|
+
children: currentList.items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("li", { className: "ml-2", children: item }, i))
|
|
1026
|
+
},
|
|
1027
|
+
elements.length
|
|
1028
|
+
)
|
|
1005
1029
|
);
|
|
1006
1030
|
currentList = null;
|
|
1007
1031
|
}
|
|
@@ -1011,7 +1035,14 @@ function renderMarkdown(text) {
|
|
|
1011
1035
|
if (line.startsWith("```")) {
|
|
1012
1036
|
if (inCodeBlock) {
|
|
1013
1037
|
elements.push(
|
|
1014
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1038
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1039
|
+
"pre",
|
|
1040
|
+
{
|
|
1041
|
+
className: "bg-gray-100 rounded p-2 my-1 overflow-x-auto",
|
|
1042
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("code", { className: "text-xs font-mono", children: codeContent.join("\n") })
|
|
1043
|
+
},
|
|
1044
|
+
elements.length
|
|
1045
|
+
)
|
|
1015
1046
|
);
|
|
1016
1047
|
inCodeBlock = false;
|
|
1017
1048
|
codeContent = [];
|
|
@@ -1033,7 +1064,9 @@ function renderMarkdown(text) {
|
|
|
1033
1064
|
const level = headerMatch[1].length;
|
|
1034
1065
|
const content = processInlineFormatting(headerMatch[2]);
|
|
1035
1066
|
const className = level === 1 ? "text-lg font-bold my-1" : level === 2 ? "text-base font-bold my-1" : "text-sm font-semibold my-1";
|
|
1036
|
-
elements.push(
|
|
1067
|
+
elements.push(
|
|
1068
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className, children: content }, elements.length)
|
|
1069
|
+
);
|
|
1037
1070
|
continue;
|
|
1038
1071
|
}
|
|
1039
1072
|
const ulMatch = line.match(/^[-*]\s+(.+)/);
|
|
@@ -1061,11 +1094,15 @@ function renderMarkdown(text) {
|
|
|
1061
1094
|
}
|
|
1062
1095
|
if (line.match(/^[-*_]{3,}$/)) {
|
|
1063
1096
|
flushList();
|
|
1064
|
-
elements.push(
|
|
1097
|
+
elements.push(
|
|
1098
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("hr", { className: "my-2 border-gray-200" }, elements.length)
|
|
1099
|
+
);
|
|
1065
1100
|
continue;
|
|
1066
1101
|
}
|
|
1067
1102
|
flushList();
|
|
1068
|
-
elements.push(
|
|
1103
|
+
elements.push(
|
|
1104
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: processInlineFormatting(line) }, elements.length)
|
|
1105
|
+
);
|
|
1069
1106
|
}
|
|
1070
1107
|
flushList();
|
|
1071
1108
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: elements });
|
|
@@ -1095,31 +1132,59 @@ var folders = [
|
|
|
1095
1132
|
id: "customers",
|
|
1096
1133
|
title: "Customer Management",
|
|
1097
1134
|
topics: [
|
|
1098
|
-
{
|
|
1099
|
-
|
|
1135
|
+
{
|
|
1136
|
+
id: "add-customer",
|
|
1137
|
+
label: "Add a new customer",
|
|
1138
|
+
prompt: "How do I add a new customer to the system and what information is required?"
|
|
1139
|
+
},
|
|
1140
|
+
{
|
|
1141
|
+
id: "customer-details",
|
|
1142
|
+
label: "View customer details",
|
|
1143
|
+
prompt: "Show me how to view and edit customer information and their payment history."
|
|
1144
|
+
}
|
|
1100
1145
|
]
|
|
1101
1146
|
},
|
|
1102
1147
|
{
|
|
1103
1148
|
id: "payments",
|
|
1104
1149
|
title: "Payment Processing",
|
|
1105
1150
|
topics: [
|
|
1106
|
-
{
|
|
1107
|
-
|
|
1151
|
+
{
|
|
1152
|
+
id: "process-payment",
|
|
1153
|
+
label: "Process a payment",
|
|
1154
|
+
prompt: "How do I process a one-time payment for a customer?"
|
|
1155
|
+
},
|
|
1156
|
+
{
|
|
1157
|
+
id: "refund-payment",
|
|
1158
|
+
label: "Issue a refund",
|
|
1159
|
+
prompt: "Walk me through issuing a refund for a customer payment."
|
|
1160
|
+
}
|
|
1108
1161
|
]
|
|
1109
1162
|
},
|
|
1110
1163
|
{
|
|
1111
1164
|
id: "subscriptions",
|
|
1112
1165
|
title: "Subscription Management",
|
|
1113
1166
|
topics: [
|
|
1114
|
-
{
|
|
1115
|
-
|
|
1167
|
+
{
|
|
1168
|
+
id: "create-subscription",
|
|
1169
|
+
label: "Create a subscription",
|
|
1170
|
+
prompt: "How do I set up a new subscription plan for a customer?"
|
|
1171
|
+
},
|
|
1172
|
+
{
|
|
1173
|
+
id: "update-subscription",
|
|
1174
|
+
label: "Update subscription tier",
|
|
1175
|
+
prompt: "How can I change a customer's subscription plan or upgrade them?"
|
|
1176
|
+
}
|
|
1116
1177
|
]
|
|
1117
1178
|
},
|
|
1118
1179
|
{
|
|
1119
1180
|
id: "billing",
|
|
1120
1181
|
title: "Billing",
|
|
1121
1182
|
topics: [
|
|
1122
|
-
{
|
|
1183
|
+
{
|
|
1184
|
+
id: "payment-methods",
|
|
1185
|
+
label: "Manage payment methods",
|
|
1186
|
+
prompt: "How do customers add or update their payment methods?"
|
|
1187
|
+
}
|
|
1123
1188
|
]
|
|
1124
1189
|
}
|
|
1125
1190
|
];
|
|
@@ -1265,18 +1330,21 @@ function ChatPanel({
|
|
|
1265
1330
|
} = {}) {
|
|
1266
1331
|
const [messages, setMessages] = React4.useState(initialMessages);
|
|
1267
1332
|
const [input, setInput] = React4.useState("");
|
|
1268
|
-
const [sessionId] = React4.useState(() => crypto.randomUUID());
|
|
1333
|
+
const [sessionId, setSessionId] = React4.useState(() => crypto.randomUUID());
|
|
1334
|
+
const resetSession = React4.useCallback(() => {
|
|
1335
|
+
setSessionId(crypto.randomUUID());
|
|
1336
|
+
}, []);
|
|
1269
1337
|
const streamIntervals = React4.useRef({});
|
|
1270
1338
|
const isEmpty = messages.length === 0;
|
|
1271
1339
|
const [phase, setPhase] = React4.useState("idle");
|
|
1272
1340
|
const [progressSteps, setProgressSteps] = React4.useState([]);
|
|
1273
1341
|
const phaseTimers = React4.useRef([]);
|
|
1274
1342
|
const lastRole = messages.length ? messages[messages.length - 1].role : void 0;
|
|
1275
|
-
const [panelView, setPanelView] = React4.useState(
|
|
1276
|
-
|
|
1277
|
-
const [startingQuestions, setStartingQuestions] = React4.useState(
|
|
1278
|
-
startingQuestionsProp || defaultStartingQuestions
|
|
1343
|
+
const [panelView, setPanelView] = React4.useState(
|
|
1344
|
+
"landing"
|
|
1279
1345
|
);
|
|
1346
|
+
const [currentFolderId, setCurrentFolderId] = React4.useState(void 0);
|
|
1347
|
+
const [startingQuestions, setStartingQuestions] = React4.useState(startingQuestionsProp || defaultStartingQuestions);
|
|
1280
1348
|
const [loadingQuestions, setLoadingQuestions] = React4.useState(false);
|
|
1281
1349
|
React4.useEffect(() => {
|
|
1282
1350
|
if (startingQuestionsEndpoint && !startingQuestionsProp) {
|
|
@@ -1300,10 +1368,11 @@ function ChatPanel({
|
|
|
1300
1368
|
const latestBulkSummaryNavigationRef = React4.useRef(null);
|
|
1301
1369
|
const [guideComplete, setGuideComplete] = React4.useState(false);
|
|
1302
1370
|
React4.useEffect(() => {
|
|
1303
|
-
;
|
|
1304
1371
|
window.resetIntegrationNotification = () => {
|
|
1305
1372
|
localStorage.removeItem("gmailNotificationSeen");
|
|
1306
|
-
console.log(
|
|
1373
|
+
console.log(
|
|
1374
|
+
"Integration notification reset! Click the Integrations tab to see it again."
|
|
1375
|
+
);
|
|
1307
1376
|
};
|
|
1308
1377
|
const handleIntegrationTabClick = () => {
|
|
1309
1378
|
const hasSeenNotification = localStorage.getItem("gmailNotificationSeen");
|
|
@@ -1326,7 +1395,10 @@ function ChatPanel({
|
|
|
1326
1395
|
};
|
|
1327
1396
|
window.addEventListener("integrationTabClicked", handleIntegrationTabClick);
|
|
1328
1397
|
return () => {
|
|
1329
|
-
window.removeEventListener(
|
|
1398
|
+
window.removeEventListener(
|
|
1399
|
+
"integrationTabClicked",
|
|
1400
|
+
handleIntegrationTabClick
|
|
1401
|
+
);
|
|
1330
1402
|
};
|
|
1331
1403
|
}, []);
|
|
1332
1404
|
React4.useEffect(() => {
|
|
@@ -1361,7 +1433,12 @@ function ChatPanel({
|
|
|
1361
1433
|
const id = Date.now() + 1;
|
|
1362
1434
|
setMessages((prev) => [
|
|
1363
1435
|
...prev,
|
|
1364
|
-
{
|
|
1436
|
+
{
|
|
1437
|
+
id,
|
|
1438
|
+
role: "assistant",
|
|
1439
|
+
kind: "guideComplete",
|
|
1440
|
+
content: "Perfect! The dialog is now open. You can enter a name and create your API key."
|
|
1441
|
+
}
|
|
1365
1442
|
]);
|
|
1366
1443
|
setActiveGuide(void 0);
|
|
1367
1444
|
setGuideComplete(true);
|
|
@@ -1372,7 +1449,9 @@ function ChatPanel({
|
|
|
1372
1449
|
}, [activeGuide, hide]);
|
|
1373
1450
|
React4.useEffect(() => {
|
|
1374
1451
|
return () => {
|
|
1375
|
-
Object.values(streamIntervals.current).forEach(
|
|
1452
|
+
Object.values(streamIntervals.current).forEach(
|
|
1453
|
+
(id) => window.clearInterval(id)
|
|
1454
|
+
);
|
|
1376
1455
|
streamIntervals.current = {};
|
|
1377
1456
|
phaseTimers.current.forEach((id) => window.clearTimeout(id));
|
|
1378
1457
|
phaseTimers.current = [];
|
|
@@ -1433,9 +1512,17 @@ function ChatPanel({
|
|
|
1433
1512
|
return;
|
|
1434
1513
|
}
|
|
1435
1514
|
const currentBulkNav = latestBulkSummaryNavigationRef.current;
|
|
1436
|
-
console.log(
|
|
1515
|
+
console.log(
|
|
1516
|
+
"[DEBUG] Keyboard handler - latestBulkSummaryNavigation:",
|
|
1517
|
+
currentBulkNav,
|
|
1518
|
+
"onNavigate:",
|
|
1519
|
+
!!onNavigate
|
|
1520
|
+
);
|
|
1437
1521
|
if (currentBulkNav && onNavigate) {
|
|
1438
|
-
console.log(
|
|
1522
|
+
console.log(
|
|
1523
|
+
"[DEBUG] Navigating via keyboard to:",
|
|
1524
|
+
currentBulkNav.page
|
|
1525
|
+
);
|
|
1439
1526
|
e.preventDefault();
|
|
1440
1527
|
e.stopPropagation();
|
|
1441
1528
|
onNavigate(currentBulkNav.page, currentBulkNav.subtab);
|
|
@@ -1458,21 +1545,57 @@ function ChatPanel({
|
|
|
1458
1545
|
};
|
|
1459
1546
|
window.addEventListener("keydown", handleKeyDown);
|
|
1460
1547
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
1461
|
-
}, [
|
|
1548
|
+
}, [
|
|
1549
|
+
pendingAction,
|
|
1550
|
+
pendingNavigation,
|
|
1551
|
+
activeGuide,
|
|
1552
|
+
guideComplete,
|
|
1553
|
+
onNavigate
|
|
1554
|
+
]);
|
|
1462
1555
|
function streamAssistantMessage(messageId, fullText, followups) {
|
|
1463
|
-
|
|
1556
|
+
let textToStream = fullText;
|
|
1557
|
+
let extractedFollowups = followups;
|
|
1558
|
+
if (fullText && fullText.startsWith("{") && fullText.includes('"response"')) {
|
|
1559
|
+
try {
|
|
1560
|
+
let depth = 0, endIdx = 0;
|
|
1561
|
+
for (let i2 = 0; i2 < fullText.length; i2++) {
|
|
1562
|
+
if (fullText[i2] === "{") depth++;
|
|
1563
|
+
else if (fullText[i2] === "}") {
|
|
1564
|
+
depth--;
|
|
1565
|
+
if (depth === 0) {
|
|
1566
|
+
endIdx = i2 + 1;
|
|
1567
|
+
break;
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
const firstJson = endIdx > 0 ? fullText.slice(0, endIdx) : fullText;
|
|
1572
|
+
const parsed = JSON.parse(firstJson);
|
|
1573
|
+
if (parsed.response && typeof parsed.response === "string") {
|
|
1574
|
+
textToStream = parsed.response;
|
|
1575
|
+
if (!extractedFollowups && parsed.followups) {
|
|
1576
|
+
extractedFollowups = parsed.followups;
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
} catch {
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
const tokens = textToStream.split(" ");
|
|
1464
1583
|
let i = 0;
|
|
1465
1584
|
const intervalId = window.setInterval(() => {
|
|
1466
1585
|
i += 1;
|
|
1467
1586
|
setMessages(
|
|
1468
|
-
(prev) => prev.map(
|
|
1587
|
+
(prev) => prev.map(
|
|
1588
|
+
(m) => m.id === messageId ? { ...m, content: tokens.slice(0, i).join(" ") } : m
|
|
1589
|
+
)
|
|
1469
1590
|
);
|
|
1470
1591
|
if (i >= tokens.length) {
|
|
1471
1592
|
window.clearInterval(intervalId);
|
|
1472
1593
|
delete streamIntervals.current[messageId];
|
|
1473
|
-
if (
|
|
1594
|
+
if (extractedFollowups && extractedFollowups.length > 0) {
|
|
1474
1595
|
setMessages(
|
|
1475
|
-
(prev) => prev.map(
|
|
1596
|
+
(prev) => prev.map(
|
|
1597
|
+
(m) => m.id === messageId ? { ...m, followups: extractedFollowups } : m
|
|
1598
|
+
)
|
|
1476
1599
|
);
|
|
1477
1600
|
}
|
|
1478
1601
|
setPhase("idle");
|
|
@@ -1482,16 +1605,21 @@ function ChatPanel({
|
|
|
1482
1605
|
}
|
|
1483
1606
|
function handleFollowupClick(messageId, followup) {
|
|
1484
1607
|
setMessages(
|
|
1485
|
-
(prev) => prev.map(
|
|
1608
|
+
(prev) => prev.map(
|
|
1609
|
+
(m) => m.id === messageId ? { ...m, followupSelected: true } : m
|
|
1610
|
+
)
|
|
1486
1611
|
);
|
|
1487
1612
|
startChatFlow(followup.label);
|
|
1488
1613
|
}
|
|
1489
1614
|
function handleBack() {
|
|
1490
|
-
Object.values(streamIntervals.current).forEach(
|
|
1615
|
+
Object.values(streamIntervals.current).forEach(
|
|
1616
|
+
(id) => window.clearInterval(id)
|
|
1617
|
+
);
|
|
1491
1618
|
streamIntervals.current = {};
|
|
1492
1619
|
phaseTimers.current.forEach((id) => window.clearTimeout(id));
|
|
1493
1620
|
phaseTimers.current = [];
|
|
1494
1621
|
hide();
|
|
1622
|
+
resetSession();
|
|
1495
1623
|
setMessages([]);
|
|
1496
1624
|
setInput("");
|
|
1497
1625
|
setPhase("idle");
|
|
@@ -1651,7 +1779,10 @@ function ChatPanel({
|
|
|
1651
1779
|
content: ""
|
|
1652
1780
|
};
|
|
1653
1781
|
setMessages((prev) => [...prev, thankYouMessage]);
|
|
1654
|
-
streamAssistantMessage(
|
|
1782
|
+
streamAssistantMessage(
|
|
1783
|
+
thankYouMessageId,
|
|
1784
|
+
"Thank you, your feedback is saved."
|
|
1785
|
+
);
|
|
1655
1786
|
return;
|
|
1656
1787
|
}
|
|
1657
1788
|
setPendingNavigation(null);
|
|
@@ -1709,7 +1840,10 @@ function ChatPanel({
|
|
|
1709
1840
|
} else if (data.status === "executing") {
|
|
1710
1841
|
setPhase("executing");
|
|
1711
1842
|
setProgressSteps((prev) => {
|
|
1712
|
-
const updated = prev.map((step) => ({
|
|
1843
|
+
const updated = prev.map((step) => ({
|
|
1844
|
+
...step,
|
|
1845
|
+
completed: true
|
|
1846
|
+
}));
|
|
1713
1847
|
const lastStep = updated[updated.length - 1];
|
|
1714
1848
|
if (!lastStep || lastStep.message !== data.message) {
|
|
1715
1849
|
updated.push({ message: data.message, completed: false });
|
|
@@ -1718,7 +1852,9 @@ function ChatPanel({
|
|
|
1718
1852
|
});
|
|
1719
1853
|
} else if (data.status === "responding") {
|
|
1720
1854
|
setPhase("responding");
|
|
1721
|
-
setProgressSteps(
|
|
1855
|
+
setProgressSteps(
|
|
1856
|
+
(prev) => prev.map((step) => ({ ...step, completed: true }))
|
|
1857
|
+
);
|
|
1722
1858
|
}
|
|
1723
1859
|
} else if (eventType === "response") {
|
|
1724
1860
|
setProgressSteps([]);
|
|
@@ -1764,7 +1900,11 @@ function ChatPanel({
|
|
|
1764
1900
|
content: ""
|
|
1765
1901
|
};
|
|
1766
1902
|
setMessages((prev) => [...prev, assistantMessage]);
|
|
1767
|
-
streamAssistantMessage(
|
|
1903
|
+
streamAssistantMessage(
|
|
1904
|
+
assistantMessageId,
|
|
1905
|
+
agentResponse.response || agentResponse.message || "For bulk operations, you can upload a CSV file - just click the \u{1F4CE} button!",
|
|
1906
|
+
agentResponse.followups
|
|
1907
|
+
);
|
|
1768
1908
|
streamCompleted = true;
|
|
1769
1909
|
} else if (agentResponse.action === "bulk_preview") {
|
|
1770
1910
|
setPendingBulkSession(agentResponse.bulk_session_id);
|
|
@@ -1796,12 +1936,18 @@ function ChatPanel({
|
|
|
1796
1936
|
structuredData: agentResponse.structuredData || void 0
|
|
1797
1937
|
};
|
|
1798
1938
|
setMessages((prev) => [...prev, assistantMessage]);
|
|
1799
|
-
streamAssistantMessage(
|
|
1939
|
+
streamAssistantMessage(
|
|
1940
|
+
assistantMessageId,
|
|
1941
|
+
agentResponse.response,
|
|
1942
|
+
agentResponse.followups
|
|
1943
|
+
);
|
|
1800
1944
|
streamCompleted = true;
|
|
1801
1945
|
setTimeout(() => {
|
|
1802
|
-
window.dispatchEvent(
|
|
1803
|
-
|
|
1804
|
-
|
|
1946
|
+
window.dispatchEvent(
|
|
1947
|
+
new CustomEvent("agentActionComplete", {
|
|
1948
|
+
detail: { result: agentResponse.executionResult }
|
|
1949
|
+
})
|
|
1950
|
+
);
|
|
1805
1951
|
}, 100);
|
|
1806
1952
|
} else {
|
|
1807
1953
|
const assistantMessageId = now + 1;
|
|
@@ -1812,7 +1958,11 @@ function ChatPanel({
|
|
|
1812
1958
|
content: ""
|
|
1813
1959
|
};
|
|
1814
1960
|
setMessages((prev) => [...prev, assistantMessage]);
|
|
1815
|
-
streamAssistantMessage(
|
|
1961
|
+
streamAssistantMessage(
|
|
1962
|
+
assistantMessageId,
|
|
1963
|
+
agentResponse.response,
|
|
1964
|
+
agentResponse.followups
|
|
1965
|
+
);
|
|
1816
1966
|
streamCompleted = true;
|
|
1817
1967
|
}
|
|
1818
1968
|
} else if (eventType === "error") {
|
|
@@ -1827,7 +1977,10 @@ function ChatPanel({
|
|
|
1827
1977
|
content: ""
|
|
1828
1978
|
};
|
|
1829
1979
|
setMessages((prev) => [...prev, errorMessage]);
|
|
1830
|
-
streamAssistantMessage(
|
|
1980
|
+
streamAssistantMessage(
|
|
1981
|
+
errorMessageId,
|
|
1982
|
+
data.message || "An error occurred processing your request."
|
|
1983
|
+
);
|
|
1831
1984
|
} else if (eventType === "done") {
|
|
1832
1985
|
setProgressSteps([]);
|
|
1833
1986
|
setPhase("idle");
|
|
@@ -1853,7 +2006,18 @@ function ChatPanel({
|
|
|
1853
2006
|
content: ""
|
|
1854
2007
|
};
|
|
1855
2008
|
setMessages((prev) => [...prev, errorMessage]);
|
|
1856
|
-
|
|
2009
|
+
let errorText = "I'm having trouble connecting to my backend.";
|
|
2010
|
+
if (error instanceof Error) {
|
|
2011
|
+
if (error.name === "AbortError") {
|
|
2012
|
+
errorText = "The request timed out. The server might be busy - please try again.";
|
|
2013
|
+
} else if (error.message.includes("Failed to fetch") || error.message.includes("NetworkError")) {
|
|
2014
|
+
errorText = "I'm having trouble connecting to my backend. Please make sure the agent server is running on port 5002.";
|
|
2015
|
+
} else if (error.message.includes("Agent request failed:")) {
|
|
2016
|
+
errorText = "The server encountered an error. Please try again.";
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
errorText += " For simple navigation requests, I can still help you locally.";
|
|
2020
|
+
streamAssistantMessage(errorMessageId, errorText);
|
|
1857
2021
|
} finally {
|
|
1858
2022
|
setProgressSteps([]);
|
|
1859
2023
|
}
|
|
@@ -1937,33 +2101,41 @@ ${userText}`
|
|
|
1937
2101
|
setMessages((prev) => [...prev, previewMessage]);
|
|
1938
2102
|
} else if (eventType === "progress") {
|
|
1939
2103
|
setPhase("executing");
|
|
1940
|
-
setProgressSteps([
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
2104
|
+
setProgressSteps([
|
|
2105
|
+
{
|
|
2106
|
+
message: `Processing row ${data.row} of ${data.total}...`,
|
|
2107
|
+
completed: false
|
|
2108
|
+
}
|
|
2109
|
+
]);
|
|
1944
2110
|
setMessages((prev) => {
|
|
1945
2111
|
const lastMsg = prev[prev.length - 1];
|
|
1946
2112
|
if (lastMsg?.kind === "bulkProgress") {
|
|
1947
2113
|
return prev.map(
|
|
1948
|
-
(m, i) => i === prev.length - 1 ? {
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
2114
|
+
(m, i) => i === prev.length - 1 ? {
|
|
2115
|
+
...m,
|
|
2116
|
+
bulkProgress: {
|
|
2117
|
+
processed: data.row,
|
|
2118
|
+
total: data.total,
|
|
2119
|
+
successes: data.successes || 0,
|
|
2120
|
+
failures: data.failures || 0
|
|
2121
|
+
}
|
|
2122
|
+
} : m
|
|
1954
2123
|
);
|
|
1955
2124
|
} else {
|
|
1956
|
-
return [
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
2125
|
+
return [
|
|
2126
|
+
...prev,
|
|
2127
|
+
{
|
|
2128
|
+
id: Date.now(),
|
|
2129
|
+
role: "assistant",
|
|
2130
|
+
kind: "bulkProgress",
|
|
2131
|
+
bulkProgress: {
|
|
2132
|
+
processed: data.row,
|
|
2133
|
+
total: data.total,
|
|
2134
|
+
successes: data.successes || 0,
|
|
2135
|
+
failures: data.failures || 0
|
|
2136
|
+
}
|
|
1965
2137
|
}
|
|
1966
|
-
|
|
2138
|
+
];
|
|
1967
2139
|
}
|
|
1968
2140
|
});
|
|
1969
2141
|
} else if (eventType === "summary") {
|
|
@@ -1972,23 +2144,34 @@ ${userText}`
|
|
|
1972
2144
|
setPendingBulkSession(null);
|
|
1973
2145
|
setMessages((prev) => {
|
|
1974
2146
|
const filtered = prev.filter((m) => m.kind !== "bulkProgress");
|
|
1975
|
-
return [
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
2147
|
+
return [
|
|
2148
|
+
...filtered,
|
|
2149
|
+
{
|
|
2150
|
+
id: Date.now(),
|
|
2151
|
+
role: "assistant",
|
|
2152
|
+
kind: "bulkSummary",
|
|
2153
|
+
content: data.message,
|
|
2154
|
+
bulkSummary: {
|
|
2155
|
+
total: data.total,
|
|
2156
|
+
successes: data.successes,
|
|
2157
|
+
failures: data.failures || [],
|
|
2158
|
+
navigationPage: data.navigationPage
|
|
2159
|
+
}
|
|
1985
2160
|
}
|
|
1986
|
-
|
|
2161
|
+
];
|
|
1987
2162
|
});
|
|
1988
2163
|
setTimeout(() => {
|
|
1989
|
-
window.dispatchEvent(
|
|
1990
|
-
|
|
1991
|
-
|
|
2164
|
+
window.dispatchEvent(
|
|
2165
|
+
new CustomEvent("agentActionComplete", {
|
|
2166
|
+
detail: {
|
|
2167
|
+
result: {
|
|
2168
|
+
bulk: true,
|
|
2169
|
+
total: data.total,
|
|
2170
|
+
successes: data.successes
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
})
|
|
2174
|
+
);
|
|
1992
2175
|
}, 100);
|
|
1993
2176
|
} else if (eventType === "error") {
|
|
1994
2177
|
setPhase("idle");
|
|
@@ -2016,18 +2199,31 @@ ${userText}`
|
|
|
2016
2199
|
console.error("Bulk upload failed:", error);
|
|
2017
2200
|
setProgressSteps([]);
|
|
2018
2201
|
setPhase("idle");
|
|
2202
|
+
let errorText = "I'm having trouble processing your CSV file.";
|
|
2203
|
+
if (error instanceof Error) {
|
|
2204
|
+
if (error.name === "AbortError") {
|
|
2205
|
+
errorText = "The bulk upload request timed out. The file might be too large or the server is busy - please try again.";
|
|
2206
|
+
} else if (error.message.includes("Failed to fetch") || error.message.includes("NetworkError")) {
|
|
2207
|
+
errorText = "I'm having trouble connecting to my backend. Please make sure the agent server is running on port 5002.";
|
|
2208
|
+
} else if (error.message.includes("Bulk upload failed:")) {
|
|
2209
|
+
errorText = "The server encountered an error processing your CSV file. Please try again.";
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
errorText += " Please try again.";
|
|
2019
2213
|
const errorMessage = {
|
|
2020
2214
|
id: now + 1,
|
|
2021
2215
|
role: "assistant",
|
|
2022
2216
|
kind: "text",
|
|
2023
|
-
content:
|
|
2217
|
+
content: errorText
|
|
2024
2218
|
};
|
|
2025
2219
|
setMessages((prev) => [...prev, errorMessage]);
|
|
2026
2220
|
}
|
|
2027
2221
|
}
|
|
2028
2222
|
async function confirmBulkOperation(bulkSessionId) {
|
|
2029
2223
|
setPhase("executing");
|
|
2030
|
-
setProgressSteps([
|
|
2224
|
+
setProgressSteps([
|
|
2225
|
+
{ message: "Starting bulk operation...", completed: false }
|
|
2226
|
+
]);
|
|
2031
2227
|
try {
|
|
2032
2228
|
const response = await fetch(`${agentUrl}/chat/bulk/confirm`, {
|
|
2033
2229
|
method: "POST",
|
|
@@ -2063,43 +2259,56 @@ ${userText}`
|
|
|
2063
2259
|
try {
|
|
2064
2260
|
const data = JSON.parse(eventData);
|
|
2065
2261
|
if (eventType === "progress") {
|
|
2066
|
-
setProgressSteps([
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2262
|
+
setProgressSteps([
|
|
2263
|
+
{
|
|
2264
|
+
message: `Processing row ${data.row} of ${data.total}...`,
|
|
2265
|
+
completed: false
|
|
2266
|
+
}
|
|
2267
|
+
]);
|
|
2070
2268
|
setMessages((prev) => {
|
|
2071
2269
|
const lastMsg = prev[prev.length - 1];
|
|
2072
2270
|
if (lastMsg?.kind === "bulkProgress") {
|
|
2073
2271
|
return prev.map(
|
|
2074
|
-
(m, i) => i === prev.length - 1 ? {
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2272
|
+
(m, i) => i === prev.length - 1 ? {
|
|
2273
|
+
...m,
|
|
2274
|
+
bulkProgress: {
|
|
2275
|
+
processed: data.row,
|
|
2276
|
+
total: data.total,
|
|
2277
|
+
successes: data.successes || 0,
|
|
2278
|
+
failures: data.failures || 0
|
|
2279
|
+
}
|
|
2280
|
+
} : m
|
|
2080
2281
|
);
|
|
2081
2282
|
} else {
|
|
2082
|
-
return [
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2283
|
+
return [
|
|
2284
|
+
...prev,
|
|
2285
|
+
{
|
|
2286
|
+
id: Date.now(),
|
|
2287
|
+
role: "assistant",
|
|
2288
|
+
kind: "bulkProgress",
|
|
2289
|
+
bulkProgress: {
|
|
2290
|
+
processed: data.row,
|
|
2291
|
+
total: data.total,
|
|
2292
|
+
successes: data.successes || 0,
|
|
2293
|
+
failures: data.failures || 0
|
|
2294
|
+
}
|
|
2091
2295
|
}
|
|
2092
|
-
|
|
2296
|
+
];
|
|
2093
2297
|
}
|
|
2094
2298
|
});
|
|
2095
2299
|
} else if (eventType === "summary") {
|
|
2096
2300
|
console.log("[DEBUG] Received summary event - data:", data);
|
|
2097
|
-
console.log(
|
|
2301
|
+
console.log(
|
|
2302
|
+
"[DEBUG] navigationPage from backend:",
|
|
2303
|
+
data.navigationPage
|
|
2304
|
+
);
|
|
2098
2305
|
setPhase("idle");
|
|
2099
2306
|
setProgressSteps([]);
|
|
2100
2307
|
setPendingBulkSession(null);
|
|
2101
2308
|
setMessages((prev) => {
|
|
2102
|
-
const filtered = prev.filter(
|
|
2309
|
+
const filtered = prev.filter(
|
|
2310
|
+
(m) => m.kind !== "bulkProgress" && m.kind !== "bulkPreview"
|
|
2311
|
+
);
|
|
2103
2312
|
const newMsg = {
|
|
2104
2313
|
id: Date.now(),
|
|
2105
2314
|
role: "assistant",
|
|
@@ -2116,9 +2325,17 @@ ${userText}`
|
|
|
2116
2325
|
return [...filtered, newMsg];
|
|
2117
2326
|
});
|
|
2118
2327
|
setTimeout(() => {
|
|
2119
|
-
window.dispatchEvent(
|
|
2120
|
-
|
|
2121
|
-
|
|
2328
|
+
window.dispatchEvent(
|
|
2329
|
+
new CustomEvent("agentActionComplete", {
|
|
2330
|
+
detail: {
|
|
2331
|
+
result: {
|
|
2332
|
+
bulk: true,
|
|
2333
|
+
total: data.total,
|
|
2334
|
+
successes: data.successes
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
})
|
|
2338
|
+
);
|
|
2122
2339
|
}, 100);
|
|
2123
2340
|
} else if (eventType === "error") {
|
|
2124
2341
|
setPhase("idle");
|
|
@@ -2160,7 +2377,10 @@ ${userText}`
|
|
|
2160
2377
|
}
|
|
2161
2378
|
function appendAssistantText(text) {
|
|
2162
2379
|
const id = Date.now() + Math.floor(Math.random() * 1e3);
|
|
2163
|
-
setMessages((prev) => [
|
|
2380
|
+
setMessages((prev) => [
|
|
2381
|
+
...prev,
|
|
2382
|
+
{ id, role: "assistant", kind: "text", content: text }
|
|
2383
|
+
]);
|
|
2164
2384
|
}
|
|
2165
2385
|
function startGuide(guideId) {
|
|
2166
2386
|
const guide = guides[guideId];
|
|
@@ -2173,7 +2393,9 @@ ${userText}`
|
|
|
2173
2393
|
appendAssistantText(`I'll help you with ${guide.title}.`);
|
|
2174
2394
|
const firstStep = guide.steps[0];
|
|
2175
2395
|
const isNavigationButton = firstStep.cursorTarget?.selector.includes("[data-page=");
|
|
2176
|
-
const isTabButton = firstStep.cursorTarget?.selector.includes(
|
|
2396
|
+
const isTabButton = firstStep.cursorTarget?.selector.includes(
|
|
2397
|
+
"[data-settings-tab="
|
|
2398
|
+
);
|
|
2177
2399
|
if (firstStep.cursorTarget && (isNavigationButton || isTabButton)) {
|
|
2178
2400
|
const cursorTarget = firstStep.cursorTarget;
|
|
2179
2401
|
if (isTabButton && firstStep.navigation && onNavigate) {
|
|
@@ -2182,7 +2404,9 @@ ${userText}`
|
|
|
2182
2404
|
const initialDelay = isTabButton ? 800 : 400;
|
|
2183
2405
|
setTimeout(() => {
|
|
2184
2406
|
const waitForElement = () => {
|
|
2185
|
-
const element = document.querySelector(
|
|
2407
|
+
const element = document.querySelector(
|
|
2408
|
+
cursorTarget.selector
|
|
2409
|
+
);
|
|
2186
2410
|
if (element && element.offsetParent !== null) {
|
|
2187
2411
|
moveTo(cursorTarget);
|
|
2188
2412
|
if (cursorTarget.onClick) {
|
|
@@ -2207,7 +2431,9 @@ ${userText}`
|
|
|
2207
2431
|
const initialDelay = isDialogElement ? 700 : isSettingsTab ? 600 : 400;
|
|
2208
2432
|
setTimeout(() => {
|
|
2209
2433
|
const waitForElement = () => {
|
|
2210
|
-
const element = document.querySelector(
|
|
2434
|
+
const element = document.querySelector(
|
|
2435
|
+
cursorTarget.selector
|
|
2436
|
+
);
|
|
2211
2437
|
if (element && element.offsetParent !== null) {
|
|
2212
2438
|
moveTo(cursorTarget);
|
|
2213
2439
|
if (cursorTarget.onClick) {
|
|
@@ -2221,7 +2447,9 @@ ${userText}`
|
|
|
2221
2447
|
moveTo(cursorTarget);
|
|
2222
2448
|
if (cursorTarget.onClick) {
|
|
2223
2449
|
setTimeout(() => {
|
|
2224
|
-
const el = document.querySelector(
|
|
2450
|
+
const el = document.querySelector(
|
|
2451
|
+
cursorTarget.selector
|
|
2452
|
+
);
|
|
2225
2453
|
if (el) el.click();
|
|
2226
2454
|
}, 1e3);
|
|
2227
2455
|
}
|
|
@@ -2258,7 +2486,12 @@ ${userText}`
|
|
|
2258
2486
|
const id = Date.now() + 1;
|
|
2259
2487
|
setMessages((prev) => [
|
|
2260
2488
|
...prev,
|
|
2261
|
-
{
|
|
2489
|
+
{
|
|
2490
|
+
id,
|
|
2491
|
+
role: "assistant",
|
|
2492
|
+
kind: "guideComplete",
|
|
2493
|
+
content: "Guide Complete"
|
|
2494
|
+
}
|
|
2262
2495
|
]);
|
|
2263
2496
|
setActiveGuide(void 0);
|
|
2264
2497
|
setGuideComplete(true);
|
|
@@ -2277,7 +2510,9 @@ ${userText}`
|
|
|
2277
2510
|
};
|
|
2278
2511
|
setMessages((prev) => [...prev, draft]);
|
|
2279
2512
|
const isNavigationButton = nextStep.cursorTarget?.selector.includes("[data-page=");
|
|
2280
|
-
const isTabButton = nextStep.cursorTarget?.selector.includes(
|
|
2513
|
+
const isTabButton = nextStep.cursorTarget?.selector.includes(
|
|
2514
|
+
"[data-settings-tab="
|
|
2515
|
+
);
|
|
2281
2516
|
if (nextStep.cursorTarget && (isNavigationButton || isTabButton)) {
|
|
2282
2517
|
const cursorTarget = nextStep.cursorTarget;
|
|
2283
2518
|
if (isTabButton && nextStep.navigation && onNavigate) {
|
|
@@ -2294,7 +2529,9 @@ ${userText}`
|
|
|
2294
2529
|
if (!currentGuide3 || currentGuide3.id !== guide.id || currentGuide3.stepIndex !== nextIndex) {
|
|
2295
2530
|
return;
|
|
2296
2531
|
}
|
|
2297
|
-
const element = document.querySelector(
|
|
2532
|
+
const element = document.querySelector(
|
|
2533
|
+
cursorTarget.selector
|
|
2534
|
+
);
|
|
2298
2535
|
if (element && element.offsetParent !== null) {
|
|
2299
2536
|
moveTo(cursorTarget);
|
|
2300
2537
|
if (cursorTarget.onClick) {
|
|
@@ -2320,7 +2557,9 @@ ${userText}`
|
|
|
2320
2557
|
const cursorTarget = nextStep.cursorTarget;
|
|
2321
2558
|
const isDialogElement = cursorTarget.selector.includes("dialog") || cursorTarget.selector.includes("api-key-name-input");
|
|
2322
2559
|
const isSettingsTab = cursorTarget.selector.includes("data-settings-tab");
|
|
2323
|
-
const navigationSetTab = nextStep.navigation?.subtab && isSettingsTab && cursorTarget.selector.includes(
|
|
2560
|
+
const navigationSetTab = nextStep.navigation?.subtab && isSettingsTab && cursorTarget.selector.includes(
|
|
2561
|
+
`data-settings-tab="${nextStep.navigation.subtab}"`
|
|
2562
|
+
);
|
|
2324
2563
|
const shouldAutoClick = cursorTarget.onClick && !navigationSetTab;
|
|
2325
2564
|
const hasNavigation = !!nextStep.navigation;
|
|
2326
2565
|
const hasSubtab = !!nextStep.navigation?.subtab;
|
|
@@ -2336,7 +2575,9 @@ ${userText}`
|
|
|
2336
2575
|
if (!currentGuide3 || currentGuide3.id !== guide.id || currentGuide3.stepIndex !== nextIndex) {
|
|
2337
2576
|
return;
|
|
2338
2577
|
}
|
|
2339
|
-
const element = document.querySelector(
|
|
2578
|
+
const element = document.querySelector(
|
|
2579
|
+
cursorTarget.selector
|
|
2580
|
+
);
|
|
2340
2581
|
if (element && element.offsetParent !== null) {
|
|
2341
2582
|
moveTo(cursorTarget);
|
|
2342
2583
|
if (shouldAutoClick) {
|
|
@@ -2358,7 +2599,9 @@ ${userText}`
|
|
|
2358
2599
|
if (!currentGuide4 || currentGuide4.id !== guide.id || currentGuide4.stepIndex !== nextIndex) {
|
|
2359
2600
|
return;
|
|
2360
2601
|
}
|
|
2361
|
-
const el = document.querySelector(
|
|
2602
|
+
const el = document.querySelector(
|
|
2603
|
+
cursorTarget.selector
|
|
2604
|
+
);
|
|
2362
2605
|
if (el) el.click();
|
|
2363
2606
|
}, 1e3);
|
|
2364
2607
|
}
|
|
@@ -2390,10 +2633,17 @@ ${userText}`
|
|
|
2390
2633
|
} else {
|
|
2391
2634
|
hide();
|
|
2392
2635
|
}
|
|
2393
|
-
const existingMessages = messages.filter(
|
|
2636
|
+
const existingMessages = messages.filter(
|
|
2637
|
+
(m) => m.kind !== "guideStep" && m.kind !== "guideComplete"
|
|
2638
|
+
);
|
|
2394
2639
|
setMessages([
|
|
2395
2640
|
...existingMessages,
|
|
2396
|
-
{
|
|
2641
|
+
{
|
|
2642
|
+
id: Date.now(),
|
|
2643
|
+
role: "assistant",
|
|
2644
|
+
kind: "guideStep",
|
|
2645
|
+
content: prevStep.text
|
|
2646
|
+
}
|
|
2397
2647
|
]);
|
|
2398
2648
|
}
|
|
2399
2649
|
}
|
|
@@ -2416,6 +2666,7 @@ ${userText}`
|
|
|
2416
2666
|
size: "sm",
|
|
2417
2667
|
className: "h-7 w-7 p-0 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-full",
|
|
2418
2668
|
onClick: () => {
|
|
2669
|
+
resetSession();
|
|
2419
2670
|
setMessages([]);
|
|
2420
2671
|
setPanelView("landing");
|
|
2421
2672
|
setCurrentFolderId(void 0);
|
|
@@ -2438,919 +2689,1161 @@ ${userText}`
|
|
|
2438
2689
|
)
|
|
2439
2690
|
] })
|
|
2440
2691
|
] }),
|
|
2441
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
{
|
|
2449
|
-
type: "button",
|
|
2450
|
-
size: "sm",
|
|
2451
|
-
variant: "ghost",
|
|
2452
|
-
className: "w-full justify-start rounded-lg px-3 py-1.5 text-xs text-gray-700 hover:bg-gray-100 h-auto",
|
|
2453
|
-
onClick: () => sendTopic(question.prompt),
|
|
2454
|
-
children: [
|
|
2455
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: `mr-2 inline-block h-1.5 w-1.5 rounded-full ${iconColors[index % iconColors.length]}` }),
|
|
2456
|
-
question.label
|
|
2457
|
-
]
|
|
2458
|
-
},
|
|
2459
|
-
question.id
|
|
2460
|
-
);
|
|
2461
|
-
}) }) }),
|
|
2462
|
-
panelView === "folder" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2463
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mb-3 flex items-center gap-2", children: [
|
|
2464
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2465
|
-
Button,
|
|
2466
|
-
{
|
|
2467
|
-
type: "button",
|
|
2468
|
-
size: "icon",
|
|
2469
|
-
variant: "ghost",
|
|
2470
|
-
className: "h-7 w-7 rounded-full hover:bg-gray-100",
|
|
2471
|
-
onClick: closeFolder,
|
|
2472
|
-
"aria-label": "Back to suggestions",
|
|
2473
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.ArrowLeft, { className: "h-4 w-4 text-gray-500" })
|
|
2474
|
-
}
|
|
2475
|
-
),
|
|
2476
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs font-medium uppercase tracking-wide text-gray-400", children: "Topics" })
|
|
2692
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2693
|
+
"div",
|
|
2694
|
+
{
|
|
2695
|
+
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",
|
|
2696
|
+
children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w-full overflow-y-auto px-4", children: [
|
|
2697
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "py-3 transition-all duration-300", children: [
|
|
2698
|
+
/* @__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?" }),
|
|
2699
|
+
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" })
|
|
2477
2700
|
] }),
|
|
2478
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
] })
|
|
2492
|
-
] }) : /* @__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: [
|
|
2493
|
-
messages.map((message, index) => {
|
|
2494
|
-
const isUser = message.role === "user";
|
|
2495
|
-
const previousRole = index > 0 ? messages[index - 1].role : void 0;
|
|
2496
|
-
const isRoleChange = previousRole !== void 0 && previousRole !== message.role;
|
|
2497
|
-
const currentGuide = activeGuideRef.current || activeGuide;
|
|
2498
|
-
let isCurrentGuideStep = false;
|
|
2499
|
-
if (currentGuide && message.kind === "guideStep") {
|
|
2500
|
-
if (message.guideStepIndex !== void 0) {
|
|
2501
|
-
isCurrentGuideStep = message.guideStepIndex === currentGuide.stepIndex;
|
|
2502
|
-
} else {
|
|
2503
|
-
isCurrentGuideStep = index === messages.length - 1;
|
|
2504
|
-
}
|
|
2505
|
-
} else if (message.kind === "guideComplete") {
|
|
2506
|
-
isCurrentGuideStep = index === messages.length - 1;
|
|
2507
|
-
}
|
|
2508
|
-
if (message.kind === "guideStep" && !isCurrentGuideStep) {
|
|
2509
|
-
return null;
|
|
2510
|
-
}
|
|
2511
|
-
if (isUser) {
|
|
2512
|
-
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);
|
|
2513
|
-
}
|
|
2514
|
-
if (message.kind === "searchSummary") {
|
|
2515
|
-
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);
|
|
2516
|
-
}
|
|
2517
|
-
if (message.kind === "guideComplete") {
|
|
2518
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2519
|
-
"div",
|
|
2520
|
-
{
|
|
2521
|
-
ref: isCurrentGuideStep ? currentStepRef : null,
|
|
2522
|
-
className: `${isRoleChange ? "mt-3" : ""}`,
|
|
2523
|
-
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: [
|
|
2524
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CheckCircle2, { className: "h-5 w-5 text-green-600 flex-shrink-0" }),
|
|
2525
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-medium text-green-800", children: message.content })
|
|
2526
|
-
] })
|
|
2527
|
-
},
|
|
2528
|
-
message.id
|
|
2529
|
-
);
|
|
2530
|
-
}
|
|
2531
|
-
if (message.kind === "navigationAction") {
|
|
2532
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `${isRoleChange ? "mt-3" : ""}`, children: [
|
|
2533
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-2 text-gray-700", children: message.content || "" }),
|
|
2534
|
-
message.navigationTarget && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2535
|
-
Button,
|
|
2536
|
-
{
|
|
2537
|
-
type: "button",
|
|
2538
|
-
size: "sm",
|
|
2539
|
-
variant: "secondary",
|
|
2540
|
-
className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
|
|
2541
|
-
onClick: () => message.navigationTarget && handleConfirmNavigation(message.navigationTarget),
|
|
2542
|
-
children: [
|
|
2543
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "Confirm" }),
|
|
2544
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
|
|
2545
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
|
|
2546
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
|
|
2547
|
-
] })
|
|
2548
|
-
]
|
|
2549
|
-
}
|
|
2550
|
-
) })
|
|
2551
|
-
] }, message.id);
|
|
2552
|
-
}
|
|
2553
|
-
if (message.kind === "actionForm") {
|
|
2554
|
-
const actionType = message.actionType;
|
|
2555
|
-
const formData = Object.keys(actionFormData).length > 0 ? actionFormData : message.actionData || {};
|
|
2556
|
-
if (message.isSubmitted) {
|
|
2557
|
-
let successContent = "";
|
|
2558
|
-
if (actionType === "updateCompanyInfo") {
|
|
2559
|
-
successContent = "Company information has been updated successfully.";
|
|
2560
|
-
} else if (actionType === "addApiKey") {
|
|
2561
|
-
successContent = "API key has been added successfully.";
|
|
2562
|
-
} else if (actionType === "addCustomer") {
|
|
2563
|
-
successContent = "Customer has been added successfully.";
|
|
2564
|
-
} else if (actionType === "enable2FA") {
|
|
2565
|
-
successContent = "Two-factor authentication has been enabled successfully.";
|
|
2566
|
-
} else if (actionType === "disable2FA") {
|
|
2567
|
-
successContent = "Two-factor authentication has been disabled successfully.";
|
|
2568
|
-
} else if (actionType === "changePassword") {
|
|
2569
|
-
successContent = "Your password has been changed successfully.";
|
|
2570
|
-
} else if (actionType === "revokeSession") {
|
|
2571
|
-
successContent = "Session has been revoked successfully.";
|
|
2572
|
-
} else if (actionType === "toggleNotification") {
|
|
2573
|
-
successContent = "Notification preferences have been updated successfully.";
|
|
2574
|
-
} else if (actionType === "connectIntegration") {
|
|
2575
|
-
successContent = "Integration has been connected successfully.";
|
|
2576
|
-
} else if (actionType === "disconnectIntegration") {
|
|
2577
|
-
successContent = "Integration has been disconnected successfully.";
|
|
2578
|
-
} else if (actionType === "addPaymentMethod") {
|
|
2579
|
-
successContent = "Payment method has been added successfully.";
|
|
2580
|
-
} else if (actionType === "removePaymentMethod") {
|
|
2581
|
-
successContent = "Payment method has been removed successfully.";
|
|
2582
|
-
} else if (actionType === "deleteApiKey") {
|
|
2583
|
-
successContent = "API key has been deleted successfully.";
|
|
2584
|
-
} else if (actionType === "addWebhook") {
|
|
2585
|
-
successContent = "Webhook endpoint has been added successfully.";
|
|
2586
|
-
} else if (actionType === "updateCurrency") {
|
|
2587
|
-
successContent = "Currency preference has been updated successfully.";
|
|
2588
|
-
} else if (actionType === "updateTimezone") {
|
|
2589
|
-
successContent = "Timezone has been updated successfully.";
|
|
2590
|
-
} else if (actionType === "refundPayment") {
|
|
2591
|
-
successContent = "Refund has been processed successfully.";
|
|
2592
|
-
} else if (actionType === "exportCertificate") {
|
|
2593
|
-
successContent = "Certificate of Incorporation has been downloaded successfully.";
|
|
2594
|
-
} else if (actionType === "createSubscription") {
|
|
2595
|
-
successContent = "Subscription has been created successfully.";
|
|
2596
|
-
} else if (actionType === "toggleBlockRule" || actionType === "enableBlockRule" || actionType === "disableBlockRule") {
|
|
2597
|
-
successContent = "Block rule has been updated successfully.";
|
|
2598
|
-
} else {
|
|
2599
|
-
successContent = "Action completed successfully.";
|
|
2600
|
-
}
|
|
2601
|
-
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);
|
|
2602
|
-
}
|
|
2603
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `min-w-0 ${isRoleChange ? "mt-3" : ""}`, children: [
|
|
2604
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
|
|
2605
|
-
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: [
|
|
2606
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
2607
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2608
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
|
|
2609
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2610
|
-
Input,
|
|
2611
|
-
{
|
|
2612
|
-
placeholder: "Acme Corporation",
|
|
2613
|
-
value: formData.companyName || "",
|
|
2614
|
-
onChange: (e) => setActionFormData({ ...actionFormData, companyName: e.target.value }),
|
|
2615
|
-
className: "h-8 text-xs border-gray-200"
|
|
2616
|
-
}
|
|
2617
|
-
)
|
|
2618
|
-
] }),
|
|
2619
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2620
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
|
|
2621
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2622
|
-
Input,
|
|
2623
|
-
{
|
|
2624
|
-
type: "email",
|
|
2625
|
-
placeholder: "contact@acme.com",
|
|
2626
|
-
value: formData.email || "",
|
|
2627
|
-
onChange: (e) => setActionFormData({ ...actionFormData, email: e.target.value }),
|
|
2628
|
-
className: "h-8 text-xs border-gray-200"
|
|
2629
|
-
}
|
|
2630
|
-
)
|
|
2631
|
-
] })
|
|
2632
|
-
] }),
|
|
2633
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2634
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Address" }),
|
|
2635
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2636
|
-
Input,
|
|
2701
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "pb-4 px-4", children: [
|
|
2702
|
+
panelView === "landing" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2703
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mb-2 text-[10px] font-semibold uppercase tracking-wider text-gray-400", children: "Suggested Questions" }),
|
|
2704
|
+
/* @__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) => {
|
|
2705
|
+
const iconColors = [
|
|
2706
|
+
"bg-blue-400",
|
|
2707
|
+
"bg-green-400",
|
|
2708
|
+
"bg-purple-400",
|
|
2709
|
+
"bg-orange-400",
|
|
2710
|
+
"bg-pink-400"
|
|
2711
|
+
];
|
|
2712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2713
|
+
Button,
|
|
2637
2714
|
{
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
className: "
|
|
2642
|
-
|
|
2643
|
-
)
|
|
2644
|
-
] }),
|
|
2645
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
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: "Phone" }),
|
|
2648
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2649
|
-
Input,
|
|
2650
|
-
{
|
|
2651
|
-
type: "tel",
|
|
2652
|
-
placeholder: "+1 (555) 123-4567",
|
|
2653
|
-
value: formData.phone || "",
|
|
2654
|
-
onChange: (e) => setActionFormData({ ...actionFormData, phone: e.target.value }),
|
|
2655
|
-
className: "h-8 text-xs border-gray-200"
|
|
2656
|
-
}
|
|
2657
|
-
)
|
|
2658
|
-
] }),
|
|
2659
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2660
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Website" }),
|
|
2661
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2662
|
-
Input,
|
|
2663
|
-
{
|
|
2664
|
-
type: "url",
|
|
2665
|
-
placeholder: "https://acme.com",
|
|
2666
|
-
value: formData.website || "",
|
|
2667
|
-
onChange: (e) => setActionFormData({ ...actionFormData, website: e.target.value }),
|
|
2668
|
-
className: "h-8 text-xs border-gray-200"
|
|
2669
|
-
}
|
|
2670
|
-
)
|
|
2671
|
-
] })
|
|
2672
|
-
] })
|
|
2673
|
-
] }),
|
|
2674
|
-
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: [
|
|
2675
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name" }),
|
|
2676
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2677
|
-
Input,
|
|
2678
|
-
{
|
|
2679
|
-
placeholder: "Production Key",
|
|
2680
|
-
value: formData.name || "",
|
|
2681
|
-
onChange: (e) => setActionFormData({ ...actionFormData, name: e.target.value }),
|
|
2682
|
-
className: "h-8 text-xs border-gray-200"
|
|
2683
|
-
}
|
|
2684
|
-
)
|
|
2685
|
-
] }) }),
|
|
2686
|
-
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: [
|
|
2687
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
2688
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2689
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
|
|
2690
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2691
|
-
Input,
|
|
2692
|
-
{
|
|
2693
|
-
placeholder: "Acme Corporation",
|
|
2694
|
-
value: formData.name || "",
|
|
2695
|
-
onChange: (e) => setActionFormData({ ...actionFormData, name: e.target.value }),
|
|
2696
|
-
className: "h-8 text-xs border-gray-200"
|
|
2697
|
-
}
|
|
2698
|
-
)
|
|
2699
|
-
] }),
|
|
2700
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2701
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
|
|
2702
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2703
|
-
Input,
|
|
2704
|
-
{
|
|
2705
|
-
type: "email",
|
|
2706
|
-
placeholder: "contact@acme.com",
|
|
2707
|
-
value: formData.email || "",
|
|
2708
|
-
onChange: (e) => setActionFormData({ ...actionFormData, email: e.target.value }),
|
|
2709
|
-
className: "h-8 text-xs border-gray-200"
|
|
2710
|
-
}
|
|
2711
|
-
)
|
|
2712
|
-
] })
|
|
2713
|
-
] }),
|
|
2714
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2715
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Location" }),
|
|
2716
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2717
|
-
Input,
|
|
2718
|
-
{
|
|
2719
|
-
placeholder: "San Francisco, CA",
|
|
2720
|
-
value: formData.location || "",
|
|
2721
|
-
onChange: (e) => setActionFormData({ ...actionFormData, location: e.target.value }),
|
|
2722
|
-
className: "h-8 text-xs border-gray-200"
|
|
2723
|
-
}
|
|
2724
|
-
)
|
|
2725
|
-
] }),
|
|
2726
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2727
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Subscription Tier" }),
|
|
2728
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2729
|
-
"select",
|
|
2730
|
-
{
|
|
2731
|
-
value: formData.subscription || "Starter",
|
|
2732
|
-
onChange: (e) => setActionFormData({ ...actionFormData, subscription: e.target.value }),
|
|
2733
|
-
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",
|
|
2715
|
+
type: "button",
|
|
2716
|
+
size: "sm",
|
|
2717
|
+
variant: "ghost",
|
|
2718
|
+
className: "w-full justify-start rounded-lg px-3 py-1.5 text-xs text-gray-700 hover:bg-gray-100 h-auto",
|
|
2719
|
+
onClick: () => sendTopic(question.prompt),
|
|
2734
2720
|
children: [
|
|
2735
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2736
|
-
|
|
2737
|
-
|
|
2721
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2722
|
+
"span",
|
|
2723
|
+
{
|
|
2724
|
+
className: `mr-2 inline-block h-1.5 w-1.5 rounded-full ${iconColors[index % iconColors.length]}`
|
|
2725
|
+
}
|
|
2726
|
+
),
|
|
2727
|
+
question.label
|
|
2738
2728
|
]
|
|
2739
|
-
}
|
|
2740
|
-
|
|
2741
|
-
|
|
2729
|
+
},
|
|
2730
|
+
question.id
|
|
2731
|
+
);
|
|
2732
|
+
}) })
|
|
2742
2733
|
] }),
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2746
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Current Password" }),
|
|
2747
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2748
|
-
Input,
|
|
2749
|
-
{
|
|
2750
|
-
type: "password",
|
|
2751
|
-
value: formData.currentPassword || "",
|
|
2752
|
-
onChange: (e) => setActionFormData({ ...actionFormData, currentPassword: e.target.value }),
|
|
2753
|
-
className: "h-8 text-xs border-gray-200"
|
|
2754
|
-
}
|
|
2755
|
-
)
|
|
2756
|
-
] }),
|
|
2757
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2758
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "New Password" }),
|
|
2734
|
+
panelView === "folder" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2735
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mb-3 flex items-center gap-2", children: [
|
|
2759
2736
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2760
|
-
|
|
2737
|
+
Button,
|
|
2761
2738
|
{
|
|
2762
|
-
type: "
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
className: "h-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2770
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Confirm New Password" }),
|
|
2771
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2772
|
-
Input,
|
|
2773
|
-
{
|
|
2774
|
-
type: "password",
|
|
2775
|
-
value: formData.confirmPassword || "",
|
|
2776
|
-
onChange: (e) => setActionFormData({ ...actionFormData, confirmPassword: e.target.value }),
|
|
2777
|
-
className: "h-8 text-xs border-gray-200"
|
|
2778
|
-
}
|
|
2779
|
-
)
|
|
2780
|
-
] })
|
|
2781
|
-
] }),
|
|
2782
|
-
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: [
|
|
2783
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2784
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Notification Type" }),
|
|
2785
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2786
|
-
"select",
|
|
2787
|
-
{
|
|
2788
|
-
value: formData.notificationType || "paymentReceived",
|
|
2789
|
-
onChange: (e) => setActionFormData({ ...actionFormData, notificationType: e.target.value }),
|
|
2790
|
-
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",
|
|
2791
|
-
children: [
|
|
2792
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "paymentReceived", children: "Payment Received" }),
|
|
2793
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "paymentFailed", children: "Payment Failed" }),
|
|
2794
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "invoicePaid", children: "Invoice Paid" }),
|
|
2795
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "monthlySummary", children: "Monthly Summary" }),
|
|
2796
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "productUpdates", children: "Product Updates" })
|
|
2797
|
-
]
|
|
2798
|
-
}
|
|
2799
|
-
)
|
|
2800
|
-
] }),
|
|
2801
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2802
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2803
|
-
"input",
|
|
2804
|
-
{
|
|
2805
|
-
type: "checkbox",
|
|
2806
|
-
checked: formData.enabled !== false,
|
|
2807
|
-
onChange: (e) => setActionFormData({ ...actionFormData, enabled: e.target.checked }),
|
|
2808
|
-
className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
|
|
2739
|
+
type: "button",
|
|
2740
|
+
size: "icon",
|
|
2741
|
+
variant: "ghost",
|
|
2742
|
+
className: "h-7 w-7 rounded-full hover:bg-gray-100",
|
|
2743
|
+
onClick: closeFolder,
|
|
2744
|
+
"aria-label": "Back to suggestions",
|
|
2745
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.ArrowLeft, { className: "h-4 w-4 text-gray-500" })
|
|
2809
2746
|
}
|
|
2810
2747
|
),
|
|
2811
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("
|
|
2812
|
-
] })
|
|
2813
|
-
] }),
|
|
2814
|
-
(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: [
|
|
2815
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Integration" }),
|
|
2816
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2817
|
-
"select",
|
|
2818
|
-
{
|
|
2819
|
-
value: formData.integrationName || "Slack",
|
|
2820
|
-
onChange: (e) => setActionFormData({ ...actionFormData, integrationName: e.target.value }),
|
|
2821
|
-
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",
|
|
2822
|
-
children: [
|
|
2823
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Slack", children: "Slack" }),
|
|
2824
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Zapier", children: "Zapier" }),
|
|
2825
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Webhook", children: "Webhook" })
|
|
2826
|
-
]
|
|
2827
|
-
}
|
|
2828
|
-
)
|
|
2829
|
-
] }) }),
|
|
2830
|
-
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: [
|
|
2831
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2832
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Card Number" }),
|
|
2833
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2834
|
-
Input,
|
|
2835
|
-
{
|
|
2836
|
-
placeholder: "1234 5678 9012 3456",
|
|
2837
|
-
value: formData.cardNumber || "",
|
|
2838
|
-
onChange: (e) => setActionFormData({ ...actionFormData, cardNumber: e.target.value }),
|
|
2839
|
-
className: "h-8 text-xs border-gray-200"
|
|
2840
|
-
}
|
|
2841
|
-
)
|
|
2842
|
-
] }),
|
|
2843
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2844
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Expiry Date" }),
|
|
2845
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2846
|
-
Input,
|
|
2847
|
-
{
|
|
2848
|
-
placeholder: "MM/YY",
|
|
2849
|
-
value: formData.expiryDate || "",
|
|
2850
|
-
onChange: (e) => setActionFormData({ ...actionFormData, expiryDate: e.target.value }),
|
|
2851
|
-
className: "h-8 text-xs border-gray-200"
|
|
2852
|
-
}
|
|
2853
|
-
)
|
|
2854
|
-
] })
|
|
2855
|
-
] }),
|
|
2856
|
-
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." }) }),
|
|
2857
|
-
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: [
|
|
2858
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2859
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Transaction ID or Customer Name" }),
|
|
2860
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2861
|
-
Input,
|
|
2862
|
-
{
|
|
2863
|
-
placeholder: "e.g., txn_1234 or Acme Corp",
|
|
2864
|
-
value: formData.transactionId || formData.customer || "",
|
|
2865
|
-
onChange: (e) => {
|
|
2866
|
-
const value = e.target.value;
|
|
2867
|
-
if (value.startsWith("txn_") || /^\d+$/.test(value)) {
|
|
2868
|
-
setActionFormData({ ...actionFormData, transactionId: value, customer: void 0 });
|
|
2869
|
-
} else {
|
|
2870
|
-
setActionFormData({ ...actionFormData, customer: value, transactionId: void 0 });
|
|
2871
|
-
}
|
|
2872
|
-
},
|
|
2873
|
-
className: "h-8 text-xs border-gray-200"
|
|
2874
|
-
}
|
|
2875
|
-
)
|
|
2876
|
-
] }),
|
|
2877
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2878
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Amount (optional)" }),
|
|
2879
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2880
|
-
Input,
|
|
2881
|
-
{
|
|
2882
|
-
placeholder: "$0.00",
|
|
2883
|
-
value: formData.amount || "",
|
|
2884
|
-
onChange: (e) => setActionFormData({ ...actionFormData, amount: e.target.value }),
|
|
2885
|
-
className: "h-8 text-xs border-gray-200"
|
|
2886
|
-
}
|
|
2887
|
-
)
|
|
2888
|
-
] }),
|
|
2889
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2890
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Reason (optional)" }),
|
|
2891
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2892
|
-
Input,
|
|
2893
|
-
{
|
|
2894
|
-
placeholder: "e.g., Customer request",
|
|
2895
|
-
value: formData.reason || "",
|
|
2896
|
-
onChange: (e) => setActionFormData({ ...actionFormData, reason: e.target.value }),
|
|
2897
|
-
className: "h-8 text-xs border-gray-200"
|
|
2898
|
-
}
|
|
2899
|
-
)
|
|
2900
|
-
] })
|
|
2901
|
-
] }),
|
|
2902
|
-
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: [
|
|
2903
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2904
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name or ID" }),
|
|
2905
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2906
|
-
Input,
|
|
2907
|
-
{
|
|
2908
|
-
placeholder: "Production Key",
|
|
2909
|
-
value: formData.keyId || formData.name || "",
|
|
2910
|
-
onChange: (e) => setActionFormData({ ...actionFormData, keyId: e.target.value, name: e.target.value }),
|
|
2911
|
-
className: "h-8 text-xs border-gray-200"
|
|
2912
|
-
}
|
|
2913
|
-
)
|
|
2914
|
-
] }),
|
|
2915
|
-
/* @__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." })
|
|
2916
|
-
] }),
|
|
2917
|
-
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: [
|
|
2918
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2919
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Webhook URL" }),
|
|
2920
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2921
|
-
Input,
|
|
2922
|
-
{
|
|
2923
|
-
type: "url",
|
|
2924
|
-
placeholder: "https://example.com/webhook",
|
|
2925
|
-
value: formData.url || "",
|
|
2926
|
-
onChange: (e) => setActionFormData({ ...actionFormData, url: e.target.value }),
|
|
2927
|
-
className: "h-8 text-xs border-gray-200"
|
|
2928
|
-
}
|
|
2929
|
-
)
|
|
2748
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs font-medium uppercase tracking-wide text-gray-400", children: "Topics" })
|
|
2930
2749
|
] }),
|
|
2931
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.
|
|
2932
|
-
|
|
2933
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2934
|
-
Input,
|
|
2935
|
-
{
|
|
2936
|
-
placeholder: "Production Webhook",
|
|
2937
|
-
value: formData.name || "",
|
|
2938
|
-
onChange: (e) => setActionFormData({ ...actionFormData, name: e.target.value }),
|
|
2939
|
-
className: "h-8 text-xs border-gray-200"
|
|
2940
|
-
}
|
|
2941
|
-
)
|
|
2942
|
-
] })
|
|
2943
|
-
] }),
|
|
2944
|
-
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: [
|
|
2945
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Currency" }),
|
|
2946
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2947
|
-
"select",
|
|
2750
|
+
/* @__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)(
|
|
2751
|
+
Button,
|
|
2948
2752
|
{
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2753
|
+
type: "button",
|
|
2754
|
+
size: "sm",
|
|
2755
|
+
variant: "secondary",
|
|
2756
|
+
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",
|
|
2757
|
+
onClick: () => sendTopic(topic.prompt),
|
|
2758
|
+
children: topic.label
|
|
2759
|
+
},
|
|
2760
|
+
topic.id
|
|
2761
|
+
)) })
|
|
2762
|
+
] })
|
|
2763
|
+
] })
|
|
2764
|
+
] }) : /* @__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: [
|
|
2765
|
+
messages.map((message, index) => {
|
|
2766
|
+
const isUser = message.role === "user";
|
|
2767
|
+
const previousRole = index > 0 ? messages[index - 1].role : void 0;
|
|
2768
|
+
const isRoleChange = previousRole !== void 0 && previousRole !== message.role;
|
|
2769
|
+
const currentGuide = activeGuideRef.current || activeGuide;
|
|
2770
|
+
let isCurrentGuideStep = false;
|
|
2771
|
+
if (currentGuide && message.kind === "guideStep") {
|
|
2772
|
+
if (message.guideStepIndex !== void 0) {
|
|
2773
|
+
isCurrentGuideStep = message.guideStepIndex === currentGuide.stepIndex;
|
|
2774
|
+
} else {
|
|
2775
|
+
isCurrentGuideStep = index === messages.length - 1;
|
|
2776
|
+
}
|
|
2777
|
+
} else if (message.kind === "guideComplete") {
|
|
2778
|
+
isCurrentGuideStep = index === messages.length - 1;
|
|
2779
|
+
}
|
|
2780
|
+
if (message.kind === "guideStep" && !isCurrentGuideStep) {
|
|
2781
|
+
return null;
|
|
2782
|
+
}
|
|
2783
|
+
if (isUser) {
|
|
2784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2785
|
+
"div",
|
|
2786
|
+
{
|
|
2787
|
+
className: `flex justify-end ${isRoleChange ? "mt-3" : ""}`,
|
|
2788
|
+
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 })
|
|
2789
|
+
},
|
|
2790
|
+
message.id
|
|
2791
|
+
);
|
|
2792
|
+
}
|
|
2793
|
+
if (message.kind === "searchSummary") {
|
|
2794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2795
|
+
"div",
|
|
2796
|
+
{
|
|
2797
|
+
className: `${isRoleChange ? "mt-3" : ""}`,
|
|
2798
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2799
|
+
AssistantSearchSummary,
|
|
2800
|
+
{
|
|
2801
|
+
title: message.title ?? "Search results",
|
|
2802
|
+
links: message.links ?? []
|
|
2803
|
+
}
|
|
2804
|
+
)
|
|
2805
|
+
},
|
|
2806
|
+
message.id
|
|
2807
|
+
);
|
|
2808
|
+
}
|
|
2809
|
+
if (message.kind === "guideComplete") {
|
|
2810
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2811
|
+
"div",
|
|
2965
2812
|
{
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
className: "
|
|
2813
|
+
ref: isCurrentGuideStep ? currentStepRef : null,
|
|
2814
|
+
className: `${isRoleChange ? "mt-3" : ""}`,
|
|
2815
|
+
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: [
|
|
2816
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CheckCircle2, { className: "h-5 w-5 text-green-600 flex-shrink-0" }),
|
|
2817
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-medium text-green-800", children: message.content })
|
|
2818
|
+
] })
|
|
2819
|
+
},
|
|
2820
|
+
message.id
|
|
2821
|
+
);
|
|
2822
|
+
}
|
|
2823
|
+
if (message.kind === "navigationAction") {
|
|
2824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2825
|
+
"div",
|
|
2826
|
+
{
|
|
2827
|
+
className: `${isRoleChange ? "mt-3" : ""}`,
|
|
2969
2828
|
children: [
|
|
2970
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("
|
|
2971
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("
|
|
2972
|
-
|
|
2973
|
-
|
|
2829
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-2 text-gray-700", children: message.content || "" }),
|
|
2830
|
+
message.navigationTarget && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2831
|
+
Button,
|
|
2832
|
+
{
|
|
2833
|
+
type: "button",
|
|
2834
|
+
size: "sm",
|
|
2835
|
+
variant: "secondary",
|
|
2836
|
+
className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
|
|
2837
|
+
onClick: () => message.navigationTarget && handleConfirmNavigation(
|
|
2838
|
+
message.navigationTarget
|
|
2839
|
+
),
|
|
2840
|
+
children: [
|
|
2841
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "Confirm" }),
|
|
2842
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
|
|
2843
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
|
|
2844
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
|
|
2845
|
+
] })
|
|
2846
|
+
]
|
|
2847
|
+
}
|
|
2848
|
+
) })
|
|
2974
2849
|
]
|
|
2850
|
+
},
|
|
2851
|
+
message.id
|
|
2852
|
+
);
|
|
2853
|
+
}
|
|
2854
|
+
if (message.kind === "actionForm") {
|
|
2855
|
+
const actionType = message.actionType;
|
|
2856
|
+
const formData = Object.keys(actionFormData).length > 0 ? actionFormData : message.actionData || {};
|
|
2857
|
+
if (message.isSubmitted) {
|
|
2858
|
+
let successContent = "";
|
|
2859
|
+
if (actionType === "updateCompanyInfo") {
|
|
2860
|
+
successContent = "Company information has been updated successfully.";
|
|
2861
|
+
} else if (actionType === "addApiKey") {
|
|
2862
|
+
successContent = "API key has been added successfully.";
|
|
2863
|
+
} else if (actionType === "addCustomer") {
|
|
2864
|
+
successContent = "Customer has been added successfully.";
|
|
2865
|
+
} else if (actionType === "enable2FA") {
|
|
2866
|
+
successContent = "Two-factor authentication has been enabled successfully.";
|
|
2867
|
+
} else if (actionType === "disable2FA") {
|
|
2868
|
+
successContent = "Two-factor authentication has been disabled successfully.";
|
|
2869
|
+
} else if (actionType === "changePassword") {
|
|
2870
|
+
successContent = "Your password has been changed successfully.";
|
|
2871
|
+
} else if (actionType === "revokeSession") {
|
|
2872
|
+
successContent = "Session has been revoked successfully.";
|
|
2873
|
+
} else if (actionType === "toggleNotification") {
|
|
2874
|
+
successContent = "Notification preferences have been updated successfully.";
|
|
2875
|
+
} else if (actionType === "connectIntegration") {
|
|
2876
|
+
successContent = "Integration has been connected successfully.";
|
|
2877
|
+
} else if (actionType === "disconnectIntegration") {
|
|
2878
|
+
successContent = "Integration has been disconnected successfully.";
|
|
2879
|
+
} else if (actionType === "addPaymentMethod") {
|
|
2880
|
+
successContent = "Payment method has been added successfully.";
|
|
2881
|
+
} else if (actionType === "removePaymentMethod") {
|
|
2882
|
+
successContent = "Payment method has been removed successfully.";
|
|
2883
|
+
} else if (actionType === "deleteApiKey") {
|
|
2884
|
+
successContent = "API key has been deleted successfully.";
|
|
2885
|
+
} else if (actionType === "addWebhook") {
|
|
2886
|
+
successContent = "Webhook endpoint has been added successfully.";
|
|
2887
|
+
} else if (actionType === "updateCurrency") {
|
|
2888
|
+
successContent = "Currency preference has been updated successfully.";
|
|
2889
|
+
} else if (actionType === "updateTimezone") {
|
|
2890
|
+
successContent = "Timezone has been updated successfully.";
|
|
2891
|
+
} else if (actionType === "refundPayment") {
|
|
2892
|
+
successContent = "Refund has been processed successfully.";
|
|
2893
|
+
} else if (actionType === "exportCertificate") {
|
|
2894
|
+
successContent = "Certificate of Incorporation has been downloaded successfully.";
|
|
2895
|
+
} else if (actionType === "createSubscription") {
|
|
2896
|
+
successContent = "Subscription has been created successfully.";
|
|
2897
|
+
} else if (actionType === "toggleBlockRule" || actionType === "enableBlockRule" || actionType === "disableBlockRule") {
|
|
2898
|
+
successContent = "Block rule has been updated successfully.";
|
|
2899
|
+
} else {
|
|
2900
|
+
successContent = "Action completed successfully.";
|
|
2975
2901
|
}
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
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: [
|
|
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: "Device/Session" }),
|
|
2981
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2982
|
-
Input,
|
|
2983
|
-
{
|
|
2984
|
-
placeholder: "MacBook Pro",
|
|
2985
|
-
value: formData.device || "",
|
|
2986
|
-
onChange: (e) => setActionFormData({ ...actionFormData, device: e.target.value }),
|
|
2987
|
-
className: "h-8 text-xs border-gray-200"
|
|
2988
|
-
}
|
|
2989
|
-
)
|
|
2990
|
-
] }),
|
|
2991
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-black", children: "This will sign out the device and invalidate its session." })
|
|
2992
|
-
] }),
|
|
2993
|
-
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: [
|
|
2994
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2995
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Customer Email" }),
|
|
2996
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2997
|
-
Input,
|
|
2998
|
-
{
|
|
2999
|
-
type: "email",
|
|
3000
|
-
placeholder: "customer@example.com",
|
|
3001
|
-
value: formData.customerEmail || "",
|
|
3002
|
-
onChange: (e) => setActionFormData({ ...actionFormData, customerEmail: e.target.value }),
|
|
3003
|
-
className: "h-8 text-xs border-gray-200"
|
|
3004
|
-
}
|
|
3005
|
-
)
|
|
3006
|
-
] }),
|
|
3007
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3008
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Plan" }),
|
|
3009
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3010
|
-
"select",
|
|
3011
|
-
{
|
|
3012
|
-
value: formData.plan || "Starter",
|
|
3013
|
-
onChange: (e) => setActionFormData({ ...actionFormData, plan: e.target.value }),
|
|
3014
|
-
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",
|
|
3015
|
-
children: [
|
|
3016
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Starter", children: "Starter ($29/mo)" }),
|
|
3017
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Professional", children: "Professional ($99/mo)" }),
|
|
3018
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Enterprise", children: "Enterprise ($299/mo)" })
|
|
3019
|
-
]
|
|
3020
|
-
}
|
|
3021
|
-
)
|
|
3022
|
-
] }),
|
|
3023
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3024
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Billing Cycle" }),
|
|
3025
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3026
|
-
"select",
|
|
3027
|
-
{
|
|
3028
|
-
value: formData.billingCycle || "monthly",
|
|
3029
|
-
onChange: (e) => setActionFormData({ ...actionFormData, billingCycle: e.target.value }),
|
|
3030
|
-
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",
|
|
3031
|
-
children: [
|
|
3032
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "monthly", children: "Monthly" }),
|
|
3033
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "yearly", children: "Yearly (Save 15%)" })
|
|
3034
|
-
]
|
|
3035
|
-
}
|
|
3036
|
-
)
|
|
3037
|
-
] })
|
|
3038
|
-
] }),
|
|
3039
|
-
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: [
|
|
3040
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-black", children: "This will export your certificate of incorporation document." }),
|
|
3041
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3042
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Format" }),
|
|
3043
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3044
|
-
"select",
|
|
2902
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2903
|
+
"div",
|
|
3045
2904
|
{
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "json", children: "JSON" })
|
|
3052
|
-
]
|
|
3053
|
-
}
|
|
3054
|
-
)
|
|
3055
|
-
] })
|
|
3056
|
-
] }),
|
|
3057
|
-
(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: [
|
|
3058
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3059
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Block Rule" }),
|
|
3060
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3061
|
-
"select",
|
|
3062
|
-
{
|
|
3063
|
-
value: formData.ruleId || "rule_1",
|
|
3064
|
-
onChange: (e) => setActionFormData({ ...actionFormData, ruleId: e.target.value }),
|
|
3065
|
-
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",
|
|
3066
|
-
children: [
|
|
3067
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "rule_1", children: "Block if risk level = 'highest'" }),
|
|
3068
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "rule_2", children: "Block if matches Stripe block lists" }),
|
|
3069
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "rule_3", children: "Block if CVC verification fails" }),
|
|
3070
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "rule_4", children: "Block if Postal code verification fails" })
|
|
3071
|
-
]
|
|
3072
|
-
}
|
|
3073
|
-
)
|
|
3074
|
-
] }),
|
|
3075
|
-
/* @__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." })
|
|
3076
|
-
] }),
|
|
3077
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3078
|
-
Button,
|
|
3079
|
-
{
|
|
3080
|
-
type: "button",
|
|
3081
|
-
size: "sm",
|
|
3082
|
-
variant: "secondary",
|
|
3083
|
-
className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
|
|
3084
|
-
onClick: handleActionSubmit,
|
|
3085
|
-
children: [
|
|
3086
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "Confirm" }),
|
|
3087
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
|
|
3088
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
|
|
3089
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
|
|
3090
|
-
] })
|
|
3091
|
-
]
|
|
2905
|
+
className: `${isRoleChange ? "mt-3" : ""}`,
|
|
2906
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 text-gray-700", children: successContent })
|
|
2907
|
+
},
|
|
2908
|
+
message.id
|
|
2909
|
+
);
|
|
3092
2910
|
}
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
2911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2912
|
+
"div",
|
|
2913
|
+
{
|
|
2914
|
+
className: `min-w-0 ${isRoleChange ? "mt-3" : ""}`,
|
|
2915
|
+
children: [
|
|
2916
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
|
|
2917
|
+
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: [
|
|
2918
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
2919
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2920
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
|
|
2921
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2922
|
+
Input,
|
|
2923
|
+
{
|
|
2924
|
+
placeholder: "Acme Corporation",
|
|
2925
|
+
value: formData.companyName || "",
|
|
2926
|
+
onChange: (e) => setActionFormData({
|
|
2927
|
+
...actionFormData,
|
|
2928
|
+
companyName: e.target.value
|
|
2929
|
+
}),
|
|
2930
|
+
className: "h-8 text-xs border-gray-200"
|
|
2931
|
+
}
|
|
2932
|
+
)
|
|
2933
|
+
] }),
|
|
2934
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2935
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
|
|
2936
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2937
|
+
Input,
|
|
2938
|
+
{
|
|
2939
|
+
type: "email",
|
|
2940
|
+
placeholder: "contact@acme.com",
|
|
2941
|
+
value: formData.email || "",
|
|
2942
|
+
onChange: (e) => setActionFormData({
|
|
2943
|
+
...actionFormData,
|
|
2944
|
+
email: e.target.value
|
|
2945
|
+
}),
|
|
2946
|
+
className: "h-8 text-xs border-gray-200"
|
|
2947
|
+
}
|
|
2948
|
+
)
|
|
2949
|
+
] })
|
|
2950
|
+
] }),
|
|
2951
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2952
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Address" }),
|
|
2953
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2954
|
+
Input,
|
|
2955
|
+
{
|
|
2956
|
+
placeholder: "123 Main St, San Francisco, CA",
|
|
2957
|
+
value: formData.address || "",
|
|
2958
|
+
onChange: (e) => setActionFormData({
|
|
2959
|
+
...actionFormData,
|
|
2960
|
+
address: e.target.value
|
|
2961
|
+
}),
|
|
2962
|
+
className: "h-8 text-xs border-gray-200"
|
|
2963
|
+
}
|
|
2964
|
+
)
|
|
2965
|
+
] }),
|
|
2966
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
2967
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2968
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Phone" }),
|
|
2969
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2970
|
+
Input,
|
|
2971
|
+
{
|
|
2972
|
+
type: "tel",
|
|
2973
|
+
placeholder: "+1 (555) 123-4567",
|
|
2974
|
+
value: formData.phone || "",
|
|
2975
|
+
onChange: (e) => setActionFormData({
|
|
2976
|
+
...actionFormData,
|
|
2977
|
+
phone: e.target.value
|
|
2978
|
+
}),
|
|
2979
|
+
className: "h-8 text-xs border-gray-200"
|
|
2980
|
+
}
|
|
2981
|
+
)
|
|
2982
|
+
] }),
|
|
2983
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2984
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Website" }),
|
|
2985
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2986
|
+
Input,
|
|
2987
|
+
{
|
|
2988
|
+
type: "url",
|
|
2989
|
+
placeholder: "https://acme.com",
|
|
2990
|
+
value: formData.website || "",
|
|
2991
|
+
onChange: (e) => setActionFormData({
|
|
2992
|
+
...actionFormData,
|
|
2993
|
+
website: e.target.value
|
|
2994
|
+
}),
|
|
2995
|
+
className: "h-8 text-xs border-gray-200"
|
|
2996
|
+
}
|
|
2997
|
+
)
|
|
2998
|
+
] })
|
|
2999
|
+
] })
|
|
3121
3000
|
] }),
|
|
3122
|
-
" ",
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3001
|
+
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: [
|
|
3002
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name" }),
|
|
3003
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3004
|
+
Input,
|
|
3005
|
+
{
|
|
3006
|
+
placeholder: "Production Key",
|
|
3007
|
+
value: formData.name || "",
|
|
3008
|
+
onChange: (e) => setActionFormData({
|
|
3009
|
+
...actionFormData,
|
|
3010
|
+
name: e.target.value
|
|
3011
|
+
}),
|
|
3012
|
+
className: "h-8 text-xs border-gray-200"
|
|
3013
|
+
}
|
|
3014
|
+
)
|
|
3015
|
+
] }) }),
|
|
3016
|
+
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: [
|
|
3017
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
3018
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3019
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
|
|
3020
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3021
|
+
Input,
|
|
3022
|
+
{
|
|
3023
|
+
placeholder: "Acme Corporation",
|
|
3024
|
+
value: formData.name || "",
|
|
3025
|
+
onChange: (e) => setActionFormData({
|
|
3026
|
+
...actionFormData,
|
|
3027
|
+
name: e.target.value
|
|
3028
|
+
}),
|
|
3029
|
+
className: "h-8 text-xs border-gray-200"
|
|
3030
|
+
}
|
|
3031
|
+
)
|
|
3032
|
+
] }),
|
|
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: "Email" }),
|
|
3035
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3036
|
+
Input,
|
|
3037
|
+
{
|
|
3038
|
+
type: "email",
|
|
3039
|
+
placeholder: "contact@acme.com",
|
|
3040
|
+
value: formData.email || "",
|
|
3041
|
+
onChange: (e) => setActionFormData({
|
|
3042
|
+
...actionFormData,
|
|
3043
|
+
email: e.target.value
|
|
3044
|
+
}),
|
|
3045
|
+
className: "h-8 text-xs border-gray-200"
|
|
3046
|
+
}
|
|
3047
|
+
)
|
|
3048
|
+
] })
|
|
3049
|
+
] }),
|
|
3050
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3051
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Location" }),
|
|
3052
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3053
|
+
Input,
|
|
3054
|
+
{
|
|
3055
|
+
placeholder: "San Francisco, CA",
|
|
3056
|
+
value: formData.location || "",
|
|
3057
|
+
onChange: (e) => setActionFormData({
|
|
3058
|
+
...actionFormData,
|
|
3059
|
+
location: e.target.value
|
|
3060
|
+
}),
|
|
3061
|
+
className: "h-8 text-xs border-gray-200"
|
|
3062
|
+
}
|
|
3063
|
+
)
|
|
3064
|
+
] }),
|
|
3065
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3066
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Subscription Tier" }),
|
|
3067
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3068
|
+
"select",
|
|
3069
|
+
{
|
|
3070
|
+
value: formData.subscription || "Starter",
|
|
3071
|
+
onChange: (e) => setActionFormData({
|
|
3072
|
+
...actionFormData,
|
|
3073
|
+
subscription: e.target.value
|
|
3074
|
+
}),
|
|
3075
|
+
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",
|
|
3076
|
+
children: [
|
|
3077
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Starter", children: "Starter" }),
|
|
3078
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Professional", children: "Professional" }),
|
|
3079
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Enterprise", children: "Enterprise" })
|
|
3080
|
+
]
|
|
3081
|
+
}
|
|
3082
|
+
)
|
|
3083
|
+
] })
|
|
3084
|
+
] }),
|
|
3085
|
+
(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." }) }),
|
|
3086
|
+
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: [
|
|
3087
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3088
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Current Password" }),
|
|
3089
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3090
|
+
Input,
|
|
3091
|
+
{
|
|
3092
|
+
type: "password",
|
|
3093
|
+
value: formData.currentPassword || "",
|
|
3094
|
+
onChange: (e) => setActionFormData({
|
|
3095
|
+
...actionFormData,
|
|
3096
|
+
currentPassword: e.target.value
|
|
3097
|
+
}),
|
|
3098
|
+
className: "h-8 text-xs border-gray-200"
|
|
3099
|
+
}
|
|
3100
|
+
)
|
|
3101
|
+
] }),
|
|
3102
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3103
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "New Password" }),
|
|
3104
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3105
|
+
Input,
|
|
3106
|
+
{
|
|
3107
|
+
type: "password",
|
|
3108
|
+
value: formData.newPassword || "",
|
|
3109
|
+
onChange: (e) => setActionFormData({
|
|
3110
|
+
...actionFormData,
|
|
3111
|
+
newPassword: e.target.value
|
|
3112
|
+
}),
|
|
3113
|
+
className: "h-8 text-xs border-gray-200"
|
|
3114
|
+
}
|
|
3115
|
+
)
|
|
3116
|
+
] }),
|
|
3117
|
+
/* @__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: "Confirm New Password" }),
|
|
3119
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3120
|
+
Input,
|
|
3121
|
+
{
|
|
3122
|
+
type: "password",
|
|
3123
|
+
value: formData.confirmPassword || "",
|
|
3124
|
+
onChange: (e) => setActionFormData({
|
|
3125
|
+
...actionFormData,
|
|
3126
|
+
confirmPassword: e.target.value
|
|
3127
|
+
}),
|
|
3128
|
+
className: "h-8 text-xs border-gray-200"
|
|
3129
|
+
}
|
|
3130
|
+
)
|
|
3131
|
+
] })
|
|
3132
|
+
] }),
|
|
3133
|
+
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: [
|
|
3134
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3135
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Notification Type" }),
|
|
3136
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3137
|
+
"select",
|
|
3138
|
+
{
|
|
3139
|
+
value: formData.notificationType || "paymentReceived",
|
|
3140
|
+
onChange: (e) => setActionFormData({
|
|
3141
|
+
...actionFormData,
|
|
3142
|
+
notificationType: e.target.value
|
|
3143
|
+
}),
|
|
3144
|
+
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",
|
|
3145
|
+
children: [
|
|
3146
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "paymentReceived", children: "Payment Received" }),
|
|
3147
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "paymentFailed", children: "Payment Failed" }),
|
|
3148
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "invoicePaid", children: "Invoice Paid" }),
|
|
3149
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "monthlySummary", children: "Monthly Summary" }),
|
|
3150
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "productUpdates", children: "Product Updates" })
|
|
3151
|
+
]
|
|
3152
|
+
}
|
|
3153
|
+
)
|
|
3154
|
+
] }),
|
|
3155
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3156
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3157
|
+
"input",
|
|
3158
|
+
{
|
|
3159
|
+
type: "checkbox",
|
|
3160
|
+
checked: formData.enabled !== false,
|
|
3161
|
+
onChange: (e) => setActionFormData({
|
|
3162
|
+
...actionFormData,
|
|
3163
|
+
enabled: e.target.checked
|
|
3164
|
+
}),
|
|
3165
|
+
className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
|
|
3166
|
+
}
|
|
3167
|
+
),
|
|
3168
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs text-black", children: "Enable this notification" })
|
|
3169
|
+
] })
|
|
3170
|
+
] }),
|
|
3171
|
+
(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: [
|
|
3172
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Integration" }),
|
|
3173
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3174
|
+
"select",
|
|
3175
|
+
{
|
|
3176
|
+
value: formData.integrationName || "Slack",
|
|
3177
|
+
onChange: (e) => setActionFormData({
|
|
3178
|
+
...actionFormData,
|
|
3179
|
+
integrationName: e.target.value
|
|
3180
|
+
}),
|
|
3181
|
+
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",
|
|
3182
|
+
children: [
|
|
3183
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Slack", children: "Slack" }),
|
|
3184
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Zapier", children: "Zapier" }),
|
|
3185
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Webhook", children: "Webhook" })
|
|
3186
|
+
]
|
|
3187
|
+
}
|
|
3188
|
+
)
|
|
3189
|
+
] }) }),
|
|
3190
|
+
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: [
|
|
3191
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3192
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Card Number" }),
|
|
3193
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3194
|
+
Input,
|
|
3195
|
+
{
|
|
3196
|
+
placeholder: "1234 5678 9012 3456",
|
|
3197
|
+
value: formData.cardNumber || "",
|
|
3198
|
+
onChange: (e) => setActionFormData({
|
|
3199
|
+
...actionFormData,
|
|
3200
|
+
cardNumber: e.target.value
|
|
3201
|
+
}),
|
|
3202
|
+
className: "h-8 text-xs border-gray-200"
|
|
3203
|
+
}
|
|
3204
|
+
)
|
|
3205
|
+
] }),
|
|
3206
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3207
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Expiry Date" }),
|
|
3208
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3209
|
+
Input,
|
|
3210
|
+
{
|
|
3211
|
+
placeholder: "MM/YY",
|
|
3212
|
+
value: formData.expiryDate || "",
|
|
3213
|
+
onChange: (e) => setActionFormData({
|
|
3214
|
+
...actionFormData,
|
|
3215
|
+
expiryDate: e.target.value
|
|
3216
|
+
}),
|
|
3217
|
+
className: "h-8 text-xs border-gray-200"
|
|
3218
|
+
}
|
|
3219
|
+
)
|
|
3220
|
+
] })
|
|
3221
|
+
] }),
|
|
3222
|
+
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." }) }),
|
|
3223
|
+
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: [
|
|
3224
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3225
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Transaction ID or Customer Name" }),
|
|
3226
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3227
|
+
Input,
|
|
3228
|
+
{
|
|
3229
|
+
placeholder: "e.g., txn_1234 or Acme Corp",
|
|
3230
|
+
value: formData.transactionId || formData.customer || "",
|
|
3231
|
+
onChange: (e) => {
|
|
3232
|
+
const value = e.target.value;
|
|
3233
|
+
if (value.startsWith("txn_") || /^\d+$/.test(value)) {
|
|
3234
|
+
setActionFormData({
|
|
3235
|
+
...actionFormData,
|
|
3236
|
+
transactionId: value,
|
|
3237
|
+
customer: void 0
|
|
3238
|
+
});
|
|
3239
|
+
} else {
|
|
3240
|
+
setActionFormData({
|
|
3241
|
+
...actionFormData,
|
|
3242
|
+
customer: value,
|
|
3243
|
+
transactionId: void 0
|
|
3244
|
+
});
|
|
3245
|
+
}
|
|
3246
|
+
},
|
|
3247
|
+
className: "h-8 text-xs border-gray-200"
|
|
3248
|
+
}
|
|
3249
|
+
)
|
|
3250
|
+
] }),
|
|
3251
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3252
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Amount (optional)" }),
|
|
3253
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3254
|
+
Input,
|
|
3255
|
+
{
|
|
3256
|
+
placeholder: "$0.00",
|
|
3257
|
+
value: formData.amount || "",
|
|
3258
|
+
onChange: (e) => setActionFormData({
|
|
3259
|
+
...actionFormData,
|
|
3260
|
+
amount: e.target.value
|
|
3261
|
+
}),
|
|
3262
|
+
className: "h-8 text-xs border-gray-200"
|
|
3263
|
+
}
|
|
3264
|
+
)
|
|
3265
|
+
] }),
|
|
3266
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3267
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Reason (optional)" }),
|
|
3268
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3269
|
+
Input,
|
|
3270
|
+
{
|
|
3271
|
+
placeholder: "e.g., Customer request",
|
|
3272
|
+
value: formData.reason || "",
|
|
3273
|
+
onChange: (e) => setActionFormData({
|
|
3274
|
+
...actionFormData,
|
|
3275
|
+
reason: e.target.value
|
|
3276
|
+
}),
|
|
3277
|
+
className: "h-8 text-xs border-gray-200"
|
|
3278
|
+
}
|
|
3279
|
+
)
|
|
3280
|
+
] })
|
|
3281
|
+
] }),
|
|
3282
|
+
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: [
|
|
3283
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3284
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name or ID" }),
|
|
3285
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3286
|
+
Input,
|
|
3287
|
+
{
|
|
3288
|
+
placeholder: "Production Key",
|
|
3289
|
+
value: formData.keyId || formData.name || "",
|
|
3290
|
+
onChange: (e) => setActionFormData({
|
|
3291
|
+
...actionFormData,
|
|
3292
|
+
keyId: e.target.value,
|
|
3293
|
+
name: e.target.value
|
|
3294
|
+
}),
|
|
3295
|
+
className: "h-8 text-xs border-gray-200"
|
|
3296
|
+
}
|
|
3297
|
+
)
|
|
3298
|
+
] }),
|
|
3299
|
+
/* @__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." })
|
|
3300
|
+
] }),
|
|
3301
|
+
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: [
|
|
3302
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3303
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Webhook URL" }),
|
|
3304
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3305
|
+
Input,
|
|
3306
|
+
{
|
|
3307
|
+
type: "url",
|
|
3308
|
+
placeholder: "https://example.com/webhook",
|
|
3309
|
+
value: formData.url || "",
|
|
3310
|
+
onChange: (e) => setActionFormData({
|
|
3311
|
+
...actionFormData,
|
|
3312
|
+
url: e.target.value
|
|
3313
|
+
}),
|
|
3314
|
+
className: "h-8 text-xs border-gray-200"
|
|
3315
|
+
}
|
|
3316
|
+
)
|
|
3317
|
+
] }),
|
|
3318
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3319
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Name (optional)" }),
|
|
3320
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3321
|
+
Input,
|
|
3322
|
+
{
|
|
3323
|
+
placeholder: "Production Webhook",
|
|
3324
|
+
value: formData.name || "",
|
|
3325
|
+
onChange: (e) => setActionFormData({
|
|
3326
|
+
...actionFormData,
|
|
3327
|
+
name: e.target.value
|
|
3328
|
+
}),
|
|
3329
|
+
className: "h-8 text-xs border-gray-200"
|
|
3330
|
+
}
|
|
3331
|
+
)
|
|
3332
|
+
] })
|
|
3333
|
+
] }),
|
|
3334
|
+
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: [
|
|
3335
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Currency" }),
|
|
3336
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3337
|
+
"select",
|
|
3338
|
+
{
|
|
3339
|
+
value: formData.currency || "USD",
|
|
3340
|
+
onChange: (e) => setActionFormData({
|
|
3341
|
+
...actionFormData,
|
|
3342
|
+
currency: e.target.value
|
|
3343
|
+
}),
|
|
3344
|
+
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",
|
|
3345
|
+
children: [
|
|
3346
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "USD", children: "USD ($)" }),
|
|
3347
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "EUR", children: "EUR (\u20AC)" }),
|
|
3348
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "GBP", children: "GBP (\xA3)" }),
|
|
3349
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "JPY", children: "JPY (\xA5)" })
|
|
3350
|
+
]
|
|
3351
|
+
}
|
|
3352
|
+
)
|
|
3353
|
+
] }) }),
|
|
3354
|
+
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: [
|
|
3355
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Timezone" }),
|
|
3356
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3357
|
+
"select",
|
|
3358
|
+
{
|
|
3359
|
+
value: formData.timezone || "America/Los_Angeles",
|
|
3360
|
+
onChange: (e) => setActionFormData({
|
|
3361
|
+
...actionFormData,
|
|
3362
|
+
timezone: e.target.value
|
|
3363
|
+
}),
|
|
3364
|
+
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",
|
|
3365
|
+
children: [
|
|
3366
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "America/Los_Angeles", children: "Pacific Time (PT)" }),
|
|
3367
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "America/New_York", children: "Eastern Time (ET)" }),
|
|
3368
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Europe/London", children: "GMT" }),
|
|
3369
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Asia/Tokyo", children: "JST" })
|
|
3370
|
+
]
|
|
3371
|
+
}
|
|
3372
|
+
)
|
|
3373
|
+
] }) }),
|
|
3374
|
+
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: [
|
|
3375
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3376
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Device/Session" }),
|
|
3377
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3378
|
+
Input,
|
|
3379
|
+
{
|
|
3380
|
+
placeholder: "MacBook Pro",
|
|
3381
|
+
value: formData.device || "",
|
|
3382
|
+
onChange: (e) => setActionFormData({
|
|
3383
|
+
...actionFormData,
|
|
3384
|
+
device: e.target.value
|
|
3385
|
+
}),
|
|
3386
|
+
className: "h-8 text-xs border-gray-200"
|
|
3387
|
+
}
|
|
3388
|
+
)
|
|
3389
|
+
] }),
|
|
3390
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-black", children: "This will sign out the device and invalidate its session." })
|
|
3391
|
+
] }),
|
|
3392
|
+
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: [
|
|
3393
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3394
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Customer Email" }),
|
|
3395
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3396
|
+
Input,
|
|
3397
|
+
{
|
|
3398
|
+
type: "email",
|
|
3399
|
+
placeholder: "customer@example.com",
|
|
3400
|
+
value: formData.customerEmail || "",
|
|
3401
|
+
onChange: (e) => setActionFormData({
|
|
3402
|
+
...actionFormData,
|
|
3403
|
+
customerEmail: e.target.value
|
|
3404
|
+
}),
|
|
3405
|
+
className: "h-8 text-xs border-gray-200"
|
|
3406
|
+
}
|
|
3407
|
+
)
|
|
3408
|
+
] }),
|
|
3409
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3410
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Plan" }),
|
|
3411
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3412
|
+
"select",
|
|
3413
|
+
{
|
|
3414
|
+
value: formData.plan || "Starter",
|
|
3415
|
+
onChange: (e) => setActionFormData({
|
|
3416
|
+
...actionFormData,
|
|
3417
|
+
plan: e.target.value
|
|
3418
|
+
}),
|
|
3419
|
+
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",
|
|
3420
|
+
children: [
|
|
3421
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Starter", children: "Starter ($29/mo)" }),
|
|
3422
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Professional", children: "Professional ($99/mo)" }),
|
|
3423
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Enterprise", children: "Enterprise ($299/mo)" })
|
|
3424
|
+
]
|
|
3425
|
+
}
|
|
3426
|
+
)
|
|
3427
|
+
] }),
|
|
3428
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3429
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Billing Cycle" }),
|
|
3430
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3431
|
+
"select",
|
|
3432
|
+
{
|
|
3433
|
+
value: formData.billingCycle || "monthly",
|
|
3434
|
+
onChange: (e) => setActionFormData({
|
|
3435
|
+
...actionFormData,
|
|
3436
|
+
billingCycle: e.target.value
|
|
3437
|
+
}),
|
|
3438
|
+
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",
|
|
3439
|
+
children: [
|
|
3440
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "monthly", children: "Monthly" }),
|
|
3441
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "yearly", children: "Yearly (Save 15%)" })
|
|
3442
|
+
]
|
|
3443
|
+
}
|
|
3444
|
+
)
|
|
3445
|
+
] })
|
|
3446
|
+
] }),
|
|
3447
|
+
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: [
|
|
3448
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-black", children: "This will export your certificate of incorporation document." }),
|
|
3449
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3450
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Format" }),
|
|
3451
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3452
|
+
"select",
|
|
3453
|
+
{
|
|
3454
|
+
value: formData.format || "pdf",
|
|
3455
|
+
onChange: (e) => setActionFormData({
|
|
3456
|
+
...actionFormData,
|
|
3457
|
+
format: e.target.value
|
|
3458
|
+
}),
|
|
3459
|
+
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",
|
|
3460
|
+
children: [
|
|
3461
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "pdf", children: "PDF" }),
|
|
3462
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "json", children: "JSON" })
|
|
3463
|
+
]
|
|
3464
|
+
}
|
|
3465
|
+
)
|
|
3466
|
+
] })
|
|
3467
|
+
] }),
|
|
3468
|
+
(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: [
|
|
3469
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
3470
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Block Rule" }),
|
|
3471
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3472
|
+
"select",
|
|
3473
|
+
{
|
|
3474
|
+
value: formData.ruleId || "rule_1",
|
|
3475
|
+
onChange: (e) => setActionFormData({
|
|
3476
|
+
...actionFormData,
|
|
3477
|
+
ruleId: e.target.value
|
|
3478
|
+
}),
|
|
3479
|
+
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",
|
|
3480
|
+
children: [
|
|
3481
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "rule_1", children: "Block if risk level = 'highest'" }),
|
|
3482
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "rule_2", children: "Block if matches Stripe block lists" }),
|
|
3483
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "rule_3", children: "Block if CVC verification fails" }),
|
|
3484
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "rule_4", children: "Block if Postal code verification fails" })
|
|
3485
|
+
]
|
|
3486
|
+
}
|
|
3487
|
+
)
|
|
3488
|
+
] }),
|
|
3489
|
+
/* @__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." })
|
|
3490
|
+
] }),
|
|
3491
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3492
|
+
Button,
|
|
3493
|
+
{
|
|
3494
|
+
type: "button",
|
|
3495
|
+
size: "sm",
|
|
3496
|
+
variant: "secondary",
|
|
3497
|
+
className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
|
|
3498
|
+
onClick: handleActionSubmit,
|
|
3499
|
+
children: [
|
|
3500
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "Confirm" }),
|
|
3501
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
|
|
3502
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
|
|
3503
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
|
|
3504
|
+
] })
|
|
3505
|
+
]
|
|
3506
|
+
}
|
|
3507
|
+
) })
|
|
3508
|
+
]
|
|
3509
|
+
},
|
|
3510
|
+
message.id
|
|
3511
|
+
);
|
|
3512
|
+
}
|
|
3513
|
+
if (message.kind === "bulkPreview" && message.csvData) {
|
|
3514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3515
|
+
"div",
|
|
3136
3516
|
{
|
|
3137
|
-
|
|
3138
|
-
size: "sm",
|
|
3139
|
-
variant: "secondary",
|
|
3140
|
-
className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
|
|
3141
|
-
onClick: () => message.bulkSessionId && confirmBulkOperation(message.bulkSessionId),
|
|
3517
|
+
className: `${isRoleChange ? "mt-3" : ""}`,
|
|
3142
3518
|
children: [
|
|
3143
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3519
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
|
|
3520
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "bg-gray-50 rounded-lg border border-gray-200 overflow-hidden", children: [
|
|
3521
|
+
/* @__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: [
|
|
3522
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.FileSpreadsheet, { className: "h-4 w-4 text-gray-600" }),
|
|
3523
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs font-medium text-gray-700", children: message.csvData.fileName }),
|
|
3524
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-xs text-gray-500", children: [
|
|
3525
|
+
"\u2022 ",
|
|
3526
|
+
message.csvData.rowCount,
|
|
3527
|
+
" rows"
|
|
3528
|
+
] })
|
|
3529
|
+
] }),
|
|
3530
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "px-3 py-2 border-b border-gray-100", children: [
|
|
3531
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-gray-500 mb-1", children: "Columns" }),
|
|
3532
|
+
/* @__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)(
|
|
3533
|
+
"span",
|
|
3534
|
+
{
|
|
3535
|
+
className: "text-xs bg-blue-100 text-blue-700 px-1.5 py-0.5 rounded",
|
|
3536
|
+
children: col
|
|
3537
|
+
},
|
|
3538
|
+
i
|
|
3539
|
+
)) })
|
|
3540
|
+
] }),
|
|
3541
|
+
message.csvData.sampleRows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "px-3 py-2", children: [
|
|
3542
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-gray-500 mb-1", children: "Sample Data" }),
|
|
3543
|
+
/* @__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)(
|
|
3544
|
+
"div",
|
|
3545
|
+
{
|
|
3546
|
+
className: "text-xs text-gray-600 bg-white rounded px-2 py-1 border border-gray-100",
|
|
3547
|
+
children: [
|
|
3548
|
+
Object.entries(row).slice(0, 3).map(([key, val], j) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
|
|
3549
|
+
j > 0 && " \u2022 ",
|
|
3550
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-gray-400", children: [
|
|
3551
|
+
key,
|
|
3552
|
+
":"
|
|
3553
|
+
] }),
|
|
3554
|
+
" ",
|
|
3555
|
+
val
|
|
3556
|
+
] }, key)),
|
|
3557
|
+
Object.keys(row).length > 3 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-gray-400", children: [
|
|
3558
|
+
" ",
|
|
3559
|
+
"..."
|
|
3560
|
+
] })
|
|
3561
|
+
]
|
|
3562
|
+
},
|
|
3563
|
+
i
|
|
3564
|
+
)) })
|
|
3565
|
+
] }),
|
|
3566
|
+
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: [
|
|
3567
|
+
"Suggested action:",
|
|
3568
|
+
" ",
|
|
3569
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { children: message.suggestedAction.replace(/_/g, " ") })
|
|
3570
|
+
] }) })
|
|
3147
3571
|
] }),
|
|
3148
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("
|
|
3149
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.
|
|
3150
|
-
|
|
3572
|
+
message.bulkSessionId && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
|
|
3573
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3574
|
+
Button,
|
|
3575
|
+
{
|
|
3576
|
+
type: "button",
|
|
3577
|
+
size: "sm",
|
|
3578
|
+
variant: "secondary",
|
|
3579
|
+
className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
|
|
3580
|
+
onClick: () => message.bulkSessionId && confirmBulkOperation(message.bulkSessionId),
|
|
3581
|
+
children: [
|
|
3582
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
|
|
3583
|
+
"Process ",
|
|
3584
|
+
message.csvData.rowCount,
|
|
3585
|
+
" rows"
|
|
3586
|
+
] }),
|
|
3587
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
|
|
3588
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
|
|
3589
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
|
|
3590
|
+
] })
|
|
3591
|
+
]
|
|
3592
|
+
}
|
|
3593
|
+
),
|
|
3594
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3595
|
+
Button,
|
|
3596
|
+
{
|
|
3597
|
+
type: "button",
|
|
3598
|
+
size: "sm",
|
|
3599
|
+
variant: "ghost",
|
|
3600
|
+
className: "h-8 rounded-xl px-3 text-xs text-gray-500 hover:text-gray-700 hover:bg-gray-100",
|
|
3601
|
+
onClick: cancelBulkOperation,
|
|
3602
|
+
children: "Cancel"
|
|
3603
|
+
}
|
|
3604
|
+
)
|
|
3151
3605
|
] })
|
|
3152
3606
|
]
|
|
3153
|
-
}
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3607
|
+
},
|
|
3608
|
+
message.id
|
|
3609
|
+
);
|
|
3610
|
+
}
|
|
3611
|
+
if (message.kind === "bulkProgress" && message.bulkProgress) {
|
|
3612
|
+
const { processed, total, successes, failures } = message.bulkProgress;
|
|
3613
|
+
const percentage = Math.round(processed / total * 100);
|
|
3614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3615
|
+
"div",
|
|
3157
3616
|
{
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3617
|
+
className: `${isRoleChange ? "mt-3" : ""}`,
|
|
3618
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "bg-gray-50 rounded-lg border border-gray-200 p-3", children: [
|
|
3619
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
3620
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Loader2, { className: "h-4 w-4 animate-spin text-blue-600" }),
|
|
3621
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-sm font-medium text-gray-700", children: [
|
|
3622
|
+
"Processing... ",
|
|
3623
|
+
processed,
|
|
3624
|
+
" of ",
|
|
3625
|
+
total
|
|
3626
|
+
] })
|
|
3627
|
+
] }),
|
|
3628
|
+
/* @__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)(
|
|
3629
|
+
"div",
|
|
3630
|
+
{
|
|
3631
|
+
className: "h-full bg-blue-600 transition-all duration-300",
|
|
3632
|
+
style: { width: `${percentage}%` }
|
|
3633
|
+
}
|
|
3634
|
+
) }),
|
|
3635
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-3 text-xs text-gray-600", children: [
|
|
3636
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-1", children: [
|
|
3637
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CheckCircle2, { className: "h-3 w-3 text-green-600" }),
|
|
3638
|
+
successes,
|
|
3639
|
+
" successful"
|
|
3640
|
+
] }),
|
|
3641
|
+
failures > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-1 text-red-600", children: [
|
|
3642
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.X, { className: "h-3 w-3" }),
|
|
3643
|
+
failures,
|
|
3644
|
+
" failed"
|
|
3645
|
+
] })
|
|
3646
|
+
] })
|
|
3647
|
+
] })
|
|
3648
|
+
},
|
|
3649
|
+
message.id
|
|
3650
|
+
);
|
|
3651
|
+
}
|
|
3652
|
+
if (message.kind === "bulkSummary" && message.bulkSummary) {
|
|
3653
|
+
const { total, successes, failures, navigationPage } = message.bulkSummary;
|
|
3654
|
+
const hasFailures = failures.length > 0;
|
|
3655
|
+
const pageLabel = navigationPage?.page === "customers" ? "Customers" : navigationPage?.page === "dashboard" ? "Dashboard" : navigationPage?.page === "settings" ? "Settings" : "Results";
|
|
3656
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3657
|
+
"div",
|
|
3658
|
+
{
|
|
3659
|
+
className: `${isRoleChange ? "mt-3" : ""}`,
|
|
3660
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3661
|
+
"div",
|
|
3662
|
+
{
|
|
3663
|
+
className: `rounded-lg border p-3 ${hasFailures ? "bg-amber-50 border-amber-200" : "bg-green-50 border-green-200"}`,
|
|
3664
|
+
children: [
|
|
3665
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
3666
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3667
|
+
import_lucide_react4.CheckCircle2,
|
|
3668
|
+
{
|
|
3669
|
+
className: `h-5 w-5 ${hasFailures ? "text-amber-600" : "text-green-600"}`
|
|
3670
|
+
}
|
|
3671
|
+
),
|
|
3672
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-medium text-gray-800", children: "Bulk operation complete" })
|
|
3673
|
+
] }),
|
|
3674
|
+
/* @__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` : ""}.` }),
|
|
3675
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-4 text-xs", children: [
|
|
3676
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-1 text-green-700", children: [
|
|
3677
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CheckCircle2, { className: "h-3 w-3" }),
|
|
3678
|
+
successes,
|
|
3679
|
+
" successful"
|
|
3680
|
+
] }),
|
|
3681
|
+
hasFailures && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-1 text-red-600", children: [
|
|
3682
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.X, { className: "h-3 w-3" }),
|
|
3683
|
+
failures.length,
|
|
3684
|
+
" failed"
|
|
3685
|
+
] })
|
|
3686
|
+
] }),
|
|
3687
|
+
hasFailures && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mt-3 pt-2 border-t border-amber-200", children: [
|
|
3688
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-amber-700 mb-1", children: "Failed Rows" }),
|
|
3689
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-1 max-h-32 overflow-y-auto", children: [
|
|
3690
|
+
failures.slice(0, 5).map((failure, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3691
|
+
"div",
|
|
3692
|
+
{
|
|
3693
|
+
className: "text-xs text-red-700 bg-red-50 rounded px-2 py-1",
|
|
3694
|
+
children: [
|
|
3695
|
+
"Row ",
|
|
3696
|
+
failure.row,
|
|
3697
|
+
":",
|
|
3698
|
+
" ",
|
|
3699
|
+
failure.error || "Unknown error"
|
|
3700
|
+
]
|
|
3701
|
+
},
|
|
3702
|
+
i
|
|
3703
|
+
)),
|
|
3704
|
+
failures.length > 5 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "text-xs text-amber-600", children: [
|
|
3705
|
+
"...and ",
|
|
3706
|
+
failures.length - 5,
|
|
3707
|
+
" more"
|
|
3708
|
+
] })
|
|
3709
|
+
] })
|
|
3710
|
+
] }),
|
|
3711
|
+
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)(
|
|
3712
|
+
"button",
|
|
3713
|
+
{
|
|
3714
|
+
type: "button",
|
|
3715
|
+
onClick: (e) => {
|
|
3716
|
+
e.preventDefault();
|
|
3717
|
+
e.stopPropagation();
|
|
3718
|
+
console.log(
|
|
3719
|
+
"[DEBUG] Button clicked - navigationPage:",
|
|
3720
|
+
navigationPage,
|
|
3721
|
+
"onNavigate:",
|
|
3722
|
+
!!onNavigate
|
|
3723
|
+
);
|
|
3724
|
+
if (onNavigate && navigationPage.page) {
|
|
3725
|
+
console.log(
|
|
3726
|
+
"[DEBUG] Calling onNavigate with page:",
|
|
3727
|
+
navigationPage.page
|
|
3728
|
+
);
|
|
3729
|
+
onNavigate(
|
|
3730
|
+
navigationPage.page,
|
|
3731
|
+
navigationPage.subtab
|
|
3732
|
+
);
|
|
3733
|
+
} else {
|
|
3734
|
+
console.log(
|
|
3735
|
+
"[DEBUG] Condition failed - onNavigate:",
|
|
3736
|
+
!!onNavigate,
|
|
3737
|
+
"navigationPage.page:",
|
|
3738
|
+
navigationPage.page
|
|
3739
|
+
);
|
|
3740
|
+
}
|
|
3741
|
+
},
|
|
3742
|
+
className: "flex items-center gap-2 text-xs text-gray-500 hover:text-gray-700 transition-colors group cursor-pointer",
|
|
3743
|
+
children: [
|
|
3744
|
+
/* @__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: [
|
|
3745
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Command, { className: "h-2.5 w-2.5" }),
|
|
3746
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "+" }),
|
|
3747
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-2.5 w-2.5" })
|
|
3748
|
+
] }),
|
|
3749
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
|
|
3750
|
+
"View ",
|
|
3751
|
+
pageLabel
|
|
3752
|
+
] })
|
|
3753
|
+
]
|
|
3754
|
+
}
|
|
3755
|
+
) })
|
|
3756
|
+
]
|
|
3757
|
+
}
|
|
3758
|
+
)
|
|
3759
|
+
},
|
|
3760
|
+
message.id
|
|
3761
|
+
);
|
|
3762
|
+
}
|
|
3763
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(React4.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3183
3764
|
"div",
|
|
3184
3765
|
{
|
|
3185
|
-
|
|
3186
|
-
|
|
3766
|
+
ref: isCurrentGuideStep ? currentStepRef : null,
|
|
3767
|
+
className: `${isRoleChange ? "mt-3" : ""}`,
|
|
3768
|
+
children: [
|
|
3769
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-sm leading-6 text-gray-700", children: (() => {
|
|
3770
|
+
const text = message.content || "";
|
|
3771
|
+
if (message.kind === "guideStep") {
|
|
3772
|
+
const m = text.match(/^(Step\s+\d+:)([\s\S]*)/);
|
|
3773
|
+
if (m) {
|
|
3774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
3775
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { children: m[1] }),
|
|
3776
|
+
m[2]
|
|
3777
|
+
] });
|
|
3778
|
+
}
|
|
3779
|
+
}
|
|
3780
|
+
if (message.role === "assistant" && text) {
|
|
3781
|
+
return renderMarkdown(text);
|
|
3782
|
+
}
|
|
3783
|
+
return text || /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "opacity-70", children: "Thinking\u2026" });
|
|
3784
|
+
})() }),
|
|
3785
|
+
message.role === "assistant" && message.structuredData && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3786
|
+
DataRenderer,
|
|
3787
|
+
{
|
|
3788
|
+
type: message.structuredData.type,
|
|
3789
|
+
data: message.structuredData.data
|
|
3790
|
+
}
|
|
3791
|
+
) }),
|
|
3792
|
+
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)(
|
|
3793
|
+
"button",
|
|
3794
|
+
{
|
|
3795
|
+
type: "button",
|
|
3796
|
+
onClick: () => handleFollowupClick(message.id, followup),
|
|
3797
|
+
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",
|
|
3798
|
+
children: followup.label
|
|
3799
|
+
},
|
|
3800
|
+
followup.id
|
|
3801
|
+
)) })
|
|
3802
|
+
]
|
|
3187
3803
|
}
|
|
3188
|
-
) })
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
" successful"
|
|
3194
|
-
] }),
|
|
3195
|
-
failures > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-1 text-red-600", children: [
|
|
3196
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.X, { className: "h-3 w-3" }),
|
|
3197
|
-
failures,
|
|
3198
|
-
" failed"
|
|
3199
|
-
] })
|
|
3200
|
-
] })
|
|
3201
|
-
] }) }, message.id);
|
|
3202
|
-
}
|
|
3203
|
-
if (message.kind === "bulkSummary" && message.bulkSummary) {
|
|
3204
|
-
const { total, successes, failures, navigationPage } = message.bulkSummary;
|
|
3205
|
-
const hasFailures = failures.length > 0;
|
|
3206
|
-
const pageLabel = navigationPage?.page === "customers" ? "Customers" : navigationPage?.page === "dashboard" ? "Dashboard" : navigationPage?.page === "settings" ? "Settings" : "Results";
|
|
3207
|
-
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: [
|
|
3208
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
3209
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CheckCircle2, { className: `h-5 w-5 ${hasFailures ? "text-amber-600" : "text-green-600"}` }),
|
|
3210
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-medium text-gray-800", children: "Bulk operation complete" })
|
|
3211
|
-
] }),
|
|
3212
|
-
/* @__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` : ""}.` }),
|
|
3213
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-4 text-xs", children: [
|
|
3214
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-1 text-green-700", children: [
|
|
3215
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CheckCircle2, { className: "h-3 w-3" }),
|
|
3216
|
-
successes,
|
|
3217
|
-
" successful"
|
|
3218
|
-
] }),
|
|
3219
|
-
hasFailures && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-1 text-red-600", children: [
|
|
3220
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.X, { className: "h-3 w-3" }),
|
|
3221
|
-
failures.length,
|
|
3222
|
-
" failed"
|
|
3223
|
-
] })
|
|
3224
|
-
] }),
|
|
3225
|
-
hasFailures && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mt-3 pt-2 border-t border-amber-200", children: [
|
|
3226
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-amber-700 mb-1", children: "Failed Rows" }),
|
|
3227
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-1 max-h-32 overflow-y-auto", children: [
|
|
3228
|
-
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: [
|
|
3229
|
-
"Row ",
|
|
3230
|
-
failure.row,
|
|
3231
|
-
": ",
|
|
3232
|
-
failure.error || "Unknown error"
|
|
3233
|
-
] }, i)),
|
|
3234
|
-
failures.length > 5 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "text-xs text-amber-600", children: [
|
|
3235
|
-
"...and ",
|
|
3236
|
-
failures.length - 5,
|
|
3237
|
-
" more"
|
|
3238
|
-
] })
|
|
3239
|
-
] })
|
|
3240
|
-
] }),
|
|
3241
|
-
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)(
|
|
3242
|
-
"button",
|
|
3804
|
+
) }, message.id);
|
|
3805
|
+
}),
|
|
3806
|
+
(activeGuide || guideComplete) && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
|
|
3807
|
+
activeGuide && activeGuide.stepIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3808
|
+
Button,
|
|
3243
3809
|
{
|
|
3244
3810
|
type: "button",
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3811
|
+
size: "sm",
|
|
3812
|
+
variant: "secondary",
|
|
3813
|
+
className: "h-7 w-7 rounded-full p-0 bg-gray-100 hover:bg-gray-200 border border-gray-200",
|
|
3814
|
+
onClick: goBackGuide,
|
|
3815
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.ArrowLeft, { className: "h-3.5 w-3.5 text-gray-600" })
|
|
3816
|
+
}
|
|
3817
|
+
),
|
|
3818
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3819
|
+
Button,
|
|
3820
|
+
{
|
|
3821
|
+
type: "button",
|
|
3822
|
+
size: "sm",
|
|
3823
|
+
variant: "secondary",
|
|
3824
|
+
className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
|
|
3825
|
+
onClick: guideComplete ? handleBack : advanceGuide,
|
|
3257
3826
|
children: [
|
|
3258
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.
|
|
3259
|
-
|
|
3260
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3261
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-
|
|
3262
|
-
] }),
|
|
3263
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
|
|
3264
|
-
"View ",
|
|
3265
|
-
pageLabel
|
|
3827
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: guideComplete ? "Done" : "Next" }),
|
|
3828
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
|
|
3829
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
|
|
3830
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
|
|
3266
3831
|
] })
|
|
3267
3832
|
]
|
|
3268
3833
|
}
|
|
3269
|
-
)
|
|
3270
|
-
] })
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
if (m) {
|
|
3283
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
3284
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { children: m[1] }),
|
|
3285
|
-
m[2]
|
|
3286
|
-
] });
|
|
3287
|
-
}
|
|
3288
|
-
}
|
|
3289
|
-
if (message.role === "assistant" && text) {
|
|
3290
|
-
return renderMarkdown(text);
|
|
3291
|
-
}
|
|
3292
|
-
return text || /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "opacity-70", children: "Thinking\u2026" });
|
|
3293
|
-
})() }),
|
|
3294
|
-
message.role === "assistant" && message.structuredData && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3295
|
-
DataRenderer,
|
|
3296
|
-
{
|
|
3297
|
-
type: message.structuredData.type,
|
|
3298
|
-
data: message.structuredData.data
|
|
3299
|
-
}
|
|
3300
|
-
) }),
|
|
3301
|
-
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)(
|
|
3302
|
-
"button",
|
|
3303
|
-
{
|
|
3304
|
-
type: "button",
|
|
3305
|
-
onClick: () => handleFollowupClick(message.id, followup),
|
|
3306
|
-
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",
|
|
3307
|
-
children: followup.label
|
|
3308
|
-
},
|
|
3309
|
-
followup.id
|
|
3310
|
-
)) })
|
|
3311
|
-
]
|
|
3312
|
-
}
|
|
3313
|
-
) }, message.id);
|
|
3314
|
-
}),
|
|
3315
|
-
(activeGuide || guideComplete) && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
|
|
3316
|
-
activeGuide && activeGuide.stepIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3317
|
-
Button,
|
|
3318
|
-
{
|
|
3319
|
-
type: "button",
|
|
3320
|
-
size: "sm",
|
|
3321
|
-
variant: "secondary",
|
|
3322
|
-
className: "h-7 w-7 rounded-full p-0 bg-gray-100 hover:bg-gray-200 border border-gray-200",
|
|
3323
|
-
onClick: goBackGuide,
|
|
3324
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.ArrowLeft, { className: "h-3.5 w-3.5 text-gray-600" })
|
|
3325
|
-
}
|
|
3326
|
-
),
|
|
3327
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3328
|
-
Button,
|
|
3329
|
-
{
|
|
3330
|
-
type: "button",
|
|
3331
|
-
size: "sm",
|
|
3332
|
-
variant: "secondary",
|
|
3333
|
-
className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
|
|
3334
|
-
onClick: guideComplete ? handleBack : advanceGuide,
|
|
3335
|
-
children: [
|
|
3336
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: guideComplete ? "Done" : "Next" }),
|
|
3337
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
|
|
3338
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
|
|
3339
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
|
|
3340
|
-
] })
|
|
3341
|
-
]
|
|
3342
|
-
}
|
|
3343
|
-
)
|
|
3344
|
-
] }),
|
|
3345
|
-
(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)(
|
|
3346
|
-
AssistantActivity,
|
|
3347
|
-
{
|
|
3348
|
-
phase,
|
|
3349
|
-
progressSteps
|
|
3350
|
-
}
|
|
3351
|
-
) }),
|
|
3352
|
-
!activeGuide && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { ref: messagesEndRef })
|
|
3353
|
-
] }) }) }) }) }),
|
|
3834
|
+
)
|
|
3835
|
+
] }),
|
|
3836
|
+
(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)(
|
|
3837
|
+
AssistantActivity,
|
|
3838
|
+
{
|
|
3839
|
+
phase,
|
|
3840
|
+
progressSteps
|
|
3841
|
+
}
|
|
3842
|
+
) }),
|
|
3843
|
+
!activeGuide && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { ref: messagesEndRef })
|
|
3844
|
+
] }) }) }) })
|
|
3845
|
+
}
|
|
3846
|
+
),
|
|
3354
3847
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "px-4 py-3 border-t border-gray-100 bg-gray-50/50 shrink-0", children: [
|
|
3355
3848
|
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: [
|
|
3356
3849
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.FileSpreadsheet, { className: "h-4 w-4 text-blue-600" }),
|
|
@@ -3402,14 +3895,10 @@ ${userText}`
|
|
|
3402
3895
|
{
|
|
3403
3896
|
placeholder: pendingFile ? "Describe what to do with this CSV..." : "Ask anything...",
|
|
3404
3897
|
value: input,
|
|
3405
|
-
onChange: (e) =>
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
onInput: (e) => {
|
|
3410
|
-
const target = e.target;
|
|
3411
|
-
target.style.height = "auto";
|
|
3412
|
-
target.style.height = Math.min(target.scrollHeight, 120) + "px";
|
|
3898
|
+
onChange: (e) => {
|
|
3899
|
+
setInput(e.target.value);
|
|
3900
|
+
e.target.style.height = "24px";
|
|
3901
|
+
e.target.style.height = `${Math.min(120, e.target.scrollHeight)}px`;
|
|
3413
3902
|
},
|
|
3414
3903
|
onKeyDown: (e) => {
|
|
3415
3904
|
if (e.key === "Enter" && !e.shiftKey && !e.metaKey && !e.ctrlKey) {
|
|
@@ -3479,7 +3968,11 @@ ${userText}`
|
|
|
3479
3968
|
}
|
|
3480
3969
|
);
|
|
3481
3970
|
}
|
|
3482
|
-
function PanelToggle({
|
|
3971
|
+
function PanelToggle({
|
|
3972
|
+
isOpen,
|
|
3973
|
+
onClick,
|
|
3974
|
+
className = ""
|
|
3975
|
+
}) {
|
|
3483
3976
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3484
3977
|
"button",
|
|
3485
3978
|
{
|
|
@@ -3525,13 +4018,7 @@ function ChatPanelWithToggle({
|
|
|
3525
4018
|
};
|
|
3526
4019
|
}, [isOpen]);
|
|
3527
4020
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
3528
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3529
|
-
PanelToggle,
|
|
3530
|
-
{
|
|
3531
|
-
isOpen,
|
|
3532
|
-
onClick: () => setIsOpen(!isOpen)
|
|
3533
|
-
}
|
|
3534
|
-
),
|
|
4021
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PanelToggle, { isOpen, onClick: () => setIsOpen(!isOpen) }),
|
|
3535
4022
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3536
4023
|
ChatPanel,
|
|
3537
4024
|
{
|