@stack-spot/ai-chat-widget 1.22.0-beta.4 → 1.22.0-beta.6

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.
@@ -29,10 +29,14 @@ export interface AIWidgetProps extends WithStyle, CustomMessage {
29
29
  * A boolean indicating whether or not the chat should have a visible header.
30
30
  */
31
31
  hasHeader?: boolean;
32
+ /**
33
+ * URL to redirect to the "Create Agent" page on the portal
34
+ */
35
+ urlCreateAgent?: string;
32
36
  }
33
37
  /**
34
38
  * Renders a Chat Widget according to the closest model found in the React tree (AIWidgetProvider). If no model is found, a global version
35
39
  * of the Chat Widget will be instantiated and used.
36
40
  */
37
- export declare const StackspotAIWidget: ({ username, initialAgents, minimizedActions, prefix, children, className, style, hasHeader, beforeMessage, afterMessage, }: AIWidgetProps) => import("react/jsx-runtime").JSX.Element;
41
+ export declare const StackspotAIWidget: ({ username, initialAgents, minimizedActions, prefix, children, className, style, hasHeader, beforeMessage, afterMessage, urlCreateAgent, }: AIWidgetProps) => import("react/jsx-runtime").JSX.Element;
38
42
  //# sourceMappingURL=StackspotAIWidget.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StackspotAIWidget.d.ts","sourceRoot":"","sources":["../src/StackspotAIWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAKjE,OAAO,cAAc,CAAA;AAGrB,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAI1C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAcxD,MAAM,WAAW,aAAc,SAAQ,SAAS,EAAE,aAAa;IAC7D;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,+HAYzB,aAAa,4CAiDjB,CAAA"}
1
+ {"version":3,"file":"StackspotAIWidget.d.ts","sourceRoot":"","sources":["../src/StackspotAIWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAKjE,OAAO,cAAc,CAAA;AAGrB,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAI1C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAcxD,MAAM,WAAW,aAAc,SAAQ,SAAS,EAAE,aAAa;IAC7D;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,+IAazB,aAAa,4CAiDjB,CAAA"}
@@ -26,7 +26,7 @@ import { Workspaces } from './views/Workspaces/index.js';
26
26
  * Renders a Chat Widget according to the closest model found in the React tree (AIWidgetProvider). If no model is found, a global version
27
27
  * of the Chat Widget will be instantiated and used.
28
28
  */
29
- export const StackspotAIWidget = ({ username, initialAgents, minimizedActions = {}, prefix, children, className, style, hasHeader = true, beforeMessage, afterMessage, }) => {
29
+ export const StackspotAIWidget = ({ username, initialAgents, minimizedActions = {}, prefix, children, className, style, hasHeader = true, beforeMessage, afterMessage, urlCreateAgent, }) => {
30
30
  const rightPanelRef = useRef(null);
31
31
  const chatWindowRef = useRef(null);
32
32
  const currentChat = useCurrentChatMessages();
@@ -37,7 +37,7 @@ export const StackspotAIWidget = ({ username, initialAgents, minimizedActions =
37
37
  return useMemo(() => (_jsx(FallbackBoundary, { children: _jsx(TooltipProvider, { children: _jsx(RightPanelProvider, { chatWindow: chatWindowRef, panel: rightPanelRef, children: _jsxs("div", { className: listToClass(['ai-chat-widget', isMinimized && 'minimized', className]), translate: "no", style: style, children: [_jsxs("div", { className: "chat-window", ref: chatWindowRef, children: [hasHeader && _jsx(_Fragment, { children: isMinimized
38
38
  ? _jsx(MinimizedHeader, { ...minimizedActions })
39
39
  : _jsx(ChatTabSelection, {}) }), _jsxs("div", { className: "chat-container", children: [_jsxs("div", { className: "chat-content", children: [prefix, isCurrentChatEmpty
40
- ? (children ?? _jsx(Home, { username: username, initialAgents: initialAgents }))
40
+ ? (children ?? _jsx(Home, { username: username, initialAgents: initialAgents, urlCreateAgent: urlCreateAgent }))
41
41
  : _jsx(Chat, { username: username, beforeMessage: beforeMessage, afterMessage: afterMessage })] }), features.messageInput && _jsx(MessageInput, {})] })] }), _jsx(Stacks, {}), !isTrial && _jsx(Workspaces, {}), _jsx(KnowledgeSources, {}), _jsx(KSDocument, {}), _jsx(Agents, {}), _jsx(Editor, {}), _jsx(ChatHistory, {}), _jsx(Steps, {}), _jsx(Tools, {}), _jsx("div", { className: "chat-right-panel", ref: rightPanelRef, children: _jsx(RightPanel, {}) })] }) }) }) })), [isCurrentChatEmpty, username, isMinimized, children, initialAgents]);
42
42
  };
43
43
  //# sourceMappingURL=StackspotAIWidget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StackspotAIWidget.js","sourceRo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aAAa,YAAE,KAAC,UAAU,KAAG,GAAM,IACtE,GACa,GACL,GACD,CACpB,EAAE,CAAC,kBAAkB,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAA;AAC1E,CAAC,CAAA"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stack-spot/ai-chat-widget",
3
- "version": "1.22.0-beta.4",
4
- "date": "Tue May 27 2025 19:19:09 GMT-0300 (Horário Padrão de Brasília)",
3
+ "version": "1.22.0-beta.6",
4
+ "date": "Wed May 28 2025 11:45:22 GMT-0300 (Horário Padrão de Brasília)",
5
5
  "dependencies": [
6
6
  {
7
7
  "name": "@stack-spot/app-metadata",
@@ -0,0 +1,4 @@
1
+ export declare const AgentCardCreate: ({ urlCreateAgent }: {
2
+ urlCreateAgent: string;
3
+ }) => import("react/jsx-runtime").JSX.Element;
4
+ //# sourceMappingURL=AgentCardCreate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentCardCreate.d.ts","sourceRoot":"","sources":["../../../src/components/AgentCard/AgentCardCreate.tsx"],"names":[],"mappings":"AA6BA,eAAO,MAAM,eAAe,uBAAwB;IAAE,cAAc,EAAE,MAAM,CAAA;CAAG,4CAc9E,CAAA"}
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { IconBox, Text } from '@citric/core';
3
+ import { PlusMini } from '@citric/icons';
4
+ import { theme } from '@stack-spot/portal-theme';
5
+ import { useTranslate } from '@stack-spot/portal-translate';
6
+ import { styled } from 'styled-components';
7
+ import { dictionary } from './dictionary.js';
8
+ const StyledCard = styled.a `
9
+ cursor: pointer;
10
+ border-radius: 8px;
11
+ transition: background-color 0.3s;
12
+ display: flex;
13
+ flex-direction: column;
14
+ gap: 12px;
15
+ border: 1px solid ${theme.color.light[600]};
16
+ text-decoration:none;
17
+
18
+ &:hover {
19
+ background-color: ${theme.color.light[500]};
20
+ }
21
+
22
+ .text-box {
23
+ display: flex;
24
+ flex-direction: column;
25
+ gap: 2px;
26
+ color: ${theme.color.light['contrastText']}
27
+ }
28
+ `;
29
+ export const AgentCardCreate = ({ urlCreateAgent }) => {
30
+ const t = useTranslate(dictionary);
31
+ return (_jsxs(StyledCard, { href: urlCreateAgent, role: "link", tabIndex: 0, className: 'agent-card', children: [_jsx(IconBox, { color: "light", appearance: "square", size: "md", children: _jsx(PlusMini, {}) }), _jsx("div", { className: "text-box", children: _jsx(Text, { appearance: "body2", children: t.create }) })] }));
32
+ };
33
+ //# sourceMappingURL=AgentCardCreate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentCardCreate.js","sourceRoot":"","sources":["../../../src/components/AgentCard/AgentCardCreate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAA;;;;;;;sBAOL,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;wBAIpB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;aAOjC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC;;CAE7C,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAE,cAAc,EAA+B,EAAE,EAAE;IACjF,MAAM,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAA;IAClC,OAAO,CACL,MAAC,UAAU,IAAC,IAAI,EAAE,cAAc,EAAE,IAAI,EAAC,MAAM,EAAC,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,YAAY,aAChF,KAAC,OAAO,IAAC,KAAK,EAAC,OAAO,EAAC,UAAU,EAAC,QAAQ,EAAC,IAAI,EAAC,IAAI,YAClD,KAAC,QAAQ,KAAG,GACJ,EACV,cAAK,SAAS,EAAC,UAAU,YACvB,KAAC,IAAI,IAAC,UAAU,EAAC,OAAO,YACrB,CAAC,CAAC,MAAM,GACJ,GACH,IACK,CACd,CAAA;AACH,CAAC,CAAA"}
@@ -5,6 +5,7 @@ export declare const dictionary: {
5
5
  account: string;
6
6
  shared: string;
7
7
  agent: string;
8
+ create: string;
8
9
  };
9
10
  pt: {
10
11
  builtin: string;
@@ -12,6 +13,7 @@ export declare const dictionary: {
12
13
  account: string;
13
14
  shared: string;
14
15
  agent: string;
16
+ create: string;
15
17
  };
16
18
  };
17
19
  //# sourceMappingURL=dictionary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../src/components/AgentCard/dictionary.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;CAeD,CAAA"}
1
+ {"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../src/components/AgentCard/dictionary.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;CAiBD,CAAA"}
@@ -5,6 +5,7 @@ export const dictionary = {
5
5
  account: 'Account',
6
6
  shared: 'Shared',
7
7
  agent: 'Agent',
8
+ create: 'Create',
8
9
  },
9
10
  pt: {
10
11
  builtin: 'Embutido',
@@ -12,6 +13,7 @@ export const dictionary = {
12
13
  account: 'Conta',
13
14
  shared: 'Compartilhado',
14
15
  agent: 'Agente',
16
+ create: 'Criar',
15
17
  },
16
18
  };
17
19
  //# sourceMappingURL=dictionary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dictionary.js","sourceRoot":"","sources":["../../../src/components/AgentCard/dictionary.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,EAAE,EAAE;QACF,OAAO,EAAE,UAAU;QACnB,QAAQ,EAAE,UAAU;QACpB,OAAO,EAAE,SAAS;QAClB,MAAM,EAAE,QAAQ;QAChB,KAAK,EAAE,OAAO;KACf;IACD,EAAE,EAAE;QACF,OAAO,EAAE,UAAU;QACnB,QAAQ,EAAE,UAAU;QACpB,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE,eAAe;QACvB,KAAK,EAAE,QAAQ;KAChB;CACmB,CAAA"}
1
+ {"version":3,"file":"dictionary.js","sourceRoot":"","sources":["../../../src/components/AgentCard/dictionary.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,EAAE,EAAE;QACF,OAAO,EAAE,UAAU;QACnB,QAAQ,EAAE,UAAU;QACpB,OAAO,EAAE,SAAS;QAClB,MAAM,EAAE,QAAQ;QAChB,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,QAAQ;KACjB;IACD,EAAE,EAAE;QACF,OAAO,EAAE,UAAU;QACnB,QAAQ,EAAE,UAAU;QACpB,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE,eAAe;QACvB,KAAK,EAAE,QAAQ;QACf,MAAM,EAAE,OAAO;KAChB;CACmB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"Code.d.ts","sourceRoot":"","sources":["../../src/components/Code.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAI3C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC,MAAM,MAAM,UAAU,GAAG,CACvB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,KACb,IAAI,CAAA;AAET,KAAK,SAAS,GAAG,KAAK,CAAC,eAAe,CAAC,WAAW,CAAC,GAC/C,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,GAC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GAAG,KAAK,4CA4HpD,CAAA"}
@@ -2,7 +2,8 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
2
2
  /**
3
3
  * Copied from the extension's webview.
4
4
  */
5
- import { AddCode, ChevronDoubleDown, Collapse, Copy } from '@citric/icons';
5
+ import { Text } from '@citric/core';
6
+ import { AddCode, ChevronDoubleDown, Collapse, Copy, Download } from '@citric/icons';
6
7
  import { IconButton } from '@citric/ui';
7
8
  import { theme, useThemeKind } from '@stack-spot/portal-theme';
8
9
  import { useTranslate } from '@stack-spot/portal-translate';
@@ -10,6 +11,7 @@ import { useState } from 'react';
10
11
  import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
11
12
  import { materialDark, vs } from 'react-syntax-highlighter/dist/esm/styles/prism/index.js';
12
13
  import styled from 'styled-components';
14
+ import { languages } from '../utils/programming-languages.js';
13
15
  const CodeBox = styled.code `
14
16
  background: ${theme.color.light[500]};
15
17
  border-radius: 6px;
@@ -31,23 +33,28 @@ const CodeBox = styled.code `
31
33
  }
32
34
  }
33
35
 
34
- .action-bar {
36
+ .header-code {
35
37
  display: flex;
36
38
  flex-direction: row;
37
- justify-content: flex-end;
39
+ justify-content: space-between;
38
40
  background: ${theme.color.light[600]};
39
41
  padding: 4px 6px;
40
42
  border-top-left-radius: 6px;
41
43
  border-top-right-radius: 6px;
42
44
 
43
- button {
44
- background: transparent;
45
- border: none;
46
- opacity: 0.75;
47
- transition: opacity 0.2s;
45
+ .action-bar {
46
+ display: flex;
47
+ flex-direction: row;
48
+
49
+ button {
50
+ background: transparent;
51
+ border: none;
52
+ opacity: 0.75;
53
+ transition: opacity 0.2s;
48
54
 
49
- &:hover {
50
- opacity: 1;
55
+ &:hover {
56
+ opacity: 1;
57
+ }
51
58
  }
52
59
  }
53
60
  }
@@ -74,6 +81,7 @@ export const Code = ({ className, onInsertCode, onNewFile, onCopyCode, language,
74
81
  const match = /language-(\w+)/.exec(className || '');
75
82
  const computedLanguage = language ?? (match ?? [])[1]?.toLowerCase() ?? 'txt';
76
83
  const content = String(children ?? '').replaceAll(/\n\t/g, '\n').trim();
84
+ const languageExtension = languages.find(l => l.value === computedLanguage)?.extensions?.[0] ?? '.txt';
77
85
  function onClickInsert() {
78
86
  onInsertCode?.(content, computedLanguage);
79
87
  }
@@ -93,11 +101,28 @@ export const Code = ({ className, onInsertCode, onNewFile, onCopyCode, language,
93
101
  if (computedLanguage === 'txt') {
94
102
  return (_jsx("code", { ...props, className: className, children: children }));
95
103
  }
96
- return (_jsxs(CodeBox, { className: ['code-box', themeKind, className].join(' '), children: [showActionBar && (_jsxs("div", { className: "action-bar", role: "toolbar", children: [_jsx(IconButton, { "aria-label": showLines ? t.hideLines : t.showLines, title: showLines ? t.hideLines : t.showLines, onClick: () => setShowLines(v => !v), style: { position: 'relative', transform: showLines ? undefined : 'rotate(180deg)', transition: 'transform 0.2s' }, children: _jsx(Collapse, {}) }), _jsx(IconButton, { "aria-label": t.copy, title: t.copy, onClick: onClickCopy, style: { position: 'relative' }, children: _jsx(Copy, {}) }), onInsertCode
97
- ? (_jsx(IconButton, { "aria-label": t.insert, title: t.insert, onClick: onClickInsert, style: { position: 'relative' }, children: _jsx(ChevronDoubleDown, { style: { transform: 'rotate(90deg)' } }) }))
98
- : null, onNewFile
99
- ? (_jsx(IconButton, { "aria-label": t.newFile, title: t.newFile, onClick: onClickNewFile, style: { position: 'relative' }, children: _jsx(AddCode, {}) }))
100
- : null] })), _jsx("div", { children: _jsx(SyntaxHighlighter, { ...props, className: "highlighter", style: themeKind === 'dark' ? materialDark : vs, language: computedLanguage, PreTag: "div", showLineNumbers: showLines, lineNumberContainerStyle: lineNumbersStyle, lineNumberStyle: lineNumbersStyle, children: content }) })] }));
104
+ return (_jsxs(CodeBox, { className: ['code-box', themeKind, className].join(' '), children: [showActionBar && (_jsxs("div", { className: "header-code", children: [_jsx("div", { children: _jsx(Text, { appearance: "code2", children: computedLanguage ?? '' }) }), _jsxs("div", { className: "action-bar", role: "toolbar", children: [_jsx(IconButton, { "aria-label": showLines ? t.hideLines : t.showLines, title: showLines ? t.hideLines : t.showLines, onClick: () => setShowLines(v => !v), style: { position: 'relative', transform: showLines ? undefined : 'rotate(180deg)', transition: 'transform 0.2s' }, children: _jsx(Collapse, {}) }), _jsx(IconButton, { "aria-label": t.downloadCode, title: t.downloadCode, onClick: () => {
105
+ try {
106
+ const extension = languageExtension;
107
+ const filename = `download${extension}`;
108
+ const blob = new Blob([content], { type: 'text/plain;charset=utf-8' });
109
+ const link = document.createElement('a');
110
+ link.href = URL.createObjectURL(blob);
111
+ link.download = filename;
112
+ document.body.appendChild(link);
113
+ link.click();
114
+ document.body.removeChild(link);
115
+ URL.revokeObjectURL(link.href);
116
+ }
117
+ catch (e) {
118
+ // eslint-disable-next-line no-console
119
+ console.error(t.downloadError, e);
120
+ }
121
+ }, children: _jsx(Download, {}) }), _jsx(IconButton, { "aria-label": t.copy, title: t.copy, onClick: onClickCopy, style: { position: 'relative' }, children: _jsx(Copy, {}) }), onInsertCode
122
+ ? (_jsx(IconButton, { "aria-label": t.insert, title: t.insert, onClick: onClickInsert, style: { position: 'relative' }, children: _jsx(ChevronDoubleDown, { style: { transform: 'rotate(90deg)' } }) }))
123
+ : null, onNewFile
124
+ ? (_jsx(IconButton, { "aria-label": t.newFile, title: t.newFile, onClick: onClickNewFile, style: { position: 'relative' }, children: _jsx(AddCode, {}) }))
125
+ : null] })] })), _jsx("div", { children: _jsx(SyntaxHighlighter, { ...props, className: "highlighter", style: themeKind === 'dark' ? materialDark : vs, language: computedLanguage, PreTag: "div", showLineNumbers: showLines, lineNumberContainerStyle: lineNumbersStyle, lineNumberStyle: lineNumbersStyle, children: content }) })] }));
101
126
  };
102
127
  const dictionary = {
103
128
  en: {
@@ -106,6 +131,8 @@ const dictionary = {
106
131
  newFile: 'Creates a new file with this code as its content',
107
132
  hideLines: 'Hide line numbers',
108
133
  showLines: 'Show line numbers',
134
+ downloadCode: 'Download the code',
135
+ downloadError: 'Error downloading code',
109
136
  },
110
137
  pt: {
111
138
  copy: 'Copiar código para a área de transferência',
@@ -113,6 +140,8 @@ const dictionary = {
113
140
  newFile: 'Criar um novo arquivo com este código como conteúdo',
114
141
  hideLines: 'Esconder números das linhas',
115
142
  showLines: 'Mostrar números das linhas',
143
+ downloadCode: 'Fazer download do código',
144
+ downloadError: 'Erro ao fazer download do código',
116
145
  },
117
146
  };
118
147
  //# sourceMappingURL=Code.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Code.js","sourceRoot":"","sources":["../../src/components/Code.tsx"],"names":[],"mappings":";AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAiB,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE/C,OAAO,EAAE,KAAK,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AACrE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,gDAAgD,CAAA;AACjF,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAsBtC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAA;gBACX,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;;;;;;;eAcvB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY;;;;;;;;;;kBAU3B,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BvC,CAAA;AAED,MAAM,gBAAgB,GAAkB;IACtC,UAAU,EAAE,MAAM;CACnB,CAAA;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,CAA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,4BAA4B;QAClC,MAAM,EAAE,yBAAyB;QACjC,OAAO,EAAE,kDAAkD;QAC3D,SAAS,EAAE,mBAAmB;QAC9B,SAAS,EAAE,mBAAmB;QAC9B,YAAY,EAAE,mBAAmB;QACjC,aAAa,EAAE,wBAAwB;KACxC;IACD,EAAE,EAAE;QACF,IAAI,EAAE,4CAA4C;QAClD,MAAM,EAAE,0BAA0B;QAClC,OAAO,EAAE,qDAAqD;QAC9D,SAAS,EAAE,6BAA6B;QACxC,SAAS,EAAE,4BAA4B;QACvC,YAAY,EAAE,0BAA0B;QACxC,aAAa,EAAE,kCAAkC;KAClD;CACmB,CAAA"}
package/dist/layout.css CHANGED
@@ -104,10 +104,10 @@
104
104
  align-items: center;
105
105
  gap: 8px;
106
106
  border-radius: 4px;
107
- padding: 10px;
107
+ padding: 10px 8px;
108
108
  img {
109
- width: 36px;
110
- height: 36px;
109
+ width: 32px;
110
+ height: 32px;
111
111
  border-radius: 4px;
112
112
  }
113
113
  h6 {
@@ -4,5 +4,5 @@ import { HomeProps } from './types.js';
4
4
  *
5
5
  * The home page can be replaced by providing children to the component `StackspotAIWidget`.
6
6
  */
7
- export declare const Home: ({ initialAgents, ...props }: HomeProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const Home: ({ initialAgents, urlCreateAgent, ...props }: HomeProps) => import("react/jsx-runtime").JSX.Element;
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Home/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAqBnC;;;;GAIG;AACH,eAAO,MAAM,IAAI,gCAAiC,SAAS,4CAgB1D,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Home/index.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAqBnC;;;;GAIG;AACH,eAAO,MAAM,IAAI,gDAAiD,SAAS,4CAiB1E,CAAA"}
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { FadingOverflow } from '@stack-spot/portal-components/FadingOverflow';
3
3
  import { styled } from 'styled-components';
4
4
  import { AgentCard } from '../../components/AgentCard/index.js';
5
+ import { AgentCardCreate } from '../../components/AgentCard/AgentCardCreate.js';
5
6
  import { FallbackBoundary } from '../../components/FallbackBoundary/index.js';
6
7
  import { useCurrentChatState } from '../../context/hooks.js';
7
8
  import { BuiltInAgent } from './BuiltInAgent.js';
@@ -29,9 +30,9 @@ const AgentList = styled.ul `
29
30
  *
30
31
  * The home page can be replaced by providing children to the component `StackspotAIWidget`.
31
32
  */
32
- export const Home = ({ initialAgents, ...props }) => {
33
+ export const Home = ({ initialAgents, urlCreateAgent, ...props }) => {
33
34
  const agent = useCurrentChatState('agent');
34
35
  const isAgentEnabled = useCurrentChatState('features').agent;
35
- return (_jsxs(FallbackBoundary, { children: [agent && !agent.builtIn ? _jsx(CustomAgent, {}) : _jsx(BuiltInAgent, { ...props }), !!initialAgents && isAgentEnabled && (_jsx(FadingOverflow, { enableHorizontalScrollWithVerticalWheel: true, sides: ['left', 'right'], scroll: "arrows", children: _jsx(AgentList, { className: "agent-list", children: initialAgents.map((agent) => _jsx("li", { children: _jsx(AgentCard, { agent: agent }) }, agent.id)) }) }))] }));
36
+ return (_jsxs(FallbackBoundary, { children: [agent && !agent.builtIn ? _jsx(CustomAgent, {}) : _jsx(BuiltInAgent, { ...props }), !!initialAgents && isAgentEnabled && (_jsx(FadingOverflow, { enableHorizontalScrollWithVerticalWheel: true, sides: ['left', 'right'], scroll: "arrows", children: _jsxs(AgentList, { className: "agent-list", children: [urlCreateAgent && _jsx("li", { children: _jsx(AgentCardCreate, { urlCreateAgent: urlCreateAgent }) }), initialAgents.map((agent) => _jsx("li", { children: _jsx(AgentCard, { agent: agent }) }, agent.id))] }) }))] }));
36
37
  };
37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AAS,IAAC,SAAS,EAAC,YAAY,aAC9B,cAAc,IAAI,uBAAI,KAAC,eAAe,IAAC,cAAc,EAAE,cAAc,GAAI,GAAK,EAC9E,aAAa,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,uBAAmB,KAAC,SAAS,IAAC,KAAK,EAAE,KAAK,GAAI,IAArC,KAAK,CAAC,EAAE,CAAkC,CAAC,IACxE,GACG,CAClB,IACgB,CACpB,CAAA;AACH,CAAC,CAAA"}
@@ -8,5 +8,9 @@ export interface HomeProps {
8
8
  * Initial agents to show in home.
9
9
  */
10
10
  initialAgents?: LabeledAgent[];
11
+ /**
12
+ * URL to redirect to the "Create Agent" page on the portal
13
+ */
14
+ urlCreateAgent?: string;
11
15
  }
12
16
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/views/Home/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;CAChC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/views/Home/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stack-spot/ai-chat-widget",
3
- "version": "1.22.0-beta.4",
3
+ "version": "1.22.0-beta.6",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -51,6 +51,10 @@ export interface AIWidgetProps extends WithStyle, CustomMessage {
51
51
  * A boolean indicating whether or not the chat should have a visible header.
52
52
  */
53
53
  hasHeader?: boolean,
54
+ /**
55
+ * URL to redirect to the "Create Agent" page on the portal
56
+ */
57
+ urlCreateAgent?: string,
54
58
  }
55
59
 
56
60
  /**
@@ -69,6 +73,7 @@ export const StackspotAIWidget = (
69
73
  hasHeader = true,
70
74
  beforeMessage,
71
75
  afterMessage,
76
+ urlCreateAgent,
72
77
  }: AIWidgetProps,
73
78
  ) => {
74
79
  const rightPanelRef = useRef<HTMLDivElement>(null)
@@ -96,7 +101,7 @@ export const StackspotAIWidget = (
96
101
  <div className="chat-content">
97
102
  {prefix}
98
103
  {isCurrentChatEmpty
99
- ? (children ?? <Home username={username} initialAgents={initialAgents}/>)
104
+ ? (children ?? <Home username={username} initialAgents={initialAgents} urlCreateAgent={urlCreateAgent} />)
100
105
  : <Chat username={username} beforeMessage={beforeMessage} afterMessage={afterMessage} />
101
106
  }
102
107
  </div>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stack-spot/ai-chat-widget",
3
- "version": "1.22.0-beta.4",
4
- "date": "Tue May 27 2025 19:19:09 GMT-0300 (Horário Padrão de Brasília)",
3
+ "version": "1.22.0-beta.6",
4
+ "date": "Wed May 28 2025 11:45:22 GMT-0300 (Horário Padrão de Brasília)",
5
5
  "dependencies": [
6
6
  {
7
7
  "name": "@stack-spot/app-metadata",
@@ -0,0 +1,44 @@
1
+ import { IconBox, Text } from '@citric/core'
2
+ import { PlusMini } from '@citric/icons'
3
+ import { theme } from '@stack-spot/portal-theme'
4
+ import { useTranslate } from '@stack-spot/portal-translate'
5
+ import { styled } from 'styled-components'
6
+ import { dictionary } from './dictionary'
7
+
8
+ const StyledCard = styled.a`
9
+ cursor: pointer;
10
+ border-radius: 8px;
11
+ transition: background-color 0.3s;
12
+ display: flex;
13
+ flex-direction: column;
14
+ gap: 12px;
15
+ border: 1px solid ${theme.color.light[600]};
16
+ text-decoration:none;
17
+
18
+ &:hover {
19
+ background-color: ${theme.color.light[500]};
20
+ }
21
+
22
+ .text-box {
23
+ display: flex;
24
+ flex-direction: column;
25
+ gap: 2px;
26
+ color: ${theme.color.light['contrastText']}
27
+ }
28
+ `
29
+
30
+ export const AgentCardCreate = ({ urlCreateAgent }: { urlCreateAgent: string }) => {
31
+ const t = useTranslate(dictionary)
32
+ return (
33
+ <StyledCard href={urlCreateAgent} role="link" tabIndex={0} className={'agent-card'}>
34
+ <IconBox color="light" appearance="square" size="md">
35
+ <PlusMini />
36
+ </IconBox>
37
+ <div className="text-box">
38
+ <Text appearance="body2">
39
+ {t.create}
40
+ </Text>
41
+ </div>
42
+ </StyledCard>
43
+ )
44
+ }
@@ -7,6 +7,7 @@ export const dictionary = {
7
7
  account: 'Account',
8
8
  shared: 'Shared',
9
9
  agent: 'Agent',
10
+ create: 'Create',
10
11
  },
11
12
  pt: {
12
13
  builtin: 'Embutido',
@@ -14,6 +15,7 @@ export const dictionary = {
14
15
  account: 'Conta',
15
16
  shared: 'Compartilhado',
16
17
  agent: 'Agente',
18
+ create: 'Criar',
17
19
  },
18
20
  } satisfies Dictionary
19
21
 
@@ -2,7 +2,8 @@
2
2
  * Copied from the extension's webview.
3
3
  */
4
4
 
5
- import { AddCode, ChevronDoubleDown, Collapse, Copy } from '@citric/icons'
5
+ import { Text } from '@citric/core'
6
+ import { AddCode, ChevronDoubleDown, Collapse, Copy, Download } from '@citric/icons'
6
7
  import { IconButton } from '@citric/ui'
7
8
  import { theme, useThemeKind } from '@stack-spot/portal-theme'
8
9
  import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
@@ -12,6 +13,7 @@ import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
12
13
  import { materialDark, vs } from 'react-syntax-highlighter/dist/esm/styles/prism'
13
14
  import styled from 'styled-components'
14
15
  import { WithChildren } from '../types'
16
+ import { languages } from '../utils/programming-languages'
15
17
 
16
18
  export type CodeAction = (
17
19
  code: string,
@@ -53,23 +55,28 @@ const CodeBox = styled.code`
53
55
  }
54
56
  }
55
57
 
56
- .action-bar {
58
+ .header-code {
57
59
  display: flex;
58
60
  flex-direction: row;
59
- justify-content: flex-end;
61
+ justify-content: space-between;
60
62
  background: ${theme.color.light[600]};
61
63
  padding: 4px 6px;
62
64
  border-top-left-radius: 6px;
63
65
  border-top-right-radius: 6px;
64
66
 
65
- button {
66
- background: transparent;
67
- border: none;
68
- opacity: 0.75;
69
- transition: opacity 0.2s;
67
+ .action-bar {
68
+ display: flex;
69
+ flex-direction: row;
70
+
71
+ button {
72
+ background: transparent;
73
+ border: none;
74
+ opacity: 0.75;
75
+ transition: opacity 0.2s;
70
76
 
71
- &:hover {
72
- opacity: 1;
77
+ &:hover {
78
+ opacity: 1;
79
+ }
73
80
  }
74
81
  }
75
82
  }
@@ -108,6 +115,7 @@ export const Code = ({
108
115
  const match = /language-(\w+)/.exec(className || '')
109
116
  const computedLanguage = language ?? (match ?? [])[1]?.toLowerCase() ?? 'txt'
110
117
  const content = String(children ?? '').replaceAll(/\n\t/g, '\n').trim()
118
+ const languageExtension = languages.find(l => l.value === computedLanguage)?.extensions?.[0] ?? '.txt'
111
119
 
112
120
  function onClickInsert() {
113
121
  onInsertCode?.(content, computedLanguage)
@@ -137,47 +145,75 @@ export const Code = ({
137
145
  return (
138
146
  <CodeBox className={['code-box', themeKind, className].join(' ')}>
139
147
  {showActionBar && (
140
- <div className="action-bar" role="toolbar">
141
- <IconButton
142
- aria-label={showLines ? t.hideLines : t.showLines}
143
- title={showLines ? t.hideLines : t.showLines}
144
- onClick={() => setShowLines(v => !v)}
145
- style={{ position: 'relative', transform: showLines ? undefined : 'rotate(180deg)', transition: 'transform 0.2s' }}
146
- >
147
- <Collapse />
148
- </IconButton>
149
- <IconButton
150
- aria-label={t.copy}
151
- title={t.copy}
152
- onClick={onClickCopy}
153
- style={{ position: 'relative' }}
154
- >
155
- <Copy />
156
- </IconButton>
157
- {onInsertCode
158
- ? (
159
- <IconButton
160
- aria-label={t.insert}
161
- title={t.insert}
162
- onClick={onClickInsert}
163
- style={{ position: 'relative' }}
164
- >
165
- <ChevronDoubleDown style={{ transform: 'rotate(90deg)' }} />
166
- </IconButton>
167
- )
168
- : null}
169
- {onNewFile
170
- ? (
171
- <IconButton
172
- aria-label={t.newFile}
173
- title={t.newFile}
174
- onClick={onClickNewFile}
175
- style={{ position: 'relative' }}
176
- >
177
- <AddCode />
178
- </IconButton>
179
- )
180
- : null}
148
+ <div className="header-code">
149
+ <div>
150
+ <Text appearance="code2">{computedLanguage ?? ''}</Text>
151
+ </div>
152
+ <div className="action-bar" role="toolbar">
153
+ <IconButton
154
+ aria-label={showLines ? t.hideLines : t.showLines}
155
+ title={showLines ? t.hideLines : t.showLines}
156
+ onClick={() => setShowLines(v => !v)}
157
+ style={{ position: 'relative', transform: showLines ? undefined : 'rotate(180deg)', transition: 'transform 0.2s' }}
158
+ >
159
+ <Collapse />
160
+ </IconButton>
161
+ <IconButton
162
+ aria-label={t.downloadCode}
163
+ title={t.downloadCode}
164
+ onClick={() => {
165
+ try {
166
+ const extension = languageExtension
167
+ const filename = `download${extension}`
168
+ const blob = new Blob([content], { type: 'text/plain;charset=utf-8' })
169
+ const link = document.createElement('a')
170
+ link.href = URL.createObjectURL(blob)
171
+ link.download = filename
172
+ document.body.appendChild(link)
173
+ link.click()
174
+ document.body.removeChild(link)
175
+ URL.revokeObjectURL(link.href)
176
+ } catch (e) {
177
+ // eslint-disable-next-line no-console
178
+ console.error(t.downloadError, e)
179
+ }
180
+ }}
181
+ >
182
+ <Download />
183
+ </IconButton>
184
+ <IconButton
185
+ aria-label={t.copy}
186
+ title={t.copy}
187
+ onClick={onClickCopy}
188
+ style={{ position: 'relative' }}
189
+ >
190
+ <Copy />
191
+ </IconButton>
192
+ {onInsertCode
193
+ ? (
194
+ <IconButton
195
+ aria-label={t.insert}
196
+ title={t.insert}
197
+ onClick={onClickInsert}
198
+ style={{ position: 'relative' }}
199
+ >
200
+ <ChevronDoubleDown style={{ transform: 'rotate(90deg)' }} />
201
+ </IconButton>
202
+ )
203
+ : null}
204
+ {onNewFile
205
+ ? (
206
+ <IconButton
207
+ aria-label={t.newFile}
208
+ title={t.newFile}
209
+ onClick={onClickNewFile}
210
+ style={{ position: 'relative' }}
211
+ >
212
+ <AddCode />
213
+ </IconButton>
214
+ )
215
+ : null}
216
+ </div>
181
217
  </div>
182
218
  )}
183
219
  <div>
@@ -205,6 +241,8 @@ const dictionary = {
205
241
  newFile: 'Creates a new file with this code as its content',
206
242
  hideLines: 'Hide line numbers',
207
243
  showLines: 'Show line numbers',
244
+ downloadCode: 'Download the code',
245
+ downloadError: 'Error downloading code',
208
246
  },
209
247
  pt: {
210
248
  copy: 'Copiar código para a área de transferência',
@@ -212,5 +250,7 @@ const dictionary = {
212
250
  newFile: 'Criar um novo arquivo com este código como conteúdo',
213
251
  hideLines: 'Esconder números das linhas',
214
252
  showLines: 'Mostrar números das linhas',
253
+ downloadCode: 'Fazer download do código',
254
+ downloadError: 'Erro ao fazer download do código',
215
255
  },
216
256
  } satisfies Dictionary
package/src/layout.css CHANGED
@@ -104,10 +104,10 @@
104
104
  align-items: center;
105
105
  gap: 8px;
106
106
  border-radius: 4px;
107
- padding: 10px;
107
+ padding: 10px 8px;
108
108
  img {
109
- width: 36px;
110
- height: 36px;
109
+ width: 32px;
110
+ height: 32px;
111
111
  border-radius: 4px;
112
112
  }
113
113
  h6 {
@@ -1,6 +1,7 @@
1
1
  import { FadingOverflow } from '@stack-spot/portal-components/FadingOverflow'
2
2
  import { styled } from 'styled-components'
3
3
  import { AgentCard } from '../../components/AgentCard'
4
+ import { AgentCardCreate } from '../../components/AgentCard/AgentCardCreate'
4
5
  import { FallbackBoundary } from '../../components/FallbackBoundary'
5
6
  import { useCurrentChatState } from '../../context/hooks'
6
7
  import { BuiltInAgent } from './BuiltInAgent'
@@ -31,7 +32,7 @@ const AgentList = styled.ul`
31
32
  *
32
33
  * The home page can be replaced by providing children to the component `StackspotAIWidget`.
33
34
  */
34
- export const Home = ({ initialAgents, ...props }: HomeProps) => {
35
+ export const Home = ({ initialAgents, urlCreateAgent, ...props }: HomeProps) => {
35
36
  const agent = useCurrentChatState('agent')
36
37
  const isAgentEnabled = useCurrentChatState('features').agent
37
38
 
@@ -41,6 +42,7 @@ export const Home = ({ initialAgents, ...props }: HomeProps) => {
41
42
  {!!initialAgents && isAgentEnabled && (
42
43
  <FadingOverflow enableHorizontalScrollWithVerticalWheel sides={['left', 'right']} scroll="arrows">
43
44
  <AgentList className="agent-list">
45
+ {urlCreateAgent && <li><AgentCardCreate urlCreateAgent={urlCreateAgent} /></li>}
44
46
  {initialAgents.map((agent) => <li key={agent.id}><AgentCard agent={agent} /></li>)}
45
47
  </AgentList>
46
48
  </FadingOverflow>
@@ -9,4 +9,8 @@ export interface HomeProps {
9
9
  * Initial agents to show in home.
10
10
  */
11
11
  initialAgents?: LabeledAgent[],
12
+ /**
13
+ * URL to redirect to the "Create Agent" page on the portal
14
+ */
15
+ urlCreateAgent?: string,
12
16
  }