@kite-copilot/chat-panel 0.2.22 → 0.2.24
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 +141 -39
- package/dist/auto.d.cts +1 -1
- package/dist/auto.d.ts +1 -1
- package/dist/auto.js +1 -1
- package/dist/{chunk-SIPUO7GU.js → chunk-TBMYN3GD.js} +141 -19
- package/dist/{createKiteChat-BMLaQQQk.d.cts → createKiteChat-CyoN-YV4.d.cts} +3 -1
- package/dist/{createKiteChat-BMLaQQQk.d.ts → createKiteChat-CyoN-YV4.d.ts} +3 -1
- package/dist/embed.global.js +21 -21
- package/dist/index.cjs +141 -19
- 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: "kite-link",
|
|
939
942
|
target: "_blank",
|
|
940
943
|
rel: "noopener noreferrer",
|
|
941
944
|
children: linkMatch[1]
|
|
@@ -946,7 +949,44 @@ function renderMarkdown(text) {
|
|
|
946
949
|
remaining = remaining.slice(linkMatch[0].length);
|
|
947
950
|
continue;
|
|
948
951
|
}
|
|
949
|
-
const
|
|
952
|
+
const urlMatch = remaining.match(/^(https?:\/\/[^\s<>]+|www\.[^\s<>]+)/);
|
|
953
|
+
if (urlMatch) {
|
|
954
|
+
const url = urlMatch[1];
|
|
955
|
+
const href = url.startsWith("www.") ? `https://${url}` : url;
|
|
956
|
+
parts.push(
|
|
957
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
958
|
+
"a",
|
|
959
|
+
{
|
|
960
|
+
href,
|
|
961
|
+
className: "kite-link",
|
|
962
|
+
target: "_blank",
|
|
963
|
+
rel: "noopener noreferrer",
|
|
964
|
+
children: url
|
|
965
|
+
},
|
|
966
|
+
keyIndex++
|
|
967
|
+
)
|
|
968
|
+
);
|
|
969
|
+
remaining = remaining.slice(url.length);
|
|
970
|
+
continue;
|
|
971
|
+
}
|
|
972
|
+
const emailMatch = remaining.match(/^([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/);
|
|
973
|
+
if (emailMatch) {
|
|
974
|
+
const email = emailMatch[1];
|
|
975
|
+
parts.push(
|
|
976
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
977
|
+
"a",
|
|
978
|
+
{
|
|
979
|
+
href: `mailto:${email}`,
|
|
980
|
+
className: "kite-link",
|
|
981
|
+
children: email
|
|
982
|
+
},
|
|
983
|
+
keyIndex++
|
|
984
|
+
)
|
|
985
|
+
);
|
|
986
|
+
remaining = remaining.slice(email.length);
|
|
987
|
+
continue;
|
|
988
|
+
}
|
|
989
|
+
const nextSpecial = remaining.search(/[`*\[@h]/);
|
|
950
990
|
if (nextSpecial === -1) {
|
|
951
991
|
parts.push(remaining);
|
|
952
992
|
break;
|
|
@@ -1266,6 +1306,7 @@ var initialMessages = [];
|
|
|
1266
1306
|
function ChatPanel({
|
|
1267
1307
|
isOpen = true,
|
|
1268
1308
|
onClose,
|
|
1309
|
+
onOpen,
|
|
1269
1310
|
onBack,
|
|
1270
1311
|
onNavigate,
|
|
1271
1312
|
onActionComplete,
|
|
@@ -1367,6 +1408,9 @@ function ChatPanel({
|
|
|
1367
1408
|
const [pendingBulkSession, setPendingBulkSession] = React4.useState(null);
|
|
1368
1409
|
const pendingBulkSessionRef = React4.useRef(null);
|
|
1369
1410
|
const fileInputRef = React4.useRef(null);
|
|
1411
|
+
const [searchExpanded, setSearchExpanded] = React4.useState(false);
|
|
1412
|
+
const [searchInput, setSearchInput] = React4.useState("");
|
|
1413
|
+
const searchInputRef = React4.useRef(null);
|
|
1370
1414
|
React4.useEffect(() => {
|
|
1371
1415
|
if (!activeGuide || activeGuide.id !== "add-api-key" || activeGuide.stepIndex !== 2) {
|
|
1372
1416
|
return;
|
|
@@ -1525,6 +1569,7 @@ function ChatPanel({
|
|
|
1525
1569
|
} catch {
|
|
1526
1570
|
}
|
|
1527
1571
|
}
|
|
1572
|
+
textToStream = unescapeJsonString(textToStream);
|
|
1528
1573
|
const tokens = textToStream.split(" ");
|
|
1529
1574
|
let i = 0;
|
|
1530
1575
|
const intervalId = window.setInterval(() => {
|
|
@@ -1715,7 +1760,11 @@ function ChatPanel({
|
|
|
1715
1760
|
const isRespondingToNotification = lastAssistantMessage?.isNotificationMessage === true;
|
|
1716
1761
|
const now = Date.now();
|
|
1717
1762
|
const userMessage = { id: now, role: "user", content: userText };
|
|
1718
|
-
setMessages(
|
|
1763
|
+
setMessages(
|
|
1764
|
+
(prev) => prev.map(
|
|
1765
|
+
(m) => m.followups && m.followups.length > 0 ? { ...m, followupSelected: true } : m
|
|
1766
|
+
).concat(userMessage)
|
|
1767
|
+
);
|
|
1719
1768
|
if (isRespondingToNotification) {
|
|
1720
1769
|
const thankYouMessageId = Date.now() + 1;
|
|
1721
1770
|
const thankYouMessage = {
|
|
@@ -2593,6 +2642,81 @@ ${userText}`
|
|
|
2593
2642
|
]);
|
|
2594
2643
|
}
|
|
2595
2644
|
}
|
|
2645
|
+
if (!isOpen) {
|
|
2646
|
+
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: [
|
|
2647
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2648
|
+
"button",
|
|
2649
|
+
{
|
|
2650
|
+
onClick: () => {
|
|
2651
|
+
setSearchExpanded(true);
|
|
2652
|
+
setTimeout(() => searchInputRef.current?.focus(), 100);
|
|
2653
|
+
},
|
|
2654
|
+
className: "flex items-center gap-3 flex-1 group",
|
|
2655
|
+
children: [
|
|
2656
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm text-gray-500 flex-1 text-left", children: "Ask a question..." }),
|
|
2657
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs text-gray-400 font-medium", children: "\u2318I" })
|
|
2658
|
+
]
|
|
2659
|
+
}
|
|
2660
|
+
),
|
|
2661
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2662
|
+
"button",
|
|
2663
|
+
{
|
|
2664
|
+
onClick: () => {
|
|
2665
|
+
onOpen?.();
|
|
2666
|
+
},
|
|
2667
|
+
className: "h-7 w-7 rounded-lg bg-gray-100 hover:bg-gray-200 flex items-center justify-center transition-colors",
|
|
2668
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Sparkles, { className: "h-3.5 w-3.5 text-black", fill: "currentColor" })
|
|
2669
|
+
}
|
|
2670
|
+
)
|
|
2671
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2672
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2673
|
+
"input",
|
|
2674
|
+
{
|
|
2675
|
+
ref: searchInputRef,
|
|
2676
|
+
type: "text",
|
|
2677
|
+
value: searchInput,
|
|
2678
|
+
onChange: (e) => setSearchInput(e.target.value),
|
|
2679
|
+
onKeyDown: (e) => {
|
|
2680
|
+
if (e.key === "Enter" && searchInput.trim()) {
|
|
2681
|
+
e.preventDefault();
|
|
2682
|
+
onOpen?.();
|
|
2683
|
+
startChatFlow(searchInput.trim());
|
|
2684
|
+
setSearchInput("");
|
|
2685
|
+
setSearchExpanded(false);
|
|
2686
|
+
} else if (e.key === "Escape") {
|
|
2687
|
+
setSearchExpanded(false);
|
|
2688
|
+
setSearchInput("");
|
|
2689
|
+
}
|
|
2690
|
+
},
|
|
2691
|
+
onBlur: () => {
|
|
2692
|
+
if (!searchInput.trim()) {
|
|
2693
|
+
setTimeout(() => setSearchExpanded(false), 200);
|
|
2694
|
+
}
|
|
2695
|
+
},
|
|
2696
|
+
placeholder: "Ask a question...",
|
|
2697
|
+
className: "flex-1 text-sm text-gray-700 outline-none bg-transparent"
|
|
2698
|
+
}
|
|
2699
|
+
),
|
|
2700
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2701
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs text-gray-400 font-medium", children: "\u21B5 Enter" }),
|
|
2702
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2703
|
+
"button",
|
|
2704
|
+
{
|
|
2705
|
+
onClick: () => {
|
|
2706
|
+
onOpen?.();
|
|
2707
|
+
if (searchInput.trim()) {
|
|
2708
|
+
setInput(searchInput);
|
|
2709
|
+
}
|
|
2710
|
+
setSearchInput("");
|
|
2711
|
+
setSearchExpanded(false);
|
|
2712
|
+
},
|
|
2713
|
+
className: "h-7 w-7 rounded-lg bg-gray-100 hover:bg-gray-200 flex items-center justify-center transition-colors cursor-pointer",
|
|
2714
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Sparkles, { className: "h-3.5 w-3.5 text-black", fill: "currentColor" })
|
|
2715
|
+
}
|
|
2716
|
+
)
|
|
2717
|
+
] })
|
|
2718
|
+
] }) }) });
|
|
2719
|
+
}
|
|
2596
2720
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2597
2721
|
"section",
|
|
2598
2722
|
{
|
|
@@ -3905,26 +4029,6 @@ ${userText}`
|
|
|
3905
4029
|
}
|
|
3906
4030
|
);
|
|
3907
4031
|
}
|
|
3908
|
-
function PanelToggle({
|
|
3909
|
-
isOpen,
|
|
3910
|
-
onClick,
|
|
3911
|
-
className = ""
|
|
3912
|
-
}) {
|
|
3913
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3914
|
-
"button",
|
|
3915
|
-
{
|
|
3916
|
-
type: "button",
|
|
3917
|
-
onClick,
|
|
3918
|
-
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}`,
|
|
3919
|
-
"aria-label": isOpen ? "Close help panel" : "Open help panel",
|
|
3920
|
-
style: {
|
|
3921
|
-
right: isOpen ? `${PANEL_WIDTH}px` : "0px",
|
|
3922
|
-
transform: "translateY(-50%)"
|
|
3923
|
-
},
|
|
3924
|
-
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" })
|
|
3925
|
-
}
|
|
3926
|
-
);
|
|
3927
|
-
}
|
|
3928
4032
|
function ChatPanelWithToggle({
|
|
3929
4033
|
onNavigate,
|
|
3930
4034
|
onActionComplete,
|
|
@@ -3954,22 +4058,20 @@ function ChatPanelWithToggle({
|
|
|
3954
4058
|
document.body.style.transition = originalTransition;
|
|
3955
4059
|
};
|
|
3956
4060
|
}, [isOpen]);
|
|
3957
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
)
|
|
3972
|
-
] });
|
|
4061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
4062
|
+
ChatPanel,
|
|
4063
|
+
{
|
|
4064
|
+
isOpen,
|
|
4065
|
+
onClose: () => setIsOpen(false),
|
|
4066
|
+
onOpen: () => setIsOpen(true),
|
|
4067
|
+
onNavigate,
|
|
4068
|
+
onActionComplete,
|
|
4069
|
+
currentPage,
|
|
4070
|
+
agentUrl,
|
|
4071
|
+
startingQuestions,
|
|
4072
|
+
startingQuestionsEndpoint
|
|
4073
|
+
}
|
|
4074
|
+
);
|
|
3973
4075
|
}
|
|
3974
4076
|
|
|
3975
4077
|
// 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: "kite-link",
|
|
938
941
|
target: "_blank",
|
|
939
942
|
rel: "noopener noreferrer",
|
|
940
943
|
children: linkMatch[1]
|
|
@@ -945,7 +948,44 @@ function renderMarkdown(text) {
|
|
|
945
948
|
remaining = remaining.slice(linkMatch[0].length);
|
|
946
949
|
continue;
|
|
947
950
|
}
|
|
948
|
-
const
|
|
951
|
+
const urlMatch = remaining.match(/^(https?:\/\/[^\s<>]+|www\.[^\s<>]+)/);
|
|
952
|
+
if (urlMatch) {
|
|
953
|
+
const url = urlMatch[1];
|
|
954
|
+
const href = url.startsWith("www.") ? `https://${url}` : url;
|
|
955
|
+
parts.push(
|
|
956
|
+
/* @__PURE__ */ jsx9(
|
|
957
|
+
"a",
|
|
958
|
+
{
|
|
959
|
+
href,
|
|
960
|
+
className: "kite-link",
|
|
961
|
+
target: "_blank",
|
|
962
|
+
rel: "noopener noreferrer",
|
|
963
|
+
children: url
|
|
964
|
+
},
|
|
965
|
+
keyIndex++
|
|
966
|
+
)
|
|
967
|
+
);
|
|
968
|
+
remaining = remaining.slice(url.length);
|
|
969
|
+
continue;
|
|
970
|
+
}
|
|
971
|
+
const emailMatch = remaining.match(/^([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/);
|
|
972
|
+
if (emailMatch) {
|
|
973
|
+
const email = emailMatch[1];
|
|
974
|
+
parts.push(
|
|
975
|
+
/* @__PURE__ */ jsx9(
|
|
976
|
+
"a",
|
|
977
|
+
{
|
|
978
|
+
href: `mailto:${email}`,
|
|
979
|
+
className: "kite-link",
|
|
980
|
+
children: email
|
|
981
|
+
},
|
|
982
|
+
keyIndex++
|
|
983
|
+
)
|
|
984
|
+
);
|
|
985
|
+
remaining = remaining.slice(email.length);
|
|
986
|
+
continue;
|
|
987
|
+
}
|
|
988
|
+
const nextSpecial = remaining.search(/[`*\[@h]/);
|
|
949
989
|
if (nextSpecial === -1) {
|
|
950
990
|
parts.push(remaining);
|
|
951
991
|
break;
|
|
@@ -1265,6 +1305,7 @@ var initialMessages = [];
|
|
|
1265
1305
|
function ChatPanel({
|
|
1266
1306
|
isOpen = true,
|
|
1267
1307
|
onClose,
|
|
1308
|
+
onOpen,
|
|
1268
1309
|
onBack,
|
|
1269
1310
|
onNavigate,
|
|
1270
1311
|
onActionComplete,
|
|
@@ -1366,6 +1407,9 @@ function ChatPanel({
|
|
|
1366
1407
|
const [pendingBulkSession, setPendingBulkSession] = React4.useState(null);
|
|
1367
1408
|
const pendingBulkSessionRef = React4.useRef(null);
|
|
1368
1409
|
const fileInputRef = React4.useRef(null);
|
|
1410
|
+
const [searchExpanded, setSearchExpanded] = React4.useState(false);
|
|
1411
|
+
const [searchInput, setSearchInput] = React4.useState("");
|
|
1412
|
+
const searchInputRef = React4.useRef(null);
|
|
1369
1413
|
React4.useEffect(() => {
|
|
1370
1414
|
if (!activeGuide || activeGuide.id !== "add-api-key" || activeGuide.stepIndex !== 2) {
|
|
1371
1415
|
return;
|
|
@@ -1524,6 +1568,7 @@ function ChatPanel({
|
|
|
1524
1568
|
} catch {
|
|
1525
1569
|
}
|
|
1526
1570
|
}
|
|
1571
|
+
textToStream = unescapeJsonString(textToStream);
|
|
1527
1572
|
const tokens = textToStream.split(" ");
|
|
1528
1573
|
let i = 0;
|
|
1529
1574
|
const intervalId = window.setInterval(() => {
|
|
@@ -1714,7 +1759,11 @@ function ChatPanel({
|
|
|
1714
1759
|
const isRespondingToNotification = lastAssistantMessage?.isNotificationMessage === true;
|
|
1715
1760
|
const now = Date.now();
|
|
1716
1761
|
const userMessage = { id: now, role: "user", content: userText };
|
|
1717
|
-
setMessages(
|
|
1762
|
+
setMessages(
|
|
1763
|
+
(prev) => prev.map(
|
|
1764
|
+
(m) => m.followups && m.followups.length > 0 ? { ...m, followupSelected: true } : m
|
|
1765
|
+
).concat(userMessage)
|
|
1766
|
+
);
|
|
1718
1767
|
if (isRespondingToNotification) {
|
|
1719
1768
|
const thankYouMessageId = Date.now() + 1;
|
|
1720
1769
|
const thankYouMessage = {
|
|
@@ -2592,6 +2641,81 @@ ${userText}`
|
|
|
2592
2641
|
]);
|
|
2593
2642
|
}
|
|
2594
2643
|
}
|
|
2644
|
+
if (!isOpen) {
|
|
2645
|
+
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: [
|
|
2646
|
+
/* @__PURE__ */ jsxs5(
|
|
2647
|
+
"button",
|
|
2648
|
+
{
|
|
2649
|
+
onClick: () => {
|
|
2650
|
+
setSearchExpanded(true);
|
|
2651
|
+
setTimeout(() => searchInputRef.current?.focus(), 100);
|
|
2652
|
+
},
|
|
2653
|
+
className: "flex items-center gap-3 flex-1 group",
|
|
2654
|
+
children: [
|
|
2655
|
+
/* @__PURE__ */ jsx9("span", { className: "text-sm text-gray-500 flex-1 text-left", children: "Ask a question..." }),
|
|
2656
|
+
/* @__PURE__ */ jsx9("span", { className: "text-xs text-gray-400 font-medium", children: "\u2318I" })
|
|
2657
|
+
]
|
|
2658
|
+
}
|
|
2659
|
+
),
|
|
2660
|
+
/* @__PURE__ */ jsx9(
|
|
2661
|
+
"button",
|
|
2662
|
+
{
|
|
2663
|
+
onClick: () => {
|
|
2664
|
+
onOpen?.();
|
|
2665
|
+
},
|
|
2666
|
+
className: "h-7 w-7 rounded-lg bg-gray-100 hover:bg-gray-200 flex items-center justify-center transition-colors",
|
|
2667
|
+
children: /* @__PURE__ */ jsx9(Sparkles, { className: "h-3.5 w-3.5 text-black", fill: "currentColor" })
|
|
2668
|
+
}
|
|
2669
|
+
)
|
|
2670
|
+
] }) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
2671
|
+
/* @__PURE__ */ jsx9(
|
|
2672
|
+
"input",
|
|
2673
|
+
{
|
|
2674
|
+
ref: searchInputRef,
|
|
2675
|
+
type: "text",
|
|
2676
|
+
value: searchInput,
|
|
2677
|
+
onChange: (e) => setSearchInput(e.target.value),
|
|
2678
|
+
onKeyDown: (e) => {
|
|
2679
|
+
if (e.key === "Enter" && searchInput.trim()) {
|
|
2680
|
+
e.preventDefault();
|
|
2681
|
+
onOpen?.();
|
|
2682
|
+
startChatFlow(searchInput.trim());
|
|
2683
|
+
setSearchInput("");
|
|
2684
|
+
setSearchExpanded(false);
|
|
2685
|
+
} else if (e.key === "Escape") {
|
|
2686
|
+
setSearchExpanded(false);
|
|
2687
|
+
setSearchInput("");
|
|
2688
|
+
}
|
|
2689
|
+
},
|
|
2690
|
+
onBlur: () => {
|
|
2691
|
+
if (!searchInput.trim()) {
|
|
2692
|
+
setTimeout(() => setSearchExpanded(false), 200);
|
|
2693
|
+
}
|
|
2694
|
+
},
|
|
2695
|
+
placeholder: "Ask a question...",
|
|
2696
|
+
className: "flex-1 text-sm text-gray-700 outline-none bg-transparent"
|
|
2697
|
+
}
|
|
2698
|
+
),
|
|
2699
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
|
|
2700
|
+
/* @__PURE__ */ jsx9("span", { className: "text-xs text-gray-400 font-medium", children: "\u21B5 Enter" }),
|
|
2701
|
+
/* @__PURE__ */ jsx9(
|
|
2702
|
+
"button",
|
|
2703
|
+
{
|
|
2704
|
+
onClick: () => {
|
|
2705
|
+
onOpen?.();
|
|
2706
|
+
if (searchInput.trim()) {
|
|
2707
|
+
setInput(searchInput);
|
|
2708
|
+
}
|
|
2709
|
+
setSearchInput("");
|
|
2710
|
+
setSearchExpanded(false);
|
|
2711
|
+
},
|
|
2712
|
+
className: "h-7 w-7 rounded-lg bg-gray-100 hover:bg-gray-200 flex items-center justify-center transition-colors cursor-pointer",
|
|
2713
|
+
children: /* @__PURE__ */ jsx9(Sparkles, { className: "h-3.5 w-3.5 text-black", fill: "currentColor" })
|
|
2714
|
+
}
|
|
2715
|
+
)
|
|
2716
|
+
] })
|
|
2717
|
+
] }) }) });
|
|
2718
|
+
}
|
|
2595
2719
|
return /* @__PURE__ */ jsxs5(
|
|
2596
2720
|
"section",
|
|
2597
2721
|
{
|
|
@@ -3953,22 +4077,20 @@ function ChatPanelWithToggle({
|
|
|
3953
4077
|
document.body.style.transition = originalTransition;
|
|
3954
4078
|
};
|
|
3955
4079
|
}, [isOpen]);
|
|
3956
|
-
return /* @__PURE__ */
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
)
|
|
3971
|
-
] });
|
|
4080
|
+
return /* @__PURE__ */ jsx9(
|
|
4081
|
+
ChatPanel,
|
|
4082
|
+
{
|
|
4083
|
+
isOpen,
|
|
4084
|
+
onClose: () => setIsOpen(false),
|
|
4085
|
+
onOpen: () => setIsOpen(true),
|
|
4086
|
+
onNavigate,
|
|
4087
|
+
onActionComplete,
|
|
4088
|
+
currentPage,
|
|
4089
|
+
agentUrl,
|
|
4090
|
+
startingQuestions,
|
|
4091
|
+
startingQuestionsEndpoint
|
|
4092
|
+
}
|
|
4093
|
+
);
|
|
3972
4094
|
}
|
|
3973
4095
|
function HelpButton({ onClick, className = "" }) {
|
|
3974
4096
|
return /* @__PURE__ */ jsx9(
|
|
@@ -87,6 +87,8 @@ 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;
|
|
90
92
|
onBack?: () => void;
|
|
91
93
|
onNavigate?: (page: Page, subtab?: SettingsTab) => void;
|
|
92
94
|
onActionComplete?: (actionType: ActionType, data: ActionData) => void;
|
|
@@ -97,7 +99,7 @@ interface ChatPanelProps {
|
|
|
97
99
|
/** API endpoint to fetch starting questions */
|
|
98
100
|
startingQuestionsEndpoint?: string;
|
|
99
101
|
}
|
|
100
|
-
declare function ChatPanel({ isOpen, onClose, onBack, onNavigate, onActionComplete, currentPage, agentUrl, startingQuestions: startingQuestionsProp, startingQuestionsEndpoint, }?: ChatPanelProps): react_jsx_runtime.JSX.Element;
|
|
102
|
+
declare function ChatPanel({ isOpen, onClose, onOpen, onBack, onNavigate, onActionComplete, currentPage, agentUrl, startingQuestions: startingQuestionsProp, startingQuestionsEndpoint, }?: ChatPanelProps): react_jsx_runtime.JSX.Element;
|
|
101
103
|
/**
|
|
102
104
|
* PanelToggle - An arrow button on the right edge that toggles the side panel
|
|
103
105
|
* Shows left arrow when closed (click to open), right arrow when open (click to close)
|
|
@@ -87,6 +87,8 @@ 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;
|
|
90
92
|
onBack?: () => void;
|
|
91
93
|
onNavigate?: (page: Page, subtab?: SettingsTab) => void;
|
|
92
94
|
onActionComplete?: (actionType: ActionType, data: ActionData) => void;
|
|
@@ -97,7 +99,7 @@ interface ChatPanelProps {
|
|
|
97
99
|
/** API endpoint to fetch starting questions */
|
|
98
100
|
startingQuestionsEndpoint?: string;
|
|
99
101
|
}
|
|
100
|
-
declare function ChatPanel({ isOpen, onClose, onBack, onNavigate, onActionComplete, currentPage, agentUrl, startingQuestions: startingQuestionsProp, startingQuestionsEndpoint, }?: ChatPanelProps): react_jsx_runtime.JSX.Element;
|
|
102
|
+
declare function ChatPanel({ isOpen, onClose, onOpen, onBack, onNavigate, onActionComplete, currentPage, agentUrl, startingQuestions: startingQuestionsProp, startingQuestionsEndpoint, }?: ChatPanelProps): react_jsx_runtime.JSX.Element;
|
|
101
103
|
/**
|
|
102
104
|
* PanelToggle - An arrow button on the right edge that toggles the side panel
|
|
103
105
|
* Shows left arrow when closed (click to open), right arrow when open (click to close)
|