@kite-copilot/chat-panel 0.2.49 → 0.2.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -379,28 +379,22 @@ function useUserAuth({
379
379
  }) {
380
380
  const [authState, setAuthState] = React4.useState({ status: "idle" });
381
381
  const lastSessionIdRef = React4.useRef(null);
382
+ const lastEnabledRef = React4.useRef(enabled);
382
383
  const fetchUser = React4.useCallback(async () => {
383
384
  if (!productBackendUrl || !enabled) {
384
- console.log("[useUserAuth] Skipping auth - productBackendUrl:", productBackendUrl, "enabled:", enabled);
385
385
  setAuthState({ status: "idle" });
386
386
  return;
387
387
  }
388
- console.log("[useUserAuth] Starting auth request to product backend...");
389
- console.log("[useUserAuth] Product backend URL:", productBackendUrl);
390
- console.log("[useUserAuth] Full request URL:", `${productBackendUrl}/users/me`);
391
388
  setAuthState({ status: "loading" });
392
389
  try {
393
390
  const response = await fetch(`${productBackendUrl}/users/me`, {
394
391
  method: "GET",
395
392
  credentials: "include",
396
- // Include cookies for authentication
397
393
  headers: {
398
394
  "Accept": "application/json"
399
395
  }
400
396
  });
401
- console.log("[useUserAuth] Response received - status:", response.status, "ok:", response.ok);
402
397
  if (!response.ok) {
403
- console.log("[useUserAuth] Auth request failed with status:", response.status);
404
398
  if (response.status === 401) {
405
399
  throw new Error("Please log in to use the chat assistant.");
406
400
  }
@@ -410,27 +404,36 @@ function useUserAuth({
410
404
  throw new Error(`Authentication failed (${response.status})`);
411
405
  }
412
406
  const user = await response.json();
413
- console.log("[useUserAuth] Auth SUCCESS - parsed user data:");
414
- console.log("[useUserAuth] id:", user.id);
415
- console.log("[useUserAuth] email:", user.email);
416
- console.log("[useUserAuth] name:", user.name);
417
- console.log("[useUserAuth] role:", user.role);
418
- console.log("[useUserAuth] isInternal:", user.isInternal);
419
- console.log("[useUserAuth] agreementsSigned:", user.agreementsSigned);
420
- console.log("[useUserAuth] lastLoginTime:", user.lastLoginTime);
421
407
  setAuthState({ status: "authenticated", user });
422
408
  } catch (error) {
423
- console.log("[useUserAuth] Auth ERROR:", error);
409
+ if (error instanceof Error) {
410
+ const errorMessage = error.message.toLowerCase();
411
+ const isCorsError = errorMessage.includes("cors") || errorMessage.includes("network");
412
+ const is404Error = errorMessage.includes("404");
413
+ if (isCorsError || is404Error) {
414
+ console.warn("[useUserAuth] Auth endpoint unavailable, falling back to unauthenticated mode:", error.message);
415
+ setAuthState({ status: "idle" });
416
+ return;
417
+ }
418
+ }
424
419
  const message = error instanceof Error ? error.message : "Unable to verify your identity. Please try again.";
425
420
  setAuthState({ status: "error", error: message });
426
421
  }
427
422
  }, [productBackendUrl, enabled]);
428
423
  React4.useEffect(() => {
429
- if (sessionId !== lastSessionIdRef.current) {
424
+ const sessionChanged = sessionId !== lastSessionIdRef.current;
425
+ const enabledChanged = enabled !== lastEnabledRef.current;
426
+ const becameEnabled = enabled && !lastEnabledRef.current;
427
+ if (sessionChanged) {
430
428
  lastSessionIdRef.current = sessionId;
429
+ }
430
+ if (enabledChanged) {
431
+ lastEnabledRef.current = enabled;
432
+ }
433
+ if (sessionChanged || becameEnabled) {
431
434
  fetchUser();
432
435
  }
433
- }, [sessionId, fetchUser]);
436
+ }, [sessionId, enabled, fetchUser]);
434
437
  const retry = React4.useCallback(() => {
435
438
  fetchUser();
436
439
  }, [fetchUser]);
@@ -447,13 +450,11 @@ function useOrgConfig({ agentUrl, orgId }) {
447
450
  });
448
451
  React5.useEffect(() => {
449
452
  if (!agentUrl || !orgId) {
450
- console.log("[useOrgConfig] Skipping - missing agentUrl or orgId", { agentUrl, orgId });
451
453
  return;
452
454
  }
453
455
  const fetchConfig = async () => {
454
456
  setState({ status: "loading", config: null, error: null });
455
457
  const url = `${agentUrl}/org/${orgId}/config`;
456
- console.log("[useOrgConfig] Fetching org config from:", url);
457
458
  try {
458
459
  const response = await fetch(url, {
459
460
  method: "GET",
@@ -465,7 +466,6 @@ function useOrgConfig({ agentUrl, orgId }) {
465
466
  throw new Error(`Failed to fetch org config (${response.status})`);
466
467
  }
467
468
  const config = await response.json();
468
- console.log("[useOrgConfig] Received config:", config);
469
469
  setState({ status: "success", config, error: null });
470
470
  } catch (error) {
471
471
  const message = error instanceof Error ? error.message : "Failed to fetch org config";
@@ -499,8 +499,7 @@ function useFrontendToolExecutor({
499
499
  }
500
500
  }, [agentUrl]);
501
501
  const executeToolRequest = (0, import_react.useCallback)(async (toolRequest) => {
502
- const { call_id, tool_name, arguments: args, endpoint, method, path_params } = toolRequest;
503
- console.log("[FrontendToolExecutor] Executing tool:", tool_name, "with args:", args);
502
+ const { call_id, arguments: args, endpoint, method, path_params } = toolRequest;
504
503
  try {
505
504
  let url = endpoint;
506
505
  for (const param of path_params) {
@@ -516,7 +515,6 @@ function useFrontendToolExecutor({
516
515
  }
517
516
  const queryString = queryParams.toString();
518
517
  const fullUrl = `${productBackendUrl}${url}${queryString ? "?" + queryString : ""}`;
519
- console.log("[FrontendToolExecutor] Fetching:", fullUrl);
520
518
  const response = await fetch(fullUrl, {
521
519
  method,
522
520
  credentials: "include",
@@ -528,7 +526,6 @@ function useFrontendToolExecutor({
528
526
  let result;
529
527
  if (response.ok) {
530
528
  result = await response.json();
531
- console.log("[FrontendToolExecutor] Tool result:", result);
532
529
  } else {
533
530
  const errorText = await response.text();
534
531
  throw new Error(`HTTP ${response.status}: ${errorText}`);
@@ -1150,7 +1147,6 @@ function TypingIndicator({ className = "" }) {
1150
1147
 
1151
1148
  // src/ChatPanel.tsx
1152
1149
  var import_jsx_runtime10 = require("react/jsx-runtime");
1153
- var CHAT_PANEL_VERSION = true ? "0.2.49" : "dev";
1154
1150
  var DEFAULT_AGENT_URL = "http://localhost:5002";
1155
1151
  var PANEL_WIDTH = 400;
1156
1152
  var PANEL_HEIGHT = 600;
@@ -1614,7 +1610,8 @@ function ChatPanel({
1614
1610
  supabaseAnonKey,
1615
1611
  initialCorner = "bottom-left",
1616
1612
  onCornerChange,
1617
- productBackendUrl
1613
+ productBackendUrl,
1614
+ getAuthHeaders
1618
1615
  } = {}) {
1619
1616
  const [messages, setMessages] = React6.useState(initialMessages);
1620
1617
  const [input, setInput] = React6.useState("");
@@ -1647,37 +1644,6 @@ function ChatPanel({
1647
1644
  agentUrl,
1648
1645
  sessionId
1649
1646
  });
1650
- React6.useEffect(() => {
1651
- if (!effectiveProductBackendUrl || orgConfigState.status !== "success") {
1652
- return;
1653
- }
1654
- const testProductBackendEndpoint = async () => {
1655
- const url = `${effectiveProductBackendUrl}/getDocument/snowkite/categories/`;
1656
- console.log("[KiteChat TEST] Testing product backend connectivity...");
1657
- console.log("[KiteChat TEST] URL:", url);
1658
- try {
1659
- const response = await fetch(url, {
1660
- method: "GET",
1661
- // Note: not using credentials: 'include' to avoid CORS issues with wildcard
1662
- headers: {
1663
- "Accept": "application/json"
1664
- }
1665
- });
1666
- console.log("[KiteChat TEST] Response status:", response.status);
1667
- console.log("[KiteChat TEST] Response ok:", response.ok);
1668
- if (response.ok) {
1669
- const data = await response.json();
1670
- console.log("[KiteChat TEST] SUCCESS - product backend reachable, data:", data);
1671
- } else {
1672
- const errorText = await response.text();
1673
- console.log("[KiteChat TEST] FAILED - status:", response.status, "body:", errorText);
1674
- }
1675
- } catch (error) {
1676
- console.error("[KiteChat TEST] ERROR:", error);
1677
- }
1678
- };
1679
- testProductBackendEndpoint();
1680
- }, [effectiveProductBackendUrl, orgConfigState.status]);
1681
1647
  const effectiveUser = React6.useMemo(() => {
1682
1648
  if (sessionUser) {
1683
1649
  return sessionUser;
@@ -1708,7 +1674,6 @@ function ChatPanel({
1708
1674
  userRole: authState.user.role,
1709
1675
  isInternal: authState.user.isInternal
1710
1676
  });
1711
- console.log("[ChatPanel] Session user captured:", authState.user.id);
1712
1677
  }
1713
1678
  }, [authState, sessionUser]);
1714
1679
  const isWaitingForAuth = React6.useMemo(() => {
@@ -1721,26 +1686,18 @@ function ChatPanel({
1721
1686
  const supabaseRef = React6.useRef(null);
1722
1687
  const typingChannelRef = React6.useRef(null);
1723
1688
  const typingTimeoutRef = React6.useRef(null);
1724
- React6.useEffect(() => {
1725
- console.log(`[KiteChat] Chat Panel v${CHAT_PANEL_VERSION} loaded`);
1726
- }, []);
1727
1689
  const resetSession = React6.useCallback(() => {
1728
- console.log("[KiteChat] resetSession called", { isEscalated, hasSupabase: !!supabaseRef.current, sessionId });
1729
1690
  if (isEscalated && supabaseRef.current && sessionId) {
1730
- console.log("[KiteChat] Updating customer_status to disconnected for session:", sessionId);
1731
1691
  supabaseRef.current.from("escalations").update({
1732
1692
  customer_status: "disconnected",
1733
1693
  customer_last_seen: (/* @__PURE__ */ new Date()).toISOString()
1734
1694
  }).eq("session_id", sessionId).then(
1735
- (result) => {
1736
- console.log("[KiteChat] Disconnect update result:", result);
1695
+ () => {
1737
1696
  },
1738
1697
  (err) => {
1739
1698
  console.error("[KiteChat] Disconnect update failed:", err);
1740
1699
  }
1741
1700
  );
1742
- } else {
1743
- console.log("[KiteChat] Skipping disconnect update - conditions not met");
1744
1701
  }
1745
1702
  setSessionUser(null);
1746
1703
  setSessionId(crypto.randomUUID());
@@ -1766,12 +1723,9 @@ function ChatPanel({
1766
1723
  }
1767
1724
  const channelName = `typing:${sessionId}`;
1768
1725
  const channel = supabaseRef.current.channel(channelName);
1769
- console.log(`[KiteChat] Subscribing to typing channel: ${channelName}`);
1770
1726
  channel.on("broadcast", { event: "typing" }, (payload) => {
1771
- console.log("[KiteChat] Received typing broadcast:", payload);
1772
1727
  const { sender, isTyping } = payload.payload;
1773
1728
  if (sender === "agent") {
1774
- console.log(`[KiteChat] Agent typing: ${isTyping}`);
1775
1729
  setAgentIsTyping(isTyping);
1776
1730
  if (isTyping) {
1777
1731
  if (typingTimeoutRef.current) {
@@ -1783,10 +1737,11 @@ function ChatPanel({
1783
1737
  }
1784
1738
  }
1785
1739
  }).subscribe((status) => {
1786
- console.log(`[KiteChat] Typing channel status: ${status}`);
1787
1740
  if (status === "SUBSCRIBED") {
1788
1741
  typingChannelRef.current = channel;
1789
- console.log("[KiteChat] Typing channel ready");
1742
+ console.log("[KiteChat] Typing channel subscribed successfully");
1743
+ } else if (status === "CHANNEL_ERROR") {
1744
+ console.error("[KiteChat] Typing channel subscription failed");
1790
1745
  }
1791
1746
  });
1792
1747
  return () => {
@@ -1797,6 +1752,20 @@ function ChatPanel({
1797
1752
  }
1798
1753
  };
1799
1754
  }, [isEscalated, sessionId]);
1755
+ React6.useEffect(() => {
1756
+ if (!isOpen && isEscalated && supabaseRef.current && sessionId) {
1757
+ console.log("[KiteChat] Panel closed during live chat, marking disconnected");
1758
+ supabaseRef.current.from("escalations").update({
1759
+ customer_status: "disconnected",
1760
+ customer_last_seen: (/* @__PURE__ */ new Date()).toISOString()
1761
+ }).eq("session_id", sessionId).then(
1762
+ () => console.log("[KiteChat] Successfully marked disconnected on panel close"),
1763
+ (err) => {
1764
+ console.error("[KiteChat] Failed to mark disconnected on panel close:", err);
1765
+ }
1766
+ );
1767
+ }
1768
+ }, [isOpen, isEscalated, sessionId]);
1800
1769
  const heartbeatIntervalRef = React6.useRef(null);
1801
1770
  const updateCustomerStatus = React6.useCallback(async (status) => {
1802
1771
  if (!supabaseRef.current || !sessionId) return;
@@ -1815,9 +1784,20 @@ function ChatPanel({
1815
1784
  }
1816
1785
  const currentSessionId = sessionId;
1817
1786
  const supabase = supabaseRef.current;
1818
- updateCustomerStatus("active");
1787
+ const markActive = () => {
1788
+ supabase.from("escalations").update({
1789
+ customer_status: "active",
1790
+ customer_last_seen: (/* @__PURE__ */ new Date()).toISOString()
1791
+ }).eq("session_id", currentSessionId).then(
1792
+ () => {
1793
+ },
1794
+ (err) => console.error("[KiteChat] Failed to update customer status:", err)
1795
+ );
1796
+ };
1797
+ console.log("[KiteChat] Starting presence heartbeat for live chat");
1798
+ markActive();
1819
1799
  heartbeatIntervalRef.current = window.setInterval(() => {
1820
- updateCustomerStatus("active");
1800
+ markActive();
1821
1801
  }, 6e4);
1822
1802
  const handleBeforeUnload = () => {
1823
1803
  supabase.from("escalations").update({
@@ -1832,7 +1812,7 @@ function ChatPanel({
1832
1812
  customer_last_seen: (/* @__PURE__ */ new Date()).toISOString()
1833
1813
  }).eq("session_id", currentSessionId);
1834
1814
  } else if (document.visibilityState === "visible") {
1835
- updateCustomerStatus("active");
1815
+ markActive();
1836
1816
  }
1837
1817
  };
1838
1818
  window.addEventListener("beforeunload", handleBeforeUnload);
@@ -1840,13 +1820,12 @@ function ChatPanel({
1840
1820
  return () => {
1841
1821
  window.removeEventListener("beforeunload", handleBeforeUnload);
1842
1822
  document.removeEventListener("visibilitychange", handleVisibilityChange);
1823
+ console.log("[KiteChat] Escalation ended, marking disconnected");
1843
1824
  supabase.from("escalations").update({
1844
1825
  customer_status: "disconnected",
1845
1826
  customer_last_seen: (/* @__PURE__ */ new Date()).toISOString()
1846
1827
  }).eq("session_id", currentSessionId).then(
1847
- () => {
1848
- console.log("[KiteChat] Marked customer as disconnected");
1849
- },
1828
+ () => console.log("[KiteChat] Successfully marked disconnected on escalation end"),
1850
1829
  (err) => {
1851
1830
  console.error("[KiteChat] Failed to mark disconnected:", err);
1852
1831
  }
@@ -1856,17 +1835,14 @@ function ChatPanel({
1856
1835
  heartbeatIntervalRef.current = null;
1857
1836
  }
1858
1837
  };
1859
- }, [isEscalated, sessionId, updateCustomerStatus]);
1838
+ }, [isEscalated, sessionId]);
1860
1839
  const sendTypingIndicator = React6.useCallback((isTyping) => {
1861
- if (!typingChannelRef.current) {
1862
- console.log("[KiteChat] Cannot send typing - channel not ready");
1863
- return;
1864
- }
1865
- if (!isEscalated) {
1866
- console.log("[KiteChat] Cannot send typing - not escalated");
1840
+ if (!typingChannelRef.current || !isEscalated) {
1841
+ if (isTyping) {
1842
+ console.warn("[KiteChat] Typing channel not ready, cannot send typing indicator");
1843
+ }
1867
1844
  return;
1868
1845
  }
1869
- console.log(`[KiteChat] Sending typing indicator: ${isTyping}`);
1870
1846
  typingChannelRef.current.send({
1871
1847
  type: "broadcast",
1872
1848
  event: "typing",
@@ -1875,16 +1851,23 @@ function ChatPanel({
1875
1851
  }, [isEscalated]);
1876
1852
  const userTypingTimeoutRef = React6.useRef(null);
1877
1853
  const handleTypingStart = React6.useCallback(() => {
1878
- if (!isEscalated || !supabaseRef.current) return;
1854
+ if (!isEscalated || !supabaseRef.current || !sessionId) return;
1879
1855
  sendTypingIndicator(true);
1880
- updateCustomerStatus("active");
1856
+ supabaseRef.current.from("escalations").update({
1857
+ customer_status: "active",
1858
+ customer_last_seen: (/* @__PURE__ */ new Date()).toISOString()
1859
+ }).eq("session_id", sessionId).then(
1860
+ () => {
1861
+ },
1862
+ (err) => console.error("[KiteChat] Failed to update presence:", err)
1863
+ );
1881
1864
  if (userTypingTimeoutRef.current) {
1882
1865
  window.clearTimeout(userTypingTimeoutRef.current);
1883
1866
  }
1884
1867
  userTypingTimeoutRef.current = window.setTimeout(() => {
1885
1868
  sendTypingIndicator(false);
1886
1869
  }, 1500);
1887
- }, [isEscalated, sendTypingIndicator, updateCustomerStatus]);
1870
+ }, [isEscalated, sendTypingIndicator, sessionId]);
1888
1871
  const streamIntervals = React6.useRef({});
1889
1872
  const isEmpty = messages.length === 0;
1890
1873
  const [phase, setPhase] = React6.useState("idle");
@@ -1919,12 +1902,6 @@ function ChatPanel({
1919
1902
  const latestBulkSummaryNavigationRef = React6.useRef(null);
1920
1903
  const [guideComplete, setGuideComplete] = React6.useState(false);
1921
1904
  React6.useEffect(() => {
1922
- window.resetIntegrationNotification = () => {
1923
- localStorage.removeItem("gmailNotificationSeen");
1924
- console.log(
1925
- "Integration notification reset! Click the Integrations tab to see it again."
1926
- );
1927
- };
1928
1905
  const handleIntegrationTabClick = () => {
1929
1906
  const hasSeenNotification = localStorage.getItem("gmailNotificationSeen");
1930
1907
  if (!hasSeenNotification) {
@@ -2066,17 +2043,7 @@ function ChatPanel({
2066
2043
  return;
2067
2044
  }
2068
2045
  const currentBulkNav = latestBulkSummaryNavigationRef.current;
2069
- console.log(
2070
- "[DEBUG] Keyboard handler - latestBulkSummaryNavigation:",
2071
- currentBulkNav,
2072
- "onNavigate:",
2073
- !!onNavigate
2074
- );
2075
2046
  if (currentBulkNav && onNavigate) {
2076
- console.log(
2077
- "[DEBUG] Navigating via keyboard to:",
2078
- currentBulkNav.page
2079
- );
2080
2047
  e.preventDefault();
2081
2048
  e.stopPropagation();
2082
2049
  onNavigate(currentBulkNav.page, currentBulkNav.subtab);
@@ -2122,7 +2089,6 @@ function ChatPanel({
2122
2089
  const messageId = data.message_id;
2123
2090
  const isDuplicate = messageId ? prev.some((m) => m.serverMessageId === messageId) : prev.slice(-5).some((m) => m.content === content);
2124
2091
  if (isDuplicate) {
2125
- console.debug("[KiteChat] Skipping duplicate agent message:", messageId || content.slice(0, 30));
2126
2092
  return prev;
2127
2093
  }
2128
2094
  return [...prev, {
@@ -2145,7 +2111,6 @@ function ChatPanel({
2145
2111
  console.error("[KiteChat] Escalation WebSocket error:", err);
2146
2112
  };
2147
2113
  ws.onclose = () => {
2148
- console.log("[KiteChat] Escalation WebSocket closed");
2149
2114
  };
2150
2115
  escalationWsRef.current = ws;
2151
2116
  }, [agentUrl]);
@@ -2159,13 +2124,22 @@ function ChatPanel({
2159
2124
  type: "user_message",
2160
2125
  content
2161
2126
  }));
2162
- updateCustomerStatus("active");
2127
+ if (supabaseRef.current && sessionId) {
2128
+ supabaseRef.current.from("escalations").update({
2129
+ customer_status: "active",
2130
+ customer_last_seen: (/* @__PURE__ */ new Date()).toISOString()
2131
+ }).eq("session_id", sessionId).then(
2132
+ () => {
2133
+ },
2134
+ (err) => console.error("[KiteChat] Failed to update presence:", err)
2135
+ );
2136
+ }
2163
2137
  return true;
2164
2138
  } catch (err) {
2165
2139
  console.error("[KiteChat] Failed to send escalated message:", err);
2166
2140
  return false;
2167
2141
  }
2168
- }, [updateCustomerStatus]);
2142
+ }, [sessionId]);
2169
2143
  React6.useEffect(() => {
2170
2144
  return () => {
2171
2145
  if (escalationWsRef.current) {
@@ -2439,14 +2413,6 @@ function ChatPanel({
2439
2413
  try {
2440
2414
  const controller = new AbortController();
2441
2415
  const timeoutId = setTimeout(() => controller.abort(), 6e4);
2442
- console.log("[ChatPanel] Sending chat request to agent backend...");
2443
- console.log("[ChatPanel] Agent URL:", agentUrl);
2444
- console.log("[ChatPanel] User data being sent:");
2445
- console.log("[ChatPanel] user_id:", effectiveUser.userId);
2446
- console.log("[ChatPanel] user_name:", effectiveUser.userName);
2447
- console.log("[ChatPanel] user_email:", effectiveUser.userEmail);
2448
- console.log("[ChatPanel] org_id:", orgId);
2449
- console.log("[ChatPanel] authState.status:", authState.status);
2450
2416
  const response = await fetch(`${agentUrl}/chat/stream`, {
2451
2417
  method: "POST",
2452
2418
  headers: {
@@ -2663,7 +2629,6 @@ function ChatPanel({
2663
2629
  setMessages((prev) => [...prev, escalationMessage]);
2664
2630
  } else if (eventType === "tool_request") {
2665
2631
  const toolRequest = data;
2666
- console.log("[KiteChat] Received tool_request:", toolRequest);
2667
2632
  executeToolRequest(toolRequest).catch((err) => {
2668
2633
  console.error("[KiteChat] Tool execution failed:", err);
2669
2634
  });
@@ -2981,11 +2946,6 @@ ${userText}`
2981
2946
  }
2982
2947
  });
2983
2948
  } else if (eventType === "summary") {
2984
- console.log("[DEBUG] Received summary event - data:", data);
2985
- console.log(
2986
- "[DEBUG] navigationPage from backend:",
2987
- data.navigationPage
2988
- );
2989
2949
  setPhase("idle");
2990
2950
  setProgressSteps([]);
2991
2951
  setPendingBulkSession(null);
@@ -3005,7 +2965,6 @@ ${userText}`
3005
2965
  navigationPage: data.navigationPage
3006
2966
  }
3007
2967
  };
3008
- console.log("[DEBUG] Creating bulkSummary message:", newMsg);
3009
2968
  return [...filtered, newMsg];
3010
2969
  });
3011
2970
  setTimeout(() => {
@@ -4576,28 +4535,11 @@ ${userText}`
4576
4535
  onClick: (e) => {
4577
4536
  e.preventDefault();
4578
4537
  e.stopPropagation();
4579
- console.log(
4580
- "[DEBUG] Button clicked - navigationPage:",
4581
- navigationPage,
4582
- "onNavigate:",
4583
- !!onNavigate
4584
- );
4585
4538
  if (onNavigate && navigationPage.page) {
4586
- console.log(
4587
- "[DEBUG] Calling onNavigate with page:",
4588
- navigationPage.page
4589
- );
4590
4539
  onNavigate(
4591
4540
  navigationPage.page,
4592
4541
  navigationPage.subtab
4593
4542
  );
4594
- } else {
4595
- console.log(
4596
- "[DEBUG] Condition failed - onNavigate:",
4597
- !!onNavigate,
4598
- "navigationPage.page:",
4599
- navigationPage.page
4600
- );
4601
4543
  }
4602
4544
  },
4603
4545
  className: "flex items-center gap-2 text-xs text-gray-500 hover:text-gray-700 transition-colors group cursor-pointer",
@@ -4877,7 +4819,8 @@ function ChatPanelWithToggle({
4877
4819
  supabaseAnonKey,
4878
4820
  initialCorner,
4879
4821
  onCornerChange,
4880
- productBackendUrl
4822
+ productBackendUrl,
4823
+ getAuthHeaders
4881
4824
  }) {
4882
4825
  const [internalIsOpen, setInternalIsOpen] = React6.useState(defaultOpen);
4883
4826
  const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
@@ -4907,7 +4850,8 @@ function ChatPanelWithToggle({
4907
4850
  supabaseAnonKey,
4908
4851
  initialCorner,
4909
4852
  onCornerChange,
4910
- productBackendUrl
4853
+ productBackendUrl,
4854
+ getAuthHeaders
4911
4855
  }
4912
4856
  );
4913
4857
  }
@@ -4979,7 +4923,8 @@ function KiteChatWrapper({
4979
4923
  userEmail: config.userEmail,
4980
4924
  supabaseUrl: config.supabaseUrl,
4981
4925
  supabaseAnonKey: config.supabaseAnonKey,
4982
- productBackendUrl: config.productBackendUrl
4926
+ productBackendUrl: config.productBackendUrl,
4927
+ getAuthHeaders: config.getAuthHeaders
4983
4928
  }
4984
4929
  );
4985
4930
  }
@@ -5022,7 +4967,6 @@ function createKiteChat(config) {
5022
4967
  }
5023
4968
  )
5024
4969
  );
5025
- console.log("[KiteChat] Mounted");
5026
4970
  },
5027
4971
  unmount() {
5028
4972
  if (!root) {
@@ -5034,7 +4978,6 @@ function createKiteChat(config) {
5034
4978
  containerElement = null;
5035
4979
  configUpdater = null;
5036
4980
  stateUpdaters = null;
5037
- console.log("[KiteChat] Unmounted");
5038
4981
  },
5039
4982
  open() {
5040
4983
  stateUpdaters?.setIsOpen(true);
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { i as ActionData, A as ActionType, C as ChatPanel, d as ChatPanelProps, b as ChatPanelWithToggle, e as ChatPanelWithToggleProps, H as HelpButton, g as HelpButtonProps, K as KiteChatConfig, a as KiteChatInstance, N as NavigationTarget, h as Page, k as PanelCorner, P as PanelToggle, f as PanelToggleProps, S as SettingsTab, j as StartingQuestion, c as createKiteChat } from './createKiteChat-e6BnJS6T.cjs';
1
+ export { i as ActionData, A as ActionType, C as ChatPanel, d as ChatPanelProps, b as ChatPanelWithToggle, e as ChatPanelWithToggleProps, H as HelpButton, g as HelpButtonProps, K as KiteChatConfig, a as KiteChatInstance, N as NavigationTarget, h as Page, k as PanelCorner, P as PanelToggle, f as PanelToggleProps, S as SettingsTab, j as StartingQuestion, c as createKiteChat } from './createKiteChat-DeQKgFyx.cjs';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import * as class_variance_authority_types from 'class-variance-authority/types';
4
4
  import * as React from 'react';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { i as ActionData, A as ActionType, C as ChatPanel, d as ChatPanelProps, b as ChatPanelWithToggle, e as ChatPanelWithToggleProps, H as HelpButton, g as HelpButtonProps, K as KiteChatConfig, a as KiteChatInstance, N as NavigationTarget, h as Page, k as PanelCorner, P as PanelToggle, f as PanelToggleProps, S as SettingsTab, j as StartingQuestion, c as createKiteChat } from './createKiteChat-e6BnJS6T.js';
1
+ export { i as ActionData, A as ActionType, C as ChatPanel, d as ChatPanelProps, b as ChatPanelWithToggle, e as ChatPanelWithToggleProps, H as HelpButton, g as HelpButtonProps, K as KiteChatConfig, a as KiteChatInstance, N as NavigationTarget, h as Page, k as PanelCorner, P as PanelToggle, f as PanelToggleProps, S as SettingsTab, j as StartingQuestion, c as createKiteChat } from './createKiteChat-DeQKgFyx.js';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import * as class_variance_authority_types from 'class-variance-authority/types';
4
4
  import * as React from 'react';
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ import {
31
31
  cn,
32
32
  createKiteChat,
33
33
  useGuideCursor
34
- } from "./chunk-YZXB3LLU.js";
34
+ } from "./chunk-BLSVIF7H.js";
35
35
  export {
36
36
  ApiKeyList,
37
37
  AssistantActivity,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kite-copilot/chat-panel",
3
- "version": "0.2.49",
3
+ "version": "0.2.50",
4
4
  "description": "AI-powered chat panel SDK with programmatic lifecycle control",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",