@kite-copilot/chat-panel 0.2.53 → 0.2.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/auto.cjs CHANGED
@@ -40,6 +40,7 @@ var import_client = require("react-dom/client");
40
40
 
41
41
  // src/ChatPanel.tsx
42
42
  var React6 = __toESM(require("react"), 1);
43
+ var import_react_dom = require("react-dom");
43
44
  var import_supabase_js = require("@supabase/supabase-js");
44
45
 
45
46
  // src/lib/utils.ts
@@ -1560,53 +1561,107 @@ function ImageLightbox({
1560
1561
  window.open(imageUrl, "_blank");
1561
1562
  }
1562
1563
  };
1563
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1564
- "div",
1565
- {
1566
- className: "fixed inset-0 z-[100] flex items-center justify-center bg-black/80",
1567
- onClick: onClose,
1568
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1569
- "div",
1570
- {
1571
- className: "relative max-w-[90vw] max-h-[90vh] flex flex-col items-center",
1572
- onClick: (e) => e.stopPropagation(),
1573
- children: [
1574
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1575
- "img",
1576
- {
1577
- src: imageUrl,
1578
- alt: "Full size preview",
1579
- className: "max-w-full max-h-[80vh] object-contain rounded-lg"
1580
- }
1581
- ),
1582
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex gap-3 mt-4", children: [
1583
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1584
- "button",
1585
- {
1586
- onClick: handleDownload,
1587
- className: "flex items-center gap-2 px-4 py-2 bg-white text-gray-800 rounded-lg hover:bg-gray-100 transition-colors text-sm font-medium",
1588
- children: [
1589
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Download, { className: "h-4 w-4" }),
1590
- "Download"
1591
- ]
1592
- }
1593
- ),
1594
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1595
- "button",
1596
- {
1597
- onClick: onClose,
1598
- className: "flex items-center gap-2 px-4 py-2 bg-gray-700 text-white rounded-lg hover:bg-gray-600 transition-colors text-sm font-medium",
1599
- children: [
1600
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-4 w-4" }),
1601
- "Close"
1602
- ]
1603
- }
1604
- )
1605
- ] })
1606
- ]
1607
- }
1608
- )
1609
- }
1564
+ return (0, import_react_dom.createPortal)(
1565
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1566
+ "div",
1567
+ {
1568
+ style: {
1569
+ position: "fixed",
1570
+ top: 0,
1571
+ left: 0,
1572
+ right: 0,
1573
+ bottom: 0,
1574
+ display: "flex",
1575
+ alignItems: "center",
1576
+ justifyContent: "center",
1577
+ backgroundColor: "rgba(0, 0, 0, 0.8)",
1578
+ zIndex: 99999
1579
+ },
1580
+ onClick: onClose,
1581
+ children: [
1582
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1583
+ "button",
1584
+ {
1585
+ onClick: (e) => {
1586
+ e.stopPropagation();
1587
+ onClose();
1588
+ },
1589
+ style: {
1590
+ position: "absolute",
1591
+ top: "16px",
1592
+ right: "16px",
1593
+ padding: "8px",
1594
+ borderRadius: "9999px",
1595
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
1596
+ color: "white",
1597
+ border: "none",
1598
+ cursor: "pointer",
1599
+ display: "flex",
1600
+ alignItems: "center",
1601
+ justifyContent: "center"
1602
+ },
1603
+ "aria-label": "Close",
1604
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { style: { height: "24px", width: "24px" } })
1605
+ }
1606
+ ),
1607
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1608
+ "div",
1609
+ {
1610
+ style: {
1611
+ position: "relative",
1612
+ maxWidth: "90vw",
1613
+ maxHeight: "90vh",
1614
+ display: "flex",
1615
+ flexDirection: "column",
1616
+ alignItems: "center"
1617
+ },
1618
+ onClick: (e) => e.stopPropagation(),
1619
+ children: [
1620
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1621
+ "img",
1622
+ {
1623
+ src: imageUrl,
1624
+ alt: "Full size preview",
1625
+ style: {
1626
+ maxWidth: "100%",
1627
+ maxHeight: "85vh",
1628
+ objectFit: "contain",
1629
+ borderRadius: "8px",
1630
+ boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.25)"
1631
+ }
1632
+ }
1633
+ ),
1634
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { display: "flex", gap: "12px", marginTop: "16px" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1635
+ "button",
1636
+ {
1637
+ onClick: handleDownload,
1638
+ style: {
1639
+ display: "flex",
1640
+ alignItems: "center",
1641
+ gap: "8px",
1642
+ padding: "8px 16px",
1643
+ backgroundColor: "white",
1644
+ color: "#1f2937",
1645
+ borderRadius: "8px",
1646
+ border: "none",
1647
+ cursor: "pointer",
1648
+ fontSize: "14px",
1649
+ fontWeight: 500,
1650
+ boxShadow: "0 10px 15px -3px rgba(0, 0, 0, 0.1)"
1651
+ },
1652
+ children: [
1653
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Download, { style: { height: "16px", width: "16px" } }),
1654
+ "Download"
1655
+ ]
1656
+ }
1657
+ ) })
1658
+ ]
1659
+ }
1660
+ )
1661
+ ]
1662
+ }
1663
+ ),
1664
+ document.body
1610
1665
  );
1611
1666
  }
1612
1667
  function ChatPanel({
@@ -1720,6 +1775,18 @@ function ChatPanel({
1720
1775
  }
1721
1776
  );
1722
1777
  }
1778
+ if (supabaseRef.current && sessionId) {
1779
+ console.log("[KiteChat] resetSession - marking session as ended:", sessionId);
1780
+ supabaseRef.current.from("sessions").update({ session_status: "ended" }).eq("session_id", sessionId).then(
1781
+ () => console.log("[KiteChat] resetSession - session marked as ended successfully:", sessionId),
1782
+ (err) => console.error("[KiteChat] resetSession - failed to mark session as ended:", sessionId, err)
1783
+ );
1784
+ } else {
1785
+ console.log("[KiteChat] resetSession - skipped marking session as ended:", {
1786
+ hasSupabase: !!supabaseRef.current,
1787
+ sessionId
1788
+ });
1789
+ }
1723
1790
  setSessionUser(null);
1724
1791
  setSessionId(crypto.randomUUID());
1725
1792
  setIsEscalated(false);
@@ -1795,6 +1862,42 @@ function ChatPanel({
1795
1862
  );
1796
1863
  }
1797
1864
  }, [isOpen, isEscalated, sessionId]);
1865
+ React6.useEffect(() => {
1866
+ if (!sessionId || !effectiveSupabaseUrl || !effectiveSupabaseAnonKey) {
1867
+ console.log("[KiteChat] Session end handler skipped - missing:", {
1868
+ sessionId: !!sessionId,
1869
+ supabaseUrl: !!effectiveSupabaseUrl,
1870
+ supabaseKey: !!effectiveSupabaseAnonKey
1871
+ });
1872
+ return;
1873
+ }
1874
+ const currentSessionId = sessionId;
1875
+ const sbUrl = effectiveSupabaseUrl;
1876
+ const sbKey = effectiveSupabaseAnonKey;
1877
+ console.log("[KiteChat] Registering session end handler for session:", currentSessionId);
1878
+ const markSessionEnded = () => {
1879
+ console.log("[KiteChat] Marking session as ended:", currentSessionId);
1880
+ const sessionsUrl = `${sbUrl}/rest/v1/sessions?session_id=eq.${currentSessionId}`;
1881
+ fetch(sessionsUrl, {
1882
+ method: "PATCH",
1883
+ headers: {
1884
+ "Content-Type": "application/json",
1885
+ "apikey": sbKey,
1886
+ "Authorization": `Bearer ${sbKey}`,
1887
+ "Prefer": "return=minimal"
1888
+ },
1889
+ body: JSON.stringify({ session_status: "ended" }),
1890
+ keepalive: true
1891
+ }).catch(() => {
1892
+ });
1893
+ };
1894
+ window.addEventListener("beforeunload", markSessionEnded);
1895
+ return () => {
1896
+ console.log("[KiteChat] Component unmounting - marking session as ended:", currentSessionId);
1897
+ window.removeEventListener("beforeunload", markSessionEnded);
1898
+ markSessionEnded();
1899
+ };
1900
+ }, [sessionId, effectiveSupabaseUrl, effectiveSupabaseAnonKey]);
1798
1901
  const heartbeatIntervalRef = React6.useRef(null);
1799
1902
  const updateCustomerStatus = React6.useCallback(async (status) => {
1800
1903
  if (!supabaseRef.current || !sessionId) return;
@@ -1826,7 +1929,11 @@ function ChatPanel({
1826
1929
  );
1827
1930
  };
1828
1931
  const markDisconnectedWithKeepalive = () => {
1829
- if (!sbUrl || !sbKey) return;
1932
+ console.log("[KiteChat] markDisconnectedWithKeepalive called for escalated session:", currentSessionId);
1933
+ if (!sbUrl || !sbKey) {
1934
+ console.log("[KiteChat] markDisconnectedWithKeepalive skipped - missing credentials");
1935
+ return;
1936
+ }
1830
1937
  const url = `${sbUrl}/rest/v1/escalations?session_id=eq.${currentSessionId}`;
1831
1938
  fetch(url, {
1832
1939
  method: "PATCH",
@@ -1843,6 +1950,20 @@ function ChatPanel({
1843
1950
  keepalive: true
1844
1951
  }).catch(() => {
1845
1952
  });
1953
+ console.log("[KiteChat] markDisconnectedWithKeepalive - also marking session as ended:", currentSessionId);
1954
+ const sessionsUrl = `${sbUrl}/rest/v1/sessions?session_id=eq.${currentSessionId}`;
1955
+ fetch(sessionsUrl, {
1956
+ method: "PATCH",
1957
+ headers: {
1958
+ "Content-Type": "application/json",
1959
+ "apikey": sbKey,
1960
+ "Authorization": `Bearer ${sbKey}`,
1961
+ "Prefer": "return=minimal"
1962
+ },
1963
+ body: JSON.stringify({ session_status: "ended" }),
1964
+ keepalive: true
1965
+ }).catch(() => {
1966
+ });
1846
1967
  };
1847
1968
  console.log("[KiteChat] Starting presence heartbeat for live chat");
1848
1969
  markActive();
@@ -2029,8 +2150,28 @@ function ChatPanel({
2029
2150
  file,
2030
2151
  preview: file.type.startsWith("image/") ? URL.createObjectURL(file) : ""
2031
2152
  }));
2032
- setPendingImages((prev) => [...prev, ...newImages]);
2153
+ console.log("[KiteChat] Adding images to pending:", newImages.length, "files");
2154
+ setPendingImages((prev) => {
2155
+ const updated = [...prev, ...newImages];
2156
+ console.log("[KiteChat] pendingImages now:", updated.length);
2157
+ return updated;
2158
+ });
2033
2159
  }, []);
2160
+ React6.useEffect(() => {
2161
+ const hasText = input.trim().length > 0;
2162
+ const hasFile = !!pendingFile;
2163
+ const hasImages = pendingImages.length > 0;
2164
+ const disabled = !hasText && !hasFile && !hasImages || isWaitingForAuth;
2165
+ console.log("[KiteChat] Send button state:", {
2166
+ hasText,
2167
+ hasFile,
2168
+ hasImages,
2169
+ pendingImagesCount: pendingImages.length,
2170
+ isWaitingForAuth,
2171
+ authStatus: authState.status,
2172
+ disabled
2173
+ });
2174
+ }, [input, pendingFile, pendingImages, isWaitingForAuth, authState.status]);
2034
2175
  const handleDragOver = React6.useCallback((e) => {
2035
2176
  e.preventDefault();
2036
2177
  e.stopPropagation();
@@ -2192,12 +2333,20 @@ function ChatPanel({
2192
2333
  onNavigate
2193
2334
  ]);
2194
2335
  const connectToEscalationWs = React6.useCallback((currentSessionId) => {
2195
- if (!agentUrl) return;
2336
+ if (!agentUrl) {
2337
+ console.log("[KiteChat] No agentUrl, skipping WebSocket connection");
2338
+ return;
2339
+ }
2196
2340
  if (escalationWsRef.current) {
2341
+ console.log("[KiteChat] Closing existing WebSocket connection");
2197
2342
  escalationWsRef.current.close();
2198
2343
  }
2199
2344
  const wsUrl = agentUrl.replace(/^http/, "ws") + `/ws/escalation/${currentSessionId}`;
2345
+ console.log("[KiteChat] Connecting to escalation WebSocket:", wsUrl);
2200
2346
  const ws = new WebSocket(wsUrl);
2347
+ ws.onopen = () => {
2348
+ console.log("[KiteChat] Escalation WebSocket connected successfully");
2349
+ };
2201
2350
  ws.onmessage = (event) => {
2202
2351
  try {
2203
2352
  const data = JSON.parse(event.data);
@@ -2228,13 +2377,18 @@ function ChatPanel({
2228
2377
  ws.onerror = (err) => {
2229
2378
  console.error("[KiteChat] Escalation WebSocket error:", err);
2230
2379
  };
2231
- ws.onclose = () => {
2380
+ ws.onclose = (event) => {
2381
+ console.log("[KiteChat] Escalation WebSocket closed - code:", event.code, "reason:", event.reason);
2232
2382
  };
2233
2383
  escalationWsRef.current = ws;
2234
2384
  }, [agentUrl]);
2235
2385
  const sendEscalatedMessage = React6.useCallback(async (content) => {
2236
- if (!escalationWsRef.current || escalationWsRef.current.readyState !== WebSocket.OPEN) {
2237
- console.error("[KiteChat] Escalation WebSocket not connected");
2386
+ if (!escalationWsRef.current) {
2387
+ console.error("[KiteChat] Escalation WebSocket not connected - no ref");
2388
+ return false;
2389
+ }
2390
+ if (escalationWsRef.current.readyState !== WebSocket.OPEN) {
2391
+ console.error("[KiteChat] Escalation WebSocket not connected - state:", escalationWsRef.current.readyState, "(0=CONNECTING, 1=OPEN, 2=CLOSING, 3=CLOSED)");
2238
2392
  return false;
2239
2393
  }
2240
2394
  try {
@@ -2266,7 +2420,9 @@ function ChatPanel({
2266
2420
  };
2267
2421
  }, []);
2268
2422
  React6.useEffect(() => {
2423
+ console.log("[KiteChat] Escalation useEffect - isEscalated:", isEscalated, "sessionId:", sessionId);
2269
2424
  if (isEscalated && sessionId) {
2425
+ console.log("[KiteChat] Triggering WebSocket connection for escalation");
2270
2426
  connectToEscalationWs(sessionId);
2271
2427
  }
2272
2428
  }, [isEscalated, sessionId, connectToEscalationWs]);
@@ -3536,8 +3692,8 @@ ${userText}`
3536
3692
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3537
3693
  "section",
3538
3694
  {
3539
- 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"}`,
3540
- style: { width: `${PANEL_WIDTH}px` },
3695
+ 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"}`,
3696
+ style: { width: `${PANEL_WIDTH}px`, height: `${PANEL_HEIGHT}px` },
3541
3697
  children: [
3542
3698
  /* @__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: [
3543
3699
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2.5", children: [
@@ -3568,8 +3724,8 @@ ${userText}`
3568
3724
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3569
3725
  "section",
3570
3726
  {
3571
- 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"}`,
3572
- style: { width: `${PANEL_WIDTH}px` },
3727
+ 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"}`,
3728
+ style: { width: `${PANEL_WIDTH}px`, height: `${PANEL_HEIGHT}px` },
3573
3729
  children: [
3574
3730
  /* @__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: [
3575
3731
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2.5", children: [
@@ -3596,8 +3752,8 @@ ${userText}`
3596
3752
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3597
3753
  "section",
3598
3754
  {
3599
- 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"}`,
3600
- style: { width: `${PANEL_WIDTH}px` },
3755
+ 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"}`,
3756
+ style: { width: `${PANEL_WIDTH}px`, height: `${PANEL_HEIGHT}px` },
3601
3757
  children: [
3602
3758
  /* @__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: [
3603
3759
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2.5", children: [
@@ -3649,9 +3805,8 @@ ${userText}`
3649
3805
  size: "sm",
3650
3806
  className: "h-7 w-7 p-0 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-full",
3651
3807
  onClick: () => {
3652
- resetSession();
3653
3808
  setMessages([]);
3654
- setPanelView("landing");
3809
+ resetSession();
3655
3810
  setCurrentFolderId(void 0);
3656
3811
  setActiveGuide(void 0);
3657
3812
  activeGuideRef.current = void 0;
@@ -3683,1181 +3838,1184 @@ ${userText}`
3683
3838
  )
3684
3839
  ] })
3685
3840
  ] }),
3686
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3687
- "div",
3688
- {
3689
- 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",
3690
- children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w-full overflow-y-auto px-4", children: [
3691
- /* @__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?" }) }),
3692
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "pb-4 px-4", children: [
3693
- 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) => {
3694
- const iconColors = [
3695
- "bg-blue-400",
3696
- "bg-green-400",
3697
- "bg-purple-400",
3698
- "bg-orange-400",
3699
- "bg-pink-400"
3700
- ];
3701
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3702
- Button,
3703
- {
3704
- type: "button",
3705
- size: "sm",
3706
- variant: "ghost",
3707
- className: "w-full justify-start rounded-lg px-3 py-1.5 text-xs text-gray-700 hover:bg-gray-100 h-auto",
3708
- onClick: () => sendTopic(question.prompt),
3709
- children: [
3710
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3711
- "span",
3712
- {
3713
- className: `mr-2 inline-block h-1.5 w-1.5 rounded-full ${iconColors[index % iconColors.length]}`
3714
- }
3715
- ),
3716
- question.label
3717
- ]
3718
- },
3719
- question.id
3720
- );
3721
- }) }) }),
3722
- panelView === "folder" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
3723
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mb-3 flex items-center gap-2", children: [
3724
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3841
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex-1 flex flex-col min-h-0 overflow-hidden relative", children: [
3842
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3843
+ "div",
3844
+ {
3845
+ className: `absolute inset-0 grid place-items-center overflow-y-auto ${isEmpty ? "visible" : "invisible pointer-events-none"}`,
3846
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w-full px-4", children: [
3847
+ /* @__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?" }) }),
3848
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "pb-4 px-4", children: [
3849
+ 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) => {
3850
+ const iconColors = [
3851
+ "bg-blue-400",
3852
+ "bg-green-400",
3853
+ "bg-purple-400",
3854
+ "bg-orange-400",
3855
+ "bg-pink-400"
3856
+ ];
3857
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3725
3858
  Button,
3726
3859
  {
3727
3860
  type: "button",
3728
- size: "icon",
3861
+ size: "sm",
3729
3862
  variant: "ghost",
3730
- className: "h-7 w-7 rounded-full hover:bg-gray-100",
3731
- onClick: closeFolder,
3732
- "aria-label": "Back to suggestions",
3733
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowLeft, { className: "h-4 w-4 text-gray-500" })
3734
- }
3735
- ),
3736
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs font-medium uppercase tracking-wide text-gray-400", children: "Topics" })
3737
- ] }),
3738
- /* @__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)(
3739
- Button,
3740
- {
3741
- type: "button",
3742
- size: "sm",
3743
- variant: "secondary",
3744
- 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",
3745
- onClick: () => sendTopic(topic.prompt),
3746
- children: topic.label
3747
- },
3748
- topic.id
3749
- )) })
3750
- ] })
3751
- ] })
3752
- ] }) : /* @__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: [
3753
- messages.map((message, index) => {
3754
- const isUser = message.role === "user";
3755
- const previousRole = index > 0 ? messages[index - 1].role : void 0;
3756
- const isRoleChange = previousRole !== void 0 && previousRole !== message.role;
3757
- const currentGuide = activeGuideRef.current || activeGuide;
3758
- let isCurrentGuideStep = false;
3759
- if (currentGuide && message.kind === "guideStep") {
3760
- if (message.guideStepIndex !== void 0) {
3761
- isCurrentGuideStep = message.guideStepIndex === currentGuide.stepIndex;
3762
- } else {
3763
- isCurrentGuideStep = index === messages.length - 1;
3764
- }
3765
- } else if (message.kind === "guideComplete") {
3766
- isCurrentGuideStep = index === messages.length - 1;
3767
- }
3768
- if (message.kind === "guideStep" && !isCurrentGuideStep) {
3769
- return null;
3770
- }
3771
- if (isUser) {
3772
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex flex-col items-end gap-2 ${isRoleChange ? "mt-3" : ""}`, children: [
3773
- 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)(
3774
- "button",
3775
- {
3776
- onClick: () => setLightboxImageUrl(url),
3777
- className: "block cursor-pointer",
3778
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3779
- "img",
3780
- {
3781
- src: url,
3782
- alt: `Attachment ${imgIndex + 1}`,
3783
- className: "max-h-32 max-w-[200px] rounded-lg object-cover border border-gray-700 hover:opacity-90 transition-opacity"
3784
- }
3785
- )
3863
+ className: "w-full justify-start rounded-lg px-3 py-1.5 text-xs text-gray-700 hover:bg-gray-100 h-auto",
3864
+ onClick: () => sendTopic(question.prompt),
3865
+ children: [
3866
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3867
+ "span",
3868
+ {
3869
+ className: `mr-2 inline-block h-1.5 w-1.5 rounded-full ${iconColors[index % iconColors.length]}`
3870
+ }
3871
+ ),
3872
+ question.label
3873
+ ]
3786
3874
  },
3787
- imgIndex
3788
- )) }),
3789
- 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() })
3790
- ] }, message.id);
3791
- }
3792
- if (message.role === "agent") {
3793
- const imageRegex = /!\[image\]\(([^)]+)\)/g;
3794
- const extractedImageUrls = [];
3795
- let match;
3796
- const contentStr = message.content || "";
3797
- while ((match = imageRegex.exec(contentStr)) !== null) {
3798
- extractedImageUrls.push(match[1]);
3799
- }
3800
- const agentImageUrls = message.imageUrls || extractedImageUrls;
3801
- const agentTextContent = contentStr.replace(/!\[image\]\([^)]+\)\n*/g, "").trim();
3802
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex flex-col items-start gap-2 ${isRoleChange ? "mt-3" : ""}`, children: [
3803
- isRoleChange && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[10px] text-gray-500 mb-1 ml-1", children: "Agent" }),
3804
- 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)(
3805
- "button",
3875
+ question.id
3876
+ );
3877
+ }) }) }),
3878
+ panelView === "folder" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
3879
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mb-3 flex items-center gap-2", children: [
3880
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3881
+ Button,
3882
+ {
3883
+ type: "button",
3884
+ size: "icon",
3885
+ variant: "ghost",
3886
+ className: "h-7 w-7 rounded-full hover:bg-gray-100",
3887
+ onClick: closeFolder,
3888
+ "aria-label": "Back to suggestions",
3889
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowLeft, { className: "h-4 w-4 text-gray-500" })
3890
+ }
3891
+ ),
3892
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs font-medium uppercase tracking-wide text-gray-400", children: "Topics" })
3893
+ ] }),
3894
+ /* @__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)(
3895
+ Button,
3806
3896
  {
3807
- onClick: () => setLightboxImageUrl(url),
3808
- className: "block cursor-pointer",
3809
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3810
- "img",
3811
- {
3812
- src: url,
3813
- alt: `Attachment ${imgIndex + 1}`,
3814
- className: "max-h-32 max-w-[200px] rounded-lg object-cover border border-gray-300 hover:opacity-90 transition-opacity"
3815
- }
3816
- )
3897
+ type: "button",
3898
+ size: "sm",
3899
+ variant: "secondary",
3900
+ 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",
3901
+ onClick: () => sendTopic(topic.prompt),
3902
+ children: topic.label
3817
3903
  },
3818
- imgIndex
3819
- )) }),
3820
- 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 })
3821
- ] }, message.id);
3904
+ topic.id
3905
+ )) })
3906
+ ] })
3907
+ ] })
3908
+ ] })
3909
+ }
3910
+ ),
3911
+ /* @__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: [
3912
+ messages.map((message, index) => {
3913
+ const isUser = message.role === "user";
3914
+ const previousRole = index > 0 ? messages[index - 1].role : void 0;
3915
+ const isRoleChange = previousRole !== void 0 && previousRole !== message.role;
3916
+ const currentGuide = activeGuideRef.current || activeGuide;
3917
+ let isCurrentGuideStep = false;
3918
+ if (currentGuide && message.kind === "guideStep") {
3919
+ if (message.guideStepIndex !== void 0) {
3920
+ isCurrentGuideStep = message.guideStepIndex === currentGuide.stepIndex;
3921
+ } else {
3922
+ isCurrentGuideStep = index === messages.length - 1;
3822
3923
  }
3823
- if (message.kind === "searchSummary") {
3824
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3825
- "div",
3924
+ } else if (message.kind === "guideComplete") {
3925
+ isCurrentGuideStep = index === messages.length - 1;
3926
+ }
3927
+ if (message.kind === "guideStep" && !isCurrentGuideStep) {
3928
+ return null;
3929
+ }
3930
+ if (isUser) {
3931
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex flex-col items-end gap-2 ${isRoleChange ? "mt-3" : ""}`, children: [
3932
+ 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)(
3933
+ "button",
3826
3934
  {
3827
- className: `${isRoleChange ? "mt-3" : ""}`,
3935
+ onClick: () => setLightboxImageUrl(url),
3936
+ className: "block cursor-pointer",
3828
3937
  children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3829
- AssistantSearchSummary,
3938
+ "img",
3830
3939
  {
3831
- title: message.title ?? "Search results",
3832
- links: message.links ?? []
3940
+ src: url,
3941
+ alt: `Attachment ${imgIndex + 1}`,
3942
+ className: "max-h-32 max-w-[200px] rounded-lg object-cover border border-gray-700 hover:opacity-90 transition-opacity"
3833
3943
  }
3834
3944
  )
3835
3945
  },
3836
- message.id
3837
- );
3946
+ imgIndex
3947
+ )) }),
3948
+ 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() })
3949
+ ] }, message.id);
3950
+ }
3951
+ if (message.role === "agent") {
3952
+ const imageRegex = /!\[image\]\(([^)]+)\)/g;
3953
+ const extractedImageUrls = [];
3954
+ let match;
3955
+ const contentStr = message.content || "";
3956
+ while ((match = imageRegex.exec(contentStr)) !== null) {
3957
+ extractedImageUrls.push(match[1]);
3838
3958
  }
3839
- if (message.kind === "guideComplete") {
3840
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3841
- "div",
3959
+ const agentImageUrls = message.imageUrls || extractedImageUrls;
3960
+ const agentTextContent = contentStr.replace(/!\[image\]\([^)]+\)\n*/g, "").trim();
3961
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex flex-col items-start gap-2 ${isRoleChange ? "mt-3" : ""}`, children: [
3962
+ isRoleChange && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[10px] text-gray-500 mb-1 ml-1", children: "Agent" }),
3963
+ 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)(
3964
+ "button",
3842
3965
  {
3843
- ref: isCurrentGuideStep ? currentStepRef : null,
3844
- className: `${isRoleChange ? "mt-3" : ""}`,
3845
- 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: [
3846
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CheckCircle2, { className: "h-5 w-5 text-green-600 flex-shrink-0" }),
3847
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "font-medium text-green-800", children: message.content })
3848
- ] })
3966
+ onClick: () => setLightboxImageUrl(url),
3967
+ className: "block cursor-pointer",
3968
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3969
+ "img",
3970
+ {
3971
+ src: url,
3972
+ alt: `Attachment ${imgIndex + 1}`,
3973
+ className: "max-h-32 max-w-[200px] rounded-lg object-cover border border-gray-300 hover:opacity-90 transition-opacity"
3974
+ }
3975
+ )
3849
3976
  },
3850
- message.id
3851
- );
3852
- }
3853
- if (message.kind === "navigationAction") {
3854
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3977
+ imgIndex
3978
+ )) }),
3979
+ 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 })
3980
+ ] }, message.id);
3981
+ }
3982
+ if (message.kind === "searchSummary") {
3983
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3984
+ "div",
3985
+ {
3986
+ className: `${isRoleChange ? "mt-3" : ""}`,
3987
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3988
+ AssistantSearchSummary,
3989
+ {
3990
+ title: message.title ?? "Search results",
3991
+ links: message.links ?? []
3992
+ }
3993
+ )
3994
+ },
3995
+ message.id
3996
+ );
3997
+ }
3998
+ if (message.kind === "guideComplete") {
3999
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4000
+ "div",
4001
+ {
4002
+ ref: isCurrentGuideStep ? currentStepRef : null,
4003
+ className: `${isRoleChange ? "mt-3" : ""}`,
4004
+ 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: [
4005
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CheckCircle2, { className: "h-5 w-5 text-green-600 flex-shrink-0" }),
4006
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "font-medium text-green-800", children: message.content })
4007
+ ] })
4008
+ },
4009
+ message.id
4010
+ );
4011
+ }
4012
+ if (message.kind === "navigationAction") {
4013
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4014
+ "div",
4015
+ {
4016
+ className: `${isRoleChange ? "mt-3" : ""}`,
4017
+ children: [
4018
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-2 text-gray-700", children: message.content || "" }),
4019
+ message.navigationTarget && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4020
+ Button,
4021
+ {
4022
+ type: "button",
4023
+ size: "sm",
4024
+ variant: "secondary",
4025
+ className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4026
+ onClick: () => message.navigationTarget && handleConfirmNavigation(
4027
+ message.navigationTarget
4028
+ ),
4029
+ children: [
4030
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Confirm" }),
4031
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
4032
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
4033
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
4034
+ ] })
4035
+ ]
4036
+ }
4037
+ ) })
4038
+ ]
4039
+ },
4040
+ message.id
4041
+ );
4042
+ }
4043
+ if (message.kind === "actionForm") {
4044
+ const actionType = message.actionType;
4045
+ const formData = Object.keys(actionFormData).length > 0 ? actionFormData : message.actionData || {};
4046
+ if (message.isSubmitted) {
4047
+ let successContent = "";
4048
+ if (actionType === "updateCompanyInfo") {
4049
+ successContent = "Company information has been updated successfully.";
4050
+ } else if (actionType === "addApiKey") {
4051
+ successContent = "API key has been added successfully.";
4052
+ } else if (actionType === "addCustomer") {
4053
+ successContent = "Customer has been added successfully.";
4054
+ } else if (actionType === "enable2FA") {
4055
+ successContent = "Two-factor authentication has been enabled successfully.";
4056
+ } else if (actionType === "disable2FA") {
4057
+ successContent = "Two-factor authentication has been disabled successfully.";
4058
+ } else if (actionType === "changePassword") {
4059
+ successContent = "Your password has been changed successfully.";
4060
+ } else if (actionType === "revokeSession") {
4061
+ successContent = "Session has been revoked successfully.";
4062
+ } else if (actionType === "toggleNotification") {
4063
+ successContent = "Notification preferences have been updated successfully.";
4064
+ } else if (actionType === "connectIntegration") {
4065
+ successContent = "Integration has been connected successfully.";
4066
+ } else if (actionType === "disconnectIntegration") {
4067
+ successContent = "Integration has been disconnected successfully.";
4068
+ } else if (actionType === "addPaymentMethod") {
4069
+ successContent = "Payment method has been added successfully.";
4070
+ } else if (actionType === "removePaymentMethod") {
4071
+ successContent = "Payment method has been removed successfully.";
4072
+ } else if (actionType === "deleteApiKey") {
4073
+ successContent = "API key has been deleted successfully.";
4074
+ } else if (actionType === "addWebhook") {
4075
+ successContent = "Webhook endpoint has been added successfully.";
4076
+ } else if (actionType === "updateCurrency") {
4077
+ successContent = "Currency preference has been updated successfully.";
4078
+ } else if (actionType === "updateTimezone") {
4079
+ successContent = "Timezone has been updated successfully.";
4080
+ } else if (actionType === "refundPayment") {
4081
+ successContent = "Refund has been processed successfully.";
4082
+ } else if (actionType === "exportCertificate") {
4083
+ successContent = "Certificate of Incorporation has been downloaded successfully.";
4084
+ } else if (actionType === "createSubscription") {
4085
+ successContent = "Subscription has been created successfully.";
4086
+ } else if (actionType === "toggleBlockRule" || actionType === "enableBlockRule" || actionType === "disableBlockRule") {
4087
+ successContent = "Block rule has been updated successfully.";
4088
+ } else {
4089
+ successContent = "Action completed successfully.";
4090
+ }
4091
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3855
4092
  "div",
3856
4093
  {
3857
4094
  className: `${isRoleChange ? "mt-3" : ""}`,
3858
- children: [
3859
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-2 text-gray-700", children: message.content || "" }),
3860
- message.navigationTarget && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3861
- Button,
3862
- {
3863
- type: "button",
3864
- size: "sm",
3865
- variant: "secondary",
3866
- className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
3867
- onClick: () => message.navigationTarget && handleConfirmNavigation(
3868
- message.navigationTarget
3869
- ),
3870
- children: [
3871
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Confirm" }),
3872
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
3873
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
3874
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
3875
- ] })
3876
- ]
3877
- }
3878
- ) })
3879
- ]
4095
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 text-gray-700", children: successContent })
3880
4096
  },
3881
4097
  message.id
3882
4098
  );
3883
4099
  }
3884
- if (message.kind === "actionForm") {
3885
- const actionType = message.actionType;
3886
- const formData = Object.keys(actionFormData).length > 0 ? actionFormData : message.actionData || {};
3887
- if (message.isSubmitted) {
3888
- let successContent = "";
3889
- if (actionType === "updateCompanyInfo") {
3890
- successContent = "Company information has been updated successfully.";
3891
- } else if (actionType === "addApiKey") {
3892
- successContent = "API key has been added successfully.";
3893
- } else if (actionType === "addCustomer") {
3894
- successContent = "Customer has been added successfully.";
3895
- } else if (actionType === "enable2FA") {
3896
- successContent = "Two-factor authentication has been enabled successfully.";
3897
- } else if (actionType === "disable2FA") {
3898
- successContent = "Two-factor authentication has been disabled successfully.";
3899
- } else if (actionType === "changePassword") {
3900
- successContent = "Your password has been changed successfully.";
3901
- } else if (actionType === "revokeSession") {
3902
- successContent = "Session has been revoked successfully.";
3903
- } else if (actionType === "toggleNotification") {
3904
- successContent = "Notification preferences have been updated successfully.";
3905
- } else if (actionType === "connectIntegration") {
3906
- successContent = "Integration has been connected successfully.";
3907
- } else if (actionType === "disconnectIntegration") {
3908
- successContent = "Integration has been disconnected successfully.";
3909
- } else if (actionType === "addPaymentMethod") {
3910
- successContent = "Payment method has been added successfully.";
3911
- } else if (actionType === "removePaymentMethod") {
3912
- successContent = "Payment method has been removed successfully.";
3913
- } else if (actionType === "deleteApiKey") {
3914
- successContent = "API key has been deleted successfully.";
3915
- } else if (actionType === "addWebhook") {
3916
- successContent = "Webhook endpoint has been added successfully.";
3917
- } else if (actionType === "updateCurrency") {
3918
- successContent = "Currency preference has been updated successfully.";
3919
- } else if (actionType === "updateTimezone") {
3920
- successContent = "Timezone has been updated successfully.";
3921
- } else if (actionType === "refundPayment") {
3922
- successContent = "Refund has been processed successfully.";
3923
- } else if (actionType === "exportCertificate") {
3924
- successContent = "Certificate of Incorporation has been downloaded successfully.";
3925
- } else if (actionType === "createSubscription") {
3926
- successContent = "Subscription has been created successfully.";
3927
- } else if (actionType === "toggleBlockRule" || actionType === "enableBlockRule" || actionType === "disableBlockRule") {
3928
- successContent = "Block rule has been updated successfully.";
3929
- } else {
3930
- successContent = "Action completed successfully.";
3931
- }
3932
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3933
- "div",
3934
- {
3935
- className: `${isRoleChange ? "mt-3" : ""}`,
3936
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 text-gray-700", children: successContent })
3937
- },
3938
- message.id
3939
- );
3940
- }
3941
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3942
- "div",
3943
- {
3944
- className: `min-w-0 ${isRoleChange ? "mt-3" : ""}`,
3945
- children: [
3946
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
3947
- 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: [
3948
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
3949
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3950
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
3951
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3952
- Input,
3953
- {
3954
- placeholder: "Acme Corporation",
3955
- value: formData.companyName || "",
3956
- onChange: (e) => setActionFormData({
3957
- ...actionFormData,
3958
- companyName: e.target.value
3959
- }),
3960
- className: "h-8 text-xs border-gray-200"
3961
- }
3962
- )
3963
- ] }),
3964
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3965
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
3966
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3967
- Input,
3968
- {
3969
- type: "email",
3970
- placeholder: "contact@acme.com",
3971
- value: formData.email || "",
3972
- onChange: (e) => setActionFormData({
3973
- ...actionFormData,
3974
- email: e.target.value
3975
- }),
3976
- className: "h-8 text-xs border-gray-200"
3977
- }
3978
- )
3979
- ] })
3980
- ] }),
4100
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4101
+ "div",
4102
+ {
4103
+ className: `min-w-0 ${isRoleChange ? "mt-3" : ""}`,
4104
+ children: [
4105
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
4106
+ 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: [
4107
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
3981
4108
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3982
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Address" }),
4109
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
3983
4110
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3984
4111
  Input,
3985
4112
  {
3986
- placeholder: "123 Main St, San Francisco, CA",
3987
- value: formData.address || "",
4113
+ placeholder: "Acme Corporation",
4114
+ value: formData.companyName || "",
3988
4115
  onChange: (e) => setActionFormData({
3989
4116
  ...actionFormData,
3990
- address: e.target.value
4117
+ companyName: e.target.value
3991
4118
  }),
3992
4119
  className: "h-8 text-xs border-gray-200"
3993
4120
  }
3994
4121
  )
3995
4122
  ] }),
3996
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
3997
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3998
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Phone" }),
3999
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4000
- Input,
4001
- {
4002
- type: "tel",
4003
- placeholder: "+1 (555) 123-4567",
4004
- value: formData.phone || "",
4005
- onChange: (e) => setActionFormData({
4006
- ...actionFormData,
4007
- phone: e.target.value
4008
- }),
4009
- className: "h-8 text-xs border-gray-200"
4010
- }
4011
- )
4012
- ] }),
4013
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4014
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Website" }),
4015
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4016
- Input,
4017
- {
4018
- type: "url",
4019
- placeholder: "https://acme.com",
4020
- value: formData.website || "",
4021
- onChange: (e) => setActionFormData({
4022
- ...actionFormData,
4023
- website: e.target.value
4024
- }),
4025
- className: "h-8 text-xs border-gray-200"
4026
- }
4027
- )
4028
- ] })
4123
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4124
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
4125
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4126
+ Input,
4127
+ {
4128
+ type: "email",
4129
+ placeholder: "contact@acme.com",
4130
+ value: formData.email || "",
4131
+ onChange: (e) => setActionFormData({
4132
+ ...actionFormData,
4133
+ email: e.target.value
4134
+ }),
4135
+ className: "h-8 text-xs border-gray-200"
4136
+ }
4137
+ )
4029
4138
  ] })
4030
4139
  ] }),
4031
- 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: [
4032
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name" }),
4140
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4141
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Address" }),
4033
4142
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4034
4143
  Input,
4035
4144
  {
4036
- placeholder: "Production Key",
4037
- value: formData.name || "",
4145
+ placeholder: "123 Main St, San Francisco, CA",
4146
+ value: formData.address || "",
4038
4147
  onChange: (e) => setActionFormData({
4039
4148
  ...actionFormData,
4040
- name: e.target.value
4149
+ address: e.target.value
4041
4150
  }),
4042
4151
  className: "h-8 text-xs border-gray-200"
4043
4152
  }
4044
4153
  )
4045
- ] }) }),
4046
- 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: [
4047
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
4048
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4049
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
4050
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4051
- Input,
4052
- {
4053
- placeholder: "Acme Corporation",
4054
- value: formData.name || "",
4055
- onChange: (e) => setActionFormData({
4056
- ...actionFormData,
4057
- name: e.target.value
4058
- }),
4059
- className: "h-8 text-xs border-gray-200"
4060
- }
4061
- )
4062
- ] }),
4063
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4064
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
4065
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4066
- Input,
4067
- {
4068
- type: "email",
4069
- placeholder: "contact@acme.com",
4070
- value: formData.email || "",
4071
- onChange: (e) => setActionFormData({
4072
- ...actionFormData,
4073
- email: e.target.value
4074
- }),
4075
- className: "h-8 text-xs border-gray-200"
4076
- }
4077
- )
4078
- ] })
4079
- ] }),
4154
+ ] }),
4155
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
4080
4156
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4081
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Location" }),
4157
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Phone" }),
4082
4158
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4083
4159
  Input,
4084
4160
  {
4085
- placeholder: "San Francisco, CA",
4086
- value: formData.location || "",
4161
+ type: "tel",
4162
+ placeholder: "+1 (555) 123-4567",
4163
+ value: formData.phone || "",
4087
4164
  onChange: (e) => setActionFormData({
4088
4165
  ...actionFormData,
4089
- location: e.target.value
4166
+ phone: e.target.value
4090
4167
  }),
4091
4168
  className: "h-8 text-xs border-gray-200"
4092
4169
  }
4093
4170
  )
4094
4171
  ] }),
4095
4172
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4096
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Subscription Tier" }),
4097
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4098
- "select",
4099
- {
4100
- value: formData.subscription || "Starter",
4101
- onChange: (e) => setActionFormData({
4102
- ...actionFormData,
4103
- subscription: e.target.value
4104
- }),
4105
- 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",
4106
- children: [
4107
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Starter", children: "Starter" }),
4108
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Professional", children: "Professional" }),
4109
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Enterprise", children: "Enterprise" })
4110
- ]
4111
- }
4112
- )
4113
- ] })
4114
- ] }),
4115
- (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." }) }),
4116
- 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: [
4117
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4118
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Current Password" }),
4173
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Website" }),
4119
4174
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4120
4175
  Input,
4121
4176
  {
4122
- type: "password",
4123
- value: formData.currentPassword || "",
4177
+ type: "url",
4178
+ placeholder: "https://acme.com",
4179
+ value: formData.website || "",
4124
4180
  onChange: (e) => setActionFormData({
4125
4181
  ...actionFormData,
4126
- currentPassword: e.target.value
4182
+ website: e.target.value
4127
4183
  }),
4128
4184
  className: "h-8 text-xs border-gray-200"
4129
4185
  }
4130
4186
  )
4131
- ] }),
4187
+ ] })
4188
+ ] })
4189
+ ] }),
4190
+ 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: [
4191
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name" }),
4192
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4193
+ Input,
4194
+ {
4195
+ placeholder: "Production Key",
4196
+ value: formData.name || "",
4197
+ onChange: (e) => setActionFormData({
4198
+ ...actionFormData,
4199
+ name: e.target.value
4200
+ }),
4201
+ className: "h-8 text-xs border-gray-200"
4202
+ }
4203
+ )
4204
+ ] }) }),
4205
+ 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: [
4206
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
4132
4207
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4133
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "New Password" }),
4208
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
4134
4209
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4135
4210
  Input,
4136
4211
  {
4137
- type: "password",
4138
- value: formData.newPassword || "",
4212
+ placeholder: "Acme Corporation",
4213
+ value: formData.name || "",
4139
4214
  onChange: (e) => setActionFormData({
4140
4215
  ...actionFormData,
4141
- newPassword: e.target.value
4216
+ name: e.target.value
4142
4217
  }),
4143
4218
  className: "h-8 text-xs border-gray-200"
4144
4219
  }
4145
4220
  )
4146
4221
  ] }),
4147
4222
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4148
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Confirm New Password" }),
4223
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
4149
4224
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4150
4225
  Input,
4151
4226
  {
4152
- type: "password",
4153
- value: formData.confirmPassword || "",
4227
+ type: "email",
4228
+ placeholder: "contact@acme.com",
4229
+ value: formData.email || "",
4154
4230
  onChange: (e) => setActionFormData({
4155
4231
  ...actionFormData,
4156
- confirmPassword: e.target.value
4232
+ email: e.target.value
4157
4233
  }),
4158
4234
  className: "h-8 text-xs border-gray-200"
4159
4235
  }
4160
4236
  )
4161
4237
  ] })
4162
4238
  ] }),
4163
- 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: [
4164
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4165
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Notification Type" }),
4166
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4167
- "select",
4168
- {
4169
- value: formData.notificationType || "paymentReceived",
4170
- onChange: (e) => setActionFormData({
4171
- ...actionFormData,
4172
- notificationType: e.target.value
4173
- }),
4174
- 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",
4175
- children: [
4176
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "paymentReceived", children: "Payment Received" }),
4177
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "paymentFailed", children: "Payment Failed" }),
4178
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "invoicePaid", children: "Invoice Paid" }),
4179
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "monthlySummary", children: "Monthly Summary" }),
4180
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "productUpdates", children: "Product Updates" })
4181
- ]
4182
- }
4183
- )
4184
- ] }),
4185
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2", children: [
4186
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4187
- "input",
4188
- {
4189
- type: "checkbox",
4190
- checked: formData.enabled !== false,
4191
- onChange: (e) => setActionFormData({
4192
- ...actionFormData,
4193
- enabled: e.target.checked
4194
- }),
4195
- className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
4196
- }
4197
- ),
4198
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs text-black", children: "Enable this notification" })
4199
- ] })
4239
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4240
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Location" }),
4241
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4242
+ Input,
4243
+ {
4244
+ placeholder: "San Francisco, CA",
4245
+ value: formData.location || "",
4246
+ onChange: (e) => setActionFormData({
4247
+ ...actionFormData,
4248
+ location: e.target.value
4249
+ }),
4250
+ className: "h-8 text-xs border-gray-200"
4251
+ }
4252
+ )
4200
4253
  ] }),
4201
- (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: [
4202
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Integration" }),
4254
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4255
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Subscription Tier" }),
4203
4256
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4204
4257
  "select",
4205
4258
  {
4206
- value: formData.integrationName || "Slack",
4259
+ value: formData.subscription || "Starter",
4207
4260
  onChange: (e) => setActionFormData({
4208
4261
  ...actionFormData,
4209
- integrationName: e.target.value
4262
+ subscription: e.target.value
4210
4263
  }),
4211
4264
  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",
4212
4265
  children: [
4213
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Slack", children: "Slack" }),
4214
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Zapier", children: "Zapier" }),
4215
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Webhook", children: "Webhook" })
4266
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Starter", children: "Starter" }),
4267
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Professional", children: "Professional" }),
4268
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Enterprise", children: "Enterprise" })
4216
4269
  ]
4217
4270
  }
4218
4271
  )
4219
- ] }) }),
4220
- 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: [
4221
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4222
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Card Number" }),
4223
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4224
- Input,
4225
- {
4226
- placeholder: "1234 5678 9012 3456",
4227
- value: formData.cardNumber || "",
4228
- onChange: (e) => setActionFormData({
4229
- ...actionFormData,
4230
- cardNumber: e.target.value
4231
- }),
4232
- className: "h-8 text-xs border-gray-200"
4233
- }
4234
- )
4235
- ] }),
4236
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4237
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Expiry Date" }),
4238
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4239
- Input,
4240
- {
4241
- placeholder: "MM/YY",
4242
- value: formData.expiryDate || "",
4243
- onChange: (e) => setActionFormData({
4244
- ...actionFormData,
4245
- expiryDate: e.target.value
4246
- }),
4247
- className: "h-8 text-xs border-gray-200"
4248
- }
4249
- )
4250
- ] })
4272
+ ] })
4273
+ ] }),
4274
+ (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." }) }),
4275
+ 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: [
4276
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4277
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Current Password" }),
4278
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4279
+ Input,
4280
+ {
4281
+ type: "password",
4282
+ value: formData.currentPassword || "",
4283
+ onChange: (e) => setActionFormData({
4284
+ ...actionFormData,
4285
+ currentPassword: e.target.value
4286
+ }),
4287
+ className: "h-8 text-xs border-gray-200"
4288
+ }
4289
+ )
4251
4290
  ] }),
4252
- 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." }) }),
4253
- 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: [
4254
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4255
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Transaction ID or Customer Name" }),
4256
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4257
- Input,
4258
- {
4259
- placeholder: "e.g., txn_1234 or Acme Corp",
4260
- value: formData.transactionId || formData.customer || "",
4261
- onChange: (e) => {
4262
- const value = e.target.value;
4263
- if (value.startsWith("txn_") || /^\d+$/.test(value)) {
4264
- setActionFormData({
4265
- ...actionFormData,
4266
- transactionId: value,
4267
- customer: void 0
4268
- });
4269
- } else {
4270
- setActionFormData({
4271
- ...actionFormData,
4272
- customer: value,
4273
- transactionId: void 0
4274
- });
4275
- }
4276
- },
4277
- className: "h-8 text-xs border-gray-200"
4278
- }
4279
- )
4280
- ] }),
4281
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4282
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Amount (optional)" }),
4283
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4284
- Input,
4285
- {
4286
- placeholder: "$0.00",
4287
- value: formData.amount || "",
4288
- onChange: (e) => setActionFormData({
4289
- ...actionFormData,
4290
- amount: e.target.value
4291
- }),
4292
- className: "h-8 text-xs border-gray-200"
4293
- }
4294
- )
4295
- ] }),
4296
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4297
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Reason (optional)" }),
4298
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4299
- Input,
4300
- {
4301
- placeholder: "e.g., Customer request",
4302
- value: formData.reason || "",
4303
- onChange: (e) => setActionFormData({
4304
- ...actionFormData,
4305
- reason: e.target.value
4306
- }),
4307
- className: "h-8 text-xs border-gray-200"
4308
- }
4309
- )
4310
- ] })
4291
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4292
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "New Password" }),
4293
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4294
+ Input,
4295
+ {
4296
+ type: "password",
4297
+ value: formData.newPassword || "",
4298
+ onChange: (e) => setActionFormData({
4299
+ ...actionFormData,
4300
+ newPassword: e.target.value
4301
+ }),
4302
+ className: "h-8 text-xs border-gray-200"
4303
+ }
4304
+ )
4311
4305
  ] }),
4312
- 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: [
4313
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4314
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name or ID" }),
4315
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4316
- Input,
4317
- {
4318
- placeholder: "Production Key",
4319
- value: formData.keyId || formData.name || "",
4320
- onChange: (e) => setActionFormData({
4321
- ...actionFormData,
4322
- keyId: e.target.value,
4323
- name: e.target.value
4324
- }),
4325
- className: "h-8 text-xs border-gray-200"
4326
- }
4327
- )
4328
- ] }),
4329
- /* @__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." })
4306
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4307
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Confirm New Password" }),
4308
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4309
+ Input,
4310
+ {
4311
+ type: "password",
4312
+ value: formData.confirmPassword || "",
4313
+ onChange: (e) => setActionFormData({
4314
+ ...actionFormData,
4315
+ confirmPassword: e.target.value
4316
+ }),
4317
+ className: "h-8 text-xs border-gray-200"
4318
+ }
4319
+ )
4320
+ ] })
4321
+ ] }),
4322
+ 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: [
4323
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4324
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Notification Type" }),
4325
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4326
+ "select",
4327
+ {
4328
+ value: formData.notificationType || "paymentReceived",
4329
+ onChange: (e) => setActionFormData({
4330
+ ...actionFormData,
4331
+ notificationType: e.target.value
4332
+ }),
4333
+ 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",
4334
+ children: [
4335
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "paymentReceived", children: "Payment Received" }),
4336
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "paymentFailed", children: "Payment Failed" }),
4337
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "invoicePaid", children: "Invoice Paid" }),
4338
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "monthlySummary", children: "Monthly Summary" }),
4339
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "productUpdates", children: "Product Updates" })
4340
+ ]
4341
+ }
4342
+ )
4330
4343
  ] }),
4331
- 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: [
4332
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4333
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Webhook URL" }),
4334
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4335
- Input,
4336
- {
4337
- type: "url",
4338
- placeholder: "https://example.com/webhook",
4339
- value: formData.url || "",
4340
- onChange: (e) => setActionFormData({
4341
- ...actionFormData,
4342
- url: e.target.value
4343
- }),
4344
- className: "h-8 text-xs border-gray-200"
4345
- }
4346
- )
4347
- ] }),
4348
- /* @__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: "Name (optional)" }),
4350
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4351
- Input,
4352
- {
4353
- placeholder: "Production Webhook",
4354
- value: formData.name || "",
4355
- onChange: (e) => setActionFormData({
4356
- ...actionFormData,
4357
- name: e.target.value
4358
- }),
4359
- className: "h-8 text-xs border-gray-200"
4360
- }
4361
- )
4362
- ] })
4344
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2", children: [
4345
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4346
+ "input",
4347
+ {
4348
+ type: "checkbox",
4349
+ checked: formData.enabled !== false,
4350
+ onChange: (e) => setActionFormData({
4351
+ ...actionFormData,
4352
+ enabled: e.target.checked
4353
+ }),
4354
+ className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
4355
+ }
4356
+ ),
4357
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs text-black", children: "Enable this notification" })
4358
+ ] })
4359
+ ] }),
4360
+ (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: [
4361
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Integration" }),
4362
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4363
+ "select",
4364
+ {
4365
+ value: formData.integrationName || "Slack",
4366
+ onChange: (e) => setActionFormData({
4367
+ ...actionFormData,
4368
+ integrationName: e.target.value
4369
+ }),
4370
+ 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",
4371
+ children: [
4372
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Slack", children: "Slack" }),
4373
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Zapier", children: "Zapier" }),
4374
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Webhook", children: "Webhook" })
4375
+ ]
4376
+ }
4377
+ )
4378
+ ] }) }),
4379
+ 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: [
4380
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4381
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Card Number" }),
4382
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4383
+ Input,
4384
+ {
4385
+ placeholder: "1234 5678 9012 3456",
4386
+ value: formData.cardNumber || "",
4387
+ onChange: (e) => setActionFormData({
4388
+ ...actionFormData,
4389
+ cardNumber: e.target.value
4390
+ }),
4391
+ className: "h-8 text-xs border-gray-200"
4392
+ }
4393
+ )
4394
+ ] }),
4395
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4396
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Expiry Date" }),
4397
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4398
+ Input,
4399
+ {
4400
+ placeholder: "MM/YY",
4401
+ value: formData.expiryDate || "",
4402
+ onChange: (e) => setActionFormData({
4403
+ ...actionFormData,
4404
+ expiryDate: e.target.value
4405
+ }),
4406
+ className: "h-8 text-xs border-gray-200"
4407
+ }
4408
+ )
4409
+ ] })
4410
+ ] }),
4411
+ 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." }) }),
4412
+ 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: [
4413
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4414
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Transaction ID or Customer Name" }),
4415
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4416
+ Input,
4417
+ {
4418
+ placeholder: "e.g., txn_1234 or Acme Corp",
4419
+ value: formData.transactionId || formData.customer || "",
4420
+ onChange: (e) => {
4421
+ const value = e.target.value;
4422
+ if (value.startsWith("txn_") || /^\d+$/.test(value)) {
4423
+ setActionFormData({
4424
+ ...actionFormData,
4425
+ transactionId: value,
4426
+ customer: void 0
4427
+ });
4428
+ } else {
4429
+ setActionFormData({
4430
+ ...actionFormData,
4431
+ customer: value,
4432
+ transactionId: void 0
4433
+ });
4434
+ }
4435
+ },
4436
+ className: "h-8 text-xs border-gray-200"
4437
+ }
4438
+ )
4439
+ ] }),
4440
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4441
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Amount (optional)" }),
4442
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4443
+ Input,
4444
+ {
4445
+ placeholder: "$0.00",
4446
+ value: formData.amount || "",
4447
+ onChange: (e) => setActionFormData({
4448
+ ...actionFormData,
4449
+ amount: e.target.value
4450
+ }),
4451
+ className: "h-8 text-xs border-gray-200"
4452
+ }
4453
+ )
4454
+ ] }),
4455
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4456
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Reason (optional)" }),
4457
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4458
+ Input,
4459
+ {
4460
+ placeholder: "e.g., Customer request",
4461
+ value: formData.reason || "",
4462
+ onChange: (e) => setActionFormData({
4463
+ ...actionFormData,
4464
+ reason: e.target.value
4465
+ }),
4466
+ className: "h-8 text-xs border-gray-200"
4467
+ }
4468
+ )
4469
+ ] })
4470
+ ] }),
4471
+ 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: [
4472
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4473
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name or ID" }),
4474
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4475
+ Input,
4476
+ {
4477
+ placeholder: "Production Key",
4478
+ value: formData.keyId || formData.name || "",
4479
+ onChange: (e) => setActionFormData({
4480
+ ...actionFormData,
4481
+ keyId: e.target.value,
4482
+ name: e.target.value
4483
+ }),
4484
+ className: "h-8 text-xs border-gray-200"
4485
+ }
4486
+ )
4487
+ ] }),
4488
+ /* @__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." })
4489
+ ] }),
4490
+ 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: [
4491
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4492
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Webhook URL" }),
4493
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4494
+ Input,
4495
+ {
4496
+ type: "url",
4497
+ placeholder: "https://example.com/webhook",
4498
+ value: formData.url || "",
4499
+ onChange: (e) => setActionFormData({
4500
+ ...actionFormData,
4501
+ url: e.target.value
4502
+ }),
4503
+ className: "h-8 text-xs border-gray-200"
4504
+ }
4505
+ )
4363
4506
  ] }),
4364
- 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: [
4365
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Currency" }),
4507
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4508
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Name (optional)" }),
4509
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4510
+ Input,
4511
+ {
4512
+ placeholder: "Production Webhook",
4513
+ value: formData.name || "",
4514
+ onChange: (e) => setActionFormData({
4515
+ ...actionFormData,
4516
+ name: e.target.value
4517
+ }),
4518
+ className: "h-8 text-xs border-gray-200"
4519
+ }
4520
+ )
4521
+ ] })
4522
+ ] }),
4523
+ 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: [
4524
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Currency" }),
4525
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4526
+ "select",
4527
+ {
4528
+ value: formData.currency || "USD",
4529
+ onChange: (e) => setActionFormData({
4530
+ ...actionFormData,
4531
+ currency: e.target.value
4532
+ }),
4533
+ 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",
4534
+ children: [
4535
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "USD", children: "USD ($)" }),
4536
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "EUR", children: "EUR (\u20AC)" }),
4537
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "GBP", children: "GBP (\xA3)" }),
4538
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "JPY", children: "JPY (\xA5)" })
4539
+ ]
4540
+ }
4541
+ )
4542
+ ] }) }),
4543
+ 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: [
4544
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Timezone" }),
4545
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4546
+ "select",
4547
+ {
4548
+ value: formData.timezone || "America/Los_Angeles",
4549
+ onChange: (e) => setActionFormData({
4550
+ ...actionFormData,
4551
+ timezone: e.target.value
4552
+ }),
4553
+ 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",
4554
+ children: [
4555
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "America/Los_Angeles", children: "Pacific Time (PT)" }),
4556
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "America/New_York", children: "Eastern Time (ET)" }),
4557
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Europe/London", children: "GMT" }),
4558
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Asia/Tokyo", children: "JST" })
4559
+ ]
4560
+ }
4561
+ )
4562
+ ] }) }),
4563
+ 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: [
4564
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4565
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Device/Session" }),
4566
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4567
+ Input,
4568
+ {
4569
+ placeholder: "MacBook Pro",
4570
+ value: formData.device || "",
4571
+ onChange: (e) => setActionFormData({
4572
+ ...actionFormData,
4573
+ device: e.target.value
4574
+ }),
4575
+ className: "h-8 text-xs border-gray-200"
4576
+ }
4577
+ )
4578
+ ] }),
4579
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-black", children: "This will sign out the device and invalidate its session." })
4580
+ ] }),
4581
+ 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: [
4582
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4583
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Customer Email" }),
4584
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4585
+ Input,
4586
+ {
4587
+ type: "email",
4588
+ placeholder: "customer@example.com",
4589
+ value: formData.customerEmail || "",
4590
+ onChange: (e) => setActionFormData({
4591
+ ...actionFormData,
4592
+ customerEmail: e.target.value
4593
+ }),
4594
+ className: "h-8 text-xs border-gray-200"
4595
+ }
4596
+ )
4597
+ ] }),
4598
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4599
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Plan" }),
4600
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4601
+ "select",
4602
+ {
4603
+ value: formData.plan || "Starter",
4604
+ onChange: (e) => setActionFormData({
4605
+ ...actionFormData,
4606
+ plan: e.target.value
4607
+ }),
4608
+ 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",
4609
+ children: [
4610
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Starter", children: "Starter ($29/mo)" }),
4611
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Professional", children: "Professional ($99/mo)" }),
4612
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Enterprise", children: "Enterprise ($299/mo)" })
4613
+ ]
4614
+ }
4615
+ )
4616
+ ] }),
4617
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4618
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Billing Cycle" }),
4619
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4620
+ "select",
4621
+ {
4622
+ value: formData.billingCycle || "monthly",
4623
+ onChange: (e) => setActionFormData({
4624
+ ...actionFormData,
4625
+ billingCycle: e.target.value
4626
+ }),
4627
+ 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",
4628
+ children: [
4629
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "monthly", children: "Monthly" }),
4630
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "yearly", children: "Yearly (Save 15%)" })
4631
+ ]
4632
+ }
4633
+ )
4634
+ ] })
4635
+ ] }),
4636
+ 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: [
4637
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-black", children: "This will export your certificate of incorporation document." }),
4638
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4639
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Format" }),
4366
4640
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4367
4641
  "select",
4368
4642
  {
4369
- value: formData.currency || "USD",
4643
+ value: formData.format || "pdf",
4370
4644
  onChange: (e) => setActionFormData({
4371
4645
  ...actionFormData,
4372
- currency: e.target.value
4646
+ format: e.target.value
4373
4647
  }),
4374
4648
  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",
4375
4649
  children: [
4376
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "USD", children: "USD ($)" }),
4377
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "EUR", children: "EUR (\u20AC)" }),
4378
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "GBP", children: "GBP (\xA3)" }),
4379
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "JPY", children: "JPY (\xA5)" })
4650
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "pdf", children: "PDF" }),
4651
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "json", children: "JSON" })
4380
4652
  ]
4381
4653
  }
4382
4654
  )
4383
- ] }) }),
4384
- 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: [
4385
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Timezone" }),
4655
+ ] })
4656
+ ] }),
4657
+ (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: [
4658
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4659
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Block Rule" }),
4386
4660
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4387
4661
  "select",
4388
4662
  {
4389
- value: formData.timezone || "America/Los_Angeles",
4663
+ value: formData.ruleId || "rule_1",
4390
4664
  onChange: (e) => setActionFormData({
4391
4665
  ...actionFormData,
4392
- timezone: e.target.value
4666
+ ruleId: e.target.value
4393
4667
  }),
4394
4668
  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",
4395
4669
  children: [
4396
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "America/Los_Angeles", children: "Pacific Time (PT)" }),
4397
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "America/New_York", children: "Eastern Time (ET)" }),
4398
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Europe/London", children: "GMT" }),
4399
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Asia/Tokyo", children: "JST" })
4670
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_1", children: "Block if risk level = 'highest'" }),
4671
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_2", children: "Block if matches Stripe block lists" }),
4672
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_3", children: "Block if CVC verification fails" }),
4673
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_4", children: "Block if Postal code verification fails" })
4400
4674
  ]
4401
4675
  }
4402
4676
  )
4403
- ] }) }),
4404
- 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: [
4405
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4406
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Device/Session" }),
4407
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4408
- Input,
4409
- {
4410
- placeholder: "MacBook Pro",
4411
- value: formData.device || "",
4412
- onChange: (e) => setActionFormData({
4413
- ...actionFormData,
4414
- device: e.target.value
4415
- }),
4416
- className: "h-8 text-xs border-gray-200"
4417
- }
4418
- )
4419
- ] }),
4420
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-black", children: "This will sign out the device and invalidate its session." })
4421
4677
  ] }),
4422
- 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: [
4423
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4424
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Customer Email" }),
4425
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4426
- Input,
4427
- {
4428
- type: "email",
4429
- placeholder: "customer@example.com",
4430
- value: formData.customerEmail || "",
4431
- onChange: (e) => setActionFormData({
4432
- ...actionFormData,
4433
- customerEmail: e.target.value
4434
- }),
4435
- className: "h-8 text-xs border-gray-200"
4436
- }
4437
- )
4438
- ] }),
4439
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4440
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Plan" }),
4441
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4442
- "select",
4443
- {
4444
- value: formData.plan || "Starter",
4445
- onChange: (e) => setActionFormData({
4446
- ...actionFormData,
4447
- plan: e.target.value
4448
- }),
4449
- 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",
4450
- children: [
4451
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Starter", children: "Starter ($29/mo)" }),
4452
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Professional", children: "Professional ($99/mo)" }),
4453
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "Enterprise", children: "Enterprise ($299/mo)" })
4454
- ]
4455
- }
4456
- )
4457
- ] }),
4458
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4459
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Billing Cycle" }),
4460
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4461
- "select",
4462
- {
4463
- value: formData.billingCycle || "monthly",
4464
- onChange: (e) => setActionFormData({
4465
- ...actionFormData,
4466
- billingCycle: e.target.value
4467
- }),
4468
- className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
4469
- children: [
4470
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "monthly", children: "Monthly" }),
4471
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "yearly", children: "Yearly (Save 15%)" })
4472
- ]
4473
- }
4474
- )
4678
+ /* @__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." })
4679
+ ] }),
4680
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4681
+ Button,
4682
+ {
4683
+ type: "button",
4684
+ size: "sm",
4685
+ variant: "secondary",
4686
+ className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4687
+ onClick: handleActionSubmit,
4688
+ children: [
4689
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Confirm" }),
4690
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
4691
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
4692
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
4693
+ ] })
4694
+ ]
4695
+ }
4696
+ ) })
4697
+ ]
4698
+ },
4699
+ message.id
4700
+ );
4701
+ }
4702
+ if (message.kind === "bulkPreview" && message.csvData) {
4703
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4704
+ "div",
4705
+ {
4706
+ className: `${isRoleChange ? "mt-3" : ""}`,
4707
+ children: [
4708
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
4709
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "bg-gray-50 rounded-lg border border-gray-200 overflow-hidden", children: [
4710
+ /* @__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: [
4711
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.FileSpreadsheet, { className: "h-4 w-4 text-gray-600" }),
4712
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs font-medium text-gray-700", children: message.csvData.fileName }),
4713
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-xs text-gray-500", children: [
4714
+ "\u2022 ",
4715
+ message.csvData.rowCount,
4716
+ " rows"
4475
4717
  ] })
4476
4718
  ] }),
4477
- 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: [
4478
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-xs text-black", children: "This will export your certificate of incorporation document." }),
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: "Format" }),
4481
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4482
- "select",
4483
- {
4484
- value: formData.format || "pdf",
4485
- onChange: (e) => setActionFormData({
4486
- ...actionFormData,
4487
- format: e.target.value
4488
- }),
4489
- 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",
4490
- children: [
4491
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "pdf", children: "PDF" }),
4492
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "json", children: "JSON" })
4493
- ]
4494
- }
4495
- )
4496
- ] })
4719
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "px-3 py-2 border-b border-gray-100", children: [
4720
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-gray-500 mb-1", children: "Columns" }),
4721
+ /* @__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)(
4722
+ "span",
4723
+ {
4724
+ className: "text-xs bg-blue-100 text-blue-700 px-1.5 py-0.5 rounded",
4725
+ children: col
4726
+ },
4727
+ i
4728
+ )) })
4497
4729
  ] }),
4498
- (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: [
4499
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4500
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Block Rule" }),
4501
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4502
- "select",
4503
- {
4504
- value: formData.ruleId || "rule_1",
4505
- onChange: (e) => setActionFormData({
4506
- ...actionFormData,
4507
- ruleId: e.target.value
4508
- }),
4509
- 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",
4510
- children: [
4511
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_1", children: "Block if risk level = 'highest'" }),
4512
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_2", children: "Block if matches Stripe block lists" }),
4513
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_3", children: "Block if CVC verification fails" }),
4514
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "rule_4", children: "Block if Postal code verification fails" })
4515
- ]
4516
- }
4517
- )
4518
- ] }),
4519
- /* @__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." })
4730
+ message.csvData.sampleRows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "px-3 py-2", children: [
4731
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-gray-500 mb-1", children: "Sample Data" }),
4732
+ /* @__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)(
4733
+ "div",
4734
+ {
4735
+ className: "text-xs text-gray-600 bg-white rounded px-2 py-1 border border-gray-100",
4736
+ children: [
4737
+ Object.entries(row).slice(0, 3).map(([key, val], j) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
4738
+ j > 0 && " \u2022 ",
4739
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-gray-400", children: [
4740
+ key,
4741
+ ":"
4742
+ ] }),
4743
+ " ",
4744
+ val
4745
+ ] }, key)),
4746
+ Object.keys(row).length > 3 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-gray-400", children: [
4747
+ " ",
4748
+ "..."
4749
+ ] })
4750
+ ]
4751
+ },
4752
+ i
4753
+ )) })
4520
4754
  ] }),
4521
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4755
+ 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: [
4756
+ "Suggested action:",
4757
+ " ",
4758
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: message.suggestedAction.replace(/_/g, " ") })
4759
+ ] }) })
4760
+ ] }),
4761
+ message.bulkSessionId && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
4762
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4522
4763
  Button,
4523
4764
  {
4524
4765
  type: "button",
4525
4766
  size: "sm",
4526
4767
  variant: "secondary",
4527
4768
  className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4528
- onClick: handleActionSubmit,
4769
+ onClick: () => message.bulkSessionId && confirmBulkOperation(message.bulkSessionId),
4529
4770
  children: [
4530
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Confirm" }),
4771
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
4772
+ "Process ",
4773
+ message.csvData.rowCount,
4774
+ " rows"
4775
+ ] }),
4531
4776
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
4532
4777
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
4533
4778
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
4534
4779
  ] })
4535
4780
  ]
4536
4781
  }
4537
- ) })
4538
- ]
4539
- },
4540
- message.id
4541
- );
4542
- }
4543
- if (message.kind === "bulkPreview" && message.csvData) {
4544
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4545
- "div",
4546
- {
4547
- className: `${isRoleChange ? "mt-3" : ""}`,
4548
- children: [
4549
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
4550
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "bg-gray-50 rounded-lg border border-gray-200 overflow-hidden", children: [
4551
- /* @__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: [
4552
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.FileSpreadsheet, { className: "h-4 w-4 text-gray-600" }),
4553
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs font-medium text-gray-700", children: message.csvData.fileName }),
4554
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-xs text-gray-500", children: [
4555
- "\u2022 ",
4556
- message.csvData.rowCount,
4557
- " rows"
4558
- ] })
4559
- ] }),
4560
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "px-3 py-2 border-b border-gray-100", children: [
4561
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-gray-500 mb-1", children: "Columns" }),
4562
- /* @__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)(
4563
- "span",
4782
+ ),
4783
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4784
+ Button,
4785
+ {
4786
+ type: "button",
4787
+ size: "sm",
4788
+ variant: "ghost",
4789
+ className: "h-8 rounded-xl px-3 text-xs text-gray-500 hover:text-gray-700 hover:bg-gray-100",
4790
+ onClick: cancelBulkOperation,
4791
+ children: "Cancel"
4792
+ }
4793
+ )
4794
+ ] })
4795
+ ]
4796
+ },
4797
+ message.id
4798
+ );
4799
+ }
4800
+ if (message.kind === "bulkProgress" && message.bulkProgress) {
4801
+ const { processed, total, successes, failures } = message.bulkProgress;
4802
+ const percentage = Math.round(processed / total * 100);
4803
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4804
+ "div",
4805
+ {
4806
+ className: `${isRoleChange ? "mt-3" : ""}`,
4807
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "bg-gray-50 rounded-lg border border-gray-200 p-3", children: [
4808
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [
4809
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Loader2, { className: "h-4 w-4 animate-spin text-blue-600" }),
4810
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-sm font-medium text-gray-700", children: [
4811
+ "Processing... ",
4812
+ processed,
4813
+ " of ",
4814
+ total
4815
+ ] })
4816
+ ] }),
4817
+ /* @__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)(
4818
+ "div",
4819
+ {
4820
+ className: "h-full bg-blue-600 transition-all duration-300",
4821
+ style: { width: `${percentage}%` }
4822
+ }
4823
+ ) }),
4824
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-3 text-xs text-gray-600", children: [
4825
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1", children: [
4826
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CheckCircle2, { className: "h-3 w-3 text-green-600" }),
4827
+ successes,
4828
+ " successful"
4829
+ ] }),
4830
+ failures > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1 text-red-600", children: [
4831
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-3 w-3" }),
4832
+ failures,
4833
+ " failed"
4834
+ ] })
4835
+ ] })
4836
+ ] })
4837
+ },
4838
+ message.id
4839
+ );
4840
+ }
4841
+ if (message.kind === "bulkSummary" && message.bulkSummary) {
4842
+ const { total, successes, failures, navigationPage } = message.bulkSummary;
4843
+ const hasFailures = failures.length > 0;
4844
+ const pageLabel = navigationPage?.page === "customers" ? "Customers" : navigationPage?.page === "dashboard" ? "Dashboard" : navigationPage?.page === "settings" ? "Settings" : "Results";
4845
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4846
+ "div",
4847
+ {
4848
+ className: `${isRoleChange ? "mt-3" : ""}`,
4849
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4850
+ "div",
4851
+ {
4852
+ className: `rounded-lg border p-3 ${hasFailures ? "bg-amber-50 border-amber-200" : "bg-green-50 border-green-200"}`,
4853
+ children: [
4854
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [
4855
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4856
+ import_lucide_react4.CheckCircle2,
4564
4857
  {
4565
- className: "text-xs bg-blue-100 text-blue-700 px-1.5 py-0.5 rounded",
4566
- children: col
4567
- },
4568
- i
4569
- )) })
4858
+ className: `h-5 w-5 ${hasFailures ? "text-amber-600" : "text-green-600"}`
4859
+ }
4860
+ ),
4861
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-sm font-medium text-gray-800", children: "Bulk operation complete" })
4570
4862
  ] }),
4571
- message.csvData.sampleRows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "px-3 py-2", children: [
4572
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-gray-500 mb-1", children: "Sample Data" }),
4573
- /* @__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)(
4574
- "div",
4575
- {
4576
- className: "text-xs text-gray-600 bg-white rounded px-2 py-1 border border-gray-100",
4577
- children: [
4578
- Object.entries(row).slice(0, 3).map(([key, val], j) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
4579
- j > 0 && " \u2022 ",
4580
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-gray-400", children: [
4581
- key,
4582
- ":"
4583
- ] }),
4584
- " ",
4585
- val
4586
- ] }, key)),
4587
- Object.keys(row).length > 3 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-gray-400", children: [
4863
+ /* @__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` : ""}.` }),
4864
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-4 text-xs", children: [
4865
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1 text-green-700", children: [
4866
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CheckCircle2, { className: "h-3 w-3" }),
4867
+ successes,
4868
+ " successful"
4869
+ ] }),
4870
+ hasFailures && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1 text-red-600", children: [
4871
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-3 w-3" }),
4872
+ failures.length,
4873
+ " failed"
4874
+ ] })
4875
+ ] }),
4876
+ hasFailures && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mt-3 pt-2 border-t border-amber-200", children: [
4877
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-amber-700 mb-1", children: "Failed Rows" }),
4878
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-1 max-h-32 overflow-y-auto", children: [
4879
+ failures.slice(0, 5).map((failure, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4880
+ "div",
4881
+ {
4882
+ className: "text-xs text-red-700 bg-red-50 rounded px-2 py-1",
4883
+ children: [
4884
+ "Row ",
4885
+ failure.row,
4886
+ ":",
4588
4887
  " ",
4589
- "..."
4590
- ] })
4591
- ]
4592
- },
4593
- i
4594
- )) })
4888
+ failure.error || "Unknown error"
4889
+ ]
4890
+ },
4891
+ i
4892
+ )),
4893
+ failures.length > 5 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "text-xs text-amber-600", children: [
4894
+ "...and ",
4895
+ failures.length - 5,
4896
+ " more"
4897
+ ] })
4898
+ ] })
4595
4899
  ] }),
4596
- 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: [
4597
- "Suggested action:",
4598
- " ",
4599
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: message.suggestedAction.replace(/_/g, " ") })
4600
- ] }) })
4601
- ] }),
4602
- message.bulkSessionId && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
4603
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4604
- Button,
4900
+ 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)(
4901
+ "button",
4605
4902
  {
4606
4903
  type: "button",
4607
- size: "sm",
4608
- variant: "secondary",
4609
- className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4610
- onClick: () => message.bulkSessionId && confirmBulkOperation(message.bulkSessionId),
4904
+ onClick: (e) => {
4905
+ e.preventDefault();
4906
+ e.stopPropagation();
4907
+ if (onNavigate && navigationPage.page) {
4908
+ onNavigate(
4909
+ navigationPage.page,
4910
+ navigationPage.subtab
4911
+ );
4912
+ }
4913
+ },
4914
+ className: "flex items-center gap-2 text-xs text-gray-500 hover:text-gray-700 transition-colors group cursor-pointer",
4611
4915
  children: [
4612
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
4613
- "Process ",
4614
- message.csvData.rowCount,
4615
- " rows"
4916
+ /* @__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: [
4917
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-2.5 w-2.5" }),
4918
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "+" }),
4919
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-2.5 w-2.5" })
4616
4920
  ] }),
4617
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
4618
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
4619
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
4921
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
4922
+ "View ",
4923
+ pageLabel
4620
4924
  ] })
4621
4925
  ]
4622
4926
  }
4623
- ),
4624
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4625
- Button,
4626
- {
4627
- type: "button",
4628
- size: "sm",
4629
- variant: "ghost",
4630
- className: "h-8 rounded-xl px-3 text-xs text-gray-500 hover:text-gray-700 hover:bg-gray-100",
4631
- onClick: cancelBulkOperation,
4632
- children: "Cancel"
4633
- }
4634
- )
4635
- ] })
4636
- ]
4637
- },
4638
- message.id
4639
- );
4640
- }
4641
- if (message.kind === "bulkProgress" && message.bulkProgress) {
4642
- const { processed, total, successes, failures } = message.bulkProgress;
4643
- const percentage = Math.round(processed / total * 100);
4644
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4645
- "div",
4646
- {
4647
- className: `${isRoleChange ? "mt-3" : ""}`,
4648
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "bg-gray-50 rounded-lg border border-gray-200 p-3", children: [
4649
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [
4650
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Loader2, { className: "h-4 w-4 animate-spin text-blue-600" }),
4651
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-sm font-medium text-gray-700", children: [
4652
- "Processing... ",
4653
- processed,
4654
- " of ",
4655
- total
4656
- ] })
4657
- ] }),
4658
- /* @__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)(
4659
- "div",
4660
- {
4661
- className: "h-full bg-blue-600 transition-all duration-300",
4662
- style: { width: `${percentage}%` }
4663
- }
4664
- ) }),
4665
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-3 text-xs text-gray-600", children: [
4666
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1", children: [
4667
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CheckCircle2, { className: "h-3 w-3 text-green-600" }),
4668
- successes,
4669
- " successful"
4670
- ] }),
4671
- failures > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1 text-red-600", children: [
4672
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-3 w-3" }),
4673
- failures,
4674
- " failed"
4675
- ] })
4676
- ] })
4677
- ] })
4678
- },
4679
- message.id
4680
- );
4681
- }
4682
- if (message.kind === "bulkSummary" && message.bulkSummary) {
4683
- const { total, successes, failures, navigationPage } = message.bulkSummary;
4684
- const hasFailures = failures.length > 0;
4685
- const pageLabel = navigationPage?.page === "customers" ? "Customers" : navigationPage?.page === "dashboard" ? "Dashboard" : navigationPage?.page === "settings" ? "Settings" : "Results";
4686
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4687
- "div",
4688
- {
4689
- className: `${isRoleChange ? "mt-3" : ""}`,
4690
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4691
- "div",
4692
- {
4693
- className: `rounded-lg border p-3 ${hasFailures ? "bg-amber-50 border-amber-200" : "bg-green-50 border-green-200"}`,
4694
- children: [
4695
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [
4696
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4697
- import_lucide_react4.CheckCircle2,
4698
- {
4699
- className: `h-5 w-5 ${hasFailures ? "text-amber-600" : "text-green-600"}`
4700
- }
4701
- ),
4702
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-sm font-medium text-gray-800", children: "Bulk operation complete" })
4703
- ] }),
4704
- /* @__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` : ""}.` }),
4705
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-4 text-xs", children: [
4706
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1 text-green-700", children: [
4707
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CheckCircle2, { className: "h-3 w-3" }),
4708
- successes,
4709
- " successful"
4710
- ] }),
4711
- hasFailures && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-1 text-red-600", children: [
4712
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-3 w-3" }),
4713
- failures.length,
4714
- " failed"
4715
- ] })
4716
- ] }),
4717
- hasFailures && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mt-3 pt-2 border-t border-amber-200", children: [
4718
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-[10px] uppercase tracking-wider text-amber-700 mb-1", children: "Failed Rows" }),
4719
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-1 max-h-32 overflow-y-auto", children: [
4720
- failures.slice(0, 5).map((failure, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4721
- "div",
4722
- {
4723
- className: "text-xs text-red-700 bg-red-50 rounded px-2 py-1",
4724
- children: [
4725
- "Row ",
4726
- failure.row,
4727
- ":",
4728
- " ",
4729
- failure.error || "Unknown error"
4730
- ]
4731
- },
4732
- i
4733
- )),
4734
- failures.length > 5 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "text-xs text-amber-600", children: [
4735
- "...and ",
4736
- failures.length - 5,
4737
- " more"
4738
- ] })
4739
- ] })
4740
- ] }),
4741
- 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)(
4742
- "button",
4743
- {
4744
- type: "button",
4745
- onClick: (e) => {
4746
- e.preventDefault();
4747
- e.stopPropagation();
4748
- if (onNavigate && navigationPage.page) {
4749
- onNavigate(
4750
- navigationPage.page,
4751
- navigationPage.subtab
4752
- );
4753
- }
4754
- },
4755
- className: "flex items-center gap-2 text-xs text-gray-500 hover:text-gray-700 transition-colors group cursor-pointer",
4756
- children: [
4757
- /* @__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: [
4758
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-2.5 w-2.5" }),
4759
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "+" }),
4760
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-2.5 w-2.5" })
4761
- ] }),
4762
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
4763
- "View ",
4764
- pageLabel
4765
- ] })
4766
- ]
4767
- }
4768
- ) })
4769
- ]
4927
+ ) })
4928
+ ]
4929
+ }
4930
+ )
4931
+ },
4932
+ message.id
4933
+ );
4934
+ }
4935
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(React6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4936
+ "div",
4937
+ {
4938
+ ref: isCurrentGuideStep ? currentStepRef : null,
4939
+ className: `${isRoleChange ? "mt-3" : ""}`,
4940
+ children: [
4941
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-sm leading-6 text-gray-700", children: (() => {
4942
+ const text = message.content || "";
4943
+ if (message.kind === "guideStep") {
4944
+ const m = text.match(/^(Step\s+\d+:)([\s\S]*)/);
4945
+ if (m) {
4946
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
4947
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: m[1] }),
4948
+ m[2]
4949
+ ] });
4770
4950
  }
4771
- )
4772
- },
4773
- message.id
4774
- );
4951
+ }
4952
+ if (message.role === "assistant" && text) {
4953
+ return renderMarkdown(text);
4954
+ }
4955
+ return text || /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "opacity-70", children: "Thinking\u2026" });
4956
+ })() }),
4957
+ message.role === "assistant" && message.structuredData && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4958
+ DataRenderer,
4959
+ {
4960
+ type: message.structuredData.type,
4961
+ data: message.structuredData.data
4962
+ }
4963
+ ) }),
4964
+ 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)(
4965
+ "button",
4966
+ {
4967
+ type: "button",
4968
+ onClick: () => handleFollowupClick(message.id, followup),
4969
+ 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",
4970
+ children: followup.label
4971
+ },
4972
+ followup.id
4973
+ )) })
4974
+ ]
4775
4975
  }
4776
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(React6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4777
- "div",
4778
- {
4779
- ref: isCurrentGuideStep ? currentStepRef : null,
4780
- className: `${isRoleChange ? "mt-3" : ""}`,
4781
- children: [
4782
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-sm leading-6 text-gray-700", children: (() => {
4783
- const text = message.content || "";
4784
- if (message.kind === "guideStep") {
4785
- const m = text.match(/^(Step\s+\d+:)([\s\S]*)/);
4786
- if (m) {
4787
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
4788
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: m[1] }),
4789
- m[2]
4790
- ] });
4791
- }
4792
- }
4793
- if (message.role === "assistant" && text) {
4794
- return renderMarkdown(text);
4795
- }
4796
- return text || /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "opacity-70", children: "Thinking\u2026" });
4797
- })() }),
4798
- message.role === "assistant" && message.structuredData && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4799
- DataRenderer,
4800
- {
4801
- type: message.structuredData.type,
4802
- data: message.structuredData.data
4803
- }
4804
- ) }),
4805
- 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)(
4806
- "button",
4807
- {
4808
- type: "button",
4809
- onClick: () => handleFollowupClick(message.id, followup),
4810
- 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",
4811
- children: followup.label
4812
- },
4813
- followup.id
4814
- )) })
4815
- ]
4816
- }
4817
- ) }, message.id);
4818
- }),
4819
- (activeGuide || guideComplete) && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
4820
- activeGuide && activeGuide.stepIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4821
- Button,
4822
- {
4823
- type: "button",
4824
- size: "sm",
4825
- variant: "secondary",
4826
- className: "h-7 w-7 rounded-full p-0 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4827
- onClick: goBackGuide,
4828
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowLeft, { className: "h-3.5 w-3.5 text-gray-600" })
4829
- }
4830
- ),
4831
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4832
- Button,
4833
- {
4834
- type: "button",
4835
- size: "sm",
4836
- variant: "secondary",
4837
- className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4838
- onClick: guideComplete ? handleBack : advanceGuide,
4839
- children: [
4840
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: guideComplete ? "Done" : "Next" }),
4841
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
4842
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
4843
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
4844
- ] })
4845
- ]
4846
- }
4847
- )
4848
- ] }),
4849
- (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)(
4850
- AssistantActivity,
4976
+ ) }, message.id);
4977
+ }),
4978
+ (activeGuide || guideComplete) && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
4979
+ activeGuide && activeGuide.stepIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4980
+ Button,
4851
4981
  {
4852
- phase,
4853
- progressSteps
4982
+ type: "button",
4983
+ size: "sm",
4984
+ variant: "secondary",
4985
+ className: "h-7 w-7 rounded-full p-0 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4986
+ onClick: goBackGuide,
4987
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowLeft, { className: "h-3.5 w-3.5 text-gray-600" })
4854
4988
  }
4855
- ) }),
4856
- 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, {}) }) }),
4857
- !activeGuide && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { ref: messagesEndRef })
4858
- ] }) }) }) })
4859
- }
4860
- ),
4989
+ ),
4990
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4991
+ Button,
4992
+ {
4993
+ type: "button",
4994
+ size: "sm",
4995
+ variant: "secondary",
4996
+ className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4997
+ onClick: guideComplete ? handleBack : advanceGuide,
4998
+ children: [
4999
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: guideComplete ? "Done" : "Next" }),
5000
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
5001
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Command, { className: "h-3 w-3" }),
5002
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CornerDownLeft, { className: "h-3 w-3" })
5003
+ ] })
5004
+ ]
5005
+ }
5006
+ )
5007
+ ] }),
5008
+ (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)(
5009
+ AssistantActivity,
5010
+ {
5011
+ phase,
5012
+ progressSteps
5013
+ }
5014
+ ) }),
5015
+ 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, {}) }) }),
5016
+ !activeGuide && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { ref: messagesEndRef })
5017
+ ] }) }) }) })
5018
+ ] }),
4861
5019
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4862
5020
  "div",
4863
5021
  {
@@ -4928,10 +5086,19 @@ ${userText}`
4928
5086
  {
4929
5087
  ref: imageInputRef,
4930
5088
  type: "file",
4931
- accept: "image/*,.pdf",
5089
+ accept: "image/*,.pdf,.csv",
4932
5090
  multiple: true,
4933
5091
  className: "hidden",
4934
- onChange: (e) => handleImageSelect(e.target.files)
5092
+ onChange: (e) => {
5093
+ const files = e.target.files;
5094
+ if (!files || files.length === 0) return;
5095
+ const csvFile = Array.from(files).find((f) => f.name.endsWith(".csv"));
5096
+ if (csvFile && !isEscalated) {
5097
+ setPendingFile(csvFile);
5098
+ } else {
5099
+ handleImageSelect(files);
5100
+ }
5101
+ }
4935
5102
  }
4936
5103
  ),
4937
5104
  /* @__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: [
@@ -4942,14 +5109,10 @@ ${userText}`
4942
5109
  size: "icon",
4943
5110
  variant: "ghost",
4944
5111
  onClick: () => {
4945
- if (isEscalated) {
4946
- imageInputRef.current?.click();
4947
- } else {
4948
- fileInputRef.current?.click();
4949
- }
5112
+ imageInputRef.current?.click();
4950
5113
  },
4951
5114
  className: "h-5 w-5 rounded-full text-gray-400 hover:text-gray-600 hover:bg-gray-100",
4952
- title: isEscalated ? "Attach image or file" : "Upload CSV for bulk operations",
5115
+ title: "Attach file (image, PDF, or CSV)",
4953
5116
  disabled: isUploadingImage,
4954
5117
  children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Paperclip, { className: "h-2.5 w-2.5" })
4955
5118
  }
@@ -5020,8 +5183,15 @@ ${userText}`
5020
5183
  {
5021
5184
  type: "submit",
5022
5185
  size: "icon",
5023
- disabled: !input.trim() && !pendingFile || isWaitingForAuth,
5186
+ disabled: !input.trim() && !pendingFile && pendingImages.length === 0 || isWaitingForAuth,
5024
5187
  className: "h-6 w-6 rounded-full bg-gray-700 hover:bg-gray-600 disabled:bg-gray-300",
5188
+ onClick: (e) => {
5189
+ e.preventDefault();
5190
+ const form = e.currentTarget.closest("form");
5191
+ if (form) {
5192
+ form.requestSubmit();
5193
+ }
5194
+ },
5025
5195
  children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowUp, { className: "h-2.5 w-2.5 text-white" })
5026
5196
  }
5027
5197
  )