@kite-copilot/chat-panel 0.2.52 → 0.2.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -71,6 +71,7 @@ var import_client = require("react-dom/client");
71
71
 
72
72
  // src/ChatPanel.tsx
73
73
  var React6 = __toESM(require("react"), 1);
74
+ var import_react_dom = require("react-dom");
74
75
  var import_supabase_js = require("@supabase/supabase-js");
75
76
 
76
77
  // src/lib/utils.ts
@@ -1120,29 +1121,29 @@ function DataRenderer({ type, data }) {
1120
1121
  // src/components/TypingIndicator.tsx
1121
1122
  var import_jsx_runtime9 = require("react/jsx-runtime");
1122
1123
  function TypingIndicator({ className = "" }) {
1123
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `flex items-center gap-1 px-4 py-3 ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1", children: [
1124
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `flex items-center gap-1.5 ${className}`, children: [
1124
1125
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1125
1126
  "span",
1126
1127
  {
1127
- className: "w-2 h-2 bg-gray-400 rounded-full animate-bounce",
1128
+ className: "w-2 h-2 bg-gray-500 rounded-full animate-bounce",
1128
1129
  style: { animationDelay: "0ms", animationDuration: "600ms" }
1129
1130
  }
1130
1131
  ),
1131
1132
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1132
1133
  "span",
1133
1134
  {
1134
- className: "w-2 h-2 bg-gray-400 rounded-full animate-bounce",
1135
+ className: "w-2 h-2 bg-gray-500 rounded-full animate-bounce",
1135
1136
  style: { animationDelay: "150ms", animationDuration: "600ms" }
1136
1137
  }
1137
1138
  ),
1138
1139
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1139
1140
  "span",
1140
1141
  {
1141
- className: "w-2 h-2 bg-gray-400 rounded-full animate-bounce",
1142
+ className: "w-2 h-2 bg-gray-500 rounded-full animate-bounce",
1142
1143
  style: { animationDelay: "300ms", animationDuration: "600ms" }
1143
1144
  }
1144
1145
  )
1145
- ] }) });
1146
+ ] });
1146
1147
  }
1147
1148
 
1148
1149
  // src/ChatPanel.tsx
@@ -1591,6 +1592,132 @@ function AuthErrorState({
1591
1592
  )
1592
1593
  ] });
1593
1594
  }
1595
+ function ImageLightbox({
1596
+ imageUrl,
1597
+ onClose
1598
+ }) {
1599
+ const handleDownload = async () => {
1600
+ try {
1601
+ const response = await fetch(imageUrl);
1602
+ const blob = await response.blob();
1603
+ const url = window.URL.createObjectURL(blob);
1604
+ const a = document.createElement("a");
1605
+ a.href = url;
1606
+ const urlParts = imageUrl.split("/");
1607
+ const filename = urlParts[urlParts.length - 1] || "image.jpg";
1608
+ a.download = filename;
1609
+ document.body.appendChild(a);
1610
+ a.click();
1611
+ document.body.removeChild(a);
1612
+ window.URL.revokeObjectURL(url);
1613
+ } catch (error) {
1614
+ console.error("Failed to download image:", error);
1615
+ window.open(imageUrl, "_blank");
1616
+ }
1617
+ };
1618
+ return (0, import_react_dom.createPortal)(
1619
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1620
+ "div",
1621
+ {
1622
+ style: {
1623
+ position: "fixed",
1624
+ top: 0,
1625
+ left: 0,
1626
+ right: 0,
1627
+ bottom: 0,
1628
+ display: "flex",
1629
+ alignItems: "center",
1630
+ justifyContent: "center",
1631
+ backgroundColor: "rgba(0, 0, 0, 0.8)",
1632
+ zIndex: 99999
1633
+ },
1634
+ onClick: onClose,
1635
+ children: [
1636
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1637
+ "button",
1638
+ {
1639
+ onClick: (e) => {
1640
+ e.stopPropagation();
1641
+ onClose();
1642
+ },
1643
+ style: {
1644
+ position: "absolute",
1645
+ top: "16px",
1646
+ right: "16px",
1647
+ padding: "8px",
1648
+ borderRadius: "9999px",
1649
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
1650
+ color: "white",
1651
+ border: "none",
1652
+ cursor: "pointer",
1653
+ display: "flex",
1654
+ alignItems: "center",
1655
+ justifyContent: "center"
1656
+ },
1657
+ "aria-label": "Close",
1658
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { style: { height: "24px", width: "24px" } })
1659
+ }
1660
+ ),
1661
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1662
+ "div",
1663
+ {
1664
+ style: {
1665
+ position: "relative",
1666
+ maxWidth: "90vw",
1667
+ maxHeight: "90vh",
1668
+ display: "flex",
1669
+ flexDirection: "column",
1670
+ alignItems: "center"
1671
+ },
1672
+ onClick: (e) => e.stopPropagation(),
1673
+ children: [
1674
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1675
+ "img",
1676
+ {
1677
+ src: imageUrl,
1678
+ alt: "Full size preview",
1679
+ style: {
1680
+ maxWidth: "100%",
1681
+ maxHeight: "85vh",
1682
+ objectFit: "contain",
1683
+ borderRadius: "8px",
1684
+ boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.25)"
1685
+ }
1686
+ }
1687
+ ),
1688
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { display: "flex", gap: "12px", marginTop: "16px" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1689
+ "button",
1690
+ {
1691
+ onClick: handleDownload,
1692
+ style: {
1693
+ display: "flex",
1694
+ alignItems: "center",
1695
+ gap: "8px",
1696
+ padding: "8px 16px",
1697
+ backgroundColor: "white",
1698
+ color: "#1f2937",
1699
+ borderRadius: "8px",
1700
+ border: "none",
1701
+ cursor: "pointer",
1702
+ fontSize: "14px",
1703
+ fontWeight: 500,
1704
+ boxShadow: "0 10px 15px -3px rgba(0, 0, 0, 0.1)"
1705
+ },
1706
+ children: [
1707
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Download, { style: { height: "16px", width: "16px" } }),
1708
+ "Download"
1709
+ ]
1710
+ }
1711
+ ) })
1712
+ ]
1713
+ }
1714
+ )
1715
+ ]
1716
+ }
1717
+ ),
1718
+ document.body
1719
+ );
1720
+ }
1594
1721
  function ChatPanel({
1595
1722
  isOpen = true,
1596
1723
  onClose,
@@ -1611,7 +1738,8 @@ function ChatPanel({
1611
1738
  initialCorner = "bottom-left",
1612
1739
  onCornerChange,
1613
1740
  productBackendUrl,
1614
- getAuthHeaders
1741
+ getAuthHeaders,
1742
+ isEval = false
1615
1743
  } = {}) {
1616
1744
  const [messages, setMessages] = React6.useState(initialMessages);
1617
1745
  const [input, setInput] = React6.useState("");
@@ -1721,13 +1849,20 @@ function ChatPanel({
1721
1849
  }, [effectiveSupabaseUrl, effectiveSupabaseAnonKey]);
1722
1850
  React6.useEffect(() => {
1723
1851
  if (!isEscalated || !sessionId || !supabaseRef.current) {
1852
+ console.log("[KiteChat] Typing channel skip - isEscalated:", isEscalated, "sessionId:", sessionId, "supabase:", !!supabaseRef.current);
1724
1853
  return;
1725
1854
  }
1726
1855
  const channelName = `typing:${sessionId}`;
1727
- const channel = supabaseRef.current.channel(channelName);
1856
+ console.log("[KiteChat] Subscribing to typing channel:", channelName, "sessionId:", sessionId);
1857
+ const channel = supabaseRef.current.channel(channelName, {
1858
+ config: { broadcast: { self: true } }
1859
+ });
1728
1860
  channel.on("broadcast", { event: "typing" }, (payload) => {
1861
+ console.log("[KiteChat] Received typing event:", payload);
1729
1862
  const { sender, isTyping } = payload.payload;
1863
+ console.log("[KiteChat] Typing event - sender:", sender, "isTyping:", isTyping);
1730
1864
  if (sender === "agent") {
1865
+ console.log("[KiteChat] Setting agentIsTyping to:", isTyping);
1731
1866
  setAgentIsTyping(isTyping);
1732
1867
  if (isTyping) {
1733
1868
  if (typingTimeoutRef.current) {
@@ -1739,6 +1874,7 @@ function ChatPanel({
1739
1874
  }
1740
1875
  }
1741
1876
  }).subscribe((status) => {
1877
+ console.log("[KiteChat] Typing channel subscription status:", status);
1742
1878
  if (status === "SUBSCRIBED") {
1743
1879
  typingChannelRef.current = channel;
1744
1880
  console.log("[KiteChat] Typing channel subscribed successfully");
@@ -1753,7 +1889,7 @@ function ChatPanel({
1753
1889
  window.clearTimeout(typingTimeoutRef.current);
1754
1890
  }
1755
1891
  };
1756
- }, [isEscalated, sessionId]);
1892
+ }, [isEscalated, sessionId, effectiveSupabaseUrl, effectiveSupabaseAnonKey]);
1757
1893
  React6.useEffect(() => {
1758
1894
  if (!isOpen && isEscalated && supabaseRef.current && sessionId) {
1759
1895
  console.log("[KiteChat] Panel closed during live chat, marking disconnected");
@@ -1964,6 +2100,97 @@ function ChatPanel({
1964
2100
  const [pendingBulkSession, setPendingBulkSession] = React6.useState(null);
1965
2101
  const pendingBulkSessionRef = React6.useRef(null);
1966
2102
  const fileInputRef = React6.useRef(null);
2103
+ const [pendingImages, setPendingImages] = React6.useState([]);
2104
+ const [isUploadingImage, setIsUploadingImage] = React6.useState(false);
2105
+ const [isDragOver, setIsDragOver] = React6.useState(false);
2106
+ const imageInputRef = React6.useRef(null);
2107
+ const [lightboxImageUrl, setLightboxImageUrl] = React6.useState(null);
2108
+ const uploadImageToStorage = React6.useCallback(async (file) => {
2109
+ if (!supabaseRef.current) {
2110
+ console.error("[KiteChat] Supabase client not available for file upload");
2111
+ return null;
2112
+ }
2113
+ const fileExt = file.name.split(".").pop();
2114
+ const fileName = `${sessionId}/${Date.now()}-${Math.random().toString(36).substring(7)}.${fileExt}`;
2115
+ const bucketName = "chat-attachments";
2116
+ try {
2117
+ const { data, error } = await supabaseRef.current.storage.from(bucketName).upload(fileName, file, {
2118
+ cacheControl: "3600",
2119
+ upsert: false
2120
+ });
2121
+ if (error) {
2122
+ console.error("[KiteChat] Upload error:", error);
2123
+ return null;
2124
+ }
2125
+ const { data: urlData } = supabaseRef.current.storage.from(bucketName).getPublicUrl(fileName);
2126
+ return urlData?.publicUrl || null;
2127
+ } catch (err) {
2128
+ console.error("[KiteChat] Upload failed:", err);
2129
+ return null;
2130
+ }
2131
+ }, [sessionId]);
2132
+ const handleImageSelect = React6.useCallback((files) => {
2133
+ if (!files) return;
2134
+ const imageFiles = Array.from(files).filter(
2135
+ (file) => file.type.startsWith("image/") || file.type === "application/pdf"
2136
+ );
2137
+ const newImages = imageFiles.map((file) => ({
2138
+ file,
2139
+ preview: file.type.startsWith("image/") ? URL.createObjectURL(file) : ""
2140
+ }));
2141
+ console.log("[KiteChat] Adding images to pending:", newImages.length, "files");
2142
+ setPendingImages((prev) => {
2143
+ const updated = [...prev, ...newImages];
2144
+ console.log("[KiteChat] pendingImages now:", updated.length);
2145
+ return updated;
2146
+ });
2147
+ }, []);
2148
+ React6.useEffect(() => {
2149
+ const hasText = input.trim().length > 0;
2150
+ const hasFile = !!pendingFile;
2151
+ const hasImages = pendingImages.length > 0;
2152
+ const disabled = !hasText && !hasFile && !hasImages || isWaitingForAuth;
2153
+ console.log("[KiteChat] Send button state:", {
2154
+ hasText,
2155
+ hasFile,
2156
+ hasImages,
2157
+ pendingImagesCount: pendingImages.length,
2158
+ isWaitingForAuth,
2159
+ authStatus: authState.status,
2160
+ disabled
2161
+ });
2162
+ }, [input, pendingFile, pendingImages, isWaitingForAuth, authState.status]);
2163
+ const handleDragOver = React6.useCallback((e) => {
2164
+ e.preventDefault();
2165
+ e.stopPropagation();
2166
+ setIsDragOver(true);
2167
+ }, []);
2168
+ const handleDragLeave = React6.useCallback((e) => {
2169
+ e.preventDefault();
2170
+ e.stopPropagation();
2171
+ setIsDragOver(false);
2172
+ }, []);
2173
+ const handleDrop = React6.useCallback((e) => {
2174
+ e.preventDefault();
2175
+ e.stopPropagation();
2176
+ setIsDragOver(false);
2177
+ const files = e.dataTransfer.files;
2178
+ if (files.length > 0) {
2179
+ const csvFile = Array.from(files).find((f) => f.name.endsWith(".csv"));
2180
+ if (csvFile && !isEscalated) {
2181
+ setPendingFile(csvFile);
2182
+ } else {
2183
+ handleImageSelect(files);
2184
+ }
2185
+ }
2186
+ }, [isEscalated, handleImageSelect]);
2187
+ React6.useEffect(() => {
2188
+ return () => {
2189
+ pendingImages.forEach((img) => {
2190
+ if (img.preview) URL.revokeObjectURL(img.preview);
2191
+ });
2192
+ };
2193
+ }, [pendingImages]);
1967
2194
  const [searchExpanded, setSearchExpanded] = React6.useState(false);
1968
2195
  const [searchInput, setSearchInput] = React6.useState("");
1969
2196
  const searchInputRef = React6.useRef(null);
@@ -2020,6 +2247,11 @@ function ChatPanel({
2020
2247
  messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
2021
2248
  }
2022
2249
  }, [messages, phase, activeGuide]);
2250
+ React6.useEffect(() => {
2251
+ if (isEscalated && agentIsTyping && !activeGuide) {
2252
+ messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
2253
+ }
2254
+ }, [isEscalated, agentIsTyping, activeGuide]);
2023
2255
  const latestBulkSummaryNavigation = React6.useMemo(() => {
2024
2256
  for (let i = messages.length - 1; i >= 0; i--) {
2025
2257
  const msg = messages[i];
@@ -2089,12 +2321,20 @@ function ChatPanel({
2089
2321
  onNavigate
2090
2322
  ]);
2091
2323
  const connectToEscalationWs = React6.useCallback((currentSessionId) => {
2092
- if (!agentUrl) return;
2324
+ if (!agentUrl) {
2325
+ console.log("[KiteChat] No agentUrl, skipping WebSocket connection");
2326
+ return;
2327
+ }
2093
2328
  if (escalationWsRef.current) {
2329
+ console.log("[KiteChat] Closing existing WebSocket connection");
2094
2330
  escalationWsRef.current.close();
2095
2331
  }
2096
2332
  const wsUrl = agentUrl.replace(/^http/, "ws") + `/ws/escalation/${currentSessionId}`;
2333
+ console.log("[KiteChat] Connecting to escalation WebSocket:", wsUrl);
2097
2334
  const ws = new WebSocket(wsUrl);
2335
+ ws.onopen = () => {
2336
+ console.log("[KiteChat] Escalation WebSocket connected successfully");
2337
+ };
2098
2338
  ws.onmessage = (event) => {
2099
2339
  try {
2100
2340
  const data = JSON.parse(event.data);
@@ -2125,13 +2365,18 @@ function ChatPanel({
2125
2365
  ws.onerror = (err) => {
2126
2366
  console.error("[KiteChat] Escalation WebSocket error:", err);
2127
2367
  };
2128
- ws.onclose = () => {
2368
+ ws.onclose = (event) => {
2369
+ console.log("[KiteChat] Escalation WebSocket closed - code:", event.code, "reason:", event.reason);
2129
2370
  };
2130
2371
  escalationWsRef.current = ws;
2131
2372
  }, [agentUrl]);
2132
2373
  const sendEscalatedMessage = React6.useCallback(async (content) => {
2133
- if (!escalationWsRef.current || escalationWsRef.current.readyState !== WebSocket.OPEN) {
2134
- console.error("[KiteChat] Escalation WebSocket not connected");
2374
+ if (!escalationWsRef.current) {
2375
+ console.error("[KiteChat] Escalation WebSocket not connected - no ref");
2376
+ return false;
2377
+ }
2378
+ if (escalationWsRef.current.readyState !== WebSocket.OPEN) {
2379
+ console.error("[KiteChat] Escalation WebSocket not connected - state:", escalationWsRef.current.readyState, "(0=CONNECTING, 1=OPEN, 2=CLOSING, 3=CLOSED)");
2135
2380
  return false;
2136
2381
  }
2137
2382
  try {
@@ -2163,7 +2408,9 @@ function ChatPanel({
2163
2408
  };
2164
2409
  }, []);
2165
2410
  React6.useEffect(() => {
2411
+ console.log("[KiteChat] Escalation useEffect - isEscalated:", isEscalated, "sessionId:", sessionId);
2166
2412
  if (isEscalated && sessionId) {
2413
+ console.log("[KiteChat] Triggering WebSocket connection for escalation");
2167
2414
  connectToEscalationWs(sessionId);
2168
2415
  }
2169
2416
  }, [isEscalated, sessionId, connectToEscalationWs]);
@@ -2256,7 +2503,7 @@ function ChatPanel({
2256
2503
  setPanelView("landing");
2257
2504
  setCurrentFolderId(void 0);
2258
2505
  }
2259
- function handleSubmit(e) {
2506
+ async function handleSubmit(e) {
2260
2507
  e.preventDefault();
2261
2508
  const trimmed = input.trim();
2262
2509
  if (pendingFile) {
@@ -2276,6 +2523,49 @@ function ChatPanel({
2276
2523
  if (fileInputRef.current) fileInputRef.current.value = "";
2277
2524
  return;
2278
2525
  }
2526
+ if (pendingImages.length > 0) {
2527
+ setIsUploadingImage(true);
2528
+ try {
2529
+ const uploadedUrls = [];
2530
+ for (const img of pendingImages) {
2531
+ const url = await uploadImageToStorage(img.file);
2532
+ if (url) {
2533
+ uploadedUrls.push(url);
2534
+ }
2535
+ if (img.preview) URL.revokeObjectURL(img.preview);
2536
+ }
2537
+ if (uploadedUrls.length > 0) {
2538
+ const imageMarkdown = uploadedUrls.map((url) => `![image](${url})`).join("\n");
2539
+ const messageContent = trimmed ? `${trimmed}
2540
+
2541
+ ${imageMarkdown}` : imageMarkdown;
2542
+ const userMessage = {
2543
+ id: Date.now(),
2544
+ role: "user",
2545
+ content: messageContent,
2546
+ imageUrls: uploadedUrls
2547
+ };
2548
+ setMessages((prev) => [...prev, userMessage]);
2549
+ if (isEscalated) {
2550
+ sendEscalatedMessage(messageContent);
2551
+ sendTypingIndicator(false);
2552
+ if (userTypingTimeoutRef.current) {
2553
+ window.clearTimeout(userTypingTimeoutRef.current);
2554
+ userTypingTimeoutRef.current = null;
2555
+ }
2556
+ } else {
2557
+ startChatFlow(messageContent);
2558
+ }
2559
+ }
2560
+ } catch (err) {
2561
+ console.error("[KiteChat] Failed to upload images:", err);
2562
+ } finally {
2563
+ setIsUploadingImage(false);
2564
+ setPendingImages([]);
2565
+ setInput("");
2566
+ }
2567
+ return;
2568
+ }
2279
2569
  if (!trimmed) return;
2280
2570
  if (isEscalated) {
2281
2571
  const userMessage = {
@@ -2440,7 +2730,8 @@ function ChatPanel({
2440
2730
  user_id: userId,
2441
2731
  org_id: orgId,
2442
2732
  user_name: userName,
2443
- user_email: userEmail
2733
+ user_email: userEmail,
2734
+ is_eval: isEval
2444
2735
  }),
2445
2736
  signal: controller.signal
2446
2737
  });
@@ -3333,19 +3624,23 @@ ${userText}`
3333
3624
  )
3334
3625
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
3335
3626
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3336
- "input",
3627
+ "textarea",
3337
3628
  {
3338
3629
  ref: searchInputRef,
3339
- type: "text",
3340
3630
  value: searchInput,
3341
- onChange: (e) => setSearchInput(e.target.value),
3631
+ onChange: (e) => {
3632
+ setSearchInput(e.target.value);
3633
+ e.target.style.height = "auto";
3634
+ e.target.style.height = Math.min(e.target.scrollHeight, 120) + "px";
3635
+ },
3342
3636
  onKeyDown: (e) => {
3343
- if (e.key === "Enter" && searchInput.trim()) {
3637
+ if (e.key === "Enter" && !e.shiftKey && searchInput.trim()) {
3344
3638
  e.preventDefault();
3345
3639
  onOpen?.();
3346
3640
  startChatFlow(searchInput.trim());
3347
3641
  setSearchInput("");
3348
3642
  setSearchExpanded(false);
3643
+ e.currentTarget.style.height = "auto";
3349
3644
  } else if (e.key === "Escape") {
3350
3645
  setSearchExpanded(false);
3351
3646
  setSearchInput("");
@@ -3357,7 +3652,8 @@ ${userText}`
3357
3652
  }
3358
3653
  },
3359
3654
  placeholder: "Ask a question...",
3360
- className: "flex-1 text-sm text-gray-700 outline-none bg-transparent"
3655
+ rows: 1,
3656
+ className: "flex-1 text-sm text-gray-700 outline-none bg-transparent resize-none min-h-[20px] max-h-[120px]"
3361
3657
  }
3362
3658
  ),
3363
3659
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2", children: [
@@ -3384,8 +3680,8 @@ ${userText}`
3384
3680
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3385
3681
  "section",
3386
3682
  {
3387
- 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"}`,
3388
- style: { width: `${PANEL_WIDTH}px` },
3683
+ 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"}`,
3684
+ style: { width: `${PANEL_WIDTH}px`, height: `${PANEL_HEIGHT}px` },
3389
3685
  children: [
3390
3686
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-100 bg-gradient-to-r from-gray-50 to-white shrink-0", children: [
3391
3687
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2.5", children: [
@@ -3416,8 +3712,8 @@ ${userText}`
3416
3712
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3417
3713
  "section",
3418
3714
  {
3419
- 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"}`,
3420
- style: { width: `${PANEL_WIDTH}px` },
3715
+ 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"}`,
3716
+ style: { width: `${PANEL_WIDTH}px`, height: `${PANEL_HEIGHT}px` },
3421
3717
  children: [
3422
3718
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-100 bg-gradient-to-r from-gray-50 to-white shrink-0", children: [
3423
3719
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2.5", children: [
@@ -3444,8 +3740,8 @@ ${userText}`
3444
3740
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3445
3741
  "section",
3446
3742
  {
3447
- 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"}`,
3448
- style: { width: `${PANEL_WIDTH}px` },
3743
+ 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"}`,
3744
+ style: { width: `${PANEL_WIDTH}px`, height: `${PANEL_HEIGHT}px` },
3449
3745
  children: [
3450
3746
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-100 bg-gradient-to-r from-gray-50 to-white shrink-0", children: [
3451
3747
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2.5", children: [
@@ -3497,9 +3793,8 @@ ${userText}`
3497
3793
  size: "sm",
3498
3794
  className: "h-7 w-7 p-0 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-full",
3499
3795
  onClick: () => {
3500
- resetSession();
3501
3796
  setMessages([]);
3502
- setPanelView("landing");
3797
+ resetSession();
3503
3798
  setCurrentFolderId(void 0);
3504
3799
  setActiveGuide(void 0);
3505
3800
  activeGuideRef.current = void 0;
@@ -3531,1258 +3826,1368 @@ ${userText}`
3531
3826
  )
3532
3827
  ] })
3533
3828
  ] }),
3534
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3535
- "div",
3536
- {
3537
- 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",
3538
- children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w-full overflow-y-auto px-4", children: [
3539
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "py-3 transition-all duration-300", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h2", { className: "text-center text-2xl font-semibold text-gray-900", children: panelView === "folder" ? folders.find((f) => f.id === currentFolderId)?.title || "" : "How can I help?" }) }),
3540
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "pb-4 px-4", children: [
3541
- panelView === "landing" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-col gap-1", children: loadingQuestions ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Loader2, { className: "h-4 w-4 animate-spin text-gray-400" }) }) : startingQuestions.map((question, index) => {
3542
- const iconColors = [
3543
- "bg-blue-400",
3544
- "bg-green-400",
3545
- "bg-purple-400",
3546
- "bg-orange-400",
3547
- "bg-pink-400"
3548
- ];
3549
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3550
- Button,
3551
- {
3552
- type: "button",
3553
- size: "sm",
3554
- variant: "ghost",
3555
- className: "w-full justify-start rounded-lg px-3 py-1.5 text-xs text-gray-700 hover:bg-gray-100 h-auto",
3556
- onClick: () => sendTopic(question.prompt),
3557
- children: [
3558
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3559
- "span",
3560
- {
3561
- className: `mr-2 inline-block h-1.5 w-1.5 rounded-full ${iconColors[index % iconColors.length]}`
3562
- }
3563
- ),
3564
- question.label
3565
- ]
3566
- },
3567
- question.id
3568
- );
3569
- }) }) }),
3570
- panelView === "folder" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
3571
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mb-3 flex items-center gap-2", children: [
3572
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3829
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex-1 flex flex-col min-h-0 overflow-hidden relative", children: [
3830
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3831
+ "div",
3832
+ {
3833
+ className: `absolute inset-0 grid place-items-center overflow-y-auto ${isEmpty ? "visible" : "invisible pointer-events-none"}`,
3834
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w-full px-4", children: [
3835
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "py-3", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h2", { className: "text-center text-2xl font-semibold text-gray-900", children: panelView === "folder" ? folders.find((f) => f.id === currentFolderId)?.title || "" : "How can I help?" }) }),
3836
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "pb-4 px-4", children: [
3837
+ panelView === "landing" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-col gap-1", children: loadingQuestions ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Loader2, { className: "h-4 w-4 animate-spin text-gray-400" }) }) : startingQuestions.map((question, index) => {
3838
+ const iconColors = [
3839
+ "bg-blue-400",
3840
+ "bg-green-400",
3841
+ "bg-purple-400",
3842
+ "bg-orange-400",
3843
+ "bg-pink-400"
3844
+ ];
3845
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3573
3846
  Button,
3574
3847
  {
3575
3848
  type: "button",
3576
- size: "icon",
3849
+ size: "sm",
3577
3850
  variant: "ghost",
3578
- className: "h-7 w-7 rounded-full hover:bg-gray-100",
3579
- onClick: closeFolder,
3580
- "aria-label": "Back to suggestions",
3581
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowLeft, { className: "h-4 w-4 text-gray-500" })
3582
- }
3583
- ),
3584
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs font-medium uppercase tracking-wide text-gray-400", children: "Topics" })
3585
- ] }),
3586
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-col gap-1.5", children: folders.find((f) => f.id === currentFolderId)?.topics.map((topic) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3587
- Button,
3588
- {
3589
- type: "button",
3590
- size: "sm",
3591
- variant: "secondary",
3592
- 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",
3593
- onClick: () => sendTopic(topic.prompt),
3594
- children: topic.label
3595
- },
3596
- topic.id
3597
- )) })
3851
+ className: "w-full justify-start rounded-lg px-3 py-1.5 text-xs text-gray-700 hover:bg-gray-100 h-auto",
3852
+ onClick: () => sendTopic(question.prompt),
3853
+ children: [
3854
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3855
+ "span",
3856
+ {
3857
+ className: `mr-2 inline-block h-1.5 w-1.5 rounded-full ${iconColors[index % iconColors.length]}`
3858
+ }
3859
+ ),
3860
+ question.label
3861
+ ]
3862
+ },
3863
+ question.id
3864
+ );
3865
+ }) }) }),
3866
+ panelView === "folder" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
3867
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mb-3 flex items-center gap-2", children: [
3868
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3869
+ Button,
3870
+ {
3871
+ type: "button",
3872
+ size: "icon",
3873
+ variant: "ghost",
3874
+ className: "h-7 w-7 rounded-full hover:bg-gray-100",
3875
+ onClick: closeFolder,
3876
+ "aria-label": "Back to suggestions",
3877
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowLeft, { className: "h-4 w-4 text-gray-500" })
3878
+ }
3879
+ ),
3880
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs font-medium uppercase tracking-wide text-gray-400", children: "Topics" })
3881
+ ] }),
3882
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-col gap-1.5", children: folders.find((f) => f.id === currentFolderId)?.topics.map((topic) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3883
+ Button,
3884
+ {
3885
+ type: "button",
3886
+ size: "sm",
3887
+ variant: "secondary",
3888
+ 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",
3889
+ onClick: () => sendTopic(topic.prompt),
3890
+ children: topic.label
3891
+ },
3892
+ topic.id
3893
+ )) })
3894
+ ] })
3598
3895
  ] })
3599
3896
  ] })
3600
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ScrollArea, { ref: messagesContainerRef, className: "h-full", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col gap-2 px-4 py-3", children: [
3601
- messages.map((message, index) => {
3602
- const isUser = message.role === "user";
3603
- const previousRole = index > 0 ? messages[index - 1].role : void 0;
3604
- const isRoleChange = previousRole !== void 0 && previousRole !== message.role;
3605
- const currentGuide = activeGuideRef.current || activeGuide;
3606
- let isCurrentGuideStep = false;
3607
- if (currentGuide && message.kind === "guideStep") {
3608
- if (message.guideStepIndex !== void 0) {
3609
- isCurrentGuideStep = message.guideStepIndex === currentGuide.stepIndex;
3610
- } else {
3611
- isCurrentGuideStep = index === messages.length - 1;
3612
- }
3613
- } else if (message.kind === "guideComplete") {
3897
+ }
3898
+ ),
3899
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `flex-1 flex flex-col min-h-0 overflow-hidden ${isEmpty ? "invisible pointer-events-none" : "visible"}`, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ScrollArea, { ref: messagesContainerRef, className: "h-full", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col gap-2 px-4 py-3", children: [
3900
+ messages.map((message, index) => {
3901
+ const isUser = message.role === "user";
3902
+ const previousRole = index > 0 ? messages[index - 1].role : void 0;
3903
+ const isRoleChange = previousRole !== void 0 && previousRole !== message.role;
3904
+ const currentGuide = activeGuideRef.current || activeGuide;
3905
+ let isCurrentGuideStep = false;
3906
+ if (currentGuide && message.kind === "guideStep") {
3907
+ if (message.guideStepIndex !== void 0) {
3908
+ isCurrentGuideStep = message.guideStepIndex === currentGuide.stepIndex;
3909
+ } else {
3614
3910
  isCurrentGuideStep = index === messages.length - 1;
3615
3911
  }
3616
- if (message.kind === "guideStep" && !isCurrentGuideStep) {
3617
- return null;
3618
- }
3619
- if (isUser) {
3620
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `flex justify-end ${isRoleChange ? "mt-3" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "max-w-[260px] rounded-2xl rounded-br-md bg-gray-900 px-3 py-2 text-sm text-white shadow-sm", children: message.content }) }, message.id);
3621
- }
3622
- if (message.role === "agent") {
3623
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex flex-col items-start ${isRoleChange ? "mt-3" : ""}`, children: [
3624
- isRoleChange && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[10px] text-gray-500 mb-1 ml-1", children: "Agent" }),
3625
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "max-w-[300px] rounded-2xl rounded-bl-md bg-gray-100 px-4 py-3 text-sm text-gray-700", children: message.content })
3626
- ] }, message.id);
3627
- }
3628
- if (message.kind === "searchSummary") {
3629
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3630
- "div",
3912
+ } else if (message.kind === "guideComplete") {
3913
+ isCurrentGuideStep = index === messages.length - 1;
3914
+ }
3915
+ if (message.kind === "guideStep" && !isCurrentGuideStep) {
3916
+ return null;
3917
+ }
3918
+ if (isUser) {
3919
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex flex-col items-end gap-2 ${isRoleChange ? "mt-3" : ""}`, children: [
3920
+ message.imageUrls && message.imageUrls.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-wrap gap-1 justify-end max-w-[260px]", children: message.imageUrls.map((url, imgIndex) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3921
+ "button",
3631
3922
  {
3632
- className: `${isRoleChange ? "mt-3" : ""}`,
3923
+ onClick: () => setLightboxImageUrl(url),
3924
+ className: "block cursor-pointer",
3633
3925
  children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3634
- AssistantSearchSummary,
3926
+ "img",
3635
3927
  {
3636
- title: message.title ?? "Search results",
3637
- links: message.links ?? []
3928
+ src: url,
3929
+ alt: `Attachment ${imgIndex + 1}`,
3930
+ className: "max-h-32 max-w-[200px] rounded-lg object-cover border border-gray-700 hover:opacity-90 transition-opacity"
3638
3931
  }
3639
3932
  )
3640
3933
  },
3641
- message.id
3642
- );
3934
+ imgIndex
3935
+ )) }),
3936
+ message.content && !message.content.match(/^!\[image\]\([^)]+\)(\n!\[image\]\([^)]+\))*$/) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "max-w-[260px] rounded-2xl rounded-br-md bg-gray-900 px-3 py-2 text-sm text-white shadow-sm", children: message.content.replace(/!\[image\]\([^)]+\)\n*/g, "").trim() })
3937
+ ] }, message.id);
3938
+ }
3939
+ if (message.role === "agent") {
3940
+ const imageRegex = /!\[image\]\(([^)]+)\)/g;
3941
+ const extractedImageUrls = [];
3942
+ let match;
3943
+ const contentStr = message.content || "";
3944
+ while ((match = imageRegex.exec(contentStr)) !== null) {
3945
+ extractedImageUrls.push(match[1]);
3643
3946
  }
3644
- if (message.kind === "guideComplete") {
3645
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3646
- "div",
3947
+ const agentImageUrls = message.imageUrls || extractedImageUrls;
3948
+ const agentTextContent = contentStr.replace(/!\[image\]\([^)]+\)\n*/g, "").trim();
3949
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex flex-col items-start gap-2 ${isRoleChange ? "mt-3" : ""}`, children: [
3950
+ isRoleChange && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[10px] text-gray-500 mb-1 ml-1", children: "Agent" }),
3951
+ agentImageUrls.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-wrap gap-1 justify-start max-w-[300px]", children: agentImageUrls.map((url, imgIndex) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3952
+ "button",
3647
3953
  {
3648
- ref: isCurrentGuideStep ? currentStepRef : null,
3649
- className: `${isRoleChange ? "mt-3" : ""}`,
3650
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2 rounded-xl bg-green-50 border border-green-200 px-3 py-2.5 text-sm leading-6", children: [
3651
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CheckCircle2, { className: "h-5 w-5 text-green-600 flex-shrink-0" }),
3652
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "font-medium text-green-800", children: message.content })
3653
- ] })
3954
+ onClick: () => setLightboxImageUrl(url),
3955
+ className: "block cursor-pointer",
3956
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3957
+ "img",
3958
+ {
3959
+ src: url,
3960
+ alt: `Attachment ${imgIndex + 1}`,
3961
+ className: "max-h-32 max-w-[200px] rounded-lg object-cover border border-gray-300 hover:opacity-90 transition-opacity"
3962
+ }
3963
+ )
3654
3964
  },
3655
- message.id
3656
- );
3657
- }
3658
- if (message.kind === "navigationAction") {
3659
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3965
+ imgIndex
3966
+ )) }),
3967
+ agentTextContent && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "max-w-[300px] rounded-2xl rounded-bl-md bg-gray-100 px-4 py-3 text-sm text-gray-700", children: agentTextContent })
3968
+ ] }, message.id);
3969
+ }
3970
+ if (message.kind === "searchSummary") {
3971
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3972
+ "div",
3973
+ {
3974
+ className: `${isRoleChange ? "mt-3" : ""}`,
3975
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3976
+ AssistantSearchSummary,
3977
+ {
3978
+ title: message.title ?? "Search results",
3979
+ links: message.links ?? []
3980
+ }
3981
+ )
3982
+ },
3983
+ message.id
3984
+ );
3985
+ }
3986
+ if (message.kind === "guideComplete") {
3987
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3988
+ "div",
3989
+ {
3990
+ ref: isCurrentGuideStep ? currentStepRef : null,
3991
+ className: `${isRoleChange ? "mt-3" : ""}`,
3992
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2 rounded-xl bg-green-50 border border-green-200 px-3 py-2.5 text-sm leading-6", children: [
3993
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CheckCircle2, { className: "h-5 w-5 text-green-600 flex-shrink-0" }),
3994
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "font-medium text-green-800", children: message.content })
3995
+ ] })
3996
+ },
3997
+ message.id
3998
+ );
3999
+ }
4000
+ if (message.kind === "navigationAction") {
4001
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4002
+ "div",
4003
+ {
4004
+ className: `${isRoleChange ? "mt-3" : ""}`,
4005
+ children: [
4006
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-2 text-gray-700", children: message.content || "" }),
4007
+ message.navigationTarget && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4008
+ Button,
4009
+ {
4010
+ type: "button",
4011
+ size: "sm",
4012
+ variant: "secondary",
4013
+ className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4014
+ onClick: () => message.navigationTarget && handleConfirmNavigation(
4015
+ message.navigationTarget
4016
+ ),
4017
+ children: [
4018
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Confirm" }),
4019
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
4020
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
4021
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
4022
+ ] })
4023
+ ]
4024
+ }
4025
+ ) })
4026
+ ]
4027
+ },
4028
+ message.id
4029
+ );
4030
+ }
4031
+ if (message.kind === "actionForm") {
4032
+ const actionType = message.actionType;
4033
+ const formData = Object.keys(actionFormData).length > 0 ? actionFormData : message.actionData || {};
4034
+ if (message.isSubmitted) {
4035
+ let successContent = "";
4036
+ if (actionType === "updateCompanyInfo") {
4037
+ successContent = "Company information has been updated successfully.";
4038
+ } else if (actionType === "addApiKey") {
4039
+ successContent = "API key has been added successfully.";
4040
+ } else if (actionType === "addCustomer") {
4041
+ successContent = "Customer has been added successfully.";
4042
+ } else if (actionType === "enable2FA") {
4043
+ successContent = "Two-factor authentication has been enabled successfully.";
4044
+ } else if (actionType === "disable2FA") {
4045
+ successContent = "Two-factor authentication has been disabled successfully.";
4046
+ } else if (actionType === "changePassword") {
4047
+ successContent = "Your password has been changed successfully.";
4048
+ } else if (actionType === "revokeSession") {
4049
+ successContent = "Session has been revoked successfully.";
4050
+ } else if (actionType === "toggleNotification") {
4051
+ successContent = "Notification preferences have been updated successfully.";
4052
+ } else if (actionType === "connectIntegration") {
4053
+ successContent = "Integration has been connected successfully.";
4054
+ } else if (actionType === "disconnectIntegration") {
4055
+ successContent = "Integration has been disconnected successfully.";
4056
+ } else if (actionType === "addPaymentMethod") {
4057
+ successContent = "Payment method has been added successfully.";
4058
+ } else if (actionType === "removePaymentMethod") {
4059
+ successContent = "Payment method has been removed successfully.";
4060
+ } else if (actionType === "deleteApiKey") {
4061
+ successContent = "API key has been deleted successfully.";
4062
+ } else if (actionType === "addWebhook") {
4063
+ successContent = "Webhook endpoint has been added successfully.";
4064
+ } else if (actionType === "updateCurrency") {
4065
+ successContent = "Currency preference has been updated successfully.";
4066
+ } else if (actionType === "updateTimezone") {
4067
+ successContent = "Timezone has been updated successfully.";
4068
+ } else if (actionType === "refundPayment") {
4069
+ successContent = "Refund has been processed successfully.";
4070
+ } else if (actionType === "exportCertificate") {
4071
+ successContent = "Certificate of Incorporation has been downloaded successfully.";
4072
+ } else if (actionType === "createSubscription") {
4073
+ successContent = "Subscription has been created successfully.";
4074
+ } else if (actionType === "toggleBlockRule" || actionType === "enableBlockRule" || actionType === "disableBlockRule") {
4075
+ successContent = "Block rule has been updated successfully.";
4076
+ } else {
4077
+ successContent = "Action completed successfully.";
4078
+ }
4079
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3660
4080
  "div",
3661
4081
  {
3662
4082
  className: `${isRoleChange ? "mt-3" : ""}`,
3663
- children: [
3664
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-2 text-gray-700", children: message.content || "" }),
3665
- message.navigationTarget && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3666
- Button,
3667
- {
3668
- type: "button",
3669
- size: "sm",
3670
- variant: "secondary",
3671
- className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
3672
- onClick: () => message.navigationTarget && handleConfirmNavigation(
3673
- message.navigationTarget
3674
- ),
3675
- children: [
3676
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Confirm" }),
3677
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
3678
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
3679
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
3680
- ] })
3681
- ]
3682
- }
3683
- ) })
3684
- ]
4083
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 text-gray-700", children: successContent })
3685
4084
  },
3686
4085
  message.id
3687
4086
  );
3688
4087
  }
3689
- if (message.kind === "actionForm") {
3690
- const actionType = message.actionType;
3691
- const formData = Object.keys(actionFormData).length > 0 ? actionFormData : message.actionData || {};
3692
- if (message.isSubmitted) {
3693
- let successContent = "";
3694
- if (actionType === "updateCompanyInfo") {
3695
- successContent = "Company information has been updated successfully.";
3696
- } else if (actionType === "addApiKey") {
3697
- successContent = "API key has been added successfully.";
3698
- } else if (actionType === "addCustomer") {
3699
- successContent = "Customer has been added successfully.";
3700
- } else if (actionType === "enable2FA") {
3701
- successContent = "Two-factor authentication has been enabled successfully.";
3702
- } else if (actionType === "disable2FA") {
3703
- successContent = "Two-factor authentication has been disabled successfully.";
3704
- } else if (actionType === "changePassword") {
3705
- successContent = "Your password has been changed successfully.";
3706
- } else if (actionType === "revokeSession") {
3707
- successContent = "Session has been revoked successfully.";
3708
- } else if (actionType === "toggleNotification") {
3709
- successContent = "Notification preferences have been updated successfully.";
3710
- } else if (actionType === "connectIntegration") {
3711
- successContent = "Integration has been connected successfully.";
3712
- } else if (actionType === "disconnectIntegration") {
3713
- successContent = "Integration has been disconnected successfully.";
3714
- } else if (actionType === "addPaymentMethod") {
3715
- successContent = "Payment method has been added successfully.";
3716
- } else if (actionType === "removePaymentMethod") {
3717
- successContent = "Payment method has been removed successfully.";
3718
- } else if (actionType === "deleteApiKey") {
3719
- successContent = "API key has been deleted successfully.";
3720
- } else if (actionType === "addWebhook") {
3721
- successContent = "Webhook endpoint has been added successfully.";
3722
- } else if (actionType === "updateCurrency") {
3723
- successContent = "Currency preference has been updated successfully.";
3724
- } else if (actionType === "updateTimezone") {
3725
- successContent = "Timezone has been updated successfully.";
3726
- } else if (actionType === "refundPayment") {
3727
- successContent = "Refund has been processed successfully.";
3728
- } else if (actionType === "exportCertificate") {
3729
- successContent = "Certificate of Incorporation has been downloaded successfully.";
3730
- } else if (actionType === "createSubscription") {
3731
- successContent = "Subscription has been created successfully.";
3732
- } else if (actionType === "toggleBlockRule" || actionType === "enableBlockRule" || actionType === "disableBlockRule") {
3733
- successContent = "Block rule has been updated successfully.";
3734
- } else {
3735
- successContent = "Action completed successfully.";
3736
- }
3737
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3738
- "div",
3739
- {
3740
- className: `${isRoleChange ? "mt-3" : ""}`,
3741
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 text-gray-700", children: successContent })
3742
- },
3743
- message.id
3744
- );
3745
- }
3746
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3747
- "div",
3748
- {
3749
- className: `min-w-0 ${isRoleChange ? "mt-3" : ""}`,
3750
- children: [
3751
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
3752
- actionType === "updateCompanyInfo" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-2 bg-gray-50 rounded-lg p-2 border border-gray-200 overflow-hidden", children: [
3753
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
3754
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3755
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
3756
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3757
- Input,
3758
- {
3759
- placeholder: "Acme Corporation",
3760
- value: formData.companyName || "",
3761
- onChange: (e) => setActionFormData({
3762
- ...actionFormData,
3763
- companyName: e.target.value
3764
- }),
3765
- className: "h-8 text-xs border-gray-200"
3766
- }
3767
- )
3768
- ] }),
3769
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3770
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
3771
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3772
- Input,
3773
- {
3774
- type: "email",
3775
- placeholder: "contact@acme.com",
3776
- value: formData.email || "",
3777
- onChange: (e) => setActionFormData({
3778
- ...actionFormData,
3779
- email: e.target.value
3780
- }),
3781
- className: "h-8 text-xs border-gray-200"
3782
- }
3783
- )
3784
- ] })
3785
- ] }),
4088
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4089
+ "div",
4090
+ {
4091
+ className: `min-w-0 ${isRoleChange ? "mt-3" : ""}`,
4092
+ children: [
4093
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
4094
+ actionType === "updateCompanyInfo" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-2 bg-gray-50 rounded-lg p-2 border border-gray-200 overflow-hidden", children: [
4095
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
3786
4096
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3787
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Address" }),
4097
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
3788
4098
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3789
4099
  Input,
3790
4100
  {
3791
- placeholder: "123 Main St, San Francisco, CA",
3792
- value: formData.address || "",
4101
+ placeholder: "Acme Corporation",
4102
+ value: formData.companyName || "",
3793
4103
  onChange: (e) => setActionFormData({
3794
4104
  ...actionFormData,
3795
- address: e.target.value
4105
+ companyName: e.target.value
3796
4106
  }),
3797
4107
  className: "h-8 text-xs border-gray-200"
3798
4108
  }
3799
4109
  )
3800
4110
  ] }),
3801
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
3802
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3803
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Phone" }),
3804
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3805
- Input,
3806
- {
3807
- type: "tel",
3808
- placeholder: "+1 (555) 123-4567",
3809
- value: formData.phone || "",
3810
- onChange: (e) => setActionFormData({
3811
- ...actionFormData,
3812
- phone: e.target.value
3813
- }),
3814
- className: "h-8 text-xs border-gray-200"
3815
- }
3816
- )
3817
- ] }),
3818
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3819
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Website" }),
3820
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3821
- Input,
3822
- {
3823
- type: "url",
3824
- placeholder: "https://acme.com",
3825
- value: formData.website || "",
3826
- onChange: (e) => setActionFormData({
3827
- ...actionFormData,
3828
- website: e.target.value
3829
- }),
3830
- className: "h-8 text-xs border-gray-200"
3831
- }
3832
- )
3833
- ] })
4111
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4112
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
4113
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4114
+ Input,
4115
+ {
4116
+ type: "email",
4117
+ placeholder: "contact@acme.com",
4118
+ value: formData.email || "",
4119
+ onChange: (e) => setActionFormData({
4120
+ ...actionFormData,
4121
+ email: e.target.value
4122
+ }),
4123
+ className: "h-8 text-xs border-gray-200"
4124
+ }
4125
+ )
3834
4126
  ] })
3835
4127
  ] }),
3836
- actionType === "addApiKey" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3837
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name" }),
4128
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4129
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Address" }),
3838
4130
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3839
4131
  Input,
3840
4132
  {
3841
- placeholder: "Production Key",
3842
- value: formData.name || "",
4133
+ placeholder: "123 Main St, San Francisco, CA",
4134
+ value: formData.address || "",
3843
4135
  onChange: (e) => setActionFormData({
3844
4136
  ...actionFormData,
3845
- name: e.target.value
4137
+ address: e.target.value
3846
4138
  }),
3847
4139
  className: "h-8 text-xs border-gray-200"
3848
4140
  }
3849
4141
  )
3850
- ] }) }),
3851
- actionType === "addCustomer" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-2 bg-gray-50 rounded-lg p-2 border border-gray-200 overflow-hidden", children: [
3852
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
3853
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3854
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
3855
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3856
- Input,
3857
- {
3858
- placeholder: "Acme Corporation",
3859
- value: formData.name || "",
3860
- onChange: (e) => setActionFormData({
3861
- ...actionFormData,
3862
- name: e.target.value
3863
- }),
3864
- className: "h-8 text-xs border-gray-200"
3865
- }
3866
- )
3867
- ] }),
3868
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3869
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
3870
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3871
- Input,
3872
- {
3873
- type: "email",
3874
- placeholder: "contact@acme.com",
3875
- value: formData.email || "",
3876
- onChange: (e) => setActionFormData({
3877
- ...actionFormData,
3878
- email: e.target.value
3879
- }),
3880
- className: "h-8 text-xs border-gray-200"
3881
- }
3882
- )
3883
- ] })
3884
- ] }),
4142
+ ] }),
4143
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
3885
4144
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3886
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Location" }),
4145
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Phone" }),
3887
4146
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3888
4147
  Input,
3889
4148
  {
3890
- placeholder: "San Francisco, CA",
3891
- value: formData.location || "",
4149
+ type: "tel",
4150
+ placeholder: "+1 (555) 123-4567",
4151
+ value: formData.phone || "",
3892
4152
  onChange: (e) => setActionFormData({
3893
4153
  ...actionFormData,
3894
- location: e.target.value
4154
+ phone: e.target.value
3895
4155
  }),
3896
4156
  className: "h-8 text-xs border-gray-200"
3897
4157
  }
3898
4158
  )
3899
4159
  ] }),
3900
4160
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3901
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Subscription Tier" }),
3902
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3903
- "select",
4161
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Website" }),
4162
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4163
+ Input,
3904
4164
  {
3905
- value: formData.subscription || "Starter",
4165
+ type: "url",
4166
+ placeholder: "https://acme.com",
4167
+ value: formData.website || "",
3906
4168
  onChange: (e) => setActionFormData({
3907
4169
  ...actionFormData,
3908
- subscription: e.target.value
4170
+ website: e.target.value
3909
4171
  }),
3910
- 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",
3911
- children: [
3912
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Starter", children: "Starter" }),
3913
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Professional", children: "Professional" }),
3914
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Enterprise", children: "Enterprise" })
3915
- ]
4172
+ className: "h-8 text-xs border-gray-200"
3916
4173
  }
3917
4174
  )
3918
4175
  ] })
3919
- ] }),
3920
- (actionType === "enable2FA" || actionType === "disable2FA") && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-black", children: actionType === "enable2FA" ? "This will enable two-factor authentication for your account. You'll need to set up an authenticator app." : "This will disable two-factor authentication for your account. Your account will be less secure." }) }),
3921
- actionType === "changePassword" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4176
+ ] })
4177
+ ] }),
4178
+ actionType === "addApiKey" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4179
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name" }),
4180
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4181
+ Input,
4182
+ {
4183
+ placeholder: "Production Key",
4184
+ value: formData.name || "",
4185
+ onChange: (e) => setActionFormData({
4186
+ ...actionFormData,
4187
+ name: e.target.value
4188
+ }),
4189
+ className: "h-8 text-xs border-gray-200"
4190
+ }
4191
+ )
4192
+ ] }) }),
4193
+ actionType === "addCustomer" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-2 bg-gray-50 rounded-lg p-2 border border-gray-200 overflow-hidden", children: [
4194
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
3922
4195
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3923
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Current Password" }),
4196
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
3924
4197
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3925
4198
  Input,
3926
4199
  {
3927
- type: "password",
3928
- value: formData.currentPassword || "",
4200
+ placeholder: "Acme Corporation",
4201
+ value: formData.name || "",
3929
4202
  onChange: (e) => setActionFormData({
3930
4203
  ...actionFormData,
3931
- currentPassword: e.target.value
4204
+ name: e.target.value
3932
4205
  }),
3933
4206
  className: "h-8 text-xs border-gray-200"
3934
4207
  }
3935
4208
  )
3936
4209
  ] }),
3937
4210
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3938
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "New Password" }),
4211
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
3939
4212
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3940
4213
  Input,
3941
4214
  {
3942
- type: "password",
3943
- value: formData.newPassword || "",
4215
+ type: "email",
4216
+ placeholder: "contact@acme.com",
4217
+ value: formData.email || "",
3944
4218
  onChange: (e) => setActionFormData({
3945
4219
  ...actionFormData,
3946
- newPassword: e.target.value
3947
- }),
3948
- className: "h-8 text-xs border-gray-200"
3949
- }
3950
- )
3951
- ] }),
3952
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3953
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Confirm New Password" }),
3954
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3955
- Input,
3956
- {
3957
- type: "password",
3958
- value: formData.confirmPassword || "",
3959
- onChange: (e) => setActionFormData({
3960
- ...actionFormData,
3961
- confirmPassword: e.target.value
4220
+ email: e.target.value
3962
4221
  }),
3963
4222
  className: "h-8 text-xs border-gray-200"
3964
4223
  }
3965
4224
  )
3966
4225
  ] })
3967
4226
  ] }),
3968
- actionType === "toggleNotification" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3969
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3970
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Notification Type" }),
3971
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3972
- "select",
3973
- {
3974
- value: formData.notificationType || "paymentReceived",
3975
- onChange: (e) => setActionFormData({
3976
- ...actionFormData,
3977
- notificationType: e.target.value
3978
- }),
3979
- 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",
3980
- children: [
3981
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "paymentReceived", children: "Payment Received" }),
3982
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "paymentFailed", children: "Payment Failed" }),
3983
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "invoicePaid", children: "Invoice Paid" }),
3984
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "monthlySummary", children: "Monthly Summary" }),
3985
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "productUpdates", children: "Product Updates" })
3986
- ]
3987
- }
3988
- )
3989
- ] }),
3990
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2", children: [
3991
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3992
- "input",
3993
- {
3994
- type: "checkbox",
3995
- checked: formData.enabled !== false,
3996
- onChange: (e) => setActionFormData({
3997
- ...actionFormData,
3998
- enabled: e.target.checked
3999
- }),
4000
- className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
4001
- }
4002
- ),
4003
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs text-black", children: "Enable this notification" })
4004
- ] })
4227
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4228
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Location" }),
4229
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4230
+ Input,
4231
+ {
4232
+ placeholder: "San Francisco, CA",
4233
+ value: formData.location || "",
4234
+ onChange: (e) => setActionFormData({
4235
+ ...actionFormData,
4236
+ location: e.target.value
4237
+ }),
4238
+ className: "h-8 text-xs border-gray-200"
4239
+ }
4240
+ )
4005
4241
  ] }),
4006
- (actionType === "connectIntegration" || actionType === "disconnectIntegration") && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4007
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Integration" }),
4242
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4243
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Subscription Tier" }),
4008
4244
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4009
4245
  "select",
4010
4246
  {
4011
- value: formData.integrationName || "Slack",
4247
+ value: formData.subscription || "Starter",
4012
4248
  onChange: (e) => setActionFormData({
4013
4249
  ...actionFormData,
4014
- integrationName: e.target.value
4250
+ subscription: e.target.value
4015
4251
  }),
4016
4252
  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",
4017
4253
  children: [
4018
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Slack", children: "Slack" }),
4019
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Zapier", children: "Zapier" }),
4020
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Webhook", children: "Webhook" })
4254
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Starter", children: "Starter" }),
4255
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Professional", children: "Professional" }),
4256
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Enterprise", children: "Enterprise" })
4021
4257
  ]
4022
4258
  }
4023
4259
  )
4024
- ] }) }),
4025
- actionType === "addPaymentMethod" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4026
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4027
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Card Number" }),
4028
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4029
- Input,
4030
- {
4031
- placeholder: "1234 5678 9012 3456",
4032
- value: formData.cardNumber || "",
4033
- onChange: (e) => setActionFormData({
4034
- ...actionFormData,
4035
- cardNumber: e.target.value
4036
- }),
4037
- className: "h-8 text-xs border-gray-200"
4038
- }
4039
- )
4040
- ] }),
4041
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4042
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Expiry Date" }),
4043
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4044
- Input,
4045
- {
4046
- placeholder: "MM/YY",
4047
- value: formData.expiryDate || "",
4048
- onChange: (e) => setActionFormData({
4049
- ...actionFormData,
4050
- expiryDate: e.target.value
4051
- }),
4052
- className: "h-8 text-xs border-gray-200"
4053
- }
4054
- )
4055
- ] })
4260
+ ] })
4261
+ ] }),
4262
+ (actionType === "enable2FA" || actionType === "disable2FA") && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-black", children: actionType === "enable2FA" ? "This will enable two-factor authentication for your account. You'll need to set up an authenticator app." : "This will disable two-factor authentication for your account. Your account will be less secure." }) }),
4263
+ actionType === "changePassword" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4264
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4265
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Current Password" }),
4266
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4267
+ Input,
4268
+ {
4269
+ type: "password",
4270
+ value: formData.currentPassword || "",
4271
+ onChange: (e) => setActionFormData({
4272
+ ...actionFormData,
4273
+ currentPassword: e.target.value
4274
+ }),
4275
+ className: "h-8 text-xs border-gray-200"
4276
+ }
4277
+ )
4056
4278
  ] }),
4057
- actionType === "removePaymentMethod" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-black", children: "This will remove the default payment method from your account." }) }),
4058
- actionType === "refundPayment" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4059
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4060
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Transaction ID or Customer Name" }),
4061
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4062
- Input,
4063
- {
4064
- placeholder: "e.g., txn_1234 or Acme Corp",
4065
- value: formData.transactionId || formData.customer || "",
4066
- onChange: (e) => {
4067
- const value = e.target.value;
4068
- if (value.startsWith("txn_") || /^\d+$/.test(value)) {
4069
- setActionFormData({
4070
- ...actionFormData,
4071
- transactionId: value,
4072
- customer: void 0
4073
- });
4074
- } else {
4075
- setActionFormData({
4076
- ...actionFormData,
4077
- customer: value,
4078
- transactionId: void 0
4079
- });
4080
- }
4081
- },
4082
- className: "h-8 text-xs border-gray-200"
4083
- }
4084
- )
4085
- ] }),
4086
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4087
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Amount (optional)" }),
4088
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4089
- Input,
4090
- {
4091
- placeholder: "$0.00",
4092
- value: formData.amount || "",
4093
- onChange: (e) => setActionFormData({
4094
- ...actionFormData,
4095
- amount: e.target.value
4096
- }),
4097
- className: "h-8 text-xs border-gray-200"
4098
- }
4099
- )
4100
- ] }),
4101
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4102
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Reason (optional)" }),
4103
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4104
- Input,
4105
- {
4106
- placeholder: "e.g., Customer request",
4107
- value: formData.reason || "",
4108
- onChange: (e) => setActionFormData({
4109
- ...actionFormData,
4110
- reason: e.target.value
4111
- }),
4112
- className: "h-8 text-xs border-gray-200"
4113
- }
4114
- )
4115
- ] })
4279
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4280
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "New Password" }),
4281
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4282
+ Input,
4283
+ {
4284
+ type: "password",
4285
+ value: formData.newPassword || "",
4286
+ onChange: (e) => setActionFormData({
4287
+ ...actionFormData,
4288
+ newPassword: e.target.value
4289
+ }),
4290
+ className: "h-8 text-xs border-gray-200"
4291
+ }
4292
+ )
4116
4293
  ] }),
4117
- actionType === "deleteApiKey" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4118
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4119
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name or ID" }),
4120
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4121
- Input,
4122
- {
4123
- placeholder: "Production Key",
4124
- value: formData.keyId || formData.name || "",
4125
- onChange: (e) => setActionFormData({
4126
- ...actionFormData,
4127
- keyId: e.target.value,
4128
- name: e.target.value
4129
- }),
4130
- className: "h-8 text-xs border-gray-200"
4131
- }
4132
- )
4133
- ] }),
4134
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-red-600", children: "Warning: This action cannot be undone. The API key will be permanently deleted." })
4294
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4295
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Confirm New Password" }),
4296
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4297
+ Input,
4298
+ {
4299
+ type: "password",
4300
+ value: formData.confirmPassword || "",
4301
+ onChange: (e) => setActionFormData({
4302
+ ...actionFormData,
4303
+ confirmPassword: e.target.value
4304
+ }),
4305
+ className: "h-8 text-xs border-gray-200"
4306
+ }
4307
+ )
4308
+ ] })
4309
+ ] }),
4310
+ actionType === "toggleNotification" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4311
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4312
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Notification Type" }),
4313
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4314
+ "select",
4315
+ {
4316
+ value: formData.notificationType || "paymentReceived",
4317
+ onChange: (e) => setActionFormData({
4318
+ ...actionFormData,
4319
+ notificationType: e.target.value
4320
+ }),
4321
+ 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",
4322
+ children: [
4323
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "paymentReceived", children: "Payment Received" }),
4324
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "paymentFailed", children: "Payment Failed" }),
4325
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "invoicePaid", children: "Invoice Paid" }),
4326
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "monthlySummary", children: "Monthly Summary" }),
4327
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "productUpdates", children: "Product Updates" })
4328
+ ]
4329
+ }
4330
+ )
4135
4331
  ] }),
4136
- actionType === "addWebhook" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4137
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4138
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Webhook URL" }),
4139
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4140
- Input,
4141
- {
4142
- type: "url",
4143
- placeholder: "https://example.com/webhook",
4144
- value: formData.url || "",
4145
- onChange: (e) => setActionFormData({
4146
- ...actionFormData,
4147
- url: e.target.value
4148
- }),
4149
- className: "h-8 text-xs border-gray-200"
4150
- }
4151
- )
4152
- ] }),
4153
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4154
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Name (optional)" }),
4155
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4156
- Input,
4157
- {
4158
- placeholder: "Production Webhook",
4159
- value: formData.name || "",
4160
- onChange: (e) => setActionFormData({
4161
- ...actionFormData,
4162
- name: e.target.value
4163
- }),
4164
- className: "h-8 text-xs border-gray-200"
4165
- }
4166
- )
4167
- ] })
4332
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2", children: [
4333
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4334
+ "input",
4335
+ {
4336
+ type: "checkbox",
4337
+ checked: formData.enabled !== false,
4338
+ onChange: (e) => setActionFormData({
4339
+ ...actionFormData,
4340
+ enabled: e.target.checked
4341
+ }),
4342
+ className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
4343
+ }
4344
+ ),
4345
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs text-black", children: "Enable this notification" })
4346
+ ] })
4347
+ ] }),
4348
+ (actionType === "connectIntegration" || actionType === "disconnectIntegration") && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4349
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Integration" }),
4350
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4351
+ "select",
4352
+ {
4353
+ value: formData.integrationName || "Slack",
4354
+ onChange: (e) => setActionFormData({
4355
+ ...actionFormData,
4356
+ integrationName: e.target.value
4357
+ }),
4358
+ 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",
4359
+ children: [
4360
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Slack", children: "Slack" }),
4361
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Zapier", children: "Zapier" }),
4362
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Webhook", children: "Webhook" })
4363
+ ]
4364
+ }
4365
+ )
4366
+ ] }) }),
4367
+ actionType === "addPaymentMethod" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4368
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4369
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Card Number" }),
4370
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4371
+ Input,
4372
+ {
4373
+ placeholder: "1234 5678 9012 3456",
4374
+ value: formData.cardNumber || "",
4375
+ onChange: (e) => setActionFormData({
4376
+ ...actionFormData,
4377
+ cardNumber: e.target.value
4378
+ }),
4379
+ className: "h-8 text-xs border-gray-200"
4380
+ }
4381
+ )
4382
+ ] }),
4383
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4384
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Expiry Date" }),
4385
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4386
+ Input,
4387
+ {
4388
+ placeholder: "MM/YY",
4389
+ value: formData.expiryDate || "",
4390
+ onChange: (e) => setActionFormData({
4391
+ ...actionFormData,
4392
+ expiryDate: e.target.value
4393
+ }),
4394
+ className: "h-8 text-xs border-gray-200"
4395
+ }
4396
+ )
4397
+ ] })
4398
+ ] }),
4399
+ actionType === "removePaymentMethod" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-black", children: "This will remove the default payment method from your account." }) }),
4400
+ actionType === "refundPayment" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4401
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4402
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Transaction ID or Customer Name" }),
4403
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4404
+ Input,
4405
+ {
4406
+ placeholder: "e.g., txn_1234 or Acme Corp",
4407
+ value: formData.transactionId || formData.customer || "",
4408
+ onChange: (e) => {
4409
+ const value = e.target.value;
4410
+ if (value.startsWith("txn_") || /^\d+$/.test(value)) {
4411
+ setActionFormData({
4412
+ ...actionFormData,
4413
+ transactionId: value,
4414
+ customer: void 0
4415
+ });
4416
+ } else {
4417
+ setActionFormData({
4418
+ ...actionFormData,
4419
+ customer: value,
4420
+ transactionId: void 0
4421
+ });
4422
+ }
4423
+ },
4424
+ className: "h-8 text-xs border-gray-200"
4425
+ }
4426
+ )
4168
4427
  ] }),
4169
- actionType === "updateCurrency" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4170
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Currency" }),
4428
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4429
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Amount (optional)" }),
4430
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4431
+ Input,
4432
+ {
4433
+ placeholder: "$0.00",
4434
+ value: formData.amount || "",
4435
+ onChange: (e) => setActionFormData({
4436
+ ...actionFormData,
4437
+ amount: e.target.value
4438
+ }),
4439
+ className: "h-8 text-xs border-gray-200"
4440
+ }
4441
+ )
4442
+ ] }),
4443
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4444
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Reason (optional)" }),
4445
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4446
+ Input,
4447
+ {
4448
+ placeholder: "e.g., Customer request",
4449
+ value: formData.reason || "",
4450
+ onChange: (e) => setActionFormData({
4451
+ ...actionFormData,
4452
+ reason: e.target.value
4453
+ }),
4454
+ className: "h-8 text-xs border-gray-200"
4455
+ }
4456
+ )
4457
+ ] })
4458
+ ] }),
4459
+ actionType === "deleteApiKey" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4460
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4461
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name or ID" }),
4462
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4463
+ Input,
4464
+ {
4465
+ placeholder: "Production Key",
4466
+ value: formData.keyId || formData.name || "",
4467
+ onChange: (e) => setActionFormData({
4468
+ ...actionFormData,
4469
+ keyId: e.target.value,
4470
+ name: e.target.value
4471
+ }),
4472
+ className: "h-8 text-xs border-gray-200"
4473
+ }
4474
+ )
4475
+ ] }),
4476
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-red-600", children: "Warning: This action cannot be undone. The API key will be permanently deleted." })
4477
+ ] }),
4478
+ actionType === "addWebhook" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4479
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4480
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Webhook URL" }),
4481
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4482
+ Input,
4483
+ {
4484
+ type: "url",
4485
+ placeholder: "https://example.com/webhook",
4486
+ value: formData.url || "",
4487
+ onChange: (e) => setActionFormData({
4488
+ ...actionFormData,
4489
+ url: e.target.value
4490
+ }),
4491
+ className: "h-8 text-xs border-gray-200"
4492
+ }
4493
+ )
4494
+ ] }),
4495
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4496
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Name (optional)" }),
4497
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4498
+ Input,
4499
+ {
4500
+ placeholder: "Production Webhook",
4501
+ value: formData.name || "",
4502
+ onChange: (e) => setActionFormData({
4503
+ ...actionFormData,
4504
+ name: e.target.value
4505
+ }),
4506
+ className: "h-8 text-xs border-gray-200"
4507
+ }
4508
+ )
4509
+ ] })
4510
+ ] }),
4511
+ actionType === "updateCurrency" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4512
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Currency" }),
4513
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4514
+ "select",
4515
+ {
4516
+ value: formData.currency || "USD",
4517
+ onChange: (e) => setActionFormData({
4518
+ ...actionFormData,
4519
+ currency: e.target.value
4520
+ }),
4521
+ 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",
4522
+ children: [
4523
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "USD", children: "USD ($)" }),
4524
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "EUR", children: "EUR (\u20AC)" }),
4525
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "GBP", children: "GBP (\xA3)" }),
4526
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "JPY", children: "JPY (\xA5)" })
4527
+ ]
4528
+ }
4529
+ )
4530
+ ] }) }),
4531
+ actionType === "updateTimezone" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4532
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Timezone" }),
4533
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4534
+ "select",
4535
+ {
4536
+ value: formData.timezone || "America/Los_Angeles",
4537
+ onChange: (e) => setActionFormData({
4538
+ ...actionFormData,
4539
+ timezone: e.target.value
4540
+ }),
4541
+ 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",
4542
+ children: [
4543
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "America/Los_Angeles", children: "Pacific Time (PT)" }),
4544
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "America/New_York", children: "Eastern Time (ET)" }),
4545
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Europe/London", children: "GMT" }),
4546
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Asia/Tokyo", children: "JST" })
4547
+ ]
4548
+ }
4549
+ )
4550
+ ] }) }),
4551
+ actionType === "revokeSession" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4552
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4553
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Device/Session" }),
4554
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4555
+ Input,
4556
+ {
4557
+ placeholder: "MacBook Pro",
4558
+ value: formData.device || "",
4559
+ onChange: (e) => setActionFormData({
4560
+ ...actionFormData,
4561
+ device: e.target.value
4562
+ }),
4563
+ className: "h-8 text-xs border-gray-200"
4564
+ }
4565
+ )
4566
+ ] }),
4567
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-black", children: "This will sign out the device and invalidate its session." })
4568
+ ] }),
4569
+ actionType === "createSubscription" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4570
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4571
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Customer Email" }),
4572
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4573
+ Input,
4574
+ {
4575
+ type: "email",
4576
+ placeholder: "customer@example.com",
4577
+ value: formData.customerEmail || "",
4578
+ onChange: (e) => setActionFormData({
4579
+ ...actionFormData,
4580
+ customerEmail: e.target.value
4581
+ }),
4582
+ className: "h-8 text-xs border-gray-200"
4583
+ }
4584
+ )
4585
+ ] }),
4586
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4587
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Plan" }),
4171
4588
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4172
4589
  "select",
4173
4590
  {
4174
- value: formData.currency || "USD",
4591
+ value: formData.plan || "Starter",
4175
4592
  onChange: (e) => setActionFormData({
4176
4593
  ...actionFormData,
4177
- currency: e.target.value
4594
+ plan: e.target.value
4178
4595
  }),
4179
4596
  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",
4180
4597
  children: [
4181
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "USD", children: "USD ($)" }),
4182
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "EUR", children: "EUR (\u20AC)" }),
4183
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "GBP", children: "GBP (\xA3)" }),
4184
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "JPY", children: "JPY (\xA5)" })
4598
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Starter", children: "Starter ($29/mo)" }),
4599
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Professional", children: "Professional ($99/mo)" }),
4600
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Enterprise", children: "Enterprise ($299/mo)" })
4185
4601
  ]
4186
4602
  }
4187
4603
  )
4188
- ] }) }),
4189
- actionType === "updateTimezone" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4190
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Timezone" }),
4604
+ ] }),
4605
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4606
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Billing Cycle" }),
4191
4607
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4192
4608
  "select",
4193
4609
  {
4194
- value: formData.timezone || "America/Los_Angeles",
4610
+ value: formData.billingCycle || "monthly",
4195
4611
  onChange: (e) => setActionFormData({
4196
4612
  ...actionFormData,
4197
- timezone: e.target.value
4613
+ billingCycle: e.target.value
4198
4614
  }),
4199
4615
  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",
4200
4616
  children: [
4201
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "America/Los_Angeles", children: "Pacific Time (PT)" }),
4202
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "America/New_York", children: "Eastern Time (ET)" }),
4203
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Europe/London", children: "GMT" }),
4204
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Asia/Tokyo", children: "JST" })
4617
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "monthly", children: "Monthly" }),
4618
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "yearly", children: "Yearly (Save 15%)" })
4619
+ ]
4620
+ }
4621
+ )
4622
+ ] })
4623
+ ] }),
4624
+ actionType === "exportCertificate" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4625
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-black", children: "This will export your certificate of incorporation document." }),
4626
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4627
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Format" }),
4628
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4629
+ "select",
4630
+ {
4631
+ value: formData.format || "pdf",
4632
+ onChange: (e) => setActionFormData({
4633
+ ...actionFormData,
4634
+ format: e.target.value
4635
+ }),
4636
+ 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",
4637
+ children: [
4638
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "pdf", children: "PDF" }),
4639
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "json", children: "JSON" })
4640
+ ]
4641
+ }
4642
+ )
4643
+ ] })
4644
+ ] }),
4645
+ (actionType === "toggleBlockRule" || actionType === "enableBlockRule" || actionType === "disableBlockRule") && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4646
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4647
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Block Rule" }),
4648
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4649
+ "select",
4650
+ {
4651
+ value: formData.ruleId || "rule_1",
4652
+ onChange: (e) => setActionFormData({
4653
+ ...actionFormData,
4654
+ ruleId: e.target.value
4655
+ }),
4656
+ 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",
4657
+ children: [
4658
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_1", children: "Block if risk level = 'highest'" }),
4659
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_2", children: "Block if matches Stripe block lists" }),
4660
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_3", children: "Block if CVC verification fails" }),
4661
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_4", children: "Block if Postal code verification fails" })
4205
4662
  ]
4206
4663
  }
4207
4664
  )
4208
- ] }) }),
4209
- actionType === "revokeSession" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4210
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4211
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Device/Session" }),
4212
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4213
- Input,
4214
- {
4215
- placeholder: "MacBook Pro",
4216
- value: formData.device || "",
4217
- onChange: (e) => setActionFormData({
4218
- ...actionFormData,
4219
- device: e.target.value
4220
- }),
4221
- className: "h-8 text-xs border-gray-200"
4222
- }
4223
- )
4224
- ] }),
4225
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-black", children: "This will sign out the device and invalidate its session." })
4226
4665
  ] }),
4227
- actionType === "createSubscription" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4228
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4229
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Customer Email" }),
4230
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4231
- Input,
4232
- {
4233
- type: "email",
4234
- placeholder: "customer@example.com",
4235
- value: formData.customerEmail || "",
4236
- onChange: (e) => setActionFormData({
4237
- ...actionFormData,
4238
- customerEmail: e.target.value
4239
- }),
4240
- className: "h-8 text-xs border-gray-200"
4241
- }
4242
- )
4243
- ] }),
4244
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4245
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Plan" }),
4246
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4247
- "select",
4248
- {
4249
- value: formData.plan || "Starter",
4250
- onChange: (e) => setActionFormData({
4251
- ...actionFormData,
4252
- plan: e.target.value
4253
- }),
4254
- 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",
4255
- children: [
4256
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Starter", children: "Starter ($29/mo)" }),
4257
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Professional", children: "Professional ($99/mo)" }),
4258
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Enterprise", children: "Enterprise ($299/mo)" })
4259
- ]
4260
- }
4261
- )
4262
- ] }),
4263
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4264
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Billing Cycle" }),
4265
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4266
- "select",
4267
- {
4268
- value: formData.billingCycle || "monthly",
4269
- onChange: (e) => setActionFormData({
4270
- ...actionFormData,
4271
- billingCycle: e.target.value
4272
- }),
4273
- 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",
4274
- children: [
4275
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "monthly", children: "Monthly" }),
4276
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "yearly", children: "Yearly (Save 15%)" })
4277
- ]
4278
- }
4279
- )
4666
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-black", children: actionType === "enableBlockRule" ? "This will enable the selected block rule to actively block matching payments." : actionType === "disableBlockRule" ? "This will disable the selected block rule. Matching payments will no longer be blocked." : "This will toggle the selected block rule's state." })
4667
+ ] }),
4668
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4669
+ Button,
4670
+ {
4671
+ type: "button",
4672
+ size: "sm",
4673
+ variant: "secondary",
4674
+ className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4675
+ onClick: handleActionSubmit,
4676
+ children: [
4677
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Confirm" }),
4678
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
4679
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
4680
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
4681
+ ] })
4682
+ ]
4683
+ }
4684
+ ) })
4685
+ ]
4686
+ },
4687
+ message.id
4688
+ );
4689
+ }
4690
+ if (message.kind === "bulkPreview" && message.csvData) {
4691
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4692
+ "div",
4693
+ {
4694
+ className: `${isRoleChange ? "mt-3" : ""}`,
4695
+ children: [
4696
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
4697
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "bg-gray-50 rounded-lg border border-gray-200 overflow-hidden", children: [
4698
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "bg-gray-100 px-3 py-2 border-b border-gray-200 flex items-center gap-2", children: [
4699
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.FileSpreadsheet, { className: "h-4 w-4 text-gray-600" }),
4700
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs font-medium text-gray-700", children: message.csvData.fileName }),
4701
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-xs text-gray-500", children: [
4702
+ "\u2022 ",
4703
+ message.csvData.rowCount,
4704
+ " rows"
4280
4705
  ] })
4281
4706
  ] }),
4282
- actionType === "exportCertificate" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4283
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-black", children: "This will export your certificate of incorporation document." }),
4284
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4285
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Format" }),
4286
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4287
- "select",
4288
- {
4289
- value: formData.format || "pdf",
4290
- onChange: (e) => setActionFormData({
4291
- ...actionFormData,
4292
- format: e.target.value
4293
- }),
4294
- 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",
4295
- children: [
4296
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "pdf", children: "PDF" }),
4297
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "json", children: "JSON" })
4298
- ]
4299
- }
4300
- )
4301
- ] })
4707
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "px-3 py-2 border-b border-gray-100", children: [
4708
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-gray-500 mb-1", children: "Columns" }),
4709
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-wrap gap-1", children: message.csvData.columns.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4710
+ "span",
4711
+ {
4712
+ className: "text-xs bg-blue-100 text-blue-700 px-1.5 py-0.5 rounded",
4713
+ children: col
4714
+ },
4715
+ i
4716
+ )) })
4302
4717
  ] }),
4303
- (actionType === "toggleBlockRule" || actionType === "enableBlockRule" || actionType === "disableBlockRule") && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
4304
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4305
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Block Rule" }),
4306
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4307
- "select",
4308
- {
4309
- value: formData.ruleId || "rule_1",
4310
- onChange: (e) => setActionFormData({
4311
- ...actionFormData,
4312
- ruleId: e.target.value
4313
- }),
4314
- 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",
4315
- children: [
4316
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_1", children: "Block if risk level = 'highest'" }),
4317
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_2", children: "Block if matches Stripe block lists" }),
4318
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_3", children: "Block if CVC verification fails" }),
4319
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_4", children: "Block if Postal code verification fails" })
4320
- ]
4321
- }
4322
- )
4323
- ] }),
4324
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-black", children: actionType === "enableBlockRule" ? "This will enable the selected block rule to actively block matching payments." : actionType === "disableBlockRule" ? "This will disable the selected block rule. Matching payments will no longer be blocked." : "This will toggle the selected block rule's state." })
4718
+ message.csvData.sampleRows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "px-3 py-2", children: [
4719
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-gray-500 mb-1", children: "Sample Data" }),
4720
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-1", children: message.csvData.sampleRows.slice(0, 3).map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4721
+ "div",
4722
+ {
4723
+ className: "text-xs text-gray-600 bg-white rounded px-2 py-1 border border-gray-100",
4724
+ children: [
4725
+ Object.entries(row).slice(0, 3).map(([key, val], j) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
4726
+ j > 0 && " \u2022 ",
4727
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-gray-400", children: [
4728
+ key,
4729
+ ":"
4730
+ ] }),
4731
+ " ",
4732
+ val
4733
+ ] }, key)),
4734
+ Object.keys(row).length > 3 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-gray-400", children: [
4735
+ " ",
4736
+ "..."
4737
+ ] })
4738
+ ]
4739
+ },
4740
+ i
4741
+ )) })
4325
4742
  ] }),
4326
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4743
+ message.suggestedAction && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "px-3 py-2 bg-blue-50 border-t border-blue-100", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-xs text-blue-700", children: [
4744
+ "Suggested action:",
4745
+ " ",
4746
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: message.suggestedAction.replace(/_/g, " ") })
4747
+ ] }) })
4748
+ ] }),
4749
+ message.bulkSessionId && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
4750
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4327
4751
  Button,
4328
4752
  {
4329
4753
  type: "button",
4330
4754
  size: "sm",
4331
4755
  variant: "secondary",
4332
4756
  className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4333
- onClick: handleActionSubmit,
4757
+ onClick: () => message.bulkSessionId && confirmBulkOperation(message.bulkSessionId),
4334
4758
  children: [
4335
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Confirm" }),
4759
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
4760
+ "Process ",
4761
+ message.csvData.rowCount,
4762
+ " rows"
4763
+ ] }),
4336
4764
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
4337
4765
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
4338
4766
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
4339
4767
  ] })
4340
4768
  ]
4341
4769
  }
4342
- ) })
4343
- ]
4344
- },
4345
- message.id
4346
- );
4347
- }
4348
- if (message.kind === "bulkPreview" && message.csvData) {
4349
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4350
- "div",
4351
- {
4352
- className: `${isRoleChange ? "mt-3" : ""}`,
4353
- children: [
4354
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
4355
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "bg-gray-50 rounded-lg border border-gray-200 overflow-hidden", children: [
4356
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "bg-gray-100 px-3 py-2 border-b border-gray-200 flex items-center gap-2", children: [
4357
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.FileSpreadsheet, { className: "h-4 w-4 text-gray-600" }),
4358
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs font-medium text-gray-700", children: message.csvData.fileName }),
4359
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-xs text-gray-500", children: [
4360
- "\u2022 ",
4361
- message.csvData.rowCount,
4362
- " rows"
4363
- ] })
4364
- ] }),
4365
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "px-3 py-2 border-b border-gray-100", children: [
4366
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-gray-500 mb-1", children: "Columns" }),
4367
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-wrap gap-1", children: message.csvData.columns.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4368
- "span",
4770
+ ),
4771
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4772
+ Button,
4773
+ {
4774
+ type: "button",
4775
+ size: "sm",
4776
+ variant: "ghost",
4777
+ className: "h-8 rounded-xl px-3 text-xs text-gray-500 hover:text-gray-700 hover:bg-gray-100",
4778
+ onClick: cancelBulkOperation,
4779
+ children: "Cancel"
4780
+ }
4781
+ )
4782
+ ] })
4783
+ ]
4784
+ },
4785
+ message.id
4786
+ );
4787
+ }
4788
+ if (message.kind === "bulkProgress" && message.bulkProgress) {
4789
+ const { processed, total, successes, failures } = message.bulkProgress;
4790
+ const percentage = Math.round(processed / total * 100);
4791
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4792
+ "div",
4793
+ {
4794
+ className: `${isRoleChange ? "mt-3" : ""}`,
4795
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "bg-gray-50 rounded-lg border border-gray-200 p-3", children: [
4796
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [
4797
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Loader2, { className: "h-4 w-4 animate-spin text-blue-600" }),
4798
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-sm font-medium text-gray-700", children: [
4799
+ "Processing... ",
4800
+ processed,
4801
+ " of ",
4802
+ total
4803
+ ] })
4804
+ ] }),
4805
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "h-2 bg-gray-200 rounded-full overflow-hidden mb-2", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4806
+ "div",
4807
+ {
4808
+ className: "h-full bg-blue-600 transition-all duration-300",
4809
+ style: { width: `${percentage}%` }
4810
+ }
4811
+ ) }),
4812
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-3 text-xs text-gray-600", children: [
4813
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1", children: [
4814
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CheckCircle2, { className: "h-3 w-3 text-green-600" }),
4815
+ successes,
4816
+ " successful"
4817
+ ] }),
4818
+ failures > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1 text-red-600", children: [
4819
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-3 w-3" }),
4820
+ failures,
4821
+ " failed"
4822
+ ] })
4823
+ ] })
4824
+ ] })
4825
+ },
4826
+ message.id
4827
+ );
4828
+ }
4829
+ if (message.kind === "bulkSummary" && message.bulkSummary) {
4830
+ const { total, successes, failures, navigationPage } = message.bulkSummary;
4831
+ const hasFailures = failures.length > 0;
4832
+ const pageLabel = navigationPage?.page === "customers" ? "Customers" : navigationPage?.page === "dashboard" ? "Dashboard" : navigationPage?.page === "settings" ? "Settings" : "Results";
4833
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4834
+ "div",
4835
+ {
4836
+ className: `${isRoleChange ? "mt-3" : ""}`,
4837
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4838
+ "div",
4839
+ {
4840
+ className: `rounded-lg border p-3 ${hasFailures ? "bg-amber-50 border-amber-200" : "bg-green-50 border-green-200"}`,
4841
+ children: [
4842
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [
4843
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4844
+ import_lucide_react4.CheckCircle2,
4369
4845
  {
4370
- className: "text-xs bg-blue-100 text-blue-700 px-1.5 py-0.5 rounded",
4371
- children: col
4372
- },
4373
- i
4374
- )) })
4846
+ className: `h-5 w-5 ${hasFailures ? "text-amber-600" : "text-green-600"}`
4847
+ }
4848
+ ),
4849
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-sm font-medium text-gray-800", children: "Bulk operation complete" })
4375
4850
  ] }),
4376
- message.csvData.sampleRows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "px-3 py-2", children: [
4377
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-gray-500 mb-1", children: "Sample Data" }),
4378
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-1", children: message.csvData.sampleRows.slice(0, 3).map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4379
- "div",
4380
- {
4381
- className: "text-xs text-gray-600 bg-white rounded px-2 py-1 border border-gray-100",
4382
- children: [
4383
- Object.entries(row).slice(0, 3).map(([key, val], j) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
4384
- j > 0 && " \u2022 ",
4385
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-gray-400", children: [
4386
- key,
4387
- ":"
4388
- ] }),
4389
- " ",
4390
- val
4391
- ] }, key)),
4392
- Object.keys(row).length > 3 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-gray-400", children: [
4851
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-sm text-gray-600 mb-2", children: message.content || `Processed ${total} rows: ${successes} successful${hasFailures ? `, ${failures.length} failed` : ""}.` }),
4852
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-4 text-xs", children: [
4853
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1 text-green-700", children: [
4854
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CheckCircle2, { className: "h-3 w-3" }),
4855
+ successes,
4856
+ " successful"
4857
+ ] }),
4858
+ hasFailures && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1 text-red-600", children: [
4859
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-3 w-3" }),
4860
+ failures.length,
4861
+ " failed"
4862
+ ] })
4863
+ ] }),
4864
+ hasFailures && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mt-3 pt-2 border-t border-amber-200", children: [
4865
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-amber-700 mb-1", children: "Failed Rows" }),
4866
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-1 max-h-32 overflow-y-auto", children: [
4867
+ failures.slice(0, 5).map((failure, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4868
+ "div",
4869
+ {
4870
+ className: "text-xs text-red-700 bg-red-50 rounded px-2 py-1",
4871
+ children: [
4872
+ "Row ",
4873
+ failure.row,
4874
+ ":",
4393
4875
  " ",
4394
- "..."
4395
- ] })
4396
- ]
4397
- },
4398
- i
4399
- )) })
4876
+ failure.error || "Unknown error"
4877
+ ]
4878
+ },
4879
+ i
4880
+ )),
4881
+ failures.length > 5 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "text-xs text-amber-600", children: [
4882
+ "...and ",
4883
+ failures.length - 5,
4884
+ " more"
4885
+ ] })
4886
+ ] })
4400
4887
  ] }),
4401
- message.suggestedAction && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "px-3 py-2 bg-blue-50 border-t border-blue-100", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-xs text-blue-700", children: [
4402
- "Suggested action:",
4403
- " ",
4404
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: message.suggestedAction.replace(/_/g, " ") })
4405
- ] }) })
4406
- ] }),
4407
- message.bulkSessionId && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
4408
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4409
- Button,
4888
+ navigationPage && successes > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-3 pt-2 border-t border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4889
+ "button",
4410
4890
  {
4411
4891
  type: "button",
4412
- size: "sm",
4413
- variant: "secondary",
4414
- className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4415
- onClick: () => message.bulkSessionId && confirmBulkOperation(message.bulkSessionId),
4892
+ onClick: (e) => {
4893
+ e.preventDefault();
4894
+ e.stopPropagation();
4895
+ if (onNavigate && navigationPage.page) {
4896
+ onNavigate(
4897
+ navigationPage.page,
4898
+ navigationPage.subtab
4899
+ );
4900
+ }
4901
+ },
4902
+ className: "flex items-center gap-2 text-xs text-gray-500 hover:text-gray-700 transition-colors group cursor-pointer",
4416
4903
  children: [
4417
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
4418
- "Process ",
4419
- message.csvData.rowCount,
4420
- " rows"
4904
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1 px-1.5 py-0.5 bg-gray-100 rounded text-[10px] font-medium text-gray-600 group-hover:bg-gray-200", children: [
4905
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-2.5 w-2.5" }),
4906
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "+" }),
4907
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-2.5 w-2.5" })
4421
4908
  ] }),
4422
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
4423
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
4424
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
4909
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
4910
+ "View ",
4911
+ pageLabel
4425
4912
  ] })
4426
4913
  ]
4427
4914
  }
4428
- ),
4429
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4430
- Button,
4431
- {
4432
- type: "button",
4433
- size: "sm",
4434
- variant: "ghost",
4435
- className: "h-8 rounded-xl px-3 text-xs text-gray-500 hover:text-gray-700 hover:bg-gray-100",
4436
- onClick: cancelBulkOperation,
4437
- children: "Cancel"
4438
- }
4439
- )
4440
- ] })
4441
- ]
4442
- },
4443
- message.id
4444
- );
4915
+ ) })
4916
+ ]
4917
+ }
4918
+ )
4919
+ },
4920
+ message.id
4921
+ );
4922
+ }
4923
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(React6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4924
+ "div",
4925
+ {
4926
+ ref: isCurrentGuideStep ? currentStepRef : null,
4927
+ className: `${isRoleChange ? "mt-3" : ""}`,
4928
+ children: [
4929
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-sm leading-6 text-gray-700", children: (() => {
4930
+ const text = message.content || "";
4931
+ if (message.kind === "guideStep") {
4932
+ const m = text.match(/^(Step\s+\d+:)([\s\S]*)/);
4933
+ if (m) {
4934
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
4935
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: m[1] }),
4936
+ m[2]
4937
+ ] });
4938
+ }
4939
+ }
4940
+ if (message.role === "assistant" && text) {
4941
+ return renderMarkdown(text);
4942
+ }
4943
+ return text || /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "opacity-70", children: "Thinking\u2026" });
4944
+ })() }),
4945
+ message.role === "assistant" && message.structuredData && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4946
+ DataRenderer,
4947
+ {
4948
+ type: message.structuredData.type,
4949
+ data: message.structuredData.data
4950
+ }
4951
+ ) }),
4952
+ message.role === "assistant" && message.followups && message.followups.length > 0 && !message.followupSelected && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-3 flex flex-wrap gap-1.5", children: message.followups.map((followup) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4953
+ "button",
4954
+ {
4955
+ type: "button",
4956
+ onClick: () => handleFollowupClick(message.id, followup),
4957
+ 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",
4958
+ children: followup.label
4959
+ },
4960
+ followup.id
4961
+ )) })
4962
+ ]
4445
4963
  }
4446
- if (message.kind === "bulkProgress" && message.bulkProgress) {
4447
- const { processed, total, successes, failures } = message.bulkProgress;
4448
- const percentage = Math.round(processed / total * 100);
4449
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4450
- "div",
4451
- {
4452
- className: `${isRoleChange ? "mt-3" : ""}`,
4453
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "bg-gray-50 rounded-lg border border-gray-200 p-3", children: [
4454
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [
4455
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Loader2, { className: "h-4 w-4 animate-spin text-blue-600" }),
4456
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-sm font-medium text-gray-700", children: [
4457
- "Processing... ",
4458
- processed,
4459
- " of ",
4460
- total
4461
- ] })
4462
- ] }),
4463
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "h-2 bg-gray-200 rounded-full overflow-hidden mb-2", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4464
- "div",
4465
- {
4466
- className: "h-full bg-blue-600 transition-all duration-300",
4467
- style: { width: `${percentage}%` }
4468
- }
4469
- ) }),
4470
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-3 text-xs text-gray-600", children: [
4471
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1", children: [
4472
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CheckCircle2, { className: "h-3 w-3 text-green-600" }),
4473
- successes,
4474
- " successful"
4475
- ] }),
4476
- failures > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1 text-red-600", children: [
4477
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-3 w-3" }),
4478
- failures,
4479
- " failed"
4480
- ] })
4481
- ] })
4482
- ] })
4483
- },
4484
- message.id
4485
- );
4964
+ ) }, message.id);
4965
+ }),
4966
+ (activeGuide || guideComplete) && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
4967
+ activeGuide && activeGuide.stepIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4968
+ Button,
4969
+ {
4970
+ type: "button",
4971
+ size: "sm",
4972
+ variant: "secondary",
4973
+ className: "h-7 w-7 rounded-full p-0 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4974
+ onClick: goBackGuide,
4975
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowLeft, { className: "h-3.5 w-3.5 text-gray-600" })
4486
4976
  }
4487
- if (message.kind === "bulkSummary" && message.bulkSummary) {
4488
- const { total, successes, failures, navigationPage } = message.bulkSummary;
4489
- const hasFailures = failures.length > 0;
4490
- const pageLabel = navigationPage?.page === "customers" ? "Customers" : navigationPage?.page === "dashboard" ? "Dashboard" : navigationPage?.page === "settings" ? "Settings" : "Results";
4491
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4492
- "div",
4493
- {
4494
- className: `${isRoleChange ? "mt-3" : ""}`,
4495
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4496
- "div",
4497
- {
4498
- className: `rounded-lg border p-3 ${hasFailures ? "bg-amber-50 border-amber-200" : "bg-green-50 border-green-200"}`,
4499
- children: [
4500
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [
4501
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4502
- import_lucide_react4.CheckCircle2,
4503
- {
4504
- className: `h-5 w-5 ${hasFailures ? "text-amber-600" : "text-green-600"}`
4505
- }
4506
- ),
4507
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-sm font-medium text-gray-800", children: "Bulk operation complete" })
4508
- ] }),
4509
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-sm text-gray-600 mb-2", children: message.content || `Processed ${total} rows: ${successes} successful${hasFailures ? `, ${failures.length} failed` : ""}.` }),
4510
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-4 text-xs", children: [
4511
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1 text-green-700", children: [
4512
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CheckCircle2, { className: "h-3 w-3" }),
4513
- successes,
4514
- " successful"
4515
- ] }),
4516
- hasFailures && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1 text-red-600", children: [
4517
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-3 w-3" }),
4518
- failures.length,
4519
- " failed"
4520
- ] })
4521
- ] }),
4522
- hasFailures && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mt-3 pt-2 border-t border-amber-200", children: [
4523
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-amber-700 mb-1", children: "Failed Rows" }),
4524
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-1 max-h-32 overflow-y-auto", children: [
4525
- failures.slice(0, 5).map((failure, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4526
- "div",
4527
- {
4528
- className: "text-xs text-red-700 bg-red-50 rounded px-2 py-1",
4529
- children: [
4530
- "Row ",
4531
- failure.row,
4532
- ":",
4533
- " ",
4534
- failure.error || "Unknown error"
4535
- ]
4536
- },
4537
- i
4538
- )),
4539
- failures.length > 5 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "text-xs text-amber-600", children: [
4540
- "...and ",
4541
- failures.length - 5,
4542
- " more"
4543
- ] })
4544
- ] })
4545
- ] }),
4546
- navigationPage && successes > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-3 pt-2 border-t border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4547
- "button",
4548
- {
4549
- type: "button",
4550
- onClick: (e) => {
4551
- e.preventDefault();
4552
- e.stopPropagation();
4553
- if (onNavigate && navigationPage.page) {
4554
- onNavigate(
4555
- navigationPage.page,
4556
- navigationPage.subtab
4557
- );
4558
- }
4559
- },
4560
- className: "flex items-center gap-2 text-xs text-gray-500 hover:text-gray-700 transition-colors group cursor-pointer",
4561
- children: [
4562
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1 px-1.5 py-0.5 bg-gray-100 rounded text-[10px] font-medium text-gray-600 group-hover:bg-gray-200", children: [
4563
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-2.5 w-2.5" }),
4564
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "+" }),
4565
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-2.5 w-2.5" })
4566
- ] }),
4567
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
4568
- "View ",
4569
- pageLabel
4570
- ] })
4571
- ]
4572
- }
4573
- ) })
4574
- ]
4575
- }
4576
- )
4577
- },
4578
- message.id
4579
- );
4977
+ ),
4978
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4979
+ Button,
4980
+ {
4981
+ type: "button",
4982
+ size: "sm",
4983
+ variant: "secondary",
4984
+ className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4985
+ onClick: guideComplete ? handleBack : advanceGuide,
4986
+ children: [
4987
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: guideComplete ? "Done" : "Next" }),
4988
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
4989
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
4990
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
4991
+ ] })
4992
+ ]
4580
4993
  }
4581
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(React6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4582
- "div",
4994
+ )
4995
+ ] }),
4996
+ (phase === "thinking" || phase === "searching" || phase === "executing" || phase === "responding") && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `${lastRole === "user" ? "mt-3" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4997
+ AssistantActivity,
4998
+ {
4999
+ phase,
5000
+ progressSteps
5001
+ }
5002
+ ) }),
5003
+ isEscalated && agentIsTyping && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex items-start mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "bg-gray-200 rounded-2xl rounded-bl-md px-4 py-3", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TypingIndicator, {}) }) }),
5004
+ !activeGuide && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { ref: messagesEndRef })
5005
+ ] }) }) }) })
5006
+ ] }),
5007
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
5008
+ "div",
5009
+ {
5010
+ className: `px-4 py-3 bg-white shrink-0 ${isDragOver ? "ring-2 ring-blue-400 ring-inset bg-blue-50" : ""}`,
5011
+ onDragOver: handleDragOver,
5012
+ onDragLeave: handleDragLeave,
5013
+ onDrop: handleDrop,
5014
+ children: [
5015
+ pendingFile && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mb-2 flex items-center gap-2 rounded-xl bg-blue-50 border border-blue-200 px-3 py-2", children: [
5016
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.FileSpreadsheet, { className: "h-4 w-4 text-blue-600" }),
5017
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs text-blue-700 flex-1 truncate", children: pendingFile.name }),
5018
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5019
+ "button",
4583
5020
  {
4584
- ref: isCurrentGuideStep ? currentStepRef : null,
4585
- className: `${isRoleChange ? "mt-3" : ""}`,
4586
- children: [
4587
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-sm leading-6 text-gray-700", children: (() => {
4588
- const text = message.content || "";
4589
- if (message.kind === "guideStep") {
4590
- const m = text.match(/^(Step\s+\d+:)([\s\S]*)/);
4591
- if (m) {
4592
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
4593
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: m[1] }),
4594
- m[2]
4595
- ] });
4596
- }
4597
- }
4598
- if (message.role === "assistant" && text) {
4599
- return renderMarkdown(text);
4600
- }
4601
- return text || /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "opacity-70", children: "Thinking\u2026" });
4602
- })() }),
4603
- message.role === "assistant" && message.structuredData && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4604
- DataRenderer,
4605
- {
4606
- type: message.structuredData.type,
4607
- data: message.structuredData.data
4608
- }
4609
- ) }),
4610
- message.role === "assistant" && message.followups && message.followups.length > 0 && !message.followupSelected && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-3 flex flex-wrap gap-1.5", children: message.followups.map((followup) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4611
- "button",
4612
- {
4613
- type: "button",
4614
- onClick: () => handleFollowupClick(message.id, followup),
4615
- 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",
4616
- children: followup.label
4617
- },
4618
- followup.id
4619
- )) })
4620
- ]
5021
+ type: "button",
5022
+ onClick: () => {
5023
+ setPendingFile(null);
5024
+ if (fileInputRef.current) fileInputRef.current.value = "";
5025
+ },
5026
+ className: "text-blue-600 hover:text-blue-800",
5027
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-4 w-4" })
4621
5028
  }
4622
- ) }, message.id);
4623
- }),
4624
- (activeGuide || guideComplete) && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
4625
- activeGuide && activeGuide.stepIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4626
- Button,
5029
+ )
5030
+ ] }),
5031
+ pendingImages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mb-2 flex flex-wrap gap-2", children: [
5032
+ pendingImages.map((img, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "relative group", children: [
5033
+ img.preview ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5034
+ "img",
5035
+ {
5036
+ src: img.preview,
5037
+ alt: `Preview ${index + 1}`,
5038
+ className: "h-16 w-16 object-cover rounded-lg border border-gray-200"
5039
+ }
5040
+ ) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "h-16 w-16 rounded-lg border border-gray-200 bg-gray-100 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.FileSpreadsheet, { className: "h-6 w-6 text-gray-400" }) }),
5041
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5042
+ "button",
5043
+ {
5044
+ type: "button",
5045
+ onClick: () => {
5046
+ if (img.preview) URL.revokeObjectURL(img.preview);
5047
+ setPendingImages((prev) => prev.filter((_, i) => i !== index));
5048
+ },
5049
+ 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",
5050
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-2.5 w-2.5" })
5051
+ }
5052
+ )
5053
+ ] }, index)),
5054
+ isUploadingImage && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "h-16 w-16 rounded-lg border border-gray-200 bg-gray-50 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Loader2, { className: "h-5 w-5 animate-spin text-gray-400" }) })
5055
+ ] }),
5056
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("form", { onSubmit: handleSubmit, className: "w-full", children: [
5057
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5058
+ "input",
4627
5059
  {
4628
- type: "button",
4629
- size: "sm",
4630
- variant: "secondary",
4631
- className: "h-7 w-7 rounded-full p-0 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4632
- onClick: goBackGuide,
4633
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowLeft, { className: "h-3.5 w-3.5 text-gray-600" })
5060
+ ref: fileInputRef,
5061
+ type: "file",
5062
+ accept: ".csv",
5063
+ className: "hidden",
5064
+ onChange: (e) => {
5065
+ const file = e.target.files?.[0];
5066
+ if (file) {
5067
+ setPendingFile(file);
5068
+ }
5069
+ }
4634
5070
  }
4635
5071
  ),
4636
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4637
- Button,
5072
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5073
+ "input",
4638
5074
  {
4639
- type: "button",
4640
- size: "sm",
4641
- variant: "secondary",
4642
- className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4643
- onClick: guideComplete ? handleBack : advanceGuide,
4644
- children: [
4645
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: guideComplete ? "Done" : "Next" }),
4646
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
4647
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
4648
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
4649
- ] })
4650
- ]
4651
- }
4652
- )
4653
- ] }),
4654
- (phase === "thinking" || phase === "searching" || phase === "executing" || phase === "responding") && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `${lastRole === "user" ? "mt-3" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4655
- AssistantActivity,
4656
- {
4657
- phase,
4658
- progressSteps
4659
- }
4660
- ) }),
4661
- isEscalated && agentIsTyping && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TypingIndicator, {}) }),
4662
- !activeGuide && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { ref: messagesEndRef })
4663
- ] }) }) }) })
4664
- }
4665
- ),
4666
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "px-4 py-3 bg-white shrink-0", children: [
4667
- pendingFile && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mb-2 flex items-center gap-2 rounded-xl bg-blue-50 border border-blue-200 px-3 py-2", children: [
4668
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.FileSpreadsheet, { className: "h-4 w-4 text-blue-600" }),
4669
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs text-blue-700 flex-1 truncate", children: pendingFile.name }),
4670
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4671
- "button",
4672
- {
4673
- type: "button",
4674
- onClick: () => {
4675
- setPendingFile(null);
4676
- if (fileInputRef.current) fileInputRef.current.value = "";
4677
- },
4678
- className: "text-blue-600 hover:text-blue-800",
4679
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-4 w-4" })
4680
- }
4681
- )
4682
- ] }),
4683
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("form", { onSubmit: handleSubmit, className: "w-full", children: [
4684
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4685
- "input",
4686
- {
4687
- ref: fileInputRef,
4688
- type: "file",
4689
- accept: ".csv",
4690
- className: "hidden",
4691
- onChange: (e) => {
4692
- const file = e.target.files?.[0];
4693
- if (file) {
4694
- setPendingFile(file);
5075
+ ref: imageInputRef,
5076
+ type: "file",
5077
+ accept: "image/*,.pdf,.csv",
5078
+ multiple: true,
5079
+ className: "hidden",
5080
+ onChange: (e) => {
5081
+ const files = e.target.files;
5082
+ if (!files || files.length === 0) return;
5083
+ const csvFile = Array.from(files).find((f) => f.name.endsWith(".csv"));
5084
+ if (csvFile && !isEscalated) {
5085
+ setPendingFile(csvFile);
5086
+ } else {
5087
+ handleImageSelect(files);
5088
+ }
5089
+ }
4695
5090
  }
4696
- }
4697
- }
4698
- ),
4699
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full items-start gap-2 rounded-xl border border-gray-200 bg-white px-3 py-2 shadow-sm", children: [
4700
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4701
- Button,
4702
- {
4703
- type: "button",
4704
- size: "icon",
4705
- variant: "ghost",
4706
- onClick: () => fileInputRef.current?.click(),
4707
- className: "h-5 w-5 rounded-full text-gray-400 hover:text-gray-600 hover:bg-gray-100",
4708
- title: "Upload CSV for bulk operations",
4709
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Paperclip, { className: "h-2.5 w-2.5" })
4710
- }
4711
- ),
4712
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4713
- "textarea",
4714
- {
4715
- placeholder: pendingFile ? "Describe what to do with this CSV..." : "Ask anything...",
4716
- value: input,
4717
- onChange: (e) => {
4718
- setInput(e.target.value);
4719
- if (e.target.value.length > 0) {
4720
- handleTypingStart();
5091
+ ),
5092
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex w-full items-start gap-2 rounded-xl border bg-white px-3 py-2 shadow-sm ${isDragOver ? "border-blue-400" : "border-gray-200"}`, children: [
5093
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5094
+ Button,
5095
+ {
5096
+ type: "button",
5097
+ size: "icon",
5098
+ variant: "ghost",
5099
+ onClick: () => {
5100
+ imageInputRef.current?.click();
5101
+ },
5102
+ className: "h-5 w-5 rounded-full text-gray-400 hover:text-gray-600 hover:bg-gray-100",
5103
+ title: "Attach file (image, PDF, or CSV)",
5104
+ disabled: isUploadingImage,
5105
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Paperclip, { className: "h-2.5 w-2.5" })
4721
5106
  }
4722
- },
4723
- rows: 1,
4724
- 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",
4725
- style: { minHeight: "20px", maxHeight: "120px" },
4726
- onInput: (e) => {
4727
- const target = e.target;
4728
- target.style.height = "auto";
4729
- target.style.height = Math.min(target.scrollHeight, 120) + "px";
4730
- },
4731
- onKeyDown: (e) => {
4732
- if (e.key === "Enter" && !e.shiftKey && !e.metaKey && !e.ctrlKey) {
4733
- e.preventDefault();
4734
- if (input.trim() || pendingFile) {
4735
- const form = e.currentTarget.closest("form");
4736
- if (form) {
4737
- form.requestSubmit();
5107
+ ),
5108
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5109
+ "textarea",
5110
+ {
5111
+ placeholder: pendingFile ? "Describe what to do with this CSV..." : pendingImages.length > 0 ? "Add a message (optional)..." : isDragOver ? "Drop files here..." : "Ask anything...",
5112
+ value: input,
5113
+ onChange: (e) => {
5114
+ setInput(e.target.value);
5115
+ if (e.target.value.length > 0) {
5116
+ handleTypingStart();
5117
+ }
5118
+ },
5119
+ rows: 1,
5120
+ 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",
5121
+ style: { minHeight: "20px", maxHeight: "120px" },
5122
+ onInput: (e) => {
5123
+ const target = e.target;
5124
+ target.style.height = "auto";
5125
+ target.style.height = Math.min(target.scrollHeight, 120) + "px";
5126
+ },
5127
+ onKeyDown: (e) => {
5128
+ if (e.key === "Enter" && !e.shiftKey && !e.metaKey && !e.ctrlKey) {
5129
+ e.preventDefault();
5130
+ if (input.trim() || pendingFile || pendingImages.length > 0) {
5131
+ const form = e.currentTarget.closest("form");
5132
+ if (form) {
5133
+ form.requestSubmit();
5134
+ }
5135
+ }
5136
+ return;
5137
+ }
5138
+ if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
5139
+ const currentBulkSession = pendingBulkSessionRef.current;
5140
+ if (currentBulkSession) {
5141
+ e.preventDefault();
5142
+ e.stopPropagation();
5143
+ confirmBulkOperation(currentBulkSession);
5144
+ return;
5145
+ }
5146
+ if (pendingAction) {
5147
+ e.preventDefault();
5148
+ e.stopPropagation();
5149
+ handleActionSubmit();
5150
+ return;
5151
+ }
5152
+ if (pendingNavigation) {
5153
+ e.preventDefault();
5154
+ e.stopPropagation();
5155
+ handleConfirmNavigation(pendingNavigation);
5156
+ return;
5157
+ }
5158
+ const currentGuide = activeGuideRef.current;
5159
+ if (currentGuide) {
5160
+ e.preventDefault();
5161
+ e.stopPropagation();
5162
+ advanceGuide();
5163
+ return;
5164
+ }
4738
5165
  }
4739
5166
  }
4740
- return;
4741
5167
  }
4742
- if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
4743
- const currentBulkSession = pendingBulkSessionRef.current;
4744
- if (currentBulkSession) {
4745
- e.preventDefault();
4746
- e.stopPropagation();
4747
- confirmBulkOperation(currentBulkSession);
4748
- return;
4749
- }
4750
- if (pendingAction) {
4751
- e.preventDefault();
4752
- e.stopPropagation();
4753
- handleActionSubmit();
4754
- return;
4755
- }
4756
- if (pendingNavigation) {
4757
- e.preventDefault();
4758
- e.stopPropagation();
4759
- handleConfirmNavigation(pendingNavigation);
4760
- return;
4761
- }
4762
- const currentGuide = activeGuideRef.current;
4763
- if (currentGuide) {
5168
+ ),
5169
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5170
+ Button,
5171
+ {
5172
+ type: "submit",
5173
+ size: "icon",
5174
+ disabled: !input.trim() && !pendingFile && pendingImages.length === 0 || isWaitingForAuth,
5175
+ className: "h-6 w-6 rounded-full bg-gray-700 hover:bg-gray-600 disabled:bg-gray-300",
5176
+ onClick: (e) => {
4764
5177
  e.preventDefault();
4765
- e.stopPropagation();
4766
- advanceGuide();
4767
- return;
4768
- }
5178
+ const form = e.currentTarget.closest("form");
5179
+ if (form) {
5180
+ form.requestSubmit();
5181
+ }
5182
+ },
5183
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowUp, { className: "h-2.5 w-2.5 text-white" })
4769
5184
  }
4770
- }
4771
- }
4772
- ),
4773
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4774
- Button,
4775
- {
4776
- type: "submit",
4777
- size: "icon",
4778
- disabled: !input.trim() && !pendingFile || isWaitingForAuth,
4779
- className: "h-6 w-6 rounded-full bg-gray-900 hover:bg-gray-800 disabled:bg-gray-300",
4780
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowUp, { className: "h-2.5 w-2.5" })
4781
- }
4782
- )
4783
- ] })
4784
- ] })
4785
- ] }),
5185
+ )
5186
+ ] })
5187
+ ] })
5188
+ ]
5189
+ }
5190
+ ),
4786
5191
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4787
5192
  GuideCursor,
4788
5193
  {
@@ -4791,6 +5196,13 @@ ${userText}`
4791
5196
  visible: cursorState.visible,
4792
5197
  onClick: cursorState.onClick
4793
5198
  }
5199
+ ),
5200
+ lightboxImageUrl && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5201
+ ImageLightbox,
5202
+ {
5203
+ imageUrl: lightboxImageUrl,
5204
+ onClose: () => setLightboxImageUrl(null)
5205
+ }
4794
5206
  )
4795
5207
  ]
4796
5208
  }
@@ -4835,7 +5247,8 @@ function ChatPanelWithToggle({
4835
5247
  initialCorner,
4836
5248
  onCornerChange,
4837
5249
  productBackendUrl,
4838
- getAuthHeaders
5250
+ getAuthHeaders,
5251
+ isEval
4839
5252
  }) {
4840
5253
  const [internalIsOpen, setInternalIsOpen] = React6.useState(defaultOpen);
4841
5254
  const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
@@ -4866,7 +5279,8 @@ function ChatPanelWithToggle({
4866
5279
  initialCorner,
4867
5280
  onCornerChange,
4868
5281
  productBackendUrl,
4869
- getAuthHeaders
5282
+ getAuthHeaders,
5283
+ isEval
4870
5284
  }
4871
5285
  );
4872
5286
  }