@kite-copilot/chat-panel 0.2.42 → 0.2.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/auto.cjs CHANGED
@@ -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 React5 = __toESM(require("react"), 1);
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
@@ -349,9 +349,13 @@ function useUserAuth({
349
349
  const lastSessionIdRef = React4.useRef(null);
350
350
  const fetchUser = React4.useCallback(async () => {
351
351
  if (!productBackendUrl || !enabled) {
352
+ console.log("[useUserAuth] Skipping auth - productBackendUrl:", productBackendUrl, "enabled:", enabled);
352
353
  setAuthState({ status: "idle" });
353
354
  return;
354
355
  }
356
+ console.log("[useUserAuth] Starting auth request to product backend...");
357
+ console.log("[useUserAuth] Product backend URL:", productBackendUrl);
358
+ console.log("[useUserAuth] Full request URL:", `${productBackendUrl}/users/me`);
355
359
  setAuthState({ status: "loading" });
356
360
  try {
357
361
  const response = await fetch(`${productBackendUrl}/users/me`, {
@@ -362,7 +366,9 @@ function useUserAuth({
362
366
  "Accept": "application/json"
363
367
  }
364
368
  });
369
+ console.log("[useUserAuth] Response received - status:", response.status, "ok:", response.ok);
365
370
  if (!response.ok) {
371
+ console.log("[useUserAuth] Auth request failed with status:", response.status);
366
372
  if (response.status === 401) {
367
373
  throw new Error("Please log in to use the chat assistant.");
368
374
  }
@@ -372,8 +378,17 @@ function useUserAuth({
372
378
  throw new Error(`Authentication failed (${response.status})`);
373
379
  }
374
380
  const user = await response.json();
381
+ console.log("[useUserAuth] Auth SUCCESS - parsed user data:");
382
+ console.log("[useUserAuth] id:", user.id);
383
+ console.log("[useUserAuth] email:", user.email);
384
+ console.log("[useUserAuth] name:", user.name);
385
+ console.log("[useUserAuth] role:", user.role);
386
+ console.log("[useUserAuth] isInternal:", user.isInternal);
387
+ console.log("[useUserAuth] agreementsSigned:", user.agreementsSigned);
388
+ console.log("[useUserAuth] lastLoginTime:", user.lastLoginTime);
375
389
  setAuthState({ status: "authenticated", user });
376
390
  } catch (error) {
391
+ console.log("[useUserAuth] Auth ERROR:", error);
377
392
  const message = error instanceof Error ? error.message : "Unable to verify your identity. Please try again.";
378
393
  setAuthState({ status: "error", error: message });
379
394
  }
@@ -390,6 +405,47 @@ function useUserAuth({
390
405
  return { authState, retry };
391
406
  }
392
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
+
393
449
  // src/components/ui/card.tsx
394
450
  var import_jsx_runtime7 = require("react/jsx-runtime");
395
451
  function Card({ className, ...props }) {
@@ -967,7 +1023,7 @@ function TypingIndicator({ className = "" }) {
967
1023
 
968
1024
  // src/ChatPanel.tsx
969
1025
  var import_jsx_runtime10 = require("react/jsx-runtime");
970
- var CHAT_PANEL_VERSION = true ? "0.2.42" : "dev";
1026
+ var CHAT_PANEL_VERSION = true ? "0.2.44" : "dev";
971
1027
  var DEFAULT_AGENT_URL = "http://localhost:5002";
972
1028
  var PANEL_WIDTH = 340;
973
1029
  function unescapeJsonString(str) {
@@ -1431,16 +1487,18 @@ function ChatPanel({
1431
1487
  supabaseAnonKey,
1432
1488
  productBackendUrl
1433
1489
  } = {}) {
1434
- const [messages, setMessages] = React5.useState(initialMessages);
1435
- const [input, setInput] = React5.useState("");
1436
- const [sessionId, setSessionId] = React5.useState(() => crypto.randomUUID());
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;
1437
1495
  const { authState, retry: retryAuth } = useUserAuth({
1438
- productBackendUrl,
1496
+ productBackendUrl: effectiveProductBackendUrl,
1439
1497
  sessionId,
1440
- enabled: !!productBackendUrl
1441
- // Only enable if URL is provided
1498
+ enabled: !!effectiveProductBackendUrl && orgConfigState.status === "success"
1499
+ // Only enable after config is fetched
1442
1500
  });
1443
- const effectiveUser = React5.useMemo(() => {
1501
+ const effectiveUser = React6.useMemo(() => {
1444
1502
  if (authState.status === "authenticated") {
1445
1503
  return {
1446
1504
  userId: authState.user.id,
@@ -1458,16 +1516,16 @@ function ChatPanel({
1458
1516
  isInternal: false
1459
1517
  };
1460
1518
  }, [authState, userId, userName, userEmail]);
1461
- const [isEscalated, setIsEscalated] = React5.useState(false);
1462
- const escalationWsRef = React5.useRef(null);
1463
- const [agentIsTyping, setAgentIsTyping] = React5.useState(false);
1464
- const supabaseRef = React5.useRef(null);
1465
- const typingChannelRef = React5.useRef(null);
1466
- const typingTimeoutRef = React5.useRef(null);
1467
- React5.useEffect(() => {
1519
+ const [isEscalated, setIsEscalated] = React6.useState(false);
1520
+ const escalationWsRef = React6.useRef(null);
1521
+ const [agentIsTyping, setAgentIsTyping] = React6.useState(false);
1522
+ const supabaseRef = React6.useRef(null);
1523
+ const typingChannelRef = React6.useRef(null);
1524
+ const typingTimeoutRef = React6.useRef(null);
1525
+ React6.useEffect(() => {
1468
1526
  console.log(`[KiteChat] Chat Panel v${CHAT_PANEL_VERSION} loaded`);
1469
1527
  }, []);
1470
- const resetSession = React5.useCallback(() => {
1528
+ const resetSession = React6.useCallback(() => {
1471
1529
  console.log("[KiteChat] resetSession called", { isEscalated, hasSupabase: !!supabaseRef.current, sessionId });
1472
1530
  if (isEscalated && supabaseRef.current && sessionId) {
1473
1531
  console.log("[KiteChat] Updating customer_status to disconnected for session:", sessionId);
@@ -1497,12 +1555,12 @@ function ChatPanel({
1497
1555
  typingChannelRef.current = null;
1498
1556
  }
1499
1557
  }, [isEscalated, sessionId]);
1500
- React5.useEffect(() => {
1558
+ React6.useEffect(() => {
1501
1559
  if (supabaseUrl && supabaseAnonKey && !supabaseRef.current) {
1502
1560
  supabaseRef.current = (0, import_supabase_js.createClient)(supabaseUrl, supabaseAnonKey);
1503
1561
  }
1504
1562
  }, [supabaseUrl, supabaseAnonKey]);
1505
- React5.useEffect(() => {
1563
+ React6.useEffect(() => {
1506
1564
  if (!isEscalated || !sessionId || !supabaseRef.current) {
1507
1565
  return;
1508
1566
  }
@@ -1539,8 +1597,8 @@ function ChatPanel({
1539
1597
  }
1540
1598
  };
1541
1599
  }, [isEscalated, sessionId]);
1542
- const heartbeatIntervalRef = React5.useRef(null);
1543
- const updateCustomerStatus = React5.useCallback(async (status) => {
1600
+ const heartbeatIntervalRef = React6.useRef(null);
1601
+ const updateCustomerStatus = React6.useCallback(async (status) => {
1544
1602
  if (!supabaseRef.current || !sessionId) return;
1545
1603
  try {
1546
1604
  await supabaseRef.current.from("escalations").update({
@@ -1551,7 +1609,7 @@ function ChatPanel({
1551
1609
  console.error("[KiteChat] Failed to update customer status:", err);
1552
1610
  }
1553
1611
  }, [sessionId]);
1554
- React5.useEffect(() => {
1612
+ React6.useEffect(() => {
1555
1613
  if (!isEscalated || !sessionId || !supabaseRef.current) {
1556
1614
  return;
1557
1615
  }
@@ -1599,7 +1657,7 @@ function ChatPanel({
1599
1657
  }
1600
1658
  };
1601
1659
  }, [isEscalated, sessionId, updateCustomerStatus]);
1602
- const sendTypingIndicator = React5.useCallback((isTyping) => {
1660
+ const sendTypingIndicator = React6.useCallback((isTyping) => {
1603
1661
  if (!typingChannelRef.current) {
1604
1662
  console.log("[KiteChat] Cannot send typing - channel not ready");
1605
1663
  return;
@@ -1615,8 +1673,8 @@ function ChatPanel({
1615
1673
  payload: { sender: "user", isTyping }
1616
1674
  });
1617
1675
  }, [isEscalated]);
1618
- const userTypingTimeoutRef = React5.useRef(null);
1619
- const handleTypingStart = React5.useCallback(() => {
1676
+ const userTypingTimeoutRef = React6.useRef(null);
1677
+ const handleTypingStart = React6.useCallback(() => {
1620
1678
  if (!isEscalated || !supabaseRef.current) return;
1621
1679
  sendTypingIndicator(true);
1622
1680
  updateCustomerStatus("active");
@@ -1627,19 +1685,19 @@ function ChatPanel({
1627
1685
  sendTypingIndicator(false);
1628
1686
  }, 1500);
1629
1687
  }, [isEscalated, sendTypingIndicator, updateCustomerStatus]);
1630
- const streamIntervals = React5.useRef({});
1688
+ const streamIntervals = React6.useRef({});
1631
1689
  const isEmpty = messages.length === 0;
1632
- const [phase, setPhase] = React5.useState("idle");
1633
- const [progressSteps, setProgressSteps] = React5.useState([]);
1634
- const phaseTimers = React5.useRef([]);
1690
+ const [phase, setPhase] = React6.useState("idle");
1691
+ const [progressSteps, setProgressSteps] = React6.useState([]);
1692
+ const phaseTimers = React6.useRef([]);
1635
1693
  const lastRole = messages.length ? messages[messages.length - 1].role : void 0;
1636
- const [panelView, setPanelView] = React5.useState(
1694
+ const [panelView, setPanelView] = React6.useState(
1637
1695
  "landing"
1638
1696
  );
1639
- const [currentFolderId, setCurrentFolderId] = React5.useState(void 0);
1640
- const [startingQuestions, setStartingQuestions] = React5.useState(startingQuestionsProp || defaultStartingQuestions);
1641
- const [loadingQuestions, setLoadingQuestions] = React5.useState(false);
1642
- React5.useEffect(() => {
1697
+ const [currentFolderId, setCurrentFolderId] = React6.useState(void 0);
1698
+ const [startingQuestions, setStartingQuestions] = React6.useState(startingQuestionsProp || defaultStartingQuestions);
1699
+ const [loadingQuestions, setLoadingQuestions] = React6.useState(false);
1700
+ React6.useEffect(() => {
1643
1701
  if (startingQuestionsEndpoint && !startingQuestionsProp) {
1644
1702
  setLoadingQuestions(true);
1645
1703
  fetch(startingQuestionsEndpoint).then((res) => res.json()).then((data) => {
@@ -1651,16 +1709,16 @@ function ChatPanel({
1651
1709
  }).finally(() => setLoadingQuestions(false));
1652
1710
  }
1653
1711
  }, [startingQuestionsEndpoint, startingQuestionsProp]);
1654
- React5.useEffect(() => {
1712
+ React6.useEffect(() => {
1655
1713
  if (startingQuestionsProp) {
1656
1714
  setStartingQuestions(startingQuestionsProp);
1657
1715
  }
1658
1716
  }, [startingQuestionsProp]);
1659
- const [activeGuide, setActiveGuide] = React5.useState(void 0);
1660
- const activeGuideRef = React5.useRef(void 0);
1661
- const latestBulkSummaryNavigationRef = React5.useRef(null);
1662
- const [guideComplete, setGuideComplete] = React5.useState(false);
1663
- React5.useEffect(() => {
1717
+ const [activeGuide, setActiveGuide] = React6.useState(void 0);
1718
+ const activeGuideRef = React6.useRef(void 0);
1719
+ const latestBulkSummaryNavigationRef = React6.useRef(null);
1720
+ const [guideComplete, setGuideComplete] = React6.useState(false);
1721
+ React6.useEffect(() => {
1664
1722
  window.resetIntegrationNotification = () => {
1665
1723
  localStorage.removeItem("gmailNotificationSeen");
1666
1724
  console.log(
@@ -1694,7 +1752,7 @@ function ChatPanel({
1694
1752
  );
1695
1753
  };
1696
1754
  }, []);
1697
- React5.useEffect(() => {
1755
+ React6.useEffect(() => {
1698
1756
  if (activeGuide) {
1699
1757
  if (!activeGuideRef.current || activeGuideRef.current.id !== activeGuide.id || activeGuideRef.current.stepIndex !== activeGuide.stepIndex) {
1700
1758
  activeGuideRef.current = activeGuide;
@@ -1703,21 +1761,21 @@ function ChatPanel({
1703
1761
  activeGuideRef.current = void 0;
1704
1762
  }
1705
1763
  }, [activeGuide]);
1706
- const [pendingNavigation, setPendingNavigation] = React5.useState(null);
1707
- const [pendingAction, setPendingAction] = React5.useState(null);
1708
- const [actionFormData, setActionFormData] = React5.useState({});
1709
- const messagesEndRef = React5.useRef(null);
1710
- const messagesContainerRef = React5.useRef(null);
1711
- const currentStepRef = React5.useRef(null);
1764
+ const [pendingNavigation, setPendingNavigation] = React6.useState(null);
1765
+ const [pendingAction, setPendingAction] = React6.useState(null);
1766
+ const [actionFormData, setActionFormData] = React6.useState({});
1767
+ const messagesEndRef = React6.useRef(null);
1768
+ const messagesContainerRef = React6.useRef(null);
1769
+ const currentStepRef = React6.useRef(null);
1712
1770
  const { cursorState, moveTo, hide } = useGuideCursor();
1713
- const [pendingFile, setPendingFile] = React5.useState(null);
1714
- const [pendingBulkSession, setPendingBulkSession] = React5.useState(null);
1715
- const pendingBulkSessionRef = React5.useRef(null);
1716
- const fileInputRef = React5.useRef(null);
1717
- const [searchExpanded, setSearchExpanded] = React5.useState(false);
1718
- const [searchInput, setSearchInput] = React5.useState("");
1719
- const searchInputRef = React5.useRef(null);
1720
- React5.useEffect(() => {
1771
+ const [pendingFile, setPendingFile] = React6.useState(null);
1772
+ const [pendingBulkSession, setPendingBulkSession] = React6.useState(null);
1773
+ const pendingBulkSessionRef = React6.useRef(null);
1774
+ const fileInputRef = React6.useRef(null);
1775
+ const [searchExpanded, setSearchExpanded] = React6.useState(false);
1776
+ const [searchInput, setSearchInput] = React6.useState("");
1777
+ const searchInputRef = React6.useRef(null);
1778
+ React6.useEffect(() => {
1721
1779
  if (!activeGuide || activeGuide.id !== "add-api-key" || activeGuide.stepIndex !== 2) {
1722
1780
  return;
1723
1781
  }
@@ -1743,7 +1801,7 @@ function ChatPanel({
1743
1801
  const interval = setInterval(checkForDialogOpen, 300);
1744
1802
  return () => clearInterval(interval);
1745
1803
  }, [activeGuide, hide]);
1746
- React5.useEffect(() => {
1804
+ React6.useEffect(() => {
1747
1805
  return () => {
1748
1806
  Object.values(streamIntervals.current).forEach(
1749
1807
  (id) => window.clearInterval(id)
@@ -1753,7 +1811,7 @@ function ChatPanel({
1753
1811
  phaseTimers.current = [];
1754
1812
  };
1755
1813
  }, []);
1756
- React5.useEffect(() => {
1814
+ React6.useEffect(() => {
1757
1815
  if (activeGuide && messages.length > 0) {
1758
1816
  const lastMessage = messages[messages.length - 1];
1759
1817
  if (lastMessage.kind === "guideStep" || lastMessage.kind === "guideComplete") {
@@ -1770,7 +1828,7 @@ function ChatPanel({
1770
1828
  messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
1771
1829
  }
1772
1830
  }, [messages, phase, activeGuide]);
1773
- const latestBulkSummaryNavigation = React5.useMemo(() => {
1831
+ const latestBulkSummaryNavigation = React6.useMemo(() => {
1774
1832
  for (let i = messages.length - 1; i >= 0; i--) {
1775
1833
  const msg = messages[i];
1776
1834
  if (msg.kind === "bulkSummary" && msg.bulkSummary?.navigationPage && msg.bulkSummary.successes > 0) {
@@ -1779,13 +1837,13 @@ function ChatPanel({
1779
1837
  }
1780
1838
  return null;
1781
1839
  }, [messages]);
1782
- React5.useEffect(() => {
1840
+ React6.useEffect(() => {
1783
1841
  latestBulkSummaryNavigationRef.current = latestBulkSummaryNavigation;
1784
1842
  }, [latestBulkSummaryNavigation]);
1785
- React5.useEffect(() => {
1843
+ React6.useEffect(() => {
1786
1844
  pendingBulkSessionRef.current = pendingBulkSession;
1787
1845
  }, [pendingBulkSession]);
1788
- React5.useEffect(() => {
1846
+ React6.useEffect(() => {
1789
1847
  const handleKeyDown = (e) => {
1790
1848
  if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
1791
1849
  const currentBulkSession = pendingBulkSessionRef.current;
@@ -1848,7 +1906,7 @@ function ChatPanel({
1848
1906
  guideComplete,
1849
1907
  onNavigate
1850
1908
  ]);
1851
- const connectToEscalationWs = React5.useCallback((currentSessionId) => {
1909
+ const connectToEscalationWs = React6.useCallback((currentSessionId) => {
1852
1910
  if (!agentUrl) return;
1853
1911
  if (escalationWsRef.current) {
1854
1912
  escalationWsRef.current.close();
@@ -1891,7 +1949,7 @@ function ChatPanel({
1891
1949
  };
1892
1950
  escalationWsRef.current = ws;
1893
1951
  }, [agentUrl]);
1894
- const sendEscalatedMessage = React5.useCallback(async (content) => {
1952
+ const sendEscalatedMessage = React6.useCallback(async (content) => {
1895
1953
  if (!escalationWsRef.current || escalationWsRef.current.readyState !== WebSocket.OPEN) {
1896
1954
  console.error("[KiteChat] Escalation WebSocket not connected");
1897
1955
  return false;
@@ -1908,14 +1966,14 @@ function ChatPanel({
1908
1966
  return false;
1909
1967
  }
1910
1968
  }, [updateCustomerStatus]);
1911
- React5.useEffect(() => {
1969
+ React6.useEffect(() => {
1912
1970
  return () => {
1913
1971
  if (escalationWsRef.current) {
1914
1972
  escalationWsRef.current.close();
1915
1973
  }
1916
1974
  };
1917
1975
  }, []);
1918
- React5.useEffect(() => {
1976
+ React6.useEffect(() => {
1919
1977
  if (isEscalated && sessionId) {
1920
1978
  connectToEscalationWs(sessionId);
1921
1979
  }
@@ -2181,6 +2239,15 @@ function ChatPanel({
2181
2239
  try {
2182
2240
  const controller = new AbortController();
2183
2241
  const timeoutId = setTimeout(() => controller.abort(), 6e4);
2242
+ console.log("[ChatPanel] Sending chat request to agent backend...");
2243
+ console.log("[ChatPanel] Agent URL:", agentUrl);
2244
+ console.log("[ChatPanel] User data being sent:");
2245
+ console.log("[ChatPanel] user_id:", effectiveUser.userId);
2246
+ console.log("[ChatPanel] user_name:", effectiveUser.userName);
2247
+ console.log("[ChatPanel] user_email:", effectiveUser.userEmail);
2248
+ console.log("[ChatPanel] user_organization:", userOrganization);
2249
+ console.log("[ChatPanel] org_id:", orgId);
2250
+ console.log("[ChatPanel] authState.status:", authState.status);
2184
2251
  const response = await fetch(`${agentUrl}/chat/stream`, {
2185
2252
  method: "POST",
2186
2253
  headers: {
@@ -3135,7 +3202,38 @@ ${userText}`
3135
3202
  ] })
3136
3203
  ] }) }) });
3137
3204
  }
3138
- if (productBackendUrl) {
3205
+ if (orgConfigState.status === "loading") {
3206
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3207
+ "section",
3208
+ {
3209
+ 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"}`,
3210
+ style: { width: `${PANEL_WIDTH}px` },
3211
+ children: [
3212
+ /* @__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: [
3213
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2.5", children: [
3214
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Sparkles, { className: "h-3.5 w-3.5 text-black", fill: "currentColor" }),
3215
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { className: "text-sm font-semibold text-gray-800", children: "Copilot" })
3216
+ ] }),
3217
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3218
+ Button,
3219
+ {
3220
+ variant: "ghost",
3221
+ size: "sm",
3222
+ className: "h-7 w-7 p-0 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-full",
3223
+ onClick: () => onClose?.(),
3224
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-4 w-4" })
3225
+ }
3226
+ )
3227
+ ] }),
3228
+ /* @__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: [
3229
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Loader2, { className: "h-8 w-8 animate-spin text-gray-400 mx-auto mb-3" }),
3230
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-sm text-gray-500", children: "Loading..." })
3231
+ ] }) })
3232
+ ]
3233
+ }
3234
+ );
3235
+ }
3236
+ if (effectiveProductBackendUrl) {
3139
3237
  if (authState.status === "loading") {
3140
3238
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3141
3239
  "section",
@@ -4310,7 +4408,7 @@ ${userText}`
4310
4408
  message.id
4311
4409
  );
4312
4410
  }
4313
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(React5.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4411
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(React6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4314
4412
  "div",
4315
4413
  {
4316
4414
  ref: isCurrentGuideStep ? currentStepRef : null,
@@ -4547,7 +4645,7 @@ function ChatPanelWithToggle({
4547
4645
  supabaseAnonKey,
4548
4646
  productBackendUrl
4549
4647
  }) {
4550
- const [internalIsOpen, setInternalIsOpen] = React5.useState(defaultOpen);
4648
+ const [internalIsOpen, setInternalIsOpen] = React6.useState(defaultOpen);
4551
4649
  const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
4552
4650
  const setIsOpen = (open) => {
4553
4651
  if (controlledIsOpen === void 0) {
@@ -4555,7 +4653,7 @@ function ChatPanelWithToggle({
4555
4653
  }
4556
4654
  onOpenChange?.(open);
4557
4655
  };
4558
- React5.useEffect(() => {
4656
+ React6.useEffect(() => {
4559
4657
  const originalPadding = document.body.style.paddingRight;
4560
4658
  const originalTransition = document.body.style.transition;
4561
4659
  document.body.style.transition = "padding-right 0.3s ease";
package/dist/auto.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createKiteChat
3
- } from "./chunk-XP6Y7EP7.js";
3
+ } from "./chunk-G74XTXWW.js";
4
4
 
5
5
  // src/auto.ts
6
6
  function mountKiteChat(config) {