@burdenoff/microfe-botmanor 2026.1115.2 → 2026.1116.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/botlit/components/BotFormFields.js +66 -87
- package/dist/botlit/components/BotFormFields.js.map +1 -1
- package/dist/botlit/components/EmojiPicker.d.ts +20 -0
- package/dist/botlit/components/EmojiPicker.js +42 -0
- package/dist/botlit/components/EmojiPicker.js.map +1 -0
- package/dist/botlit/components/index.d.ts +1 -0
- package/dist/botlit/hooks/internal/allPages.d.ts +2 -0
- package/dist/botlit/hooks/internal/allPages.js +25 -0
- package/dist/botlit/hooks/internal/allPages.js.map +1 -0
- package/dist/botlit/hooks/useAgents.d.ts +24 -3
- package/dist/botlit/hooks/useAgents.js +158 -109
- package/dist/botlit/hooks/useAgents.js.map +1 -1
- package/dist/botlit/hooks/useBotAgents.d.ts +23 -0
- package/dist/botlit/hooks/useBotAgents.js +69 -0
- package/dist/botlit/hooks/useBotAgents.js.map +1 -0
- package/dist/botlit/hooks/useBots.js +2 -2
- package/dist/botlit/hooks/useBots.js.map +1 -1
- package/dist/botlit/hooks/useKnowledgeBases.js +40 -44
- package/dist/botlit/hooks/useKnowledgeBases.js.map +1 -1
- package/dist/botlit/hooks/useMCPServers.js +53 -57
- package/dist/botlit/hooks/useMCPServers.js.map +1 -1
- package/dist/botlit/pages/AgentBuilderPage.js +832 -425
- package/dist/botlit/pages/AgentBuilderPage.js.map +1 -1
- package/dist/botlit/pages/AgentDetailPage.js +407 -325
- package/dist/botlit/pages/AgentDetailPage.js.map +1 -1
- package/dist/botlit/pages/AgentsListPage.js +487 -291
- package/dist/botlit/pages/AgentsListPage.js.map +1 -1
- package/dist/botlit/types/index.d.ts +4 -1
- package/dist/botlit/utils/agentDelete.d.ts +5 -0
- package/dist/botlit/utils/agentDelete.js +15 -0
- package/dist/botlit/utils/agentDelete.js.map +1 -0
- package/dist/botlit/utils/agentSettings.d.ts +77 -0
- package/dist/botlit/utils/agentSettings.js +78 -0
- package/dist/botlit/utils/agentSettings.js.map +1 -0
- package/dist/generated/wspace-operations.d.ts +4 -0
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +43 -0
- package/dist/generated/wspace-types.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
import { useTr as e } from "../../shared/hooks/useTr.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { EmojiPicker as t } from "./EmojiPicker.js";
|
|
3
|
+
import { FormField as n, Input as r, Textarea as i } from "./Input.js";
|
|
4
|
+
import { BOT_IDENTITY_MESSAGES as a, slugify as o } from "../utils/botIdentity.js";
|
|
5
5
|
import { toUnion as s } from "../utils/unions.js";
|
|
6
|
-
import {
|
|
7
|
-
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
6
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
7
|
// src/botlit/components/BotFormFields.tsx
|
|
9
|
-
var
|
|
8
|
+
var d = [
|
|
10
9
|
"SINGLE",
|
|
11
10
|
"ROUND_ROBIN",
|
|
12
11
|
"INTELLIGENT",
|
|
13
12
|
"CUSTOM"
|
|
14
|
-
],
|
|
13
|
+
], f = "🤖", p = {
|
|
15
14
|
name: "",
|
|
16
15
|
slug: "",
|
|
17
16
|
description: "",
|
|
18
|
-
icon:
|
|
17
|
+
icon: f,
|
|
19
18
|
routingStrategy: "SINGLE",
|
|
20
19
|
welcomeMessage: "",
|
|
21
20
|
fallbackMessage: "",
|
|
22
21
|
defaultAgentId: ""
|
|
23
|
-
},
|
|
22
|
+
}, m = [
|
|
24
23
|
{
|
|
25
24
|
icon: "🤖",
|
|
26
25
|
key: "robot",
|
|
@@ -71,182 +70,162 @@ var f = [
|
|
|
71
70
|
key: "lightning",
|
|
72
71
|
label: "Lightning"
|
|
73
72
|
}
|
|
74
|
-
],
|
|
75
|
-
let
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
className: "flex flex-wrap gap-2",
|
|
88
|
-
children: a.map((e, i) => {
|
|
89
|
-
let a = e.icon === t;
|
|
90
|
-
return /* @__PURE__ */ u("button", {
|
|
91
|
-
type: "button",
|
|
92
|
-
role: "radio",
|
|
93
|
-
"aria-checked": a,
|
|
94
|
-
"aria-label": r(`botlit.botDetail.form.icons.${e.key}`, e.label),
|
|
95
|
-
tabIndex: a ? 0 : -1,
|
|
96
|
-
onClick: () => n(e.icon),
|
|
97
|
-
onKeyDown: (e) => {
|
|
98
|
-
e.key === "ArrowRight" || e.key === "ArrowDown" ? (e.preventDefault(), s(i, 1)) : (e.key === "ArrowLeft" || e.key === "ArrowUp") && (e.preventDefault(), s(i, -1));
|
|
99
|
-
},
|
|
100
|
-
className: o("rounded-lg border-2 p-3 text-3xl transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary", a ? "border-primary bg-accent" : "border-dashed border-border-subtle hover:border-primary"),
|
|
101
|
-
children: /* @__PURE__ */ u("span", {
|
|
102
|
-
"aria-hidden": "true",
|
|
103
|
-
children: e.icon
|
|
104
|
-
})
|
|
105
|
-
}, e.key);
|
|
106
|
-
})
|
|
73
|
+
], h = ({ value: n, onChange: r }) => {
|
|
74
|
+
let i = e();
|
|
75
|
+
return /* @__PURE__ */ l(t, {
|
|
76
|
+
value: n,
|
|
77
|
+
onChange: r,
|
|
78
|
+
choices: m.map(({ icon: e, key: t, label: n }) => ({
|
|
79
|
+
emoji: e,
|
|
80
|
+
key: t,
|
|
81
|
+
label: n
|
|
82
|
+
})),
|
|
83
|
+
groupLabel: i("botlit.botDetail.form.icon", "Icon"),
|
|
84
|
+
optionLabel: (e) => i(`botlit.botDetail.form.icons.${e.key}`, e.label),
|
|
85
|
+
currentLabel: i("botlit.botDetail.form.icons.current", "Current icon")
|
|
107
86
|
});
|
|
108
|
-
},
|
|
109
|
-
let y = e(), b = (e) => `${
|
|
87
|
+
}, g = ({ idPrefix: t, value: f, onChange: p, errors: m, showErrors: g, mode: _, agents: v }) => {
|
|
88
|
+
let y = e(), b = (e) => `${t}-${e}`, x = (e) => e ? y(`botlit.botDetail.form.errors.${e}`, a[e], {
|
|
110
89
|
nameMax: 100,
|
|
111
90
|
slugMax: 64
|
|
112
|
-
}) : void 0, S =
|
|
113
|
-
return /* @__PURE__ */
|
|
91
|
+
}) : void 0, S = g ? x(m.name) : void 0, C = g ? x(m.slug) : void 0, w = f.slug.trim() === "" ? o(f.name) : "", T = (e, t, n) => t ? b(`${e}-error`) : n ? b(`${e}-description`) : void 0;
|
|
92
|
+
return /* @__PURE__ */ u("div", {
|
|
114
93
|
className: "space-y-6",
|
|
115
94
|
children: [
|
|
116
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ l("div", {
|
|
117
96
|
className: "flex items-start gap-4",
|
|
118
|
-
children: /* @__PURE__ */
|
|
119
|
-
value:
|
|
97
|
+
children: /* @__PURE__ */ l(h, {
|
|
98
|
+
value: f.icon,
|
|
120
99
|
onChange: (e) => p({
|
|
121
|
-
...
|
|
100
|
+
...f,
|
|
122
101
|
icon: e
|
|
123
102
|
})
|
|
124
103
|
})
|
|
125
104
|
}),
|
|
126
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ l(n, {
|
|
127
106
|
label: y("botlit.botDetail.form.botName", "Bot Name"),
|
|
128
107
|
required: !0,
|
|
129
108
|
htmlFor: b("name"),
|
|
130
109
|
error: S,
|
|
131
|
-
children: /* @__PURE__ */
|
|
110
|
+
children: /* @__PURE__ */ l(r, {
|
|
132
111
|
id: b("name"),
|
|
133
112
|
required: !0,
|
|
134
113
|
maxLength: 120,
|
|
135
114
|
"aria-invalid": S ? !0 : void 0,
|
|
136
115
|
"aria-describedby": T("name", S, !1),
|
|
137
116
|
placeholder: y("botlit.botDetail.form.botNamePlaceholder", "e.g., Customer Support Bot"),
|
|
138
|
-
value:
|
|
117
|
+
value: f.name,
|
|
139
118
|
onChange: (e) => p({
|
|
140
|
-
...
|
|
119
|
+
...f,
|
|
141
120
|
name: e.target.value
|
|
142
121
|
})
|
|
143
122
|
})
|
|
144
123
|
}),
|
|
145
|
-
/* @__PURE__ */
|
|
124
|
+
/* @__PURE__ */ l(n, {
|
|
146
125
|
label: y("botlit.botDetail.form.slug", "Slug"),
|
|
147
126
|
htmlFor: b("slug"),
|
|
148
127
|
error: C,
|
|
149
128
|
description: w ? y("botlit.botDetail.form.slugDerived", "Will be saved as \"{{slug}}\".", { slug: w }) : y("botlit.botDetail.form.slugHelp", "Lowercase letters, numbers and hyphens. Left empty, it is made from the name."),
|
|
150
|
-
children: /* @__PURE__ */
|
|
129
|
+
children: /* @__PURE__ */ l(r, {
|
|
151
130
|
id: b("slug"),
|
|
152
131
|
"aria-invalid": C ? !0 : void 0,
|
|
153
132
|
"aria-describedby": T("slug", C, !0),
|
|
154
133
|
placeholder: y("botlit.botDetail.form.slugPlaceholder", "customer-support-bot"),
|
|
155
|
-
value:
|
|
134
|
+
value: f.slug,
|
|
156
135
|
onChange: (e) => p({
|
|
157
|
-
...
|
|
136
|
+
...f,
|
|
158
137
|
slug: e.target.value
|
|
159
138
|
})
|
|
160
139
|
})
|
|
161
140
|
}),
|
|
162
|
-
/* @__PURE__ */
|
|
141
|
+
/* @__PURE__ */ l(n, {
|
|
163
142
|
label: y("botlit.botDetail.form.description", "Description"),
|
|
164
143
|
htmlFor: b("description"),
|
|
165
|
-
children: /* @__PURE__ */
|
|
144
|
+
children: /* @__PURE__ */ l(i, {
|
|
166
145
|
id: b("description"),
|
|
167
146
|
placeholder: y("botlit.botDetail.form.descriptionPlaceholder", "Describe what this bot does..."),
|
|
168
|
-
value:
|
|
147
|
+
value: f.description,
|
|
169
148
|
onChange: (e) => p({
|
|
170
|
-
...
|
|
149
|
+
...f,
|
|
171
150
|
description: e.target.value
|
|
172
151
|
}),
|
|
173
152
|
rows: 4
|
|
174
153
|
})
|
|
175
154
|
}),
|
|
176
|
-
/* @__PURE__ */
|
|
155
|
+
/* @__PURE__ */ l(n, {
|
|
177
156
|
label: y("botlit.botDetail.form.routingStrategy", "Routing Strategy"),
|
|
178
157
|
htmlFor: b("routing"),
|
|
179
|
-
children: /* @__PURE__ */
|
|
158
|
+
children: /* @__PURE__ */ u("select", {
|
|
180
159
|
id: b("routing"),
|
|
181
160
|
className: "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
|
|
182
|
-
value:
|
|
161
|
+
value: f.routingStrategy,
|
|
183
162
|
onChange: (e) => p({
|
|
184
|
-
...
|
|
185
|
-
routingStrategy: s(e.target.value,
|
|
163
|
+
...f,
|
|
164
|
+
routingStrategy: s(e.target.value, d, "SINGLE")
|
|
186
165
|
}),
|
|
187
166
|
children: [
|
|
188
|
-
/* @__PURE__ */
|
|
167
|
+
/* @__PURE__ */ l("option", {
|
|
189
168
|
value: "SINGLE",
|
|
190
169
|
children: y("botlit.botDetail.routing.single", "Single")
|
|
191
170
|
}),
|
|
192
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ l("option", {
|
|
193
172
|
value: "ROUND_ROBIN",
|
|
194
173
|
children: y("botlit.botDetail.routing.roundRobin", "Round Robin")
|
|
195
174
|
}),
|
|
196
|
-
/* @__PURE__ */
|
|
175
|
+
/* @__PURE__ */ l("option", {
|
|
197
176
|
value: "INTELLIGENT",
|
|
198
177
|
children: y("botlit.botDetail.routing.intelligent", "Intelligent")
|
|
199
178
|
}),
|
|
200
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ l("option", {
|
|
201
180
|
value: "CUSTOM",
|
|
202
181
|
children: y("botlit.botDetail.routing.custom", "Custom")
|
|
203
182
|
})
|
|
204
183
|
]
|
|
205
184
|
})
|
|
206
185
|
}),
|
|
207
|
-
_ === "edit" && /* @__PURE__ */
|
|
208
|
-
/* @__PURE__ */
|
|
186
|
+
_ === "edit" && /* @__PURE__ */ u(c, { children: [
|
|
187
|
+
/* @__PURE__ */ l(n, {
|
|
209
188
|
label: y("botlit.botDetail.form.welcomeMessage", "Welcome Message"),
|
|
210
189
|
htmlFor: b("welcome"),
|
|
211
|
-
children: /* @__PURE__ */
|
|
190
|
+
children: /* @__PURE__ */ l(i, {
|
|
212
191
|
id: b("welcome"),
|
|
213
192
|
placeholder: y("botlit.botDetail.form.welcomeMessagePlaceholder", "Welcome message shown to users..."),
|
|
214
|
-
value:
|
|
193
|
+
value: f.welcomeMessage,
|
|
215
194
|
onChange: (e) => p({
|
|
216
|
-
...
|
|
195
|
+
...f,
|
|
217
196
|
welcomeMessage: e.target.value
|
|
218
197
|
}),
|
|
219
198
|
rows: 3
|
|
220
199
|
})
|
|
221
200
|
}),
|
|
222
|
-
/* @__PURE__ */
|
|
201
|
+
/* @__PURE__ */ l(n, {
|
|
223
202
|
label: y("botlit.botDetail.form.fallbackMessage", "Fallback Message"),
|
|
224
203
|
htmlFor: b("fallback"),
|
|
225
|
-
children: /* @__PURE__ */
|
|
204
|
+
children: /* @__PURE__ */ l(r, {
|
|
226
205
|
id: b("fallback"),
|
|
227
206
|
placeholder: y("botlit.botDetail.form.fallbackMessagePlaceholder", "Message when agent can't respond..."),
|
|
228
|
-
value:
|
|
207
|
+
value: f.fallbackMessage,
|
|
229
208
|
onChange: (e) => p({
|
|
230
|
-
...
|
|
209
|
+
...f,
|
|
231
210
|
fallbackMessage: e.target.value
|
|
232
211
|
})
|
|
233
212
|
})
|
|
234
213
|
}),
|
|
235
|
-
/* @__PURE__ */
|
|
214
|
+
/* @__PURE__ */ l(n, {
|
|
236
215
|
label: y("botlit.botDetail.form.defaultAgent", "Default Agent"),
|
|
237
216
|
htmlFor: b("default-agent"),
|
|
238
|
-
children: /* @__PURE__ */
|
|
217
|
+
children: /* @__PURE__ */ u("select", {
|
|
239
218
|
id: b("default-agent"),
|
|
240
219
|
className: "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
|
|
241
|
-
value:
|
|
220
|
+
value: f.defaultAgentId,
|
|
242
221
|
onChange: (e) => p({
|
|
243
|
-
...
|
|
222
|
+
...f,
|
|
244
223
|
defaultAgentId: e.target.value
|
|
245
224
|
}),
|
|
246
|
-
children: [/* @__PURE__ */
|
|
225
|
+
children: [/* @__PURE__ */ l("option", {
|
|
247
226
|
value: "",
|
|
248
227
|
children: y("botlit.botDetail.form.noDefaultAgent", "No default agent")
|
|
249
|
-
}), v?.map((e) => /* @__PURE__ */
|
|
228
|
+
}), v?.map((e) => /* @__PURE__ */ l("option", {
|
|
250
229
|
value: e.id,
|
|
251
230
|
children: e.name
|
|
252
231
|
}, e.id))]
|
|
@@ -256,6 +235,6 @@ var f = [
|
|
|
256
235
|
]
|
|
257
236
|
});
|
|
258
237
|
};
|
|
259
|
-
export {
|
|
238
|
+
export { g as BotFormFields, p as DEFAULT_BOT_FORM, f as DEFAULT_BOT_ICON, d as ROUTING_STRATEGIES };
|
|
260
239
|
|
|
261
240
|
//# sourceMappingURL=BotFormFields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BotFormFields.js","names":["_Fragment","Fragment$1","ROUTING_STRATEGIES","DEFAULT_BOT_ICON","DEFAULT_BOT_FORM","ICON_CHOICES","IconChooser","t","useTr","groupRef","useRef","choices","c","value","move","next","from","delta","onChange","selected","choice","event","index","cn","BotFormFields","id","idPrefix","field","message","key","BOT_IDENTITY_MESSAGES","nameError","showErrors","errors","slugError","derivedSlug","slugify","describedBy","error","hasDescription","FormField","Input","Textarea","toUnion","mode","agents","agent"],"sources":["../../../src/botlit/components/BotFormFields.tsx"],"sourcesContent":["/**\n * Bot form fields\n * @module botlit/components\n *\n * The fields shared by the create and edit bot forms (BOFF-12439, 12440, 12443).\n * One component so validation messages, field ids and accessibility are fixed\n * once: inline errors tied to their inputs with `aria-describedby`, `aria-invalid`\n * and a native `required`, and an icon chooser that is a real radio group\n * (keyboard and screen-reader operable) instead of a button that cycles emojis.\n */\n\nimport type { FC } from 'react';\nimport { useRef } from 'react';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { FormField, Input, Textarea } from './Input';\nimport {\n BOT_IDENTITY_MESSAGES,\n BOT_NAME_MAX_LENGTH,\n BOT_SLUG_MAX_LENGTH,\n slugify,\n type BotIdentityErrors,\n} from '../utils/botIdentity';\nimport { cn } from '../utils/cn';\nimport { toUnion } from '../utils/unions';\n\n/** Routing strategies the bot form offers. */\nexport const ROUTING_STRATEGIES = ['SINGLE', 'ROUND_ROBIN', 'INTELLIGENT', 'CUSTOM'] as const;\nexport type BotRoutingStrategy = (typeof ROUTING_STRATEGIES)[number];\n\n/** Editable subset of a bot app — one field per `UpdateBotAppInput` field. */\nexport interface BotAppForm {\n name: string;\n slug: string;\n description: string;\n icon: string;\n routingStrategy: BotRoutingStrategy;\n welcomeMessage: string;\n fallbackMessage: string;\n defaultAgentId: string;\n}\n\nexport const DEFAULT_BOT_ICON = '\\u{1F916}';\n\nexport const DEFAULT_BOT_FORM: BotAppForm = {\n name: '',\n slug: '',\n description: '',\n icon: DEFAULT_BOT_ICON,\n routingStrategy: 'SINGLE',\n welcomeMessage: '',\n fallbackMessage: '',\n defaultAgentId: '',\n};\n\n/** Icons the chooser offers, with the name a screen reader announces. */\nconst ICON_CHOICES: ReadonlyArray<{ icon: string; key: string; label: string }> = [\n { icon: '🤖', key: 'robot', label: 'Robot' },\n { icon: '💼', key: 'briefcase', label: 'Briefcase' },\n { icon: '🎧', key: 'headset', label: 'Headset' },\n { icon: '📊', key: 'chart', label: 'Chart' },\n { icon: '🎯', key: 'target', label: 'Target' },\n { icon: '🔧', key: 'wrench', label: 'Wrench' },\n { icon: '📚', key: 'books', label: 'Books' },\n { icon: '💡', key: 'idea', label: 'Light bulb' },\n { icon: '🚀', key: 'rocket', label: 'Rocket' },\n { icon: '⚡', key: 'lightning', label: 'Lightning' },\n];\n\ninterface IconChooserProps {\n value: string;\n onChange: (icon: string) => void;\n}\n\nconst IconChooser: FC<IconChooserProps> = ({ value, onChange }) => {\n const t = useTr();\n const groupRef = useRef<HTMLDivElement>(null);\n // A bot may carry an icon the chooser does not list; keep it selectable.\n const choices = ICON_CHOICES.some((c) => c.icon === value)\n ? ICON_CHOICES\n : [{ icon: value, key: 'current', label: 'Current icon' }, ...ICON_CHOICES];\n\n const move = (from: number, delta: number) => {\n const next = (from + delta + choices.length) % choices.length;\n onChange(choices[next].icon);\n groupRef.current?.querySelectorAll<HTMLElement>('[role=\"radio\"]')[next]?.focus();\n };\n\n return (\n <div\n ref={groupRef}\n role=\"radiogroup\"\n aria-label={t('botlit.botDetail.form.icon', 'Icon')}\n className=\"flex flex-wrap gap-2\"\n >\n {choices.map((choice, index) => {\n const selected = choice.icon === value;\n return (\n <button\n key={choice.key}\n type=\"button\"\n role=\"radio\"\n aria-checked={selected}\n aria-label={t(`botlit.botDetail.form.icons.${choice.key}`, choice.label)}\n tabIndex={selected ? 0 : -1}\n onClick={() => onChange(choice.icon)}\n onKeyDown={(event) => {\n if (event.key === 'ArrowRight' || event.key === 'ArrowDown') {\n event.preventDefault();\n move(index, 1);\n } else if (event.key === 'ArrowLeft' || event.key === 'ArrowUp') {\n event.preventDefault();\n move(index, -1);\n }\n }}\n className={cn(\n 'rounded-lg border-2 p-3 text-3xl transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary',\n selected\n ? 'border-primary bg-accent'\n : 'border-dashed border-border-subtle hover:border-primary'\n )}\n >\n <span aria-hidden=\"true\">{choice.icon}</span>\n </button>\n );\n })}\n </div>\n );\n};\n\ninterface BotFormFieldsProps {\n /** Prefix for field ids, so the create and edit forms never collide. */\n idPrefix: string;\n value: BotAppForm;\n onChange: (next: BotAppForm) => void;\n /** Validation result; only shown once the user has tried to submit. */\n errors: BotIdentityErrors;\n showErrors: boolean;\n /** Edit mode also exposes the welcome and fallback messages and the default agent. */\n mode: 'create' | 'edit';\n agents?: ReadonlyArray<{ id: string; name: string }>;\n}\n\nexport const BotFormFields: FC<BotFormFieldsProps> = ({\n idPrefix,\n value,\n onChange,\n errors,\n showErrors,\n mode,\n agents,\n}) => {\n const t = useTr();\n const id = (field: string) => `${idPrefix}-${field}`;\n const message = (key: keyof typeof BOT_IDENTITY_MESSAGES | undefined) =>\n key\n ? t(`botlit.botDetail.form.errors.${key}`, BOT_IDENTITY_MESSAGES[key], {\n nameMax: BOT_NAME_MAX_LENGTH,\n slugMax: BOT_SLUG_MAX_LENGTH,\n })\n : undefined;\n const nameError = showErrors ? message(errors.name) : undefined;\n const slugError = showErrors ? message(errors.slug) : undefined;\n const derivedSlug = value.slug.trim() === '' ? slugify(value.name) : '';\n\n const describedBy = (field: string, error: string | undefined, hasDescription: boolean) =>\n error ? id(`${field}-error`) : hasDescription ? id(`${field}-description`) : undefined;\n\n return (\n <div className=\"space-y-6\">\n <div className=\"flex items-start gap-4\">\n <IconChooser value={value.icon} onChange={(icon) => onChange({ ...value, icon })} />\n </div>\n\n <FormField\n label={t('botlit.botDetail.form.botName', 'Bot Name')}\n required\n htmlFor={id('name')}\n error={nameError}\n >\n <Input\n id={id('name')}\n required\n maxLength={BOT_NAME_MAX_LENGTH + 20}\n aria-invalid={nameError ? true : undefined}\n aria-describedby={describedBy('name', nameError, false)}\n placeholder={t('botlit.botDetail.form.botNamePlaceholder', 'e.g., Customer Support Bot')}\n value={value.name}\n onChange={(e) => onChange({ ...value, name: e.target.value })}\n />\n </FormField>\n\n <FormField\n label={t('botlit.botDetail.form.slug', 'Slug')}\n htmlFor={id('slug')}\n error={slugError}\n description={\n derivedSlug\n ? t('botlit.botDetail.form.slugDerived', 'Will be saved as \"{{slug}}\".', {\n slug: derivedSlug,\n })\n : t(\n 'botlit.botDetail.form.slugHelp',\n 'Lowercase letters, numbers and hyphens. Left empty, it is made from the name.'\n )\n }\n >\n <Input\n id={id('slug')}\n aria-invalid={slugError ? true : undefined}\n aria-describedby={describedBy('slug', slugError, true)}\n placeholder={t('botlit.botDetail.form.slugPlaceholder', 'customer-support-bot')}\n value={value.slug}\n onChange={(e) => onChange({ ...value, slug: e.target.value })}\n />\n </FormField>\n\n <FormField\n label={t('botlit.botDetail.form.description', 'Description')}\n htmlFor={id('description')}\n >\n <Textarea\n id={id('description')}\n placeholder={t(\n 'botlit.botDetail.form.descriptionPlaceholder',\n 'Describe what this bot does...'\n )}\n value={value.description}\n onChange={(e) => onChange({ ...value, description: e.target.value })}\n rows={4}\n />\n </FormField>\n\n <FormField\n label={t('botlit.botDetail.form.routingStrategy', 'Routing Strategy')}\n htmlFor={id('routing')}\n >\n <select\n id={id('routing')}\n className=\"flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm\"\n value={value.routingStrategy}\n onChange={(e) =>\n onChange({\n ...value,\n routingStrategy: toUnion(e.target.value, ROUTING_STRATEGIES, 'SINGLE'),\n })\n }\n >\n <option value=\"SINGLE\">{t('botlit.botDetail.routing.single', 'Single')}</option>\n <option value=\"ROUND_ROBIN\">\n {t('botlit.botDetail.routing.roundRobin', 'Round Robin')}\n </option>\n <option value=\"INTELLIGENT\">\n {t('botlit.botDetail.routing.intelligent', 'Intelligent')}\n </option>\n <option value=\"CUSTOM\">{t('botlit.botDetail.routing.custom', 'Custom')}</option>\n </select>\n </FormField>\n\n {mode === 'edit' && (\n <>\n <FormField\n label={t('botlit.botDetail.form.welcomeMessage', 'Welcome Message')}\n htmlFor={id('welcome')}\n >\n <Textarea\n id={id('welcome')}\n placeholder={t(\n 'botlit.botDetail.form.welcomeMessagePlaceholder',\n 'Welcome message shown to users...'\n )}\n value={value.welcomeMessage}\n onChange={(e) => onChange({ ...value, welcomeMessage: e.target.value })}\n rows={3}\n />\n </FormField>\n\n <FormField\n label={t('botlit.botDetail.form.fallbackMessage', 'Fallback Message')}\n htmlFor={id('fallback')}\n >\n <Input\n id={id('fallback')}\n placeholder={t(\n 'botlit.botDetail.form.fallbackMessagePlaceholder',\n \"Message when agent can't respond...\"\n )}\n value={value.fallbackMessage}\n onChange={(e) => onChange({ ...value, fallbackMessage: e.target.value })}\n />\n </FormField>\n\n <FormField\n label={t('botlit.botDetail.form.defaultAgent', 'Default Agent')}\n htmlFor={id('default-agent')}\n >\n <select\n id={id('default-agent')}\n className=\"flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm\"\n value={value.defaultAgentId}\n onChange={(e) => onChange({ ...value, defaultAgentId: e.target.value })}\n >\n <option value=\"\">\n {t('botlit.botDetail.form.noDefaultAgent', 'No default agent')}\n </option>\n {agents?.map((agent) => (\n <option key={agent.id} value={agent.id}>\n {agent.name}\n </option>\n ))}\n </select>\n </FormField>\n </>\n )}\n </div>\n );\n};\n"],"mappings":";;;;;;;;AA0BA,IAAaE,IAAqB;CAAC;CAAU;CAAe;CAAe;AAAQ,GAetEC,IAAmB,MAEnBC,IAA+B;CAC1C,MAAM;CACN,MAAM;CACN,aAAa;CACb,MAAMD;CACN,iBAAiB;CACjB,gBAAgB;CAChB,iBAAiB;CACjB,gBAAgB;AAClB,GAGME,IAA4E;CAChF;EAAE,MAAM;EAAM,KAAK;EAAS,OAAO;CAAQ;CAC3C;EAAE,MAAM;EAAM,KAAK;EAAa,OAAO;CAAY;CACnD;EAAE,MAAM;EAAM,KAAK;EAAW,OAAO;CAAU;CAC/C;EAAE,MAAM;EAAM,KAAK;EAAS,OAAO;CAAQ;CAC3C;EAAE,MAAM;EAAM,KAAK;EAAU,OAAO;CAAS;CAC7C;EAAE,MAAM;EAAM,KAAK;EAAU,OAAO;CAAS;CAC7C;EAAE,MAAM;EAAM,KAAK;EAAS,OAAO;CAAQ;CAC3C;EAAE,MAAM;EAAM,KAAK;EAAQ,OAAO;CAAa;CAC/C;EAAE,MAAM;EAAM,KAAK;EAAU,OAAO;CAAS;CAC7C;EAAE,MAAM;EAAK,KAAK;EAAa,OAAO;CAAY;AACpD,GAOMC,KAAqC,EAAE,UAAO,kBAAe;CACjE,IAAMC,I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B;KAClE,SAASkB,EAAG,SAAS;KAErB,UAAA,kBAACiB,GAAD;MACE,IAAIjB,EAAG,SAAS;MAChB,aAAalB,EACX,mDACA,mCACF;MACA,OAAOM,EAAM;MACb,WAAW,MAAMK,EAAS;OAAE,GAAGL;OAAO,gBAAgB,EAAE,OAAO;MAAM,CAAC;MACtE,MAAM;KACP,CAAA;IACQ,CAAA;IAEX,kBAAC2B,GAAD;KACE,OAAOjC,EAAE,yCAAyC,kBAAkB;KACpE,SAASkB,EAAG,UAAU;KAEtB,UAAA,kBAACgB,GAAD;MACE,IAAIhB,EAAG,UAAU;MACjB,aAAalB,EACX,oDACA,qCACF;MACA,OAAOM,EAAM;MACb,WAAW,MAAMK,EAAS;OAAE,GAAGL;OAAO,iBAAiB,EAAE,OAAO;MAAM,CAAC;KACxE,CAAA;IACQ,CAAA;IAEX,kBAAC2B,GAAD;KACE,OAAOjC,EAAE,sCAAsC,eAAe;KAC9D,SAASkB,EAAG,eAAe;KAE3B,UAAA,kBAAC,UAAD;MACE,IAAIA,EAAG,eAAe;MACtB,WAAU;MACV,OAAOZ,EAAM;MACb,WAAW,MAAMK,EAAS;OAAE,GAAGL;OAAO,gBAAgB,EAAE,OAAO;MAAM,CAAC;MAJxE,UAAA,CAME,kBAAC,UAAD;OAAQ,OAAM;OACX,UAAAN,EAAE,wCAAwC,kBAAkB;MACvD,CAAA,GACPsC,GAAQ,KAAK,MACZ,kBAAC,UAAD;OAAuB,OAAOC,EAAM;OACjC,UAAAA,EAAM;MACD,GAFKA,EAAM,EAEX,CACT,CACK;;IACC,CAAA;GACX,EAAA,CAAA;EAED;;AAET"}
|
|
1
|
+
{"version":3,"file":"BotFormFields.js","names":["_Fragment","ROUTING_STRATEGIES","DEFAULT_BOT_ICON","DEFAULT_BOT_FORM","ICON_CHOICES","IconChooser","t","useTr","EmojiPicker","icon","choice","BotFormFields","id","idPrefix","field","message","key","BOT_IDENTITY_MESSAGES","nameError","showErrors","errors","slugError","derivedSlug","value","slugify","describedBy","error","hasDescription","onChange","FormField","Input","Textarea","toUnion","mode","Fragment","agents","agent"],"sources":["../../../src/botlit/components/BotFormFields.tsx"],"sourcesContent":["/**\n * Bot form fields\n * @module botlit/components\n *\n * The fields shared by the create and edit bot forms (BOFF-12439, 12440, 12443).\n * One component so validation messages, field ids and accessibility are fixed\n * once: inline errors tied to their inputs with `aria-describedby`, `aria-invalid`\n * and a native `required`, and an icon chooser that is a real radio group\n * (keyboard and screen-reader operable) instead of a button that cycles emojis.\n */\n\nimport type { FC } from 'react';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { EmojiPicker } from './EmojiPicker';\nimport { FormField, Input, Textarea } from './Input';\nimport {\n BOT_IDENTITY_MESSAGES,\n BOT_NAME_MAX_LENGTH,\n BOT_SLUG_MAX_LENGTH,\n slugify,\n type BotIdentityErrors,\n} from '../utils/botIdentity';\nimport { cn } from '../utils/cn';\nimport { toUnion } from '../utils/unions';\n\n/** Routing strategies the bot form offers. */\nexport const ROUTING_STRATEGIES = ['SINGLE', 'ROUND_ROBIN', 'INTELLIGENT', 'CUSTOM'] as const;\nexport type BotRoutingStrategy = (typeof ROUTING_STRATEGIES)[number];\n\n/** Editable subset of a bot app — one field per `UpdateBotAppInput` field. */\nexport interface BotAppForm {\n name: string;\n slug: string;\n description: string;\n icon: string;\n routingStrategy: BotRoutingStrategy;\n welcomeMessage: string;\n fallbackMessage: string;\n defaultAgentId: string;\n}\n\nexport const DEFAULT_BOT_ICON = '\\u{1F916}';\n\nexport const DEFAULT_BOT_FORM: BotAppForm = {\n name: '',\n slug: '',\n description: '',\n icon: DEFAULT_BOT_ICON,\n routingStrategy: 'SINGLE',\n welcomeMessage: '',\n fallbackMessage: '',\n defaultAgentId: '',\n};\n\n/** Icons the chooser offers, with the name a screen reader announces. */\nconst ICON_CHOICES: ReadonlyArray<{ icon: string; key: string; label: string }> = [\n { icon: '🤖', key: 'robot', label: 'Robot' },\n { icon: '💼', key: 'briefcase', label: 'Briefcase' },\n { icon: '🎧', key: 'headset', label: 'Headset' },\n { icon: '📊', key: 'chart', label: 'Chart' },\n { icon: '🎯', key: 'target', label: 'Target' },\n { icon: '🔧', key: 'wrench', label: 'Wrench' },\n { icon: '📚', key: 'books', label: 'Books' },\n { icon: '💡', key: 'idea', label: 'Light bulb' },\n { icon: '🚀', key: 'rocket', label: 'Rocket' },\n { icon: '⚡', key: 'lightning', label: 'Lightning' },\n];\n\nconst IconChooser: FC<{ value: string; onChange: (icon: string) => void }> = ({\n value,\n onChange,\n}) => {\n const t = useTr();\n return (\n <EmojiPicker\n value={value}\n onChange={onChange}\n choices={ICON_CHOICES.map(({ icon, key, label }) => ({ emoji: icon, key, label }))}\n groupLabel={t('botlit.botDetail.form.icon', 'Icon')}\n optionLabel={(choice) => t(`botlit.botDetail.form.icons.${choice.key}`, choice.label)}\n currentLabel={t('botlit.botDetail.form.icons.current', 'Current icon')}\n />\n );\n};\n\ninterface BotFormFieldsProps {\n /** Prefix for field ids, so the create and edit forms never collide. */\n idPrefix: string;\n value: BotAppForm;\n onChange: (next: BotAppForm) => void;\n /** Validation result; only shown once the user has tried to submit. */\n errors: BotIdentityErrors;\n showErrors: boolean;\n /** Edit mode also exposes the welcome and fallback messages and the default agent. */\n mode: 'create' | 'edit';\n agents?: ReadonlyArray<{ id: string; name: string }>;\n}\n\nexport const BotFormFields: FC<BotFormFieldsProps> = ({\n idPrefix,\n value,\n onChange,\n errors,\n showErrors,\n mode,\n agents,\n}) => {\n const t = useTr();\n const id = (field: string) => `${idPrefix}-${field}`;\n const message = (key: keyof typeof BOT_IDENTITY_MESSAGES | undefined) =>\n key\n ? t(`botlit.botDetail.form.errors.${key}`, BOT_IDENTITY_MESSAGES[key], {\n nameMax: BOT_NAME_MAX_LENGTH,\n slugMax: BOT_SLUG_MAX_LENGTH,\n })\n : undefined;\n const nameError = showErrors ? message(errors.name) : undefined;\n const slugError = showErrors ? message(errors.slug) : undefined;\n const derivedSlug = value.slug.trim() === '' ? slugify(value.name) : '';\n\n const describedBy = (field: string, error: string | undefined, hasDescription: boolean) =>\n error ? id(`${field}-error`) : hasDescription ? id(`${field}-description`) : undefined;\n\n return (\n <div className=\"space-y-6\">\n <div className=\"flex items-start gap-4\">\n <IconChooser value={value.icon} onChange={(icon) => onChange({ ...value, icon })} />\n </div>\n\n <FormField\n label={t('botlit.botDetail.form.botName', 'Bot Name')}\n required\n htmlFor={id('name')}\n error={nameError}\n >\n <Input\n id={id('name')}\n required\n maxLength={BOT_NAME_MAX_LENGTH + 20}\n aria-invalid={nameError ? true : undefined}\n aria-describedby={describedBy('name', nameError, false)}\n placeholder={t('botlit.botDetail.form.botNamePlaceholder', 'e.g., Customer Support Bot')}\n value={value.name}\n onChange={(e) => onChange({ ...value, name: e.target.value })}\n />\n </FormField>\n\n <FormField\n label={t('botlit.botDetail.form.slug', 'Slug')}\n htmlFor={id('slug')}\n error={slugError}\n description={\n derivedSlug\n ? t('botlit.botDetail.form.slugDerived', 'Will be saved as \"{{slug}}\".', {\n slug: derivedSlug,\n })\n : t(\n 'botlit.botDetail.form.slugHelp',\n 'Lowercase letters, numbers and hyphens. Left empty, it is made from the name.'\n )\n }\n >\n <Input\n id={id('slug')}\n aria-invalid={slugError ? true : undefined}\n aria-describedby={describedBy('slug', slugError, true)}\n placeholder={t('botlit.botDetail.form.slugPlaceholder', 'customer-support-bot')}\n value={value.slug}\n onChange={(e) => onChange({ ...value, slug: e.target.value })}\n />\n </FormField>\n\n <FormField\n label={t('botlit.botDetail.form.description', 'Description')}\n htmlFor={id('description')}\n >\n <Textarea\n id={id('description')}\n placeholder={t(\n 'botlit.botDetail.form.descriptionPlaceholder',\n 'Describe what this bot does...'\n )}\n value={value.description}\n onChange={(e) => onChange({ ...value, description: e.target.value })}\n rows={4}\n />\n </FormField>\n\n <FormField\n label={t('botlit.botDetail.form.routingStrategy', 'Routing Strategy')}\n htmlFor={id('routing')}\n >\n <select\n id={id('routing')}\n className=\"flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm\"\n value={value.routingStrategy}\n onChange={(e) =>\n onChange({\n ...value,\n routingStrategy: toUnion(e.target.value, ROUTING_STRATEGIES, 'SINGLE'),\n })\n }\n >\n <option value=\"SINGLE\">{t('botlit.botDetail.routing.single', 'Single')}</option>\n <option value=\"ROUND_ROBIN\">\n {t('botlit.botDetail.routing.roundRobin', 'Round Robin')}\n </option>\n <option value=\"INTELLIGENT\">\n {t('botlit.botDetail.routing.intelligent', 'Intelligent')}\n </option>\n <option value=\"CUSTOM\">{t('botlit.botDetail.routing.custom', 'Custom')}</option>\n </select>\n </FormField>\n\n {mode === 'edit' && (\n <>\n <FormField\n label={t('botlit.botDetail.form.welcomeMessage', 'Welcome Message')}\n htmlFor={id('welcome')}\n >\n <Textarea\n id={id('welcome')}\n placeholder={t(\n 'botlit.botDetail.form.welcomeMessagePlaceholder',\n 'Welcome message shown to users...'\n )}\n value={value.welcomeMessage}\n onChange={(e) => onChange({ ...value, welcomeMessage: e.target.value })}\n rows={3}\n />\n </FormField>\n\n <FormField\n label={t('botlit.botDetail.form.fallbackMessage', 'Fallback Message')}\n htmlFor={id('fallback')}\n >\n <Input\n id={id('fallback')}\n placeholder={t(\n 'botlit.botDetail.form.fallbackMessagePlaceholder',\n \"Message when agent can't respond...\"\n )}\n value={value.fallbackMessage}\n onChange={(e) => onChange({ ...value, fallbackMessage: e.target.value })}\n />\n </FormField>\n\n <FormField\n label={t('botlit.botDetail.form.defaultAgent', 'Default Agent')}\n htmlFor={id('default-agent')}\n >\n <select\n id={id('default-agent')}\n className=\"flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm\"\n value={value.defaultAgentId}\n onChange={(e) => onChange({ ...value, defaultAgentId: e.target.value })}\n >\n <option value=\"\">\n {t('botlit.botDetail.form.noDefaultAgent', 'No default agent')}\n </option>\n {agents?.map((agent) => (\n <option key={agent.id} value={agent.id}>\n {agent.name}\n </option>\n ))}\n </select>\n </FormField>\n </>\n )}\n </div>\n );\n};\n"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AInB,EAAG,SAAS;MAChB,aAAaN,EACX,mDACA,mCACF;MACA,OAAOiB,EAAM;MACb,WAAW,MAAMK,EAAS;OAAE,GAAGL;OAAO,gBAAgB,EAAE,OAAO;MAAM,CAAC;MACtE,MAAM;KACP,CAAA;IACQ,CAAA;IAEX,kBAACM,GAAD;KACE,OAAOvB,EAAE,yCAAyC,kBAAkB;KACpE,SAASM,EAAG,UAAU;KAEtB,UAAA,kBAACkB,GAAD;MACE,IAAIlB,EAAG,UAAU;MACjB,aAAaN,EACX,oDACA,qCACF;MACA,OAAOiB,EAAM;MACb,WAAW,MAAMK,EAAS;OAAE,GAAGL;OAAO,iBAAiB,EAAE,OAAO;MAAM,CAAC;KACxE,CAAA;IACQ,CAAA;IAEX,kBAACM,GAAD;KACE,OAAOvB,EAAE,sCAAsC,eAAe;KAC9D,SAASM,EAAG,eAAe;KAE3B,UAAA,kBAAC,UAAD;MACE,IAAIA,EAAG,eAAe;MACtB,WAAU;MACV,OAAOW,EAAM;MACb,WAAW,MAAMK,EAAS;OAAE,GAAGL;OAAO,gBAAgB,EAAE,OAAO;MAAM,CAAC;MAJxE,UAAA,CAME,kBAAC,UAAD;OAAQ,OAAM;OACX,UAAAjB,EAAE,wCAAwC,kBAAkB;MACvD,CAAA,GACP6B,GAAQ,KAAK,MACZ,kBAAC,UAAD;OAAuB,OAAOC,EAAM;OACjC,UAAAA,EAAM;MACD,GAFKA,EAAM,EAEX,CACT,CACK;;IACC,CAAA;GACX,EAAA,CAAA;EAED;;AAET"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export interface EmojiChoice {
|
|
3
|
+
emoji: string;
|
|
4
|
+
key: string;
|
|
5
|
+
/** English fallback for the accessible name. */
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
interface EmojiPickerProps {
|
|
9
|
+
value: string;
|
|
10
|
+
onChange: (emoji: string) => void;
|
|
11
|
+
choices: ReadonlyArray<EmojiChoice>;
|
|
12
|
+
/** Accessible name of the group, already translated. */
|
|
13
|
+
groupLabel: string;
|
|
14
|
+
/** Accessible name of one option, already translated. */
|
|
15
|
+
optionLabel: (choice: EmojiChoice) => string;
|
|
16
|
+
/** Name for a saved emoji the list does not offer, already translated. */
|
|
17
|
+
currentLabel: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const EmojiPicker: FC<EmojiPickerProps>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { cn as e } from "../utils/cn.js";
|
|
2
|
+
import { useRef as t } from "react";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
// src/botlit/components/EmojiPicker.tsx
|
|
5
|
+
var r = ({ value: r, onChange: i, choices: a, groupLabel: o, optionLabel: s, currentLabel: c }) => {
|
|
6
|
+
let l = t(null), u = a.some((e) => e.emoji === r) ? a : [{
|
|
7
|
+
emoji: r,
|
|
8
|
+
key: "current",
|
|
9
|
+
label: c
|
|
10
|
+
}, ...a], d = (e, t) => {
|
|
11
|
+
let n = (e + t + u.length) % u.length;
|
|
12
|
+
i(u[n].emoji), l.current?.querySelectorAll("[role=\"radio\"]")[n]?.focus();
|
|
13
|
+
};
|
|
14
|
+
return /* @__PURE__ */ n("div", {
|
|
15
|
+
ref: l,
|
|
16
|
+
role: "radiogroup",
|
|
17
|
+
"aria-label": o,
|
|
18
|
+
className: "flex flex-wrap gap-2",
|
|
19
|
+
children: u.map((t, a) => {
|
|
20
|
+
let o = t.emoji === r;
|
|
21
|
+
return /* @__PURE__ */ n("button", {
|
|
22
|
+
type: "button",
|
|
23
|
+
role: "radio",
|
|
24
|
+
"aria-checked": o,
|
|
25
|
+
"aria-label": t.key === "current" ? c : s(t),
|
|
26
|
+
tabIndex: o ? 0 : -1,
|
|
27
|
+
onClick: () => i(t.emoji),
|
|
28
|
+
onKeyDown: (e) => {
|
|
29
|
+
e.key === "ArrowRight" || e.key === "ArrowDown" ? (e.preventDefault(), d(a, 1)) : (e.key === "ArrowLeft" || e.key === "ArrowUp") && (e.preventDefault(), d(a, -1));
|
|
30
|
+
},
|
|
31
|
+
className: e("rounded-lg border-2 p-3 text-3xl transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary", o ? "border-primary bg-accent" : "border-dashed border-border-subtle hover:border-primary"),
|
|
32
|
+
children: /* @__PURE__ */ n("span", {
|
|
33
|
+
"aria-hidden": "true",
|
|
34
|
+
children: t.emoji
|
|
35
|
+
})
|
|
36
|
+
}, t.key);
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
export { r as EmojiPicker };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=EmojiPicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmojiPicker.js","names":["EmojiPicker","groupRef","useRef","options","choices","choice","value","currentLabel","move","next","from","delta","onChange","groupLabel","selected","optionLabel","event","index","cn"],"sources":["../../../src/botlit/components/EmojiPicker.tsx"],"sourcesContent":["/**\n * Emoji picker\n * @module botlit/components\n *\n * One accessible chooser for the emoji that stands for a bot or an agent\n * (BOFF-12453, BOFF-12443). It is a real radio group: arrow keys move the\n * selection, only the selected option is in the tab order, each option has a\n * name a screen reader announces, and every button is `type=\"button\"` so it\n * never submits the form it sits in.\n */\n\nimport type { FC } from 'react';\nimport { useRef } from 'react';\nimport { cn } from '../utils/cn';\n\nexport interface EmojiChoice {\n emoji: string;\n key: string;\n /** English fallback for the accessible name. */\n label: string;\n}\n\ninterface EmojiPickerProps {\n value: string;\n onChange: (emoji: string) => void;\n choices: ReadonlyArray<EmojiChoice>;\n /** Accessible name of the group, already translated. */\n groupLabel: string;\n /** Accessible name of one option, already translated. */\n optionLabel: (choice: EmojiChoice) => string;\n /** Name for a saved emoji the list does not offer, already translated. */\n currentLabel: string;\n}\n\nexport const EmojiPicker: FC<EmojiPickerProps> = ({\n value,\n onChange,\n choices,\n groupLabel,\n optionLabel,\n currentLabel,\n}) => {\n const groupRef = useRef<HTMLDivElement>(null);\n // A saved value that the list does not offer stays selectable.\n const options: ReadonlyArray<EmojiChoice> = choices.some((choice) => choice.emoji === value)\n ? choices\n : [{ emoji: value, key: 'current', label: currentLabel }, ...choices];\n\n const move = (from: number, delta: number) => {\n const next = (from + delta + options.length) % options.length;\n onChange(options[next].emoji);\n groupRef.current?.querySelectorAll<HTMLElement>('[role=\"radio\"]')[next]?.focus();\n };\n\n return (\n <div ref={groupRef} role=\"radiogroup\" aria-label={groupLabel} className=\"flex flex-wrap gap-2\">\n {options.map((choice, index) => {\n const selected = choice.emoji === value;\n return (\n <button\n key={choice.key}\n type=\"button\"\n role=\"radio\"\n aria-checked={selected}\n aria-label={choice.key === 'current' ? currentLabel : optionLabel(choice)}\n tabIndex={selected ? 0 : -1}\n onClick={() => onChange(choice.emoji)}\n onKeyDown={(event) => {\n if (event.key === 'ArrowRight' || event.key === 'ArrowDown') {\n event.preventDefault();\n move(index, 1);\n } else if (event.key === 'ArrowLeft' || event.key === 'ArrowUp') {\n event.preventDefault();\n move(index, -1);\n }\n }}\n className={cn(\n 'rounded-lg border-2 p-3 text-3xl transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary',\n selected\n ? 'border-primary bg-accent'\n : 'border-dashed border-border-subtle hover:border-primary'\n )}\n >\n <span aria-hidden=\"true\">{choice.emoji}</span>\n </button>\n );\n })}\n </div>\n );\n};\n"],"mappings":";;;;AAkCA,IAAaA,KAAqC,EAChD,UACA,aACA,YACA,eACA,gBACA,sBACI;CACJ,IAAMC,IAAWC,EAAuB,IAAI,GAEtCC,IAAsCC,EAAQ,MAAM,MAAWC,EAAO,UAAUC,CAAK,IACvFF,IACA,CAAC;EAAE,OAAOE;EAAO,KAAK;EAAW,OAAOC;CAAa,GAAG,GAAGH,CAAO,GAEhEI,KAAQ,GAAc,MAAkB;EAC5C,IAAMC,KAAQC,IAAOC,IAAQR,EAAQ,UAAUA,EAAQ;EAEvD,AADAS,EAAST,EAAQM,EAAK,CAAC,KAAK,GAC5BR,EAAS,SAAS,iBAA8B,kBAAgB,CAAC,CAACQ,EAAK,EAAE,MAAM;CACjF;CAEA,OACE,kBAAC,OAAD;EAAK,KAAKR;EAAU,MAAK;EAAa,cAAYY;EAAY,WAAU;EACrE,UAAAV,EAAQ,KAAK,GAAQ,MAAU;GAC9B,IAAMW,IAAWT,EAAO,UAAUC;GAClC,OACE,kBAAC,UAAD;IAEE,MAAK;IACL,MAAK;IACL,gBAAcQ;IACd,cAAYT,EAAO,QAAQ,YAAYE,IAAeQ,EAAYV,CAAM;IACxE,UAAUS,IAAW,IAAI;IACzB,eAAeF,EAASP,EAAO,KAAK;IACpC,YAAY,MAAU;KACpB,AAAIW,EAAM,QAAQ,gBAAgBA,EAAM,QAAQ,eAC9CA,EAAM,eAAe,GACrBR,EAAKS,GAAO,CAAC,MACJD,EAAM,QAAQ,eAAeA,EAAM,QAAQ,eACpDA,EAAM,eAAe,GACrBR,EAAKS,GAAO,EAAE;IAElB;IACA,WAAWC,EACT,iIACAJ,IACI,6BACA,yDACN;IAEA,UAAA,kBAAC,QAAD;KAAM,eAAY;KAAQ,UAAAT,EAAO;IAAY,CAAA;GACvC,GAxBDA,EAAO,GAwBN;EAEZ,CAAC;CACE,CAAA;AAET"}
|
|
@@ -10,6 +10,7 @@ export { Badge, StatusBadge } from './Badge';
|
|
|
10
10
|
export { EmptyState } from './EmptyState';
|
|
11
11
|
export { ErrorState } from './ErrorState';
|
|
12
12
|
export { ActionMenu } from './ActionMenu';
|
|
13
|
+
export { EmojiPicker } from './EmojiPicker';
|
|
13
14
|
export { ChannelSelectorSheet } from './ChannelSelectorSheet';
|
|
14
15
|
export { RouteLoader, type RouteLoaderProps } from './RouteLoader';
|
|
15
16
|
export { WorkspaceRequired, type WorkspaceRequiredProps } from './WorkspaceRequired';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useWorkspacePaginatedQuery as e } from "./workspaceGateway.js";
|
|
2
|
+
import { useEffect as t } from "react";
|
|
3
|
+
// src/botlit/hooks/internal/allPages.ts
|
|
4
|
+
function n(n) {
|
|
5
|
+
let r = e({
|
|
6
|
+
...n,
|
|
7
|
+
select: (e) => e
|
|
8
|
+
}), { hasMore: i, loadingMore: a, loadMore: o, error: s } = r;
|
|
9
|
+
return t(() => {
|
|
10
|
+
i && !a && !s && o();
|
|
11
|
+
}, [
|
|
12
|
+
i,
|
|
13
|
+
a,
|
|
14
|
+
s,
|
|
15
|
+
o
|
|
16
|
+
]), {
|
|
17
|
+
data: r.data,
|
|
18
|
+
loading: r.loading || r.loadingMore || r.hasMore && !r.error,
|
|
19
|
+
error: r.error,
|
|
20
|
+
refetch: r.refetch
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export { n as useAllPagesQuery };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=allPages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allPages.js","names":["useAllPagesQuery","result","useWorkspacePaginatedQuery","options","rows","useEffect","hasMore","loadingMore","error","loadMore"],"sources":["../../../../src/botlit/hooks/internal/allPages.ts"],"sourcesContent":["/**\n * Reads every page of a list\n * @module botlit/hooks/internal\n *\n * For lists that other pages use as a lookup (a bot's links, the MCP servers and\n * knowledge bases an agent can attach). A lookup built from the first page only\n * would call a real item \"missing\" or hide it from a picker. This pages through\n * the whole list and stays `loading` until the last page is in, so a caller never\n * derives anything from a partial set.\n */\n\nimport { useEffect } from 'react';\n\nimport {\n useWorkspacePaginatedQuery,\n type QueryResult,\n type WorkspacePaginatedQueryOptions,\n} from './workspaceGateway';\n\nexport function useAllPagesQuery<TData, TRow>(\n options: Omit<WorkspacePaginatedQueryOptions<TData, TRow, TRow[]>, 'select'>\n): QueryResult<TRow[]> {\n const result = useWorkspacePaginatedQuery<TData, TRow, TRow[]>({\n ...options,\n select: (rows) => rows,\n });\n\n const { hasMore, loadingMore, loadMore, error } = result;\n useEffect(() => {\n if (hasMore && !loadingMore && !error) void loadMore();\n }, [hasMore, loadingMore, error, loadMore]);\n\n return {\n data: result.data,\n loading: result.loading || result.loadingMore || (result.hasMore && !result.error),\n error: result.error,\n refetch: result.refetch,\n };\n}\n"],"mappings":";;;AAmBA,SAAgBA,EACd,GACqB;CACrB,IAAMC,IAASC,EAAgD;EAC7D,GAAGC;EACH,SAAS,MAASC;CACpB,CAAC,GAEK,EAAE,YAAS,gBAAa,aAAU,aAAUH;CAKlD,OAJAI,QAAgB;EACd,AAAIC,KAAW,CAACC,KAAe,CAACC,KAAOC,EAAc;CACvD,GAAG;EAACH;EAASC;EAAaC;EAAOC;CAAQ,CAAC,GAEnC;EACL,MAAMR,EAAO;EACb,SAASA,EAAO,WAAWA,EAAO,eAAgBA,EAAO,WAAW,CAACA,EAAO;EAC5E,OAAOA,EAAO;EACd,SAASA,EAAO;CAClB;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UpdateBotmanorAgentInput } from '../../generated/wspace-types';
|
|
2
|
-
import {
|
|
2
|
+
import { AgentFilter } from '../types';
|
|
3
3
|
import { GraphQLInput } from './internal/mutationInput';
|
|
4
4
|
import { PaginatedQueryResult, QueryResult } from './internal/workspaceGateway';
|
|
5
5
|
export interface AgentRecord {
|
|
@@ -7,6 +7,8 @@ export interface AgentRecord {
|
|
|
7
7
|
name: string;
|
|
8
8
|
slug: string;
|
|
9
9
|
description?: string | null;
|
|
10
|
+
/** Emoji chosen for the agent; null means the default. */
|
|
11
|
+
avatar?: string | null;
|
|
10
12
|
type: string;
|
|
11
13
|
status: string;
|
|
12
14
|
visibility?: string | null;
|
|
@@ -55,12 +57,16 @@ interface CreateAgentInput {
|
|
|
55
57
|
name: string;
|
|
56
58
|
slug?: string;
|
|
57
59
|
description?: string;
|
|
60
|
+
avatar?: string;
|
|
58
61
|
type: string;
|
|
59
62
|
systemPrompt: string;
|
|
60
63
|
temperature?: number;
|
|
61
64
|
maxTokens?: number;
|
|
65
|
+
maxConcurrentExecutions?: number;
|
|
62
66
|
capabilities?: string[];
|
|
63
67
|
llmModelId?: string;
|
|
68
|
+
knowledgeBaseIds?: string[];
|
|
69
|
+
mcpConnectionIds?: string[];
|
|
64
70
|
}
|
|
65
71
|
interface UpdateAgentInput {
|
|
66
72
|
agentId: string;
|
|
@@ -69,11 +75,11 @@ interface UpdateAgentInput {
|
|
|
69
75
|
export declare const agentKeys: {
|
|
70
76
|
all: readonly ["agents"];
|
|
71
77
|
lists: () => readonly ["agents", "list"];
|
|
72
|
-
list: (filter?:
|
|
78
|
+
list: (filter?: AgentFilter) => readonly ["agents", "list", AgentFilter | undefined];
|
|
73
79
|
details: () => readonly ["agents", "detail"];
|
|
74
80
|
detail: (id: string) => readonly ["agents", "detail", string];
|
|
75
81
|
};
|
|
76
|
-
export declare function useAgents(filter?:
|
|
82
|
+
export declare function useAgents(filter?: AgentFilter): PaginatedQueryResult<AgentRecord[]>;
|
|
77
83
|
/**
|
|
78
84
|
* Exact agent counts by status for the workspace (BOFF-12426). Unlike
|
|
79
85
|
* `useAgents` this is not capped at one page, so it is the source for
|
|
@@ -88,6 +94,21 @@ export interface AgentCounts {
|
|
|
88
94
|
archived: number;
|
|
89
95
|
}
|
|
90
96
|
export declare function useAgentCounts(enabled?: boolean): QueryResult<AgentCounts | null>;
|
|
97
|
+
/** What still uses an agent, shown in the delete confirmation (BOFF-12457). */
|
|
98
|
+
export interface AgentUsage {
|
|
99
|
+
bots: Array<{
|
|
100
|
+
id: string;
|
|
101
|
+
name: string;
|
|
102
|
+
isDefault: boolean;
|
|
103
|
+
}>;
|
|
104
|
+
a2aConnections: Array<{
|
|
105
|
+
id: string;
|
|
106
|
+
name: string;
|
|
107
|
+
}>;
|
|
108
|
+
workflowIds: string[];
|
|
109
|
+
}
|
|
110
|
+
/** Returns a function that reads what uses an agent. Reads fresh every time, because a delete is about to rely on it. */
|
|
111
|
+
export declare function useLoadAgentUsage(): (agentId: string) => Promise<AgentUsage>;
|
|
91
112
|
export declare function useAgent(agentId: string | undefined): {
|
|
92
113
|
data: AgentRecord | null;
|
|
93
114
|
loading: boolean;
|