@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/auto.cjs
CHANGED
|
@@ -1024,7 +1024,7 @@ function TypingIndicator({ className = "" }) {
|
|
|
1024
1024
|
|
|
1025
1025
|
// src/ChatPanel.tsx
|
|
1026
1026
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1027
|
-
var CHAT_PANEL_VERSION = true ? "0.2.
|
|
1027
|
+
var CHAT_PANEL_VERSION = true ? "0.2.48" : "dev";
|
|
1028
1028
|
var DEFAULT_AGENT_URL = "http://localhost:5002";
|
|
1029
1029
|
var PANEL_WIDTH = 400;
|
|
1030
1030
|
var PANEL_HEIGHT = 600;
|
|
@@ -1507,6 +1507,7 @@ function ChatPanel({
|
|
|
1507
1507
|
}
|
|
1508
1508
|
}, [corner, onCornerChange, dragControls]);
|
|
1509
1509
|
const [sessionId, setSessionId] = React6.useState(() => crypto.randomUUID());
|
|
1510
|
+
const [sessionUser, setSessionUser] = React6.useState(null);
|
|
1510
1511
|
const orgConfigState = useOrgConfig({ agentUrl, orgId: orgId || "" });
|
|
1511
1512
|
const effectiveProductBackendUrl = orgConfigState.config?.productBackendUrl || productBackendUrl;
|
|
1512
1513
|
const { authState, retry: retryAuth } = useUserAuth({
|
|
@@ -1547,6 +1548,9 @@ function ChatPanel({
|
|
|
1547
1548
|
testProductBackendEndpoint();
|
|
1548
1549
|
}, [effectiveProductBackendUrl, orgConfigState.status]);
|
|
1549
1550
|
const effectiveUser = React6.useMemo(() => {
|
|
1551
|
+
if (sessionUser) {
|
|
1552
|
+
return sessionUser;
|
|
1553
|
+
}
|
|
1550
1554
|
if (authState.status === "authenticated") {
|
|
1551
1555
|
return {
|
|
1552
1556
|
userId: authState.user.id,
|
|
@@ -1563,7 +1567,23 @@ function ChatPanel({
|
|
|
1563
1567
|
userRole: void 0,
|
|
1564
1568
|
isInternal: false
|
|
1565
1569
|
};
|
|
1566
|
-
}, [authState, userId, userName, userEmail]);
|
|
1570
|
+
}, [sessionUser, authState, userId, userName, userEmail]);
|
|
1571
|
+
React6.useEffect(() => {
|
|
1572
|
+
if (authState.status === "authenticated" && sessionUser === null) {
|
|
1573
|
+
setSessionUser({
|
|
1574
|
+
userId: authState.user.id,
|
|
1575
|
+
userName: authState.user.name,
|
|
1576
|
+
userEmail: authState.user.email,
|
|
1577
|
+
userRole: authState.user.role,
|
|
1578
|
+
isInternal: authState.user.isInternal
|
|
1579
|
+
});
|
|
1580
|
+
console.log("[ChatPanel] Session user captured:", authState.user.id);
|
|
1581
|
+
}
|
|
1582
|
+
}, [authState, sessionUser]);
|
|
1583
|
+
const isWaitingForAuth = React6.useMemo(() => {
|
|
1584
|
+
if (!effectiveProductBackendUrl) return false;
|
|
1585
|
+
return authState.status === "loading" || authState.status === "idle";
|
|
1586
|
+
}, [effectiveProductBackendUrl, authState.status]);
|
|
1567
1587
|
const [isEscalated, setIsEscalated] = React6.useState(false);
|
|
1568
1588
|
const escalationWsRef = React6.useRef(null);
|
|
1569
1589
|
const [agentIsTyping, setAgentIsTyping] = React6.useState(false);
|
|
@@ -1591,6 +1611,7 @@ function ChatPanel({
|
|
|
1591
1611
|
} else {
|
|
1592
1612
|
console.log("[KiteChat] Skipping disconnect update - conditions not met");
|
|
1593
1613
|
}
|
|
1614
|
+
setSessionUser(null);
|
|
1594
1615
|
setSessionId(crypto.randomUUID());
|
|
1595
1616
|
setIsEscalated(false);
|
|
1596
1617
|
if (escalationWsRef.current) {
|
|
@@ -4660,7 +4681,7 @@ ${userText}`
|
|
|
4660
4681
|
{
|
|
4661
4682
|
type: "submit",
|
|
4662
4683
|
size: "icon",
|
|
4663
|
-
disabled: !input.trim() && !pendingFile,
|
|
4684
|
+
disabled: !input.trim() && !pendingFile || isWaitingForAuth,
|
|
4664
4685
|
className: "h-6 w-6 rounded-full bg-gray-900 hover:bg-gray-800 disabled:bg-gray-300",
|
|
4665
4686
|
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowUp, { className: "h-2.5 w-2.5" })
|
|
4666
4687
|
}
|
package/dist/auto.js
CHANGED
|
@@ -1025,7 +1025,7 @@ function TypingIndicator({ className = "" }) {
|
|
|
1025
1025
|
|
|
1026
1026
|
// src/ChatPanel.tsx
|
|
1027
1027
|
import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1028
|
-
var CHAT_PANEL_VERSION = true ? "0.2.
|
|
1028
|
+
var CHAT_PANEL_VERSION = true ? "0.2.48" : "dev";
|
|
1029
1029
|
var DEFAULT_AGENT_URL = "http://localhost:5002";
|
|
1030
1030
|
var PANEL_WIDTH = 400;
|
|
1031
1031
|
var PANEL_HEIGHT = 600;
|
|
@@ -1508,6 +1508,7 @@ function ChatPanel({
|
|
|
1508
1508
|
}
|
|
1509
1509
|
}, [corner, onCornerChange, dragControls]);
|
|
1510
1510
|
const [sessionId, setSessionId] = React6.useState(() => crypto.randomUUID());
|
|
1511
|
+
const [sessionUser, setSessionUser] = React6.useState(null);
|
|
1511
1512
|
const orgConfigState = useOrgConfig({ agentUrl, orgId: orgId || "" });
|
|
1512
1513
|
const effectiveProductBackendUrl = orgConfigState.config?.productBackendUrl || productBackendUrl;
|
|
1513
1514
|
const { authState, retry: retryAuth } = useUserAuth({
|
|
@@ -1548,6 +1549,9 @@ function ChatPanel({
|
|
|
1548
1549
|
testProductBackendEndpoint();
|
|
1549
1550
|
}, [effectiveProductBackendUrl, orgConfigState.status]);
|
|
1550
1551
|
const effectiveUser = React6.useMemo(() => {
|
|
1552
|
+
if (sessionUser) {
|
|
1553
|
+
return sessionUser;
|
|
1554
|
+
}
|
|
1551
1555
|
if (authState.status === "authenticated") {
|
|
1552
1556
|
return {
|
|
1553
1557
|
userId: authState.user.id,
|
|
@@ -1564,7 +1568,23 @@ function ChatPanel({
|
|
|
1564
1568
|
userRole: void 0,
|
|
1565
1569
|
isInternal: false
|
|
1566
1570
|
};
|
|
1567
|
-
}, [authState, userId, userName, userEmail]);
|
|
1571
|
+
}, [sessionUser, authState, userId, userName, userEmail]);
|
|
1572
|
+
React6.useEffect(() => {
|
|
1573
|
+
if (authState.status === "authenticated" && sessionUser === null) {
|
|
1574
|
+
setSessionUser({
|
|
1575
|
+
userId: authState.user.id,
|
|
1576
|
+
userName: authState.user.name,
|
|
1577
|
+
userEmail: authState.user.email,
|
|
1578
|
+
userRole: authState.user.role,
|
|
1579
|
+
isInternal: authState.user.isInternal
|
|
1580
|
+
});
|
|
1581
|
+
console.log("[ChatPanel] Session user captured:", authState.user.id);
|
|
1582
|
+
}
|
|
1583
|
+
}, [authState, sessionUser]);
|
|
1584
|
+
const isWaitingForAuth = React6.useMemo(() => {
|
|
1585
|
+
if (!effectiveProductBackendUrl) return false;
|
|
1586
|
+
return authState.status === "loading" || authState.status === "idle";
|
|
1587
|
+
}, [effectiveProductBackendUrl, authState.status]);
|
|
1568
1588
|
const [isEscalated, setIsEscalated] = React6.useState(false);
|
|
1569
1589
|
const escalationWsRef = React6.useRef(null);
|
|
1570
1590
|
const [agentIsTyping, setAgentIsTyping] = React6.useState(false);
|
|
@@ -1592,6 +1612,7 @@ function ChatPanel({
|
|
|
1592
1612
|
} else {
|
|
1593
1613
|
console.log("[KiteChat] Skipping disconnect update - conditions not met");
|
|
1594
1614
|
}
|
|
1615
|
+
setSessionUser(null);
|
|
1595
1616
|
setSessionId(crypto.randomUUID());
|
|
1596
1617
|
setIsEscalated(false);
|
|
1597
1618
|
if (escalationWsRef.current) {
|
|
@@ -4661,7 +4682,7 @@ ${userText}`
|
|
|
4661
4682
|
{
|
|
4662
4683
|
type: "submit",
|
|
4663
4684
|
size: "icon",
|
|
4664
|
-
disabled: !input.trim() && !pendingFile,
|
|
4685
|
+
disabled: !input.trim() && !pendingFile || isWaitingForAuth,
|
|
4665
4686
|
className: "h-6 w-6 rounded-full bg-gray-900 hover:bg-gray-800 disabled:bg-gray-300",
|
|
4666
4687
|
children: /* @__PURE__ */ jsx10(ArrowUp, { className: "h-2.5 w-2.5" })
|
|
4667
4688
|
}
|