@copilotkit/react-core 1.9.2-next.8 → 1.9.2-next.9

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 (99) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/{chunk-CCESTGAM.mjs → chunk-3OQM3NEK.mjs} +2 -2
  3. package/dist/{chunk-T4ZKC4X4.mjs → chunk-3YHYWAHK.mjs} +2 -2
  4. package/dist/{chunk-ISYBUDL4.mjs → chunk-55QZ2SVJ.mjs} +4 -5
  5. package/dist/chunk-55QZ2SVJ.mjs.map +1 -0
  6. package/dist/chunk-57K2ZJ5F.mjs +348 -0
  7. package/dist/chunk-57K2ZJ5F.mjs.map +1 -0
  8. package/dist/{chunk-ZHEEHGLS.mjs → chunk-ADIITPD2.mjs} +8 -5
  9. package/dist/{chunk-ZHEEHGLS.mjs.map → chunk-ADIITPD2.mjs.map} +1 -1
  10. package/dist/{chunk-S4BOATBG.mjs → chunk-EF5BNM34.mjs} +2 -2
  11. package/dist/{chunk-I4JPQECN.mjs → chunk-EXU7GWLC.mjs} +4 -4
  12. package/dist/{chunk-7G6RR4HE.mjs → chunk-FXK6RQIN.mjs} +2 -2
  13. package/dist/{chunk-JXF732XG.mjs → chunk-G7LYGERN.mjs} +80 -13
  14. package/dist/chunk-G7LYGERN.mjs.map +1 -0
  15. package/dist/{chunk-VJCHRQ7Q.mjs → chunk-JDEWNLNP.mjs} +37 -4
  16. package/dist/chunk-JDEWNLNP.mjs.map +1 -0
  17. package/dist/{chunk-JHIZ5HAI.mjs → chunk-NQVCZQ5T.mjs} +3 -3
  18. package/dist/{chunk-VF6UPRKM.mjs → chunk-OF4SZTLL.mjs} +3 -3
  19. package/dist/{chunk-QQZLIEXK.mjs → chunk-SJJNFYGQ.mjs} +3 -3
  20. package/dist/{chunk-RN3ZRHI7.mjs → chunk-WOGURSAL.mjs} +5 -5
  21. package/dist/chunk-YAF2LATQ.mjs +310 -0
  22. package/dist/chunk-YAF2LATQ.mjs.map +1 -0
  23. package/dist/components/copilot-provider/copilot-messages.js +35 -2
  24. package/dist/components/copilot-provider/copilot-messages.js.map +1 -1
  25. package/dist/components/copilot-provider/copilot-messages.mjs +2 -2
  26. package/dist/components/copilot-provider/copilotkit.js +289 -234
  27. package/dist/components/copilot-provider/copilotkit.js.map +1 -1
  28. package/dist/components/copilot-provider/copilotkit.mjs +7 -7
  29. package/dist/components/copilot-provider/index.js +289 -234
  30. package/dist/components/copilot-provider/index.js.map +1 -1
  31. package/dist/components/copilot-provider/index.mjs +7 -7
  32. package/dist/components/error-boundary/error-boundary.js +135 -146
  33. package/dist/components/error-boundary/error-boundary.js.map +1 -1
  34. package/dist/components/error-boundary/error-boundary.mjs +4 -4
  35. package/dist/components/error-boundary/error-utils.js.map +1 -1
  36. package/dist/components/error-boundary/error-utils.mjs +2 -2
  37. package/dist/components/index.js +289 -234
  38. package/dist/components/index.js.map +1 -1
  39. package/dist/components/index.mjs +7 -7
  40. package/dist/components/toast/toast-provider.js +118 -85
  41. package/dist/components/toast/toast-provider.js.map +1 -1
  42. package/dist/components/toast/toast-provider.mjs +1 -1
  43. package/dist/components/usage-banner.js +135 -146
  44. package/dist/components/usage-banner.js.map +1 -1
  45. package/dist/components/usage-banner.mjs +1 -1
  46. package/dist/hooks/index.js +75 -10
  47. package/dist/hooks/index.js.map +1 -1
  48. package/dist/hooks/index.mjs +14 -14
  49. package/dist/hooks/use-chat.js +72 -10
  50. package/dist/hooks/use-chat.js.map +1 -1
  51. package/dist/hooks/use-chat.mjs +4 -4
  52. package/dist/hooks/use-coagent-state-render.js.map +1 -1
  53. package/dist/hooks/use-coagent-state-render.mjs +2 -2
  54. package/dist/hooks/use-coagent.js +75 -10
  55. package/dist/hooks/use-coagent.js.map +1 -1
  56. package/dist/hooks/use-coagent.mjs +10 -10
  57. package/dist/hooks/use-copilot-action.js.map +1 -1
  58. package/dist/hooks/use-copilot-action.mjs +3 -3
  59. package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
  60. package/dist/hooks/use-copilot-authenticated-action.mjs +4 -4
  61. package/dist/hooks/use-copilot-chat.js +72 -10
  62. package/dist/hooks/use-copilot-chat.js.map +1 -1
  63. package/dist/hooks/use-copilot-chat.mjs +9 -9
  64. package/dist/hooks/use-copilot-runtime-client.js +1 -1
  65. package/dist/hooks/use-copilot-runtime-client.js.map +1 -1
  66. package/dist/hooks/use-copilot-runtime-client.mjs +2 -2
  67. package/dist/hooks/use-langgraph-interrupt.js +72 -10
  68. package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
  69. package/dist/hooks/use-langgraph-interrupt.mjs +10 -10
  70. package/dist/index.js +363 -243
  71. package/dist/index.js.map +1 -1
  72. package/dist/index.mjs +15 -15
  73. package/dist/lib/copilot-task.mjs +8 -8
  74. package/dist/lib/index.mjs +8 -8
  75. package/dist/utils/extract.mjs +7 -7
  76. package/dist/utils/index.mjs +7 -7
  77. package/package.json +3 -3
  78. package/src/components/copilot-provider/copilot-messages.tsx +42 -3
  79. package/src/components/toast/toast-provider.tsx +49 -24
  80. package/src/components/usage-banner.tsx +144 -147
  81. package/src/hooks/use-chat.ts +106 -6
  82. package/src/hooks/use-coagent.ts +5 -0
  83. package/src/hooks/use-copilot-runtime-client.ts +2 -39
  84. package/dist/chunk-HD2GE3DK.mjs +0 -359
  85. package/dist/chunk-HD2GE3DK.mjs.map +0 -1
  86. package/dist/chunk-ISYBUDL4.mjs.map +0 -1
  87. package/dist/chunk-JXF732XG.mjs.map +0 -1
  88. package/dist/chunk-VJCHRQ7Q.mjs.map +0 -1
  89. package/dist/chunk-VRXANACV.mjs +0 -277
  90. package/dist/chunk-VRXANACV.mjs.map +0 -1
  91. /package/dist/{chunk-CCESTGAM.mjs.map → chunk-3OQM3NEK.mjs.map} +0 -0
  92. /package/dist/{chunk-T4ZKC4X4.mjs.map → chunk-3YHYWAHK.mjs.map} +0 -0
  93. /package/dist/{chunk-S4BOATBG.mjs.map → chunk-EF5BNM34.mjs.map} +0 -0
  94. /package/dist/{chunk-I4JPQECN.mjs.map → chunk-EXU7GWLC.mjs.map} +0 -0
  95. /package/dist/{chunk-7G6RR4HE.mjs.map → chunk-FXK6RQIN.mjs.map} +0 -0
  96. /package/dist/{chunk-JHIZ5HAI.mjs.map → chunk-NQVCZQ5T.mjs.map} +0 -0
  97. /package/dist/{chunk-VF6UPRKM.mjs.map → chunk-OF4SZTLL.mjs.map} +0 -0
  98. /package/dist/{chunk-QQZLIEXK.mjs.map → chunk-SJJNFYGQ.mjs.map} +0 -0
  99. /package/dist/{chunk-RN3ZRHI7.mjs.map → chunk-WOGURSAL.mjs.map} +0 -0
@@ -516,12 +516,14 @@ function ToastProvider({
516
516
  border: `1px solid ${colors.border}`,
517
517
  borderLeft: `4px solid ${colors.border}`,
518
518
  borderRadius: "8px",
519
- padding: "10px 14px",
519
+ padding: "12px 16px",
520
520
  fontSize: "13px",
521
521
  boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
522
522
  backdropFilter: "blur(8px)",
523
- maxWidth: "500px",
524
- minWidth: "350px"
523
+ maxWidth: "min(90vw, 700px)",
524
+ width: "100%",
525
+ boxSizing: "border-box",
526
+ overflow: "hidden"
525
527
  },
526
528
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
527
529
  "div",
@@ -533,94 +535,125 @@ function ToastProvider({
533
535
  gap: "10px"
534
536
  },
535
537
  children: [
536
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", flex: 1 }, children: [
537
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
538
- "div",
539
- {
540
- style: {
541
- width: "12px",
542
- height: "12px",
543
- borderRadius: "50%",
544
- backgroundColor: colors.border,
545
- flexShrink: 0
546
- }
547
- }
548
- ),
549
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px", flex: 1 }, children: [
550
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
551
- "div",
552
- {
553
- style: {
554
- color: colors.text,
555
- lineHeight: "1.4",
556
- fontWeight: "400",
557
- fontSize: "13px",
558
- flex: 1,
559
- wordWrap: "break-word",
560
- overflowWrap: "break-word",
561
- hyphens: "auto"
562
- },
563
- children: (() => {
564
- const message = bannerError.message;
565
- const markdownLinkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
566
- const plainUrlRegex = /(https?:\/\/[^\s)]+)/g;
567
- let cleanMessage = message.replace(markdownLinkRegex, "").replace(plainUrlRegex, "").replace(/See more:\s*/g, "").replace(/\s+/g, " ").trim();
568
- if (cleanMessage.length > 120) {
569
- cleanMessage = cleanMessage.substring(0, 117) + "...";
538
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
539
+ "div",
540
+ {
541
+ style: {
542
+ display: "flex",
543
+ alignItems: "center",
544
+ gap: "8px",
545
+ flex: 1,
546
+ minWidth: 0
547
+ },
548
+ children: [
549
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
550
+ "div",
551
+ {
552
+ style: {
553
+ width: "12px",
554
+ height: "12px",
555
+ borderRadius: "50%",
556
+ backgroundColor: colors.border,
557
+ flexShrink: 0
570
558
  }
571
- return cleanMessage;
572
- })()
573
- }
574
- ),
575
- (() => {
576
- const message = bannerError.message;
577
- const markdownLinkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
578
- const plainUrlRegex = /(https?:\/\/[^\s)]+)/g;
579
- let url = null;
580
- let buttonText = "See More";
581
- const markdownMatch = markdownLinkRegex.exec(message);
582
- if (markdownMatch) {
583
- url = markdownMatch[2];
584
- buttonText = "See More";
585
- } else {
586
- const urlMatch = plainUrlRegex.exec(message);
587
- if (urlMatch) {
588
- url = urlMatch[0];
589
- buttonText = "See More";
590
559
  }
591
- }
592
- if (!url)
593
- return null;
594
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
595
- "button",
560
+ ),
561
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
562
+ "div",
596
563
  {
597
- onClick: () => window.open(url, "_blank", "noopener,noreferrer"),
598
564
  style: {
599
- background: colors.border,
600
- color: "white",
601
- border: "none",
602
- borderRadius: "5px",
603
- padding: "4px 10px",
604
- fontSize: "11px",
605
- fontWeight: "500",
606
- cursor: "pointer",
607
- transition: "all 0.2s ease",
608
- flexShrink: 0
609
- },
610
- onMouseEnter: (e) => {
611
- e.currentTarget.style.opacity = "0.9";
612
- e.currentTarget.style.transform = "translateY(-1px)";
613
- },
614
- onMouseLeave: (e) => {
615
- e.currentTarget.style.opacity = "1";
616
- e.currentTarget.style.transform = "translateY(0)";
565
+ display: "flex",
566
+ alignItems: "center",
567
+ gap: "10px",
568
+ flex: 1,
569
+ minWidth: 0
617
570
  },
618
- children: buttonText
571
+ children: [
572
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
573
+ "div",
574
+ {
575
+ style: {
576
+ color: colors.text,
577
+ lineHeight: "1.4",
578
+ fontWeight: "400",
579
+ fontSize: "13px",
580
+ flex: 1,
581
+ wordBreak: "break-all",
582
+ overflowWrap: "break-word",
583
+ maxWidth: "550px",
584
+ overflow: "hidden",
585
+ display: "-webkit-box",
586
+ WebkitLineClamp: 10,
587
+ WebkitBoxOrient: "vertical"
588
+ },
589
+ children: (() => {
590
+ let message = bannerError.message;
591
+ const jsonMatch = message.match(/'message':\s*'([^']+)'/);
592
+ if (jsonMatch) {
593
+ return jsonMatch[1];
594
+ }
595
+ message = message.split(" - ")[0];
596
+ message = message.split(": Error code")[0];
597
+ message = message.replace(/:\s*\d{3}$/, "");
598
+ message = message.replace(/See more:.*$/g, "");
599
+ message = message.trim();
600
+ return message || "Configuration error occurred.";
601
+ })()
602
+ }
603
+ ),
604
+ (() => {
605
+ const message = bannerError.message;
606
+ const markdownLinkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
607
+ const plainUrlRegex = /(https?:\/\/[^\s)]+)/g;
608
+ let url = null;
609
+ let buttonText = "See More";
610
+ const markdownMatch = markdownLinkRegex.exec(message);
611
+ if (markdownMatch) {
612
+ url = markdownMatch[2];
613
+ buttonText = "See More";
614
+ } else {
615
+ const urlMatch = plainUrlRegex.exec(message);
616
+ if (urlMatch) {
617
+ url = urlMatch[0].replace(/[.,;:'"]*$/, "");
618
+ buttonText = "See More";
619
+ }
620
+ }
621
+ if (!url)
622
+ return null;
623
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
624
+ "button",
625
+ {
626
+ onClick: () => window.open(url, "_blank", "noopener,noreferrer"),
627
+ style: {
628
+ background: colors.border,
629
+ color: "white",
630
+ border: "none",
631
+ borderRadius: "5px",
632
+ padding: "4px 10px",
633
+ fontSize: "11px",
634
+ fontWeight: "500",
635
+ cursor: "pointer",
636
+ transition: "all 0.2s ease",
637
+ flexShrink: 0
638
+ },
639
+ onMouseEnter: (e) => {
640
+ e.currentTarget.style.opacity = "0.9";
641
+ e.currentTarget.style.transform = "translateY(-1px)";
642
+ },
643
+ onMouseLeave: (e) => {
644
+ e.currentTarget.style.opacity = "1";
645
+ e.currentTarget.style.transform = "translateY(0)";
646
+ },
647
+ children: buttonText
648
+ }
649
+ );
650
+ })()
651
+ ]
619
652
  }
620
- );
621
- })()
622
- ] })
623
- ] }),
653
+ )
654
+ ]
655
+ }
656
+ ),
624
657
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
625
658
  "button",
626
659
  {
@@ -673,8 +706,38 @@ function CopilotMessages({ children }) {
673
706
  const lastLoadedThreadId = (0, import_react6.useRef)();
674
707
  const lastLoadedAgentName = (0, import_react6.useRef)();
675
708
  const lastLoadedMessages = (0, import_react6.useRef)();
676
- const { threadId, agentSession, runtimeClient, showDevConsole } = useCopilotContext();
709
+ const { threadId, agentSession, runtimeClient, showDevConsole, onTrace, copilotApiConfig } = useCopilotContext();
677
710
  const { setBannerError } = useToast();
711
+ const traceUIError = (0, import_react6.useCallback)(
712
+ (error, originalError) => __async(this, null, function* () {
713
+ if (!onTrace || !copilotApiConfig.publicApiKey)
714
+ return;
715
+ try {
716
+ const traceEvent = {
717
+ type: "error",
718
+ timestamp: Date.now(),
719
+ context: {
720
+ source: "ui",
721
+ request: {
722
+ operation: "loadAgentState",
723
+ url: copilotApiConfig.chatApiEndpoint,
724
+ startTime: Date.now()
725
+ },
726
+ technical: {
727
+ environment: "browser",
728
+ userAgent: typeof navigator !== "undefined" ? navigator.userAgent : void 0,
729
+ stackTrace: originalError instanceof Error ? originalError.stack : void 0
730
+ }
731
+ },
732
+ error
733
+ };
734
+ yield onTrace(traceEvent);
735
+ } catch (traceError) {
736
+ console.error("Error in CopilotMessages onTrace handler:", traceError);
737
+ }
738
+ }),
739
+ [onTrace, copilotApiConfig.publicApiKey, copilotApiConfig.chatApiEndpoint]
740
+ );
678
741
  const createStructuredError2 = (gqlError) => {
679
742
  const extensions = gqlError.extensions;
680
743
  const originalError = extensions == null ? void 0 : extensions.originalError;
@@ -719,12 +782,14 @@ function CopilotMessages({ children }) {
719
782
  const ckError = createStructuredError2(gqlError);
720
783
  if (ckError) {
721
784
  setBannerError(ckError);
785
+ traceUIError(ckError, gqlError);
722
786
  } else {
723
787
  const fallbackError = new import_shared4.CopilotKitError({
724
788
  message: gqlError.message,
725
789
  code: import_shared4.CopilotKitErrorCode.UNKNOWN
726
790
  });
727
791
  setBannerError(fallbackError);
792
+ traceUIError(fallbackError, gqlError);
728
793
  }
729
794
  };
730
795
  graphQLErrors.forEach(routeError);
@@ -738,10 +803,11 @@ function CopilotMessages({ children }) {
738
803
  code: import_shared4.CopilotKitErrorCode.UNKNOWN
739
804
  });
740
805
  setBannerError(fallbackError);
806
+ traceUIError(fallbackError, error);
741
807
  }
742
808
  }
743
809
  },
744
- [setBannerError, showDevConsole]
810
+ [setBannerError, showDevConsole, traceUIError]
745
811
  );
746
812
  (0, import_react6.useEffect)(() => {
747
813
  if (!threadId || threadId === lastLoadedThreadId.current)
@@ -812,7 +878,7 @@ var useCopilotRuntimeClient = (options) => {
812
878
  startTime: Date.now()
813
879
  },
814
880
  technical: {
815
- environment: process.env.NODE_ENV,
881
+ environment: "browser",
816
882
  userAgent: typeof navigator !== "undefined" ? navigator.userAgent : void 0,
817
883
  stackTrace: originalError instanceof Error ? originalError.stack : void 0
818
884
  }
@@ -978,8 +1044,8 @@ var defaultIcons = {
978
1044
  "svg",
979
1045
  {
980
1046
  viewBox: "0 0 24 24",
981
- width: "18",
982
- height: "18",
1047
+ width: "16",
1048
+ height: "16",
983
1049
  stroke: "currentColor",
984
1050
  strokeWidth: "2.5",
985
1051
  fill: "none",
@@ -996,8 +1062,8 @@ var defaultIcons = {
996
1062
  "svg",
997
1063
  {
998
1064
  viewBox: "0 0 24 24",
999
- width: "18",
1000
- height: "18",
1065
+ width: "16",
1066
+ height: "16",
1001
1067
  stroke: "currentColor",
1002
1068
  strokeWidth: "2.5",
1003
1069
  fill: "none",
@@ -1014,8 +1080,8 @@ var defaultIcons = {
1014
1080
  "svg",
1015
1081
  {
1016
1082
  viewBox: "0 0 24 24",
1017
- width: "18",
1018
- height: "18",
1083
+ width: "16",
1084
+ height: "16",
1019
1085
  stroke: "currentColor",
1020
1086
  strokeWidth: "2.5",
1021
1087
  fill: "none",
@@ -1040,19 +1106,33 @@ function UsageBanner({
1040
1106
  return null;
1041
1107
  }
1042
1108
  const parseMessage = (rawMessage) => {
1043
- const linkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
1044
- const matches = Array.from(rawMessage.matchAll(linkRegex));
1045
- if (matches.length > 0) {
1046
- let cleanMessage2 = rawMessage.replace(/\.\s*See more:\s*\[([^\]]+)\]\(([^)]+)\)/g, ".").replace(/See more:\s*\[([^\]]+)\]\(([^)]+)\)/g, "").trim();
1047
- return cleanMessage2;
1109
+ if (rawMessage.toLowerCase().includes("authentication") || rawMessage.toLowerCase().includes("api key")) {
1110
+ return "Authentication failed. Please check your API key.";
1111
+ }
1112
+ if (rawMessage.toLowerCase().includes("rate limit")) {
1113
+ return "Rate limit exceeded. Please try again later.";
1114
+ }
1115
+ if (rawMessage.toLowerCase().includes("checkpointer")) {
1116
+ return "Agent configuration error. Please check your setup.";
1048
1117
  }
1049
- return rawMessage;
1118
+ let cleanMessage2 = rawMessage;
1119
+ cleanMessage2 = cleanMessage2.split(" - ")[0];
1120
+ cleanMessage2 = cleanMessage2.split(": Error code")[0];
1121
+ cleanMessage2 = cleanMessage2.split(": 401")[0];
1122
+ cleanMessage2 = cleanMessage2.split(": 403")[0];
1123
+ cleanMessage2 = cleanMessage2.split(": 404")[0];
1124
+ cleanMessage2 = cleanMessage2.split(": 500")[0];
1125
+ cleanMessage2 = cleanMessage2.replace(/See more:.*$/g, "").trim();
1126
+ if (cleanMessage2.includes("{") || cleanMessage2.includes("'") || cleanMessage2.length > 60) {
1127
+ return "Configuration error. Please check your setup.";
1128
+ }
1129
+ return cleanMessage2 || "An error occurred. Please check your configuration.";
1050
1130
  };
1051
1131
  const cleanMessage = parseMessage(message);
1052
1132
  const Icon = icon || defaultIcons[severity];
1053
1133
  const themeConfigs = {
1054
1134
  [import_shared7.Severity.INFO]: {
1055
- bg: "linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%)",
1135
+ bg: "rgba(239, 246, 255, 0.95)",
1056
1136
  border: "#93c5fd",
1057
1137
  text: "#1e40af",
1058
1138
  icon: "#3b82f6",
@@ -1060,7 +1140,7 @@ function UsageBanner({
1060
1140
  primaryBtnHover: "#2563eb"
1061
1141
  },
1062
1142
  [import_shared7.Severity.WARNING]: {
1063
- bg: "linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%)",
1143
+ bg: "rgba(255, 251, 235, 0.95)",
1064
1144
  border: "#fbbf24",
1065
1145
  text: "#92400e",
1066
1146
  icon: "#f59e0b",
@@ -1068,7 +1148,7 @@ function UsageBanner({
1068
1148
  primaryBtnHover: "#d97706"
1069
1149
  },
1070
1150
  [import_shared7.Severity.CRITICAL]: {
1071
- bg: "linear-gradient(135deg, #fef2f2 0%, #fecaca 100%)",
1151
+ bg: "rgba(254, 242, 242, 0.95)",
1072
1152
  border: "#f87171",
1073
1153
  text: "#991b1b",
1074
1154
  icon: "#ef4444",
@@ -1082,24 +1162,26 @@ function UsageBanner({
1082
1162
  {
1083
1163
  style: {
1084
1164
  position: "fixed",
1085
- bottom: "20px",
1165
+ bottom: "24px",
1086
1166
  left: "50%",
1087
1167
  transform: "translateX(-50%)",
1088
- maxWidth: "min(95vw, 680px)",
1089
- width: "100%",
1168
+ width: "400px",
1169
+ maxWidth: "90vw",
1090
1170
  zIndex: 1e4,
1091
- animation: "bannerSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1)"
1171
+ animation: "bannerSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1)"
1092
1172
  },
1093
1173
  children: [
1094
1174
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("style", { children: `
1095
1175
  @keyframes bannerSlideIn {
1096
1176
  from {
1097
1177
  opacity: 0;
1098
- transform: translateX(-50%) translateY(10px);
1178
+ transform: translateX(-50%) translateY(20px);
1179
+ scale: 0.95;
1099
1180
  }
1100
1181
  to {
1101
1182
  opacity: 1;
1102
1183
  transform: translateX(-50%) translateY(0);
1184
+ scale: 1;
1103
1185
  }
1104
1186
  }
1105
1187
  ` }),
@@ -1107,17 +1189,16 @@ function UsageBanner({
1107
1189
  "div",
1108
1190
  {
1109
1191
  style: {
1110
- display: "flex",
1111
- alignItems: "flex-start",
1112
- gap: "14px",
1113
- borderRadius: "16px",
1192
+ borderRadius: "12px",
1114
1193
  border: `1px solid ${themeConfig.border}`,
1115
1194
  background: themeConfig.bg,
1116
- padding: "18px 20px",
1117
- boxShadow: "0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)",
1195
+ padding: "14px",
1196
+ boxShadow: "0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08)",
1118
1197
  position: "relative",
1119
- backdropFilter: "blur(10px)",
1120
- WebkitBackdropFilter: "blur(10px)"
1198
+ backdropFilter: "blur(12px)",
1199
+ WebkitBackdropFilter: "blur(12px)",
1200
+ boxSizing: "border-box",
1201
+ overflow: "hidden"
1121
1202
  },
1122
1203
  children: [
1123
1204
  onClose && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
@@ -1126,35 +1207,23 @@ function UsageBanner({
1126
1207
  onClick: onClose,
1127
1208
  style: {
1128
1209
  position: "absolute",
1129
- top: "12px",
1130
- right: "12px",
1131
- background: "rgba(255, 255, 255, 0.8)",
1210
+ top: "8px",
1211
+ right: "8px",
1212
+ background: "rgba(255, 255, 255, 0.9)",
1132
1213
  border: "none",
1133
1214
  color: themeConfig.text,
1134
1215
  cursor: "pointer",
1135
- fontSize: "18px",
1216
+ fontSize: "16px",
1136
1217
  lineHeight: "1",
1137
- padding: "6px",
1138
- borderRadius: "8px",
1139
- opacity: 0.7,
1140
- transition: "all 0.2s ease",
1218
+ padding: "4px",
1219
+ borderRadius: "4px",
1220
+ width: "20px",
1221
+ height: "20px",
1141
1222
  display: "flex",
1142
1223
  alignItems: "center",
1143
- justifyContent: "center",
1144
- width: "28px",
1145
- height: "28px"
1224
+ justifyContent: "center"
1146
1225
  },
1147
1226
  title: "Close",
1148
- onMouseOver: (e) => {
1149
- e.currentTarget.style.opacity = "1";
1150
- e.currentTarget.style.background = "rgba(255, 255, 255, 1)";
1151
- e.currentTarget.style.transform = "scale(1.05)";
1152
- },
1153
- onMouseOut: (e) => {
1154
- e.currentTarget.style.opacity = "0.7";
1155
- e.currentTarget.style.background = "rgba(255, 255, 255, 0.8)";
1156
- e.currentTarget.style.transform = "scale(1)";
1157
- },
1158
1227
  children: "\xD7"
1159
1228
  }
1160
1229
  ),
@@ -1162,106 +1231,92 @@ function UsageBanner({
1162
1231
  "div",
1163
1232
  {
1164
1233
  style: {
1165
- color: themeConfig.icon,
1166
- flexShrink: 0,
1167
- marginTop: "1px",
1168
- padding: "6px",
1169
- borderRadius: "10px",
1170
- background: "rgba(255, 255, 255, 0.7)",
1171
- display: "flex",
1172
- alignItems: "center",
1173
- justifyContent: "center"
1234
+ fontSize: "14px",
1235
+ fontWeight: 500,
1236
+ color: themeConfig.text,
1237
+ lineHeight: "1.4",
1238
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
1239
+ paddingRight: onClose ? "30px" : "0",
1240
+ marginBottom: actions ? "12px" : "0",
1241
+ wordBreak: "break-word",
1242
+ overflow: "hidden",
1243
+ textOverflow: "ellipsis",
1244
+ display: "-webkit-box",
1245
+ WebkitLineClamp: 2,
1246
+ WebkitBoxOrient: "vertical"
1174
1247
  },
1175
- children: Icon
1248
+ children: cleanMessage
1176
1249
  }
1177
1250
  ),
1178
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { flex: 1, paddingRight: onClose ? "40px" : "0" }, children: [
1179
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1180
- "div",
1181
- {
1182
- style: {
1183
- fontSize: "15px",
1184
- fontWeight: 600,
1185
- color: themeConfig.text,
1186
- lineHeight: "1.5",
1187
- marginBottom: actions ? "12px" : "0",
1188
- fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
1189
- },
1190
- children: cleanMessage
1191
- }
1192
- ),
1193
- actions && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1194
- "div",
1195
- {
1196
- style: {
1197
- display: "flex",
1198
- gap: "10px",
1199
- flexWrap: "wrap"
1200
- },
1201
- children: [
1202
- actions.secondary && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1203
- "button",
1204
- {
1205
- onClick: actions.secondary.onClick,
1206
- style: {
1207
- borderRadius: "10px",
1208
- padding: "8px 16px",
1209
- fontSize: "14px",
1210
- fontWeight: 500,
1211
- color: themeConfig.text,
1212
- backgroundColor: "rgba(255, 255, 255, 0.8)",
1213
- border: `1.5px solid ${themeConfig.border}`,
1214
- cursor: "pointer",
1215
- transition: "all 0.2s ease",
1216
- fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
1217
- },
1218
- onMouseOver: (e) => {
1219
- e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 1)";
1220
- e.currentTarget.style.transform = "translateY(-1px)";
1221
- e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.15)";
1222
- },
1223
- onMouseOut: (e) => {
1224
- e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.8)";
1225
- e.currentTarget.style.transform = "translateY(0)";
1226
- e.currentTarget.style.boxShadow = "none";
1227
- },
1228
- children: actions.secondary.label
1229
- }
1230
- ),
1231
- actions.primary && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1232
- "button",
1233
- {
1234
- onClick: actions.primary.onClick,
1235
- style: {
1236
- borderRadius: "10px",
1237
- padding: "8px 16px",
1238
- fontSize: "14px",
1239
- fontWeight: 600,
1240
- color: "#fff",
1241
- backgroundColor: themeConfig.primaryBtn,
1242
- border: "none",
1243
- cursor: "pointer",
1244
- transition: "all 0.2s ease",
1245
- boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
1246
- fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
1247
- },
1248
- onMouseOver: (e) => {
1249
- e.currentTarget.style.backgroundColor = themeConfig.primaryBtnHover;
1250
- e.currentTarget.style.transform = "translateY(-1px)";
1251
- e.currentTarget.style.boxShadow = "0 6px 16px rgba(0, 0, 0, 0.2)";
1252
- },
1253
- onMouseOut: (e) => {
1254
- e.currentTarget.style.backgroundColor = themeConfig.primaryBtn;
1255
- e.currentTarget.style.transform = "translateY(0)";
1256
- e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.15)";
1257
- },
1258
- children: actions.primary.label
1259
- }
1260
- )
1261
- ]
1262
- }
1263
- )
1264
- ] })
1251
+ actions && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1252
+ "div",
1253
+ {
1254
+ style: {
1255
+ display: "flex",
1256
+ gap: "8px",
1257
+ flexWrap: "wrap"
1258
+ },
1259
+ children: [
1260
+ actions.secondary && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1261
+ "button",
1262
+ {
1263
+ onClick: actions.secondary.onClick,
1264
+ style: {
1265
+ borderRadius: "8px",
1266
+ padding: "6px 12px",
1267
+ fontSize: "13px",
1268
+ fontWeight: 500,
1269
+ color: themeConfig.text,
1270
+ backgroundColor: "rgba(255, 255, 255, 0.9)",
1271
+ border: `1px solid ${themeConfig.border}`,
1272
+ cursor: "pointer",
1273
+ transition: "all 0.2s ease",
1274
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
1275
+ },
1276
+ onMouseOver: (e) => {
1277
+ e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 1)";
1278
+ e.currentTarget.style.transform = "translateY(-1px)";
1279
+ },
1280
+ onMouseOut: (e) => {
1281
+ e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.9)";
1282
+ e.currentTarget.style.transform = "translateY(0)";
1283
+ },
1284
+ children: actions.secondary.label
1285
+ }
1286
+ ),
1287
+ actions.primary && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1288
+ "button",
1289
+ {
1290
+ onClick: actions.primary.onClick,
1291
+ style: {
1292
+ borderRadius: "8px",
1293
+ padding: "6px 12px",
1294
+ fontSize: "13px",
1295
+ fontWeight: 600,
1296
+ color: "#fff",
1297
+ backgroundColor: themeConfig.primaryBtn,
1298
+ border: "none",
1299
+ cursor: "pointer",
1300
+ transition: "all 0.2s ease",
1301
+ boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)",
1302
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
1303
+ },
1304
+ onMouseOver: (e) => {
1305
+ e.currentTarget.style.backgroundColor = themeConfig.primaryBtnHover;
1306
+ e.currentTarget.style.transform = "translateY(-1px)";
1307
+ e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.2)";
1308
+ },
1309
+ onMouseOut: (e) => {
1310
+ e.currentTarget.style.backgroundColor = themeConfig.primaryBtn;
1311
+ e.currentTarget.style.transform = "translateY(0)";
1312
+ e.currentTarget.style.boxShadow = "0 2px 8px rgba(0, 0, 0, 0.15)";
1313
+ },
1314
+ children: actions.primary.label
1315
+ }
1316
+ )
1317
+ ]
1318
+ }
1319
+ )
1265
1320
  ]
1266
1321
  }
1267
1322
  )