@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.
@@ -882,7 +882,7 @@ function DataRenderer({ type, data }) {
882
882
  }
883
883
 
884
884
  // src/ChatPanel.tsx
885
- import * as React5 from "react";
885
+ import * as React6 from "react";
886
886
  import { createClient } from "@supabase/supabase-js";
887
887
  import { ArrowLeft, ArrowUp, Command, CornerDownLeft, CheckCircle2 as CheckCircle23, SquarePen, Paperclip, X, FileSpreadsheet, Loader2 as Loader22, ChevronLeft, ChevronRight, Sparkles, Minus } from "lucide-react";
888
888
 
@@ -953,6 +953,47 @@ function useUserAuth({
953
953
  return { authState, retry };
954
954
  }
955
955
 
956
+ // src/hooks/useOrgConfig.ts
957
+ import * as React5 from "react";
958
+ function useOrgConfig({ agentUrl, orgId }) {
959
+ const [state, setState] = React5.useState({
960
+ status: "idle",
961
+ config: null,
962
+ error: null
963
+ });
964
+ React5.useEffect(() => {
965
+ if (!agentUrl || !orgId) {
966
+ console.log("[useOrgConfig] Skipping - missing agentUrl or orgId", { agentUrl, orgId });
967
+ return;
968
+ }
969
+ const fetchConfig = async () => {
970
+ setState({ status: "loading", config: null, error: null });
971
+ const url = `${agentUrl}/org/${orgId}/config`;
972
+ console.log("[useOrgConfig] Fetching org config from:", url);
973
+ try {
974
+ const response = await fetch(url, {
975
+ method: "GET",
976
+ headers: {
977
+ "Accept": "application/json"
978
+ }
979
+ });
980
+ if (!response.ok) {
981
+ throw new Error(`Failed to fetch org config (${response.status})`);
982
+ }
983
+ const config = await response.json();
984
+ console.log("[useOrgConfig] Received config:", config);
985
+ setState({ status: "success", config, error: null });
986
+ } catch (error) {
987
+ const message = error instanceof Error ? error.message : "Failed to fetch org config";
988
+ console.error("[useOrgConfig] Error:", message);
989
+ setState({ status: "error", config: null, error: message });
990
+ }
991
+ };
992
+ fetchConfig();
993
+ }, [agentUrl, orgId]);
994
+ return state;
995
+ }
996
+
956
997
  // src/components/TypingIndicator.tsx
957
998
  import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
958
999
  function TypingIndicator({ className = "" }) {
@@ -983,7 +1024,7 @@ function TypingIndicator({ className = "" }) {
983
1024
 
984
1025
  // src/ChatPanel.tsx
985
1026
  import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
986
- var CHAT_PANEL_VERSION = true ? "0.2.43" : "dev";
1027
+ var CHAT_PANEL_VERSION = true ? "0.2.45" : "dev";
987
1028
  var DEFAULT_AGENT_URL = "http://localhost:5002";
988
1029
  var PANEL_WIDTH = 340;
989
1030
  function unescapeJsonString(str) {
@@ -1447,16 +1488,49 @@ function ChatPanel({
1447
1488
  supabaseAnonKey,
1448
1489
  productBackendUrl
1449
1490
  } = {}) {
1450
- const [messages, setMessages] = React5.useState(initialMessages);
1451
- const [input, setInput] = React5.useState("");
1452
- const [sessionId, setSessionId] = React5.useState(() => crypto.randomUUID());
1491
+ const [messages, setMessages] = React6.useState(initialMessages);
1492
+ const [input, setInput] = React6.useState("");
1493
+ const [sessionId, setSessionId] = React6.useState(() => crypto.randomUUID());
1494
+ const orgConfigState = useOrgConfig({ agentUrl, orgId: orgId || "" });
1495
+ const effectiveProductBackendUrl = orgConfigState.config?.productBackendUrl || productBackendUrl;
1453
1496
  const { authState, retry: retryAuth } = useUserAuth({
1454
- productBackendUrl,
1497
+ productBackendUrl: effectiveProductBackendUrl,
1455
1498
  sessionId,
1456
- enabled: !!productBackendUrl
1457
- // Only enable if URL is provided
1499
+ enabled: !!effectiveProductBackendUrl && orgConfigState.status === "success"
1500
+ // Only enable after config is fetched
1458
1501
  });
1459
- const effectiveUser = React5.useMemo(() => {
1502
+ React6.useEffect(() => {
1503
+ if (!effectiveProductBackendUrl || orgConfigState.status !== "success") {
1504
+ return;
1505
+ }
1506
+ const testUserSiteEndpoint = async () => {
1507
+ const url = `${effectiveProductBackendUrl}/userSite`;
1508
+ console.log("[KiteChat TEST] Testing GET /userSite endpoint...");
1509
+ console.log("[KiteChat TEST] URL:", url);
1510
+ try {
1511
+ const response = await fetch(url, {
1512
+ method: "GET",
1513
+ credentials: "include",
1514
+ headers: {
1515
+ "Accept": "application/json"
1516
+ }
1517
+ });
1518
+ console.log("[KiteChat TEST] /userSite response status:", response.status);
1519
+ console.log("[KiteChat TEST] /userSite response ok:", response.ok);
1520
+ if (response.ok) {
1521
+ const data = await response.json();
1522
+ console.log("[KiteChat TEST] /userSite SUCCESS - data:", data);
1523
+ } else {
1524
+ const errorText = await response.text();
1525
+ console.log("[KiteChat TEST] /userSite FAILED - status:", response.status, "body:", errorText);
1526
+ }
1527
+ } catch (error) {
1528
+ console.error("[KiteChat TEST] /userSite ERROR:", error);
1529
+ }
1530
+ };
1531
+ testUserSiteEndpoint();
1532
+ }, [effectiveProductBackendUrl, orgConfigState.status]);
1533
+ const effectiveUser = React6.useMemo(() => {
1460
1534
  if (authState.status === "authenticated") {
1461
1535
  return {
1462
1536
  userId: authState.user.id,
@@ -1474,16 +1548,16 @@ function ChatPanel({
1474
1548
  isInternal: false
1475
1549
  };
1476
1550
  }, [authState, userId, userName, userEmail]);
1477
- const [isEscalated, setIsEscalated] = React5.useState(false);
1478
- const escalationWsRef = React5.useRef(null);
1479
- const [agentIsTyping, setAgentIsTyping] = React5.useState(false);
1480
- const supabaseRef = React5.useRef(null);
1481
- const typingChannelRef = React5.useRef(null);
1482
- const typingTimeoutRef = React5.useRef(null);
1483
- React5.useEffect(() => {
1551
+ const [isEscalated, setIsEscalated] = React6.useState(false);
1552
+ const escalationWsRef = React6.useRef(null);
1553
+ const [agentIsTyping, setAgentIsTyping] = React6.useState(false);
1554
+ const supabaseRef = React6.useRef(null);
1555
+ const typingChannelRef = React6.useRef(null);
1556
+ const typingTimeoutRef = React6.useRef(null);
1557
+ React6.useEffect(() => {
1484
1558
  console.log(`[KiteChat] Chat Panel v${CHAT_PANEL_VERSION} loaded`);
1485
1559
  }, []);
1486
- const resetSession = React5.useCallback(() => {
1560
+ const resetSession = React6.useCallback(() => {
1487
1561
  console.log("[KiteChat] resetSession called", { isEscalated, hasSupabase: !!supabaseRef.current, sessionId });
1488
1562
  if (isEscalated && supabaseRef.current && sessionId) {
1489
1563
  console.log("[KiteChat] Updating customer_status to disconnected for session:", sessionId);
@@ -1513,12 +1587,12 @@ function ChatPanel({
1513
1587
  typingChannelRef.current = null;
1514
1588
  }
1515
1589
  }, [isEscalated, sessionId]);
1516
- React5.useEffect(() => {
1590
+ React6.useEffect(() => {
1517
1591
  if (supabaseUrl && supabaseAnonKey && !supabaseRef.current) {
1518
1592
  supabaseRef.current = createClient(supabaseUrl, supabaseAnonKey);
1519
1593
  }
1520
1594
  }, [supabaseUrl, supabaseAnonKey]);
1521
- React5.useEffect(() => {
1595
+ React6.useEffect(() => {
1522
1596
  if (!isEscalated || !sessionId || !supabaseRef.current) {
1523
1597
  return;
1524
1598
  }
@@ -1555,8 +1629,8 @@ function ChatPanel({
1555
1629
  }
1556
1630
  };
1557
1631
  }, [isEscalated, sessionId]);
1558
- const heartbeatIntervalRef = React5.useRef(null);
1559
- const updateCustomerStatus = React5.useCallback(async (status) => {
1632
+ const heartbeatIntervalRef = React6.useRef(null);
1633
+ const updateCustomerStatus = React6.useCallback(async (status) => {
1560
1634
  if (!supabaseRef.current || !sessionId) return;
1561
1635
  try {
1562
1636
  await supabaseRef.current.from("escalations").update({
@@ -1567,7 +1641,7 @@ function ChatPanel({
1567
1641
  console.error("[KiteChat] Failed to update customer status:", err);
1568
1642
  }
1569
1643
  }, [sessionId]);
1570
- React5.useEffect(() => {
1644
+ React6.useEffect(() => {
1571
1645
  if (!isEscalated || !sessionId || !supabaseRef.current) {
1572
1646
  return;
1573
1647
  }
@@ -1615,7 +1689,7 @@ function ChatPanel({
1615
1689
  }
1616
1690
  };
1617
1691
  }, [isEscalated, sessionId, updateCustomerStatus]);
1618
- const sendTypingIndicator = React5.useCallback((isTyping) => {
1692
+ const sendTypingIndicator = React6.useCallback((isTyping) => {
1619
1693
  if (!typingChannelRef.current) {
1620
1694
  console.log("[KiteChat] Cannot send typing - channel not ready");
1621
1695
  return;
@@ -1631,8 +1705,8 @@ function ChatPanel({
1631
1705
  payload: { sender: "user", isTyping }
1632
1706
  });
1633
1707
  }, [isEscalated]);
1634
- const userTypingTimeoutRef = React5.useRef(null);
1635
- const handleTypingStart = React5.useCallback(() => {
1708
+ const userTypingTimeoutRef = React6.useRef(null);
1709
+ const handleTypingStart = React6.useCallback(() => {
1636
1710
  if (!isEscalated || !supabaseRef.current) return;
1637
1711
  sendTypingIndicator(true);
1638
1712
  updateCustomerStatus("active");
@@ -1643,19 +1717,19 @@ function ChatPanel({
1643
1717
  sendTypingIndicator(false);
1644
1718
  }, 1500);
1645
1719
  }, [isEscalated, sendTypingIndicator, updateCustomerStatus]);
1646
- const streamIntervals = React5.useRef({});
1720
+ const streamIntervals = React6.useRef({});
1647
1721
  const isEmpty = messages.length === 0;
1648
- const [phase, setPhase] = React5.useState("idle");
1649
- const [progressSteps, setProgressSteps] = React5.useState([]);
1650
- const phaseTimers = React5.useRef([]);
1722
+ const [phase, setPhase] = React6.useState("idle");
1723
+ const [progressSteps, setProgressSteps] = React6.useState([]);
1724
+ const phaseTimers = React6.useRef([]);
1651
1725
  const lastRole = messages.length ? messages[messages.length - 1].role : void 0;
1652
- const [panelView, setPanelView] = React5.useState(
1726
+ const [panelView, setPanelView] = React6.useState(
1653
1727
  "landing"
1654
1728
  );
1655
- const [currentFolderId, setCurrentFolderId] = React5.useState(void 0);
1656
- const [startingQuestions, setStartingQuestions] = React5.useState(startingQuestionsProp || defaultStartingQuestions);
1657
- const [loadingQuestions, setLoadingQuestions] = React5.useState(false);
1658
- React5.useEffect(() => {
1729
+ const [currentFolderId, setCurrentFolderId] = React6.useState(void 0);
1730
+ const [startingQuestions, setStartingQuestions] = React6.useState(startingQuestionsProp || defaultStartingQuestions);
1731
+ const [loadingQuestions, setLoadingQuestions] = React6.useState(false);
1732
+ React6.useEffect(() => {
1659
1733
  if (startingQuestionsEndpoint && !startingQuestionsProp) {
1660
1734
  setLoadingQuestions(true);
1661
1735
  fetch(startingQuestionsEndpoint).then((res) => res.json()).then((data) => {
@@ -1667,16 +1741,16 @@ function ChatPanel({
1667
1741
  }).finally(() => setLoadingQuestions(false));
1668
1742
  }
1669
1743
  }, [startingQuestionsEndpoint, startingQuestionsProp]);
1670
- React5.useEffect(() => {
1744
+ React6.useEffect(() => {
1671
1745
  if (startingQuestionsProp) {
1672
1746
  setStartingQuestions(startingQuestionsProp);
1673
1747
  }
1674
1748
  }, [startingQuestionsProp]);
1675
- const [activeGuide, setActiveGuide] = React5.useState(void 0);
1676
- const activeGuideRef = React5.useRef(void 0);
1677
- const latestBulkSummaryNavigationRef = React5.useRef(null);
1678
- const [guideComplete, setGuideComplete] = React5.useState(false);
1679
- React5.useEffect(() => {
1749
+ const [activeGuide, setActiveGuide] = React6.useState(void 0);
1750
+ const activeGuideRef = React6.useRef(void 0);
1751
+ const latestBulkSummaryNavigationRef = React6.useRef(null);
1752
+ const [guideComplete, setGuideComplete] = React6.useState(false);
1753
+ React6.useEffect(() => {
1680
1754
  window.resetIntegrationNotification = () => {
1681
1755
  localStorage.removeItem("gmailNotificationSeen");
1682
1756
  console.log(
@@ -1710,7 +1784,7 @@ function ChatPanel({
1710
1784
  );
1711
1785
  };
1712
1786
  }, []);
1713
- React5.useEffect(() => {
1787
+ React6.useEffect(() => {
1714
1788
  if (activeGuide) {
1715
1789
  if (!activeGuideRef.current || activeGuideRef.current.id !== activeGuide.id || activeGuideRef.current.stepIndex !== activeGuide.stepIndex) {
1716
1790
  activeGuideRef.current = activeGuide;
@@ -1719,21 +1793,21 @@ function ChatPanel({
1719
1793
  activeGuideRef.current = void 0;
1720
1794
  }
1721
1795
  }, [activeGuide]);
1722
- const [pendingNavigation, setPendingNavigation] = React5.useState(null);
1723
- const [pendingAction, setPendingAction] = React5.useState(null);
1724
- const [actionFormData, setActionFormData] = React5.useState({});
1725
- const messagesEndRef = React5.useRef(null);
1726
- const messagesContainerRef = React5.useRef(null);
1727
- const currentStepRef = React5.useRef(null);
1796
+ const [pendingNavigation, setPendingNavigation] = React6.useState(null);
1797
+ const [pendingAction, setPendingAction] = React6.useState(null);
1798
+ const [actionFormData, setActionFormData] = React6.useState({});
1799
+ const messagesEndRef = React6.useRef(null);
1800
+ const messagesContainerRef = React6.useRef(null);
1801
+ const currentStepRef = React6.useRef(null);
1728
1802
  const { cursorState, moveTo, hide } = useGuideCursor();
1729
- const [pendingFile, setPendingFile] = React5.useState(null);
1730
- const [pendingBulkSession, setPendingBulkSession] = React5.useState(null);
1731
- const pendingBulkSessionRef = React5.useRef(null);
1732
- const fileInputRef = React5.useRef(null);
1733
- const [searchExpanded, setSearchExpanded] = React5.useState(false);
1734
- const [searchInput, setSearchInput] = React5.useState("");
1735
- const searchInputRef = React5.useRef(null);
1736
- React5.useEffect(() => {
1803
+ const [pendingFile, setPendingFile] = React6.useState(null);
1804
+ const [pendingBulkSession, setPendingBulkSession] = React6.useState(null);
1805
+ const pendingBulkSessionRef = React6.useRef(null);
1806
+ const fileInputRef = React6.useRef(null);
1807
+ const [searchExpanded, setSearchExpanded] = React6.useState(false);
1808
+ const [searchInput, setSearchInput] = React6.useState("");
1809
+ const searchInputRef = React6.useRef(null);
1810
+ React6.useEffect(() => {
1737
1811
  if (!activeGuide || activeGuide.id !== "add-api-key" || activeGuide.stepIndex !== 2) {
1738
1812
  return;
1739
1813
  }
@@ -1759,7 +1833,7 @@ function ChatPanel({
1759
1833
  const interval = setInterval(checkForDialogOpen, 300);
1760
1834
  return () => clearInterval(interval);
1761
1835
  }, [activeGuide, hide]);
1762
- React5.useEffect(() => {
1836
+ React6.useEffect(() => {
1763
1837
  return () => {
1764
1838
  Object.values(streamIntervals.current).forEach(
1765
1839
  (id) => window.clearInterval(id)
@@ -1769,7 +1843,7 @@ function ChatPanel({
1769
1843
  phaseTimers.current = [];
1770
1844
  };
1771
1845
  }, []);
1772
- React5.useEffect(() => {
1846
+ React6.useEffect(() => {
1773
1847
  if (activeGuide && messages.length > 0) {
1774
1848
  const lastMessage = messages[messages.length - 1];
1775
1849
  if (lastMessage.kind === "guideStep" || lastMessage.kind === "guideComplete") {
@@ -1786,7 +1860,7 @@ function ChatPanel({
1786
1860
  messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
1787
1861
  }
1788
1862
  }, [messages, phase, activeGuide]);
1789
- const latestBulkSummaryNavigation = React5.useMemo(() => {
1863
+ const latestBulkSummaryNavigation = React6.useMemo(() => {
1790
1864
  for (let i = messages.length - 1; i >= 0; i--) {
1791
1865
  const msg = messages[i];
1792
1866
  if (msg.kind === "bulkSummary" && msg.bulkSummary?.navigationPage && msg.bulkSummary.successes > 0) {
@@ -1795,13 +1869,13 @@ function ChatPanel({
1795
1869
  }
1796
1870
  return null;
1797
1871
  }, [messages]);
1798
- React5.useEffect(() => {
1872
+ React6.useEffect(() => {
1799
1873
  latestBulkSummaryNavigationRef.current = latestBulkSummaryNavigation;
1800
1874
  }, [latestBulkSummaryNavigation]);
1801
- React5.useEffect(() => {
1875
+ React6.useEffect(() => {
1802
1876
  pendingBulkSessionRef.current = pendingBulkSession;
1803
1877
  }, [pendingBulkSession]);
1804
- React5.useEffect(() => {
1878
+ React6.useEffect(() => {
1805
1879
  const handleKeyDown = (e) => {
1806
1880
  if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
1807
1881
  const currentBulkSession = pendingBulkSessionRef.current;
@@ -1864,7 +1938,7 @@ function ChatPanel({
1864
1938
  guideComplete,
1865
1939
  onNavigate
1866
1940
  ]);
1867
- const connectToEscalationWs = React5.useCallback((currentSessionId) => {
1941
+ const connectToEscalationWs = React6.useCallback((currentSessionId) => {
1868
1942
  if (!agentUrl) return;
1869
1943
  if (escalationWsRef.current) {
1870
1944
  escalationWsRef.current.close();
@@ -1907,7 +1981,7 @@ function ChatPanel({
1907
1981
  };
1908
1982
  escalationWsRef.current = ws;
1909
1983
  }, [agentUrl]);
1910
- const sendEscalatedMessage = React5.useCallback(async (content) => {
1984
+ const sendEscalatedMessage = React6.useCallback(async (content) => {
1911
1985
  if (!escalationWsRef.current || escalationWsRef.current.readyState !== WebSocket.OPEN) {
1912
1986
  console.error("[KiteChat] Escalation WebSocket not connected");
1913
1987
  return false;
@@ -1924,14 +1998,14 @@ function ChatPanel({
1924
1998
  return false;
1925
1999
  }
1926
2000
  }, [updateCustomerStatus]);
1927
- React5.useEffect(() => {
2001
+ React6.useEffect(() => {
1928
2002
  return () => {
1929
2003
  if (escalationWsRef.current) {
1930
2004
  escalationWsRef.current.close();
1931
2005
  }
1932
2006
  };
1933
2007
  }, []);
1934
- React5.useEffect(() => {
2008
+ React6.useEffect(() => {
1935
2009
  if (isEscalated && sessionId) {
1936
2010
  connectToEscalationWs(sessionId);
1937
2011
  }
@@ -3160,7 +3234,38 @@ ${userText}`
3160
3234
  ] })
3161
3235
  ] }) }) });
3162
3236
  }
3163
- if (productBackendUrl) {
3237
+ if (orgConfigState.status === "loading") {
3238
+ return /* @__PURE__ */ jsxs6(
3239
+ "section",
3240
+ {
3241
+ 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"}`,
3242
+ style: { width: `${PANEL_WIDTH}px` },
3243
+ children: [
3244
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-100 bg-gradient-to-r from-gray-50 to-white shrink-0", children: [
3245
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2.5", children: [
3246
+ /* @__PURE__ */ jsx10(Sparkles, { className: "h-3.5 w-3.5 text-black", fill: "currentColor" }),
3247
+ /* @__PURE__ */ jsx10("h3", { className: "text-sm font-semibold text-gray-800", children: "Copilot" })
3248
+ ] }),
3249
+ /* @__PURE__ */ jsx10(
3250
+ Button,
3251
+ {
3252
+ variant: "ghost",
3253
+ size: "sm",
3254
+ className: "h-7 w-7 p-0 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-full",
3255
+ onClick: () => onClose?.(),
3256
+ children: /* @__PURE__ */ jsx10(X, { className: "h-4 w-4" })
3257
+ }
3258
+ )
3259
+ ] }),
3260
+ /* @__PURE__ */ jsx10("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ jsxs6("div", { className: "text-center", children: [
3261
+ /* @__PURE__ */ jsx10(Loader22, { className: "h-8 w-8 animate-spin text-gray-400 mx-auto mb-3" }),
3262
+ /* @__PURE__ */ jsx10("p", { className: "text-sm text-gray-500", children: "Loading..." })
3263
+ ] }) })
3264
+ ]
3265
+ }
3266
+ );
3267
+ }
3268
+ if (effectiveProductBackendUrl) {
3164
3269
  if (authState.status === "loading") {
3165
3270
  return /* @__PURE__ */ jsxs6(
3166
3271
  "section",
@@ -4335,7 +4440,7 @@ ${userText}`
4335
4440
  message.id
4336
4441
  );
4337
4442
  }
4338
- return /* @__PURE__ */ jsx10(React5.Fragment, { children: /* @__PURE__ */ jsxs6(
4443
+ return /* @__PURE__ */ jsx10(React6.Fragment, { children: /* @__PURE__ */ jsxs6(
4339
4444
  "div",
4340
4445
  {
4341
4446
  ref: isCurrentGuideStep ? currentStepRef : null,
@@ -4592,7 +4697,7 @@ function ChatPanelWithToggle({
4592
4697
  supabaseAnonKey,
4593
4698
  productBackendUrl
4594
4699
  }) {
4595
- const [internalIsOpen, setInternalIsOpen] = React5.useState(defaultOpen);
4700
+ const [internalIsOpen, setInternalIsOpen] = React6.useState(defaultOpen);
4596
4701
  const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
4597
4702
  const setIsOpen = (open) => {
4598
4703
  if (controlledIsOpen === void 0) {
@@ -4600,7 +4705,7 @@ function ChatPanelWithToggle({
4600
4705
  }
4601
4706
  onOpenChange?.(open);
4602
4707
  };
4603
- React5.useEffect(() => {
4708
+ React6.useEffect(() => {
4604
4709
  const originalPadding = document.body.style.paddingRight;
4605
4710
  const originalTransition = document.body.style.transition;
4606
4711
  document.body.style.transition = "padding-right 0.3s ease";
@@ -4647,7 +4752,7 @@ function HelpButton({ onClick, className = "" }) {
4647
4752
  }
4648
4753
 
4649
4754
  // src/createKiteChat.tsx
4650
- import React6 from "react";
4755
+ import React7 from "react";
4651
4756
  import { createRoot } from "react-dom/client";
4652
4757
  import { jsx as jsx11 } from "react/jsx-runtime";
4653
4758
  function KiteChatWrapper({
@@ -4655,14 +4760,14 @@ function KiteChatWrapper({
4655
4760
  onConfigUpdate,
4656
4761
  onStateUpdate
4657
4762
  }) {
4658
- const [config, setConfig] = React6.useState(initialConfig);
4659
- const [currentPage, setCurrentPage] = React6.useState(initialConfig.currentPage || "dashboard");
4660
- const [isOpen, setIsOpen] = React6.useState(false);
4661
- const isOpenRef = React6.useRef(false);
4662
- React6.useEffect(() => {
4763
+ const [config, setConfig] = React7.useState(initialConfig);
4764
+ const [currentPage, setCurrentPage] = React7.useState(initialConfig.currentPage || "dashboard");
4765
+ const [isOpen, setIsOpen] = React7.useState(false);
4766
+ const isOpenRef = React7.useRef(false);
4767
+ React7.useEffect(() => {
4663
4768
  isOpenRef.current = isOpen;
4664
4769
  }, [isOpen]);
4665
- React6.useEffect(() => {
4770
+ React7.useEffect(() => {
4666
4771
  onConfigUpdate((newConfig) => {
4667
4772
  if (newConfig.currentPage !== void 0) {
4668
4773
  setCurrentPage(newConfig.currentPage);
@@ -4674,7 +4779,7 @@ function KiteChatWrapper({
4674
4779
  getIsOpen: () => isOpenRef.current
4675
4780
  });
4676
4781
  }, [onConfigUpdate, onStateUpdate]);
4677
- React6.useEffect(() => {
4782
+ React7.useEffect(() => {
4678
4783
  const container = document.getElementById("kite-chat-root");
4679
4784
  if (!container) return;
4680
4785
  if (config.theme === "dark") {