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