@copilotkit/react-ui 1.4.7 → 1.4.8-no-pino-redact.1

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/{chunk-4T3TMQNJ.mjs → chunk-BH6PCAAL.mjs} +38 -2
  3. package/dist/chunk-BH6PCAAL.mjs.map +1 -0
  4. package/dist/{chunk-63ZKP62F.mjs → chunk-E5SSVET3.mjs} +3 -3
  5. package/dist/{chunk-4LUMV4YO.mjs → chunk-EMQEEXUB.mjs} +8 -3
  6. package/dist/chunk-EMQEEXUB.mjs.map +1 -0
  7. package/dist/{chunk-VYKDFXGS.mjs → chunk-FUDBUYBG.mjs} +2 -2
  8. package/dist/chunk-ICGZEGHQ.mjs +155 -0
  9. package/dist/chunk-ICGZEGHQ.mjs.map +1 -0
  10. package/dist/{chunk-DHGDU64D.mjs → chunk-T35X2SFE.mjs} +3 -3
  11. package/dist/{chunk-2B57NCBA.mjs → chunk-TTYR7XPN.mjs} +2 -2
  12. package/dist/{chunk-TKFQ7VQR.mjs → chunk-ZQFKJLQ6.mjs} +2 -2
  13. package/dist/components/chat/Chat.js +123 -4
  14. package/dist/components/chat/Chat.js.map +1 -1
  15. package/dist/components/chat/Chat.mjs +5 -5
  16. package/dist/components/chat/Input.js +7 -2
  17. package/dist/components/chat/Input.js.map +1 -1
  18. package/dist/components/chat/Input.mjs +1 -1
  19. package/dist/components/chat/Modal.js +123 -4
  20. package/dist/components/chat/Modal.js.map +1 -1
  21. package/dist/components/chat/Modal.mjs +6 -6
  22. package/dist/components/chat/Popup.js +123 -4
  23. package/dist/components/chat/Popup.js.map +1 -1
  24. package/dist/components/chat/Popup.mjs +7 -7
  25. package/dist/components/chat/Sidebar.js +123 -4
  26. package/dist/components/chat/Sidebar.js.map +1 -1
  27. package/dist/components/chat/Sidebar.mjs +7 -7
  28. package/dist/components/chat/index.js +123 -4
  29. package/dist/components/chat/index.js.map +1 -1
  30. package/dist/components/chat/index.mjs +8 -8
  31. package/dist/components/dev-console/console.js +116 -2
  32. package/dist/components/dev-console/console.js.map +1 -1
  33. package/dist/components/dev-console/console.mjs +3 -3
  34. package/dist/components/dev-console/index.js +116 -2
  35. package/dist/components/dev-console/index.js.map +1 -1
  36. package/dist/components/dev-console/index.mjs +3 -3
  37. package/dist/components/help-modal/icons.d.ts +4 -1
  38. package/dist/components/help-modal/icons.js +39 -2
  39. package/dist/components/help-modal/icons.js.map +1 -1
  40. package/dist/components/help-modal/icons.mjs +5 -3
  41. package/dist/components/help-modal/index.js +136 -2
  42. package/dist/components/help-modal/index.js.map +1 -1
  43. package/dist/components/help-modal/index.mjs +2 -2
  44. package/dist/components/help-modal/modal.js +136 -2
  45. package/dist/components/help-modal/modal.js.map +1 -1
  46. package/dist/components/help-modal/modal.mjs +2 -2
  47. package/dist/components/index.js +123 -4
  48. package/dist/components/index.js.map +1 -1
  49. package/dist/components/index.mjs +8 -8
  50. package/dist/index.js +123 -4
  51. package/dist/index.js.map +1 -1
  52. package/dist/index.mjs +8 -8
  53. package/package.json +4 -4
  54. package/src/components/chat/Input.tsx +9 -2
  55. package/src/components/help-modal/icons.tsx +28 -0
  56. package/src/components/help-modal/modal.tsx +90 -27
  57. package/dist/chunk-4LUMV4YO.mjs.map +0 -1
  58. package/dist/chunk-4T3TMQNJ.mjs.map +0 -1
  59. package/dist/chunk-WOUWNTAV.mjs +0 -72
  60. package/dist/chunk-WOUWNTAV.mjs.map +0 -1
  61. /package/dist/{chunk-63ZKP62F.mjs.map → chunk-E5SSVET3.mjs.map} +0 -0
  62. /package/dist/{chunk-VYKDFXGS.mjs.map → chunk-FUDBUYBG.mjs.map} +0 -0
  63. /package/dist/{chunk-DHGDU64D.mjs.map → chunk-T35X2SFE.mjs.map} +0 -0
  64. /package/dist/{chunk-2B57NCBA.mjs.map → chunk-TTYR7XPN.mjs.map} +0 -0
  65. /package/dist/{chunk-TKFQ7VQR.mjs.map → chunk-ZQFKJLQ6.mjs.map} +0 -0
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  CopilotModal
3
- } from "../../chunk-63ZKP62F.mjs";
3
+ } from "../../chunk-E5SSVET3.mjs";
4
4
  import "../../chunk-YAGE7RCE.mjs";
5
5
  import "../../chunk-VEC45H6Q.mjs";
6
6
  import "../../chunk-RQNJNK2W.mjs";
7
- import "../../chunk-DHGDU64D.mjs";
7
+ import "../../chunk-T35X2SFE.mjs";
8
8
  import "../../chunk-6INMITFA.mjs";
9
9
  import "../../chunk-RU73BEZM.mjs";
10
10
  import "../../chunk-V7W6IM2V.mjs";
11
11
  import "../../chunk-OMTPWC7T.mjs";
12
12
  import "../../chunk-ZABXREBH.mjs";
13
13
  import "../../chunk-RJCZRKTV.mjs";
14
- import "../../chunk-2B57NCBA.mjs";
14
+ import "../../chunk-TTYR7XPN.mjs";
15
15
  import "../../chunk-4FIGRRFS.mjs";
16
16
  import "../../chunk-KXE2JCUH.mjs";
17
- import "../../chunk-WOUWNTAV.mjs";
18
- import "../../chunk-4T3TMQNJ.mjs";
17
+ import "../../chunk-ICGZEGHQ.mjs";
18
+ import "../../chunk-BH6PCAAL.mjs";
19
19
  import "../../chunk-OTPAZXVR.mjs";
20
- import "../../chunk-4LUMV4YO.mjs";
20
+ import "../../chunk-EMQEEXUB.mjs";
21
21
  import "../../chunk-YQFVRDNC.mjs";
22
22
  import "../../chunk-YQ3D5IQV.mjs";
23
23
  import "../../chunk-RKPANT3F.mjs";
@@ -877,7 +877,10 @@ var Input = ({ inProgress, onSend, isVisible = false }) => {
877
877
  });
878
878
  const sendIcon = inProgress || pushToTalkState === "transcribing" ? context.icons.activityIcon : context.icons.sendIcon;
879
879
  const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
880
- const sendDisabled = inProgress || text.length === 0 || pushToTalkState !== "idle";
880
+ const canSend = () => {
881
+ return !inProgress && text.trim().length > 0 && pushToTalkState === "idle";
882
+ };
883
+ const sendDisabled = !canSend();
881
884
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
882
885
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
883
886
  Textarea_default,
@@ -891,7 +894,9 @@ var Input = ({ inProgress, onSend, isVisible = false }) => {
891
894
  onKeyDown: (event) => {
892
895
  if (event.key === "Enter" && !event.shiftKey) {
893
896
  event.preventDefault();
894
- send();
897
+ if (canSend()) {
898
+ send();
899
+ }
895
900
  }
896
901
  }
897
902
  }
@@ -1934,15 +1939,79 @@ var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1934
1939
  children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
1935
1940
  }
1936
1941
  );
1942
+ var LoadingSpinnerIcon = ({ color = "rgb(107 114 128)" }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1943
+ "svg",
1944
+ {
1945
+ style: {
1946
+ animation: "copilotKitSpinAnimation 1s linear infinite",
1947
+ color
1948
+ },
1949
+ width: "24",
1950
+ height: "24",
1951
+ xmlns: "http://www.w3.org/2000/svg",
1952
+ fill: "none",
1953
+ viewBox: "0 0 24 24",
1954
+ children: [
1955
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1956
+ "circle",
1957
+ {
1958
+ style: { opacity: 0.25 },
1959
+ cx: "12",
1960
+ cy: "12",
1961
+ r: "10",
1962
+ stroke: "currentColor",
1963
+ strokeWidth: "4"
1964
+ }
1965
+ ),
1966
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1967
+ "path",
1968
+ {
1969
+ style: { opacity: 0.75 },
1970
+ fill: "currentColor",
1971
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
1972
+ }
1973
+ )
1974
+ ]
1975
+ }
1976
+ );
1937
1977
 
1938
1978
  // src/components/help-modal/modal.tsx
1939
1979
  var import_jsx_runtime19 = require("react/jsx-runtime");
1940
1980
  function CopilotKitHelpModal() {
1941
1981
  const [showHelpModal, setShowHelpModal] = (0, import_react9.useState)(false);
1942
1982
  const [issueDescription, setIssueDescription] = (0, import_react9.useState)("");
1943
- const handleSubmit = () => {
1944
- setShowHelpModal(false);
1983
+ const [email, setEmail] = (0, import_react9.useState)("");
1984
+ const [emailError, setEmailError] = (0, import_react9.useState)("");
1985
+ const [submitting, setSubmitting] = (0, import_react9.useState)(false);
1986
+ const validateEmail = (email2) => {
1987
+ const re = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
1988
+ return re.test(email2);
1945
1989
  };
1990
+ const handleSubmit = (e) => __async(this, null, function* () {
1991
+ e.preventDefault();
1992
+ if ((email == null ? void 0 : email.length) > 0 && !validateEmail(email)) {
1993
+ setEmailError("Please enter a valid email address");
1994
+ return;
1995
+ }
1996
+ setSubmitting(true);
1997
+ yield fetch("https://api.segment.io/v1/track", {
1998
+ method: "POST",
1999
+ headers: {
2000
+ "Content-Type": "application/json"
2001
+ },
2002
+ body: JSON.stringify({
2003
+ event: "oss.dev-console.help",
2004
+ anonymousId: window.crypto.randomUUID(),
2005
+ properties: { email, text: issueDescription },
2006
+ writeKey: "q0gQqvGYyw9pNyhIocNzefSYKGO1aiwW"
2007
+ })
2008
+ });
2009
+ setEmailError("");
2010
+ setEmail("");
2011
+ setIssueDescription("");
2012
+ setSubmitting(false);
2013
+ setShowHelpModal(false);
2014
+ });
1946
2015
  const HelpButton = () => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1947
2016
  "button",
1948
2017
  {
@@ -1952,6 +2021,10 @@ function CopilotKitHelpModal() {
1952
2021
  children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LifeBuoyIcon, {})
1953
2022
  }
1954
2023
  );
2024
+ const submitButtonDisabled = (0, import_react9.useMemo)(
2025
+ () => submitting || !!emailError || issueDescription == null || (issueDescription == null ? void 0 : issueDescription.length) == 0,
2026
+ [submitting, emailError, issueDescription]
2027
+ );
1955
2028
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
1956
2029
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(HelpButton, {}),
1957
2030
  showHelpModal && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
@@ -1990,6 +2063,52 @@ function CopilotKitHelpModal() {
1990
2063
  children: "Apply for Priority Direct Slack Support"
1991
2064
  }
1992
2065
  ) })
2066
+ ] }),
2067
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("form", { onSubmit: handleSubmit, className: "flex flex-col space-y-2", children: [
2068
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
2069
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { htmlFor: "feedback", className: "block text-sm font-medium text-gray-700 mb-1", children: "Let us know what your issue is:" }),
2070
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2071
+ "textarea",
2072
+ {
2073
+ id: "feedback",
2074
+ rows: 4,
2075
+ className: "w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500",
2076
+ placeholder: "A Loom link / screen recording is always great!",
2077
+ onChange: (e) => setIssueDescription(e.target.value),
2078
+ value: issueDescription,
2079
+ required: true
2080
+ }
2081
+ )
2082
+ ] }),
2083
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
2084
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { htmlFor: "email", className: "block text-sm font-medium text-gray-700 mb-1", children: "Email (optional):" }),
2085
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2086
+ "input",
2087
+ {
2088
+ type: "email",
2089
+ id: "email",
2090
+ className: `w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500 ${emailError ? "border-red-500" : ""}`,
2091
+ placeholder: "Enter your email for follow-up",
2092
+ onChange: (e) => {
2093
+ setEmail(e.target.value);
2094
+ setEmailError("");
2095
+ },
2096
+ value: email
2097
+ }
2098
+ ),
2099
+ emailError && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-red-500 text-sm mt-1", children: emailError })
2100
+ ] }),
2101
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "bg-gray-50 px-4 py-4 sm:px-6 sm:flex sm:flex-row-reverse rounded-b-lg", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2102
+ "button",
2103
+ {
2104
+ type: "submit",
2105
+ onClick: handleSubmit,
2106
+ disabled: submitButtonDisabled,
2107
+ style: submitButtonDisabled ? { backgroundColor: "rgb(216, 216, 216)", color: "rgb(129, 129, 129)" } : void 0,
2108
+ className: "w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-500 text-base font-medium text-white hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm disabled:shadow-none",
2109
+ children: submitting ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LoadingSpinnerIcon, { color: "white" }) : "Submit"
2110
+ }
2111
+ ) })
1993
2112
  ] })
1994
2113
  ] })
1995
2114
  }