@stack-spot/ai-chat-widget 1.0.0-dev.1768591614779 → 1.0.0-dev.1769003015775

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 (102) hide show
  1. package/dist/StackspotAIWidget.d.ts.map +1 -1
  2. package/dist/StackspotAIWidget.js +1 -2
  3. package/dist/StackspotAIWidget.js.map +1 -1
  4. package/dist/app-metadata.json +3 -3
  5. package/dist/chat-interceptors/send-message.d.ts.map +1 -1
  6. package/dist/chat-interceptors/send-message.js +1 -5
  7. package/dist/chat-interceptors/send-message.js.map +1 -1
  8. package/dist/components/Code.d.ts.map +1 -1
  9. package/dist/components/Code.js +19 -4
  10. package/dist/components/Code.js.map +1 -1
  11. package/dist/components/FileDescription.js +1 -1
  12. package/dist/components/FileDescription.js.map +1 -1
  13. package/dist/components/Selector/index.d.ts +0 -2
  14. package/dist/components/Selector/index.d.ts.map +1 -1
  15. package/dist/components/Selector/index.js +2 -5
  16. package/dist/components/Selector/index.js.map +1 -1
  17. package/dist/components/Selector/styled.d.ts +0 -2
  18. package/dist/components/Selector/styled.d.ts.map +1 -1
  19. package/dist/components/Selector/styled.js +0 -45
  20. package/dist/components/Selector/styled.js.map +1 -1
  21. package/dist/components/TabManager.d.ts.map +1 -1
  22. package/dist/components/TabManager.js +4 -20
  23. package/dist/components/TabManager.js.map +1 -1
  24. package/dist/state/types.d.ts +0 -1
  25. package/dist/state/types.d.ts.map +1 -1
  26. package/dist/utils/tools.d.ts +5 -5
  27. package/dist/utils/tools.d.ts.map +1 -1
  28. package/dist/utils/tools.js +2 -2
  29. package/dist/utils/tools.js.map +1 -1
  30. package/dist/views/Agents/AgentDescription.d.ts +2 -6
  31. package/dist/views/Agents/AgentDescription.d.ts.map +1 -1
  32. package/dist/views/Agents/AgentDescription.js +10 -25
  33. package/dist/views/Agents/AgentDescription.js.map +1 -1
  34. package/dist/views/Agents/AgentsTab.d.ts.map +1 -1
  35. package/dist/views/Agents/AgentsTab.js +4 -21
  36. package/dist/views/Agents/AgentsTab.js.map +1 -1
  37. package/dist/views/Agents/dictionary.d.ts +1 -1
  38. package/dist/views/Agents/dictionary.d.ts.map +1 -1
  39. package/dist/views/Agents/dictionary.js +0 -2
  40. package/dist/views/Agents/dictionary.js.map +1 -1
  41. package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
  42. package/dist/views/Chat/ChatMessage.js +5 -6
  43. package/dist/views/Chat/ChatMessage.js.map +1 -1
  44. package/dist/views/ChatHistory/utils.d.ts.map +1 -1
  45. package/dist/views/ChatHistory/utils.js +7 -14
  46. package/dist/views/ChatHistory/utils.js.map +1 -1
  47. package/dist/views/Home/CustomAgent.js +3 -3
  48. package/dist/views/Home/CustomAgent.js.map +1 -1
  49. package/dist/views/MessageInput/AgentSelector.d.ts.map +1 -1
  50. package/dist/views/MessageInput/AgentSelector.js +1 -11
  51. package/dist/views/MessageInput/AgentSelector.js.map +1 -1
  52. package/dist/views/MessageInput/ContextBar.js +1 -1
  53. package/dist/views/MessageInput/ContextBar.js.map +1 -1
  54. package/dist/views/MessageInput/ModelSwitcher/index.d.ts.map +1 -1
  55. package/dist/views/MessageInput/ModelSwitcher/index.js +1 -3
  56. package/dist/views/MessageInput/ModelSwitcher/index.js.map +1 -1
  57. package/dist/views/MessageInput/ModelSwitcher/utils.d.ts +2 -2
  58. package/dist/views/MessageInput/ModelSwitcher/utils.d.ts.map +1 -1
  59. package/dist/views/MessageInput/ModelSwitcher/utils.js +6 -6
  60. package/dist/views/MessageInput/ModelSwitcher/utils.js.map +1 -1
  61. package/dist/views/Resources.js +5 -8
  62. package/dist/views/Resources.js.map +1 -1
  63. package/dist/views/Tools.js +2 -3
  64. package/dist/views/Tools.js.map +1 -1
  65. package/package.json +2 -2
  66. package/src/StackspotAIWidget.tsx +2 -4
  67. package/src/app-metadata.json +3 -3
  68. package/src/chat-interceptors/send-message.ts +2 -6
  69. package/src/components/Code.tsx +19 -4
  70. package/src/components/FileDescription.tsx +1 -1
  71. package/src/components/Selector/index.tsx +2 -11
  72. package/src/components/Selector/styled.ts +0 -47
  73. package/src/components/TabManager.tsx +8 -31
  74. package/src/state/types.ts +0 -1
  75. package/src/utils/tools.ts +4 -4
  76. package/src/views/Agents/AgentDescription.tsx +14 -48
  77. package/src/views/Agents/AgentsTab.tsx +13 -31
  78. package/src/views/Agents/dictionary.ts +1 -2
  79. package/src/views/Chat/ChatMessage.tsx +6 -8
  80. package/src/views/ChatHistory/utils.ts +10 -18
  81. package/src/views/Home/CustomAgent.tsx +4 -4
  82. package/src/views/MessageInput/AgentSelector.tsx +5 -15
  83. package/src/views/MessageInput/ContextBar.tsx +1 -1
  84. package/src/views/MessageInput/ModelSwitcher/index.tsx +2 -3
  85. package/src/views/MessageInput/ModelSwitcher/utils.tsx +8 -9
  86. package/src/views/Resources.tsx +6 -10
  87. package/src/views/Tools.tsx +4 -5
  88. package/dist/components/FreemiumSensitiveDataInfo.d.ts +0 -2
  89. package/dist/components/FreemiumSensitiveDataInfo.d.ts.map +0 -1
  90. package/dist/components/FreemiumSensitiveDataInfo.js +0 -24
  91. package/dist/components/FreemiumSensitiveDataInfo.js.map +0 -1
  92. package/dist/components/Selector/SelectVersion.d.ts +0 -12
  93. package/dist/components/Selector/SelectVersion.d.ts.map +0 -1
  94. package/dist/components/Selector/SelectVersion.js +0 -33
  95. package/dist/components/Selector/SelectVersion.js.map +0 -1
  96. package/dist/hooks/enabled-feature-flags.d.ts +0 -5
  97. package/dist/hooks/enabled-feature-flags.d.ts.map +0 -1
  98. package/dist/hooks/enabled-feature-flags.js +0 -28
  99. package/dist/hooks/enabled-feature-flags.js.map +0 -1
  100. package/src/components/FreemiumSensitiveDataInfo.tsx +0 -36
  101. package/src/components/Selector/SelectVersion.tsx +0 -55
  102. package/src/hooks/enabled-feature-flags.ts +0 -31
@@ -9,7 +9,6 @@ import { NavigationComponent } from '../../components/ComponentNavigator'
9
9
  import { DescribedRadioGroup } from '../../components/form/DescribedRadioGroup'
10
10
  import { WorkspaceTabNavigator } from '../../components/WorkspaceTabNavigator'
11
11
  import { useCurrentChat } from '../../context/hooks'
12
- import { useIsFeatureFlagEnabled } from '../../hooks/enabled-feature-flags'
13
12
  import { useRightPanel } from '../../right-panel/hooks'
14
13
  import { ChatProperties } from '../../state/ChatState'
15
14
  import { AgentDescription } from './AgentDescription'
@@ -29,10 +28,9 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
29
28
  const chat = useCurrentChat()
30
29
  const { useFavorites, onAddFavorite, onRemoveFavorite } = useAgentFavorites()
31
30
  const [submitEnabled, setSubmitEnabled] = useState(false)
32
- const featureFlag = useIsFeatureFlagEnabled('ENABLE_VERSION_CONTENT_AI')
33
31
  const listFavorites = useFavorites()
34
32
  const agentDefault = agentToolsClient.agentDefault.useQuery()
35
- const [agentVersions, setAgentVersions] = useState<Record<string, number | undefined>>({})
33
+
36
34
  const [filter, setFilter] = useState<string | undefined>()
37
35
  const [apiFilter, setApiFilter] = useState<string | undefined>()
38
36
  const [isPending, startTransition] = useTransition()
@@ -61,15 +59,15 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
61
59
 
62
60
  const agents = workspaceId ? workspaceAgents : agentsData
63
61
 
64
- const initialValue = useMemo<AgentResponseWithBuiltIn | undefined>(() => {
65
- const initial = agent.current
66
- ? agents?.find(a => a.id === agent.current?.id)
67
- : chat.get('agent') ?
68
- agents?.find(a => a.id === chat.get('agent')?.id) : { ...agentDefault, suggested_prompts: null } as AgentResponseWithBuiltIn
69
- if (initial && !submitEnabled) setSubmitEnabled(true)
70
- return initial
71
- },
72
- [agents],
62
+ const initialValue = useMemo<AgentResponseWithBuiltIn | undefined>(
63
+ () => {
64
+ const initial = agent.current
65
+ ? agents?.find(a => a.id === agent.current?.id)
66
+ : chat.get('agent') ? agents?.find(a => a.id === chat.get('agent')?.id) : agentDefault as unknown as AgentResponseWithBuiltIn
67
+ if (initial && !submitEnabled) setSubmitEnabled(true)
68
+ return initial
69
+ },
70
+ [agents],
73
71
  )
74
72
 
75
73
  function submit() {
@@ -77,26 +75,12 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
77
75
  close()
78
76
  }
79
77
 
80
- const onVersionChange = (ag: AgentResponseWithBuiltIn, version?: number) => {
81
- setAgentVersions(prev => ({
82
- ...prev,
83
- [ag.id]: version,
84
- }))
85
-
86
- if (agent.current?.id === ag.id) {
87
- agent.current = {
88
- ...agent.current,
89
- agent_version_number: version,
90
- }
91
- }
92
- }
93
-
94
78
  return <>
95
79
  <div className="content">
96
80
  <DescribedRadioGroup
97
81
  fetchNextPage={fetchNextPage}
98
82
  hasNextPage={hasNextPage && !workspaceId}
99
- options={agents || []}
83
+ options={agents}
100
84
  initialValue={initialValue}
101
85
  filter={workspaceId ? undefined : filter}
102
86
  setFilter={workspaceId ? undefined : (value?: string) => {
@@ -105,8 +89,7 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
105
89
  }}
106
90
  onChange={(ag) => {
107
91
  agent.current = ag
108
- ? { ...ag, label: ag.name, image: ag.avatar!, slug: ag.slug, builtIn: ag.visibility_level === 'built_in',
109
- agent_version_number: agentVersions[ag.id] ?? ag.version_number }
92
+ ? { ...ag, label: ag.name, image: ag.avatar!, slug: ag.slug, builtIn: ag.visibility_level === 'built_in' }
110
93
  : undefined
111
94
  setSubmitEnabled(true)
112
95
  }}
@@ -115,8 +98,7 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
115
98
  idOrSlug: ag.id,
116
99
  // below, "key" is important. I don't know why exactly, but sometimes the avatar doesn't update if we don't do this.
117
100
  image: <ImageWithFallback key={ag.id} src={ag.avatar ?? undefined} fallback={<Icon icon="Agent" />} />,
118
- description: <AgentDescription agentId={ag.id} enableVersionSelect={featureFlag.flagEnabled}
119
- onVersionChange={(version?: number) => onVersionChange(ag, version)} />,
101
+ description: <AgentDescription agentId={ag.id} />,
120
102
  name: ag.name,
121
103
  listFavorites,
122
104
  onAddFavorite,
@@ -19,7 +19,6 @@ const dictionary = {
19
19
  tools: 'Tools',
20
20
  spots: 'Spots',
21
21
  multiAgent: 'Multi-agents',
22
- version: 'Version',
23
22
  },
24
23
  pt: {
25
24
  title: 'Agentes',
@@ -39,7 +38,7 @@ const dictionary = {
39
38
  tools: 'Ferramentas',
40
39
  spots: 'Spots',
41
40
  multiAgent: 'Multi-agents',
42
- version: 'Versão',
41
+
43
42
  },
44
43
  } satisfies Dictionary
45
44
 
@@ -215,16 +215,14 @@ export const ChatMessage = ({ message, isLast, beforeMessage, afterMessage, cust
215
215
  const chat = useCurrentChat()
216
216
  const agentId = entry.agent?.id ?? ''
217
217
  // enabled: we don't want to make any request if there is no agent
218
- const [agent] = agentToolsClient.agentV2.useStatefulQuery({ agentCoreId: agentId, versionNumber: entry.agent?.agent_version_number },
219
- { enabled: !!agentId })
218
+ const [agent] = agentToolsClient.agent.useStatefulQuery({ agentId }, { enabled: !!agentId })
220
219
  const toolkits = useMemo(() => [
221
- ...agent?.version?.toolkits?.builtin_toolkits ?? [],
222
- ...agent?.version?.toolkits?.custom_toolkits ?? [],
223
- ...agent?.version?.toolkits?.mcp_toolkits ?? [],
220
+ ...agent?.toolkits?.builtin_toolkits ?? [],
221
+ ...agent?.toolkits?.custom_toolkits ?? [],
222
+ ...agent?.toolkits?.mcp_toolkits ?? [],
224
223
  ], [agent])
225
- const agentsSearch = entry.tools?.map((id) => ({ agent_core_id: id })) ?? []
226
- const [agentsTools] = agentToolsClient.agentsByIdsV2.useStatefulQuery(
227
- { searchAgentsRequestV2: { agents: agentsSearch } }, { enabled: !!entry.tools?.length })
224
+ const [agentsTools] = agentToolsClient.agentsByIds.useStatefulQuery(
225
+ { searchAgentsRequest: { ids: entry.tools || [''] } }, { enabled: !!entry.tools?.length })
228
226
  const [copied, setCopied] = useState(false)
229
227
  const [showUserButtonCopy, setShowUserButtonCopy] = useState(false)
230
228
  const isPlanning = useCurrentChatState('isPlaning') ?? false
@@ -1,5 +1,5 @@
1
1
  import { agentToolsClient, aiClient, AnswerChatStep, ChatAgentTool, ChatStep, PlanningChatStep, workspaceClient } from '@stack-spot/portal-network'
2
- import { AgentCoreWithSingleVersionResponse } from '@stack-spot/portal-network/api/agent-tools'
2
+ import { AgentModel } from '@stack-spot/portal-network/api/agent-tools'
3
3
  import { last } from 'lodash'
4
4
  import { ChatEntry } from '../../state/ChatEntry'
5
5
  import { ChatProperties, ChatState } from '../../state/ChatState'
@@ -56,11 +56,11 @@ function toJSONString(data: any) {
56
56
  return `${data}`
57
57
  }
58
58
 
59
- function findTool(agent: AgentCoreWithSingleVersionResponse | undefined, id: string) {
59
+ function findTool(agent: AgentModel | undefined, id: string) {
60
60
  const allToolkits = [
61
- ...agent?.version?.toolkits?.builtin_toolkits ?? [],
62
- ...agent?.version?.toolkits?.custom_toolkits ?? [],
63
- ...agent?.version?.toolkits?.mcp_toolkits ?? [],
61
+ ...agent?.toolkits?.builtin_toolkits ?? [],
62
+ ...agent?.toolkits?.custom_toolkits ?? [],
63
+ ...agent?.toolkits?.mcp_toolkits ?? [],
64
64
  ]
65
65
  for (const toolkit of allToolkits) {
66
66
  for (const tool of toolkit.tools ?? []) {
@@ -75,10 +75,9 @@ async function stepsFromAgentInfo(
75
75
  ): Promise<ChatStep[] | undefined> {
76
76
  const planningInfo = agentInfo?.find(i => i.type === 'planning' && !!i.data)
77
77
  if (planningInfo) {
78
- let agent: AgentCoreWithSingleVersionResponse | undefined
78
+ let agent: AgentModel | undefined
79
79
  try {
80
- //TODO: avaliar se vamos precisar da versao aqui
81
- agent = agentId ? await agentToolsClient.agentV2.query({ agentCoreId: agentId }) : undefined
80
+ agent = agentId ? await agentToolsClient.agent.query({ agentId }) : undefined
82
81
  } catch { /* empty */ }
83
82
  const planning: PlanningChatStep = {
84
83
  type: 'planning',
@@ -106,7 +105,7 @@ async function stepsFromAgentInfo(
106
105
  return {
107
106
  id: t.tool_id,
108
107
  executionId: t.tool_execution_id,
109
- name: ('name' in tool ? tool.name : ('function' in tool ? tool?.function?.name : undefined) ?? ''),
108
+ name: tool?.name,
110
109
  description: 'description' in tool ? tool.description : undefined,
111
110
  image: toolkit ? (('image_url' in toolkit ? toolkit?.image_url : toolkit?.avatar) ?? undefined) : undefined,
112
111
  goal: t.goal,
@@ -140,18 +139,11 @@ function toolsFromAgentInfo(agentInfo: any[] | null | undefined): string[] {
140
139
  */
141
140
  export async function loadChat(widget: WidgetState, conversationId: string) {
142
141
  const chat = await aiClient.chat.query({ conversationId })
143
- const historyAgents = chat.history?.reduce<{ agent_core_id: string }[]>((accumulator, item) => {
144
- const agentId = item.custom_agent?.id
145
- if (agentId !== undefined) {
146
- accumulator.push({ agent_core_id: agentId })
147
- }
148
- return accumulator
149
- }, []) ?? []
150
-
142
+ const historyAgentIds = chat.history?.map(item => item.custom_agent?.id).filter(Boolean) as string[] ?? []
151
143
  const [stack, workspace, agents] = await Promise.all([
152
144
  findStack(chat.ai_stack_id),
153
145
  findWorkspace(chat.workspace_id),
154
- agentToolsClient.agentsByIdsV2.query({ searchAgentsRequestV2: { agents: historyAgents } }),
146
+ agentToolsClient.agentsByIds.query({ searchAgentsRequest: { ids: historyAgentIds } }),
155
147
  ])
156
148
  const agentsAsLabeledAgents: LabeledAgent[] = agents
157
149
  .map((a) => ({ ...a, label: a.name, image: a.avatar ?? '', builtIn: a.visibility_level === 'built_in' }))
@@ -11,16 +11,16 @@ import { HomeBox } from './styled'
11
11
  * This is the home rendered when the agent is custom.
12
12
  */
13
13
  export const CustomAgent = () => {
14
- const { id, label, image, agent_version_number } = useCurrentChatState('agent') ?? {}
15
- const [agent] = agentToolsClient.agentV2.useStatefulQuery({ agentCoreId: id!, versionNumber: agent_version_number })
14
+ const { id, label, image } = useCurrentChatState('agent') ?? {}
15
+ const [agent] = agentToolsClient.agent.useStatefulQuery({ agentId: id! })
16
16
  const chat = useCurrentChat()
17
- const suggestions = useMemo(() => agent?.version?.conversation_starter?.map((prompt, index) => (
17
+ const suggestions = useMemo(() => agent?.conversation_starter?.map((prompt, index) => (
18
18
  <QuickStartButton
19
19
  key={index}
20
20
  label={prompt}
21
21
  onClick={() => send(prompt)}
22
22
  />
23
- )), [agent?.version?.conversation_starter])
23
+ )), [agent?.conversation_starter])
24
24
 
25
25
  function send(message: string) {
26
26
  chat.pushMessage(ChatEntry.createUserEntry(message))
@@ -5,16 +5,16 @@ import { VisibilityLevelEnum } from '@stack-spot/portal-network/api/agent-tools'
5
5
  import { useCallback } from 'react'
6
6
  import { Selector } from '../../components/Selector'
7
7
  import { useCurrentChat, useCurrentChatState, useWidgetState } from '../../context/hooks'
8
- import { useIsFeatureFlagEnabled } from '../../hooks/enabled-feature-flags'
9
8
  import { agentRegex } from '../../regex'
10
9
  import { useAgentFavorites } from '../Agents/useAgentFavorites'
11
10
 
12
- const AgentItem = ({ avatar, name, spaceName }: AgentResponseWithBuiltIn) => {
11
+ type AgentWithSpaceName = AgentResponseWithBuiltIn
12
+
13
+ const AgentItem = ({ avatar, name, spaceName }: AgentWithSpaceName) => {
13
14
  const avatarComponent = avatar
14
15
  ? <img style={{ width: '32px', height: '32px', borderRadius: '50%' }} src={avatar} />
15
16
  : <IconBox size="md" icon="Agent" style={{ backgroundColor: 'transparent' }} />
16
17
 
17
-
18
18
  return <Row gap="8px" style={{ flexWrap: 'nowrap' }}>
19
19
  {avatarComponent}
20
20
  <div>
@@ -31,11 +31,10 @@ export const AgentSelector = ({ inputRef, isTrial }: {
31
31
  const chat = useCurrentChat()
32
32
  const isAgentEnabled = useCurrentChatState('features').agent
33
33
  const spotId = useWidgetState('features')?.workspaceId
34
- const featureFlag = useIsFeatureFlagEnabled('ENABLE_VERSION_CONTENT_AI')
35
34
 
36
35
  const { useFavorites, onAddFavorite, onRemoveFavorite } = useAgentFavorites()
37
36
 
38
- const onSelectItem = useCallback(async (agent: AgentResponseWithBuiltIn, selectedVersion?: number) => {
37
+ const onSelectItem = useCallback(async (agent: AgentResponseWithBuiltIn) => {
39
38
  const newValue = `@${agent.slug}`
40
39
  chat.set('nextMessage', undefined)
41
40
  chat.set(
@@ -43,11 +42,10 @@ export const AgentSelector = ({ inputRef, isTrial }: {
43
42
  {
44
43
  id: agent.id,
45
44
  label: agent.name,
46
- image: agent.avatar,
45
+ image: agent.avatar,
47
46
  slug: agent.slug,
48
47
  builtIn: agent.builtIn,
49
48
  visibility_level: agent.visibility_level,
50
- agent_version_number: selectedVersion || agent.version_number,
51
49
  },
52
50
  )
53
51
 
@@ -72,12 +70,6 @@ export const AgentSelector = ({ inputRef, isTrial }: {
72
70
  }) }
73
71
  }
74
72
 
75
- const getAgentVersions = (id: string, enabled: boolean) => {
76
- const [listVersions] = agentToolsClient.listAgentVersions.useStatefulQuery({ agentCoreId: id }, { enabled })
77
- const optionsVersions = listVersions?.map((version) => version.version_number)
78
- return optionsVersions
79
- }
80
-
81
73
  return <Selector
82
74
  inputRef={inputRef}
83
75
  favorite={{ useFavorites, onAddFavorite, onRemoveFavorite }}
@@ -93,10 +85,8 @@ export const AgentSelector = ({ inputRef, isTrial }: {
93
85
  ['favorite', 'personal', 'workspace', 'account', 'shared', 'built_in', 'recently_used'],
94
86
  renderComponentItem: AgentItem,
95
87
  isEnabled: isAgentEnabled,
96
- isEnabledVersionContent: featureFlag.flagEnabled,
97
88
  onSelect: onSelectItem,
98
89
  useData: getAgents,
99
- useVersions: getAgentVersions,
100
90
  }}
101
91
  />
102
92
  }
@@ -21,7 +21,7 @@ const ContextBadge = ({ label, color, dismiss, onDismiss }: ContextBadgeProps) =
21
21
  appearance="none"
22
22
  onClick={onDismiss}
23
23
  title={dismiss}
24
- aria-label={dismiss}
24
+ arial-label={dismiss}
25
25
  style={{ padding: '2px 0 2px 2px', color: 'inherit' }}
26
26
  />}
27
27
  </Badge>
@@ -15,9 +15,8 @@ export const ModelSwitcher = () => {
15
15
  const chat = useCurrentChat()
16
16
  const [filter, setFilter] = useState('')
17
17
  const [visibleMenu, setVisibleMenu] = useState(false)
18
- const [agentData, isLoadingAgentData] = agentToolsClient.agentV2.useStatefulQuery({
19
- agentCoreId: agentCurrentChat?.id || '', versionNumber: agentCurrentChat?.agent_version_number },
20
- { enabled: !!agentCurrentChat?.id })
18
+ const [agentData, isLoadingAgentData] = agentToolsClient.agent.useStatefulQuery({ agentId: agentCurrentChat?.id || '' },
19
+ { enabled: !!agentCurrentChat?.id })
21
20
  const [models, isLoadingModels] =
22
21
  genAiInferenceClient.listModels.useStatefulQuery({ pageSize: 999, active: true })
23
22
 
@@ -1,6 +1,6 @@
1
1
  import { CitricIconOutline, CitricIconSocial } from '@stack-spot/citric-icons'
2
2
  import { IconBox } from '@stack-spot/citric-react'
3
- import { AgentCoreWithSingleVersionResponse } from '@stack-spot/portal-network/api/agent-tools'
3
+ import { AgentModel } from '@stack-spot/portal-network/api/agent-tools'
4
4
  import { LlmModelsResponse, PaginatedResponseLlmModelsResponse } from '@stack-spot/portal-network/api/genAiInference'
5
5
  import { theme } from '@stack-spot/portal-theme'
6
6
  import { Dispatch, ReactElement } from 'react'
@@ -27,20 +27,19 @@ export const providerIcon: Record<string, CitricIconSocial | CitricIconOutline>
27
27
  export function getListModelsData(
28
28
  chat: ChatState,
29
29
  setVisibleMenu: Dispatch<React.SetStateAction<boolean>>,
30
- agent?: AgentCoreWithSingleVersionResponse,
30
+ agent?: AgentModel,
31
31
  models?: PaginatedResponseLlmModelsResponse) {
32
32
 
33
33
  const chatSelectedModelId = chat.get('selected_model_id')
34
34
 
35
- const listModelsToShow = agent?.visibility_level !== 'built_in' && !!agent?.version?.model_id ?
36
- models?.items.filter((model) => agent?.version?.available_llm_models?.find((modelAvailable) => modelAvailable.model_id === model.id)) :
35
+ const listModelsToShow = agent?.visibility_level !== 'built_in' && !!agent?.model_id ?
36
+ models?.items.filter((model) => agent?.available_llm_models?.find((modelAvailable) => modelAvailable.model_id === model.id)) :
37
37
  models?.items
38
38
 
39
- const modelAvailableDefault = agent?.version?.available_llm_models?.find((model) =>
40
- (model.is_default || model.model_id === agent.version?.model_id))
39
+ const modelAvailableDefault = agent?.available_llm_models?.find((model) => (model.is_default || model.model_id === agent.model_id))
41
40
  const modelListData = parseModelList(chat, setVisibleMenu, listModelsToShow, modelAvailableDefault?.model_id)
42
41
 
43
- if (agent?.visibility_level === 'built_in' || !agent?.version?.model_id) {
42
+ if (agent?.visibility_level === 'built_in' || !agent?.model_id) {
44
43
 
45
44
  const modelDefaultProviderType = models?.items.find((modelAccount) =>
46
45
  chatSelectedModelId ? modelAccount.id === chatSelectedModelId :
@@ -51,9 +50,9 @@ export function getListModelsData(
51
50
  return { modelName: modelDefaultActive?.label, modelProviderType: modelDefaultProviderType, listItemsData: modelListData }
52
51
  }
53
52
 
54
- const modelAccount = models?.items.find((modelAccount) => modelAccount.id === (chatSelectedModelId || agent.version?.model_id))
53
+ const modelAccount = models?.items.find((modelAccount) => modelAccount.id === (chatSelectedModelId || agent.model_id))
55
54
  const modelProviderType = modelAccount?.model_configuration.provider.provider_type
56
- const modelSelectedName = modelAccount?.display_name || modelAvailableDefault?.model_name || agent?.version?.model_name
55
+ const modelSelectedName = modelAccount?.display_name || modelAvailableDefault?.model_name || agent?.model_name
57
56
 
58
57
  const listItemsData =
59
58
  modelListData && modelListData?.length > 0 ? modelListData :
@@ -46,19 +46,15 @@ const ResourcesPanel = () => {
46
46
  const chat = widget.chatTabs.getAll().find(c => c.id === chatId)
47
47
  return chat?.getMessages().find(m => m.id === messageId)?.getValue()
48
48
  }, [messageId])
49
-
50
- const [agent] = agentToolsClient.agentV2.useStatefulQuery({
51
- agentCoreId: message?.agent?.id || '', versionNumber: message?.agent?.agent_version_number },
52
- { enabled: !!message?.agent?.id })
49
+ const [agent] = agentToolsClient.agent.useStatefulQuery({ agentId: message?.agent?.id || '' },
50
+ { enabled: !!message?.agent?.id })
53
51
  const toolkits = useMemo(() => [
54
- ...agent?.version?.toolkits?.builtin_toolkits ?? [],
55
- ...agent?.version?.toolkits?.custom_toolkits ?? [],
56
- ...agent?.version?.toolkits?.mcp_toolkits ?? [],
52
+ ...agent?.toolkits?.builtin_toolkits ?? [],
53
+ ...agent?.toolkits?.custom_toolkits ?? [],
54
+ ...agent?.toolkits?.mcp_toolkits ?? [],
57
55
  ], [agent])
58
56
  const tools = useMemo(() => message?.tools?.map(id => toolById(id, toolkits)), [messageId, toolkits])
59
- const agentsSearch = message?.tools?.map((id) => ({ agent_core_id: id })) ?? []
60
- const [agentsTools] = agentToolsClient.agentsByIdsV2.useStatefulQuery(
61
- { searchAgentsRequestV2: { agents: agentsSearch } })
57
+ const [agentsTools] = agentToolsClient.agentsByIds.useStatefulQuery({ searchAgentsRequest:{ ids: message?.tools || [] } })
62
58
  const hasAgentTool = useMemo(() => message?.tools?.some(id => agentsTools?.find((agent) => agent.id === id)), [messageId])
63
59
 
64
60
  const header = (image?: string, label?: string) => (
@@ -42,12 +42,11 @@ const ToolsPanel = () => {
42
42
  }, [messageId])
43
43
 
44
44
  const [toolKits] = agentToolsClient.tools.useStatefulQuery({}, { enabled: !!message?.agent?.id })
45
- const [agent] = agentToolsClient.agentV2.useStatefulQuery({ agentCoreId: message?.agent?.id || '',
46
- versionNumber: message?.agent?.agent_version_number },
47
- { enabled: !!message?.agent?.id })
45
+ const [agent] = agentToolsClient.agent.useStatefulQuery({ agentId: message?.agent?.id || '' },
46
+ { enabled: !!message?.agent?.id })
48
47
  const tools = useMemo(() => message?.tools?.map(id => toolById(id, toolKits)), [messageId, toolKits])
49
- const customTools = useMemo(() => message?.tools?.map(id => toolById(id, agent?.version?.toolkits?.custom_toolkits)),
50
- [messageId, agent?.version?.toolkits?.custom_toolkits])
48
+ const customTools = useMemo(() => message?.tools?.map(id => toolById(id, agent?.toolkits?.custom_toolkits)),
49
+ [messageId, agent?.toolkits?.custom_toolkits])
51
50
  return !!(tools?.length || customTools?.length) && (
52
51
  <ToolList>
53
52
  {[...(tools || []), ...(customTools || [])].map(
@@ -1,2 +0,0 @@
1
- export declare const FreemiumSensitiveDataInfo: () => import("react/jsx-runtime").JSX.Element | undefined;
2
- //# sourceMappingURL=FreemiumSensitiveDataInfo.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FreemiumSensitiveDataInfo.d.ts","sourceRoot":"","sources":["../../src/components/FreemiumSensitiveDataInfo.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,yBAAyB,2DAkBrC,CAAA"}
@@ -1,24 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Column, Icon, Link, Row, Text } from '@stack-spot/citric-react';
3
- import { useTranslate } from '@stack-spot/portal-translate';
4
- import { checkIsTrial } from '../utils/check-is-trial.js';
5
- export const FreemiumSensitiveDataInfo = () => {
6
- const isTrial = checkIsTrial();
7
- const t = useTranslate(dictionary);
8
- if (isTrial)
9
- return;
10
- return (_jsxs(Row, { gap: 8, pb: 3, pt: 3, w: "100%", justifyContent: "center", alignItems: "center", children: [_jsx(Column, { children: _jsx(Icon, { icon: "InfoCircle", color: "light.700" }) }), _jsxs("div", { children: [_jsx(Text, { style: { lineHeight: '14px', marginRight: '2px' }, color: "light.700", appearance: "microtext1", children: t.information }), _jsx(Link, { target: "_blank", color: "light.700", style: { lineHeight: '14px' }, appearance: "microtext1", href: t.policiesLink, children: t.seePolices })] })] }));
11
- };
12
- const dictionary = {
13
- en: {
14
- information: 'For personal use only. Avoid entering corporate or sensitive data.',
15
- seePolices: 'View Terms and Conditions',
16
- policiesLink: 'https://stackspot.com/en/stackspot-terms-and-conditions-ai',
17
- },
18
- pt: {
19
- information: 'Conta para uso pessoal. Evite inserir dados corporativos ou sensíveis.',
20
- seePolices: 'Ver Termos e Condições',
21
- policiesLink: 'https://stackspot.com/pt/termos-e-condicoes-da-plataforma-stackspot-ai',
22
- },
23
- };
24
- //# sourceMappingURL=FreemiumSensitiveDataInfo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FreemiumSensitiveDataInfo.js","sourceRoot":"","sources":["../../src/components/FreemiumSensitiveDataInfo.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAEtD,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC5C,MAAM,OAAO,GAAG,YAAY,EAAE,CAAA;IAC9B,MAAM,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAA;IAClC,IAAI,OAAO;QAAE,OAAM;IAEnB,OAAO,CACL,MAAC,GAAG,IAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAC,MAAM,EAAC,cAAc,EAAC,QAAQ,EAAC,UAAU,EAAC,QAAQ,aAC7E,KAAC,MAAM,cACL,KAAC,IAAI,IAAC,IAAI,EAAC,YAAY,EAAC,KAAK,EAAC,WAAW,GAAG,GACrC,EACT,0BACE,KAAC,IAAI,IAAC,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,KAAK,EAAC,WAAW,EAAC,UAAU,EAAC,YAAY,YAAE,CAAC,CAAC,WAAW,GAAQ,EACzH,KAAC,IAAI,IAAC,MAAM,EAAC,QAAQ,EAAC,KAAK,EAAC,WAAW,EAAC,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,UAAU,EAAC,YAAY,EAAC,IAAI,EAAE,CAAC,CAAC,YAAY,YAChH,CAAC,CAAC,UAAU,GACR,IACH,IACF,CACP,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,WAAW,EAAE,oEAAoE;QACjF,UAAU,EAAE,2BAA2B;QACvC,YAAY,EAAE,4DAA4D;KAC3E;IACD,EAAE,EAAE;QACF,WAAW,EAAE,wEAAwE;QACrF,UAAU,EAAE,wBAAwB;QACpC,YAAY,EAAE,wEAAwE;KACvF;CACO,CAAA"}
@@ -1,12 +0,0 @@
1
- import { Dispatch, SetStateAction } from 'react';
2
- interface Props {
3
- value?: number;
4
- onChange: Dispatch<SetStateAction<number | undefined>>;
5
- options?: number[];
6
- lazyLoadOptions?: boolean;
7
- useVersions?: (id: string, enabled: boolean) => number[] | undefined;
8
- id: string;
9
- }
10
- export declare const SelectVersion: ({ useVersions, value, onChange, options: initialOptions, id, lazyLoadOptions }: Props) => import("react/jsx-runtime").JSX.Element;
11
- export {};
12
- //# sourceMappingURL=SelectVersion.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SelectVersion.d.ts","sourceRoot":"","sources":["../../../src/components/Selector/SelectVersion.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAc,cAAc,EAAuB,MAAM,OAAO,CAAA;AAIjF,UAAU,KAAK;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IACvD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,MAAM,EAAE,GAAG,SAAS,CAAC;IACrE,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,eAAO,MAAM,aAAa,mFAA0F,KAAK,4CA6BxH,CAAA"}
@@ -1,33 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Select } from '@stack-spot/citric-react';
3
- import { useTranslate } from '@stack-spot/portal-translate';
4
- import { useEffect, useState } from 'react';
5
- import { isEqual } from 'lodash';
6
- import { VersionSelector } from './styled.js';
7
- export const SelectVersion = ({ useVersions, value, onChange, options: initialOptions, id, lazyLoadOptions = false }) => {
8
- const t = useTranslate(dictionary);
9
- const [options, setOptions] = useState(initialOptions);
10
- const [enabled, setEnabled] = useState(!lazyLoadOptions);
11
- const versions = useVersions?.(id, enabled);
12
- const onClick = (e) => {
13
- e?.stopPropagation();
14
- if (lazyLoadOptions) {
15
- setEnabled(true);
16
- }
17
- };
18
- useEffect(() => {
19
- if (lazyLoadOptions && !isEqual(versions, options)) {
20
- setOptions(versions);
21
- }
22
- }, [versions]);
23
- return (_jsx(VersionSelector, { children: _jsx(Select, { className: "version-selector", options: options || [], value: value, onChange: onChange, onClick: onClick, renderLabel: (item) => `${t.version} ${item}` }) }));
24
- };
25
- const dictionary = {
26
- en: {
27
- version: 'Version',
28
- },
29
- pt: {
30
- version: 'Versão',
31
- },
32
- };
33
- //# sourceMappingURL=SelectVersion.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SelectVersion.js","sourceRoot":"","sources":["../../../src/components/Selector/SelectVersion.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAwC,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAW1C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE,eAAe,GAAC,KAAK,EAAS,EAAE,EAAE;IAC3H,MAAM,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAA;IAClC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAA;IACtD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,CAAC,eAAe,CAAC,CAAA;IACxD,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;IAE3C,MAAM,OAAO,GAAG,CAAC,CAA+B,EAAE,EAAE;QAClD,CAAC,EAAE,eAAe,EAAE,CAAA;QACpB,IAAI,eAAe,EAAE,CAAC;YACpB,UAAU,CAAC,IAAI,CAAC,CAAA;QAClB,CAAC;IACH,CAAC,CAAA;IAED,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,eAAe,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAC,CAAC;YAClD,UAAU,CAAC,QAAQ,CAAC,CAAA;QACtB,CAAC;IACH,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAA;IAEd,OAAO,CACL,KAAC,eAAe,cACd,KAAC,MAAM,IAAC,SAAS,EAAC,kBAAkB,EAClC,OAAO,EAAE,OAAO,IAAI,EAAE,EACtB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAA,GAAG,CAAC,CAAC,OAAO,IAAI,IAAI,EAAE,GAAI,GAClC,CACnB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,OAAO,EAAE,SAAS;KACnB;IACD,EAAE,EAAE;QACF,OAAO,EAAE,QAAQ;KAClB;CACF,CAAA"}
@@ -1,5 +0,0 @@
1
- export declare const useIsFeatureFlagEnabled: (flagSlug: string, resourceType?: string, resourceSlug?: string) => {
2
- flagEnabled: boolean;
3
- isLoading: boolean;
4
- };
5
- //# sourceMappingURL=enabled-feature-flags.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"enabled-feature-flags.d.ts","sourceRoot":"","sources":["../../src/hooks/enabled-feature-flags.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,uBAAuB,aACxB,MAAM,iBACD,MAAM,iBACN,MAAM;;;CAiBtB,CAAA"}
@@ -1,28 +0,0 @@
1
- import { accountClient } from '@stack-spot/portal-network';
2
- const useEnabledFeatureFlags = (resourceType, resourceSlug) => {
3
- const queryParams = resourceType && resourceSlug ? { [resourceType]: resourceSlug } : {};
4
- const [featureFlags, , error, { isLoading }] = accountClient.getEnabledFeatureFlagsForAccount.useStatefulQuery({
5
- queryParams,
6
- });
7
- return { featureFlags, isLoading, error };
8
- };
9
- export const useIsFeatureFlagEnabled = (flagSlug, resourceType, resourceSlug) => {
10
- const { featureFlags, isLoading } = useEnabledFeatureFlags(resourceType, resourceSlug);
11
- if (resourceType && resourceSlug) {
12
- const featureFlag = featureFlags?.find((flag) => flag.slug === flagSlug);
13
- const resourcesByType = featureFlag?.resources?.[resourceType];
14
- if (!!featureFlag && !!resourcesByType) {
15
- if (resourcesByType.mode === 'ALL') {
16
- return { flagEnabled: true, isLoading };
17
- }
18
- else {
19
- return { flagEnabled: !!featureFlag.resources?.[resourceType].slugs.some((slug) => slug === resourceSlug), isLoading };
20
- }
21
- }
22
- return { flagEnabled: false, isLoading };
23
- }
24
- else {
25
- return { flagEnabled: !!featureFlags?.some((flag) => flag.slug === flagSlug), isLoading };
26
- }
27
- };
28
- //# sourceMappingURL=enabled-feature-flags.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"enabled-feature-flags.js","sourceRoot":"","sources":["../../src/hooks/enabled-feature-flags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAE1D,MAAM,sBAAsB,GAAG,CAAC,YAAqB,EAAE,YAAqB,EAAE,EAAE;IAC9E,MAAM,WAAW,GAAG,YAAY,IAAI,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IACxF,MAAM,CAAC,YAAY,EAAE,AAAD,EAAG,KAAK,EAAE,EAAE,SAAS,EAAE,CAAC,GAAG,aAAa,CAAC,gCAAgC,CAAC,gBAAgB,CAAC;QAC7G,WAAW;KACZ,CAAC,CAAA;IACF,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE,CAAA;AAC3C,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,QAAgB,EAChB,YAAqB,EACrB,YAAqB,EACrB,EAAE;IACF,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,sBAAsB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;IACtF,IAAI,YAAY,IAAI,YAAY,EAAE,CAAC;QACjC,MAAM,WAAW,GAAG,YAAY,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAA;QACxE,MAAM,eAAe,GAAG,WAAW,EAAE,SAAS,EAAE,CAAC,YAAY,CAAC,CAAA;QAC9D,IAAI,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;YACvC,IAAI,eAAe,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;gBACnC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;YACzC,CAAC;iBAAM,CAAC;gBACN,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,YAAY,CAAC,EAAE,SAAS,EAAE,CAAA;YACxH,CAAC;QACH,CAAC;QACD,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA;IAC1C,CAAC;SAAM,CAAC;QACN,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAA;IAC3F,CAAC;AACH,CAAC,CAAA"}
@@ -1,36 +0,0 @@
1
- import { Column, Icon, Link, Row, Text } from '@stack-spot/citric-react'
2
- import { useTranslate } from '@stack-spot/portal-translate'
3
- import { checkIsTrial } from '../utils/check-is-trial'
4
-
5
- export const FreemiumSensitiveDataInfo = () => {
6
- const isTrial = checkIsTrial()
7
- const t = useTranslate(dictionary)
8
- if (isTrial) return
9
-
10
- return (
11
- <Row gap={8} pb={3} pt={3} w="100%" justifyContent="center" alignItems="center">
12
- <Column>
13
- <Icon icon="InfoCircle" color="light.700" />
14
- </Column>
15
- <div>
16
- <Text style={{ lineHeight: '14px', marginRight: '2px' }} color="light.700" appearance="microtext1">{t.information}</Text>
17
- <Link target="_blank" color="light.700" style={{ lineHeight: '14px' }} appearance="microtext1" href={t.policiesLink}>
18
- {t.seePolices}
19
- </Link>
20
- </div>
21
- </Row>
22
- )
23
- }
24
-
25
- const dictionary = {
26
- en: {
27
- information: 'For personal use only. Avoid entering corporate or sensitive data.',
28
- seePolices: 'View Terms and Conditions',
29
- policiesLink: 'https://stackspot.com/en/stackspot-terms-and-conditions-ai',
30
- },
31
- pt: {
32
- information: 'Conta para uso pessoal. Evite inserir dados corporativos ou sensíveis.',
33
- seePolices: 'Ver Termos e Condições',
34
- policiesLink: 'https://stackspot.com/pt/termos-e-condicoes-da-plataforma-stackspot-ai',
35
- },
36
- } as const
@@ -1,55 +0,0 @@
1
-
2
- import { Select } from '@stack-spot/citric-react'
3
- import { useTranslate } from '@stack-spot/portal-translate'
4
- import { Dispatch, MouseEvent, SetStateAction, useEffect, useState } from 'react'
5
- import { isEqual } from 'lodash'
6
- import { VersionSelector } from './styled'
7
-
8
- interface Props {
9
- value?: number,
10
- onChange: Dispatch<SetStateAction<number | undefined>>,
11
- options?: number[],
12
- lazyLoadOptions?: boolean,
13
- useVersions?: (id: string, enabled: boolean) => number[] | undefined,
14
- id: string,
15
- }
16
-
17
- export const SelectVersion = ({ useVersions, value, onChange, options: initialOptions, id, lazyLoadOptions=false }: Props) => {
18
- const t = useTranslate(dictionary)
19
- const [options, setOptions] = useState(initialOptions)
20
- const [enabled, setEnabled] = useState(!lazyLoadOptions)
21
- const versions = useVersions?.(id, enabled)
22
-
23
- const onClick = (e?: MouseEvent<HTMLDivElement>) => {
24
- e?.stopPropagation()
25
- if (lazyLoadOptions) {
26
- setEnabled(true)
27
- }
28
- }
29
-
30
- useEffect(() => {
31
- if (lazyLoadOptions && !isEqual(versions, options)){
32
- setOptions(versions)
33
- }
34
- }, [versions])
35
-
36
- return (
37
- <VersionSelector>
38
- <Select className="version-selector"
39
- options={options || []}
40
- value={value}
41
- onChange={onChange}
42
- onClick={onClick}
43
- renderLabel={(item) =>`${t.version} ${item}`} />
44
- </VersionSelector>
45
- )
46
- }
47
-
48
- const dictionary = {
49
- en: {
50
- version: 'Version',
51
- },
52
- pt: {
53
- version: 'Versão',
54
- },
55
- }