@kite-copilot/chat-panel 0.2.21 → 0.2.23
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 +43 -137
- package/dist/auto.d.cts +1 -1
- package/dist/auto.d.ts +1 -1
- package/dist/auto.js +1 -1
- package/dist/{chunk-OQCVEXPE.js → chunk-MIJSRC3X.js} +23 -137
- package/dist/{createKiteChat-CyoN-YV4.d.cts → createKiteChat-BMLaQQQk.d.cts} +1 -3
- package/dist/{createKiteChat-CyoN-YV4.d.ts → createKiteChat-BMLaQQQk.d.ts} +1 -3
- package/dist/embed.global.js +23 -19
- package/dist/index.cjs +23 -137
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/styles.css +2 -2
- package/package.json +1 -1
package/dist/auto.cjs
CHANGED
|
@@ -888,6 +888,9 @@ function DataRenderer({ type, data }) {
|
|
|
888
888
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
889
889
|
var DEFAULT_AGENT_URL = "http://localhost:5002";
|
|
890
890
|
var PANEL_WIDTH = 340;
|
|
891
|
+
function unescapeJsonString(str) {
|
|
892
|
+
return str.replace(/\\\\n/g, "\n").replace(/\\\\t/g, " ").replace(/\\\\"/g, '"').replace(/\\\\\\\\/g, "\\").replace(/\\n/g, "\n").replace(/\\t/g, " ").replace(/\\"/g, '"').replace(/\\\\/g, "\\");
|
|
893
|
+
}
|
|
891
894
|
function renderMarkdown(text) {
|
|
892
895
|
if (!text) return null;
|
|
893
896
|
const lines = text.split("\n");
|
|
@@ -935,7 +938,7 @@ function renderMarkdown(text) {
|
|
|
935
938
|
"a",
|
|
936
939
|
{
|
|
937
940
|
href: linkMatch[2],
|
|
938
|
-
className: "
|
|
941
|
+
className: "text-blue-600 hover:underline",
|
|
939
942
|
target: "_blank",
|
|
940
943
|
rel: "noopener noreferrer",
|
|
941
944
|
children: linkMatch[1]
|
|
@@ -946,44 +949,7 @@ function renderMarkdown(text) {
|
|
|
946
949
|
remaining = remaining.slice(linkMatch[0].length);
|
|
947
950
|
continue;
|
|
948
951
|
}
|
|
949
|
-
const
|
|
950
|
-
if (urlMatch) {
|
|
951
|
-
const url = urlMatch[1];
|
|
952
|
-
const href = url.startsWith("www.") ? `https://${url}` : url;
|
|
953
|
-
parts.push(
|
|
954
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
955
|
-
"a",
|
|
956
|
-
{
|
|
957
|
-
href,
|
|
958
|
-
className: "kite-link",
|
|
959
|
-
target: "_blank",
|
|
960
|
-
rel: "noopener noreferrer",
|
|
961
|
-
children: url
|
|
962
|
-
},
|
|
963
|
-
keyIndex++
|
|
964
|
-
)
|
|
965
|
-
);
|
|
966
|
-
remaining = remaining.slice(url.length);
|
|
967
|
-
continue;
|
|
968
|
-
}
|
|
969
|
-
const emailMatch = remaining.match(/^([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/);
|
|
970
|
-
if (emailMatch) {
|
|
971
|
-
const email = emailMatch[1];
|
|
972
|
-
parts.push(
|
|
973
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
974
|
-
"a",
|
|
975
|
-
{
|
|
976
|
-
href: `mailto:${email}`,
|
|
977
|
-
className: "kite-link",
|
|
978
|
-
children: email
|
|
979
|
-
},
|
|
980
|
-
keyIndex++
|
|
981
|
-
)
|
|
982
|
-
);
|
|
983
|
-
remaining = remaining.slice(email.length);
|
|
984
|
-
continue;
|
|
985
|
-
}
|
|
986
|
-
const nextSpecial = remaining.search(/[`*\[@h]/);
|
|
952
|
+
const nextSpecial = remaining.search(/[`*\[]/);
|
|
987
953
|
if (nextSpecial === -1) {
|
|
988
954
|
parts.push(remaining);
|
|
989
955
|
break;
|
|
@@ -1303,7 +1269,6 @@ var initialMessages = [];
|
|
|
1303
1269
|
function ChatPanel({
|
|
1304
1270
|
isOpen = true,
|
|
1305
1271
|
onClose,
|
|
1306
|
-
onOpen,
|
|
1307
1272
|
onBack,
|
|
1308
1273
|
onNavigate,
|
|
1309
1274
|
onActionComplete,
|
|
@@ -1405,9 +1370,6 @@ function ChatPanel({
|
|
|
1405
1370
|
const [pendingBulkSession, setPendingBulkSession] = React4.useState(null);
|
|
1406
1371
|
const pendingBulkSessionRef = React4.useRef(null);
|
|
1407
1372
|
const fileInputRef = React4.useRef(null);
|
|
1408
|
-
const [searchExpanded, setSearchExpanded] = React4.useState(false);
|
|
1409
|
-
const [searchInput, setSearchInput] = React4.useState("");
|
|
1410
|
-
const searchInputRef = React4.useRef(null);
|
|
1411
1373
|
React4.useEffect(() => {
|
|
1412
1374
|
if (!activeGuide || activeGuide.id !== "add-api-key" || activeGuide.stepIndex !== 2) {
|
|
1413
1375
|
return;
|
|
@@ -1566,6 +1528,7 @@ function ChatPanel({
|
|
|
1566
1528
|
} catch {
|
|
1567
1529
|
}
|
|
1568
1530
|
}
|
|
1531
|
+
textToStream = unescapeJsonString(textToStream);
|
|
1569
1532
|
const tokens = textToStream.split(" ");
|
|
1570
1533
|
let i = 0;
|
|
1571
1534
|
const intervalId = window.setInterval(() => {
|
|
@@ -1756,11 +1719,7 @@ function ChatPanel({
|
|
|
1756
1719
|
const isRespondingToNotification = lastAssistantMessage?.isNotificationMessage === true;
|
|
1757
1720
|
const now = Date.now();
|
|
1758
1721
|
const userMessage = { id: now, role: "user", content: userText };
|
|
1759
|
-
setMessages(
|
|
1760
|
-
(prev) => prev.map(
|
|
1761
|
-
(m) => m.followups && m.followups.length > 0 ? { ...m, followupSelected: true } : m
|
|
1762
|
-
).concat(userMessage)
|
|
1763
|
-
);
|
|
1722
|
+
setMessages((prev) => [...prev, userMessage]);
|
|
1764
1723
|
if (isRespondingToNotification) {
|
|
1765
1724
|
const thankYouMessageId = Date.now() + 1;
|
|
1766
1725
|
const thankYouMessage = {
|
|
@@ -2638,81 +2597,6 @@ ${userText}`
|
|
|
2638
2597
|
]);
|
|
2639
2598
|
}
|
|
2640
2599
|
}
|
|
2641
|
-
if (!isOpen) {
|
|
2642
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "fixed bottom-6 left-1/2 -translate-x-1/2 z-50", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `flex items-center gap-3 rounded-2xl bg-white border border-gray-200 shadow-lg px-4 py-2 hover:shadow-xl transition-all duration-300 ease-out focus-within:border-gray-700 ${searchExpanded ? "w-[480px]" : "w-[320px]"}`, children: !searchExpanded ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-3 w-full", children: [
|
|
2643
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2644
|
-
"button",
|
|
2645
|
-
{
|
|
2646
|
-
onClick: () => {
|
|
2647
|
-
setSearchExpanded(true);
|
|
2648
|
-
setTimeout(() => searchInputRef.current?.focus(), 100);
|
|
2649
|
-
},
|
|
2650
|
-
className: "flex items-center gap-3 flex-1 group",
|
|
2651
|
-
children: [
|
|
2652
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm text-gray-500 flex-1 text-left", children: "Ask a question..." }),
|
|
2653
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs text-gray-400 font-medium", children: "\u2318I" })
|
|
2654
|
-
]
|
|
2655
|
-
}
|
|
2656
|
-
),
|
|
2657
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2658
|
-
"button",
|
|
2659
|
-
{
|
|
2660
|
-
onClick: () => {
|
|
2661
|
-
onOpen?.();
|
|
2662
|
-
},
|
|
2663
|
-
className: "h-7 w-7 rounded-lg bg-gray-100 hover:bg-gray-200 flex items-center justify-center transition-colors",
|
|
2664
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Sparkles, { className: "h-3.5 w-3.5 text-black", fill: "currentColor" })
|
|
2665
|
-
}
|
|
2666
|
-
)
|
|
2667
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2668
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2669
|
-
"input",
|
|
2670
|
-
{
|
|
2671
|
-
ref: searchInputRef,
|
|
2672
|
-
type: "text",
|
|
2673
|
-
value: searchInput,
|
|
2674
|
-
onChange: (e) => setSearchInput(e.target.value),
|
|
2675
|
-
onKeyDown: (e) => {
|
|
2676
|
-
if (e.key === "Enter" && searchInput.trim()) {
|
|
2677
|
-
e.preventDefault();
|
|
2678
|
-
onOpen?.();
|
|
2679
|
-
startChatFlow(searchInput.trim());
|
|
2680
|
-
setSearchInput("");
|
|
2681
|
-
setSearchExpanded(false);
|
|
2682
|
-
} else if (e.key === "Escape") {
|
|
2683
|
-
setSearchExpanded(false);
|
|
2684
|
-
setSearchInput("");
|
|
2685
|
-
}
|
|
2686
|
-
},
|
|
2687
|
-
onBlur: () => {
|
|
2688
|
-
if (!searchInput.trim()) {
|
|
2689
|
-
setTimeout(() => setSearchExpanded(false), 200);
|
|
2690
|
-
}
|
|
2691
|
-
},
|
|
2692
|
-
placeholder: "Ask a question...",
|
|
2693
|
-
className: "flex-1 text-sm text-gray-700 outline-none bg-transparent"
|
|
2694
|
-
}
|
|
2695
|
-
),
|
|
2696
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2697
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs text-gray-400 font-medium", children: "\u21B5 Enter" }),
|
|
2698
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2699
|
-
"button",
|
|
2700
|
-
{
|
|
2701
|
-
onClick: () => {
|
|
2702
|
-
onOpen?.();
|
|
2703
|
-
if (searchInput.trim()) {
|
|
2704
|
-
setInput(searchInput);
|
|
2705
|
-
}
|
|
2706
|
-
setSearchInput("");
|
|
2707
|
-
setSearchExpanded(false);
|
|
2708
|
-
},
|
|
2709
|
-
className: "h-7 w-7 rounded-lg bg-gray-100 hover:bg-gray-200 flex items-center justify-center transition-colors cursor-pointer",
|
|
2710
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Sparkles, { className: "h-3.5 w-3.5 text-black", fill: "currentColor" })
|
|
2711
|
-
}
|
|
2712
|
-
)
|
|
2713
|
-
] })
|
|
2714
|
-
] }) }) });
|
|
2715
|
-
}
|
|
2716
2600
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2717
2601
|
"section",
|
|
2718
2602
|
{
|
|
@@ -4025,6 +3909,26 @@ ${userText}`
|
|
|
4025
3909
|
}
|
|
4026
3910
|
);
|
|
4027
3911
|
}
|
|
3912
|
+
function PanelToggle({
|
|
3913
|
+
isOpen,
|
|
3914
|
+
onClick,
|
|
3915
|
+
className = ""
|
|
3916
|
+
}) {
|
|
3917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3918
|
+
"button",
|
|
3919
|
+
{
|
|
3920
|
+
type: "button",
|
|
3921
|
+
onClick,
|
|
3922
|
+
className: `fixed top-1/2 z-50 flex items-center justify-center w-6 h-16 bg-gray-100 hover:bg-gray-200 border border-gray-200 border-r-0 rounded-l-lg text-gray-600 hover:text-gray-800 shadow-md transition-all duration-300 ${className}`,
|
|
3923
|
+
"aria-label": isOpen ? "Close help panel" : "Open help panel",
|
|
3924
|
+
style: {
|
|
3925
|
+
right: isOpen ? `${PANEL_WIDTH}px` : "0px",
|
|
3926
|
+
transform: "translateY(-50%)"
|
|
3927
|
+
},
|
|
3928
|
+
children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.ChevronRight, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.ChevronLeft, { className: "h-4 w-4" })
|
|
3929
|
+
}
|
|
3930
|
+
);
|
|
3931
|
+
}
|
|
4028
3932
|
function ChatPanelWithToggle({
|
|
4029
3933
|
onNavigate,
|
|
4030
3934
|
onActionComplete,
|
|
@@ -4054,20 +3958,22 @@ function ChatPanelWithToggle({
|
|
|
4054
3958
|
document.body.style.transition = originalTransition;
|
|
4055
3959
|
};
|
|
4056
3960
|
}, [isOpen]);
|
|
4057
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
3961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
3962
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PanelToggle, { isOpen, onClick: () => setIsOpen(!isOpen) }),
|
|
3963
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3964
|
+
ChatPanel,
|
|
3965
|
+
{
|
|
3966
|
+
isOpen,
|
|
3967
|
+
onClose: () => setIsOpen(false),
|
|
3968
|
+
onNavigate,
|
|
3969
|
+
onActionComplete,
|
|
3970
|
+
currentPage,
|
|
3971
|
+
agentUrl,
|
|
3972
|
+
startingQuestions,
|
|
3973
|
+
startingQuestionsEndpoint
|
|
3974
|
+
}
|
|
3975
|
+
)
|
|
3976
|
+
] });
|
|
4071
3977
|
}
|
|
4072
3978
|
|
|
4073
3979
|
// src/createKiteChat.tsx
|
package/dist/auto.d.cts
CHANGED
package/dist/auto.d.ts
CHANGED
package/dist/auto.js
CHANGED
|
@@ -887,6 +887,9 @@ import { ArrowLeft, ArrowUp, Command, CornerDownLeft, CheckCircle2 as CheckCircl
|
|
|
887
887
|
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
888
888
|
var DEFAULT_AGENT_URL = "http://localhost:5002";
|
|
889
889
|
var PANEL_WIDTH = 340;
|
|
890
|
+
function unescapeJsonString(str) {
|
|
891
|
+
return str.replace(/\\\\n/g, "\n").replace(/\\\\t/g, " ").replace(/\\\\"/g, '"').replace(/\\\\\\\\/g, "\\").replace(/\\n/g, "\n").replace(/\\t/g, " ").replace(/\\"/g, '"').replace(/\\\\/g, "\\");
|
|
892
|
+
}
|
|
890
893
|
function renderMarkdown(text) {
|
|
891
894
|
if (!text) return null;
|
|
892
895
|
const lines = text.split("\n");
|
|
@@ -934,7 +937,7 @@ function renderMarkdown(text) {
|
|
|
934
937
|
"a",
|
|
935
938
|
{
|
|
936
939
|
href: linkMatch[2],
|
|
937
|
-
className: "
|
|
940
|
+
className: "text-blue-600 hover:underline",
|
|
938
941
|
target: "_blank",
|
|
939
942
|
rel: "noopener noreferrer",
|
|
940
943
|
children: linkMatch[1]
|
|
@@ -945,44 +948,7 @@ function renderMarkdown(text) {
|
|
|
945
948
|
remaining = remaining.slice(linkMatch[0].length);
|
|
946
949
|
continue;
|
|
947
950
|
}
|
|
948
|
-
const
|
|
949
|
-
if (urlMatch) {
|
|
950
|
-
const url = urlMatch[1];
|
|
951
|
-
const href = url.startsWith("www.") ? `https://${url}` : url;
|
|
952
|
-
parts.push(
|
|
953
|
-
/* @__PURE__ */ jsx9(
|
|
954
|
-
"a",
|
|
955
|
-
{
|
|
956
|
-
href,
|
|
957
|
-
className: "kite-link",
|
|
958
|
-
target: "_blank",
|
|
959
|
-
rel: "noopener noreferrer",
|
|
960
|
-
children: url
|
|
961
|
-
},
|
|
962
|
-
keyIndex++
|
|
963
|
-
)
|
|
964
|
-
);
|
|
965
|
-
remaining = remaining.slice(url.length);
|
|
966
|
-
continue;
|
|
967
|
-
}
|
|
968
|
-
const emailMatch = remaining.match(/^([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/);
|
|
969
|
-
if (emailMatch) {
|
|
970
|
-
const email = emailMatch[1];
|
|
971
|
-
parts.push(
|
|
972
|
-
/* @__PURE__ */ jsx9(
|
|
973
|
-
"a",
|
|
974
|
-
{
|
|
975
|
-
href: `mailto:${email}`,
|
|
976
|
-
className: "kite-link",
|
|
977
|
-
children: email
|
|
978
|
-
},
|
|
979
|
-
keyIndex++
|
|
980
|
-
)
|
|
981
|
-
);
|
|
982
|
-
remaining = remaining.slice(email.length);
|
|
983
|
-
continue;
|
|
984
|
-
}
|
|
985
|
-
const nextSpecial = remaining.search(/[`*\[@h]/);
|
|
951
|
+
const nextSpecial = remaining.search(/[`*\[]/);
|
|
986
952
|
if (nextSpecial === -1) {
|
|
987
953
|
parts.push(remaining);
|
|
988
954
|
break;
|
|
@@ -1302,7 +1268,6 @@ var initialMessages = [];
|
|
|
1302
1268
|
function ChatPanel({
|
|
1303
1269
|
isOpen = true,
|
|
1304
1270
|
onClose,
|
|
1305
|
-
onOpen,
|
|
1306
1271
|
onBack,
|
|
1307
1272
|
onNavigate,
|
|
1308
1273
|
onActionComplete,
|
|
@@ -1404,9 +1369,6 @@ function ChatPanel({
|
|
|
1404
1369
|
const [pendingBulkSession, setPendingBulkSession] = React4.useState(null);
|
|
1405
1370
|
const pendingBulkSessionRef = React4.useRef(null);
|
|
1406
1371
|
const fileInputRef = React4.useRef(null);
|
|
1407
|
-
const [searchExpanded, setSearchExpanded] = React4.useState(false);
|
|
1408
|
-
const [searchInput, setSearchInput] = React4.useState("");
|
|
1409
|
-
const searchInputRef = React4.useRef(null);
|
|
1410
1372
|
React4.useEffect(() => {
|
|
1411
1373
|
if (!activeGuide || activeGuide.id !== "add-api-key" || activeGuide.stepIndex !== 2) {
|
|
1412
1374
|
return;
|
|
@@ -1565,6 +1527,7 @@ function ChatPanel({
|
|
|
1565
1527
|
} catch {
|
|
1566
1528
|
}
|
|
1567
1529
|
}
|
|
1530
|
+
textToStream = unescapeJsonString(textToStream);
|
|
1568
1531
|
const tokens = textToStream.split(" ");
|
|
1569
1532
|
let i = 0;
|
|
1570
1533
|
const intervalId = window.setInterval(() => {
|
|
@@ -1755,11 +1718,7 @@ function ChatPanel({
|
|
|
1755
1718
|
const isRespondingToNotification = lastAssistantMessage?.isNotificationMessage === true;
|
|
1756
1719
|
const now = Date.now();
|
|
1757
1720
|
const userMessage = { id: now, role: "user", content: userText };
|
|
1758
|
-
setMessages(
|
|
1759
|
-
(prev) => prev.map(
|
|
1760
|
-
(m) => m.followups && m.followups.length > 0 ? { ...m, followupSelected: true } : m
|
|
1761
|
-
).concat(userMessage)
|
|
1762
|
-
);
|
|
1721
|
+
setMessages((prev) => [...prev, userMessage]);
|
|
1763
1722
|
if (isRespondingToNotification) {
|
|
1764
1723
|
const thankYouMessageId = Date.now() + 1;
|
|
1765
1724
|
const thankYouMessage = {
|
|
@@ -2637,81 +2596,6 @@ ${userText}`
|
|
|
2637
2596
|
]);
|
|
2638
2597
|
}
|
|
2639
2598
|
}
|
|
2640
|
-
if (!isOpen) {
|
|
2641
|
-
return /* @__PURE__ */ jsx9("div", { className: "fixed bottom-6 left-1/2 -translate-x-1/2 z-50", children: /* @__PURE__ */ jsx9("div", { className: `flex items-center gap-3 rounded-2xl bg-white border border-gray-200 shadow-lg px-4 py-2 hover:shadow-xl transition-all duration-300 ease-out focus-within:border-gray-700 ${searchExpanded ? "w-[480px]" : "w-[320px]"}`, children: !searchExpanded ? /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3 w-full", children: [
|
|
2642
|
-
/* @__PURE__ */ jsxs5(
|
|
2643
|
-
"button",
|
|
2644
|
-
{
|
|
2645
|
-
onClick: () => {
|
|
2646
|
-
setSearchExpanded(true);
|
|
2647
|
-
setTimeout(() => searchInputRef.current?.focus(), 100);
|
|
2648
|
-
},
|
|
2649
|
-
className: "flex items-center gap-3 flex-1 group",
|
|
2650
|
-
children: [
|
|
2651
|
-
/* @__PURE__ */ jsx9("span", { className: "text-sm text-gray-500 flex-1 text-left", children: "Ask a question..." }),
|
|
2652
|
-
/* @__PURE__ */ jsx9("span", { className: "text-xs text-gray-400 font-medium", children: "\u2318I" })
|
|
2653
|
-
]
|
|
2654
|
-
}
|
|
2655
|
-
),
|
|
2656
|
-
/* @__PURE__ */ jsx9(
|
|
2657
|
-
"button",
|
|
2658
|
-
{
|
|
2659
|
-
onClick: () => {
|
|
2660
|
-
onOpen?.();
|
|
2661
|
-
},
|
|
2662
|
-
className: "h-7 w-7 rounded-lg bg-gray-100 hover:bg-gray-200 flex items-center justify-center transition-colors",
|
|
2663
|
-
children: /* @__PURE__ */ jsx9(Sparkles, { className: "h-3.5 w-3.5 text-black", fill: "currentColor" })
|
|
2664
|
-
}
|
|
2665
|
-
)
|
|
2666
|
-
] }) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
2667
|
-
/* @__PURE__ */ jsx9(
|
|
2668
|
-
"input",
|
|
2669
|
-
{
|
|
2670
|
-
ref: searchInputRef,
|
|
2671
|
-
type: "text",
|
|
2672
|
-
value: searchInput,
|
|
2673
|
-
onChange: (e) => setSearchInput(e.target.value),
|
|
2674
|
-
onKeyDown: (e) => {
|
|
2675
|
-
if (e.key === "Enter" && searchInput.trim()) {
|
|
2676
|
-
e.preventDefault();
|
|
2677
|
-
onOpen?.();
|
|
2678
|
-
startChatFlow(searchInput.trim());
|
|
2679
|
-
setSearchInput("");
|
|
2680
|
-
setSearchExpanded(false);
|
|
2681
|
-
} else if (e.key === "Escape") {
|
|
2682
|
-
setSearchExpanded(false);
|
|
2683
|
-
setSearchInput("");
|
|
2684
|
-
}
|
|
2685
|
-
},
|
|
2686
|
-
onBlur: () => {
|
|
2687
|
-
if (!searchInput.trim()) {
|
|
2688
|
-
setTimeout(() => setSearchExpanded(false), 200);
|
|
2689
|
-
}
|
|
2690
|
-
},
|
|
2691
|
-
placeholder: "Ask a question...",
|
|
2692
|
-
className: "flex-1 text-sm text-gray-700 outline-none bg-transparent"
|
|
2693
|
-
}
|
|
2694
|
-
),
|
|
2695
|
-
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
|
|
2696
|
-
/* @__PURE__ */ jsx9("span", { className: "text-xs text-gray-400 font-medium", children: "\u21B5 Enter" }),
|
|
2697
|
-
/* @__PURE__ */ jsx9(
|
|
2698
|
-
"button",
|
|
2699
|
-
{
|
|
2700
|
-
onClick: () => {
|
|
2701
|
-
onOpen?.();
|
|
2702
|
-
if (searchInput.trim()) {
|
|
2703
|
-
setInput(searchInput);
|
|
2704
|
-
}
|
|
2705
|
-
setSearchInput("");
|
|
2706
|
-
setSearchExpanded(false);
|
|
2707
|
-
},
|
|
2708
|
-
className: "h-7 w-7 rounded-lg bg-gray-100 hover:bg-gray-200 flex items-center justify-center transition-colors cursor-pointer",
|
|
2709
|
-
children: /* @__PURE__ */ jsx9(Sparkles, { className: "h-3.5 w-3.5 text-black", fill: "currentColor" })
|
|
2710
|
-
}
|
|
2711
|
-
)
|
|
2712
|
-
] })
|
|
2713
|
-
] }) }) });
|
|
2714
|
-
}
|
|
2715
2599
|
return /* @__PURE__ */ jsxs5(
|
|
2716
2600
|
"section",
|
|
2717
2601
|
{
|
|
@@ -4073,20 +3957,22 @@ function ChatPanelWithToggle({
|
|
|
4073
3957
|
document.body.style.transition = originalTransition;
|
|
4074
3958
|
};
|
|
4075
3959
|
}, [isOpen]);
|
|
4076
|
-
return /* @__PURE__ */
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
3960
|
+
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
3961
|
+
/* @__PURE__ */ jsx9(PanelToggle, { isOpen, onClick: () => setIsOpen(!isOpen) }),
|
|
3962
|
+
/* @__PURE__ */ jsx9(
|
|
3963
|
+
ChatPanel,
|
|
3964
|
+
{
|
|
3965
|
+
isOpen,
|
|
3966
|
+
onClose: () => setIsOpen(false),
|
|
3967
|
+
onNavigate,
|
|
3968
|
+
onActionComplete,
|
|
3969
|
+
currentPage,
|
|
3970
|
+
agentUrl,
|
|
3971
|
+
startingQuestions,
|
|
3972
|
+
startingQuestionsEndpoint
|
|
3973
|
+
}
|
|
3974
|
+
)
|
|
3975
|
+
] });
|
|
4090
3976
|
}
|
|
4091
3977
|
function HelpButton({ onClick, className = "" }) {
|
|
4092
3978
|
return /* @__PURE__ */ jsx9(
|
|
@@ -87,8 +87,6 @@ interface ChatPanelProps {
|
|
|
87
87
|
isOpen?: boolean;
|
|
88
88
|
/** Callback when the panel should close */
|
|
89
89
|
onClose?: () => void;
|
|
90
|
-
/** Callback when the panel should open */
|
|
91
|
-
onOpen?: () => void;
|
|
92
90
|
onBack?: () => void;
|
|
93
91
|
onNavigate?: (page: Page, subtab?: SettingsTab) => void;
|
|
94
92
|
onActionComplete?: (actionType: ActionType, data: ActionData) => void;
|
|
@@ -99,7 +97,7 @@ interface ChatPanelProps {
|
|
|
99
97
|
/** API endpoint to fetch starting questions */
|
|
100
98
|
startingQuestionsEndpoint?: string;
|
|
101
99
|
}
|
|
102
|
-
declare function ChatPanel({ isOpen, onClose,
|
|
100
|
+
declare function ChatPanel({ isOpen, onClose, onBack, onNavigate, onActionComplete, currentPage, agentUrl, startingQuestions: startingQuestionsProp, startingQuestionsEndpoint, }?: ChatPanelProps): react_jsx_runtime.JSX.Element;
|
|
103
101
|
/**
|
|
104
102
|
* PanelToggle - An arrow button on the right edge that toggles the side panel
|
|
105
103
|
* Shows left arrow when closed (click to open), right arrow when open (click to close)
|
|
@@ -87,8 +87,6 @@ interface ChatPanelProps {
|
|
|
87
87
|
isOpen?: boolean;
|
|
88
88
|
/** Callback when the panel should close */
|
|
89
89
|
onClose?: () => void;
|
|
90
|
-
/** Callback when the panel should open */
|
|
91
|
-
onOpen?: () => void;
|
|
92
90
|
onBack?: () => void;
|
|
93
91
|
onNavigate?: (page: Page, subtab?: SettingsTab) => void;
|
|
94
92
|
onActionComplete?: (actionType: ActionType, data: ActionData) => void;
|
|
@@ -99,7 +97,7 @@ interface ChatPanelProps {
|
|
|
99
97
|
/** API endpoint to fetch starting questions */
|
|
100
98
|
startingQuestionsEndpoint?: string;
|
|
101
99
|
}
|
|
102
|
-
declare function ChatPanel({ isOpen, onClose,
|
|
100
|
+
declare function ChatPanel({ isOpen, onClose, onBack, onNavigate, onActionComplete, currentPage, agentUrl, startingQuestions: startingQuestionsProp, startingQuestionsEndpoint, }?: ChatPanelProps): react_jsx_runtime.JSX.Element;
|
|
103
101
|
/**
|
|
104
102
|
* PanelToggle - An arrow button on the right edge that toggles the side panel
|
|
105
103
|
* Shows left arrow when closed (click to open), right arrow when open (click to close)
|