@copilotkit/react-core 1.63.2 → 1.64.0
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/copilotkit-BE1n5tSI.d.mts.map +1 -1
- package/dist/copilotkit-CXvuYw_F.d.cts.map +1 -1
- package/dist/{copilotkit-CN2JVeH3.mjs → copilotkit-D_Ao1X-u.mjs} +117 -100
- package/dist/copilotkit-D_Ao1X-u.mjs.map +1 -0
- package/dist/{copilotkit-DDVfoiRM.cjs → copilotkit-DiLTL1ZM.cjs} +119 -102
- package/dist/copilotkit-DiLTL1ZM.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.umd.js +22 -63
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/headless.cjs +96 -60
- package/dist/v2/headless.cjs.map +1 -1
- package/dist/v2/headless.d.cts +30 -2
- package/dist/v2/headless.d.cts.map +1 -1
- package/dist/v2/headless.d.mts +19 -3
- package/dist/v2/headless.d.mts.map +1 -1
- package/dist/v2/headless.mjs +100 -72
- package/dist/v2/headless.mjs.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.mjs +1 -1
- package/dist/v2/index.umd.js +118 -101
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +7 -7
- package/skills/react-core/references/threads.md +1 -2
- package/dist/copilotkit-CN2JVeH3.mjs.map +0 -1
- package/dist/copilotkit-DDVfoiRM.cjs.map +0 -1
package/dist/v2/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_copilotkit = require('../copilotkit-
|
|
4
|
+
const require_copilotkit = require('../copilotkit-DiLTL1ZM.cjs');
|
|
5
5
|
require("./index.css");
|
|
6
6
|
let _copilotkit_a2ui_renderer = require("@copilotkit/a2ui-renderer");
|
|
7
7
|
|
package/dist/v2/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { $ as useCapabilities, A as CopilotChatMessageView, At as CopilotChatConfigurationProvider, B as CopilotChatAssistantMessage_default, C as CopilotModalHeader, Ct as CopilotKitInspector, D as CopilotChat, Dt as CopilotChatInput_default, E as DefaultOpenIcon, Et as CopilotKitCoreReact, F as CopilotChatSuggestionView, G as useLearnFromUserActionInCurrentThread, H as useLearningContainersInCurrentThread, I as CopilotChatSuggestionPill, J as useThreads, K as useLearnFromUserAction, L as CopilotChatReasoningMessage_default, M as IntelligenceIndicator, N as getIntelligenceTurnAnchors, O as CopilotChatView_default, Ot as AudioRecorderError, P as IntelligenceIndicatorView, Q as useAgentContext, R as CopilotChatUserMessage_default, S as CopilotSidebarView, St as ɵrunMcpFollowUp, T as DefaultCloseIcon, Tt as useCopilotKit, U as useLearningContainers, V as CopilotChatToolCallsView, W as useAttachments, X as useConfigureSuggestions, Y as useInterrupt, Z as useSuggestions, _ as WildcardToolCallRender, _t as SandboxFunctionsContext, at as useComponent, b as CopilotSidebar, bt as MCPAppsActivityRenderer, ct as useRenderCustomMessages, dt as createA2UIMessageRenderer, et as UseAgentUpdate, ft as GenerateSandboxedUiArgsSchema, gt as OpenGenerativeUIToolRenderer, ht as OpenGenerativeUIContentSchema, it as useRenderTool, j as INTELLIGENCE_TURN_HEAD, jt as useCopilotChatConfiguration, k as CopilotChatAttachmentQueue, kt as CopilotChatAudioRecorder, lt as CopilotKitProvider, mt as OpenGenerativeUIActivityType, nt as useHumanInTheLoop, ot as useFrontendTool, pt as OpenGenerativeUIActivityRenderer, q as useMemories, rt as useDefaultRenderTool, st as useRenderActivityMessage, t as CopilotKit, tt as useAgent, ut as defineToolCallRenderer, v as CopilotThreadsDrawer, vt as useSandboxFunctions, w as CopilotChatToggleButton, wt as useRenderToolCall, x as CopilotPopupView, xt as MCPAppsActivityType, y as CopilotPopup, yt as MCPAppsActivityContentSchema, z as CopilotChatAttachmentRenderer } from "../copilotkit-
|
|
3
|
+
import { $ as useCapabilities, A as CopilotChatMessageView, At as CopilotChatConfigurationProvider, B as CopilotChatAssistantMessage_default, C as CopilotModalHeader, Ct as CopilotKitInspector, D as CopilotChat, Dt as CopilotChatInput_default, E as DefaultOpenIcon, Et as CopilotKitCoreReact, F as CopilotChatSuggestionView, G as useLearnFromUserActionInCurrentThread, H as useLearningContainersInCurrentThread, I as CopilotChatSuggestionPill, J as useThreads, K as useLearnFromUserAction, L as CopilotChatReasoningMessage_default, M as IntelligenceIndicator, N as getIntelligenceTurnAnchors, O as CopilotChatView_default, Ot as AudioRecorderError, P as IntelligenceIndicatorView, Q as useAgentContext, R as CopilotChatUserMessage_default, S as CopilotSidebarView, St as ɵrunMcpFollowUp, T as DefaultCloseIcon, Tt as useCopilotKit, U as useLearningContainers, V as CopilotChatToolCallsView, W as useAttachments, X as useConfigureSuggestions, Y as useInterrupt, Z as useSuggestions, _ as WildcardToolCallRender, _t as SandboxFunctionsContext, at as useComponent, b as CopilotSidebar, bt as MCPAppsActivityRenderer, ct as useRenderCustomMessages, dt as createA2UIMessageRenderer, et as UseAgentUpdate, ft as GenerateSandboxedUiArgsSchema, gt as OpenGenerativeUIToolRenderer, ht as OpenGenerativeUIContentSchema, it as useRenderTool, j as INTELLIGENCE_TURN_HEAD, jt as useCopilotChatConfiguration, k as CopilotChatAttachmentQueue, kt as CopilotChatAudioRecorder, lt as CopilotKitProvider, mt as OpenGenerativeUIActivityType, nt as useHumanInTheLoop, ot as useFrontendTool, pt as OpenGenerativeUIActivityRenderer, q as useMemories, rt as useDefaultRenderTool, st as useRenderActivityMessage, t as CopilotKit, tt as useAgent, ut as defineToolCallRenderer, v as CopilotThreadsDrawer, vt as useSandboxFunctions, w as CopilotChatToggleButton, wt as useRenderToolCall, x as CopilotPopupView, xt as MCPAppsActivityType, y as CopilotPopup, yt as MCPAppsActivityContentSchema, z as CopilotChatAttachmentRenderer } from "../copilotkit-D_Ao1X-u.mjs";
|
|
4
4
|
import "./index.css";
|
|
5
5
|
import { defaultTheme as a2uiDefaultTheme } from "@copilotkit/a2ui-renderer";
|
|
6
6
|
|
package/dist/v2/index.umd.js
CHANGED
|
@@ -37,7 +37,7 @@ react = __toESM(react);
|
|
|
37
37
|
_radix_ui_react_tooltip = __toESM(_radix_ui_react_tooltip);
|
|
38
38
|
_radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
39
39
|
|
|
40
|
-
//#region src/v2/lib/
|
|
40
|
+
//#region src/v2/lib/shallow-stable-ref.ts
|
|
41
41
|
/**
|
|
42
42
|
* Shallow equality comparison for objects.
|
|
43
43
|
*/
|
|
@@ -77,64 +77,6 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
77
77
|
ref.current = value;
|
|
78
78
|
return ref.current;
|
|
79
79
|
}
|
|
80
|
-
/**
|
|
81
|
-
* Check if a value is a React component type (function, class, forwardRef, memo, etc.)
|
|
82
|
-
*/
|
|
83
|
-
function isReactComponentType(value) {
|
|
84
|
-
if (typeof value === "function") return true;
|
|
85
|
-
if (value && typeof value === "object" && "$$typeof" in value && !react.default.isValidElement(value)) return true;
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Internal function to render a slot value as a React element (non-memoized).
|
|
90
|
-
*/
|
|
91
|
-
function renderSlotElement(slot, DefaultComponent, props) {
|
|
92
|
-
if (typeof slot === "string") {
|
|
93
|
-
const existingClassName = props.className;
|
|
94
|
-
return react.default.createElement(DefaultComponent, {
|
|
95
|
-
...props,
|
|
96
|
-
className: (0, tailwind_merge.twMerge)(existingClassName, slot)
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
if (isReactComponentType(slot)) return react.default.createElement(slot, props);
|
|
100
|
-
if (slot && typeof slot === "object" && !react.default.isValidElement(slot)) return react.default.createElement(DefaultComponent, {
|
|
101
|
-
...props,
|
|
102
|
-
...slot
|
|
103
|
-
});
|
|
104
|
-
return react.default.createElement(DefaultComponent, props);
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Internal memoized wrapper component for renderSlot.
|
|
108
|
-
* Uses forwardRef to support ref forwarding.
|
|
109
|
-
*/
|
|
110
|
-
const MemoizedSlotWrapper = react.default.memo(react.default.forwardRef(function MemoizedSlotWrapper(props, ref) {
|
|
111
|
-
const { $slot, $component, ...rest } = props;
|
|
112
|
-
return renderSlotElement($slot, $component, ref !== null ? {
|
|
113
|
-
...rest,
|
|
114
|
-
ref
|
|
115
|
-
} : rest);
|
|
116
|
-
}), (prev, next) => {
|
|
117
|
-
if (prev.$slot !== next.$slot) return false;
|
|
118
|
-
if (prev.$component !== next.$component) return false;
|
|
119
|
-
const { $slot: _ps, $component: _pc, ...prevRest } = prev;
|
|
120
|
-
const { $slot: _ns, $component: _nc, ...nextRest } = next;
|
|
121
|
-
return shallowEqual(prevRest, nextRest);
|
|
122
|
-
});
|
|
123
|
-
/**
|
|
124
|
-
* Renders a slot value as a memoized React element.
|
|
125
|
-
* Automatically prevents unnecessary re-renders using shallow prop comparison.
|
|
126
|
-
* Supports ref forwarding.
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* renderSlot(customInput, CopilotChatInput, { onSubmit: handleSubmit })
|
|
130
|
-
*/
|
|
131
|
-
function renderSlot(slot, DefaultComponent, props) {
|
|
132
|
-
return react.default.createElement(MemoizedSlotWrapper, {
|
|
133
|
-
...props,
|
|
134
|
-
$slot: slot,
|
|
135
|
-
$component: DefaultComponent
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
80
|
|
|
139
81
|
//#endregion
|
|
140
82
|
//#region src/v2/providers/CopilotChatConfigurationProvider.tsx
|
|
@@ -342,9 +284,9 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
342
284
|
|
|
343
285
|
//#endregion
|
|
344
286
|
//#region src/v2/lib/utils.ts
|
|
345
|
-
const twMerge$
|
|
287
|
+
const twMerge$9 = (0, tailwind_merge.extendTailwindMerge)({ prefix: "cpk" });
|
|
346
288
|
function cn(...inputs) {
|
|
347
|
-
return twMerge$
|
|
289
|
+
return twMerge$9((0, clsx.clsx)(inputs));
|
|
348
290
|
}
|
|
349
291
|
|
|
350
292
|
//#endregion
|
|
@@ -438,12 +380,13 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
438
380
|
...props
|
|
439
381
|
}) });
|
|
440
382
|
}
|
|
441
|
-
function TooltipTrigger({ ...props }) {
|
|
383
|
+
const TooltipTrigger = react.forwardRef(function TooltipTrigger({ ...props }, ref) {
|
|
442
384
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_tooltip.Trigger, {
|
|
385
|
+
ref,
|
|
443
386
|
"data-slot": "tooltip-trigger",
|
|
444
387
|
...props
|
|
445
388
|
});
|
|
446
|
-
}
|
|
389
|
+
});
|
|
447
390
|
function TooltipContent({ className, sideOffset = 0, children, ...props }) {
|
|
448
391
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_tooltip.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_tooltip.Content, {
|
|
449
392
|
"data-copilotkit": true,
|
|
@@ -463,12 +406,13 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
463
406
|
...props
|
|
464
407
|
});
|
|
465
408
|
}
|
|
466
|
-
function DropdownMenuTrigger({ ...props }) {
|
|
409
|
+
const DropdownMenuTrigger = react.forwardRef(function DropdownMenuTrigger({ ...props }, ref) {
|
|
467
410
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Trigger, {
|
|
411
|
+
ref,
|
|
468
412
|
"data-slot": "dropdown-menu-trigger",
|
|
469
413
|
...props
|
|
470
414
|
});
|
|
471
|
-
}
|
|
415
|
+
});
|
|
472
416
|
function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
|
|
473
417
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Content, {
|
|
474
418
|
"data-copilotkit": true,
|
|
@@ -717,6 +661,67 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
717
661
|
});
|
|
718
662
|
CopilotChatAudioRecorder.displayName = "CopilotChatAudioRecorder";
|
|
719
663
|
|
|
664
|
+
//#endregion
|
|
665
|
+
//#region src/v2/lib/slots.tsx
|
|
666
|
+
/**
|
|
667
|
+
* Check if a value is a React component type (function, class, forwardRef, memo, etc.)
|
|
668
|
+
*/
|
|
669
|
+
function isReactComponentType(value) {
|
|
670
|
+
if (typeof value === "function") return true;
|
|
671
|
+
if (value && typeof value === "object" && "$$typeof" in value && !react.default.isValidElement(value)) return true;
|
|
672
|
+
return false;
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Internal function to render a slot value as a React element (non-memoized).
|
|
676
|
+
*/
|
|
677
|
+
function renderSlotElement(slot, DefaultComponent, props) {
|
|
678
|
+
if (typeof slot === "string") {
|
|
679
|
+
const existingClassName = props.className;
|
|
680
|
+
return react.default.createElement(DefaultComponent, {
|
|
681
|
+
...props,
|
|
682
|
+
className: (0, tailwind_merge.twMerge)(existingClassName, slot)
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
if (isReactComponentType(slot)) return react.default.createElement(slot, props);
|
|
686
|
+
if (slot && typeof slot === "object" && !react.default.isValidElement(slot)) return react.default.createElement(DefaultComponent, {
|
|
687
|
+
...props,
|
|
688
|
+
...slot
|
|
689
|
+
});
|
|
690
|
+
return react.default.createElement(DefaultComponent, props);
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Internal memoized wrapper component for renderSlot.
|
|
694
|
+
* Uses forwardRef to support ref forwarding.
|
|
695
|
+
*/
|
|
696
|
+
const MemoizedSlotWrapper = react.default.memo(react.default.forwardRef(function MemoizedSlotWrapper(props, ref) {
|
|
697
|
+
const { $slot, $component, ...rest } = props;
|
|
698
|
+
return renderSlotElement($slot, $component, ref !== null ? {
|
|
699
|
+
...rest,
|
|
700
|
+
ref
|
|
701
|
+
} : rest);
|
|
702
|
+
}), (prev, next) => {
|
|
703
|
+
if (prev.$slot !== next.$slot) return false;
|
|
704
|
+
if (prev.$component !== next.$component) return false;
|
|
705
|
+
const { $slot: _ps, $component: _pc, ...prevRest } = prev;
|
|
706
|
+
const { $slot: _ns, $component: _nc, ...nextRest } = next;
|
|
707
|
+
return shallowEqual(prevRest, nextRest);
|
|
708
|
+
});
|
|
709
|
+
/**
|
|
710
|
+
* Renders a slot value as a memoized React element.
|
|
711
|
+
* Automatically prevents unnecessary re-renders using shallow prop comparison.
|
|
712
|
+
* Supports ref forwarding.
|
|
713
|
+
*
|
|
714
|
+
* @example
|
|
715
|
+
* renderSlot(customInput, CopilotChatInput, { onSubmit: handleSubmit })
|
|
716
|
+
*/
|
|
717
|
+
function renderSlot(slot, DefaultComponent, props) {
|
|
718
|
+
return react.default.createElement(MemoizedSlotWrapper, {
|
|
719
|
+
...props,
|
|
720
|
+
$slot: slot,
|
|
721
|
+
$component: DefaultComponent
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
|
|
720
725
|
//#endregion
|
|
721
726
|
//#region src/v2/components/chat/CopilotChatInput.tsx
|
|
722
727
|
const SLASH_MENU_MAX_VISIBLE_ITEMS = 5;
|
|
@@ -1070,7 +1075,6 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
1070
1075
|
}
|
|
1071
1076
|
if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
|
|
1072
1077
|
if (window.matchMedia("(max-width: 767px)").matches) {
|
|
1073
|
-
ensureMeasurements();
|
|
1074
1078
|
adjustTextareaHeight();
|
|
1075
1079
|
updateLayout("expanded");
|
|
1076
1080
|
return;
|
|
@@ -4424,17 +4428,15 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4424
4428
|
const status = copilotkit.runtimeConnectionStatus;
|
|
4425
4429
|
if (isRuntimeConfigured && (status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Disconnected || status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Connecting)) {
|
|
4426
4430
|
const cached = provisionalAgentCache.current.get(resolvedAgentId);
|
|
4427
|
-
if (cached) {
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
isReady: false
|
|
4432
|
-
};
|
|
4433
|
-
}
|
|
4431
|
+
if (cached) return {
|
|
4432
|
+
agent: cached,
|
|
4433
|
+
isReady: false
|
|
4434
|
+
};
|
|
4434
4435
|
const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
|
|
4435
4436
|
runtimeUrl: copilotkit.runtimeUrl,
|
|
4436
4437
|
agentId: resolvedAgentId,
|
|
4437
4438
|
transport: copilotkit.runtimeTransport,
|
|
4439
|
+
credentials: copilotkit.credentials,
|
|
4438
4440
|
runtimeMode: "pending"
|
|
4439
4441
|
});
|
|
4440
4442
|
copilotkit.applyHeadersToAgent(provisional);
|
|
@@ -4446,17 +4448,15 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4446
4448
|
}
|
|
4447
4449
|
if (isRuntimeConfigured && status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Error) {
|
|
4448
4450
|
const cached = provisionalAgentCache.current.get(resolvedAgentId);
|
|
4449
|
-
if (cached) {
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
isReady: false
|
|
4454
|
-
};
|
|
4455
|
-
}
|
|
4451
|
+
if (cached) return {
|
|
4452
|
+
agent: cached,
|
|
4453
|
+
isReady: false
|
|
4454
|
+
};
|
|
4456
4455
|
const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
|
|
4457
4456
|
runtimeUrl: copilotkit.runtimeUrl,
|
|
4458
4457
|
agentId: resolvedAgentId,
|
|
4459
4458
|
transport: copilotkit.runtimeTransport,
|
|
4459
|
+
credentials: copilotkit.credentials,
|
|
4460
4460
|
runtimeMode: "pending"
|
|
4461
4461
|
});
|
|
4462
4462
|
copilotkit.applyHeadersToAgent(provisional);
|
|
@@ -4475,6 +4475,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4475
4475
|
copilotkit.runtimeConnectionStatus,
|
|
4476
4476
|
copilotkit.runtimeUrl,
|
|
4477
4477
|
copilotkit.runtimeTransport,
|
|
4478
|
+
copilotkit.credentials,
|
|
4478
4479
|
JSON.stringify(copilotkit.headers)
|
|
4479
4480
|
]);
|
|
4480
4481
|
(0, react.useEffect)(() => {
|
|
@@ -4514,7 +4515,12 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4514
4515
|
]);
|
|
4515
4516
|
(0, react.useEffect)(() => {
|
|
4516
4517
|
if (agent instanceof _ag_ui_client.HttpAgent) copilotkit.applyHeadersToAgent(agent);
|
|
4517
|
-
|
|
4518
|
+
if (agent instanceof _copilotkit_core.ProxiedCopilotRuntimeAgent) agent.credentials = copilotkit.credentials;
|
|
4519
|
+
}, [
|
|
4520
|
+
agent,
|
|
4521
|
+
JSON.stringify(copilotkit.headers),
|
|
4522
|
+
copilotkit.credentials
|
|
4523
|
+
]);
|
|
4518
4524
|
const configThreadId = chatConfig?.threadId;
|
|
4519
4525
|
const configHasExplicitThreadId = chatConfig?.hasExplicitThreadId;
|
|
4520
4526
|
(0, react.useEffect)(() => {
|
|
@@ -9077,27 +9083,35 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
9077
9083
|
|
|
9078
9084
|
//#endregion
|
|
9079
9085
|
//#region src/v2/components/chat/CopilotPopup.tsx
|
|
9086
|
+
const PopupShellPropsContext = react.default.createContext({});
|
|
9087
|
+
const PopupViewOverride = (viewProps) => {
|
|
9088
|
+
const { header: viewHeader, toggleButton: viewToggleButton, width: viewWidth, height: viewHeight, clickOutsideToClose: viewClickOutsideToClose, defaultOpen: viewDefaultOpen, ...restProps } = viewProps;
|
|
9089
|
+
const shell = (0, react.useContext)(PopupShellPropsContext);
|
|
9090
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotPopupView_default, {
|
|
9091
|
+
...restProps,
|
|
9092
|
+
header: shell.header ?? viewHeader,
|
|
9093
|
+
toggleButton: shell.toggleButton ?? viewToggleButton,
|
|
9094
|
+
width: shell.width ?? viewWidth,
|
|
9095
|
+
height: shell.height ?? viewHeight,
|
|
9096
|
+
clickOutsideToClose: shell.clickOutsideToClose ?? viewClickOutsideToClose,
|
|
9097
|
+
defaultOpen: shell.defaultOpen ?? viewDefaultOpen
|
|
9098
|
+
});
|
|
9099
|
+
};
|
|
9100
|
+
const PopupViewOverrideWithStatics = Object.assign(PopupViewOverride, CopilotChatView_default);
|
|
9080
9101
|
function CopilotPopup({ header, toggleButton, defaultOpen, width, height, clickOutsideToClose, ...chatProps }) {
|
|
9081
9102
|
const { checkFeature } = useLicenseContext();
|
|
9082
9103
|
const isPopupLicensed = checkFeature("popup");
|
|
9083
9104
|
(0, react.useEffect)(() => {
|
|
9084
9105
|
if (!isPopupLicensed) console.warn("[CopilotKit] Warning: \"popup\" feature is not licensed. Visit copilotkit.ai/pricing");
|
|
9085
9106
|
}, [isPopupLicensed]);
|
|
9086
|
-
const
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
|
|
9092
|
-
|
|
9093
|
-
|
|
9094
|
-
height: height ?? viewHeight,
|
|
9095
|
-
clickOutsideToClose: clickOutsideToClose ?? viewClickOutsideToClose,
|
|
9096
|
-
defaultOpen: defaultOpen ?? viewDefaultOpen
|
|
9097
|
-
});
|
|
9098
|
-
};
|
|
9099
|
-
return Object.assign(Component, CopilotChatView_default);
|
|
9100
|
-
}, [
|
|
9107
|
+
const shellProps = (0, react.useMemo)(() => ({
|
|
9108
|
+
header,
|
|
9109
|
+
toggleButton,
|
|
9110
|
+
width,
|
|
9111
|
+
height,
|
|
9112
|
+
clickOutsideToClose,
|
|
9113
|
+
defaultOpen
|
|
9114
|
+
}), [
|
|
9101
9115
|
clickOutsideToClose,
|
|
9102
9116
|
header,
|
|
9103
9117
|
toggleButton,
|
|
@@ -9105,11 +9119,14 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
9105
9119
|
width,
|
|
9106
9120
|
defaultOpen
|
|
9107
9121
|
]);
|
|
9108
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [!isPopupLicensed && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InlineFeatureWarning, { featureName: "Popup" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
9109
|
-
|
|
9110
|
-
|
|
9111
|
-
|
|
9112
|
-
|
|
9122
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [!isPopupLicensed && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InlineFeatureWarning, { featureName: "Popup" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PopupShellPropsContext.Provider, {
|
|
9123
|
+
value: shellProps,
|
|
9124
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChat, {
|
|
9125
|
+
welcomeScreen: CopilotPopupView_default.WelcomeScreen,
|
|
9126
|
+
...chatProps,
|
|
9127
|
+
isModalDefaultOpen: defaultOpen,
|
|
9128
|
+
chatView: PopupViewOverrideWithStatics
|
|
9129
|
+
})
|
|
9113
9130
|
})] });
|
|
9114
9131
|
}
|
|
9115
9132
|
CopilotPopup.displayName = "CopilotPopup";
|