@copilotkit/vue 2.0.0-rc.2 → 2.0.0-rc.20
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/PARITY.md +3 -3
- package/dist/hooks/use-copilot-action.d.ts.map +1 -1
- package/dist/hooks/use-frontend-tool.d.ts +1 -1
- package/dist/hooks/use-frontend-tool.d.ts.map +1 -1
- package/dist/hooks/zod-parameters.d.ts +14 -0
- package/dist/hooks/zod-parameters.d.ts.map +1 -0
- package/dist/index.cjs +1 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +353 -16908
- package/dist/index.mjs.map +1 -1
- package/dist/use-render-activity-message-CsWYyd6r.cjs +91 -0
- package/dist/use-render-activity-message-CsWYyd6r.cjs.map +1 -0
- package/dist/use-render-activity-message-DntKKNdd.js +17418 -0
- package/dist/use-render-activity-message-DntKKNdd.js.map +1 -0
- package/dist/v2/components/InlineFeatureWarning.vue.d.ts.map +1 -1
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts +2 -2
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts.map +1 -1
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts +13 -45
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts +1 -1
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts +13 -5
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts.map +1 -1
- package/dist/v2/components/a2ui/catalog.d.ts.map +1 -1
- package/dist/v2/components/a2ui/utils.d.ts.map +1 -1
- package/dist/v2/components/a2ui.d.ts +3 -7
- package/dist/v2/components/a2ui.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChat.vue.d.ts +2 -2
- package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAttachmentRenderer.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts +6 -270
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatInspectorButton.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallItem.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatUserMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts +2 -2
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatWorkSummary.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts +8 -3
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts +5 -3
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts +5 -3
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts +8 -3
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts +5 -3
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts +5 -3
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts +0 -1
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts.map +1 -1
- package/dist/v2/components/chat/forwarded-slots.d.ts +12 -0
- package/dist/v2/components/chat/forwarded-slots.d.ts.map +1 -0
- package/dist/v2/components/chat/index.d.ts +28 -25
- package/dist/v2/components/chat/index.d.ts.map +1 -1
- package/dist/v2/components/chat/inspector-shortcuts.d.ts +2 -1
- package/dist/v2/components/chat/inspector-shortcuts.d.ts.map +1 -1
- package/dist/v2/components/chat/message-feedback.d.ts +18 -49
- package/dist/v2/components/chat/message-feedback.d.ts.map +1 -1
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts +2 -2
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts.map +1 -1
- package/dist/v2/components/chat/tool-call-display-context.d.ts +2 -19
- package/dist/v2/components/chat/tool-call-display-context.d.ts.map +1 -1
- package/dist/v2/components/chat/tool-call-group-parts.d.ts +7 -20
- package/dist/v2/components/chat/tool-call-group-parts.d.ts.map +1 -1
- package/dist/v2/components/chat/turn-work.d.ts +0 -2
- package/dist/v2/components/chat/turn-work.d.ts.map +1 -1
- package/dist/v2/components/chat/types.d.ts +8 -3
- package/dist/v2/components/chat/types.d.ts.map +1 -1
- package/dist/v2/components/chat/use-chat-labels.d.ts +8 -0
- package/dist/v2/components/chat/use-chat-labels.d.ts.map +1 -0
- package/dist/v2/components/chat/use-copy-feedback.d.ts +11 -0
- package/dist/v2/components/chat/use-copy-feedback.d.ts.map +1 -0
- package/dist/v2/components/icons/index.d.ts +968 -1
- package/dist/v2/components/icons/index.d.ts.map +1 -1
- package/dist/v2/hooks/use-attachments.d.ts.map +1 -1
- package/dist/v2/hooks/use-frontend-tool.d.ts +5 -0
- package/dist/v2/hooks/use-frontend-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-keyboard-height.d.ts +1 -1
- package/dist/v2/hooks/use-keyboard-height.d.ts.map +1 -1
- package/dist/v2/hooks/use-pin-to-send.d.ts +4 -12
- package/dist/v2/hooks/use-pin-to-send.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-activity-message.d.ts +13 -9
- package/dist/v2/hooks/use-render-activity-message.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-custom-messages.d.ts +5 -7
- package/dist/v2/hooks/use-render-custom-messages.d.ts.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.mjs +197 -200
- package/dist/v2/index.mjs.map +1 -1
- package/dist/v2/lib/is-mobile-viewport.d.ts +1 -14
- package/dist/v2/lib/is-mobile-viewport.d.ts.map +1 -1
- package/dist/v2/lib/processPartialHtml.d.ts +1 -2
- package/dist/v2/lib/processPartialHtml.d.ts.map +1 -1
- package/dist/v2/lib/shallow-stable.d.ts.map +1 -1
- package/dist/v2/lib/vue-core.d.ts +0 -1
- package/dist/v2/lib/vue-core.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.types.d.ts +0 -5
- package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts +1 -1
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/markdown-renderer.d.ts +2 -2
- package/dist/v2/providers/markdown-renderer.d.ts.map +1 -1
- package/dist/v2/providers/types.d.ts +3 -46
- package/dist/v2/providers/types.d.ts.map +1 -1
- package/dist/v2/types/human-in-the-loop.d.ts +8 -29
- package/dist/v2/types/human-in-the-loop.d.ts.map +1 -1
- package/dist/v2/types/interrupt.d.ts +1 -22
- package/dist/v2/types/interrupt.d.ts.map +1 -1
- package/dist/v2/types/vue-activity-message-renderer.d.ts +16 -15
- package/dist/v2/types/vue-activity-message-renderer.d.ts.map +1 -1
- package/dist/v2/types/vue-custom-message-renderer.d.ts +7 -16
- package/dist/v2/types/vue-custom-message-renderer.d.ts.map +1 -1
- package/dist/v2/types/vue-tool-call-renderer.d.ts +16 -35
- package/dist/v2/types/vue-tool-call-renderer.d.ts.map +1 -1
- package/package.json +10 -11
- package/src/__tests__/build-entries.test.ts +27 -0
- package/src/hooks/__tests__/zod-parameters.test.ts +520 -0
- package/src/hooks/use-copilot-action.ts +2 -1
- package/src/hooks/use-frontend-tool.ts +3 -6
- package/src/hooks/zod-parameters.ts +162 -0
- package/src/v2/components/A2UIMessageRenderer.ts +3 -3
- package/src/v2/components/InlineFeatureWarning.vue +20 -21
- package/src/v2/components/LicenseWarningBanner.vue +27 -135
- package/src/v2/components/OpenGenerativeUIRenderer.ts +51 -373
- package/src/v2/components/__tests__/A2UICatalogContext.test.ts +1 -1
- package/src/v2/components/__tests__/LicenseWarningBanner.test.ts +60 -0
- package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.ts +55 -6
- package/src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts +1 -1
- package/src/v2/components/a2ui/A2UICatalogContext.ts +10 -102
- package/src/v2/components/a2ui/A2UIRecoveryStates.ts +1 -1
- package/src/v2/components/a2ui/catalog.ts +1 -0
- package/src/v2/components/a2ui/utils.ts +2 -0
- package/src/v2/components/a2ui.ts +1 -1
- package/src/v2/components/chat/CopilotChat.vue +19 -40
- package/src/v2/components/chat/CopilotChatAssistantMessage.vue +19 -43
- package/src/v2/components/chat/CopilotChatAttachmentQueue.vue +14 -10
- package/src/v2/components/chat/CopilotChatAttachmentRenderer.vue +14 -6
- package/src/v2/components/chat/CopilotChatFeedbackCommentPopover.vue +2 -2
- package/src/v2/components/chat/CopilotChatInput.vue +40 -30
- package/src/v2/components/chat/CopilotChatInspectorButton.vue +45 -108
- package/src/v2/components/chat/CopilotChatMessageView.vue +72 -140
- package/src/v2/components/chat/CopilotChatReasoningMessage.vue +7 -15
- package/src/v2/components/chat/CopilotChatToolCallGroup.vue +60 -37
- package/src/v2/components/chat/CopilotChatToolCallItem.vue +3 -3
- package/src/v2/components/chat/CopilotChatToolCallsView.vue +15 -13
- package/src/v2/components/chat/CopilotChatUserMessage.vue +24 -112
- package/src/v2/components/chat/CopilotChatView.vue +5 -5
- package/src/v2/components/chat/CopilotChatWorkSummary.vue +26 -36
- package/src/v2/components/chat/CopilotModalHeader.vue +11 -23
- package/src/v2/components/chat/CopilotPopup.vue +23 -25
- package/src/v2/components/chat/CopilotPopupView.vue +10 -39
- package/src/v2/components/chat/CopilotPopupViewInternal.vue +14 -34
- package/src/v2/components/chat/CopilotSidebar.vue +23 -25
- package/src/v2/components/chat/CopilotSidebarView.vue +10 -39
- package/src/v2/components/chat/CopilotSidebarViewInternal.vue +14 -34
- package/src/v2/components/chat/StreamingMarkdownDefault.vue +4 -4
- package/src/v2/components/chat/__tests__/CopilotChat.labels.test.ts +19 -4
- package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.ts +26 -9
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.learningFeedback.test.ts +5 -5
- package/src/v2/components/chat/__tests__/CopilotChatInput.test.ts +33 -1
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.test.ts +247 -403
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.toolCallDisplay.test.ts +1 -99
- package/src/v2/components/chat/__tests__/CopilotPopup.test.ts +90 -1
- package/src/v2/components/chat/__tests__/CopilotSidebar.test.ts +90 -1
- package/src/v2/components/chat/copilotChatToolCallItemRender.ts +3 -19
- package/src/v2/components/chat/forwarded-slots.ts +17 -0
- package/src/v2/components/chat/index.ts +0 -1
- package/src/v2/components/chat/inspector-shortcuts.ts +10 -16
- package/src/v2/components/chat/message-feedback.ts +62 -197
- package/src/v2/components/chat/normalize-auto-scroll.ts +3 -17
- package/src/v2/components/chat/tool-call-display-context.ts +2 -23
- package/src/v2/components/chat/tool-call-group-parts.ts +44 -85
- package/src/v2/components/chat/turn-work.ts +0 -9
- package/src/v2/components/chat/types.ts +12 -4
- package/src/v2/components/chat/use-chat-labels.ts +16 -0
- package/src/v2/components/chat/use-copy-feedback.ts +21 -0
- package/src/v2/components/icons/__tests__/icons.test.ts +72 -68
- package/src/v2/components/icons/index.ts +109 -27
- package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.ts +62 -1
- package/src/v2/hooks/__tests__/use-render-activity-message.test.ts +105 -0
- package/src/v2/hooks/__tests__/use-render-tool.test.ts +3 -6
- package/src/v2/hooks/__tests__/zod-regression.test.ts +5 -4
- package/src/v2/hooks/use-attachments.ts +6 -2
- package/src/v2/hooks/use-frontend-tool.ts +10 -10
- package/src/v2/hooks/use-keyboard-height.ts +17 -40
- package/src/v2/hooks/use-pin-to-send.ts +15 -99
- package/src/v2/hooks/use-render-activity-message.ts +27 -48
- package/src/v2/hooks/use-render-custom-messages.ts +14 -35
- package/src/v2/lib/__tests__/shallow-stable.test.ts +54 -0
- package/src/v2/lib/is-mobile-viewport.ts +5 -23
- package/src/v2/lib/processPartialHtml.ts +6 -21
- package/src/v2/lib/shallow-stable.ts +2 -16
- package/src/v2/lib/vue-core.ts +9 -13
- package/src/v2/providers/CopilotKitProvider.types.ts +0 -5
- package/src/v2/providers/CopilotKitProvider.vue +53 -112
- package/src/v2/providers/__tests__/CopilotKitProvider.a2ui.test.ts +1 -1
- package/src/v2/providers/__tests__/CopilotKitProvider.headersAtSendTime.test.ts +3 -3
- package/src/v2/providers/__tests__/CopilotKitProvider.learning.test.ts +3 -1
- package/src/v2/providers/__tests__/CopilotKitProvider.test.ts +17 -33
- package/src/v2/providers/markdown-renderer.ts +2 -2
- package/src/v2/providers/types.ts +3 -49
- package/src/v2/types/__tests__/defineToolCallRenderer.test.ts +28 -33
- package/src/v2/types/defineToolCallRenderer.ts +5 -4
- package/src/v2/types/human-in-the-loop.ts +8 -32
- package/src/v2/types/interrupt.ts +7 -31
- package/src/v2/types/vue-activity-message-renderer.ts +24 -15
- package/src/v2/types/vue-custom-message-renderer.ts +12 -16
- package/src/v2/types/vue-tool-call-renderer.ts +23 -38
- package/tsconfig.json +0 -1
- package/vite.config.ts +3 -4
- package/dist/v2/components/chat/BasicMarkdown.vue.d.ts +0 -9
- package/dist/v2/components/chat/BasicMarkdown.vue.d.ts.map +0 -1
- package/dist/v2/components/chat/tool-call-layout.d.ts +0 -115
- package/dist/v2/components/chat/tool-call-layout.d.ts.map +0 -1
- package/dist/v2/lib/message-feedback.d.ts +0 -33
- package/dist/v2/lib/message-feedback.d.ts.map +0 -1
- package/dist/v2/lib/transcription-client.d.ts +0 -19
- package/dist/v2/lib/transcription-client.d.ts.map +0 -1
- package/src/v2/components/chat/BasicMarkdown.vue +0 -160
- package/src/v2/components/chat/__tests__/BasicMarkdown.test.ts +0 -69
- package/src/v2/components/chat/__tests__/normalize-auto-scroll.test.ts +0 -39
- package/src/v2/components/chat/tool-call-layout.ts +0 -304
- package/src/v2/lib/__tests__/is-mobile-viewport.test.ts +0 -48
- package/src/v2/lib/__tests__/message-feedback.test.ts +0 -152
- package/src/v2/lib/__tests__/processPartialHtml.test.ts +0 -84
- package/src/v2/lib/__tests__/transcription-client.test.ts +0 -67
- package/src/v2/lib/message-feedback.ts +0 -120
- package/src/v2/lib/transcription-client.ts +0 -151
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computed, defineComponent, h } from "vue";
|
|
2
2
|
import type { PropType } from "vue";
|
|
3
|
-
import
|
|
3
|
+
import * as z from "zod";
|
|
4
4
|
import type { VueActivityMessageRenderer } from "../types";
|
|
5
5
|
import type { A2UITheme } from "../types";
|
|
6
6
|
import A2UISurfaceActivityRenderer from "./A2UISurfaceActivityRenderer.vue";
|
|
@@ -31,7 +31,7 @@ export type A2UIMessageRendererOptions = {
|
|
|
31
31
|
* The `a2ui-surface` activity carries the WHOLE generative-UI lifecycle on one
|
|
32
32
|
* stable messageId: pre-paint `status` ("building" | "retrying" | "failed")
|
|
33
33
|
* with recovery detail, then `a2ui_operations` on paint. The states swap in
|
|
34
|
-
* place, so the painted surface replaces the skeleton. `.
|
|
34
|
+
* place, so the painted surface replaces the skeleton. `.loose()` keeps
|
|
35
35
|
* the operations and any future fields.
|
|
36
36
|
*/
|
|
37
37
|
const A2UISurfaceContentSchema = z
|
|
@@ -39,7 +39,7 @@ const A2UISurfaceContentSchema = z
|
|
|
39
39
|
a2ui_operations: z.array(z.any()).optional(),
|
|
40
40
|
...A2UILifecycleFields,
|
|
41
41
|
})
|
|
42
|
-
.
|
|
42
|
+
.loose();
|
|
43
43
|
|
|
44
44
|
export function createA2UIMessageRenderer(
|
|
45
45
|
options: A2UIMessageRendererOptions,
|
|
@@ -1,35 +1,34 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import {
|
|
4
|
+
ɵINLINE_FEATURE_WARNING_STYLE,
|
|
5
|
+
ɵgetInlineFeatureWarningSpec,
|
|
6
|
+
} from "@copilotkit/core";
|
|
7
|
+
import { useChatLabels } from "./chat/use-chat-labels";
|
|
8
|
+
|
|
9
|
+
const props = defineProps<{
|
|
3
10
|
featureName: string;
|
|
4
11
|
}>();
|
|
5
12
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
borderRadius: "6px",
|
|
11
|
-
fontSize: "13px",
|
|
12
|
-
color: "#92400e",
|
|
13
|
-
fontFamily:
|
|
14
|
-
"-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif",
|
|
15
|
-
} as const;
|
|
16
|
-
|
|
17
|
-
const linkStyle = {
|
|
18
|
-
color: "#b45309",
|
|
19
|
-
textDecoration: "underline",
|
|
20
|
-
} as const;
|
|
13
|
+
const labels = useChatLabels();
|
|
14
|
+
const spec = computed(() =>
|
|
15
|
+
ɵgetInlineFeatureWarningSpec(props.featureName, labels.value),
|
|
16
|
+
);
|
|
21
17
|
</script>
|
|
22
18
|
|
|
23
19
|
<template>
|
|
24
|
-
<div
|
|
25
|
-
|
|
20
|
+
<div
|
|
21
|
+
:style="ɵINLINE_FEATURE_WARNING_STYLE.container"
|
|
22
|
+
data-testid="copilot-inline-feature-warning"
|
|
23
|
+
>
|
|
24
|
+
{{ spec.message }}
|
|
26
25
|
<a
|
|
27
|
-
href="
|
|
26
|
+
:href="spec.actionUrl"
|
|
28
27
|
target="_blank"
|
|
29
28
|
rel="noopener noreferrer"
|
|
30
|
-
:style="
|
|
29
|
+
:style="ɵINLINE_FEATURE_WARNING_STYLE.link"
|
|
31
30
|
>
|
|
32
|
-
|
|
31
|
+
{{ spec.actionLabel }}
|
|
33
32
|
</a>
|
|
34
33
|
</div>
|
|
35
34
|
</template>
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, onBeforeUnmount, onMounted } from "vue";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
| "no_license"
|
|
11
|
-
| "expired"
|
|
12
|
-
| "expiring"
|
|
13
|
-
| "invalid"
|
|
14
|
-
| "feature_unlicensed";
|
|
3
|
+
import {
|
|
4
|
+
ɵLICENSE_BANNER_STYLE,
|
|
5
|
+
ɵgetLicenseBannerSpec,
|
|
6
|
+
ɵreserveLicenseBannerOffset,
|
|
7
|
+
} from "@copilotkit/core";
|
|
8
|
+
import type { ɵLicenseBannerType } from "@copilotkit/core";
|
|
9
|
+
import { useChatLabels } from "./chat/use-chat-labels";
|
|
15
10
|
|
|
16
11
|
const props = withDefaults(
|
|
17
12
|
defineProps<{
|
|
18
|
-
type:
|
|
13
|
+
type: ɵLicenseBannerType;
|
|
19
14
|
featureName?: string;
|
|
20
15
|
expiryDate?: string;
|
|
21
16
|
graceRemaining?: number;
|
|
@@ -29,152 +24,49 @@ const props = withDefaults(
|
|
|
29
24
|
},
|
|
30
25
|
);
|
|
31
26
|
|
|
32
|
-
|
|
33
|
-
severity: "info" | "warning" | "critical";
|
|
34
|
-
message: string;
|
|
35
|
-
actionLabel: string;
|
|
36
|
-
actionUrl: string;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const spec = computed<BannerSpec | null>(() => {
|
|
40
|
-
switch (props.type) {
|
|
41
|
-
case "no_license":
|
|
42
|
-
return {
|
|
43
|
-
severity: "info",
|
|
44
|
-
message: "Powered by CopilotKit",
|
|
45
|
-
actionLabel: "Get a license",
|
|
46
|
-
actionUrl: "https://copilotkit.ai/pricing",
|
|
47
|
-
};
|
|
48
|
-
case "feature_unlicensed":
|
|
49
|
-
return {
|
|
50
|
-
severity: "warning",
|
|
51
|
-
message: `⚠ The "${props.featureName ?? ""}" feature requires a CopilotKit license.`,
|
|
52
|
-
actionLabel: "Get a license",
|
|
53
|
-
actionUrl: "https://copilotkit.ai/pricing",
|
|
54
|
-
};
|
|
55
|
-
case "expiring": {
|
|
56
|
-
const days = props.graceRemaining;
|
|
57
|
-
const dayLabel = days === 1 ? "day" : "days";
|
|
58
|
-
return {
|
|
59
|
-
severity: "warning",
|
|
60
|
-
message: `Your CopilotKit license expires in ${days} ${dayLabel}. Please renew.`,
|
|
61
|
-
actionLabel: "Renew",
|
|
62
|
-
actionUrl: "https://dashboard.operations.copilotkit.ai",
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
case "expired":
|
|
66
|
-
return {
|
|
67
|
-
severity: "critical",
|
|
68
|
-
message: `Your CopilotKit license expired${props.expiryDate ? ` on ${props.expiryDate}` : ""}. Please renew at copilotkit.ai/pricing`,
|
|
69
|
-
actionLabel: "Renew now",
|
|
70
|
-
actionUrl: "https://copilotkit.ai/pricing",
|
|
71
|
-
};
|
|
72
|
-
case "invalid":
|
|
73
|
-
return {
|
|
74
|
-
severity: "critical",
|
|
75
|
-
message:
|
|
76
|
-
"Invalid CopilotKit license token. Please check your configuration.",
|
|
77
|
-
actionLabel: "Get a license",
|
|
78
|
-
actionUrl: "https://copilotkit.ai/pricing",
|
|
79
|
-
};
|
|
80
|
-
default:
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
const baseStyle = {
|
|
86
|
-
position: "fixed",
|
|
87
|
-
bottom: "8px",
|
|
88
|
-
left: "50%",
|
|
89
|
-
transform: "translateX(-50%)",
|
|
90
|
-
zIndex: 99999,
|
|
91
|
-
display: "inline-flex",
|
|
92
|
-
alignItems: "center",
|
|
93
|
-
gap: "12px",
|
|
94
|
-
whiteSpace: "nowrap",
|
|
95
|
-
padding: "8px 16px",
|
|
96
|
-
fontSize: "13px",
|
|
97
|
-
fontFamily:
|
|
98
|
-
"-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif",
|
|
99
|
-
borderRadius: "6px",
|
|
100
|
-
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)",
|
|
101
|
-
} as const;
|
|
27
|
+
const labels = useChatLabels();
|
|
102
28
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
case "critical":
|
|
112
|
-
return {
|
|
113
|
-
backgroundColor: "#fef2f2",
|
|
114
|
-
border: "1px solid #fca5a5",
|
|
115
|
-
color: "#991b1b",
|
|
116
|
-
};
|
|
117
|
-
default:
|
|
118
|
-
return {
|
|
119
|
-
backgroundColor: "#eff6ff",
|
|
120
|
-
border: "1px solid #93c5fd",
|
|
121
|
-
color: "#1e40af",
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
});
|
|
29
|
+
// Core picks the text, link, and severity; this component renders them.
|
|
30
|
+
const spec = computed(() =>
|
|
31
|
+
ɵgetLicenseBannerSpec(props.type, labels.value, {
|
|
32
|
+
featureName: props.featureName,
|
|
33
|
+
expiryDate: props.expiryDate,
|
|
34
|
+
graceRemaining: props.graceRemaining,
|
|
35
|
+
}),
|
|
36
|
+
);
|
|
125
37
|
|
|
126
38
|
const containerStyle = computed(() => ({
|
|
127
|
-
|
|
128
|
-
|
|
39
|
+
...ɵLICENSE_BANNER_STYLE.base,
|
|
40
|
+
...ɵLICENSE_BANNER_STYLE.severity[spec.value.severity],
|
|
129
41
|
}));
|
|
130
42
|
|
|
131
43
|
// Publish the banner's reserved bottom offset so the chat input can lift
|
|
132
44
|
// itself above it via padding-bottom: var(--copilotkit-license-banner-offset).
|
|
45
|
+
let releaseOffset: (() => void) | undefined;
|
|
133
46
|
onMounted(() => {
|
|
134
|
-
|
|
135
|
-
document.documentElement.style.setProperty(
|
|
136
|
-
LICENSE_BANNER_OFFSET_VAR,
|
|
137
|
-
`${LICENSE_BANNER_OFFSET_PX}px`,
|
|
138
|
-
);
|
|
47
|
+
releaseOffset = ɵreserveLicenseBannerOffset();
|
|
139
48
|
});
|
|
140
|
-
|
|
141
49
|
onBeforeUnmount(() => {
|
|
142
|
-
|
|
143
|
-
|
|
50
|
+
releaseOffset?.();
|
|
51
|
+
releaseOffset = undefined;
|
|
144
52
|
});
|
|
145
53
|
</script>
|
|
146
54
|
|
|
147
55
|
<template>
|
|
148
|
-
<div
|
|
56
|
+
<div :style="containerStyle" data-testid="copilot-license-banner">
|
|
149
57
|
<span>{{ spec.message }}</span>
|
|
150
|
-
<div
|
|
151
|
-
:style="{
|
|
152
|
-
display: 'flex',
|
|
153
|
-
gap: '8px',
|
|
154
|
-
alignItems: 'center',
|
|
155
|
-
}"
|
|
156
|
-
>
|
|
58
|
+
<div :style="ɵLICENSE_BANNER_STYLE.actions">
|
|
157
59
|
<a
|
|
158
60
|
:href="spec.actionUrl"
|
|
159
61
|
target="_blank"
|
|
160
62
|
rel="noopener noreferrer"
|
|
161
|
-
:style="
|
|
162
|
-
fontWeight: 600,
|
|
163
|
-
textDecoration: 'underline',
|
|
164
|
-
color: 'inherit',
|
|
165
|
-
}"
|
|
63
|
+
:style="ɵLICENSE_BANNER_STYLE.link"
|
|
166
64
|
>
|
|
167
65
|
{{ spec.actionLabel }}
|
|
168
66
|
</a>
|
|
169
67
|
<button
|
|
170
68
|
v-if="props.onDismiss"
|
|
171
|
-
:style="
|
|
172
|
-
background: 'none',
|
|
173
|
-
border: 'none',
|
|
174
|
-
cursor: 'pointer',
|
|
175
|
-
color: 'inherit',
|
|
176
|
-
fontSize: '16px',
|
|
177
|
-
}"
|
|
69
|
+
:style="ɵLICENSE_BANNER_STYLE.dismiss"
|
|
178
70
|
@click="props.onDismiss"
|
|
179
71
|
>
|
|
180
72
|
×
|