@kite-copilot/chat-panel 0.2.43 → 0.2.45
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 +174 -69
- package/dist/auto.js +1 -1
- package/dist/{chunk-XZM4VX5Y.js → chunk-262FS4KW.js} +182 -77
- package/dist/embed.global.js +21 -21
- package/dist/index.cjs +174 -69
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/auto.cjs
CHANGED
|
@@ -39,7 +39,7 @@ var import_react = __toESM(require("react"), 1);
|
|
|
39
39
|
var import_client = require("react-dom/client");
|
|
40
40
|
|
|
41
41
|
// src/ChatPanel.tsx
|
|
42
|
-
var
|
|
42
|
+
var React6 = __toESM(require("react"), 1);
|
|
43
43
|
var import_supabase_js = require("@supabase/supabase-js");
|
|
44
44
|
|
|
45
45
|
// src/lib/utils.ts
|
|
@@ -405,6 +405,47 @@ function useUserAuth({
|
|
|
405
405
|
return { authState, retry };
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
+
// src/hooks/useOrgConfig.ts
|
|
409
|
+
var React5 = __toESM(require("react"), 1);
|
|
410
|
+
function useOrgConfig({ agentUrl, orgId }) {
|
|
411
|
+
const [state, setState] = React5.useState({
|
|
412
|
+
status: "idle",
|
|
413
|
+
config: null,
|
|
414
|
+
error: null
|
|
415
|
+
});
|
|
416
|
+
React5.useEffect(() => {
|
|
417
|
+
if (!agentUrl || !orgId) {
|
|
418
|
+
console.log("[useOrgConfig] Skipping - missing agentUrl or orgId", { agentUrl, orgId });
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
const fetchConfig = async () => {
|
|
422
|
+
setState({ status: "loading", config: null, error: null });
|
|
423
|
+
const url = `${agentUrl}/org/${orgId}/config`;
|
|
424
|
+
console.log("[useOrgConfig] Fetching org config from:", url);
|
|
425
|
+
try {
|
|
426
|
+
const response = await fetch(url, {
|
|
427
|
+
method: "GET",
|
|
428
|
+
headers: {
|
|
429
|
+
"Accept": "application/json"
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
if (!response.ok) {
|
|
433
|
+
throw new Error(`Failed to fetch org config (${response.status})`);
|
|
434
|
+
}
|
|
435
|
+
const config = await response.json();
|
|
436
|
+
console.log("[useOrgConfig] Received config:", config);
|
|
437
|
+
setState({ status: "success", config, error: null });
|
|
438
|
+
} catch (error) {
|
|
439
|
+
const message = error instanceof Error ? error.message : "Failed to fetch org config";
|
|
440
|
+
console.error("[useOrgConfig] Error:", message);
|
|
441
|
+
setState({ status: "error", config: null, error: message });
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
fetchConfig();
|
|
445
|
+
}, [agentUrl, orgId]);
|
|
446
|
+
return state;
|
|
447
|
+
}
|
|
448
|
+
|
|
408
449
|
// src/components/ui/card.tsx
|
|
409
450
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
410
451
|
function Card({ className, ...props }) {
|
|
@@ -982,7 +1023,7 @@ function TypingIndicator({ className = "" }) {
|
|
|
982
1023
|
|
|
983
1024
|
// src/ChatPanel.tsx
|
|
984
1025
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
985
|
-
var CHAT_PANEL_VERSION = true ? "0.2.
|
|
1026
|
+
var CHAT_PANEL_VERSION = true ? "0.2.45" : "dev";
|
|
986
1027
|
var DEFAULT_AGENT_URL = "http://localhost:5002";
|
|
987
1028
|
var PANEL_WIDTH = 340;
|
|
988
1029
|
function unescapeJsonString(str) {
|
|
@@ -1446,16 +1487,49 @@ function ChatPanel({
|
|
|
1446
1487
|
supabaseAnonKey,
|
|
1447
1488
|
productBackendUrl
|
|
1448
1489
|
} = {}) {
|
|
1449
|
-
const [messages, setMessages] =
|
|
1450
|
-
const [input, setInput] =
|
|
1451
|
-
const [sessionId, setSessionId] =
|
|
1490
|
+
const [messages, setMessages] = React6.useState(initialMessages);
|
|
1491
|
+
const [input, setInput] = React6.useState("");
|
|
1492
|
+
const [sessionId, setSessionId] = React6.useState(() => crypto.randomUUID());
|
|
1493
|
+
const orgConfigState = useOrgConfig({ agentUrl, orgId: orgId || "" });
|
|
1494
|
+
const effectiveProductBackendUrl = orgConfigState.config?.productBackendUrl || productBackendUrl;
|
|
1452
1495
|
const { authState, retry: retryAuth } = useUserAuth({
|
|
1453
|
-
productBackendUrl,
|
|
1496
|
+
productBackendUrl: effectiveProductBackendUrl,
|
|
1454
1497
|
sessionId,
|
|
1455
|
-
enabled: !!
|
|
1456
|
-
// Only enable
|
|
1498
|
+
enabled: !!effectiveProductBackendUrl && orgConfigState.status === "success"
|
|
1499
|
+
// Only enable after config is fetched
|
|
1457
1500
|
});
|
|
1458
|
-
|
|
1501
|
+
React6.useEffect(() => {
|
|
1502
|
+
if (!effectiveProductBackendUrl || orgConfigState.status !== "success") {
|
|
1503
|
+
return;
|
|
1504
|
+
}
|
|
1505
|
+
const testUserSiteEndpoint = async () => {
|
|
1506
|
+
const url = `${effectiveProductBackendUrl}/userSite`;
|
|
1507
|
+
console.log("[KiteChat TEST] Testing GET /userSite endpoint...");
|
|
1508
|
+
console.log("[KiteChat TEST] URL:", url);
|
|
1509
|
+
try {
|
|
1510
|
+
const response = await fetch(url, {
|
|
1511
|
+
method: "GET",
|
|
1512
|
+
credentials: "include",
|
|
1513
|
+
headers: {
|
|
1514
|
+
"Accept": "application/json"
|
|
1515
|
+
}
|
|
1516
|
+
});
|
|
1517
|
+
console.log("[KiteChat TEST] /userSite response status:", response.status);
|
|
1518
|
+
console.log("[KiteChat TEST] /userSite response ok:", response.ok);
|
|
1519
|
+
if (response.ok) {
|
|
1520
|
+
const data = await response.json();
|
|
1521
|
+
console.log("[KiteChat TEST] /userSite SUCCESS - data:", data);
|
|
1522
|
+
} else {
|
|
1523
|
+
const errorText = await response.text();
|
|
1524
|
+
console.log("[KiteChat TEST] /userSite FAILED - status:", response.status, "body:", errorText);
|
|
1525
|
+
}
|
|
1526
|
+
} catch (error) {
|
|
1527
|
+
console.error("[KiteChat TEST] /userSite ERROR:", error);
|
|
1528
|
+
}
|
|
1529
|
+
};
|
|
1530
|
+
testUserSiteEndpoint();
|
|
1531
|
+
}, [effectiveProductBackendUrl, orgConfigState.status]);
|
|
1532
|
+
const effectiveUser = React6.useMemo(() => {
|
|
1459
1533
|
if (authState.status === "authenticated") {
|
|
1460
1534
|
return {
|
|
1461
1535
|
userId: authState.user.id,
|
|
@@ -1473,16 +1547,16 @@ function ChatPanel({
|
|
|
1473
1547
|
isInternal: false
|
|
1474
1548
|
};
|
|
1475
1549
|
}, [authState, userId, userName, userEmail]);
|
|
1476
|
-
const [isEscalated, setIsEscalated] =
|
|
1477
|
-
const escalationWsRef =
|
|
1478
|
-
const [agentIsTyping, setAgentIsTyping] =
|
|
1479
|
-
const supabaseRef =
|
|
1480
|
-
const typingChannelRef =
|
|
1481
|
-
const typingTimeoutRef =
|
|
1482
|
-
|
|
1550
|
+
const [isEscalated, setIsEscalated] = React6.useState(false);
|
|
1551
|
+
const escalationWsRef = React6.useRef(null);
|
|
1552
|
+
const [agentIsTyping, setAgentIsTyping] = React6.useState(false);
|
|
1553
|
+
const supabaseRef = React6.useRef(null);
|
|
1554
|
+
const typingChannelRef = React6.useRef(null);
|
|
1555
|
+
const typingTimeoutRef = React6.useRef(null);
|
|
1556
|
+
React6.useEffect(() => {
|
|
1483
1557
|
console.log(`[KiteChat] Chat Panel v${CHAT_PANEL_VERSION} loaded`);
|
|
1484
1558
|
}, []);
|
|
1485
|
-
const resetSession =
|
|
1559
|
+
const resetSession = React6.useCallback(() => {
|
|
1486
1560
|
console.log("[KiteChat] resetSession called", { isEscalated, hasSupabase: !!supabaseRef.current, sessionId });
|
|
1487
1561
|
if (isEscalated && supabaseRef.current && sessionId) {
|
|
1488
1562
|
console.log("[KiteChat] Updating customer_status to disconnected for session:", sessionId);
|
|
@@ -1512,12 +1586,12 @@ function ChatPanel({
|
|
|
1512
1586
|
typingChannelRef.current = null;
|
|
1513
1587
|
}
|
|
1514
1588
|
}, [isEscalated, sessionId]);
|
|
1515
|
-
|
|
1589
|
+
React6.useEffect(() => {
|
|
1516
1590
|
if (supabaseUrl && supabaseAnonKey && !supabaseRef.current) {
|
|
1517
1591
|
supabaseRef.current = (0, import_supabase_js.createClient)(supabaseUrl, supabaseAnonKey);
|
|
1518
1592
|
}
|
|
1519
1593
|
}, [supabaseUrl, supabaseAnonKey]);
|
|
1520
|
-
|
|
1594
|
+
React6.useEffect(() => {
|
|
1521
1595
|
if (!isEscalated || !sessionId || !supabaseRef.current) {
|
|
1522
1596
|
return;
|
|
1523
1597
|
}
|
|
@@ -1554,8 +1628,8 @@ function ChatPanel({
|
|
|
1554
1628
|
}
|
|
1555
1629
|
};
|
|
1556
1630
|
}, [isEscalated, sessionId]);
|
|
1557
|
-
const heartbeatIntervalRef =
|
|
1558
|
-
const updateCustomerStatus =
|
|
1631
|
+
const heartbeatIntervalRef = React6.useRef(null);
|
|
1632
|
+
const updateCustomerStatus = React6.useCallback(async (status) => {
|
|
1559
1633
|
if (!supabaseRef.current || !sessionId) return;
|
|
1560
1634
|
try {
|
|
1561
1635
|
await supabaseRef.current.from("escalations").update({
|
|
@@ -1566,7 +1640,7 @@ function ChatPanel({
|
|
|
1566
1640
|
console.error("[KiteChat] Failed to update customer status:", err);
|
|
1567
1641
|
}
|
|
1568
1642
|
}, [sessionId]);
|
|
1569
|
-
|
|
1643
|
+
React6.useEffect(() => {
|
|
1570
1644
|
if (!isEscalated || !sessionId || !supabaseRef.current) {
|
|
1571
1645
|
return;
|
|
1572
1646
|
}
|
|
@@ -1614,7 +1688,7 @@ function ChatPanel({
|
|
|
1614
1688
|
}
|
|
1615
1689
|
};
|
|
1616
1690
|
}, [isEscalated, sessionId, updateCustomerStatus]);
|
|
1617
|
-
const sendTypingIndicator =
|
|
1691
|
+
const sendTypingIndicator = React6.useCallback((isTyping) => {
|
|
1618
1692
|
if (!typingChannelRef.current) {
|
|
1619
1693
|
console.log("[KiteChat] Cannot send typing - channel not ready");
|
|
1620
1694
|
return;
|
|
@@ -1630,8 +1704,8 @@ function ChatPanel({
|
|
|
1630
1704
|
payload: { sender: "user", isTyping }
|
|
1631
1705
|
});
|
|
1632
1706
|
}, [isEscalated]);
|
|
1633
|
-
const userTypingTimeoutRef =
|
|
1634
|
-
const handleTypingStart =
|
|
1707
|
+
const userTypingTimeoutRef = React6.useRef(null);
|
|
1708
|
+
const handleTypingStart = React6.useCallback(() => {
|
|
1635
1709
|
if (!isEscalated || !supabaseRef.current) return;
|
|
1636
1710
|
sendTypingIndicator(true);
|
|
1637
1711
|
updateCustomerStatus("active");
|
|
@@ -1642,19 +1716,19 @@ function ChatPanel({
|
|
|
1642
1716
|
sendTypingIndicator(false);
|
|
1643
1717
|
}, 1500);
|
|
1644
1718
|
}, [isEscalated, sendTypingIndicator, updateCustomerStatus]);
|
|
1645
|
-
const streamIntervals =
|
|
1719
|
+
const streamIntervals = React6.useRef({});
|
|
1646
1720
|
const isEmpty = messages.length === 0;
|
|
1647
|
-
const [phase, setPhase] =
|
|
1648
|
-
const [progressSteps, setProgressSteps] =
|
|
1649
|
-
const phaseTimers =
|
|
1721
|
+
const [phase, setPhase] = React6.useState("idle");
|
|
1722
|
+
const [progressSteps, setProgressSteps] = React6.useState([]);
|
|
1723
|
+
const phaseTimers = React6.useRef([]);
|
|
1650
1724
|
const lastRole = messages.length ? messages[messages.length - 1].role : void 0;
|
|
1651
|
-
const [panelView, setPanelView] =
|
|
1725
|
+
const [panelView, setPanelView] = React6.useState(
|
|
1652
1726
|
"landing"
|
|
1653
1727
|
);
|
|
1654
|
-
const [currentFolderId, setCurrentFolderId] =
|
|
1655
|
-
const [startingQuestions, setStartingQuestions] =
|
|
1656
|
-
const [loadingQuestions, setLoadingQuestions] =
|
|
1657
|
-
|
|
1728
|
+
const [currentFolderId, setCurrentFolderId] = React6.useState(void 0);
|
|
1729
|
+
const [startingQuestions, setStartingQuestions] = React6.useState(startingQuestionsProp || defaultStartingQuestions);
|
|
1730
|
+
const [loadingQuestions, setLoadingQuestions] = React6.useState(false);
|
|
1731
|
+
React6.useEffect(() => {
|
|
1658
1732
|
if (startingQuestionsEndpoint && !startingQuestionsProp) {
|
|
1659
1733
|
setLoadingQuestions(true);
|
|
1660
1734
|
fetch(startingQuestionsEndpoint).then((res) => res.json()).then((data) => {
|
|
@@ -1666,16 +1740,16 @@ function ChatPanel({
|
|
|
1666
1740
|
}).finally(() => setLoadingQuestions(false));
|
|
1667
1741
|
}
|
|
1668
1742
|
}, [startingQuestionsEndpoint, startingQuestionsProp]);
|
|
1669
|
-
|
|
1743
|
+
React6.useEffect(() => {
|
|
1670
1744
|
if (startingQuestionsProp) {
|
|
1671
1745
|
setStartingQuestions(startingQuestionsProp);
|
|
1672
1746
|
}
|
|
1673
1747
|
}, [startingQuestionsProp]);
|
|
1674
|
-
const [activeGuide, setActiveGuide] =
|
|
1675
|
-
const activeGuideRef =
|
|
1676
|
-
const latestBulkSummaryNavigationRef =
|
|
1677
|
-
const [guideComplete, setGuideComplete] =
|
|
1678
|
-
|
|
1748
|
+
const [activeGuide, setActiveGuide] = React6.useState(void 0);
|
|
1749
|
+
const activeGuideRef = React6.useRef(void 0);
|
|
1750
|
+
const latestBulkSummaryNavigationRef = React6.useRef(null);
|
|
1751
|
+
const [guideComplete, setGuideComplete] = React6.useState(false);
|
|
1752
|
+
React6.useEffect(() => {
|
|
1679
1753
|
window.resetIntegrationNotification = () => {
|
|
1680
1754
|
localStorage.removeItem("gmailNotificationSeen");
|
|
1681
1755
|
console.log(
|
|
@@ -1709,7 +1783,7 @@ function ChatPanel({
|
|
|
1709
1783
|
);
|
|
1710
1784
|
};
|
|
1711
1785
|
}, []);
|
|
1712
|
-
|
|
1786
|
+
React6.useEffect(() => {
|
|
1713
1787
|
if (activeGuide) {
|
|
1714
1788
|
if (!activeGuideRef.current || activeGuideRef.current.id !== activeGuide.id || activeGuideRef.current.stepIndex !== activeGuide.stepIndex) {
|
|
1715
1789
|
activeGuideRef.current = activeGuide;
|
|
@@ -1718,21 +1792,21 @@ function ChatPanel({
|
|
|
1718
1792
|
activeGuideRef.current = void 0;
|
|
1719
1793
|
}
|
|
1720
1794
|
}, [activeGuide]);
|
|
1721
|
-
const [pendingNavigation, setPendingNavigation] =
|
|
1722
|
-
const [pendingAction, setPendingAction] =
|
|
1723
|
-
const [actionFormData, setActionFormData] =
|
|
1724
|
-
const messagesEndRef =
|
|
1725
|
-
const messagesContainerRef =
|
|
1726
|
-
const currentStepRef =
|
|
1795
|
+
const [pendingNavigation, setPendingNavigation] = React6.useState(null);
|
|
1796
|
+
const [pendingAction, setPendingAction] = React6.useState(null);
|
|
1797
|
+
const [actionFormData, setActionFormData] = React6.useState({});
|
|
1798
|
+
const messagesEndRef = React6.useRef(null);
|
|
1799
|
+
const messagesContainerRef = React6.useRef(null);
|
|
1800
|
+
const currentStepRef = React6.useRef(null);
|
|
1727
1801
|
const { cursorState, moveTo, hide } = useGuideCursor();
|
|
1728
|
-
const [pendingFile, setPendingFile] =
|
|
1729
|
-
const [pendingBulkSession, setPendingBulkSession] =
|
|
1730
|
-
const pendingBulkSessionRef =
|
|
1731
|
-
const fileInputRef =
|
|
1732
|
-
const [searchExpanded, setSearchExpanded] =
|
|
1733
|
-
const [searchInput, setSearchInput] =
|
|
1734
|
-
const searchInputRef =
|
|
1735
|
-
|
|
1802
|
+
const [pendingFile, setPendingFile] = React6.useState(null);
|
|
1803
|
+
const [pendingBulkSession, setPendingBulkSession] = React6.useState(null);
|
|
1804
|
+
const pendingBulkSessionRef = React6.useRef(null);
|
|
1805
|
+
const fileInputRef = React6.useRef(null);
|
|
1806
|
+
const [searchExpanded, setSearchExpanded] = React6.useState(false);
|
|
1807
|
+
const [searchInput, setSearchInput] = React6.useState("");
|
|
1808
|
+
const searchInputRef = React6.useRef(null);
|
|
1809
|
+
React6.useEffect(() => {
|
|
1736
1810
|
if (!activeGuide || activeGuide.id !== "add-api-key" || activeGuide.stepIndex !== 2) {
|
|
1737
1811
|
return;
|
|
1738
1812
|
}
|
|
@@ -1758,7 +1832,7 @@ function ChatPanel({
|
|
|
1758
1832
|
const interval = setInterval(checkForDialogOpen, 300);
|
|
1759
1833
|
return () => clearInterval(interval);
|
|
1760
1834
|
}, [activeGuide, hide]);
|
|
1761
|
-
|
|
1835
|
+
React6.useEffect(() => {
|
|
1762
1836
|
return () => {
|
|
1763
1837
|
Object.values(streamIntervals.current).forEach(
|
|
1764
1838
|
(id) => window.clearInterval(id)
|
|
@@ -1768,7 +1842,7 @@ function ChatPanel({
|
|
|
1768
1842
|
phaseTimers.current = [];
|
|
1769
1843
|
};
|
|
1770
1844
|
}, []);
|
|
1771
|
-
|
|
1845
|
+
React6.useEffect(() => {
|
|
1772
1846
|
if (activeGuide && messages.length > 0) {
|
|
1773
1847
|
const lastMessage = messages[messages.length - 1];
|
|
1774
1848
|
if (lastMessage.kind === "guideStep" || lastMessage.kind === "guideComplete") {
|
|
@@ -1785,7 +1859,7 @@ function ChatPanel({
|
|
|
1785
1859
|
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
1786
1860
|
}
|
|
1787
1861
|
}, [messages, phase, activeGuide]);
|
|
1788
|
-
const latestBulkSummaryNavigation =
|
|
1862
|
+
const latestBulkSummaryNavigation = React6.useMemo(() => {
|
|
1789
1863
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
1790
1864
|
const msg = messages[i];
|
|
1791
1865
|
if (msg.kind === "bulkSummary" && msg.bulkSummary?.navigationPage && msg.bulkSummary.successes > 0) {
|
|
@@ -1794,13 +1868,13 @@ function ChatPanel({
|
|
|
1794
1868
|
}
|
|
1795
1869
|
return null;
|
|
1796
1870
|
}, [messages]);
|
|
1797
|
-
|
|
1871
|
+
React6.useEffect(() => {
|
|
1798
1872
|
latestBulkSummaryNavigationRef.current = latestBulkSummaryNavigation;
|
|
1799
1873
|
}, [latestBulkSummaryNavigation]);
|
|
1800
|
-
|
|
1874
|
+
React6.useEffect(() => {
|
|
1801
1875
|
pendingBulkSessionRef.current = pendingBulkSession;
|
|
1802
1876
|
}, [pendingBulkSession]);
|
|
1803
|
-
|
|
1877
|
+
React6.useEffect(() => {
|
|
1804
1878
|
const handleKeyDown = (e) => {
|
|
1805
1879
|
if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
|
|
1806
1880
|
const currentBulkSession = pendingBulkSessionRef.current;
|
|
@@ -1863,7 +1937,7 @@ function ChatPanel({
|
|
|
1863
1937
|
guideComplete,
|
|
1864
1938
|
onNavigate
|
|
1865
1939
|
]);
|
|
1866
|
-
const connectToEscalationWs =
|
|
1940
|
+
const connectToEscalationWs = React6.useCallback((currentSessionId) => {
|
|
1867
1941
|
if (!agentUrl) return;
|
|
1868
1942
|
if (escalationWsRef.current) {
|
|
1869
1943
|
escalationWsRef.current.close();
|
|
@@ -1906,7 +1980,7 @@ function ChatPanel({
|
|
|
1906
1980
|
};
|
|
1907
1981
|
escalationWsRef.current = ws;
|
|
1908
1982
|
}, [agentUrl]);
|
|
1909
|
-
const sendEscalatedMessage =
|
|
1983
|
+
const sendEscalatedMessage = React6.useCallback(async (content) => {
|
|
1910
1984
|
if (!escalationWsRef.current || escalationWsRef.current.readyState !== WebSocket.OPEN) {
|
|
1911
1985
|
console.error("[KiteChat] Escalation WebSocket not connected");
|
|
1912
1986
|
return false;
|
|
@@ -1923,14 +1997,14 @@ function ChatPanel({
|
|
|
1923
1997
|
return false;
|
|
1924
1998
|
}
|
|
1925
1999
|
}, [updateCustomerStatus]);
|
|
1926
|
-
|
|
2000
|
+
React6.useEffect(() => {
|
|
1927
2001
|
return () => {
|
|
1928
2002
|
if (escalationWsRef.current) {
|
|
1929
2003
|
escalationWsRef.current.close();
|
|
1930
2004
|
}
|
|
1931
2005
|
};
|
|
1932
2006
|
}, []);
|
|
1933
|
-
|
|
2007
|
+
React6.useEffect(() => {
|
|
1934
2008
|
if (isEscalated && sessionId) {
|
|
1935
2009
|
connectToEscalationWs(sessionId);
|
|
1936
2010
|
}
|
|
@@ -3159,7 +3233,38 @@ ${userText}`
|
|
|
3159
3233
|
] })
|
|
3160
3234
|
] }) }) });
|
|
3161
3235
|
}
|
|
3162
|
-
if (
|
|
3236
|
+
if (orgConfigState.status === "loading") {
|
|
3237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3238
|
+
"section",
|
|
3239
|
+
{
|
|
3240
|
+
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"}`,
|
|
3241
|
+
style: { width: `${PANEL_WIDTH}px` },
|
|
3242
|
+
children: [
|
|
3243
|
+
/* @__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: [
|
|
3244
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2.5", children: [
|
|
3245
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Sparkles, { className: "h-3.5 w-3.5 text-black", fill: "currentColor" }),
|
|
3246
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { className: "text-sm font-semibold text-gray-800", children: "Copilot" })
|
|
3247
|
+
] }),
|
|
3248
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3249
|
+
Button,
|
|
3250
|
+
{
|
|
3251
|
+
variant: "ghost",
|
|
3252
|
+
size: "sm",
|
|
3253
|
+
className: "h-7 w-7 p-0 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-full",
|
|
3254
|
+
onClick: () => onClose?.(),
|
|
3255
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-4 w-4" })
|
|
3256
|
+
}
|
|
3257
|
+
)
|
|
3258
|
+
] }),
|
|
3259
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "text-center", children: [
|
|
3260
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Loader2, { className: "h-8 w-8 animate-spin text-gray-400 mx-auto mb-3" }),
|
|
3261
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-sm text-gray-500", children: "Loading..." })
|
|
3262
|
+
] }) })
|
|
3263
|
+
]
|
|
3264
|
+
}
|
|
3265
|
+
);
|
|
3266
|
+
}
|
|
3267
|
+
if (effectiveProductBackendUrl) {
|
|
3163
3268
|
if (authState.status === "loading") {
|
|
3164
3269
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3165
3270
|
"section",
|
|
@@ -4334,7 +4439,7 @@ ${userText}`
|
|
|
4334
4439
|
message.id
|
|
4335
4440
|
);
|
|
4336
4441
|
}
|
|
4337
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(React6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
4338
4443
|
"div",
|
|
4339
4444
|
{
|
|
4340
4445
|
ref: isCurrentGuideStep ? currentStepRef : null,
|
|
@@ -4571,7 +4676,7 @@ function ChatPanelWithToggle({
|
|
|
4571
4676
|
supabaseAnonKey,
|
|
4572
4677
|
productBackendUrl
|
|
4573
4678
|
}) {
|
|
4574
|
-
const [internalIsOpen, setInternalIsOpen] =
|
|
4679
|
+
const [internalIsOpen, setInternalIsOpen] = React6.useState(defaultOpen);
|
|
4575
4680
|
const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
|
|
4576
4681
|
const setIsOpen = (open) => {
|
|
4577
4682
|
if (controlledIsOpen === void 0) {
|
|
@@ -4579,7 +4684,7 @@ function ChatPanelWithToggle({
|
|
|
4579
4684
|
}
|
|
4580
4685
|
onOpenChange?.(open);
|
|
4581
4686
|
};
|
|
4582
|
-
|
|
4687
|
+
React6.useEffect(() => {
|
|
4583
4688
|
const originalPadding = document.body.style.paddingRight;
|
|
4584
4689
|
const originalTransition = document.body.style.transition;
|
|
4585
4690
|
document.body.style.transition = "padding-right 0.3s ease";
|