@kite-copilot/chat-panel 0.2.47 → 0.2.48
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 +24 -3
- package/dist/auto.js +1 -1
- package/dist/{chunk-XMIO4GMW.js → chunk-LOTJ3U5L.js} +24 -3
- package/dist/embed.global.js +23 -58
- package/dist/index.cjs +24 -3
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1078,7 +1078,7 @@ function TypingIndicator({ className = "" }) {
|
|
|
1078
1078
|
|
|
1079
1079
|
// src/ChatPanel.tsx
|
|
1080
1080
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1081
|
-
var CHAT_PANEL_VERSION = true ? "0.2.
|
|
1081
|
+
var CHAT_PANEL_VERSION = true ? "0.2.48" : "dev";
|
|
1082
1082
|
var DEFAULT_AGENT_URL = "http://localhost:5002";
|
|
1083
1083
|
var PANEL_WIDTH = 400;
|
|
1084
1084
|
var PANEL_HEIGHT = 600;
|
|
@@ -1561,6 +1561,7 @@ function ChatPanel({
|
|
|
1561
1561
|
}
|
|
1562
1562
|
}, [corner, onCornerChange, dragControls]);
|
|
1563
1563
|
const [sessionId, setSessionId] = React6.useState(() => crypto.randomUUID());
|
|
1564
|
+
const [sessionUser, setSessionUser] = React6.useState(null);
|
|
1564
1565
|
const orgConfigState = useOrgConfig({ agentUrl, orgId: orgId || "" });
|
|
1565
1566
|
const effectiveProductBackendUrl = orgConfigState.config?.productBackendUrl || productBackendUrl;
|
|
1566
1567
|
const { authState, retry: retryAuth } = useUserAuth({
|
|
@@ -1601,6 +1602,9 @@ function ChatPanel({
|
|
|
1601
1602
|
testProductBackendEndpoint();
|
|
1602
1603
|
}, [effectiveProductBackendUrl, orgConfigState.status]);
|
|
1603
1604
|
const effectiveUser = React6.useMemo(() => {
|
|
1605
|
+
if (sessionUser) {
|
|
1606
|
+
return sessionUser;
|
|
1607
|
+
}
|
|
1604
1608
|
if (authState.status === "authenticated") {
|
|
1605
1609
|
return {
|
|
1606
1610
|
userId: authState.user.id,
|
|
@@ -1617,7 +1621,23 @@ function ChatPanel({
|
|
|
1617
1621
|
userRole: void 0,
|
|
1618
1622
|
isInternal: false
|
|
1619
1623
|
};
|
|
1620
|
-
}, [authState, userId, userName, userEmail]);
|
|
1624
|
+
}, [sessionUser, authState, userId, userName, userEmail]);
|
|
1625
|
+
React6.useEffect(() => {
|
|
1626
|
+
if (authState.status === "authenticated" && sessionUser === null) {
|
|
1627
|
+
setSessionUser({
|
|
1628
|
+
userId: authState.user.id,
|
|
1629
|
+
userName: authState.user.name,
|
|
1630
|
+
userEmail: authState.user.email,
|
|
1631
|
+
userRole: authState.user.role,
|
|
1632
|
+
isInternal: authState.user.isInternal
|
|
1633
|
+
});
|
|
1634
|
+
console.log("[ChatPanel] Session user captured:", authState.user.id);
|
|
1635
|
+
}
|
|
1636
|
+
}, [authState, sessionUser]);
|
|
1637
|
+
const isWaitingForAuth = React6.useMemo(() => {
|
|
1638
|
+
if (!effectiveProductBackendUrl) return false;
|
|
1639
|
+
return authState.status === "loading" || authState.status === "idle";
|
|
1640
|
+
}, [effectiveProductBackendUrl, authState.status]);
|
|
1621
1641
|
const [isEscalated, setIsEscalated] = React6.useState(false);
|
|
1622
1642
|
const escalationWsRef = React6.useRef(null);
|
|
1623
1643
|
const [agentIsTyping, setAgentIsTyping] = React6.useState(false);
|
|
@@ -1645,6 +1665,7 @@ function ChatPanel({
|
|
|
1645
1665
|
} else {
|
|
1646
1666
|
console.log("[KiteChat] Skipping disconnect update - conditions not met");
|
|
1647
1667
|
}
|
|
1668
|
+
setSessionUser(null);
|
|
1648
1669
|
setSessionId(crypto.randomUUID());
|
|
1649
1670
|
setIsEscalated(false);
|
|
1650
1671
|
if (escalationWsRef.current) {
|
|
@@ -4714,7 +4735,7 @@ ${userText}`
|
|
|
4714
4735
|
{
|
|
4715
4736
|
type: "submit",
|
|
4716
4737
|
size: "icon",
|
|
4717
|
-
disabled: !input.trim() && !pendingFile,
|
|
4738
|
+
disabled: !input.trim() && !pendingFile || isWaitingForAuth,
|
|
4718
4739
|
className: "h-6 w-6 rounded-full bg-gray-900 hover:bg-gray-800 disabled:bg-gray-300",
|
|
4719
4740
|
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowUp, { className: "h-2.5 w-2.5" })
|
|
4720
4741
|
}
|
package/dist/index.js
CHANGED