@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/index.cjs
CHANGED
|
@@ -70,7 +70,7 @@ var import_react = __toESM(require("react"), 1);
|
|
|
70
70
|
var import_client = require("react-dom/client");
|
|
71
71
|
|
|
72
72
|
// src/ChatPanel.tsx
|
|
73
|
-
var
|
|
73
|
+
var React6 = __toESM(require("react"), 1);
|
|
74
74
|
var import_supabase_js = require("@supabase/supabase-js");
|
|
75
75
|
|
|
76
76
|
// src/lib/utils.ts
|
|
@@ -436,6 +436,47 @@ function useUserAuth({
|
|
|
436
436
|
return { authState, retry };
|
|
437
437
|
}
|
|
438
438
|
|
|
439
|
+
// src/hooks/useOrgConfig.ts
|
|
440
|
+
var React5 = __toESM(require("react"), 1);
|
|
441
|
+
function useOrgConfig({ agentUrl, orgId }) {
|
|
442
|
+
const [state, setState] = React5.useState({
|
|
443
|
+
status: "idle",
|
|
444
|
+
config: null,
|
|
445
|
+
error: null
|
|
446
|
+
});
|
|
447
|
+
React5.useEffect(() => {
|
|
448
|
+
if (!agentUrl || !orgId) {
|
|
449
|
+
console.log("[useOrgConfig] Skipping - missing agentUrl or orgId", { agentUrl, orgId });
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
const fetchConfig = async () => {
|
|
453
|
+
setState({ status: "loading", config: null, error: null });
|
|
454
|
+
const url = `${agentUrl}/org/${orgId}/config`;
|
|
455
|
+
console.log("[useOrgConfig] Fetching org config from:", url);
|
|
456
|
+
try {
|
|
457
|
+
const response = await fetch(url, {
|
|
458
|
+
method: "GET",
|
|
459
|
+
headers: {
|
|
460
|
+
"Accept": "application/json"
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
if (!response.ok) {
|
|
464
|
+
throw new Error(`Failed to fetch org config (${response.status})`);
|
|
465
|
+
}
|
|
466
|
+
const config = await response.json();
|
|
467
|
+
console.log("[useOrgConfig] Received config:", config);
|
|
468
|
+
setState({ status: "success", config, error: null });
|
|
469
|
+
} catch (error) {
|
|
470
|
+
const message = error instanceof Error ? error.message : "Failed to fetch org config";
|
|
471
|
+
console.error("[useOrgConfig] Error:", message);
|
|
472
|
+
setState({ status: "error", config: null, error: message });
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
fetchConfig();
|
|
476
|
+
}, [agentUrl, orgId]);
|
|
477
|
+
return state;
|
|
478
|
+
}
|
|
479
|
+
|
|
439
480
|
// src/components/ui/card.tsx
|
|
440
481
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
441
482
|
function Card({ className, ...props }) {
|
|
@@ -1036,7 +1077,7 @@ function TypingIndicator({ className = "" }) {
|
|
|
1036
1077
|
|
|
1037
1078
|
// src/ChatPanel.tsx
|
|
1038
1079
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1039
|
-
var CHAT_PANEL_VERSION = true ? "0.2.
|
|
1080
|
+
var CHAT_PANEL_VERSION = true ? "0.2.45" : "dev";
|
|
1040
1081
|
var DEFAULT_AGENT_URL = "http://localhost:5002";
|
|
1041
1082
|
var PANEL_WIDTH = 340;
|
|
1042
1083
|
function unescapeJsonString(str) {
|
|
@@ -1500,16 +1541,49 @@ function ChatPanel({
|
|
|
1500
1541
|
supabaseAnonKey,
|
|
1501
1542
|
productBackendUrl
|
|
1502
1543
|
} = {}) {
|
|
1503
|
-
const [messages, setMessages] =
|
|
1504
|
-
const [input, setInput] =
|
|
1505
|
-
const [sessionId, setSessionId] =
|
|
1544
|
+
const [messages, setMessages] = React6.useState(initialMessages);
|
|
1545
|
+
const [input, setInput] = React6.useState("");
|
|
1546
|
+
const [sessionId, setSessionId] = React6.useState(() => crypto.randomUUID());
|
|
1547
|
+
const orgConfigState = useOrgConfig({ agentUrl, orgId: orgId || "" });
|
|
1548
|
+
const effectiveProductBackendUrl = orgConfigState.config?.productBackendUrl || productBackendUrl;
|
|
1506
1549
|
const { authState, retry: retryAuth } = useUserAuth({
|
|
1507
|
-
productBackendUrl,
|
|
1550
|
+
productBackendUrl: effectiveProductBackendUrl,
|
|
1508
1551
|
sessionId,
|
|
1509
|
-
enabled: !!
|
|
1510
|
-
// Only enable
|
|
1552
|
+
enabled: !!effectiveProductBackendUrl && orgConfigState.status === "success"
|
|
1553
|
+
// Only enable after config is fetched
|
|
1511
1554
|
});
|
|
1512
|
-
|
|
1555
|
+
React6.useEffect(() => {
|
|
1556
|
+
if (!effectiveProductBackendUrl || orgConfigState.status !== "success") {
|
|
1557
|
+
return;
|
|
1558
|
+
}
|
|
1559
|
+
const testUserSiteEndpoint = async () => {
|
|
1560
|
+
const url = `${effectiveProductBackendUrl}/userSite`;
|
|
1561
|
+
console.log("[KiteChat TEST] Testing GET /userSite endpoint...");
|
|
1562
|
+
console.log("[KiteChat TEST] URL:", url);
|
|
1563
|
+
try {
|
|
1564
|
+
const response = await fetch(url, {
|
|
1565
|
+
method: "GET",
|
|
1566
|
+
credentials: "include",
|
|
1567
|
+
headers: {
|
|
1568
|
+
"Accept": "application/json"
|
|
1569
|
+
}
|
|
1570
|
+
});
|
|
1571
|
+
console.log("[KiteChat TEST] /userSite response status:", response.status);
|
|
1572
|
+
console.log("[KiteChat TEST] /userSite response ok:", response.ok);
|
|
1573
|
+
if (response.ok) {
|
|
1574
|
+
const data = await response.json();
|
|
1575
|
+
console.log("[KiteChat TEST] /userSite SUCCESS - data:", data);
|
|
1576
|
+
} else {
|
|
1577
|
+
const errorText = await response.text();
|
|
1578
|
+
console.log("[KiteChat TEST] /userSite FAILED - status:", response.status, "body:", errorText);
|
|
1579
|
+
}
|
|
1580
|
+
} catch (error) {
|
|
1581
|
+
console.error("[KiteChat TEST] /userSite ERROR:", error);
|
|
1582
|
+
}
|
|
1583
|
+
};
|
|
1584
|
+
testUserSiteEndpoint();
|
|
1585
|
+
}, [effectiveProductBackendUrl, orgConfigState.status]);
|
|
1586
|
+
const effectiveUser = React6.useMemo(() => {
|
|
1513
1587
|
if (authState.status === "authenticated") {
|
|
1514
1588
|
return {
|
|
1515
1589
|
userId: authState.user.id,
|
|
@@ -1527,16 +1601,16 @@ function ChatPanel({
|
|
|
1527
1601
|
isInternal: false
|
|
1528
1602
|
};
|
|
1529
1603
|
}, [authState, userId, userName, userEmail]);
|
|
1530
|
-
const [isEscalated, setIsEscalated] =
|
|
1531
|
-
const escalationWsRef =
|
|
1532
|
-
const [agentIsTyping, setAgentIsTyping] =
|
|
1533
|
-
const supabaseRef =
|
|
1534
|
-
const typingChannelRef =
|
|
1535
|
-
const typingTimeoutRef =
|
|
1536
|
-
|
|
1604
|
+
const [isEscalated, setIsEscalated] = React6.useState(false);
|
|
1605
|
+
const escalationWsRef = React6.useRef(null);
|
|
1606
|
+
const [agentIsTyping, setAgentIsTyping] = React6.useState(false);
|
|
1607
|
+
const supabaseRef = React6.useRef(null);
|
|
1608
|
+
const typingChannelRef = React6.useRef(null);
|
|
1609
|
+
const typingTimeoutRef = React6.useRef(null);
|
|
1610
|
+
React6.useEffect(() => {
|
|
1537
1611
|
console.log(`[KiteChat] Chat Panel v${CHAT_PANEL_VERSION} loaded`);
|
|
1538
1612
|
}, []);
|
|
1539
|
-
const resetSession =
|
|
1613
|
+
const resetSession = React6.useCallback(() => {
|
|
1540
1614
|
console.log("[KiteChat] resetSession called", { isEscalated, hasSupabase: !!supabaseRef.current, sessionId });
|
|
1541
1615
|
if (isEscalated && supabaseRef.current && sessionId) {
|
|
1542
1616
|
console.log("[KiteChat] Updating customer_status to disconnected for session:", sessionId);
|
|
@@ -1566,12 +1640,12 @@ function ChatPanel({
|
|
|
1566
1640
|
typingChannelRef.current = null;
|
|
1567
1641
|
}
|
|
1568
1642
|
}, [isEscalated, sessionId]);
|
|
1569
|
-
|
|
1643
|
+
React6.useEffect(() => {
|
|
1570
1644
|
if (supabaseUrl && supabaseAnonKey && !supabaseRef.current) {
|
|
1571
1645
|
supabaseRef.current = (0, import_supabase_js.createClient)(supabaseUrl, supabaseAnonKey);
|
|
1572
1646
|
}
|
|
1573
1647
|
}, [supabaseUrl, supabaseAnonKey]);
|
|
1574
|
-
|
|
1648
|
+
React6.useEffect(() => {
|
|
1575
1649
|
if (!isEscalated || !sessionId || !supabaseRef.current) {
|
|
1576
1650
|
return;
|
|
1577
1651
|
}
|
|
@@ -1608,8 +1682,8 @@ function ChatPanel({
|
|
|
1608
1682
|
}
|
|
1609
1683
|
};
|
|
1610
1684
|
}, [isEscalated, sessionId]);
|
|
1611
|
-
const heartbeatIntervalRef =
|
|
1612
|
-
const updateCustomerStatus =
|
|
1685
|
+
const heartbeatIntervalRef = React6.useRef(null);
|
|
1686
|
+
const updateCustomerStatus = React6.useCallback(async (status) => {
|
|
1613
1687
|
if (!supabaseRef.current || !sessionId) return;
|
|
1614
1688
|
try {
|
|
1615
1689
|
await supabaseRef.current.from("escalations").update({
|
|
@@ -1620,7 +1694,7 @@ function ChatPanel({
|
|
|
1620
1694
|
console.error("[KiteChat] Failed to update customer status:", err);
|
|
1621
1695
|
}
|
|
1622
1696
|
}, [sessionId]);
|
|
1623
|
-
|
|
1697
|
+
React6.useEffect(() => {
|
|
1624
1698
|
if (!isEscalated || !sessionId || !supabaseRef.current) {
|
|
1625
1699
|
return;
|
|
1626
1700
|
}
|
|
@@ -1668,7 +1742,7 @@ function ChatPanel({
|
|
|
1668
1742
|
}
|
|
1669
1743
|
};
|
|
1670
1744
|
}, [isEscalated, sessionId, updateCustomerStatus]);
|
|
1671
|
-
const sendTypingIndicator =
|
|
1745
|
+
const sendTypingIndicator = React6.useCallback((isTyping) => {
|
|
1672
1746
|
if (!typingChannelRef.current) {
|
|
1673
1747
|
console.log("[KiteChat] Cannot send typing - channel not ready");
|
|
1674
1748
|
return;
|
|
@@ -1684,8 +1758,8 @@ function ChatPanel({
|
|
|
1684
1758
|
payload: { sender: "user", isTyping }
|
|
1685
1759
|
});
|
|
1686
1760
|
}, [isEscalated]);
|
|
1687
|
-
const userTypingTimeoutRef =
|
|
1688
|
-
const handleTypingStart =
|
|
1761
|
+
const userTypingTimeoutRef = React6.useRef(null);
|
|
1762
|
+
const handleTypingStart = React6.useCallback(() => {
|
|
1689
1763
|
if (!isEscalated || !supabaseRef.current) return;
|
|
1690
1764
|
sendTypingIndicator(true);
|
|
1691
1765
|
updateCustomerStatus("active");
|
|
@@ -1696,19 +1770,19 @@ function ChatPanel({
|
|
|
1696
1770
|
sendTypingIndicator(false);
|
|
1697
1771
|
}, 1500);
|
|
1698
1772
|
}, [isEscalated, sendTypingIndicator, updateCustomerStatus]);
|
|
1699
|
-
const streamIntervals =
|
|
1773
|
+
const streamIntervals = React6.useRef({});
|
|
1700
1774
|
const isEmpty = messages.length === 0;
|
|
1701
|
-
const [phase, setPhase] =
|
|
1702
|
-
const [progressSteps, setProgressSteps] =
|
|
1703
|
-
const phaseTimers =
|
|
1775
|
+
const [phase, setPhase] = React6.useState("idle");
|
|
1776
|
+
const [progressSteps, setProgressSteps] = React6.useState([]);
|
|
1777
|
+
const phaseTimers = React6.useRef([]);
|
|
1704
1778
|
const lastRole = messages.length ? messages[messages.length - 1].role : void 0;
|
|
1705
|
-
const [panelView, setPanelView] =
|
|
1779
|
+
const [panelView, setPanelView] = React6.useState(
|
|
1706
1780
|
"landing"
|
|
1707
1781
|
);
|
|
1708
|
-
const [currentFolderId, setCurrentFolderId] =
|
|
1709
|
-
const [startingQuestions, setStartingQuestions] =
|
|
1710
|
-
const [loadingQuestions, setLoadingQuestions] =
|
|
1711
|
-
|
|
1782
|
+
const [currentFolderId, setCurrentFolderId] = React6.useState(void 0);
|
|
1783
|
+
const [startingQuestions, setStartingQuestions] = React6.useState(startingQuestionsProp || defaultStartingQuestions);
|
|
1784
|
+
const [loadingQuestions, setLoadingQuestions] = React6.useState(false);
|
|
1785
|
+
React6.useEffect(() => {
|
|
1712
1786
|
if (startingQuestionsEndpoint && !startingQuestionsProp) {
|
|
1713
1787
|
setLoadingQuestions(true);
|
|
1714
1788
|
fetch(startingQuestionsEndpoint).then((res) => res.json()).then((data) => {
|
|
@@ -1720,16 +1794,16 @@ function ChatPanel({
|
|
|
1720
1794
|
}).finally(() => setLoadingQuestions(false));
|
|
1721
1795
|
}
|
|
1722
1796
|
}, [startingQuestionsEndpoint, startingQuestionsProp]);
|
|
1723
|
-
|
|
1797
|
+
React6.useEffect(() => {
|
|
1724
1798
|
if (startingQuestionsProp) {
|
|
1725
1799
|
setStartingQuestions(startingQuestionsProp);
|
|
1726
1800
|
}
|
|
1727
1801
|
}, [startingQuestionsProp]);
|
|
1728
|
-
const [activeGuide, setActiveGuide] =
|
|
1729
|
-
const activeGuideRef =
|
|
1730
|
-
const latestBulkSummaryNavigationRef =
|
|
1731
|
-
const [guideComplete, setGuideComplete] =
|
|
1732
|
-
|
|
1802
|
+
const [activeGuide, setActiveGuide] = React6.useState(void 0);
|
|
1803
|
+
const activeGuideRef = React6.useRef(void 0);
|
|
1804
|
+
const latestBulkSummaryNavigationRef = React6.useRef(null);
|
|
1805
|
+
const [guideComplete, setGuideComplete] = React6.useState(false);
|
|
1806
|
+
React6.useEffect(() => {
|
|
1733
1807
|
window.resetIntegrationNotification = () => {
|
|
1734
1808
|
localStorage.removeItem("gmailNotificationSeen");
|
|
1735
1809
|
console.log(
|
|
@@ -1763,7 +1837,7 @@ function ChatPanel({
|
|
|
1763
1837
|
);
|
|
1764
1838
|
};
|
|
1765
1839
|
}, []);
|
|
1766
|
-
|
|
1840
|
+
React6.useEffect(() => {
|
|
1767
1841
|
if (activeGuide) {
|
|
1768
1842
|
if (!activeGuideRef.current || activeGuideRef.current.id !== activeGuide.id || activeGuideRef.current.stepIndex !== activeGuide.stepIndex) {
|
|
1769
1843
|
activeGuideRef.current = activeGuide;
|
|
@@ -1772,21 +1846,21 @@ function ChatPanel({
|
|
|
1772
1846
|
activeGuideRef.current = void 0;
|
|
1773
1847
|
}
|
|
1774
1848
|
}, [activeGuide]);
|
|
1775
|
-
const [pendingNavigation, setPendingNavigation] =
|
|
1776
|
-
const [pendingAction, setPendingAction] =
|
|
1777
|
-
const [actionFormData, setActionFormData] =
|
|
1778
|
-
const messagesEndRef =
|
|
1779
|
-
const messagesContainerRef =
|
|
1780
|
-
const currentStepRef =
|
|
1849
|
+
const [pendingNavigation, setPendingNavigation] = React6.useState(null);
|
|
1850
|
+
const [pendingAction, setPendingAction] = React6.useState(null);
|
|
1851
|
+
const [actionFormData, setActionFormData] = React6.useState({});
|
|
1852
|
+
const messagesEndRef = React6.useRef(null);
|
|
1853
|
+
const messagesContainerRef = React6.useRef(null);
|
|
1854
|
+
const currentStepRef = React6.useRef(null);
|
|
1781
1855
|
const { cursorState, moveTo, hide } = useGuideCursor();
|
|
1782
|
-
const [pendingFile, setPendingFile] =
|
|
1783
|
-
const [pendingBulkSession, setPendingBulkSession] =
|
|
1784
|
-
const pendingBulkSessionRef =
|
|
1785
|
-
const fileInputRef =
|
|
1786
|
-
const [searchExpanded, setSearchExpanded] =
|
|
1787
|
-
const [searchInput, setSearchInput] =
|
|
1788
|
-
const searchInputRef =
|
|
1789
|
-
|
|
1856
|
+
const [pendingFile, setPendingFile] = React6.useState(null);
|
|
1857
|
+
const [pendingBulkSession, setPendingBulkSession] = React6.useState(null);
|
|
1858
|
+
const pendingBulkSessionRef = React6.useRef(null);
|
|
1859
|
+
const fileInputRef = React6.useRef(null);
|
|
1860
|
+
const [searchExpanded, setSearchExpanded] = React6.useState(false);
|
|
1861
|
+
const [searchInput, setSearchInput] = React6.useState("");
|
|
1862
|
+
const searchInputRef = React6.useRef(null);
|
|
1863
|
+
React6.useEffect(() => {
|
|
1790
1864
|
if (!activeGuide || activeGuide.id !== "add-api-key" || activeGuide.stepIndex !== 2) {
|
|
1791
1865
|
return;
|
|
1792
1866
|
}
|
|
@@ -1812,7 +1886,7 @@ function ChatPanel({
|
|
|
1812
1886
|
const interval = setInterval(checkForDialogOpen, 300);
|
|
1813
1887
|
return () => clearInterval(interval);
|
|
1814
1888
|
}, [activeGuide, hide]);
|
|
1815
|
-
|
|
1889
|
+
React6.useEffect(() => {
|
|
1816
1890
|
return () => {
|
|
1817
1891
|
Object.values(streamIntervals.current).forEach(
|
|
1818
1892
|
(id) => window.clearInterval(id)
|
|
@@ -1822,7 +1896,7 @@ function ChatPanel({
|
|
|
1822
1896
|
phaseTimers.current = [];
|
|
1823
1897
|
};
|
|
1824
1898
|
}, []);
|
|
1825
|
-
|
|
1899
|
+
React6.useEffect(() => {
|
|
1826
1900
|
if (activeGuide && messages.length > 0) {
|
|
1827
1901
|
const lastMessage = messages[messages.length - 1];
|
|
1828
1902
|
if (lastMessage.kind === "guideStep" || lastMessage.kind === "guideComplete") {
|
|
@@ -1839,7 +1913,7 @@ function ChatPanel({
|
|
|
1839
1913
|
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
1840
1914
|
}
|
|
1841
1915
|
}, [messages, phase, activeGuide]);
|
|
1842
|
-
const latestBulkSummaryNavigation =
|
|
1916
|
+
const latestBulkSummaryNavigation = React6.useMemo(() => {
|
|
1843
1917
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
1844
1918
|
const msg = messages[i];
|
|
1845
1919
|
if (msg.kind === "bulkSummary" && msg.bulkSummary?.navigationPage && msg.bulkSummary.successes > 0) {
|
|
@@ -1848,13 +1922,13 @@ function ChatPanel({
|
|
|
1848
1922
|
}
|
|
1849
1923
|
return null;
|
|
1850
1924
|
}, [messages]);
|
|
1851
|
-
|
|
1925
|
+
React6.useEffect(() => {
|
|
1852
1926
|
latestBulkSummaryNavigationRef.current = latestBulkSummaryNavigation;
|
|
1853
1927
|
}, [latestBulkSummaryNavigation]);
|
|
1854
|
-
|
|
1928
|
+
React6.useEffect(() => {
|
|
1855
1929
|
pendingBulkSessionRef.current = pendingBulkSession;
|
|
1856
1930
|
}, [pendingBulkSession]);
|
|
1857
|
-
|
|
1931
|
+
React6.useEffect(() => {
|
|
1858
1932
|
const handleKeyDown = (e) => {
|
|
1859
1933
|
if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
|
|
1860
1934
|
const currentBulkSession = pendingBulkSessionRef.current;
|
|
@@ -1917,7 +1991,7 @@ function ChatPanel({
|
|
|
1917
1991
|
guideComplete,
|
|
1918
1992
|
onNavigate
|
|
1919
1993
|
]);
|
|
1920
|
-
const connectToEscalationWs =
|
|
1994
|
+
const connectToEscalationWs = React6.useCallback((currentSessionId) => {
|
|
1921
1995
|
if (!agentUrl) return;
|
|
1922
1996
|
if (escalationWsRef.current) {
|
|
1923
1997
|
escalationWsRef.current.close();
|
|
@@ -1960,7 +2034,7 @@ function ChatPanel({
|
|
|
1960
2034
|
};
|
|
1961
2035
|
escalationWsRef.current = ws;
|
|
1962
2036
|
}, [agentUrl]);
|
|
1963
|
-
const sendEscalatedMessage =
|
|
2037
|
+
const sendEscalatedMessage = React6.useCallback(async (content) => {
|
|
1964
2038
|
if (!escalationWsRef.current || escalationWsRef.current.readyState !== WebSocket.OPEN) {
|
|
1965
2039
|
console.error("[KiteChat] Escalation WebSocket not connected");
|
|
1966
2040
|
return false;
|
|
@@ -1977,14 +2051,14 @@ function ChatPanel({
|
|
|
1977
2051
|
return false;
|
|
1978
2052
|
}
|
|
1979
2053
|
}, [updateCustomerStatus]);
|
|
1980
|
-
|
|
2054
|
+
React6.useEffect(() => {
|
|
1981
2055
|
return () => {
|
|
1982
2056
|
if (escalationWsRef.current) {
|
|
1983
2057
|
escalationWsRef.current.close();
|
|
1984
2058
|
}
|
|
1985
2059
|
};
|
|
1986
2060
|
}, []);
|
|
1987
|
-
|
|
2061
|
+
React6.useEffect(() => {
|
|
1988
2062
|
if (isEscalated && sessionId) {
|
|
1989
2063
|
connectToEscalationWs(sessionId);
|
|
1990
2064
|
}
|
|
@@ -3213,7 +3287,38 @@ ${userText}`
|
|
|
3213
3287
|
] })
|
|
3214
3288
|
] }) }) });
|
|
3215
3289
|
}
|
|
3216
|
-
if (
|
|
3290
|
+
if (orgConfigState.status === "loading") {
|
|
3291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3292
|
+
"section",
|
|
3293
|
+
{
|
|
3294
|
+
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"}`,
|
|
3295
|
+
style: { width: `${PANEL_WIDTH}px` },
|
|
3296
|
+
children: [
|
|
3297
|
+
/* @__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: [
|
|
3298
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2.5", children: [
|
|
3299
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Sparkles, { className: "h-3.5 w-3.5 text-black", fill: "currentColor" }),
|
|
3300
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { className: "text-sm font-semibold text-gray-800", children: "Copilot" })
|
|
3301
|
+
] }),
|
|
3302
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3303
|
+
Button,
|
|
3304
|
+
{
|
|
3305
|
+
variant: "ghost",
|
|
3306
|
+
size: "sm",
|
|
3307
|
+
className: "h-7 w-7 p-0 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-full",
|
|
3308
|
+
onClick: () => onClose?.(),
|
|
3309
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-4 w-4" })
|
|
3310
|
+
}
|
|
3311
|
+
)
|
|
3312
|
+
] }),
|
|
3313
|
+
/* @__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: [
|
|
3314
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Loader2, { className: "h-8 w-8 animate-spin text-gray-400 mx-auto mb-3" }),
|
|
3315
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-sm text-gray-500", children: "Loading..." })
|
|
3316
|
+
] }) })
|
|
3317
|
+
]
|
|
3318
|
+
}
|
|
3319
|
+
);
|
|
3320
|
+
}
|
|
3321
|
+
if (effectiveProductBackendUrl) {
|
|
3217
3322
|
if (authState.status === "loading") {
|
|
3218
3323
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3219
3324
|
"section",
|
|
@@ -4388,7 +4493,7 @@ ${userText}`
|
|
|
4388
4493
|
message.id
|
|
4389
4494
|
);
|
|
4390
4495
|
}
|
|
4391
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(React6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
4392
4497
|
"div",
|
|
4393
4498
|
{
|
|
4394
4499
|
ref: isCurrentGuideStep ? currentStepRef : null,
|
|
@@ -4645,7 +4750,7 @@ function ChatPanelWithToggle({
|
|
|
4645
4750
|
supabaseAnonKey,
|
|
4646
4751
|
productBackendUrl
|
|
4647
4752
|
}) {
|
|
4648
|
-
const [internalIsOpen, setInternalIsOpen] =
|
|
4753
|
+
const [internalIsOpen, setInternalIsOpen] = React6.useState(defaultOpen);
|
|
4649
4754
|
const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
|
|
4650
4755
|
const setIsOpen = (open) => {
|
|
4651
4756
|
if (controlledIsOpen === void 0) {
|
|
@@ -4653,7 +4758,7 @@ function ChatPanelWithToggle({
|
|
|
4653
4758
|
}
|
|
4654
4759
|
onOpenChange?.(open);
|
|
4655
4760
|
};
|
|
4656
|
-
|
|
4761
|
+
React6.useEffect(() => {
|
|
4657
4762
|
const originalPadding = document.body.style.paddingRight;
|
|
4658
4763
|
const originalTransition = document.body.style.transition;
|
|
4659
4764
|
document.body.style.transition = "padding-right 0.3s ease";
|
package/dist/index.js
CHANGED