@kite-copilot/chat-panel 0.2.52 → 0.2.54

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 CHANGED
@@ -40,6 +40,7 @@ var import_client = require("react-dom/client");
40
40
 
41
41
  // src/ChatPanel.tsx
42
42
  var React6 = __toESM(require("react"), 1);
43
+ var import_react_dom = require("react-dom");
43
44
  var import_supabase_js = require("@supabase/supabase-js");
44
45
 
45
46
  // src/lib/utils.ts
@@ -1066,29 +1067,29 @@ function DataRenderer({ type, data }) {
1066
1067
  // src/components/TypingIndicator.tsx
1067
1068
  var import_jsx_runtime9 = require("react/jsx-runtime");
1068
1069
  function TypingIndicator({ className = "" }) {
1069
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `flex items-center gap-1 px-4 py-3 ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1", children: [
1070
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `flex items-center gap-1.5 ${className}`, children: [
1070
1071
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1071
1072
  "span",
1072
1073
  {
1073
- className: "w-2 h-2 bg-gray-400 rounded-full animate-bounce",
1074
+ className: "w-2 h-2 bg-gray-500 rounded-full animate-bounce",
1074
1075
  style: { animationDelay: "0ms", animationDuration: "600ms" }
1075
1076
  }
1076
1077
  ),
1077
1078
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1078
1079
  "span",
1079
1080
  {
1080
- className: "w-2 h-2 bg-gray-400 rounded-full animate-bounce",
1081
+ className: "w-2 h-2 bg-gray-500 rounded-full animate-bounce",
1081
1082
  style: { animationDelay: "150ms", animationDuration: "600ms" }
1082
1083
  }
1083
1084
  ),
1084
1085
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1085
1086
  "span",
1086
1087
  {
1087
- className: "w-2 h-2 bg-gray-400 rounded-full animate-bounce",
1088
+ className: "w-2 h-2 bg-gray-500 rounded-full animate-bounce",
1088
1089
  style: { animationDelay: "300ms", animationDuration: "600ms" }
1089
1090
  }
1090
1091
  )
1091
- ] }) });
1092
+ ] });
1092
1093
  }
1093
1094
 
1094
1095
  // src/ChatPanel.tsx
@@ -1537,6 +1538,132 @@ function AuthErrorState({
1537
1538
  )
1538
1539
  ] });
1539
1540
  }
1541
+ function ImageLightbox({
1542
+ imageUrl,
1543
+ onClose
1544
+ }) {
1545
+ const handleDownload = async () => {
1546
+ try {
1547
+ const response = await fetch(imageUrl);
1548
+ const blob = await response.blob();
1549
+ const url = window.URL.createObjectURL(blob);
1550
+ const a = document.createElement("a");
1551
+ a.href = url;
1552
+ const urlParts = imageUrl.split("/");
1553
+ const filename = urlParts[urlParts.length - 1] || "image.jpg";
1554
+ a.download = filename;
1555
+ document.body.appendChild(a);
1556
+ a.click();
1557
+ document.body.removeChild(a);
1558
+ window.URL.revokeObjectURL(url);
1559
+ } catch (error) {
1560
+ console.error("Failed to download image:", error);
1561
+ window.open(imageUrl, "_blank");
1562
+ }
1563
+ };
1564
+ return (0, import_react_dom.createPortal)(
1565
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1566
+ "div",
1567
+ {
1568
+ style: {
1569
+ position: "fixed",
1570
+ top: 0,
1571
+ left: 0,
1572
+ right: 0,
1573
+ bottom: 0,
1574
+ display: "flex",
1575
+ alignItems: "center",
1576
+ justifyContent: "center",
1577
+ backgroundColor: "rgba(0, 0, 0, 0.8)",
1578
+ zIndex: 99999
1579
+ },
1580
+ onClick: onClose,
1581
+ children: [
1582
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1583
+ "button",
1584
+ {
1585
+ onClick: (e) => {
1586
+ e.stopPropagation();
1587
+ onClose();
1588
+ },
1589
+ style: {
1590
+ position: "absolute",
1591
+ top: "16px",
1592
+ right: "16px",
1593
+ padding: "8px",
1594
+ borderRadius: "9999px",
1595
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
1596
+ color: "white",
1597
+ border: "none",
1598
+ cursor: "pointer",
1599
+ display: "flex",
1600
+ alignItems: "center",
1601
+ justifyContent: "center"
1602
+ },
1603
+ "aria-label": "Close",
1604
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { style: { height: "24px", width: "24px" } })
1605
+ }
1606
+ ),
1607
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1608
+ "div",
1609
+ {
1610
+ style: {
1611
+ position: "relative",
1612
+ maxWidth: "90vw",
1613
+ maxHeight: "90vh",
1614
+ display: "flex",
1615
+ flexDirection: "column",
1616
+ alignItems: "center"
1617
+ },
1618
+ onClick: (e) => e.stopPropagation(),
1619
+ children: [
1620
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1621
+ "img",
1622
+ {
1623
+ src: imageUrl,
1624
+ alt: "Full size preview",
1625
+ style: {
1626
+ maxWidth: "100%",
1627
+ maxHeight: "85vh",
1628
+ objectFit: "contain",
1629
+ borderRadius: "8px",
1630
+ boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.25)"
1631
+ }
1632
+ }
1633
+ ),
1634
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { display: "flex", gap: "12px", marginTop: "16px" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1635
+ "button",
1636
+ {
1637
+ onClick: handleDownload,
1638
+ style: {
1639
+ display: "flex",
1640
+ alignItems: "center",
1641
+ gap: "8px",
1642
+ padding: "8px 16px",
1643
+ backgroundColor: "white",
1644
+ color: "#1f2937",
1645
+ borderRadius: "8px",
1646
+ border: "none",
1647
+ cursor: "pointer",
1648
+ fontSize: "14px",
1649
+ fontWeight: 500,
1650
+ boxShadow: "0 10px 15px -3px rgba(0, 0, 0, 0.1)"
1651
+ },
1652
+ children: [
1653
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Download, { style: { height: "16px", width: "16px" } }),
1654
+ "Download"
1655
+ ]
1656
+ }
1657
+ ) })
1658
+ ]
1659
+ }
1660
+ )
1661
+ ]
1662
+ }
1663
+ ),
1664
+ document.body
1665
+ );
1666
+ }
1540
1667
  function ChatPanel({
1541
1668
  isOpen = true,
1542
1669
  onClose,
@@ -1557,7 +1684,8 @@ function ChatPanel({
1557
1684
  initialCorner = "bottom-left",
1558
1685
  onCornerChange,
1559
1686
  productBackendUrl,
1560
- getAuthHeaders
1687
+ getAuthHeaders,
1688
+ isEval = false
1561
1689
  } = {}) {
1562
1690
  const [messages, setMessages] = React6.useState(initialMessages);
1563
1691
  const [input, setInput] = React6.useState("");
@@ -1667,13 +1795,20 @@ function ChatPanel({
1667
1795
  }, [effectiveSupabaseUrl, effectiveSupabaseAnonKey]);
1668
1796
  React6.useEffect(() => {
1669
1797
  if (!isEscalated || !sessionId || !supabaseRef.current) {
1798
+ console.log("[KiteChat] Typing channel skip - isEscalated:", isEscalated, "sessionId:", sessionId, "supabase:", !!supabaseRef.current);
1670
1799
  return;
1671
1800
  }
1672
1801
  const channelName = `typing:${sessionId}`;
1673
- const channel = supabaseRef.current.channel(channelName);
1802
+ console.log("[KiteChat] Subscribing to typing channel:", channelName, "sessionId:", sessionId);
1803
+ const channel = supabaseRef.current.channel(channelName, {
1804
+ config: { broadcast: { self: true } }
1805
+ });
1674
1806
  channel.on("broadcast", { event: "typing" }, (payload) => {
1807
+ console.log("[KiteChat] Received typing event:", payload);
1675
1808
  const { sender, isTyping } = payload.payload;
1809
+ console.log("[KiteChat] Typing event - sender:", sender, "isTyping:", isTyping);
1676
1810
  if (sender === "agent") {
1811
+ console.log("[KiteChat] Setting agentIsTyping to:", isTyping);
1677
1812
  setAgentIsTyping(isTyping);
1678
1813
  if (isTyping) {
1679
1814
  if (typingTimeoutRef.current) {
@@ -1685,6 +1820,7 @@ function ChatPanel({
1685
1820
  }
1686
1821
  }
1687
1822
  }).subscribe((status) => {
1823
+ console.log("[KiteChat] Typing channel subscription status:", status);
1688
1824
  if (status === "SUBSCRIBED") {
1689
1825
  typingChannelRef.current = channel;
1690
1826
  console.log("[KiteChat] Typing channel subscribed successfully");
@@ -1699,7 +1835,7 @@ function ChatPanel({
1699
1835
  window.clearTimeout(typingTimeoutRef.current);
1700
1836
  }
1701
1837
  };
1702
- }, [isEscalated, sessionId]);
1838
+ }, [isEscalated, sessionId, effectiveSupabaseUrl, effectiveSupabaseAnonKey]);
1703
1839
  React6.useEffect(() => {
1704
1840
  if (!isOpen && isEscalated && supabaseRef.current && sessionId) {
1705
1841
  console.log("[KiteChat] Panel closed during live chat, marking disconnected");
@@ -1910,6 +2046,97 @@ function ChatPanel({
1910
2046
  const [pendingBulkSession, setPendingBulkSession] = React6.useState(null);
1911
2047
  const pendingBulkSessionRef = React6.useRef(null);
1912
2048
  const fileInputRef = React6.useRef(null);
2049
+ const [pendingImages, setPendingImages] = React6.useState([]);
2050
+ const [isUploadingImage, setIsUploadingImage] = React6.useState(false);
2051
+ const [isDragOver, setIsDragOver] = React6.useState(false);
2052
+ const imageInputRef = React6.useRef(null);
2053
+ const [lightboxImageUrl, setLightboxImageUrl] = React6.useState(null);
2054
+ const uploadImageToStorage = React6.useCallback(async (file) => {
2055
+ if (!supabaseRef.current) {
2056
+ console.error("[KiteChat] Supabase client not available for file upload");
2057
+ return null;
2058
+ }
2059
+ const fileExt = file.name.split(".").pop();
2060
+ const fileName = `${sessionId}/${Date.now()}-${Math.random().toString(36).substring(7)}.${fileExt}`;
2061
+ const bucketName = "chat-attachments";
2062
+ try {
2063
+ const { data, error } = await supabaseRef.current.storage.from(bucketName).upload(fileName, file, {
2064
+ cacheControl: "3600",
2065
+ upsert: false
2066
+ });
2067
+ if (error) {
2068
+ console.error("[KiteChat] Upload error:", error);
2069
+ return null;
2070
+ }
2071
+ const { data: urlData } = supabaseRef.current.storage.from(bucketName).getPublicUrl(fileName);
2072
+ return urlData?.publicUrl || null;
2073
+ } catch (err) {
2074
+ console.error("[KiteChat] Upload failed:", err);
2075
+ return null;
2076
+ }
2077
+ }, [sessionId]);
2078
+ const handleImageSelect = React6.useCallback((files) => {
2079
+ if (!files) return;
2080
+ const imageFiles = Array.from(files).filter(
2081
+ (file) => file.type.startsWith("image/") || file.type === "application/pdf"
2082
+ );
2083
+ const newImages = imageFiles.map((file) => ({
2084
+ file,
2085
+ preview: file.type.startsWith("image/") ? URL.createObjectURL(file) : ""
2086
+ }));
2087
+ console.log("[KiteChat] Adding images to pending:", newImages.length, "files");
2088
+ setPendingImages((prev) => {
2089
+ const updated = [...prev, ...newImages];
2090
+ console.log("[KiteChat] pendingImages now:", updated.length);
2091
+ return updated;
2092
+ });
2093
+ }, []);
2094
+ React6.useEffect(() => {
2095
+ const hasText = input.trim().length > 0;
2096
+ const hasFile = !!pendingFile;
2097
+ const hasImages = pendingImages.length > 0;
2098
+ const disabled = !hasText && !hasFile && !hasImages || isWaitingForAuth;
2099
+ console.log("[KiteChat] Send button state:", {
2100
+ hasText,
2101
+ hasFile,
2102
+ hasImages,
2103
+ pendingImagesCount: pendingImages.length,
2104
+ isWaitingForAuth,
2105
+ authStatus: authState.status,
2106
+ disabled
2107
+ });
2108
+ }, [input, pendingFile, pendingImages, isWaitingForAuth, authState.status]);
2109
+ const handleDragOver = React6.useCallback((e) => {
2110
+ e.preventDefault();
2111
+ e.stopPropagation();
2112
+ setIsDragOver(true);
2113
+ }, []);
2114
+ const handleDragLeave = React6.useCallback((e) => {
2115
+ e.preventDefault();
2116
+ e.stopPropagation();
2117
+ setIsDragOver(false);
2118
+ }, []);
2119
+ const handleDrop = React6.useCallback((e) => {
2120
+ e.preventDefault();
2121
+ e.stopPropagation();
2122
+ setIsDragOver(false);
2123
+ const files = e.dataTransfer.files;
2124
+ if (files.length > 0) {
2125
+ const csvFile = Array.from(files).find((f) => f.name.endsWith(".csv"));
2126
+ if (csvFile && !isEscalated) {
2127
+ setPendingFile(csvFile);
2128
+ } else {
2129
+ handleImageSelect(files);
2130
+ }
2131
+ }
2132
+ }, [isEscalated, handleImageSelect]);
2133
+ React6.useEffect(() => {
2134
+ return () => {
2135
+ pendingImages.forEach((img) => {
2136
+ if (img.preview) URL.revokeObjectURL(img.preview);
2137
+ });
2138
+ };
2139
+ }, [pendingImages]);
1913
2140
  const [searchExpanded, setSearchExpanded] = React6.useState(false);
1914
2141
  const [searchInput, setSearchInput] = React6.useState("");
1915
2142
  const searchInputRef = React6.useRef(null);
@@ -1966,6 +2193,11 @@ function ChatPanel({
1966
2193
  messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
1967
2194
  }
1968
2195
  }, [messages, phase, activeGuide]);
2196
+ React6.useEffect(() => {
2197
+ if (isEscalated && agentIsTyping && !activeGuide) {
2198
+ messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
2199
+ }
2200
+ }, [isEscalated, agentIsTyping, activeGuide]);
1969
2201
  const latestBulkSummaryNavigation = React6.useMemo(() => {
1970
2202
  for (let i = messages.length - 1; i >= 0; i--) {
1971
2203
  const msg = messages[i];
@@ -2035,12 +2267,20 @@ function ChatPanel({
2035
2267
  onNavigate
2036
2268
  ]);
2037
2269
  const connectToEscalationWs = React6.useCallback((currentSessionId) => {
2038
- if (!agentUrl) return;
2270
+ if (!agentUrl) {
2271
+ console.log("[KiteChat] No agentUrl, skipping WebSocket connection");
2272
+ return;
2273
+ }
2039
2274
  if (escalationWsRef.current) {
2275
+ console.log("[KiteChat] Closing existing WebSocket connection");
2040
2276
  escalationWsRef.current.close();
2041
2277
  }
2042
2278
  const wsUrl = agentUrl.replace(/^http/, "ws") + `/ws/escalation/${currentSessionId}`;
2279
+ console.log("[KiteChat] Connecting to escalation WebSocket:", wsUrl);
2043
2280
  const ws = new WebSocket(wsUrl);
2281
+ ws.onopen = () => {
2282
+ console.log("[KiteChat] Escalation WebSocket connected successfully");
2283
+ };
2044
2284
  ws.onmessage = (event) => {
2045
2285
  try {
2046
2286
  const data = JSON.parse(event.data);
@@ -2071,13 +2311,18 @@ function ChatPanel({
2071
2311
  ws.onerror = (err) => {
2072
2312
  console.error("[KiteChat] Escalation WebSocket error:", err);
2073
2313
  };
2074
- ws.onclose = () => {
2314
+ ws.onclose = (event) => {
2315
+ console.log("[KiteChat] Escalation WebSocket closed - code:", event.code, "reason:", event.reason);
2075
2316
  };
2076
2317
  escalationWsRef.current = ws;
2077
2318
  }, [agentUrl]);
2078
2319
  const sendEscalatedMessage = React6.useCallback(async (content) => {
2079
- if (!escalationWsRef.current || escalationWsRef.current.readyState !== WebSocket.OPEN) {
2080
- console.error("[KiteChat] Escalation WebSocket not connected");
2320
+ if (!escalationWsRef.current) {
2321
+ console.error("[KiteChat] Escalation WebSocket not connected - no ref");
2322
+ return false;
2323
+ }
2324
+ if (escalationWsRef.current.readyState !== WebSocket.OPEN) {
2325
+ console.error("[KiteChat] Escalation WebSocket not connected - state:", escalationWsRef.current.readyState, "(0=CONNECTING, 1=OPEN, 2=CLOSING, 3=CLOSED)");
2081
2326
  return false;
2082
2327
  }
2083
2328
  try {
@@ -2109,7 +2354,9 @@ function ChatPanel({
2109
2354
  };
2110
2355
  }, []);
2111
2356
  React6.useEffect(() => {
2357
+ console.log("[KiteChat] Escalation useEffect - isEscalated:", isEscalated, "sessionId:", sessionId);
2112
2358
  if (isEscalated && sessionId) {
2359
+ console.log("[KiteChat] Triggering WebSocket connection for escalation");
2113
2360
  connectToEscalationWs(sessionId);
2114
2361
  }
2115
2362
  }, [isEscalated, sessionId, connectToEscalationWs]);
@@ -2202,7 +2449,7 @@ function ChatPanel({
2202
2449
  setPanelView("landing");
2203
2450
  setCurrentFolderId(void 0);
2204
2451
  }
2205
- function handleSubmit(e) {
2452
+ async function handleSubmit(e) {
2206
2453
  e.preventDefault();
2207
2454
  const trimmed = input.trim();
2208
2455
  if (pendingFile) {
@@ -2222,6 +2469,49 @@ function ChatPanel({
2222
2469
  if (fileInputRef.current) fileInputRef.current.value = "";
2223
2470
  return;
2224
2471
  }
2472
+ if (pendingImages.length > 0) {
2473
+ setIsUploadingImage(true);
2474
+ try {
2475
+ const uploadedUrls = [];
2476
+ for (const img of pendingImages) {
2477
+ const url = await uploadImageToStorage(img.file);
2478
+ if (url) {
2479
+ uploadedUrls.push(url);
2480
+ }
2481
+ if (img.preview) URL.revokeObjectURL(img.preview);
2482
+ }
2483
+ if (uploadedUrls.length > 0) {
2484
+ const imageMarkdown = uploadedUrls.map((url) => `![image](${url})`).join("\n");
2485
+ const messageContent = trimmed ? `${trimmed}
2486
+
2487
+ ${imageMarkdown}` : imageMarkdown;
2488
+ const userMessage = {
2489
+ id: Date.now(),
2490
+ role: "user",
2491
+ content: messageContent,
2492
+ imageUrls: uploadedUrls
2493
+ };
2494
+ setMessages((prev) => [...prev, userMessage]);
2495
+ if (isEscalated) {
2496
+ sendEscalatedMessage(messageContent);
2497
+ sendTypingIndicator(false);
2498
+ if (userTypingTimeoutRef.current) {
2499
+ window.clearTimeout(userTypingTimeoutRef.current);
2500
+ userTypingTimeoutRef.current = null;
2501
+ }
2502
+ } else {
2503
+ startChatFlow(messageContent);
2504
+ }
2505
+ }
2506
+ } catch (err) {
2507
+ console.error("[KiteChat] Failed to upload images:", err);
2508
+ } finally {
2509
+ setIsUploadingImage(false);
2510
+ setPendingImages([]);
2511
+ setInput("");
2512
+ }
2513
+ return;
2514
+ }
2225
2515
  if (!trimmed) return;
2226
2516
  if (isEscalated) {
2227
2517
  const userMessage = {
@@ -2386,7 +2676,8 @@ function ChatPanel({
2386
2676
  user_id: userId,
2387
2677
  org_id: orgId,
2388
2678
  user_name: userName,
2389
- user_email: userEmail
2679
+ user_email: userEmail,
2680
+ is_eval: isEval
2390
2681
  }),
2391
2682
  signal: controller.signal
2392
2683
  });
@@ -3279,19 +3570,23 @@ ${userText}`
3279
3570
  )
3280
3571
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
3281
3572
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3282
- "input",
3573
+ "textarea",
3283
3574
  {
3284
3575
  ref: searchInputRef,
3285
- type: "text",
3286
3576
  value: searchInput,
3287
- onChange: (e) => setSearchInput(e.target.value),
3577
+ onChange: (e) => {
3578
+ setSearchInput(e.target.value);
3579
+ e.target.style.height = "auto";
3580
+ e.target.style.height = Math.min(e.target.scrollHeight, 120) + "px";
3581
+ },
3288
3582
  onKeyDown: (e) => {
3289
- if (e.key === "Enter" && searchInput.trim()) {
3583
+ if (e.key === "Enter" && !e.shiftKey && searchInput.trim()) {
3290
3584
  e.preventDefault();
3291
3585
  onOpen?.();
3292
3586
  startChatFlow(searchInput.trim());
3293
3587
  setSearchInput("");
3294
3588
  setSearchExpanded(false);
3589
+ e.currentTarget.style.height = "auto";
3295
3590
  } else if (e.key === "Escape") {
3296
3591
  setSearchExpanded(false);
3297
3592
  setSearchInput("");
@@ -3303,7 +3598,8 @@ ${userText}`
3303
3598
  }
3304
3599
  },
3305
3600
  placeholder: "Ask a question...",
3306
- className: "flex-1 text-sm text-gray-700 outline-none bg-transparent"
3601
+ rows: 1,
3602
+ className: "flex-1 text-sm text-gray-700 outline-none bg-transparent resize-none min-h-[20px] max-h-[120px]"
3307
3603
  }
3308
3604
  ),
3309
3605
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2", children: [
@@ -3330,8 +3626,8 @@ ${userText}`
3330
3626
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3331
3627
  "section",
3332
3628
  {
3333
- className: `fixed top-0 right-0 z-40 flex flex-col bg-white border-l border-gray-200 h-full overflow-hidden transition-transform duration-300 ${isOpen ? "translate-x-0" : "translate-x-full"}`,
3334
- style: { width: `${PANEL_WIDTH}px` },
3629
+ className: `fixed bottom-4 z-40 flex flex-col bg-white border border-gray-200 rounded-2xl overflow-hidden shadow-2xl ${corner === "bottom-left" ? "left-4" : "right-4"} ${isOpen ? "opacity-100 scale-100" : "opacity-0 scale-95 pointer-events-none"}`,
3630
+ style: { width: `${PANEL_WIDTH}px`, height: `${PANEL_HEIGHT}px` },
3335
3631
  children: [
3336
3632
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-100 bg-gradient-to-r from-gray-50 to-white shrink-0", children: [
3337
3633
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2.5", children: [
@@ -3362,8 +3658,8 @@ ${userText}`
3362
3658
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3363
3659
  "section",
3364
3660
  {
3365
- className: `fixed top-0 right-0 z-40 flex flex-col bg-white border-l border-gray-200 h-full overflow-hidden transition-transform duration-300 ${isOpen ? "translate-x-0" : "translate-x-full"}`,
3366
- style: { width: `${PANEL_WIDTH}px` },
3661
+ className: `fixed bottom-4 z-40 flex flex-col bg-white border border-gray-200 rounded-2xl overflow-hidden shadow-2xl ${corner === "bottom-left" ? "left-4" : "right-4"} ${isOpen ? "opacity-100 scale-100" : "opacity-0 scale-95 pointer-events-none"}`,
3662
+ style: { width: `${PANEL_WIDTH}px`, height: `${PANEL_HEIGHT}px` },
3367
3663
  children: [
3368
3664
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-100 bg-gradient-to-r from-gray-50 to-white shrink-0", children: [
3369
3665
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2.5", children: [
@@ -3390,8 +3686,8 @@ ${userText}`
3390
3686
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3391
3687
  "section",
3392
3688
  {
3393
- className: `fixed top-0 right-0 z-40 flex flex-col bg-white border-l border-gray-200 h-full overflow-hidden transition-transform duration-300 ${isOpen ? "translate-x-0" : "translate-x-full"}`,
3394
- style: { width: `${PANEL_WIDTH}px` },
3689
+ className: `fixed bottom-4 z-40 flex flex-col bg-white border border-gray-200 rounded-2xl overflow-hidden shadow-2xl ${corner === "bottom-left" ? "left-4" : "right-4"} ${isOpen ? "opacity-100 scale-100" : "opacity-0 scale-95 pointer-events-none"}`,
3690
+ style: { width: `${PANEL_WIDTH}px`, height: `${PANEL_HEIGHT}px` },
3395
3691
  children: [
3396
3692
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-100 bg-gradient-to-r from-gray-50 to-white shrink-0", children: [
3397
3693
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2.5", children: [
@@ -3443,9 +3739,8 @@ ${userText}`
3443
3739
  size: "sm",
3444
3740
  className: "h-7 w-7 p-0 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-full",
3445
3741
  onClick: () => {
3446
- resetSession();
3447
3742
  setMessages([]);
3448
- setPanelView("landing");
3743
+ resetSession();
3449
3744
  setCurrentFolderId(void 0);
3450
3745
  setActiveGuide(void 0);
3451
3746
  activeGuideRef.current = void 0;
@@ -3477,1258 +3772,1368 @@ ${userText}`
3477
3772
  )
3478
3773
  ] })
3479
3774
  ] }),
3480
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3481
- "div",
3482
- {
3483
- 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",
3484
- children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w-full overflow-y-auto px-4", children: [
3485
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "py-3 transition-all duration-300", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h2", { className: "text-center text-2xl font-semibold text-gray-900", children: panelView === "folder" ? folders.find((f) => f.id === currentFolderId)?.title || "" : "How can I help?" }) }),
3486
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "pb-4 px-4", children: [
3487
- panelView === "landing" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-col gap-1", children: loadingQuestions ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Loader2, { className: "h-4 w-4 animate-spin text-gray-400" }) }) : startingQuestions.map((question, index) => {
3488
- const iconColors = [
3489
- "bg-blue-400",
3490
- "bg-green-400",
3491
- "bg-purple-400",
3492
- "bg-orange-400",
3493
- "bg-pink-400"
3494
- ];
3495
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3496
- Button,
3497
- {
3498
- type: "button",
3499
- size: "sm",
3500
- variant: "ghost",
3501
- className: "w-full justify-start rounded-lg px-3 py-1.5 text-xs text-gray-700 hover:bg-gray-100 h-auto",
3502
- onClick: () => sendTopic(question.prompt),
3503
- children: [
3504
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3505
- "span",
3506
- {
3507
- className: `mr-2 inline-block h-1.5 w-1.5 rounded-full ${iconColors[index % iconColors.length]}`
3508
- }
3509
- ),
3510
- question.label
3511
- ]
3512
- },
3513
- question.id
3514
- );
3515
- }) }) }),
3516
- panelView === "folder" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
3517
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mb-3 flex items-center gap-2", children: [
3518
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3775
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex-1 flex flex-col min-h-0 overflow-hidden relative", children: [
3776
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3777
+ "div",
3778
+ {
3779
+ className: `absolute inset-0 grid place-items-center overflow-y-auto ${isEmpty ? "visible" : "invisible pointer-events-none"}`,
3780
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w-full px-4", children: [
3781
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "py-3", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h2", { className: "text-center text-2xl font-semibold text-gray-900", children: panelView === "folder" ? folders.find((f) => f.id === currentFolderId)?.title || "" : "How can I help?" }) }),
3782
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "pb-4 px-4", children: [
3783
+ panelView === "landing" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-col gap-1", children: loadingQuestions ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Loader2, { className: "h-4 w-4 animate-spin text-gray-400" }) }) : startingQuestions.map((question, index) => {
3784
+ const iconColors = [
3785
+ "bg-blue-400",
3786
+ "bg-green-400",
3787
+ "bg-purple-400",
3788
+ "bg-orange-400",
3789
+ "bg-pink-400"
3790
+ ];
3791
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3519
3792
  Button,
3520
3793
  {
3521
3794
  type: "button",
3522
- size: "icon",
3795
+ size: "sm",
3523
3796
  variant: "ghost",
3524
- className: "h-7 w-7 rounded-full hover:bg-gray-100",
3525
- onClick: closeFolder,
3526
- "aria-label": "Back to suggestions",
3527
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowLeft, { className: "h-4 w-4 text-gray-500" })
3528
- }
3529
- ),
3530
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs font-medium uppercase tracking-wide text-gray-400", children: "Topics" })
3531
- ] }),
3532
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-col gap-1.5", children: folders.find((f) => f.id === currentFolderId)?.topics.map((topic) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3533
- Button,
3534
- {
3535
- type: "button",
3536
- size: "sm",
3537
- variant: "secondary",
3538
- 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",
3539
- onClick: () => sendTopic(topic.prompt),
3540
- children: topic.label
3541
- },
3542
- topic.id
3543
- )) })
3797
+ className: "w-full justify-start rounded-lg px-3 py-1.5 text-xs text-gray-700 hover:bg-gray-100 h-auto",
3798
+ onClick: () => sendTopic(question.prompt),
3799
+ children: [
3800
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3801
+ "span",
3802
+ {
3803
+ className: `mr-2 inline-block h-1.5 w-1.5 rounded-full ${iconColors[index % iconColors.length]}`
3804
+ }
3805
+ ),
3806
+ question.label
3807
+ ]
3808
+ },
3809
+ question.id
3810
+ );
3811
+ }) }) }),
3812
+ panelView === "folder" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
3813
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mb-3 flex items-center gap-2", children: [
3814
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3815
+ Button,
3816
+ {
3817
+ type: "button",
3818
+ size: "icon",
3819
+ variant: "ghost",
3820
+ className: "h-7 w-7 rounded-full hover:bg-gray-100",
3821
+ onClick: closeFolder,
3822
+ "aria-label": "Back to suggestions",
3823
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowLeft, { className: "h-4 w-4 text-gray-500" })
3824
+ }
3825
+ ),
3826
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs font-medium uppercase tracking-wide text-gray-400", children: "Topics" })
3827
+ ] }),
3828
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-col gap-1.5", children: folders.find((f) => f.id === currentFolderId)?.topics.map((topic) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3829
+ Button,
3830
+ {
3831
+ type: "button",
3832
+ size: "sm",
3833
+ variant: "secondary",
3834
+ 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",
3835
+ onClick: () => sendTopic(topic.prompt),
3836
+ children: topic.label
3837
+ },
3838
+ topic.id
3839
+ )) })
3840
+ ] })
3544
3841
  ] })
3545
3842
  ] })
3546
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ScrollArea, { ref: messagesContainerRef, className: "h-full", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col gap-2 px-4 py-3", children: [
3547
- messages.map((message, index) => {
3548
- const isUser = message.role === "user";
3549
- const previousRole = index > 0 ? messages[index - 1].role : void 0;
3550
- const isRoleChange = previousRole !== void 0 && previousRole !== message.role;
3551
- const currentGuide = activeGuideRef.current || activeGuide;
3552
- let isCurrentGuideStep = false;
3553
- if (currentGuide && message.kind === "guideStep") {
3554
- if (message.guideStepIndex !== void 0) {
3555
- isCurrentGuideStep = message.guideStepIndex === currentGuide.stepIndex;
3556
- } else {
3557
- isCurrentGuideStep = index === messages.length - 1;
3558
- }
3559
- } else if (message.kind === "guideComplete") {
3843
+ }
3844
+ ),
3845
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `flex-1 flex flex-col min-h-0 overflow-hidden ${isEmpty ? "invisible pointer-events-none" : "visible"}`, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ScrollArea, { ref: messagesContainerRef, className: "h-full", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col gap-2 px-4 py-3", children: [
3846
+ messages.map((message, index) => {
3847
+ const isUser = message.role === "user";
3848
+ const previousRole = index > 0 ? messages[index - 1].role : void 0;
3849
+ const isRoleChange = previousRole !== void 0 && previousRole !== message.role;
3850
+ const currentGuide = activeGuideRef.current || activeGuide;
3851
+ let isCurrentGuideStep = false;
3852
+ if (currentGuide && message.kind === "guideStep") {
3853
+ if (message.guideStepIndex !== void 0) {
3854
+ isCurrentGuideStep = message.guideStepIndex === currentGuide.stepIndex;
3855
+ } else {
3560
3856
  isCurrentGuideStep = index === messages.length - 1;
3561
3857
  }
3562
- if (message.kind === "guideStep" && !isCurrentGuideStep) {
3563
- return null;
3564
- }
3565
- if (isUser) {
3566
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `flex justify-end ${isRoleChange ? "mt-3" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "max-w-[260px] rounded-2xl rounded-br-md bg-gray-900 px-3 py-2 text-sm text-white shadow-sm", children: message.content }) }, message.id);
3567
- }
3568
- if (message.role === "agent") {
3569
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex flex-col items-start ${isRoleChange ? "mt-3" : ""}`, children: [
3570
- isRoleChange && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[10px] text-gray-500 mb-1 ml-1", children: "Agent" }),
3571
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "max-w-[300px] rounded-2xl rounded-bl-md bg-gray-100 px-4 py-3 text-sm text-gray-700", children: message.content })
3572
- ] }, message.id);
3573
- }
3574
- if (message.kind === "searchSummary") {
3575
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3576
- "div",
3858
+ } else if (message.kind === "guideComplete") {
3859
+ isCurrentGuideStep = index === messages.length - 1;
3860
+ }
3861
+ if (message.kind === "guideStep" && !isCurrentGuideStep) {
3862
+ return null;
3863
+ }
3864
+ if (isUser) {
3865
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex flex-col items-end gap-2 ${isRoleChange ? "mt-3" : ""}`, children: [
3866
+ message.imageUrls && message.imageUrls.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-wrap gap-1 justify-end max-w-[260px]", children: message.imageUrls.map((url, imgIndex) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3867
+ "button",
3577
3868
  {
3578
- className: `${isRoleChange ? "mt-3" : ""}`,
3869
+ onClick: () => setLightboxImageUrl(url),
3870
+ className: "block cursor-pointer",
3579
3871
  children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3580
- AssistantSearchSummary,
3872
+ "img",
3581
3873
  {
3582
- title: message.title ?? "Search results",
3583
- links: message.links ?? []
3874
+ src: url,
3875
+ alt: `Attachment ${imgIndex + 1}`,
3876
+ className: "max-h-32 max-w-[200px] rounded-lg object-cover border border-gray-700 hover:opacity-90 transition-opacity"
3584
3877
  }
3585
3878
  )
3586
3879
  },
3587
- message.id
3588
- );
3880
+ imgIndex
3881
+ )) }),
3882
+ message.content && !message.content.match(/^!\[image\]\([^)]+\)(\n!\[image\]\([^)]+\))*$/) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "max-w-[260px] rounded-2xl rounded-br-md bg-gray-900 px-3 py-2 text-sm text-white shadow-sm", children: message.content.replace(/!\[image\]\([^)]+\)\n*/g, "").trim() })
3883
+ ] }, message.id);
3884
+ }
3885
+ if (message.role === "agent") {
3886
+ const imageRegex = /!\[image\]\(([^)]+)\)/g;
3887
+ const extractedImageUrls = [];
3888
+ let match;
3889
+ const contentStr = message.content || "";
3890
+ while ((match = imageRegex.exec(contentStr)) !== null) {
3891
+ extractedImageUrls.push(match[1]);
3589
3892
  }
3590
- if (message.kind === "guideComplete") {
3591
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3592
- "div",
3893
+ const agentImageUrls = message.imageUrls || extractedImageUrls;
3894
+ const agentTextContent = contentStr.replace(/!\[image\]\([^)]+\)\n*/g, "").trim();
3895
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex flex-col items-start gap-2 ${isRoleChange ? "mt-3" : ""}`, children: [
3896
+ isRoleChange && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[10px] text-gray-500 mb-1 ml-1", children: "Agent" }),
3897
+ agentImageUrls.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-wrap gap-1 justify-start max-w-[300px]", children: agentImageUrls.map((url, imgIndex) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3898
+ "button",
3593
3899
  {
3594
- ref: isCurrentGuideStep ? currentStepRef : null,
3595
- className: `${isRoleChange ? "mt-3" : ""}`,
3596
- children: /* @__PURE__ */ (0, import_jsx_runtime10.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: [
3597
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CheckCircle2, { className: "h-5 w-5 text-green-600 flex-shrink-0" }),
3598
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "font-medium text-green-800", children: message.content })
3599
- ] })
3900
+ onClick: () => setLightboxImageUrl(url),
3901
+ className: "block cursor-pointer",
3902
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3903
+ "img",
3904
+ {
3905
+ src: url,
3906
+ alt: `Attachment ${imgIndex + 1}`,
3907
+ className: "max-h-32 max-w-[200px] rounded-lg object-cover border border-gray-300 hover:opacity-90 transition-opacity"
3908
+ }
3909
+ )
3600
3910
  },
3601
- message.id
3602
- );
3603
- }
3604
- if (message.kind === "navigationAction") {
3605
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3911
+ imgIndex
3912
+ )) }),
3913
+ agentTextContent && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "max-w-[300px] rounded-2xl rounded-bl-md bg-gray-100 px-4 py-3 text-sm text-gray-700", children: agentTextContent })
3914
+ ] }, message.id);
3915
+ }
3916
+ if (message.kind === "searchSummary") {
3917
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3918
+ "div",
3919
+ {
3920
+ className: `${isRoleChange ? "mt-3" : ""}`,
3921
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3922
+ AssistantSearchSummary,
3923
+ {
3924
+ title: message.title ?? "Search results",
3925
+ links: message.links ?? []
3926
+ }
3927
+ )
3928
+ },
3929
+ message.id
3930
+ );
3931
+ }
3932
+ if (message.kind === "guideComplete") {
3933
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3934
+ "div",
3935
+ {
3936
+ ref: isCurrentGuideStep ? currentStepRef : null,
3937
+ className: `${isRoleChange ? "mt-3" : ""}`,
3938
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.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: [
3939
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CheckCircle2, { className: "h-5 w-5 text-green-600 flex-shrink-0" }),
3940
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "font-medium text-green-800", children: message.content })
3941
+ ] })
3942
+ },
3943
+ message.id
3944
+ );
3945
+ }
3946
+ if (message.kind === "navigationAction") {
3947
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3948
+ "div",
3949
+ {
3950
+ className: `${isRoleChange ? "mt-3" : ""}`,
3951
+ children: [
3952
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-2 text-gray-700", children: message.content || "" }),
3953
+ message.navigationTarget && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3954
+ Button,
3955
+ {
3956
+ type: "button",
3957
+ size: "sm",
3958
+ variant: "secondary",
3959
+ className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
3960
+ onClick: () => message.navigationTarget && handleConfirmNavigation(
3961
+ message.navigationTarget
3962
+ ),
3963
+ children: [
3964
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Confirm" }),
3965
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
3966
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
3967
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
3968
+ ] })
3969
+ ]
3970
+ }
3971
+ ) })
3972
+ ]
3973
+ },
3974
+ message.id
3975
+ );
3976
+ }
3977
+ if (message.kind === "actionForm") {
3978
+ const actionType = message.actionType;
3979
+ const formData = Object.keys(actionFormData).length > 0 ? actionFormData : message.actionData || {};
3980
+ if (message.isSubmitted) {
3981
+ let successContent = "";
3982
+ if (actionType === "updateCompanyInfo") {
3983
+ successContent = "Company information has been updated successfully.";
3984
+ } else if (actionType === "addApiKey") {
3985
+ successContent = "API key has been added successfully.";
3986
+ } else if (actionType === "addCustomer") {
3987
+ successContent = "Customer has been added successfully.";
3988
+ } else if (actionType === "enable2FA") {
3989
+ successContent = "Two-factor authentication has been enabled successfully.";
3990
+ } else if (actionType === "disable2FA") {
3991
+ successContent = "Two-factor authentication has been disabled successfully.";
3992
+ } else if (actionType === "changePassword") {
3993
+ successContent = "Your password has been changed successfully.";
3994
+ } else if (actionType === "revokeSession") {
3995
+ successContent = "Session has been revoked successfully.";
3996
+ } else if (actionType === "toggleNotification") {
3997
+ successContent = "Notification preferences have been updated successfully.";
3998
+ } else if (actionType === "connectIntegration") {
3999
+ successContent = "Integration has been connected successfully.";
4000
+ } else if (actionType === "disconnectIntegration") {
4001
+ successContent = "Integration has been disconnected successfully.";
4002
+ } else if (actionType === "addPaymentMethod") {
4003
+ successContent = "Payment method has been added successfully.";
4004
+ } else if (actionType === "removePaymentMethod") {
4005
+ successContent = "Payment method has been removed successfully.";
4006
+ } else if (actionType === "deleteApiKey") {
4007
+ successContent = "API key has been deleted successfully.";
4008
+ } else if (actionType === "addWebhook") {
4009
+ successContent = "Webhook endpoint has been added successfully.";
4010
+ } else if (actionType === "updateCurrency") {
4011
+ successContent = "Currency preference has been updated successfully.";
4012
+ } else if (actionType === "updateTimezone") {
4013
+ successContent = "Timezone has been updated successfully.";
4014
+ } else if (actionType === "refundPayment") {
4015
+ successContent = "Refund has been processed successfully.";
4016
+ } else if (actionType === "exportCertificate") {
4017
+ successContent = "Certificate of Incorporation has been downloaded successfully.";
4018
+ } else if (actionType === "createSubscription") {
4019
+ successContent = "Subscription has been created successfully.";
4020
+ } else if (actionType === "toggleBlockRule" || actionType === "enableBlockRule" || actionType === "disableBlockRule") {
4021
+ successContent = "Block rule has been updated successfully.";
4022
+ } else {
4023
+ successContent = "Action completed successfully.";
4024
+ }
4025
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3606
4026
  "div",
3607
4027
  {
3608
4028
  className: `${isRoleChange ? "mt-3" : ""}`,
3609
- children: [
3610
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-2 text-gray-700", children: message.content || "" }),
3611
- message.navigationTarget && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3612
- Button,
3613
- {
3614
- type: "button",
3615
- size: "sm",
3616
- variant: "secondary",
3617
- className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
3618
- onClick: () => message.navigationTarget && handleConfirmNavigation(
3619
- message.navigationTarget
3620
- ),
3621
- children: [
3622
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Confirm" }),
3623
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
3624
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
3625
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
3626
- ] })
3627
- ]
3628
- }
3629
- ) })
3630
- ]
4029
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 text-gray-700", children: successContent })
3631
4030
  },
3632
4031
  message.id
3633
4032
  );
3634
4033
  }
3635
- if (message.kind === "actionForm") {
3636
- const actionType = message.actionType;
3637
- const formData = Object.keys(actionFormData).length > 0 ? actionFormData : message.actionData || {};
3638
- if (message.isSubmitted) {
3639
- let successContent = "";
3640
- if (actionType === "updateCompanyInfo") {
3641
- successContent = "Company information has been updated successfully.";
3642
- } else if (actionType === "addApiKey") {
3643
- successContent = "API key has been added successfully.";
3644
- } else if (actionType === "addCustomer") {
3645
- successContent = "Customer has been added successfully.";
3646
- } else if (actionType === "enable2FA") {
3647
- successContent = "Two-factor authentication has been enabled successfully.";
3648
- } else if (actionType === "disable2FA") {
3649
- successContent = "Two-factor authentication has been disabled successfully.";
3650
- } else if (actionType === "changePassword") {
3651
- successContent = "Your password has been changed successfully.";
3652
- } else if (actionType === "revokeSession") {
3653
- successContent = "Session has been revoked successfully.";
3654
- } else if (actionType === "toggleNotification") {
3655
- successContent = "Notification preferences have been updated successfully.";
3656
- } else if (actionType === "connectIntegration") {
3657
- successContent = "Integration has been connected successfully.";
3658
- } else if (actionType === "disconnectIntegration") {
3659
- successContent = "Integration has been disconnected successfully.";
3660
- } else if (actionType === "addPaymentMethod") {
3661
- successContent = "Payment method has been added successfully.";
3662
- } else if (actionType === "removePaymentMethod") {
3663
- successContent = "Payment method has been removed successfully.";
3664
- } else if (actionType === "deleteApiKey") {
3665
- successContent = "API key has been deleted successfully.";
3666
- } else if (actionType === "addWebhook") {
3667
- successContent = "Webhook endpoint has been added successfully.";
3668
- } else if (actionType === "updateCurrency") {
3669
- successContent = "Currency preference has been updated successfully.";
3670
- } else if (actionType === "updateTimezone") {
3671
- successContent = "Timezone has been updated successfully.";
3672
- } else if (actionType === "refundPayment") {
3673
- successContent = "Refund has been processed successfully.";
3674
- } else if (actionType === "exportCertificate") {
3675
- successContent = "Certificate of Incorporation has been downloaded successfully.";
3676
- } else if (actionType === "createSubscription") {
3677
- successContent = "Subscription has been created successfully.";
3678
- } else if (actionType === "toggleBlockRule" || actionType === "enableBlockRule" || actionType === "disableBlockRule") {
3679
- successContent = "Block rule has been updated successfully.";
3680
- } else {
3681
- successContent = "Action completed successfully.";
3682
- }
3683
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3684
- "div",
3685
- {
3686
- className: `${isRoleChange ? "mt-3" : ""}`,
3687
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 text-gray-700", children: successContent })
3688
- },
3689
- message.id
3690
- );
3691
- }
3692
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3693
- "div",
3694
- {
3695
- className: `min-w-0 ${isRoleChange ? "mt-3" : ""}`,
3696
- children: [
3697
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
3698
- actionType === "updateCompanyInfo" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-2 bg-gray-50 rounded-lg p-2 border border-gray-200 overflow-hidden", children: [
3699
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
3700
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3701
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
3702
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3703
- Input,
3704
- {
3705
- placeholder: "Acme Corporation",
3706
- value: formData.companyName || "",
3707
- onChange: (e) => setActionFormData({
3708
- ...actionFormData,
3709
- companyName: e.target.value
3710
- }),
3711
- className: "h-8 text-xs border-gray-200"
3712
- }
3713
- )
3714
- ] }),
3715
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3716
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
3717
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3718
- Input,
3719
- {
3720
- type: "email",
3721
- placeholder: "contact@acme.com",
3722
- value: formData.email || "",
3723
- onChange: (e) => setActionFormData({
3724
- ...actionFormData,
3725
- email: e.target.value
3726
- }),
3727
- className: "h-8 text-xs border-gray-200"
3728
- }
3729
- )
3730
- ] })
3731
- ] }),
4034
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4035
+ "div",
4036
+ {
4037
+ className: `min-w-0 ${isRoleChange ? "mt-3" : ""}`,
4038
+ children: [
4039
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
4040
+ actionType === "updateCompanyInfo" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-2 bg-gray-50 rounded-lg p-2 border border-gray-200 overflow-hidden", children: [
4041
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
3732
4042
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3733
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Address" }),
4043
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
3734
4044
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3735
4045
  Input,
3736
4046
  {
3737
- placeholder: "123 Main St, San Francisco, CA",
3738
- value: formData.address || "",
4047
+ placeholder: "Acme Corporation",
4048
+ value: formData.companyName || "",
3739
4049
  onChange: (e) => setActionFormData({
3740
4050
  ...actionFormData,
3741
- address: e.target.value
4051
+ companyName: e.target.value
3742
4052
  }),
3743
4053
  className: "h-8 text-xs border-gray-200"
3744
4054
  }
3745
4055
  )
3746
4056
  ] }),
3747
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
3748
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3749
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Phone" }),
3750
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3751
- Input,
3752
- {
3753
- type: "tel",
3754
- placeholder: "+1 (555) 123-4567",
3755
- value: formData.phone || "",
3756
- onChange: (e) => setActionFormData({
3757
- ...actionFormData,
3758
- phone: e.target.value
3759
- }),
3760
- className: "h-8 text-xs border-gray-200"
3761
- }
3762
- )
3763
- ] }),
3764
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3765
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Website" }),
3766
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3767
- Input,
3768
- {
3769
- type: "url",
3770
- placeholder: "https://acme.com",
3771
- value: formData.website || "",
3772
- onChange: (e) => setActionFormData({
3773
- ...actionFormData,
3774
- website: e.target.value
3775
- }),
3776
- className: "h-8 text-xs border-gray-200"
3777
- }
3778
- )
3779
- ] })
4057
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4058
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
4059
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4060
+ Input,
4061
+ {
4062
+ type: "email",
4063
+ placeholder: "contact@acme.com",
4064
+ value: formData.email || "",
4065
+ onChange: (e) => setActionFormData({
4066
+ ...actionFormData,
4067
+ email: e.target.value
4068
+ }),
4069
+ className: "h-8 text-xs border-gray-200"
4070
+ }
4071
+ )
3780
4072
  ] })
3781
4073
  ] }),
3782
- actionType === "addApiKey" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3783
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name" }),
4074
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4075
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Address" }),
3784
4076
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3785
4077
  Input,
3786
4078
  {
3787
- placeholder: "Production Key",
3788
- value: formData.name || "",
4079
+ placeholder: "123 Main St, San Francisco, CA",
4080
+ value: formData.address || "",
3789
4081
  onChange: (e) => setActionFormData({
3790
4082
  ...actionFormData,
3791
- name: e.target.value
4083
+ address: e.target.value
3792
4084
  }),
3793
4085
  className: "h-8 text-xs border-gray-200"
3794
4086
  }
3795
4087
  )
3796
- ] }) }),
3797
- actionType === "addCustomer" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-2 bg-gray-50 rounded-lg p-2 border border-gray-200 overflow-hidden", children: [
3798
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
3799
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3800
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
3801
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3802
- Input,
3803
- {
3804
- placeholder: "Acme Corporation",
3805
- value: formData.name || "",
3806
- onChange: (e) => setActionFormData({
3807
- ...actionFormData,
3808
- name: e.target.value
3809
- }),
3810
- className: "h-8 text-xs border-gray-200"
3811
- }
3812
- )
3813
- ] }),
3814
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3815
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
3816
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3817
- Input,
3818
- {
3819
- type: "email",
3820
- placeholder: "contact@acme.com",
3821
- value: formData.email || "",
3822
- onChange: (e) => setActionFormData({
3823
- ...actionFormData,
3824
- email: e.target.value
3825
- }),
3826
- className: "h-8 text-xs border-gray-200"
3827
- }
3828
- )
3829
- ] })
3830
- ] }),
4088
+ ] }),
4089
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
3831
4090
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3832
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Location" }),
4091
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Phone" }),
3833
4092
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3834
4093
  Input,
3835
4094
  {
3836
- placeholder: "San Francisco, CA",
3837
- value: formData.location || "",
4095
+ type: "tel",
4096
+ placeholder: "+1 (555) 123-4567",
4097
+ value: formData.phone || "",
3838
4098
  onChange: (e) => setActionFormData({
3839
4099
  ...actionFormData,
3840
- location: e.target.value
4100
+ phone: e.target.value
3841
4101
  }),
3842
4102
  className: "h-8 text-xs border-gray-200"
3843
4103
  }
3844
4104
  )
3845
4105
  ] }),
3846
4106
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3847
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Subscription Tier" }),
3848
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3849
- "select",
4107
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Website" }),
4108
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4109
+ Input,
3850
4110
  {
3851
- value: formData.subscription || "Starter",
4111
+ type: "url",
4112
+ placeholder: "https://acme.com",
4113
+ value: formData.website || "",
3852
4114
  onChange: (e) => setActionFormData({
3853
4115
  ...actionFormData,
3854
- subscription: e.target.value
4116
+ website: e.target.value
3855
4117
  }),
3856
- 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",
3857
- children: [
3858
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Starter", children: "Starter" }),
3859
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Professional", children: "Professional" }),
3860
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Enterprise", children: "Enterprise" })
3861
- ]
4118
+ className: "h-8 text-xs border-gray-200"
3862
4119
  }
3863
4120
  )
3864
4121
  ] })
3865
- ] }),
3866
- (actionType === "enable2FA" || actionType === "disable2FA") && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.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." }) }),
3867
- actionType === "changePassword" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4122
+ ] })
4123
+ ] }),
4124
+ actionType === "addApiKey" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4125
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name" }),
4126
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4127
+ Input,
4128
+ {
4129
+ placeholder: "Production Key",
4130
+ value: formData.name || "",
4131
+ onChange: (e) => setActionFormData({
4132
+ ...actionFormData,
4133
+ name: e.target.value
4134
+ }),
4135
+ className: "h-8 text-xs border-gray-200"
4136
+ }
4137
+ )
4138
+ ] }) }),
4139
+ actionType === "addCustomer" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-2 bg-gray-50 rounded-lg p-2 border border-gray-200 overflow-hidden", children: [
4140
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
3868
4141
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3869
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Current Password" }),
4142
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
3870
4143
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3871
4144
  Input,
3872
4145
  {
3873
- type: "password",
3874
- value: formData.currentPassword || "",
4146
+ placeholder: "Acme Corporation",
4147
+ value: formData.name || "",
3875
4148
  onChange: (e) => setActionFormData({
3876
4149
  ...actionFormData,
3877
- currentPassword: e.target.value
4150
+ name: e.target.value
3878
4151
  }),
3879
4152
  className: "h-8 text-xs border-gray-200"
3880
4153
  }
3881
4154
  )
3882
4155
  ] }),
3883
4156
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3884
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "New Password" }),
4157
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
3885
4158
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3886
4159
  Input,
3887
4160
  {
3888
- type: "password",
3889
- value: formData.newPassword || "",
4161
+ type: "email",
4162
+ placeholder: "contact@acme.com",
4163
+ value: formData.email || "",
3890
4164
  onChange: (e) => setActionFormData({
3891
4165
  ...actionFormData,
3892
- newPassword: e.target.value
3893
- }),
3894
- className: "h-8 text-xs border-gray-200"
3895
- }
3896
- )
3897
- ] }),
3898
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3899
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Confirm New Password" }),
3900
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3901
- Input,
3902
- {
3903
- type: "password",
3904
- value: formData.confirmPassword || "",
3905
- onChange: (e) => setActionFormData({
3906
- ...actionFormData,
3907
- confirmPassword: e.target.value
4166
+ email: e.target.value
3908
4167
  }),
3909
4168
  className: "h-8 text-xs border-gray-200"
3910
4169
  }
3911
4170
  )
3912
4171
  ] })
3913
4172
  ] }),
3914
- actionType === "toggleNotification" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3915
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3916
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Notification Type" }),
3917
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3918
- "select",
3919
- {
3920
- value: formData.notificationType || "paymentReceived",
3921
- onChange: (e) => setActionFormData({
3922
- ...actionFormData,
3923
- notificationType: e.target.value
3924
- }),
3925
- 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",
3926
- children: [
3927
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "paymentReceived", children: "Payment Received" }),
3928
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "paymentFailed", children: "Payment Failed" }),
3929
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "invoicePaid", children: "Invoice Paid" }),
3930
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "monthlySummary", children: "Monthly Summary" }),
3931
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "productUpdates", children: "Product Updates" })
3932
- ]
3933
- }
3934
- )
3935
- ] }),
3936
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2", children: [
3937
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3938
- "input",
3939
- {
3940
- type: "checkbox",
3941
- checked: formData.enabled !== false,
3942
- onChange: (e) => setActionFormData({
3943
- ...actionFormData,
3944
- enabled: e.target.checked
3945
- }),
3946
- className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
3947
- }
3948
- ),
3949
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs text-black", children: "Enable this notification" })
3950
- ] })
4173
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4174
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Location" }),
4175
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4176
+ Input,
4177
+ {
4178
+ placeholder: "San Francisco, CA",
4179
+ value: formData.location || "",
4180
+ onChange: (e) => setActionFormData({
4181
+ ...actionFormData,
4182
+ location: e.target.value
4183
+ }),
4184
+ className: "h-8 text-xs border-gray-200"
4185
+ }
4186
+ )
3951
4187
  ] }),
3952
- (actionType === "connectIntegration" || actionType === "disconnectIntegration") && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3953
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Integration" }),
4188
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4189
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Subscription Tier" }),
3954
4190
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3955
4191
  "select",
3956
4192
  {
3957
- value: formData.integrationName || "Slack",
4193
+ value: formData.subscription || "Starter",
3958
4194
  onChange: (e) => setActionFormData({
3959
4195
  ...actionFormData,
3960
- integrationName: e.target.value
4196
+ subscription: e.target.value
3961
4197
  }),
3962
4198
  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",
3963
4199
  children: [
3964
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Slack", children: "Slack" }),
3965
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Zapier", children: "Zapier" }),
3966
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Webhook", children: "Webhook" })
4200
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Starter", children: "Starter" }),
4201
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Professional", children: "Professional" }),
4202
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Enterprise", children: "Enterprise" })
3967
4203
  ]
3968
4204
  }
3969
4205
  )
3970
- ] }) }),
3971
- actionType === "addPaymentMethod" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3972
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3973
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Card Number" }),
3974
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3975
- Input,
3976
- {
3977
- placeholder: "1234 5678 9012 3456",
3978
- value: formData.cardNumber || "",
3979
- onChange: (e) => setActionFormData({
3980
- ...actionFormData,
3981
- cardNumber: e.target.value
3982
- }),
3983
- className: "h-8 text-xs border-gray-200"
3984
- }
3985
- )
3986
- ] }),
3987
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3988
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Expiry Date" }),
3989
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3990
- Input,
3991
- {
3992
- placeholder: "MM/YY",
3993
- value: formData.expiryDate || "",
3994
- onChange: (e) => setActionFormData({
3995
- ...actionFormData,
3996
- expiryDate: e.target.value
3997
- }),
3998
- className: "h-8 text-xs border-gray-200"
3999
- }
4000
- )
4001
- ] })
4206
+ ] })
4207
+ ] }),
4208
+ (actionType === "enable2FA" || actionType === "disable2FA") && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.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." }) }),
4209
+ actionType === "changePassword" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4210
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4211
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Current Password" }),
4212
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4213
+ Input,
4214
+ {
4215
+ type: "password",
4216
+ value: formData.currentPassword || "",
4217
+ onChange: (e) => setActionFormData({
4218
+ ...actionFormData,
4219
+ currentPassword: e.target.value
4220
+ }),
4221
+ className: "h-8 text-xs border-gray-200"
4222
+ }
4223
+ )
4002
4224
  ] }),
4003
- actionType === "removePaymentMethod" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-black", children: "This will remove the default payment method from your account." }) }),
4004
- actionType === "refundPayment" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4005
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4006
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Transaction ID or Customer Name" }),
4007
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4008
- Input,
4009
- {
4010
- placeholder: "e.g., txn_1234 or Acme Corp",
4011
- value: formData.transactionId || formData.customer || "",
4012
- onChange: (e) => {
4013
- const value = e.target.value;
4014
- if (value.startsWith("txn_") || /^\d+$/.test(value)) {
4015
- setActionFormData({
4016
- ...actionFormData,
4017
- transactionId: value,
4018
- customer: void 0
4019
- });
4020
- } else {
4021
- setActionFormData({
4022
- ...actionFormData,
4023
- customer: value,
4024
- transactionId: void 0
4025
- });
4026
- }
4027
- },
4028
- className: "h-8 text-xs border-gray-200"
4029
- }
4030
- )
4031
- ] }),
4032
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4033
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Amount (optional)" }),
4034
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4035
- Input,
4036
- {
4037
- placeholder: "$0.00",
4038
- value: formData.amount || "",
4039
- onChange: (e) => setActionFormData({
4040
- ...actionFormData,
4041
- amount: e.target.value
4042
- }),
4043
- className: "h-8 text-xs border-gray-200"
4044
- }
4045
- )
4046
- ] }),
4047
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4048
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Reason (optional)" }),
4049
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4050
- Input,
4051
- {
4052
- placeholder: "e.g., Customer request",
4053
- value: formData.reason || "",
4054
- onChange: (e) => setActionFormData({
4055
- ...actionFormData,
4056
- reason: e.target.value
4057
- }),
4058
- className: "h-8 text-xs border-gray-200"
4059
- }
4060
- )
4061
- ] })
4225
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4226
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "New Password" }),
4227
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4228
+ Input,
4229
+ {
4230
+ type: "password",
4231
+ value: formData.newPassword || "",
4232
+ onChange: (e) => setActionFormData({
4233
+ ...actionFormData,
4234
+ newPassword: e.target.value
4235
+ }),
4236
+ className: "h-8 text-xs border-gray-200"
4237
+ }
4238
+ )
4062
4239
  ] }),
4063
- actionType === "deleteApiKey" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4064
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4065
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name or ID" }),
4066
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4067
- Input,
4068
- {
4069
- placeholder: "Production Key",
4070
- value: formData.keyId || formData.name || "",
4071
- onChange: (e) => setActionFormData({
4072
- ...actionFormData,
4073
- keyId: e.target.value,
4074
- name: e.target.value
4075
- }),
4076
- className: "h-8 text-xs border-gray-200"
4077
- }
4078
- )
4079
- ] }),
4080
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-red-600", children: "Warning: This action cannot be undone. The API key will be permanently deleted." })
4240
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4241
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Confirm New Password" }),
4242
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4243
+ Input,
4244
+ {
4245
+ type: "password",
4246
+ value: formData.confirmPassword || "",
4247
+ onChange: (e) => setActionFormData({
4248
+ ...actionFormData,
4249
+ confirmPassword: e.target.value
4250
+ }),
4251
+ className: "h-8 text-xs border-gray-200"
4252
+ }
4253
+ )
4254
+ ] })
4255
+ ] }),
4256
+ actionType === "toggleNotification" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4257
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4258
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Notification Type" }),
4259
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4260
+ "select",
4261
+ {
4262
+ value: formData.notificationType || "paymentReceived",
4263
+ onChange: (e) => setActionFormData({
4264
+ ...actionFormData,
4265
+ notificationType: e.target.value
4266
+ }),
4267
+ 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",
4268
+ children: [
4269
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "paymentReceived", children: "Payment Received" }),
4270
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "paymentFailed", children: "Payment Failed" }),
4271
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "invoicePaid", children: "Invoice Paid" }),
4272
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "monthlySummary", children: "Monthly Summary" }),
4273
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "productUpdates", children: "Product Updates" })
4274
+ ]
4275
+ }
4276
+ )
4081
4277
  ] }),
4082
- actionType === "addWebhook" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4083
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4084
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Webhook URL" }),
4085
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4086
- Input,
4087
- {
4088
- type: "url",
4089
- placeholder: "https://example.com/webhook",
4090
- value: formData.url || "",
4091
- onChange: (e) => setActionFormData({
4092
- ...actionFormData,
4093
- url: e.target.value
4094
- }),
4095
- className: "h-8 text-xs border-gray-200"
4096
- }
4097
- )
4098
- ] }),
4099
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4100
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Name (optional)" }),
4101
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4102
- Input,
4103
- {
4104
- placeholder: "Production Webhook",
4105
- value: formData.name || "",
4106
- onChange: (e) => setActionFormData({
4107
- ...actionFormData,
4108
- name: e.target.value
4109
- }),
4110
- className: "h-8 text-xs border-gray-200"
4111
- }
4112
- )
4113
- ] })
4278
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2", children: [
4279
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4280
+ "input",
4281
+ {
4282
+ type: "checkbox",
4283
+ checked: formData.enabled !== false,
4284
+ onChange: (e) => setActionFormData({
4285
+ ...actionFormData,
4286
+ enabled: e.target.checked
4287
+ }),
4288
+ className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
4289
+ }
4290
+ ),
4291
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs text-black", children: "Enable this notification" })
4292
+ ] })
4293
+ ] }),
4294
+ (actionType === "connectIntegration" || actionType === "disconnectIntegration") && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4295
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Integration" }),
4296
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4297
+ "select",
4298
+ {
4299
+ value: formData.integrationName || "Slack",
4300
+ onChange: (e) => setActionFormData({
4301
+ ...actionFormData,
4302
+ integrationName: e.target.value
4303
+ }),
4304
+ 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",
4305
+ children: [
4306
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Slack", children: "Slack" }),
4307
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Zapier", children: "Zapier" }),
4308
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Webhook", children: "Webhook" })
4309
+ ]
4310
+ }
4311
+ )
4312
+ ] }) }),
4313
+ actionType === "addPaymentMethod" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4314
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4315
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Card Number" }),
4316
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4317
+ Input,
4318
+ {
4319
+ placeholder: "1234 5678 9012 3456",
4320
+ value: formData.cardNumber || "",
4321
+ onChange: (e) => setActionFormData({
4322
+ ...actionFormData,
4323
+ cardNumber: e.target.value
4324
+ }),
4325
+ className: "h-8 text-xs border-gray-200"
4326
+ }
4327
+ )
4328
+ ] }),
4329
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4330
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Expiry Date" }),
4331
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4332
+ Input,
4333
+ {
4334
+ placeholder: "MM/YY",
4335
+ value: formData.expiryDate || "",
4336
+ onChange: (e) => setActionFormData({
4337
+ ...actionFormData,
4338
+ expiryDate: e.target.value
4339
+ }),
4340
+ className: "h-8 text-xs border-gray-200"
4341
+ }
4342
+ )
4343
+ ] })
4344
+ ] }),
4345
+ actionType === "removePaymentMethod" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-black", children: "This will remove the default payment method from your account." }) }),
4346
+ actionType === "refundPayment" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4347
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4348
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Transaction ID or Customer Name" }),
4349
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4350
+ Input,
4351
+ {
4352
+ placeholder: "e.g., txn_1234 or Acme Corp",
4353
+ value: formData.transactionId || formData.customer || "",
4354
+ onChange: (e) => {
4355
+ const value = e.target.value;
4356
+ if (value.startsWith("txn_") || /^\d+$/.test(value)) {
4357
+ setActionFormData({
4358
+ ...actionFormData,
4359
+ transactionId: value,
4360
+ customer: void 0
4361
+ });
4362
+ } else {
4363
+ setActionFormData({
4364
+ ...actionFormData,
4365
+ customer: value,
4366
+ transactionId: void 0
4367
+ });
4368
+ }
4369
+ },
4370
+ className: "h-8 text-xs border-gray-200"
4371
+ }
4372
+ )
4114
4373
  ] }),
4115
- actionType === "updateCurrency" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4116
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Currency" }),
4374
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4375
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Amount (optional)" }),
4376
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4377
+ Input,
4378
+ {
4379
+ placeholder: "$0.00",
4380
+ value: formData.amount || "",
4381
+ onChange: (e) => setActionFormData({
4382
+ ...actionFormData,
4383
+ amount: e.target.value
4384
+ }),
4385
+ className: "h-8 text-xs border-gray-200"
4386
+ }
4387
+ )
4388
+ ] }),
4389
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4390
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Reason (optional)" }),
4391
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4392
+ Input,
4393
+ {
4394
+ placeholder: "e.g., Customer request",
4395
+ value: formData.reason || "",
4396
+ onChange: (e) => setActionFormData({
4397
+ ...actionFormData,
4398
+ reason: e.target.value
4399
+ }),
4400
+ className: "h-8 text-xs border-gray-200"
4401
+ }
4402
+ )
4403
+ ] })
4404
+ ] }),
4405
+ actionType === "deleteApiKey" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4406
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4407
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name or ID" }),
4408
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4409
+ Input,
4410
+ {
4411
+ placeholder: "Production Key",
4412
+ value: formData.keyId || formData.name || "",
4413
+ onChange: (e) => setActionFormData({
4414
+ ...actionFormData,
4415
+ keyId: e.target.value,
4416
+ name: e.target.value
4417
+ }),
4418
+ className: "h-8 text-xs border-gray-200"
4419
+ }
4420
+ )
4421
+ ] }),
4422
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-red-600", children: "Warning: This action cannot be undone. The API key will be permanently deleted." })
4423
+ ] }),
4424
+ actionType === "addWebhook" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4425
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4426
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Webhook URL" }),
4427
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4428
+ Input,
4429
+ {
4430
+ type: "url",
4431
+ placeholder: "https://example.com/webhook",
4432
+ value: formData.url || "",
4433
+ onChange: (e) => setActionFormData({
4434
+ ...actionFormData,
4435
+ url: e.target.value
4436
+ }),
4437
+ className: "h-8 text-xs border-gray-200"
4438
+ }
4439
+ )
4440
+ ] }),
4441
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4442
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Name (optional)" }),
4443
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4444
+ Input,
4445
+ {
4446
+ placeholder: "Production Webhook",
4447
+ value: formData.name || "",
4448
+ onChange: (e) => setActionFormData({
4449
+ ...actionFormData,
4450
+ name: e.target.value
4451
+ }),
4452
+ className: "h-8 text-xs border-gray-200"
4453
+ }
4454
+ )
4455
+ ] })
4456
+ ] }),
4457
+ actionType === "updateCurrency" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4458
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Currency" }),
4459
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4460
+ "select",
4461
+ {
4462
+ value: formData.currency || "USD",
4463
+ onChange: (e) => setActionFormData({
4464
+ ...actionFormData,
4465
+ currency: e.target.value
4466
+ }),
4467
+ 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",
4468
+ children: [
4469
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "USD", children: "USD ($)" }),
4470
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "EUR", children: "EUR (\u20AC)" }),
4471
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "GBP", children: "GBP (\xA3)" }),
4472
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "JPY", children: "JPY (\xA5)" })
4473
+ ]
4474
+ }
4475
+ )
4476
+ ] }) }),
4477
+ actionType === "updateTimezone" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4478
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Timezone" }),
4479
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4480
+ "select",
4481
+ {
4482
+ value: formData.timezone || "America/Los_Angeles",
4483
+ onChange: (e) => setActionFormData({
4484
+ ...actionFormData,
4485
+ timezone: e.target.value
4486
+ }),
4487
+ 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",
4488
+ children: [
4489
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "America/Los_Angeles", children: "Pacific Time (PT)" }),
4490
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "America/New_York", children: "Eastern Time (ET)" }),
4491
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Europe/London", children: "GMT" }),
4492
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Asia/Tokyo", children: "JST" })
4493
+ ]
4494
+ }
4495
+ )
4496
+ ] }) }),
4497
+ actionType === "revokeSession" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4498
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4499
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Device/Session" }),
4500
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4501
+ Input,
4502
+ {
4503
+ placeholder: "MacBook Pro",
4504
+ value: formData.device || "",
4505
+ onChange: (e) => setActionFormData({
4506
+ ...actionFormData,
4507
+ device: e.target.value
4508
+ }),
4509
+ className: "h-8 text-xs border-gray-200"
4510
+ }
4511
+ )
4512
+ ] }),
4513
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-black", children: "This will sign out the device and invalidate its session." })
4514
+ ] }),
4515
+ actionType === "createSubscription" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4516
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4517
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Customer Email" }),
4518
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4519
+ Input,
4520
+ {
4521
+ type: "email",
4522
+ placeholder: "customer@example.com",
4523
+ value: formData.customerEmail || "",
4524
+ onChange: (e) => setActionFormData({
4525
+ ...actionFormData,
4526
+ customerEmail: e.target.value
4527
+ }),
4528
+ className: "h-8 text-xs border-gray-200"
4529
+ }
4530
+ )
4531
+ ] }),
4532
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4533
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Plan" }),
4117
4534
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4118
4535
  "select",
4119
4536
  {
4120
- value: formData.currency || "USD",
4537
+ value: formData.plan || "Starter",
4121
4538
  onChange: (e) => setActionFormData({
4122
4539
  ...actionFormData,
4123
- currency: e.target.value
4540
+ plan: e.target.value
4124
4541
  }),
4125
4542
  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",
4126
4543
  children: [
4127
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "USD", children: "USD ($)" }),
4128
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "EUR", children: "EUR (\u20AC)" }),
4129
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "GBP", children: "GBP (\xA3)" }),
4130
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "JPY", children: "JPY (\xA5)" })
4544
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Starter", children: "Starter ($29/mo)" }),
4545
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Professional", children: "Professional ($99/mo)" }),
4546
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Enterprise", children: "Enterprise ($299/mo)" })
4131
4547
  ]
4132
4548
  }
4133
4549
  )
4134
- ] }) }),
4135
- actionType === "updateTimezone" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4136
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Timezone" }),
4550
+ ] }),
4551
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4552
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Billing Cycle" }),
4137
4553
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4138
4554
  "select",
4139
4555
  {
4140
- value: formData.timezone || "America/Los_Angeles",
4556
+ value: formData.billingCycle || "monthly",
4141
4557
  onChange: (e) => setActionFormData({
4142
4558
  ...actionFormData,
4143
- timezone: e.target.value
4559
+ billingCycle: e.target.value
4144
4560
  }),
4145
4561
  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",
4146
4562
  children: [
4147
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "America/Los_Angeles", children: "Pacific Time (PT)" }),
4148
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "America/New_York", children: "Eastern Time (ET)" }),
4149
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Europe/London", children: "GMT" }),
4150
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Asia/Tokyo", children: "JST" })
4563
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "monthly", children: "Monthly" }),
4564
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "yearly", children: "Yearly (Save 15%)" })
4565
+ ]
4566
+ }
4567
+ )
4568
+ ] })
4569
+ ] }),
4570
+ actionType === "exportCertificate" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4571
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-black", children: "This will export your certificate of incorporation document." }),
4572
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4573
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Format" }),
4574
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4575
+ "select",
4576
+ {
4577
+ value: formData.format || "pdf",
4578
+ onChange: (e) => setActionFormData({
4579
+ ...actionFormData,
4580
+ format: e.target.value
4581
+ }),
4582
+ 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",
4583
+ children: [
4584
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "pdf", children: "PDF" }),
4585
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "json", children: "JSON" })
4586
+ ]
4587
+ }
4588
+ )
4589
+ ] })
4590
+ ] }),
4591
+ (actionType === "toggleBlockRule" || actionType === "enableBlockRule" || actionType === "disableBlockRule") && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4592
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4593
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Block Rule" }),
4594
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4595
+ "select",
4596
+ {
4597
+ value: formData.ruleId || "rule_1",
4598
+ onChange: (e) => setActionFormData({
4599
+ ...actionFormData,
4600
+ ruleId: e.target.value
4601
+ }),
4602
+ 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",
4603
+ children: [
4604
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_1", children: "Block if risk level = 'highest'" }),
4605
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_2", children: "Block if matches Stripe block lists" }),
4606
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_3", children: "Block if CVC verification fails" }),
4607
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_4", children: "Block if Postal code verification fails" })
4151
4608
  ]
4152
4609
  }
4153
4610
  )
4154
- ] }) }),
4155
- actionType === "revokeSession" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4156
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4157
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Device/Session" }),
4158
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4159
- Input,
4160
- {
4161
- placeholder: "MacBook Pro",
4162
- value: formData.device || "",
4163
- onChange: (e) => setActionFormData({
4164
- ...actionFormData,
4165
- device: e.target.value
4166
- }),
4167
- className: "h-8 text-xs border-gray-200"
4168
- }
4169
- )
4170
- ] }),
4171
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-black", children: "This will sign out the device and invalidate its session." })
4172
4611
  ] }),
4173
- actionType === "createSubscription" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4174
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4175
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Customer Email" }),
4176
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4177
- Input,
4178
- {
4179
- type: "email",
4180
- placeholder: "customer@example.com",
4181
- value: formData.customerEmail || "",
4182
- onChange: (e) => setActionFormData({
4183
- ...actionFormData,
4184
- customerEmail: e.target.value
4185
- }),
4186
- className: "h-8 text-xs border-gray-200"
4187
- }
4188
- )
4189
- ] }),
4190
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4191
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Plan" }),
4192
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4193
- "select",
4194
- {
4195
- value: formData.plan || "Starter",
4196
- onChange: (e) => setActionFormData({
4197
- ...actionFormData,
4198
- plan: e.target.value
4199
- }),
4200
- 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",
4201
- children: [
4202
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Starter", children: "Starter ($29/mo)" }),
4203
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Professional", children: "Professional ($99/mo)" }),
4204
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Enterprise", children: "Enterprise ($299/mo)" })
4205
- ]
4206
- }
4207
- )
4208
- ] }),
4209
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4210
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Billing Cycle" }),
4211
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4212
- "select",
4213
- {
4214
- value: formData.billingCycle || "monthly",
4215
- onChange: (e) => setActionFormData({
4216
- ...actionFormData,
4217
- billingCycle: e.target.value
4218
- }),
4219
- 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",
4220
- children: [
4221
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "monthly", children: "Monthly" }),
4222
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "yearly", children: "Yearly (Save 15%)" })
4223
- ]
4224
- }
4225
- )
4612
+ /* @__PURE__ */ (0, import_jsx_runtime10.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." })
4613
+ ] }),
4614
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4615
+ Button,
4616
+ {
4617
+ type: "button",
4618
+ size: "sm",
4619
+ variant: "secondary",
4620
+ className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4621
+ onClick: handleActionSubmit,
4622
+ children: [
4623
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Confirm" }),
4624
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
4625
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
4626
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
4627
+ ] })
4628
+ ]
4629
+ }
4630
+ ) })
4631
+ ]
4632
+ },
4633
+ message.id
4634
+ );
4635
+ }
4636
+ if (message.kind === "bulkPreview" && message.csvData) {
4637
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4638
+ "div",
4639
+ {
4640
+ className: `${isRoleChange ? "mt-3" : ""}`,
4641
+ children: [
4642
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
4643
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "bg-gray-50 rounded-lg border border-gray-200 overflow-hidden", children: [
4644
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "bg-gray-100 px-3 py-2 border-b border-gray-200 flex items-center gap-2", children: [
4645
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.FileSpreadsheet, { className: "h-4 w-4 text-gray-600" }),
4646
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs font-medium text-gray-700", children: message.csvData.fileName }),
4647
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-xs text-gray-500", children: [
4648
+ "\u2022 ",
4649
+ message.csvData.rowCount,
4650
+ " rows"
4226
4651
  ] })
4227
4652
  ] }),
4228
- actionType === "exportCertificate" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4229
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-black", children: "This will export your certificate of incorporation document." }),
4230
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4231
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Format" }),
4232
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4233
- "select",
4234
- {
4235
- value: formData.format || "pdf",
4236
- onChange: (e) => setActionFormData({
4237
- ...actionFormData,
4238
- format: e.target.value
4239
- }),
4240
- 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",
4241
- children: [
4242
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "pdf", children: "PDF" }),
4243
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "json", children: "JSON" })
4244
- ]
4245
- }
4246
- )
4247
- ] })
4653
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "px-3 py-2 border-b border-gray-100", children: [
4654
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-gray-500 mb-1", children: "Columns" }),
4655
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-wrap gap-1", children: message.csvData.columns.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4656
+ "span",
4657
+ {
4658
+ className: "text-xs bg-blue-100 text-blue-700 px-1.5 py-0.5 rounded",
4659
+ children: col
4660
+ },
4661
+ i
4662
+ )) })
4248
4663
  ] }),
4249
- (actionType === "toggleBlockRule" || actionType === "enableBlockRule" || actionType === "disableBlockRule") && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4250
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4251
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Block Rule" }),
4252
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4253
- "select",
4254
- {
4255
- value: formData.ruleId || "rule_1",
4256
- onChange: (e) => setActionFormData({
4257
- ...actionFormData,
4258
- ruleId: e.target.value
4259
- }),
4260
- 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",
4261
- children: [
4262
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_1", children: "Block if risk level = 'highest'" }),
4263
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_2", children: "Block if matches Stripe block lists" }),
4264
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_3", children: "Block if CVC verification fails" }),
4265
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_4", children: "Block if Postal code verification fails" })
4266
- ]
4267
- }
4268
- )
4269
- ] }),
4270
- /* @__PURE__ */ (0, import_jsx_runtime10.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." })
4664
+ message.csvData.sampleRows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "px-3 py-2", children: [
4665
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-gray-500 mb-1", children: "Sample Data" }),
4666
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-1", children: message.csvData.sampleRows.slice(0, 3).map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4667
+ "div",
4668
+ {
4669
+ className: "text-xs text-gray-600 bg-white rounded px-2 py-1 border border-gray-100",
4670
+ children: [
4671
+ Object.entries(row).slice(0, 3).map(([key, val], j) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
4672
+ j > 0 && " \u2022 ",
4673
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-gray-400", children: [
4674
+ key,
4675
+ ":"
4676
+ ] }),
4677
+ " ",
4678
+ val
4679
+ ] }, key)),
4680
+ Object.keys(row).length > 3 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-gray-400", children: [
4681
+ " ",
4682
+ "..."
4683
+ ] })
4684
+ ]
4685
+ },
4686
+ i
4687
+ )) })
4271
4688
  ] }),
4272
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4689
+ message.suggestedAction && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "px-3 py-2 bg-blue-50 border-t border-blue-100", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-xs text-blue-700", children: [
4690
+ "Suggested action:",
4691
+ " ",
4692
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: message.suggestedAction.replace(/_/g, " ") })
4693
+ ] }) })
4694
+ ] }),
4695
+ message.bulkSessionId && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
4696
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4273
4697
  Button,
4274
4698
  {
4275
4699
  type: "button",
4276
4700
  size: "sm",
4277
4701
  variant: "secondary",
4278
4702
  className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4279
- onClick: handleActionSubmit,
4703
+ onClick: () => message.bulkSessionId && confirmBulkOperation(message.bulkSessionId),
4280
4704
  children: [
4281
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Confirm" }),
4705
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
4706
+ "Process ",
4707
+ message.csvData.rowCount,
4708
+ " rows"
4709
+ ] }),
4282
4710
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
4283
4711
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
4284
4712
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
4285
4713
  ] })
4286
4714
  ]
4287
4715
  }
4288
- ) })
4289
- ]
4290
- },
4291
- message.id
4292
- );
4293
- }
4294
- if (message.kind === "bulkPreview" && message.csvData) {
4295
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4296
- "div",
4297
- {
4298
- className: `${isRoleChange ? "mt-3" : ""}`,
4299
- children: [
4300
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
4301
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "bg-gray-50 rounded-lg border border-gray-200 overflow-hidden", children: [
4302
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "bg-gray-100 px-3 py-2 border-b border-gray-200 flex items-center gap-2", children: [
4303
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.FileSpreadsheet, { className: "h-4 w-4 text-gray-600" }),
4304
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs font-medium text-gray-700", children: message.csvData.fileName }),
4305
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-xs text-gray-500", children: [
4306
- "\u2022 ",
4307
- message.csvData.rowCount,
4308
- " rows"
4309
- ] })
4310
- ] }),
4311
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "px-3 py-2 border-b border-gray-100", children: [
4312
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-gray-500 mb-1", children: "Columns" }),
4313
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-wrap gap-1", children: message.csvData.columns.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4314
- "span",
4716
+ ),
4717
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4718
+ Button,
4719
+ {
4720
+ type: "button",
4721
+ size: "sm",
4722
+ variant: "ghost",
4723
+ className: "h-8 rounded-xl px-3 text-xs text-gray-500 hover:text-gray-700 hover:bg-gray-100",
4724
+ onClick: cancelBulkOperation,
4725
+ children: "Cancel"
4726
+ }
4727
+ )
4728
+ ] })
4729
+ ]
4730
+ },
4731
+ message.id
4732
+ );
4733
+ }
4734
+ if (message.kind === "bulkProgress" && message.bulkProgress) {
4735
+ const { processed, total, successes, failures } = message.bulkProgress;
4736
+ const percentage = Math.round(processed / total * 100);
4737
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4738
+ "div",
4739
+ {
4740
+ className: `${isRoleChange ? "mt-3" : ""}`,
4741
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "bg-gray-50 rounded-lg border border-gray-200 p-3", children: [
4742
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [
4743
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Loader2, { className: "h-4 w-4 animate-spin text-blue-600" }),
4744
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-sm font-medium text-gray-700", children: [
4745
+ "Processing... ",
4746
+ processed,
4747
+ " of ",
4748
+ total
4749
+ ] })
4750
+ ] }),
4751
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "h-2 bg-gray-200 rounded-full overflow-hidden mb-2", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4752
+ "div",
4753
+ {
4754
+ className: "h-full bg-blue-600 transition-all duration-300",
4755
+ style: { width: `${percentage}%` }
4756
+ }
4757
+ ) }),
4758
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-3 text-xs text-gray-600", children: [
4759
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1", children: [
4760
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CheckCircle2, { className: "h-3 w-3 text-green-600" }),
4761
+ successes,
4762
+ " successful"
4763
+ ] }),
4764
+ failures > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1 text-red-600", children: [
4765
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-3 w-3" }),
4766
+ failures,
4767
+ " failed"
4768
+ ] })
4769
+ ] })
4770
+ ] })
4771
+ },
4772
+ message.id
4773
+ );
4774
+ }
4775
+ if (message.kind === "bulkSummary" && message.bulkSummary) {
4776
+ const { total, successes, failures, navigationPage } = message.bulkSummary;
4777
+ const hasFailures = failures.length > 0;
4778
+ const pageLabel = navigationPage?.page === "customers" ? "Customers" : navigationPage?.page === "dashboard" ? "Dashboard" : navigationPage?.page === "settings" ? "Settings" : "Results";
4779
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4780
+ "div",
4781
+ {
4782
+ className: `${isRoleChange ? "mt-3" : ""}`,
4783
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4784
+ "div",
4785
+ {
4786
+ className: `rounded-lg border p-3 ${hasFailures ? "bg-amber-50 border-amber-200" : "bg-green-50 border-green-200"}`,
4787
+ children: [
4788
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [
4789
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4790
+ import_lucide_react4.CheckCircle2,
4315
4791
  {
4316
- className: "text-xs bg-blue-100 text-blue-700 px-1.5 py-0.5 rounded",
4317
- children: col
4318
- },
4319
- i
4320
- )) })
4792
+ className: `h-5 w-5 ${hasFailures ? "text-amber-600" : "text-green-600"}`
4793
+ }
4794
+ ),
4795
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-sm font-medium text-gray-800", children: "Bulk operation complete" })
4321
4796
  ] }),
4322
- message.csvData.sampleRows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "px-3 py-2", children: [
4323
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-gray-500 mb-1", children: "Sample Data" }),
4324
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-1", children: message.csvData.sampleRows.slice(0, 3).map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4325
- "div",
4326
- {
4327
- className: "text-xs text-gray-600 bg-white rounded px-2 py-1 border border-gray-100",
4328
- children: [
4329
- Object.entries(row).slice(0, 3).map(([key, val], j) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
4330
- j > 0 && " \u2022 ",
4331
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-gray-400", children: [
4332
- key,
4333
- ":"
4334
- ] }),
4335
- " ",
4336
- val
4337
- ] }, key)),
4338
- Object.keys(row).length > 3 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-gray-400", children: [
4797
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-sm text-gray-600 mb-2", children: message.content || `Processed ${total} rows: ${successes} successful${hasFailures ? `, ${failures.length} failed` : ""}.` }),
4798
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-4 text-xs", children: [
4799
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1 text-green-700", children: [
4800
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CheckCircle2, { className: "h-3 w-3" }),
4801
+ successes,
4802
+ " successful"
4803
+ ] }),
4804
+ hasFailures && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1 text-red-600", children: [
4805
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-3 w-3" }),
4806
+ failures.length,
4807
+ " failed"
4808
+ ] })
4809
+ ] }),
4810
+ hasFailures && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mt-3 pt-2 border-t border-amber-200", children: [
4811
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-amber-700 mb-1", children: "Failed Rows" }),
4812
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-1 max-h-32 overflow-y-auto", children: [
4813
+ failures.slice(0, 5).map((failure, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4814
+ "div",
4815
+ {
4816
+ className: "text-xs text-red-700 bg-red-50 rounded px-2 py-1",
4817
+ children: [
4818
+ "Row ",
4819
+ failure.row,
4820
+ ":",
4339
4821
  " ",
4340
- "..."
4341
- ] })
4342
- ]
4343
- },
4344
- i
4345
- )) })
4822
+ failure.error || "Unknown error"
4823
+ ]
4824
+ },
4825
+ i
4826
+ )),
4827
+ failures.length > 5 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "text-xs text-amber-600", children: [
4828
+ "...and ",
4829
+ failures.length - 5,
4830
+ " more"
4831
+ ] })
4832
+ ] })
4346
4833
  ] }),
4347
- message.suggestedAction && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "px-3 py-2 bg-blue-50 border-t border-blue-100", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-xs text-blue-700", children: [
4348
- "Suggested action:",
4349
- " ",
4350
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: message.suggestedAction.replace(/_/g, " ") })
4351
- ] }) })
4352
- ] }),
4353
- message.bulkSessionId && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
4354
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4355
- Button,
4834
+ navigationPage && successes > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-3 pt-2 border-t border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4835
+ "button",
4356
4836
  {
4357
4837
  type: "button",
4358
- size: "sm",
4359
- variant: "secondary",
4360
- className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4361
- onClick: () => message.bulkSessionId && confirmBulkOperation(message.bulkSessionId),
4838
+ onClick: (e) => {
4839
+ e.preventDefault();
4840
+ e.stopPropagation();
4841
+ if (onNavigate && navigationPage.page) {
4842
+ onNavigate(
4843
+ navigationPage.page,
4844
+ navigationPage.subtab
4845
+ );
4846
+ }
4847
+ },
4848
+ className: "flex items-center gap-2 text-xs text-gray-500 hover:text-gray-700 transition-colors group cursor-pointer",
4362
4849
  children: [
4363
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
4364
- "Process ",
4365
- message.csvData.rowCount,
4366
- " rows"
4850
+ /* @__PURE__ */ (0, import_jsx_runtime10.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: [
4851
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-2.5 w-2.5" }),
4852
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "+" }),
4853
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-2.5 w-2.5" })
4367
4854
  ] }),
4368
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
4369
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
4370
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
4855
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
4856
+ "View ",
4857
+ pageLabel
4371
4858
  ] })
4372
4859
  ]
4373
4860
  }
4374
- ),
4375
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4376
- Button,
4377
- {
4378
- type: "button",
4379
- size: "sm",
4380
- variant: "ghost",
4381
- className: "h-8 rounded-xl px-3 text-xs text-gray-500 hover:text-gray-700 hover:bg-gray-100",
4382
- onClick: cancelBulkOperation,
4383
- children: "Cancel"
4384
- }
4385
- )
4386
- ] })
4387
- ]
4388
- },
4389
- message.id
4390
- );
4861
+ ) })
4862
+ ]
4863
+ }
4864
+ )
4865
+ },
4866
+ message.id
4867
+ );
4868
+ }
4869
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(React6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4870
+ "div",
4871
+ {
4872
+ ref: isCurrentGuideStep ? currentStepRef : null,
4873
+ className: `${isRoleChange ? "mt-3" : ""}`,
4874
+ children: [
4875
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-sm leading-6 text-gray-700", children: (() => {
4876
+ const text = message.content || "";
4877
+ if (message.kind === "guideStep") {
4878
+ const m = text.match(/^(Step\s+\d+:)([\s\S]*)/);
4879
+ if (m) {
4880
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
4881
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: m[1] }),
4882
+ m[2]
4883
+ ] });
4884
+ }
4885
+ }
4886
+ if (message.role === "assistant" && text) {
4887
+ return renderMarkdown(text);
4888
+ }
4889
+ return text || /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "opacity-70", children: "Thinking\u2026" });
4890
+ })() }),
4891
+ message.role === "assistant" && message.structuredData && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4892
+ DataRenderer,
4893
+ {
4894
+ type: message.structuredData.type,
4895
+ data: message.structuredData.data
4896
+ }
4897
+ ) }),
4898
+ message.role === "assistant" && message.followups && message.followups.length > 0 && !message.followupSelected && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-3 flex flex-wrap gap-1.5", children: message.followups.map((followup) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4899
+ "button",
4900
+ {
4901
+ type: "button",
4902
+ onClick: () => handleFollowupClick(message.id, followup),
4903
+ 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",
4904
+ children: followup.label
4905
+ },
4906
+ followup.id
4907
+ )) })
4908
+ ]
4391
4909
  }
4392
- if (message.kind === "bulkProgress" && message.bulkProgress) {
4393
- const { processed, total, successes, failures } = message.bulkProgress;
4394
- const percentage = Math.round(processed / total * 100);
4395
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4396
- "div",
4397
- {
4398
- className: `${isRoleChange ? "mt-3" : ""}`,
4399
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "bg-gray-50 rounded-lg border border-gray-200 p-3", children: [
4400
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [
4401
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Loader2, { className: "h-4 w-4 animate-spin text-blue-600" }),
4402
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-sm font-medium text-gray-700", children: [
4403
- "Processing... ",
4404
- processed,
4405
- " of ",
4406
- total
4407
- ] })
4408
- ] }),
4409
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "h-2 bg-gray-200 rounded-full overflow-hidden mb-2", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4410
- "div",
4411
- {
4412
- className: "h-full bg-blue-600 transition-all duration-300",
4413
- style: { width: `${percentage}%` }
4414
- }
4415
- ) }),
4416
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-3 text-xs text-gray-600", children: [
4417
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1", children: [
4418
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CheckCircle2, { className: "h-3 w-3 text-green-600" }),
4419
- successes,
4420
- " successful"
4421
- ] }),
4422
- failures > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1 text-red-600", children: [
4423
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-3 w-3" }),
4424
- failures,
4425
- " failed"
4426
- ] })
4427
- ] })
4428
- ] })
4429
- },
4430
- message.id
4431
- );
4910
+ ) }, message.id);
4911
+ }),
4912
+ (activeGuide || guideComplete) && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
4913
+ activeGuide && activeGuide.stepIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4914
+ Button,
4915
+ {
4916
+ type: "button",
4917
+ size: "sm",
4918
+ variant: "secondary",
4919
+ className: "h-7 w-7 rounded-full p-0 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4920
+ onClick: goBackGuide,
4921
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowLeft, { className: "h-3.5 w-3.5 text-gray-600" })
4432
4922
  }
4433
- if (message.kind === "bulkSummary" && message.bulkSummary) {
4434
- const { total, successes, failures, navigationPage } = message.bulkSummary;
4435
- const hasFailures = failures.length > 0;
4436
- const pageLabel = navigationPage?.page === "customers" ? "Customers" : navigationPage?.page === "dashboard" ? "Dashboard" : navigationPage?.page === "settings" ? "Settings" : "Results";
4437
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4438
- "div",
4439
- {
4440
- className: `${isRoleChange ? "mt-3" : ""}`,
4441
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4442
- "div",
4443
- {
4444
- className: `rounded-lg border p-3 ${hasFailures ? "bg-amber-50 border-amber-200" : "bg-green-50 border-green-200"}`,
4445
- children: [
4446
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [
4447
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4448
- import_lucide_react4.CheckCircle2,
4449
- {
4450
- className: `h-5 w-5 ${hasFailures ? "text-amber-600" : "text-green-600"}`
4451
- }
4452
- ),
4453
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-sm font-medium text-gray-800", children: "Bulk operation complete" })
4454
- ] }),
4455
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-sm text-gray-600 mb-2", children: message.content || `Processed ${total} rows: ${successes} successful${hasFailures ? `, ${failures.length} failed` : ""}.` }),
4456
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-4 text-xs", children: [
4457
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1 text-green-700", children: [
4458
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CheckCircle2, { className: "h-3 w-3" }),
4459
- successes,
4460
- " successful"
4461
- ] }),
4462
- hasFailures && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1 text-red-600", children: [
4463
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-3 w-3" }),
4464
- failures.length,
4465
- " failed"
4466
- ] })
4467
- ] }),
4468
- hasFailures && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mt-3 pt-2 border-t border-amber-200", children: [
4469
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-amber-700 mb-1", children: "Failed Rows" }),
4470
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-1 max-h-32 overflow-y-auto", children: [
4471
- failures.slice(0, 5).map((failure, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4472
- "div",
4473
- {
4474
- className: "text-xs text-red-700 bg-red-50 rounded px-2 py-1",
4475
- children: [
4476
- "Row ",
4477
- failure.row,
4478
- ":",
4479
- " ",
4480
- failure.error || "Unknown error"
4481
- ]
4482
- },
4483
- i
4484
- )),
4485
- failures.length > 5 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "text-xs text-amber-600", children: [
4486
- "...and ",
4487
- failures.length - 5,
4488
- " more"
4489
- ] })
4490
- ] })
4491
- ] }),
4492
- navigationPage && successes > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-3 pt-2 border-t border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4493
- "button",
4494
- {
4495
- type: "button",
4496
- onClick: (e) => {
4497
- e.preventDefault();
4498
- e.stopPropagation();
4499
- if (onNavigate && navigationPage.page) {
4500
- onNavigate(
4501
- navigationPage.page,
4502
- navigationPage.subtab
4503
- );
4504
- }
4505
- },
4506
- className: "flex items-center gap-2 text-xs text-gray-500 hover:text-gray-700 transition-colors group cursor-pointer",
4507
- children: [
4508
- /* @__PURE__ */ (0, import_jsx_runtime10.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: [
4509
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-2.5 w-2.5" }),
4510
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "+" }),
4511
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-2.5 w-2.5" })
4512
- ] }),
4513
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
4514
- "View ",
4515
- pageLabel
4516
- ] })
4517
- ]
4518
- }
4519
- ) })
4520
- ]
4521
- }
4522
- )
4523
- },
4524
- message.id
4525
- );
4923
+ ),
4924
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4925
+ Button,
4926
+ {
4927
+ type: "button",
4928
+ size: "sm",
4929
+ variant: "secondary",
4930
+ className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4931
+ onClick: guideComplete ? handleBack : advanceGuide,
4932
+ children: [
4933
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: guideComplete ? "Done" : "Next" }),
4934
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
4935
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
4936
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
4937
+ ] })
4938
+ ]
4526
4939
  }
4527
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(React6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4528
- "div",
4940
+ )
4941
+ ] }),
4942
+ (phase === "thinking" || phase === "searching" || phase === "executing" || phase === "responding") && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `${lastRole === "user" ? "mt-3" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4943
+ AssistantActivity,
4944
+ {
4945
+ phase,
4946
+ progressSteps
4947
+ }
4948
+ ) }),
4949
+ isEscalated && agentIsTyping && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex items-start mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "bg-gray-200 rounded-2xl rounded-bl-md px-4 py-3", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TypingIndicator, {}) }) }),
4950
+ !activeGuide && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { ref: messagesEndRef })
4951
+ ] }) }) }) })
4952
+ ] }),
4953
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4954
+ "div",
4955
+ {
4956
+ className: `px-4 py-3 bg-white shrink-0 ${isDragOver ? "ring-2 ring-blue-400 ring-inset bg-blue-50" : ""}`,
4957
+ onDragOver: handleDragOver,
4958
+ onDragLeave: handleDragLeave,
4959
+ onDrop: handleDrop,
4960
+ children: [
4961
+ pendingFile && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mb-2 flex items-center gap-2 rounded-xl bg-blue-50 border border-blue-200 px-3 py-2", children: [
4962
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.FileSpreadsheet, { className: "h-4 w-4 text-blue-600" }),
4963
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs text-blue-700 flex-1 truncate", children: pendingFile.name }),
4964
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4965
+ "button",
4529
4966
  {
4530
- ref: isCurrentGuideStep ? currentStepRef : null,
4531
- className: `${isRoleChange ? "mt-3" : ""}`,
4532
- children: [
4533
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-sm leading-6 text-gray-700", children: (() => {
4534
- const text = message.content || "";
4535
- if (message.kind === "guideStep") {
4536
- const m = text.match(/^(Step\s+\d+:)([\s\S]*)/);
4537
- if (m) {
4538
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
4539
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: m[1] }),
4540
- m[2]
4541
- ] });
4542
- }
4543
- }
4544
- if (message.role === "assistant" && text) {
4545
- return renderMarkdown(text);
4546
- }
4547
- return text || /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "opacity-70", children: "Thinking\u2026" });
4548
- })() }),
4549
- message.role === "assistant" && message.structuredData && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4550
- DataRenderer,
4551
- {
4552
- type: message.structuredData.type,
4553
- data: message.structuredData.data
4554
- }
4555
- ) }),
4556
- message.role === "assistant" && message.followups && message.followups.length > 0 && !message.followupSelected && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-3 flex flex-wrap gap-1.5", children: message.followups.map((followup) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4557
- "button",
4558
- {
4559
- type: "button",
4560
- onClick: () => handleFollowupClick(message.id, followup),
4561
- 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",
4562
- children: followup.label
4563
- },
4564
- followup.id
4565
- )) })
4566
- ]
4967
+ type: "button",
4968
+ onClick: () => {
4969
+ setPendingFile(null);
4970
+ if (fileInputRef.current) fileInputRef.current.value = "";
4971
+ },
4972
+ className: "text-blue-600 hover:text-blue-800",
4973
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-4 w-4" })
4567
4974
  }
4568
- ) }, message.id);
4569
- }),
4570
- (activeGuide || guideComplete) && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
4571
- activeGuide && activeGuide.stepIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4572
- Button,
4975
+ )
4976
+ ] }),
4977
+ pendingImages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mb-2 flex flex-wrap gap-2", children: [
4978
+ pendingImages.map((img, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "relative group", children: [
4979
+ img.preview ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4980
+ "img",
4981
+ {
4982
+ src: img.preview,
4983
+ alt: `Preview ${index + 1}`,
4984
+ className: "h-16 w-16 object-cover rounded-lg border border-gray-200"
4985
+ }
4986
+ ) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "h-16 w-16 rounded-lg border border-gray-200 bg-gray-100 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.FileSpreadsheet, { className: "h-6 w-6 text-gray-400" }) }),
4987
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4988
+ "button",
4989
+ {
4990
+ type: "button",
4991
+ onClick: () => {
4992
+ if (img.preview) URL.revokeObjectURL(img.preview);
4993
+ setPendingImages((prev) => prev.filter((_, i) => i !== index));
4994
+ },
4995
+ className: "absolute -top-1 -right-1 h-4 w-4 rounded-full bg-gray-800 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",
4996
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-2.5 w-2.5" })
4997
+ }
4998
+ )
4999
+ ] }, index)),
5000
+ isUploadingImage && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "h-16 w-16 rounded-lg border border-gray-200 bg-gray-50 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Loader2, { className: "h-5 w-5 animate-spin text-gray-400" }) })
5001
+ ] }),
5002
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("form", { onSubmit: handleSubmit, className: "w-full", children: [
5003
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5004
+ "input",
4573
5005
  {
4574
- type: "button",
4575
- size: "sm",
4576
- variant: "secondary",
4577
- className: "h-7 w-7 rounded-full p-0 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4578
- onClick: goBackGuide,
4579
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowLeft, { className: "h-3.5 w-3.5 text-gray-600" })
5006
+ ref: fileInputRef,
5007
+ type: "file",
5008
+ accept: ".csv",
5009
+ className: "hidden",
5010
+ onChange: (e) => {
5011
+ const file = e.target.files?.[0];
5012
+ if (file) {
5013
+ setPendingFile(file);
5014
+ }
5015
+ }
4580
5016
  }
4581
5017
  ),
4582
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4583
- Button,
5018
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5019
+ "input",
4584
5020
  {
4585
- type: "button",
4586
- size: "sm",
4587
- variant: "secondary",
4588
- className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4589
- onClick: guideComplete ? handleBack : advanceGuide,
4590
- children: [
4591
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: guideComplete ? "Done" : "Next" }),
4592
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
4593
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
4594
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
4595
- ] })
4596
- ]
4597
- }
4598
- )
4599
- ] }),
4600
- (phase === "thinking" || phase === "searching" || phase === "executing" || phase === "responding") && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `${lastRole === "user" ? "mt-3" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4601
- AssistantActivity,
4602
- {
4603
- phase,
4604
- progressSteps
4605
- }
4606
- ) }),
4607
- isEscalated && agentIsTyping && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TypingIndicator, {}) }),
4608
- !activeGuide && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { ref: messagesEndRef })
4609
- ] }) }) }) })
4610
- }
4611
- ),
4612
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "px-4 py-3 bg-white shrink-0", children: [
4613
- pendingFile && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mb-2 flex items-center gap-2 rounded-xl bg-blue-50 border border-blue-200 px-3 py-2", children: [
4614
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.FileSpreadsheet, { className: "h-4 w-4 text-blue-600" }),
4615
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs text-blue-700 flex-1 truncate", children: pendingFile.name }),
4616
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4617
- "button",
4618
- {
4619
- type: "button",
4620
- onClick: () => {
4621
- setPendingFile(null);
4622
- if (fileInputRef.current) fileInputRef.current.value = "";
4623
- },
4624
- className: "text-blue-600 hover:text-blue-800",
4625
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-4 w-4" })
4626
- }
4627
- )
4628
- ] }),
4629
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("form", { onSubmit: handleSubmit, className: "w-full", children: [
4630
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4631
- "input",
4632
- {
4633
- ref: fileInputRef,
4634
- type: "file",
4635
- accept: ".csv",
4636
- className: "hidden",
4637
- onChange: (e) => {
4638
- const file = e.target.files?.[0];
4639
- if (file) {
4640
- setPendingFile(file);
5021
+ ref: imageInputRef,
5022
+ type: "file",
5023
+ accept: "image/*,.pdf,.csv",
5024
+ multiple: true,
5025
+ className: "hidden",
5026
+ onChange: (e) => {
5027
+ const files = e.target.files;
5028
+ if (!files || files.length === 0) return;
5029
+ const csvFile = Array.from(files).find((f) => f.name.endsWith(".csv"));
5030
+ if (csvFile && !isEscalated) {
5031
+ setPendingFile(csvFile);
5032
+ } else {
5033
+ handleImageSelect(files);
5034
+ }
5035
+ }
4641
5036
  }
4642
- }
4643
- }
4644
- ),
4645
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full items-start gap-2 rounded-xl border border-gray-200 bg-white px-3 py-2 shadow-sm", children: [
4646
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4647
- Button,
4648
- {
4649
- type: "button",
4650
- size: "icon",
4651
- variant: "ghost",
4652
- onClick: () => fileInputRef.current?.click(),
4653
- className: "h-5 w-5 rounded-full text-gray-400 hover:text-gray-600 hover:bg-gray-100",
4654
- title: "Upload CSV for bulk operations",
4655
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Paperclip, { className: "h-2.5 w-2.5" })
4656
- }
4657
- ),
4658
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4659
- "textarea",
4660
- {
4661
- placeholder: pendingFile ? "Describe what to do with this CSV..." : "Ask anything...",
4662
- value: input,
4663
- onChange: (e) => {
4664
- setInput(e.target.value);
4665
- if (e.target.value.length > 0) {
4666
- handleTypingStart();
5037
+ ),
5038
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex w-full items-start gap-2 rounded-xl border bg-white px-3 py-2 shadow-sm ${isDragOver ? "border-blue-400" : "border-gray-200"}`, children: [
5039
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5040
+ Button,
5041
+ {
5042
+ type: "button",
5043
+ size: "icon",
5044
+ variant: "ghost",
5045
+ onClick: () => {
5046
+ imageInputRef.current?.click();
5047
+ },
5048
+ className: "h-5 w-5 rounded-full text-gray-400 hover:text-gray-600 hover:bg-gray-100",
5049
+ title: "Attach file (image, PDF, or CSV)",
5050
+ disabled: isUploadingImage,
5051
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Paperclip, { className: "h-2.5 w-2.5" })
4667
5052
  }
4668
- },
4669
- rows: 1,
4670
- className: "flex-1 border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 text-sm placeholder:text-gray-400 resize-none overflow-hidden outline-none",
4671
- style: { minHeight: "20px", maxHeight: "120px" },
4672
- onInput: (e) => {
4673
- const target = e.target;
4674
- target.style.height = "auto";
4675
- target.style.height = Math.min(target.scrollHeight, 120) + "px";
4676
- },
4677
- onKeyDown: (e) => {
4678
- if (e.key === "Enter" && !e.shiftKey && !e.metaKey && !e.ctrlKey) {
4679
- e.preventDefault();
4680
- if (input.trim() || pendingFile) {
4681
- const form = e.currentTarget.closest("form");
4682
- if (form) {
4683
- form.requestSubmit();
5053
+ ),
5054
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5055
+ "textarea",
5056
+ {
5057
+ placeholder: pendingFile ? "Describe what to do with this CSV..." : pendingImages.length > 0 ? "Add a message (optional)..." : isDragOver ? "Drop files here..." : "Ask anything...",
5058
+ value: input,
5059
+ onChange: (e) => {
5060
+ setInput(e.target.value);
5061
+ if (e.target.value.length > 0) {
5062
+ handleTypingStart();
5063
+ }
5064
+ },
5065
+ rows: 1,
5066
+ className: "flex-1 border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 text-sm placeholder:text-gray-400 resize-none overflow-hidden outline-none",
5067
+ style: { minHeight: "20px", maxHeight: "120px" },
5068
+ onInput: (e) => {
5069
+ const target = e.target;
5070
+ target.style.height = "auto";
5071
+ target.style.height = Math.min(target.scrollHeight, 120) + "px";
5072
+ },
5073
+ onKeyDown: (e) => {
5074
+ if (e.key === "Enter" && !e.shiftKey && !e.metaKey && !e.ctrlKey) {
5075
+ e.preventDefault();
5076
+ if (input.trim() || pendingFile || pendingImages.length > 0) {
5077
+ const form = e.currentTarget.closest("form");
5078
+ if (form) {
5079
+ form.requestSubmit();
5080
+ }
5081
+ }
5082
+ return;
5083
+ }
5084
+ if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
5085
+ const currentBulkSession = pendingBulkSessionRef.current;
5086
+ if (currentBulkSession) {
5087
+ e.preventDefault();
5088
+ e.stopPropagation();
5089
+ confirmBulkOperation(currentBulkSession);
5090
+ return;
5091
+ }
5092
+ if (pendingAction) {
5093
+ e.preventDefault();
5094
+ e.stopPropagation();
5095
+ handleActionSubmit();
5096
+ return;
5097
+ }
5098
+ if (pendingNavigation) {
5099
+ e.preventDefault();
5100
+ e.stopPropagation();
5101
+ handleConfirmNavigation(pendingNavigation);
5102
+ return;
5103
+ }
5104
+ const currentGuide = activeGuideRef.current;
5105
+ if (currentGuide) {
5106
+ e.preventDefault();
5107
+ e.stopPropagation();
5108
+ advanceGuide();
5109
+ return;
5110
+ }
4684
5111
  }
4685
5112
  }
4686
- return;
4687
5113
  }
4688
- if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
4689
- const currentBulkSession = pendingBulkSessionRef.current;
4690
- if (currentBulkSession) {
4691
- e.preventDefault();
4692
- e.stopPropagation();
4693
- confirmBulkOperation(currentBulkSession);
4694
- return;
4695
- }
4696
- if (pendingAction) {
4697
- e.preventDefault();
4698
- e.stopPropagation();
4699
- handleActionSubmit();
4700
- return;
4701
- }
4702
- if (pendingNavigation) {
4703
- e.preventDefault();
4704
- e.stopPropagation();
4705
- handleConfirmNavigation(pendingNavigation);
4706
- return;
4707
- }
4708
- const currentGuide = activeGuideRef.current;
4709
- if (currentGuide) {
5114
+ ),
5115
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5116
+ Button,
5117
+ {
5118
+ type: "submit",
5119
+ size: "icon",
5120
+ disabled: !input.trim() && !pendingFile && pendingImages.length === 0 || isWaitingForAuth,
5121
+ className: "h-6 w-6 rounded-full bg-gray-700 hover:bg-gray-600 disabled:bg-gray-300",
5122
+ onClick: (e) => {
4710
5123
  e.preventDefault();
4711
- e.stopPropagation();
4712
- advanceGuide();
4713
- return;
4714
- }
5124
+ const form = e.currentTarget.closest("form");
5125
+ if (form) {
5126
+ form.requestSubmit();
5127
+ }
5128
+ },
5129
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowUp, { className: "h-2.5 w-2.5 text-white" })
4715
5130
  }
4716
- }
4717
- }
4718
- ),
4719
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4720
- Button,
4721
- {
4722
- type: "submit",
4723
- size: "icon",
4724
- disabled: !input.trim() && !pendingFile || isWaitingForAuth,
4725
- className: "h-6 w-6 rounded-full bg-gray-900 hover:bg-gray-800 disabled:bg-gray-300",
4726
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowUp, { className: "h-2.5 w-2.5" })
4727
- }
4728
- )
4729
- ] })
4730
- ] })
4731
- ] }),
5131
+ )
5132
+ ] })
5133
+ ] })
5134
+ ]
5135
+ }
5136
+ ),
4732
5137
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4733
5138
  GuideCursor,
4734
5139
  {
@@ -4737,6 +5142,13 @@ ${userText}`
4737
5142
  visible: cursorState.visible,
4738
5143
  onClick: cursorState.onClick
4739
5144
  }
5145
+ ),
5146
+ lightboxImageUrl && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5147
+ ImageLightbox,
5148
+ {
5149
+ imageUrl: lightboxImageUrl,
5150
+ onClose: () => setLightboxImageUrl(null)
5151
+ }
4740
5152
  )
4741
5153
  ]
4742
5154
  }
@@ -4761,7 +5173,8 @@ function ChatPanelWithToggle({
4761
5173
  initialCorner,
4762
5174
  onCornerChange,
4763
5175
  productBackendUrl,
4764
- getAuthHeaders
5176
+ getAuthHeaders,
5177
+ isEval
4765
5178
  }) {
4766
5179
  const [internalIsOpen, setInternalIsOpen] = React6.useState(defaultOpen);
4767
5180
  const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
@@ -4792,7 +5205,8 @@ function ChatPanelWithToggle({
4792
5205
  initialCorner,
4793
5206
  onCornerChange,
4794
5207
  productBackendUrl,
4795
- getAuthHeaders
5208
+ getAuthHeaders,
5209
+ isEval
4796
5210
  }
4797
5211
  );
4798
5212
  }