@greatapps/greatagents-ui 0.3.5 → 0.3.7
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/index.d.ts +2 -1
- package/dist/index.js +1274 -1233
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/agents/agent-form-dialog.tsx +12 -11
- package/src/components/agents/agent-tabs.tsx +1 -10
- package/src/components/agents/agent-tools-list.tsx +11 -6
- package/src/components/capabilities/capabilities-tab.tsx +1 -1
- package/src/components/capabilities/wizard-steps/credentials-step.tsx +50 -8
- package/src/components/tools/tool-credentials-form.tsx +18 -4
- package/src/components/tools/tools-table.tsx +3 -2
package/dist/index.js
CHANGED
|
@@ -744,6 +744,7 @@ import {
|
|
|
744
744
|
} from "@greatapps/greatauth-ui/ui";
|
|
745
745
|
import { Loader2 } from "lucide-react";
|
|
746
746
|
import { toast as toast2 } from "sonner";
|
|
747
|
+
import { ImageCropUpload } from "@greatapps/greatauth-ui";
|
|
747
748
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
748
749
|
function msToSeconds(ms) {
|
|
749
750
|
if (ms == null || ms === 0) return "";
|
|
@@ -776,7 +777,8 @@ function AgentFormDialog({
|
|
|
776
777
|
config,
|
|
777
778
|
open,
|
|
778
779
|
onOpenChange,
|
|
779
|
-
agent
|
|
780
|
+
agent,
|
|
781
|
+
idAccount
|
|
780
782
|
}) {
|
|
781
783
|
const isEditing = !!agent;
|
|
782
784
|
const createAgent = useCreateAgent(config);
|
|
@@ -829,21 +831,19 @@ function AgentFormDialog({
|
|
|
829
831
|
return /* @__PURE__ */ jsx2(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs2(DialogContent, { className: "sm:max-w-lg", children: [
|
|
830
832
|
/* @__PURE__ */ jsx2(DialogHeader, { children: /* @__PURE__ */ jsx2(DialogTitle, { children: isEditing ? "Editar Agente" : "Novo Agente" }) }),
|
|
831
833
|
/* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
|
|
832
|
-
/* @__PURE__ */
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
/* @__PURE__ */ jsx2("p", { className: "text-xs text-muted-foreground", children: "URL da imagem de avatar do agente" })
|
|
846
|
-
] }),
|
|
834
|
+
/* @__PURE__ */ jsx2("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx2(
|
|
835
|
+
ImageCropUpload,
|
|
836
|
+
{
|
|
837
|
+
value: form.photo || null,
|
|
838
|
+
onChange: (url) => updateField("photo", url),
|
|
839
|
+
onRemove: () => updateField("photo", ""),
|
|
840
|
+
entityType: "agents",
|
|
841
|
+
entityId: agent?.id,
|
|
842
|
+
idAccount: typeof idAccount === "string" ? Number(idAccount) : idAccount ?? Number(config.accountId) ?? 0,
|
|
843
|
+
name: form.title || null,
|
|
844
|
+
disabled: isPending
|
|
845
|
+
}
|
|
846
|
+
) }),
|
|
847
847
|
/* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
|
|
848
848
|
/* @__PURE__ */ jsx2(Label, { htmlFor: "agent-title", children: "Nome do Agente *" }),
|
|
849
849
|
/* @__PURE__ */ jsx2(
|
|
@@ -951,7 +951,7 @@ import {
|
|
|
951
951
|
} from "@greatapps/greatauth-ui/ui";
|
|
952
952
|
import { Loader2 as Loader22 } from "lucide-react";
|
|
953
953
|
import { toast as toast3 } from "sonner";
|
|
954
|
-
import { ImageCropUpload } from "@greatapps/greatauth-ui";
|
|
954
|
+
import { ImageCropUpload as ImageCropUpload2 } from "@greatapps/greatauth-ui";
|
|
955
955
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
956
956
|
function msToSeconds2(ms) {
|
|
957
957
|
if (ms == null || ms === 0) return "";
|
|
@@ -1009,7 +1009,7 @@ function AgentEditForm({ config, agent, idAccount, open, onOpenChange }) {
|
|
|
1009
1009
|
}
|
|
1010
1010
|
const formContent = /* @__PURE__ */ jsxs3("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
|
|
1011
1011
|
/* @__PURE__ */ jsx3("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx3(
|
|
1012
|
-
|
|
1012
|
+
ImageCropUpload2,
|
|
1013
1013
|
{
|
|
1014
1014
|
value: form.photo || null,
|
|
1015
1015
|
onChange: (url) => updateField("photo", url),
|
|
@@ -1118,13 +1118,21 @@ function AgentEditForm({ config, agent, idAccount, open, onOpenChange }) {
|
|
|
1118
1118
|
return /* @__PURE__ */ jsx3("div", { className: "max-w-lg pt-4", children: formContent });
|
|
1119
1119
|
}
|
|
1120
1120
|
|
|
1121
|
-
// src/components/agents/agent-
|
|
1122
|
-
import { useState as
|
|
1121
|
+
// src/components/agents/agent-objectives-list.tsx
|
|
1122
|
+
import { useState as useState5 } from "react";
|
|
1123
1123
|
import {
|
|
1124
|
-
|
|
1125
|
-
Badge as Badge2,
|
|
1124
|
+
Input as Input4,
|
|
1126
1125
|
Button as Button4,
|
|
1126
|
+
Switch as Switch3,
|
|
1127
1127
|
Skeleton,
|
|
1128
|
+
Textarea,
|
|
1129
|
+
Label as Label3,
|
|
1130
|
+
Badge as Badge2,
|
|
1131
|
+
Dialog as Dialog3,
|
|
1132
|
+
DialogContent as DialogContent3,
|
|
1133
|
+
DialogHeader as DialogHeader3,
|
|
1134
|
+
DialogTitle as DialogTitle3,
|
|
1135
|
+
DialogFooter as DialogFooter3,
|
|
1128
1136
|
AlertDialog as AlertDialog2,
|
|
1129
1137
|
AlertDialogAction as AlertDialogAction2,
|
|
1130
1138
|
AlertDialogCancel as AlertDialogCancel2,
|
|
@@ -1132,440 +1140,107 @@ import {
|
|
|
1132
1140
|
AlertDialogDescription as AlertDialogDescription2,
|
|
1133
1141
|
AlertDialogFooter as AlertDialogFooter2,
|
|
1134
1142
|
AlertDialogHeader as AlertDialogHeader2,
|
|
1135
|
-
AlertDialogTitle as AlertDialogTitle2
|
|
1136
|
-
Popover,
|
|
1137
|
-
PopoverContent,
|
|
1138
|
-
PopoverTrigger,
|
|
1139
|
-
Input as Input4,
|
|
1140
|
-
Textarea,
|
|
1141
|
-
Dialog as Dialog3,
|
|
1142
|
-
DialogContent as DialogContent3,
|
|
1143
|
-
DialogHeader as DialogHeader3,
|
|
1144
|
-
DialogTitle as DialogTitle3,
|
|
1145
|
-
DialogFooter as DialogFooter3,
|
|
1146
|
-
Label as Label3,
|
|
1147
|
-
Select,
|
|
1148
|
-
SelectContent,
|
|
1149
|
-
SelectItem,
|
|
1150
|
-
SelectTrigger,
|
|
1151
|
-
SelectValue
|
|
1143
|
+
AlertDialogTitle as AlertDialogTitle2
|
|
1152
1144
|
} from "@greatapps/greatauth-ui/ui";
|
|
1145
|
+
|
|
1146
|
+
// src/components/ui/sortable.tsx
|
|
1153
1147
|
import {
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
idAgent: agent.id,
|
|
1189
|
-
id: agentTool.id,
|
|
1190
|
-
body: { enabled: checked }
|
|
1191
|
-
});
|
|
1192
|
-
toast4.success(checked ? "Ferramenta ativada" : "Ferramenta desativada");
|
|
1193
|
-
} catch (err) {
|
|
1194
|
-
toast4.error(
|
|
1195
|
-
err instanceof Error ? err.message : "Erro ao alterar estado da ferramenta"
|
|
1196
|
-
);
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
async function handleAdd(tool) {
|
|
1200
|
-
try {
|
|
1201
|
-
await addMutation.mutateAsync({
|
|
1202
|
-
idAgent: agent.id,
|
|
1203
|
-
body: { id_tool: tool.id }
|
|
1204
|
-
});
|
|
1205
|
-
toast4.success("Ferramenta adicionada");
|
|
1206
|
-
setAddOpen(false);
|
|
1207
|
-
setSearch("");
|
|
1208
|
-
} catch (err) {
|
|
1209
|
-
toast4.error(
|
|
1210
|
-
err instanceof Error ? err.message : "Erro ao adicionar ferramenta"
|
|
1211
|
-
);
|
|
1212
|
-
}
|
|
1213
|
-
}
|
|
1214
|
-
async function handleRemove() {
|
|
1215
|
-
if (!removeTarget) return;
|
|
1216
|
-
try {
|
|
1217
|
-
await removeMutation.mutateAsync({
|
|
1218
|
-
idAgent: agent.id,
|
|
1219
|
-
id: removeTarget.id
|
|
1220
|
-
});
|
|
1221
|
-
toast4.success("Ferramenta removida");
|
|
1222
|
-
} catch (err) {
|
|
1223
|
-
toast4.error(
|
|
1224
|
-
err instanceof Error ? err.message : "Erro ao remover ferramenta"
|
|
1225
|
-
);
|
|
1226
|
-
} finally {
|
|
1227
|
-
setRemoveTarget(null);
|
|
1228
|
-
}
|
|
1148
|
+
closestCenter,
|
|
1149
|
+
closestCorners,
|
|
1150
|
+
DndContext,
|
|
1151
|
+
DragOverlay,
|
|
1152
|
+
defaultDropAnimationSideEffects,
|
|
1153
|
+
KeyboardSensor,
|
|
1154
|
+
MouseSensor,
|
|
1155
|
+
TouchSensor,
|
|
1156
|
+
useSensor,
|
|
1157
|
+
useSensors
|
|
1158
|
+
} from "@dnd-kit/core";
|
|
1159
|
+
import {
|
|
1160
|
+
restrictToHorizontalAxis,
|
|
1161
|
+
restrictToParentElement,
|
|
1162
|
+
restrictToVerticalAxis
|
|
1163
|
+
} from "@dnd-kit/modifiers";
|
|
1164
|
+
import {
|
|
1165
|
+
arrayMove,
|
|
1166
|
+
horizontalListSortingStrategy,
|
|
1167
|
+
SortableContext,
|
|
1168
|
+
sortableKeyboardCoordinates,
|
|
1169
|
+
useSortable,
|
|
1170
|
+
verticalListSortingStrategy
|
|
1171
|
+
} from "@dnd-kit/sortable";
|
|
1172
|
+
import { CSS } from "@dnd-kit/utilities";
|
|
1173
|
+
import { Slot as SlotPrimitive } from "radix-ui";
|
|
1174
|
+
import * as React2 from "react";
|
|
1175
|
+
import * as ReactDOM from "react-dom";
|
|
1176
|
+
|
|
1177
|
+
// src/lib/compose-refs.ts
|
|
1178
|
+
import * as React from "react";
|
|
1179
|
+
function setRef(ref, value) {
|
|
1180
|
+
if (typeof ref === "function") {
|
|
1181
|
+
return ref(value);
|
|
1229
1182
|
}
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
setConfigInstructions(agentTool.custom_instructions || "");
|
|
1233
|
-
setConfigCredentialId(agentTool.id_tool_credential ? String(agentTool.id_tool_credential) : "");
|
|
1183
|
+
if (ref !== null && ref !== void 0) {
|
|
1184
|
+
ref.current = value;
|
|
1234
1185
|
}
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1186
|
+
}
|
|
1187
|
+
function composeRefs(...refs) {
|
|
1188
|
+
return (node) => {
|
|
1189
|
+
let hasCleanup = false;
|
|
1190
|
+
const cleanups = refs.map((ref) => {
|
|
1191
|
+
const cleanup = setRef(ref, node);
|
|
1192
|
+
if (!hasCleanup && typeof cleanup === "function") {
|
|
1193
|
+
hasCleanup = true;
|
|
1194
|
+
}
|
|
1195
|
+
return cleanup;
|
|
1196
|
+
});
|
|
1197
|
+
if (hasCleanup) {
|
|
1198
|
+
return () => {
|
|
1199
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
1200
|
+
const cleanup = cleanups[i];
|
|
1201
|
+
if (typeof cleanup === "function") {
|
|
1202
|
+
cleanup();
|
|
1203
|
+
} else {
|
|
1204
|
+
setRef(refs[i], null);
|
|
1205
|
+
}
|
|
1245
1206
|
}
|
|
1246
|
-
}
|
|
1247
|
-
toast4.success("Configura\xE7\xE3o atualizada");
|
|
1248
|
-
setConfigTarget(null);
|
|
1249
|
-
} catch (err) {
|
|
1250
|
-
toast4.error(
|
|
1251
|
-
err instanceof Error ? err.message : "Erro ao atualizar configura\xE7\xE3o"
|
|
1252
|
-
);
|
|
1207
|
+
};
|
|
1253
1208
|
}
|
|
1209
|
+
};
|
|
1210
|
+
}
|
|
1211
|
+
function useComposedRefs(...refs) {
|
|
1212
|
+
return React.useCallback(composeRefs(...refs), refs);
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
// src/components/ui/sortable.tsx
|
|
1216
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
1217
|
+
var orientationConfig = {
|
|
1218
|
+
vertical: {
|
|
1219
|
+
modifiers: [restrictToVerticalAxis, restrictToParentElement],
|
|
1220
|
+
strategy: verticalListSortingStrategy,
|
|
1221
|
+
collisionDetection: closestCenter
|
|
1222
|
+
},
|
|
1223
|
+
horizontal: {
|
|
1224
|
+
modifiers: [restrictToHorizontalAxis, restrictToParentElement],
|
|
1225
|
+
strategy: horizontalListSortingStrategy,
|
|
1226
|
+
collisionDetection: closestCenter
|
|
1227
|
+
},
|
|
1228
|
+
mixed: {
|
|
1229
|
+
modifiers: [restrictToParentElement],
|
|
1230
|
+
strategy: void 0,
|
|
1231
|
+
collisionDetection: closestCorners
|
|
1254
1232
|
}
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
] }),
|
|
1267
|
-
/* @__PURE__ */ jsxs4(Popover, { open: addOpen, onOpenChange: setAddOpen, children: [
|
|
1268
|
-
/* @__PURE__ */ jsx4(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs4(Button4, { size: "sm", disabled: availableTools.length === 0, children: [
|
|
1269
|
-
/* @__PURE__ */ jsx4(Plus, { className: "mr-2 h-4 w-4" }),
|
|
1270
|
-
"Adicionar Ferramenta"
|
|
1271
|
-
] }) }),
|
|
1272
|
-
/* @__PURE__ */ jsxs4(PopoverContent, { className: "w-72 p-0", align: "end", children: [
|
|
1273
|
-
/* @__PURE__ */ jsx4("div", { className: "p-2", children: /* @__PURE__ */ jsx4(
|
|
1274
|
-
Input4,
|
|
1275
|
-
{
|
|
1276
|
-
placeholder: "Buscar ferramenta\\u2026",
|
|
1277
|
-
"aria-label": "Buscar ferramenta",
|
|
1278
|
-
name: "search",
|
|
1279
|
-
value: search,
|
|
1280
|
-
onChange: (e) => setSearch(e.target.value),
|
|
1281
|
-
className: "h-8"
|
|
1282
|
-
}
|
|
1283
|
-
) }),
|
|
1284
|
-
/* @__PURE__ */ jsx4("div", { className: "max-h-48 overflow-y-auto", children: filteredAvailable.length === 0 ? /* @__PURE__ */ jsx4("p", { className: "p-3 text-center text-sm text-muted-foreground", children: "Nenhuma ferramenta dispon\xEDvel" }) : filteredAvailable.map((tool) => /* @__PURE__ */ jsxs4(
|
|
1285
|
-
"button",
|
|
1286
|
-
{
|
|
1287
|
-
type: "button",
|
|
1288
|
-
className: "flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-accent",
|
|
1289
|
-
onClick: () => handleAdd(tool),
|
|
1290
|
-
disabled: addMutation.isPending,
|
|
1291
|
-
children: [
|
|
1292
|
-
/* @__PURE__ */ jsx4(Wrench, { className: "h-4 w-4 text-muted-foreground" }),
|
|
1293
|
-
/* @__PURE__ */ jsx4("span", { className: "flex-1 font-medium", children: tool.name }),
|
|
1294
|
-
/* @__PURE__ */ jsx4(Badge2, { variant: "secondary", className: "text-xs", children: tool.type })
|
|
1295
|
-
]
|
|
1296
|
-
},
|
|
1297
|
-
tool.id
|
|
1298
|
-
)) })
|
|
1299
|
-
] })
|
|
1300
|
-
] })
|
|
1301
|
-
] }),
|
|
1302
|
-
agentTools.length === 0 ? /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
|
|
1303
|
-
/* @__PURE__ */ jsx4(Wrench, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
|
|
1304
|
-
/* @__PURE__ */ jsx4("p", { className: "text-sm text-muted-foreground", children: "Nenhuma ferramenta associada. Clique em 'Adicionar Ferramenta' para come\xE7ar." })
|
|
1305
|
-
] }) : /* @__PURE__ */ jsx4("div", { className: "space-y-2", children: agentTools.map((agentTool) => {
|
|
1306
|
-
const tool = getToolInfo(agentTool.id_tool);
|
|
1307
|
-
return /* @__PURE__ */ jsxs4(
|
|
1308
|
-
"div",
|
|
1309
|
-
{
|
|
1310
|
-
className: "flex items-center gap-3 rounded-lg border bg-card p-3",
|
|
1311
|
-
children: [
|
|
1312
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex flex-1 flex-col gap-1 min-w-0", children: [
|
|
1313
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
1314
|
-
/* @__PURE__ */ jsx4("span", { className: "truncate font-medium", children: tool?.name || `Ferramenta #${agentTool.id_tool}` }),
|
|
1315
|
-
tool?.type && /* @__PURE__ */ jsx4(Badge2, { variant: "secondary", className: "shrink-0 text-xs", children: tool.type })
|
|
1316
|
-
] }),
|
|
1317
|
-
agentTool.custom_instructions && /* @__PURE__ */ jsx4("p", { className: "truncate text-xs text-muted-foreground", children: agentTool.custom_instructions })
|
|
1318
|
-
] }),
|
|
1319
|
-
/* @__PURE__ */ jsx4(
|
|
1320
|
-
Switch3,
|
|
1321
|
-
{
|
|
1322
|
-
"aria-label": "Ativar/Desativar",
|
|
1323
|
-
checked: agentTool.enabled,
|
|
1324
|
-
onCheckedChange: (checked) => handleToggleEnabled(agentTool, checked),
|
|
1325
|
-
disabled: updateMutation.isPending
|
|
1326
|
-
}
|
|
1327
|
-
),
|
|
1328
|
-
/* @__PURE__ */ jsx4(
|
|
1329
|
-
Button4,
|
|
1330
|
-
{
|
|
1331
|
-
variant: "ghost",
|
|
1332
|
-
size: "icon",
|
|
1333
|
-
"aria-label": "Configurar",
|
|
1334
|
-
className: "shrink-0 text-muted-foreground hover:text-foreground",
|
|
1335
|
-
onClick: () => openConfig(agentTool),
|
|
1336
|
-
title: "Configurar instru\xE7\xF5es",
|
|
1337
|
-
children: /* @__PURE__ */ jsx4(Settings2, { className: "h-4 w-4" })
|
|
1338
|
-
}
|
|
1339
|
-
),
|
|
1340
|
-
/* @__PURE__ */ jsx4(
|
|
1341
|
-
Button4,
|
|
1342
|
-
{
|
|
1343
|
-
variant: "ghost",
|
|
1344
|
-
size: "icon",
|
|
1345
|
-
"aria-label": "Remover",
|
|
1346
|
-
className: "shrink-0 text-muted-foreground hover:text-destructive",
|
|
1347
|
-
onClick: () => setRemoveTarget(agentTool),
|
|
1348
|
-
children: /* @__PURE__ */ jsx4(Trash22, { className: "h-4 w-4" })
|
|
1349
|
-
}
|
|
1350
|
-
)
|
|
1351
|
-
]
|
|
1352
|
-
},
|
|
1353
|
-
agentTool.id
|
|
1354
|
-
);
|
|
1355
|
-
}) }),
|
|
1356
|
-
/* @__PURE__ */ jsx4(
|
|
1357
|
-
Dialog3,
|
|
1358
|
-
{
|
|
1359
|
-
open: !!configTarget,
|
|
1360
|
-
onOpenChange: (open) => !open && setConfigTarget(null),
|
|
1361
|
-
children: /* @__PURE__ */ jsxs4(DialogContent3, { className: "sm:max-w-lg", children: [
|
|
1362
|
-
/* @__PURE__ */ jsx4(DialogHeader3, { children: /* @__PURE__ */ jsx4(DialogTitle3, { children: "Instru\xE7\xF5es da Ferramenta" }) }),
|
|
1363
|
-
/* @__PURE__ */ jsxs4("div", { className: "space-y-4", children: [
|
|
1364
|
-
configTarget && getToolInfo(configTarget.id_tool)?.type !== "none" && /* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
|
|
1365
|
-
/* @__PURE__ */ jsx4(Label3, { htmlFor: "tool-credential", children: "Credencial" }),
|
|
1366
|
-
/* @__PURE__ */ jsxs4(
|
|
1367
|
-
Select,
|
|
1368
|
-
{
|
|
1369
|
-
value: configCredentialId || void 0,
|
|
1370
|
-
onValueChange: (val) => setConfigCredentialId(val === "__none__" ? "" : val),
|
|
1371
|
-
children: [
|
|
1372
|
-
/* @__PURE__ */ jsx4(SelectTrigger, { id: "tool-credential", children: /* @__PURE__ */ jsx4(SelectValue, { placeholder: "Selecione uma credencial (opcional)" }) }),
|
|
1373
|
-
/* @__PURE__ */ jsxs4(SelectContent, { children: [
|
|
1374
|
-
/* @__PURE__ */ jsx4(SelectItem, { value: "__none__", children: "Nenhuma (autom\xE1tico)" }),
|
|
1375
|
-
allCredentials.filter((c) => configTarget && c.id_tool === configTarget.id_tool && c.status === "active").map((c) => /* @__PURE__ */ jsx4(SelectItem, { value: String(c.id), children: c.label || `Credencial #${c.id}` }, c.id))
|
|
1376
|
-
] })
|
|
1377
|
-
]
|
|
1378
|
-
}
|
|
1379
|
-
),
|
|
1380
|
-
/* @__PURE__ */ jsx4("p", { className: "text-xs text-muted-foreground", children: "Vincule uma credencial espec\xEDfica a esta ferramenta neste agente." })
|
|
1381
|
-
] }),
|
|
1382
|
-
/* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
|
|
1383
|
-
/* @__PURE__ */ jsx4(Label3, { htmlFor: "tool-instructions", children: "Instru\xE7\xF5es Personalizadas" }),
|
|
1384
|
-
/* @__PURE__ */ jsx4(
|
|
1385
|
-
Textarea,
|
|
1386
|
-
{
|
|
1387
|
-
id: "tool-instructions",
|
|
1388
|
-
name: "instructions",
|
|
1389
|
-
value: configInstructions,
|
|
1390
|
-
onChange: (e) => setConfigInstructions(e.target.value),
|
|
1391
|
-
placeholder: "Instru\\u00e7\\u00f5es sobre como e quando o agente deve usar esta ferramenta\\u2026",
|
|
1392
|
-
rows: 6
|
|
1393
|
-
}
|
|
1394
|
-
),
|
|
1395
|
-
/* @__PURE__ */ jsx4("p", { className: "text-xs text-muted-foreground", children: "Este texto \xE9 adicionado ao prompt do agente para orientar o uso da ferramenta." })
|
|
1396
|
-
] })
|
|
1397
|
-
] }),
|
|
1398
|
-
/* @__PURE__ */ jsxs4(DialogFooter3, { children: [
|
|
1399
|
-
/* @__PURE__ */ jsx4(
|
|
1400
|
-
Button4,
|
|
1401
|
-
{
|
|
1402
|
-
variant: "outline",
|
|
1403
|
-
onClick: () => setConfigTarget(null),
|
|
1404
|
-
children: "Cancelar"
|
|
1405
|
-
}
|
|
1406
|
-
),
|
|
1407
|
-
/* @__PURE__ */ jsx4(
|
|
1408
|
-
Button4,
|
|
1409
|
-
{
|
|
1410
|
-
onClick: handleSaveConfig,
|
|
1411
|
-
disabled: updateMutation.isPending,
|
|
1412
|
-
children: "Salvar"
|
|
1413
|
-
}
|
|
1414
|
-
)
|
|
1415
|
-
] })
|
|
1416
|
-
] })
|
|
1417
|
-
}
|
|
1418
|
-
),
|
|
1419
|
-
/* @__PURE__ */ jsx4(
|
|
1420
|
-
AlertDialog2,
|
|
1421
|
-
{
|
|
1422
|
-
open: !!removeTarget,
|
|
1423
|
-
onOpenChange: (open) => !open && setRemoveTarget(null),
|
|
1424
|
-
children: /* @__PURE__ */ jsxs4(AlertDialogContent2, { children: [
|
|
1425
|
-
/* @__PURE__ */ jsxs4(AlertDialogHeader2, { children: [
|
|
1426
|
-
/* @__PURE__ */ jsx4(AlertDialogTitle2, { children: "Remover ferramenta?" }),
|
|
1427
|
-
/* @__PURE__ */ jsx4(AlertDialogDescription2, { children: "A ferramenta ser\xE1 desassociada deste agente." })
|
|
1428
|
-
] }),
|
|
1429
|
-
/* @__PURE__ */ jsxs4(AlertDialogFooter2, { children: [
|
|
1430
|
-
/* @__PURE__ */ jsx4(AlertDialogCancel2, { children: "Cancelar" }),
|
|
1431
|
-
/* @__PURE__ */ jsx4(
|
|
1432
|
-
AlertDialogAction2,
|
|
1433
|
-
{
|
|
1434
|
-
onClick: handleRemove,
|
|
1435
|
-
disabled: removeMutation.isPending,
|
|
1436
|
-
children: "Remover"
|
|
1437
|
-
}
|
|
1438
|
-
)
|
|
1439
|
-
] })
|
|
1440
|
-
] })
|
|
1441
|
-
}
|
|
1442
|
-
)
|
|
1443
|
-
] });
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
// src/components/agents/agent-objectives-list.tsx
|
|
1447
|
-
import { useState as useState6 } from "react";
|
|
1448
|
-
import {
|
|
1449
|
-
Input as Input5,
|
|
1450
|
-
Button as Button5,
|
|
1451
|
-
Switch as Switch4,
|
|
1452
|
-
Skeleton as Skeleton2,
|
|
1453
|
-
Textarea as Textarea2,
|
|
1454
|
-
Label as Label4,
|
|
1455
|
-
Badge as Badge3,
|
|
1456
|
-
Dialog as Dialog4,
|
|
1457
|
-
DialogContent as DialogContent4,
|
|
1458
|
-
DialogHeader as DialogHeader4,
|
|
1459
|
-
DialogTitle as DialogTitle4,
|
|
1460
|
-
DialogFooter as DialogFooter4,
|
|
1461
|
-
AlertDialog as AlertDialog3,
|
|
1462
|
-
AlertDialogAction as AlertDialogAction3,
|
|
1463
|
-
AlertDialogCancel as AlertDialogCancel3,
|
|
1464
|
-
AlertDialogContent as AlertDialogContent3,
|
|
1465
|
-
AlertDialogDescription as AlertDialogDescription3,
|
|
1466
|
-
AlertDialogFooter as AlertDialogFooter3,
|
|
1467
|
-
AlertDialogHeader as AlertDialogHeader3,
|
|
1468
|
-
AlertDialogTitle as AlertDialogTitle3
|
|
1469
|
-
} from "@greatapps/greatauth-ui/ui";
|
|
1470
|
-
|
|
1471
|
-
// src/components/ui/sortable.tsx
|
|
1472
|
-
import {
|
|
1473
|
-
closestCenter,
|
|
1474
|
-
closestCorners,
|
|
1475
|
-
DndContext,
|
|
1476
|
-
DragOverlay,
|
|
1477
|
-
defaultDropAnimationSideEffects,
|
|
1478
|
-
KeyboardSensor,
|
|
1479
|
-
MouseSensor,
|
|
1480
|
-
TouchSensor,
|
|
1481
|
-
useSensor,
|
|
1482
|
-
useSensors
|
|
1483
|
-
} from "@dnd-kit/core";
|
|
1484
|
-
import {
|
|
1485
|
-
restrictToHorizontalAxis,
|
|
1486
|
-
restrictToParentElement,
|
|
1487
|
-
restrictToVerticalAxis
|
|
1488
|
-
} from "@dnd-kit/modifiers";
|
|
1489
|
-
import {
|
|
1490
|
-
arrayMove,
|
|
1491
|
-
horizontalListSortingStrategy,
|
|
1492
|
-
SortableContext,
|
|
1493
|
-
sortableKeyboardCoordinates,
|
|
1494
|
-
useSortable,
|
|
1495
|
-
verticalListSortingStrategy
|
|
1496
|
-
} from "@dnd-kit/sortable";
|
|
1497
|
-
import { CSS } from "@dnd-kit/utilities";
|
|
1498
|
-
import { Slot as SlotPrimitive } from "radix-ui";
|
|
1499
|
-
import * as React2 from "react";
|
|
1500
|
-
import * as ReactDOM from "react-dom";
|
|
1501
|
-
|
|
1502
|
-
// src/lib/compose-refs.ts
|
|
1503
|
-
import * as React from "react";
|
|
1504
|
-
function setRef(ref, value) {
|
|
1505
|
-
if (typeof ref === "function") {
|
|
1506
|
-
return ref(value);
|
|
1507
|
-
}
|
|
1508
|
-
if (ref !== null && ref !== void 0) {
|
|
1509
|
-
ref.current = value;
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
|
-
function composeRefs(...refs) {
|
|
1513
|
-
return (node) => {
|
|
1514
|
-
let hasCleanup = false;
|
|
1515
|
-
const cleanups = refs.map((ref) => {
|
|
1516
|
-
const cleanup = setRef(ref, node);
|
|
1517
|
-
if (!hasCleanup && typeof cleanup === "function") {
|
|
1518
|
-
hasCleanup = true;
|
|
1519
|
-
}
|
|
1520
|
-
return cleanup;
|
|
1521
|
-
});
|
|
1522
|
-
if (hasCleanup) {
|
|
1523
|
-
return () => {
|
|
1524
|
-
for (let i = 0; i < cleanups.length; i++) {
|
|
1525
|
-
const cleanup = cleanups[i];
|
|
1526
|
-
if (typeof cleanup === "function") {
|
|
1527
|
-
cleanup();
|
|
1528
|
-
} else {
|
|
1529
|
-
setRef(refs[i], null);
|
|
1530
|
-
}
|
|
1531
|
-
}
|
|
1532
|
-
};
|
|
1533
|
-
}
|
|
1534
|
-
};
|
|
1535
|
-
}
|
|
1536
|
-
function useComposedRefs(...refs) {
|
|
1537
|
-
return React.useCallback(composeRefs(...refs), refs);
|
|
1538
|
-
}
|
|
1539
|
-
|
|
1540
|
-
// src/components/ui/sortable.tsx
|
|
1541
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1542
|
-
var orientationConfig = {
|
|
1543
|
-
vertical: {
|
|
1544
|
-
modifiers: [restrictToVerticalAxis, restrictToParentElement],
|
|
1545
|
-
strategy: verticalListSortingStrategy,
|
|
1546
|
-
collisionDetection: closestCenter
|
|
1547
|
-
},
|
|
1548
|
-
horizontal: {
|
|
1549
|
-
modifiers: [restrictToHorizontalAxis, restrictToParentElement],
|
|
1550
|
-
strategy: horizontalListSortingStrategy,
|
|
1551
|
-
collisionDetection: closestCenter
|
|
1552
|
-
},
|
|
1553
|
-
mixed: {
|
|
1554
|
-
modifiers: [restrictToParentElement],
|
|
1555
|
-
strategy: void 0,
|
|
1556
|
-
collisionDetection: closestCorners
|
|
1557
|
-
}
|
|
1558
|
-
};
|
|
1559
|
-
var ROOT_NAME = "Sortable";
|
|
1560
|
-
var CONTENT_NAME = "SortableContent";
|
|
1561
|
-
var ITEM_NAME = "SortableItem";
|
|
1562
|
-
var ITEM_HANDLE_NAME = "SortableItemHandle";
|
|
1563
|
-
var OVERLAY_NAME = "SortableOverlay";
|
|
1564
|
-
var SortableRootContext = React2.createContext(null);
|
|
1565
|
-
function useSortableContext(consumerName) {
|
|
1566
|
-
const context = React2.useContext(SortableRootContext);
|
|
1567
|
-
if (!context) {
|
|
1568
|
-
throw new Error(`\`${consumerName}\` must be used within \`${ROOT_NAME}\``);
|
|
1233
|
+
};
|
|
1234
|
+
var ROOT_NAME = "Sortable";
|
|
1235
|
+
var CONTENT_NAME = "SortableContent";
|
|
1236
|
+
var ITEM_NAME = "SortableItem";
|
|
1237
|
+
var ITEM_HANDLE_NAME = "SortableItemHandle";
|
|
1238
|
+
var OVERLAY_NAME = "SortableOverlay";
|
|
1239
|
+
var SortableRootContext = React2.createContext(null);
|
|
1240
|
+
function useSortableContext(consumerName) {
|
|
1241
|
+
const context = React2.useContext(SortableRootContext);
|
|
1242
|
+
if (!context) {
|
|
1243
|
+
throw new Error(`\`${consumerName}\` must be used within \`${ROOT_NAME}\``);
|
|
1569
1244
|
}
|
|
1570
1245
|
return context;
|
|
1571
1246
|
}
|
|
@@ -1723,11 +1398,11 @@ function Sortable(props) {
|
|
|
1723
1398
|
flatCursor
|
|
1724
1399
|
]
|
|
1725
1400
|
);
|
|
1726
|
-
return /* @__PURE__ */
|
|
1401
|
+
return /* @__PURE__ */ jsx4(
|
|
1727
1402
|
SortableRootContext.Provider,
|
|
1728
1403
|
{
|
|
1729
1404
|
value: contextValue,
|
|
1730
|
-
children: /* @__PURE__ */
|
|
1405
|
+
children: /* @__PURE__ */ jsx4(
|
|
1731
1406
|
DndContext,
|
|
1732
1407
|
{
|
|
1733
1408
|
collisionDetection: collisionDetection ?? config.collisionDetection,
|
|
@@ -1760,12 +1435,12 @@ function SortableContent(props) {
|
|
|
1760
1435
|
} = props;
|
|
1761
1436
|
const context = useSortableContext(CONTENT_NAME);
|
|
1762
1437
|
const ContentPrimitive = asChild ? SlotPrimitive.Slot : "div";
|
|
1763
|
-
return /* @__PURE__ */
|
|
1438
|
+
return /* @__PURE__ */ jsx4(SortableContentContext.Provider, { value: true, children: /* @__PURE__ */ jsx4(
|
|
1764
1439
|
SortableContext,
|
|
1765
1440
|
{
|
|
1766
1441
|
items: context.items,
|
|
1767
1442
|
strategy: strategyProp ?? context.strategy,
|
|
1768
|
-
children: withoutSlot ? children : /* @__PURE__ */
|
|
1443
|
+
children: withoutSlot ? children : /* @__PURE__ */ jsx4(
|
|
1769
1444
|
ContentPrimitive,
|
|
1770
1445
|
{
|
|
1771
1446
|
"data-slot": "sortable-content",
|
|
@@ -1841,7 +1516,7 @@ function SortableItem(props) {
|
|
|
1841
1516
|
[id, attributes, listeners, setActivatorNodeRef, isDragging, disabled]
|
|
1842
1517
|
);
|
|
1843
1518
|
const ItemPrimitive = asChild ? SlotPrimitive.Slot : "div";
|
|
1844
|
-
return /* @__PURE__ */
|
|
1519
|
+
return /* @__PURE__ */ jsx4(SortableItemContext.Provider, { value: itemContext, children: /* @__PURE__ */ jsx4(
|
|
1845
1520
|
ItemPrimitive,
|
|
1846
1521
|
{
|
|
1847
1522
|
id,
|
|
@@ -1878,7 +1553,7 @@ function SortableItemHandle(props) {
|
|
|
1878
1553
|
itemContext.setActivatorNodeRef(node);
|
|
1879
1554
|
});
|
|
1880
1555
|
const HandlePrimitive = asChild ? SlotPrimitive.Slot : "button";
|
|
1881
|
-
return /* @__PURE__ */
|
|
1556
|
+
return /* @__PURE__ */ jsx4(
|
|
1882
1557
|
HandlePrimitive,
|
|
1883
1558
|
{
|
|
1884
1559
|
type: "button",
|
|
@@ -1917,14 +1592,14 @@ function SortableOverlay(props) {
|
|
|
1917
1592
|
const container = containerProp ?? (mounted ? globalThis.document?.body : null);
|
|
1918
1593
|
if (!container) return null;
|
|
1919
1594
|
return ReactDOM.createPortal(
|
|
1920
|
-
/* @__PURE__ */
|
|
1595
|
+
/* @__PURE__ */ jsx4(
|
|
1921
1596
|
DragOverlay,
|
|
1922
1597
|
{
|
|
1923
1598
|
dropAnimation,
|
|
1924
1599
|
modifiers: context.modifiers,
|
|
1925
1600
|
className: cn(!context.flatCursor && "cursor-grabbing"),
|
|
1926
1601
|
...overlayProps,
|
|
1927
|
-
children: /* @__PURE__ */
|
|
1602
|
+
children: /* @__PURE__ */ jsx4(SortableOverlayContext.Provider, { value: true, children: context.activeId ? typeof children === "function" ? children({ value: context.activeId }) : children : null })
|
|
1928
1603
|
}
|
|
1929
1604
|
),
|
|
1930
1605
|
container
|
|
@@ -1932,9 +1607,9 @@ function SortableOverlay(props) {
|
|
|
1932
1607
|
}
|
|
1933
1608
|
|
|
1934
1609
|
// src/components/agents/agent-objectives-list.tsx
|
|
1935
|
-
import { Trash2 as
|
|
1936
|
-
import { toast as
|
|
1937
|
-
import { jsx as
|
|
1610
|
+
import { Trash2 as Trash22, Target, Pencil as Pencil2, Plus, GripVertical } from "lucide-react";
|
|
1611
|
+
import { toast as toast4 } from "sonner";
|
|
1612
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1938
1613
|
function slugify(text) {
|
|
1939
1614
|
return text.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1940
1615
|
}
|
|
@@ -1944,11 +1619,11 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
1944
1619
|
const createMutation = useCreateObjective(config);
|
|
1945
1620
|
const updateMutation = useUpdateObjective(config);
|
|
1946
1621
|
const deleteMutation = useDeleteObjective(config);
|
|
1947
|
-
const [formOpen, setFormOpen] =
|
|
1948
|
-
const [editTarget, setEditTarget] =
|
|
1949
|
-
const [form, setForm] =
|
|
1950
|
-
const [slugManual, setSlugManual] =
|
|
1951
|
-
const [removeTarget, setRemoveTarget] =
|
|
1622
|
+
const [formOpen, setFormOpen] = useState5(false);
|
|
1623
|
+
const [editTarget, setEditTarget] = useState5(null);
|
|
1624
|
+
const [form, setForm] = useState5(EMPTY_FORM);
|
|
1625
|
+
const [slugManual, setSlugManual] = useState5(false);
|
|
1626
|
+
const [removeTarget, setRemoveTarget] = useState5(null);
|
|
1952
1627
|
const objectives = objectivesData?.data || [];
|
|
1953
1628
|
const sortedObjectives = [...objectives].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
1954
1629
|
async function handleReorder(newItems) {
|
|
@@ -1961,9 +1636,9 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
1961
1636
|
body: { order: item.order }
|
|
1962
1637
|
});
|
|
1963
1638
|
}
|
|
1964
|
-
|
|
1639
|
+
toast4.success("Ordem atualizada");
|
|
1965
1640
|
} catch {
|
|
1966
|
-
|
|
1641
|
+
toast4.error("Erro ao reordenar objetivos");
|
|
1967
1642
|
}
|
|
1968
1643
|
}
|
|
1969
1644
|
function openCreate() {
|
|
@@ -1997,7 +1672,7 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
1997
1672
|
prompt: form.prompt.trim() || null
|
|
1998
1673
|
}
|
|
1999
1674
|
});
|
|
2000
|
-
|
|
1675
|
+
toast4.success("Objetivo atualizado");
|
|
2001
1676
|
} else {
|
|
2002
1677
|
await createMutation.mutateAsync({
|
|
2003
1678
|
idAgent: agent.id,
|
|
@@ -2008,11 +1683,11 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
2008
1683
|
order: nextOrder
|
|
2009
1684
|
}
|
|
2010
1685
|
});
|
|
2011
|
-
|
|
1686
|
+
toast4.success("Objetivo criado");
|
|
2012
1687
|
}
|
|
2013
1688
|
setFormOpen(false);
|
|
2014
1689
|
} catch (err) {
|
|
2015
|
-
|
|
1690
|
+
toast4.error(
|
|
2016
1691
|
err instanceof Error ? err.message : editTarget ? "Erro ao atualizar objetivo" : "Erro ao criar objetivo"
|
|
2017
1692
|
);
|
|
2018
1693
|
}
|
|
@@ -2024,9 +1699,9 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
2024
1699
|
id: objective.id,
|
|
2025
1700
|
body: { active: checked }
|
|
2026
1701
|
});
|
|
2027
|
-
|
|
1702
|
+
toast4.success(checked ? "Objetivo ativado" : "Objetivo desativado");
|
|
2028
1703
|
} catch (err) {
|
|
2029
|
-
|
|
1704
|
+
toast4.error(
|
|
2030
1705
|
err instanceof Error ? err.message : "Erro ao alterar estado do objetivo"
|
|
2031
1706
|
);
|
|
2032
1707
|
}
|
|
@@ -2038,9 +1713,9 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
2038
1713
|
idAgent: agent.id,
|
|
2039
1714
|
id: removeTarget.id
|
|
2040
1715
|
});
|
|
2041
|
-
|
|
1716
|
+
toast4.success("Objetivo removido");
|
|
2042
1717
|
} catch (err) {
|
|
2043
|
-
|
|
1718
|
+
toast4.error(
|
|
2044
1719
|
err instanceof Error ? err.message : "Erro ao remover o objetivo"
|
|
2045
1720
|
);
|
|
2046
1721
|
} finally {
|
|
@@ -2048,51 +1723,51 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
2048
1723
|
}
|
|
2049
1724
|
}
|
|
2050
1725
|
if (isLoading) {
|
|
2051
|
-
return /* @__PURE__ */
|
|
1726
|
+
return /* @__PURE__ */ jsx5("div", { className: "space-y-3 p-4", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx5(Skeleton, { className: "h-14 w-full" }, i)) });
|
|
2052
1727
|
}
|
|
2053
|
-
return /* @__PURE__ */
|
|
2054
|
-
/* @__PURE__ */
|
|
2055
|
-
/* @__PURE__ */
|
|
2056
|
-
/* @__PURE__ */
|
|
1728
|
+
return /* @__PURE__ */ jsxs4("div", { className: "space-y-4 p-4", children: [
|
|
1729
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between", children: [
|
|
1730
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
1731
|
+
/* @__PURE__ */ jsxs4("h3", { className: "text-sm font-medium text-muted-foreground", children: [
|
|
2057
1732
|
sortedObjectives.length,
|
|
2058
1733
|
" objetivo",
|
|
2059
1734
|
sortedObjectives.length !== 1 ? "s" : "",
|
|
2060
1735
|
" definido",
|
|
2061
1736
|
sortedObjectives.length !== 1 ? "s" : ""
|
|
2062
1737
|
] }),
|
|
2063
|
-
/* @__PURE__ */
|
|
1738
|
+
/* @__PURE__ */ jsx5("p", { className: "text-xs text-muted-foreground", children: "Objetivos s\xE3o modos de conversa que o agente ativa automaticamente conforme a inten\xE7\xE3o do utilizador." })
|
|
2064
1739
|
] }),
|
|
2065
|
-
/* @__PURE__ */
|
|
2066
|
-
/* @__PURE__ */
|
|
1740
|
+
/* @__PURE__ */ jsxs4(Button4, { onClick: openCreate, size: "sm", children: [
|
|
1741
|
+
/* @__PURE__ */ jsx5(Plus, { className: "mr-2 h-4 w-4" }),
|
|
2067
1742
|
"Novo Objetivo"
|
|
2068
1743
|
] })
|
|
2069
1744
|
] }),
|
|
2070
|
-
sortedObjectives.length === 0 ? /* @__PURE__ */
|
|
2071
|
-
/* @__PURE__ */
|
|
2072
|
-
/* @__PURE__ */
|
|
2073
|
-
] }) : /* @__PURE__ */
|
|
1745
|
+
sortedObjectives.length === 0 ? /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
|
|
1746
|
+
/* @__PURE__ */ jsx5(Target, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
|
|
1747
|
+
/* @__PURE__ */ jsx5("p", { className: "text-sm text-muted-foreground", children: "Nenhum objetivo definido. Adicione objetivos para orientar o agente em diferentes contextos." })
|
|
1748
|
+
] }) : /* @__PURE__ */ jsxs4(
|
|
2074
1749
|
Sortable,
|
|
2075
1750
|
{
|
|
2076
1751
|
value: sortedObjectives,
|
|
2077
1752
|
onValueChange: handleReorder,
|
|
2078
1753
|
getItemValue: (item) => item.id,
|
|
2079
1754
|
children: [
|
|
2080
|
-
/* @__PURE__ */
|
|
1755
|
+
/* @__PURE__ */ jsx5(SortableContent, { className: "space-y-2", children: sortedObjectives.map((objective) => /* @__PURE__ */ jsxs4(
|
|
2081
1756
|
SortableItem,
|
|
2082
1757
|
{
|
|
2083
1758
|
value: objective.id,
|
|
2084
1759
|
className: "flex items-center gap-3 rounded-lg border bg-card p-3",
|
|
2085
1760
|
children: [
|
|
2086
|
-
/* @__PURE__ */
|
|
2087
|
-
/* @__PURE__ */
|
|
2088
|
-
/* @__PURE__ */
|
|
2089
|
-
/* @__PURE__ */
|
|
2090
|
-
objective.slug && /* @__PURE__ */
|
|
1761
|
+
/* @__PURE__ */ jsx5(SortableItemHandle, { className: "shrink-0 text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ jsx5(GripVertical, { "aria-hidden": "true", className: "h-5 w-5" }) }),
|
|
1762
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-1 flex-col gap-1 min-w-0", children: [
|
|
1763
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
1764
|
+
/* @__PURE__ */ jsx5("span", { className: "truncate font-medium", children: objective.title }),
|
|
1765
|
+
objective.slug && /* @__PURE__ */ jsx5(Badge2, { variant: "secondary", className: "shrink-0 text-xs font-mono", children: objective.slug })
|
|
2091
1766
|
] }),
|
|
2092
|
-
objective.prompt && /* @__PURE__ */
|
|
1767
|
+
objective.prompt && /* @__PURE__ */ jsx5("p", { className: "line-clamp-2 text-xs text-muted-foreground", children: objective.prompt })
|
|
2093
1768
|
] }),
|
|
2094
|
-
/* @__PURE__ */
|
|
2095
|
-
|
|
1769
|
+
/* @__PURE__ */ jsx5(
|
|
1770
|
+
Switch3,
|
|
2096
1771
|
{
|
|
2097
1772
|
"aria-label": "Ativar/Desativar",
|
|
2098
1773
|
checked: objective.active,
|
|
@@ -2100,49 +1775,49 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
2100
1775
|
disabled: updateMutation.isPending
|
|
2101
1776
|
}
|
|
2102
1777
|
),
|
|
2103
|
-
/* @__PURE__ */
|
|
2104
|
-
|
|
1778
|
+
/* @__PURE__ */ jsx5(
|
|
1779
|
+
Button4,
|
|
2105
1780
|
{
|
|
2106
1781
|
variant: "ghost",
|
|
2107
1782
|
size: "icon",
|
|
2108
1783
|
"aria-label": "Editar",
|
|
2109
1784
|
className: "shrink-0 text-muted-foreground hover:text-foreground",
|
|
2110
1785
|
onClick: () => openEdit(objective),
|
|
2111
|
-
children: /* @__PURE__ */
|
|
1786
|
+
children: /* @__PURE__ */ jsx5(Pencil2, { className: "h-4 w-4" })
|
|
2112
1787
|
}
|
|
2113
1788
|
),
|
|
2114
|
-
/* @__PURE__ */
|
|
2115
|
-
|
|
1789
|
+
/* @__PURE__ */ jsx5(
|
|
1790
|
+
Button4,
|
|
2116
1791
|
{
|
|
2117
1792
|
variant: "ghost",
|
|
2118
1793
|
size: "icon",
|
|
2119
1794
|
"aria-label": "Excluir",
|
|
2120
1795
|
className: "shrink-0 text-muted-foreground hover:text-destructive",
|
|
2121
1796
|
onClick: () => setRemoveTarget(objective),
|
|
2122
|
-
children: /* @__PURE__ */
|
|
1797
|
+
children: /* @__PURE__ */ jsx5(Trash22, { className: "h-4 w-4" })
|
|
2123
1798
|
}
|
|
2124
1799
|
)
|
|
2125
1800
|
]
|
|
2126
1801
|
},
|
|
2127
1802
|
objective.id
|
|
2128
1803
|
)) }),
|
|
2129
|
-
/* @__PURE__ */
|
|
1804
|
+
/* @__PURE__ */ jsx5(SortableOverlay, { children: ({ value }) => {
|
|
2130
1805
|
const obj = sortedObjectives.find((o) => o.id === value);
|
|
2131
|
-
return /* @__PURE__ */
|
|
2132
|
-
/* @__PURE__ */
|
|
2133
|
-
/* @__PURE__ */
|
|
1806
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3 rounded-lg border bg-card p-3 shadow-lg", children: [
|
|
1807
|
+
/* @__PURE__ */ jsx5(GripVertical, { "aria-hidden": "true", className: "h-5 w-5 text-muted-foreground" }),
|
|
1808
|
+
/* @__PURE__ */ jsx5("span", { className: "font-medium", children: obj?.title })
|
|
2134
1809
|
] });
|
|
2135
1810
|
} })
|
|
2136
1811
|
]
|
|
2137
1812
|
}
|
|
2138
1813
|
),
|
|
2139
|
-
/* @__PURE__ */
|
|
2140
|
-
/* @__PURE__ */
|
|
2141
|
-
/* @__PURE__ */
|
|
2142
|
-
/* @__PURE__ */
|
|
2143
|
-
/* @__PURE__ */
|
|
2144
|
-
/* @__PURE__ */
|
|
2145
|
-
|
|
1814
|
+
/* @__PURE__ */ jsx5(Dialog3, { open: formOpen, onOpenChange: setFormOpen, children: /* @__PURE__ */ jsxs4(DialogContent3, { className: "sm:max-w-lg", children: [
|
|
1815
|
+
/* @__PURE__ */ jsx5(DialogHeader3, { children: /* @__PURE__ */ jsx5(DialogTitle3, { children: editTarget ? "Editar Objetivo" : "Novo Objetivo" }) }),
|
|
1816
|
+
/* @__PURE__ */ jsxs4("div", { className: "space-y-4", children: [
|
|
1817
|
+
/* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
|
|
1818
|
+
/* @__PURE__ */ jsx5(Label3, { htmlFor: "objective-title", children: "T\xEDtulo *" }),
|
|
1819
|
+
/* @__PURE__ */ jsx5(
|
|
1820
|
+
Input4,
|
|
2146
1821
|
{
|
|
2147
1822
|
id: "objective-title",
|
|
2148
1823
|
name: "title",
|
|
@@ -2159,10 +1834,10 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
2159
1834
|
}
|
|
2160
1835
|
)
|
|
2161
1836
|
] }),
|
|
2162
|
-
/* @__PURE__ */
|
|
2163
|
-
/* @__PURE__ */
|
|
2164
|
-
/* @__PURE__ */
|
|
2165
|
-
|
|
1837
|
+
/* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
|
|
1838
|
+
/* @__PURE__ */ jsx5(Label3, { htmlFor: "objective-slug", children: "Slug (identificador) *" }),
|
|
1839
|
+
/* @__PURE__ */ jsx5(
|
|
1840
|
+
Input4,
|
|
2166
1841
|
{
|
|
2167
1842
|
id: "objective-slug",
|
|
2168
1843
|
name: "slug",
|
|
@@ -2175,12 +1850,12 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
2175
1850
|
className: "font-mono"
|
|
2176
1851
|
}
|
|
2177
1852
|
),
|
|
2178
|
-
/* @__PURE__ */
|
|
1853
|
+
/* @__PURE__ */ jsx5("p", { className: "text-xs text-muted-foreground", children: "Gerado automaticamente. Usado pelo agente para identificar o objetivo." })
|
|
2179
1854
|
] }),
|
|
2180
|
-
/* @__PURE__ */
|
|
2181
|
-
/* @__PURE__ */
|
|
2182
|
-
/* @__PURE__ */
|
|
2183
|
-
|
|
1855
|
+
/* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
|
|
1856
|
+
/* @__PURE__ */ jsx5(Label3, { htmlFor: "objective-prompt", children: "Instru\xE7\xF5es do Objetivo" }),
|
|
1857
|
+
/* @__PURE__ */ jsx5(
|
|
1858
|
+
Textarea,
|
|
2184
1859
|
{
|
|
2185
1860
|
id: "objective-prompt",
|
|
2186
1861
|
name: "prompt",
|
|
@@ -2190,20 +1865,20 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
2190
1865
|
rows: 8
|
|
2191
1866
|
}
|
|
2192
1867
|
),
|
|
2193
|
-
/* @__PURE__ */
|
|
1868
|
+
/* @__PURE__ */ jsx5("p", { className: "text-xs text-muted-foreground", children: "Estas instru\xE7\xF5es s\xE3o carregadas automaticamente quando o agente detecta que o utilizador precisa deste objetivo." })
|
|
2194
1869
|
] })
|
|
2195
1870
|
] }),
|
|
2196
|
-
/* @__PURE__ */
|
|
2197
|
-
/* @__PURE__ */
|
|
2198
|
-
|
|
1871
|
+
/* @__PURE__ */ jsxs4(DialogFooter3, { children: [
|
|
1872
|
+
/* @__PURE__ */ jsx5(
|
|
1873
|
+
Button4,
|
|
2199
1874
|
{
|
|
2200
1875
|
variant: "outline",
|
|
2201
1876
|
onClick: () => setFormOpen(false),
|
|
2202
1877
|
children: "Cancelar"
|
|
2203
1878
|
}
|
|
2204
1879
|
),
|
|
2205
|
-
/* @__PURE__ */
|
|
2206
|
-
|
|
1880
|
+
/* @__PURE__ */ jsx5(
|
|
1881
|
+
Button4,
|
|
2207
1882
|
{
|
|
2208
1883
|
onClick: handleSubmit,
|
|
2209
1884
|
disabled: !form.title.trim() || createMutation.isPending || updateMutation.isPending,
|
|
@@ -2212,20 +1887,20 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
2212
1887
|
)
|
|
2213
1888
|
] })
|
|
2214
1889
|
] }) }),
|
|
2215
|
-
/* @__PURE__ */
|
|
2216
|
-
|
|
1890
|
+
/* @__PURE__ */ jsx5(
|
|
1891
|
+
AlertDialog2,
|
|
2217
1892
|
{
|
|
2218
1893
|
open: !!removeTarget,
|
|
2219
1894
|
onOpenChange: (open) => !open && setRemoveTarget(null),
|
|
2220
|
-
children: /* @__PURE__ */
|
|
2221
|
-
/* @__PURE__ */
|
|
2222
|
-
/* @__PURE__ */
|
|
2223
|
-
/* @__PURE__ */
|
|
1895
|
+
children: /* @__PURE__ */ jsxs4(AlertDialogContent2, { children: [
|
|
1896
|
+
/* @__PURE__ */ jsxs4(AlertDialogHeader2, { children: [
|
|
1897
|
+
/* @__PURE__ */ jsx5(AlertDialogTitle2, { children: "Remover objetivo?" }),
|
|
1898
|
+
/* @__PURE__ */ jsx5(AlertDialogDescription2, { children: "O objetivo ser\xE1 removido permanentemente." })
|
|
2224
1899
|
] }),
|
|
2225
|
-
/* @__PURE__ */
|
|
2226
|
-
/* @__PURE__ */
|
|
2227
|
-
/* @__PURE__ */
|
|
2228
|
-
|
|
1900
|
+
/* @__PURE__ */ jsxs4(AlertDialogFooter2, { children: [
|
|
1901
|
+
/* @__PURE__ */ jsx5(AlertDialogCancel2, { children: "Cancelar" }),
|
|
1902
|
+
/* @__PURE__ */ jsx5(
|
|
1903
|
+
AlertDialogAction2,
|
|
2229
1904
|
{
|
|
2230
1905
|
onClick: handleRemove,
|
|
2231
1906
|
disabled: deleteMutation.isPending,
|
|
@@ -2240,11 +1915,11 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
2240
1915
|
}
|
|
2241
1916
|
|
|
2242
1917
|
// src/components/agents/agent-prompt-editor.tsx
|
|
2243
|
-
import { useState as
|
|
2244
|
-
import { Button as
|
|
1918
|
+
import { useState as useState6, useRef, useCallback as useCallback3, useEffect as useEffect3 } from "react";
|
|
1919
|
+
import { Button as Button5, Input as Input5, Skeleton as Skeleton2, Badge as Badge3 } from "@greatapps/greatauth-ui/ui";
|
|
2245
1920
|
import { FileText, Loader2 as Loader23, ChevronDown, ChevronUp, RotateCcw } from "lucide-react";
|
|
2246
|
-
import { toast as
|
|
2247
|
-
import { jsx as
|
|
1921
|
+
import { toast as toast5 } from "sonner";
|
|
1922
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2248
1923
|
function formatDate(dateStr) {
|
|
2249
1924
|
const date = new Date(dateStr);
|
|
2250
1925
|
return date.toLocaleDateString("pt-BR", {
|
|
@@ -2317,12 +1992,12 @@ function AgentPromptEditor({ config, agent }) {
|
|
|
2317
1992
|
);
|
|
2318
1993
|
const currentVersion = sortedVersions.find((v) => v.is_current) || sortedVersions[0] || null;
|
|
2319
1994
|
const currentPromptContent = currentVersion?.prompt_content ?? "";
|
|
2320
|
-
const [trackedAgentId, setTrackedAgentId] =
|
|
2321
|
-
const [promptText, setPromptText] =
|
|
2322
|
-
const [promptInitialized, setPromptInitialized] =
|
|
2323
|
-
const [changeNotes, setChangeNotes] =
|
|
2324
|
-
const [showPreview, setShowPreview] =
|
|
2325
|
-
const [compareVersionId, setCompareVersionId] =
|
|
1995
|
+
const [trackedAgentId, setTrackedAgentId] = useState6(agent.id);
|
|
1996
|
+
const [promptText, setPromptText] = useState6(currentPromptContent);
|
|
1997
|
+
const [promptInitialized, setPromptInitialized] = useState6(false);
|
|
1998
|
+
const [changeNotes, setChangeNotes] = useState6("");
|
|
1999
|
+
const [showPreview, setShowPreview] = useState6(false);
|
|
2000
|
+
const [compareVersionId, setCompareVersionId] = useState6(null);
|
|
2326
2001
|
const textareaRef = useRef(null);
|
|
2327
2002
|
if (!promptInitialized && currentPromptContent && !isLoading) {
|
|
2328
2003
|
setPromptText(currentPromptContent);
|
|
@@ -2369,15 +2044,15 @@ function AgentPromptEditor({ config, agent }) {
|
|
|
2369
2044
|
try {
|
|
2370
2045
|
await updateAgent.mutateAsync({ id: agent.id, body });
|
|
2371
2046
|
setChangeNotes("");
|
|
2372
|
-
|
|
2047
|
+
toast5.success("Prompt salvo com sucesso");
|
|
2373
2048
|
} catch {
|
|
2374
|
-
|
|
2049
|
+
toast5.error("Erro ao salvar prompt");
|
|
2375
2050
|
}
|
|
2376
2051
|
}
|
|
2377
2052
|
function handleRestore(version) {
|
|
2378
2053
|
setPromptText(version.prompt_content ?? "");
|
|
2379
2054
|
setChangeNotes(`Restaurado da v${version.version_number}`);
|
|
2380
|
-
|
|
2055
|
+
toast5.info("Prompt restaurado no editor. Clique em Salvar para confirmar.");
|
|
2381
2056
|
}
|
|
2382
2057
|
const charCount = promptText.length;
|
|
2383
2058
|
const tokenEstimate = Math.ceil(charCount / 4);
|
|
@@ -2386,12 +2061,12 @@ function AgentPromptEditor({ config, agent }) {
|
|
|
2386
2061
|
const allTools = toolsData?.data || [];
|
|
2387
2062
|
const previewText = buildPreview(promptText, objectives, agentTools, allTools);
|
|
2388
2063
|
if (isLoading) {
|
|
2389
|
-
return /* @__PURE__ */
|
|
2064
|
+
return /* @__PURE__ */ jsx6("div", { className: "space-y-3 p-4", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx6(Skeleton2, { className: "h-14 w-full" }, i)) });
|
|
2390
2065
|
}
|
|
2391
|
-
return /* @__PURE__ */
|
|
2392
|
-
/* @__PURE__ */
|
|
2393
|
-
/* @__PURE__ */
|
|
2394
|
-
/* @__PURE__ */
|
|
2066
|
+
return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-4 p-4 lg:flex-row", children: [
|
|
2067
|
+
/* @__PURE__ */ jsxs5("div", { className: "min-w-0 flex-1 space-y-4", children: [
|
|
2068
|
+
/* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
|
|
2069
|
+
/* @__PURE__ */ jsx6(
|
|
2395
2070
|
"textarea",
|
|
2396
2071
|
{
|
|
2397
2072
|
ref: textareaRef,
|
|
@@ -2406,22 +2081,22 @@ function AgentPromptEditor({ config, agent }) {
|
|
|
2406
2081
|
style: { minHeight: "300px" }
|
|
2407
2082
|
}
|
|
2408
2083
|
),
|
|
2409
|
-
/* @__PURE__ */
|
|
2410
|
-
/* @__PURE__ */
|
|
2084
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3 text-xs text-muted-foreground", children: [
|
|
2085
|
+
/* @__PURE__ */ jsxs5("span", { className: "tabular-nums", children: [
|
|
2411
2086
|
charCount.toLocaleString("pt-BR"),
|
|
2412
2087
|
" caracteres"
|
|
2413
2088
|
] }),
|
|
2414
|
-
/* @__PURE__ */
|
|
2415
|
-
/* @__PURE__ */
|
|
2089
|
+
/* @__PURE__ */ jsx6("span", { children: "\xB7" }),
|
|
2090
|
+
/* @__PURE__ */ jsxs5("span", { className: "tabular-nums", children: [
|
|
2416
2091
|
"~",
|
|
2417
2092
|
tokenEstimate.toLocaleString("pt-BR"),
|
|
2418
2093
|
" tokens"
|
|
2419
2094
|
] })
|
|
2420
2095
|
] })
|
|
2421
2096
|
] }),
|
|
2422
|
-
/* @__PURE__ */
|
|
2423
|
-
/* @__PURE__ */
|
|
2424
|
-
|
|
2097
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3", children: [
|
|
2098
|
+
/* @__PURE__ */ jsx6(
|
|
2099
|
+
Input5,
|
|
2425
2100
|
{
|
|
2426
2101
|
"aria-label": "Notas da altera\xE7\xE3o",
|
|
2427
2102
|
name: "changeNotes",
|
|
@@ -2438,34 +2113,34 @@ function AgentPromptEditor({ config, agent }) {
|
|
|
2438
2113
|
}
|
|
2439
2114
|
}
|
|
2440
2115
|
),
|
|
2441
|
-
/* @__PURE__ */
|
|
2442
|
-
|
|
2116
|
+
/* @__PURE__ */ jsxs5(
|
|
2117
|
+
Button5,
|
|
2443
2118
|
{
|
|
2444
2119
|
onClick: handleSave,
|
|
2445
2120
|
disabled: updateAgent.isPending || !promptText.trim(),
|
|
2446
2121
|
children: [
|
|
2447
|
-
updateAgent.isPending && /* @__PURE__ */
|
|
2122
|
+
updateAgent.isPending && /* @__PURE__ */ jsx6(Loader23, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
2448
2123
|
"Salvar"
|
|
2449
2124
|
]
|
|
2450
2125
|
}
|
|
2451
2126
|
)
|
|
2452
2127
|
] }),
|
|
2453
|
-
/* @__PURE__ */
|
|
2454
|
-
/* @__PURE__ */
|
|
2128
|
+
/* @__PURE__ */ jsxs5("div", { className: "rounded-lg border", children: [
|
|
2129
|
+
/* @__PURE__ */ jsxs5(
|
|
2455
2130
|
"button",
|
|
2456
2131
|
{
|
|
2457
2132
|
type: "button",
|
|
2458
2133
|
onClick: () => setShowPreview((prev) => !prev),
|
|
2459
2134
|
className: "flex w-full items-center justify-between px-4 py-3 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",
|
|
2460
2135
|
children: [
|
|
2461
|
-
/* @__PURE__ */
|
|
2462
|
-
showPreview ? /* @__PURE__ */
|
|
2136
|
+
/* @__PURE__ */ jsx6("span", { children: "Preview do prompt final" }),
|
|
2137
|
+
showPreview ? /* @__PURE__ */ jsx6(ChevronUp, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx6(ChevronDown, { className: "h-4 w-4" })
|
|
2463
2138
|
]
|
|
2464
2139
|
}
|
|
2465
2140
|
),
|
|
2466
|
-
showPreview && /* @__PURE__ */
|
|
2141
|
+
showPreview && /* @__PURE__ */ jsx6("div", { className: "border-t px-4 py-3", children: /* @__PURE__ */ jsx6("pre", { className: "max-h-96 overflow-auto whitespace-pre-wrap font-mono text-sm leading-relaxed", children: previewText.split("\n").map((line, i) => {
|
|
2467
2142
|
const isSection = line.startsWith("[SKILLS DISPON\xCDVEIS]") || line.startsWith("[TOOLS DISPON\xCDVEIS]");
|
|
2468
|
-
return /* @__PURE__ */
|
|
2143
|
+
return /* @__PURE__ */ jsxs5(
|
|
2469
2144
|
"span",
|
|
2470
2145
|
{
|
|
2471
2146
|
className: isSection ? "font-semibold text-muted-foreground" : "",
|
|
@@ -2478,17 +2153,17 @@ function AgentPromptEditor({ config, agent }) {
|
|
|
2478
2153
|
);
|
|
2479
2154
|
}) }) })
|
|
2480
2155
|
] }),
|
|
2481
|
-
diffLines && compareVersion && currentVersion && /* @__PURE__ */
|
|
2482
|
-
/* @__PURE__ */
|
|
2483
|
-
/* @__PURE__ */
|
|
2156
|
+
diffLines && compareVersion && currentVersion && /* @__PURE__ */ jsxs5("div", { children: [
|
|
2157
|
+
/* @__PURE__ */ jsxs5("div", { className: "mb-2 flex items-center justify-between", children: [
|
|
2158
|
+
/* @__PURE__ */ jsxs5("h3", { className: "text-sm font-medium text-muted-foreground", children: [
|
|
2484
2159
|
"Diferen\xE7as: v",
|
|
2485
2160
|
compareVersion.version_number,
|
|
2486
2161
|
" \u2192 v",
|
|
2487
2162
|
currentVersion.version_number,
|
|
2488
2163
|
" (actual)"
|
|
2489
2164
|
] }),
|
|
2490
|
-
/* @__PURE__ */
|
|
2491
|
-
|
|
2165
|
+
/* @__PURE__ */ jsx6(
|
|
2166
|
+
Button5,
|
|
2492
2167
|
{
|
|
2493
2168
|
variant: "ghost",
|
|
2494
2169
|
size: "sm",
|
|
@@ -2498,12 +2173,12 @@ function AgentPromptEditor({ config, agent }) {
|
|
|
2498
2173
|
}
|
|
2499
2174
|
)
|
|
2500
2175
|
] }),
|
|
2501
|
-
/* @__PURE__ */
|
|
2176
|
+
/* @__PURE__ */ jsx6("div", { className: "max-h-64 overflow-auto rounded-lg border font-mono text-sm", children: diffLines.map((line, i) => /* @__PURE__ */ jsxs5(
|
|
2502
2177
|
"div",
|
|
2503
2178
|
{
|
|
2504
2179
|
className: `whitespace-pre-wrap px-3 py-0.5 ${line.type === "added" ? "bg-green-500/10 text-green-700 dark:text-green-400" : line.type === "removed" ? "bg-red-500/10 text-red-700 dark:text-red-400" : ""}`,
|
|
2505
2180
|
children: [
|
|
2506
|
-
/* @__PURE__ */
|
|
2181
|
+
/* @__PURE__ */ jsx6("span", { className: "mr-2 inline-block w-4 select-none text-muted-foreground", children: line.type === "added" ? "+" : line.type === "removed" ? "-" : " " }),
|
|
2507
2182
|
line.line || " "
|
|
2508
2183
|
]
|
|
2509
2184
|
},
|
|
@@ -2511,57 +2186,57 @@ function AgentPromptEditor({ config, agent }) {
|
|
|
2511
2186
|
)) })
|
|
2512
2187
|
] })
|
|
2513
2188
|
] }),
|
|
2514
|
-
/* @__PURE__ */
|
|
2515
|
-
/* @__PURE__ */
|
|
2516
|
-
sortedVersions.length === 0 ? /* @__PURE__ */
|
|
2517
|
-
/* @__PURE__ */
|
|
2518
|
-
/* @__PURE__ */
|
|
2519
|
-
] }) : /* @__PURE__ */
|
|
2189
|
+
/* @__PURE__ */ jsxs5("div", { className: "w-full space-y-2 lg:w-80 lg:shrink-0", children: [
|
|
2190
|
+
/* @__PURE__ */ jsx6("h3", { className: "text-sm font-medium text-muted-foreground", children: "Hist\xF3rico de Vers\xF5es" }),
|
|
2191
|
+
sortedVersions.length === 0 ? /* @__PURE__ */ jsxs5("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
|
|
2192
|
+
/* @__PURE__ */ jsx6(FileText, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
|
|
2193
|
+
/* @__PURE__ */ jsx6("p", { className: "text-sm text-muted-foreground", children: "Nenhuma vers\xE3o encontrada. Salve o prompt para criar a primeira vers\xE3o." })
|
|
2194
|
+
] }) : /* @__PURE__ */ jsx6("div", { className: "space-y-1", children: sortedVersions.map((version, idx) => {
|
|
2520
2195
|
const isCurrent = idx === 0;
|
|
2521
2196
|
const isComparing = version.id === compareVersionId;
|
|
2522
|
-
return /* @__PURE__ */
|
|
2197
|
+
return /* @__PURE__ */ jsxs5(
|
|
2523
2198
|
"div",
|
|
2524
2199
|
{
|
|
2525
2200
|
className: `rounded-lg border p-3 transition-colors ${isCurrent ? "border-primary bg-primary/5" : isComparing ? "border-muted-foreground/30 bg-muted/50" : ""}`,
|
|
2526
2201
|
children: [
|
|
2527
|
-
/* @__PURE__ */
|
|
2528
|
-
/* @__PURE__ */
|
|
2202
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2203
|
+
/* @__PURE__ */ jsxs5("span", { className: "text-sm font-medium", children: [
|
|
2529
2204
|
"v",
|
|
2530
2205
|
version.version_number
|
|
2531
2206
|
] }),
|
|
2532
|
-
isCurrent && /* @__PURE__ */
|
|
2207
|
+
isCurrent && /* @__PURE__ */ jsx6(Badge3, { variant: "default", className: "text-[10px] px-1.5 py-0", children: "Actual" })
|
|
2533
2208
|
] }),
|
|
2534
|
-
/* @__PURE__ */
|
|
2535
|
-
/* @__PURE__ */
|
|
2536
|
-
/* @__PURE__ */
|
|
2209
|
+
/* @__PURE__ */ jsx6("div", { className: "mt-1 text-xs text-muted-foreground", children: formatDate(version.datetime_add) }),
|
|
2210
|
+
/* @__PURE__ */ jsxs5("div", { className: "mt-1 flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
2211
|
+
/* @__PURE__ */ jsxs5("span", { children: [
|
|
2537
2212
|
(version.prompt_content ?? "").length,
|
|
2538
2213
|
" chars"
|
|
2539
2214
|
] }),
|
|
2540
|
-
/* @__PURE__ */
|
|
2541
|
-
/* @__PURE__ */
|
|
2215
|
+
/* @__PURE__ */ jsx6("span", { children: "\xB7" }),
|
|
2216
|
+
/* @__PURE__ */ jsx6("span", { className: "truncate font-mono", children: (version.prompt_hash ?? "").slice(0, 8) })
|
|
2542
2217
|
] }),
|
|
2543
|
-
version.change_notes && /* @__PURE__ */
|
|
2544
|
-
!isCurrent && /* @__PURE__ */
|
|
2545
|
-
/* @__PURE__ */
|
|
2218
|
+
version.change_notes && /* @__PURE__ */ jsx6("div", { className: "mt-1.5 text-xs italic text-muted-foreground", children: version.change_notes }),
|
|
2219
|
+
!isCurrent && /* @__PURE__ */ jsxs5("div", { className: "mt-2 flex items-center gap-3", children: [
|
|
2220
|
+
/* @__PURE__ */ jsxs5(
|
|
2546
2221
|
"button",
|
|
2547
2222
|
{
|
|
2548
2223
|
type: "button",
|
|
2549
2224
|
onClick: () => setCompareVersionId(isComparing ? null : version.id),
|
|
2550
2225
|
className: "flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",
|
|
2551
2226
|
children: [
|
|
2552
|
-
/* @__PURE__ */
|
|
2227
|
+
/* @__PURE__ */ jsx6(FileText, { "aria-hidden": "true", className: "h-3 w-3" }),
|
|
2553
2228
|
isComparing ? "Ocultar diff" : "Comparar"
|
|
2554
2229
|
]
|
|
2555
2230
|
}
|
|
2556
2231
|
),
|
|
2557
|
-
/* @__PURE__ */
|
|
2232
|
+
/* @__PURE__ */ jsxs5(
|
|
2558
2233
|
"button",
|
|
2559
2234
|
{
|
|
2560
2235
|
type: "button",
|
|
2561
2236
|
onClick: () => handleRestore(version),
|
|
2562
2237
|
className: "flex items-center gap-1 text-xs text-primary hover:underline",
|
|
2563
2238
|
children: [
|
|
2564
|
-
/* @__PURE__ */
|
|
2239
|
+
/* @__PURE__ */ jsx6(RotateCcw, { "aria-hidden": "true", className: "h-3 w-3" }),
|
|
2565
2240
|
"Restaurar"
|
|
2566
2241
|
]
|
|
2567
2242
|
}
|
|
@@ -2577,7 +2252,7 @@ function AgentPromptEditor({ config, agent }) {
|
|
|
2577
2252
|
}
|
|
2578
2253
|
|
|
2579
2254
|
// src/components/conversations/agent-conversations-table.tsx
|
|
2580
|
-
import { useState as
|
|
2255
|
+
import { useState as useState7 } from "react";
|
|
2581
2256
|
import {
|
|
2582
2257
|
Table,
|
|
2583
2258
|
TableBody,
|
|
@@ -2585,15 +2260,15 @@ import {
|
|
|
2585
2260
|
TableHead,
|
|
2586
2261
|
TableHeader,
|
|
2587
2262
|
TableRow,
|
|
2588
|
-
Skeleton as
|
|
2589
|
-
Badge as
|
|
2263
|
+
Skeleton as Skeleton4,
|
|
2264
|
+
Badge as Badge4
|
|
2590
2265
|
} from "@greatapps/greatauth-ui/ui";
|
|
2591
2266
|
import { MessageCircle, ExternalLink } from "lucide-react";
|
|
2592
2267
|
|
|
2593
2268
|
// src/components/conversations/conversation-view.tsx
|
|
2594
|
-
import { Skeleton as
|
|
2269
|
+
import { Skeleton as Skeleton3, Button as Button6 } from "@greatapps/greatauth-ui/ui";
|
|
2595
2270
|
import { X, MessageSquare } from "lucide-react";
|
|
2596
|
-
import { jsx as
|
|
2271
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2597
2272
|
function formatDateTime(dateStr) {
|
|
2598
2273
|
if (!dateStr) return "\u2014";
|
|
2599
2274
|
return new Date(dateStr).toLocaleString("pt-BR");
|
|
@@ -2607,68 +2282,68 @@ function ConversationView({
|
|
|
2607
2282
|
}) {
|
|
2608
2283
|
const { data: conversation, isLoading } = useConversation(config, conversationId);
|
|
2609
2284
|
if (isLoading) {
|
|
2610
|
-
return /* @__PURE__ */
|
|
2611
|
-
/* @__PURE__ */
|
|
2612
|
-
/* @__PURE__ */
|
|
2285
|
+
return /* @__PURE__ */ jsxs6("div", { className: "rounded-lg border bg-card p-4 space-y-3", children: [
|
|
2286
|
+
/* @__PURE__ */ jsx7(Skeleton3, { className: "h-6 w-48" }),
|
|
2287
|
+
/* @__PURE__ */ jsx7("div", { className: "grid grid-cols-2 gap-3", children: Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsx7(Skeleton3, { className: "h-10 w-full" }, i)) })
|
|
2613
2288
|
] });
|
|
2614
2289
|
}
|
|
2615
2290
|
if (!conversation) {
|
|
2616
|
-
return /* @__PURE__ */
|
|
2617
|
-
/* @__PURE__ */
|
|
2618
|
-
/* @__PURE__ */
|
|
2291
|
+
return /* @__PURE__ */ jsx7("div", { className: "rounded-lg border bg-card p-4", children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between", children: [
|
|
2292
|
+
/* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground", children: "Conversa n\xE3o encontrada." }),
|
|
2293
|
+
/* @__PURE__ */ jsx7(Button6, { variant: "ghost", size: "icon", "aria-label": "Fechar", onClick: onClose, children: /* @__PURE__ */ jsx7(X, { className: "h-4 w-4" }) })
|
|
2619
2294
|
] }) });
|
|
2620
2295
|
}
|
|
2621
|
-
return /* @__PURE__ */
|
|
2622
|
-
/* @__PURE__ */
|
|
2623
|
-
/* @__PURE__ */
|
|
2296
|
+
return /* @__PURE__ */ jsxs6("div", { className: "rounded-lg border bg-card p-4 space-y-4", children: [
|
|
2297
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between", children: [
|
|
2298
|
+
/* @__PURE__ */ jsxs6("h3", { className: "font-semibold", children: [
|
|
2624
2299
|
"Detalhes da conversa #",
|
|
2625
2300
|
conversation.id
|
|
2626
2301
|
] }),
|
|
2627
|
-
/* @__PURE__ */
|
|
2302
|
+
/* @__PURE__ */ jsx7("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsx7(Button6, { variant: "ghost", size: "icon", "aria-label": "Fechar", onClick: onClose, children: /* @__PURE__ */ jsx7(X, { className: "h-4 w-4" }) }) })
|
|
2628
2303
|
] }),
|
|
2629
|
-
conversation.id_external ? renderChatLink ? renderChatLink(conversation.id_external) : /* @__PURE__ */
|
|
2630
|
-
/* @__PURE__ */
|
|
2304
|
+
conversation.id_external ? renderChatLink ? renderChatLink(conversation.id_external) : /* @__PURE__ */ jsx7(Button6, { variant: "outline", size: "sm", asChild: true, children: /* @__PURE__ */ jsxs6("a", { href: `/gchat/inbox/${conversation.id_external}`, children: [
|
|
2305
|
+
/* @__PURE__ */ jsx7(MessageSquare, { className: "mr-2 h-4 w-4" }),
|
|
2631
2306
|
"Ver no Chat"
|
|
2632
2307
|
] }) }) : null,
|
|
2633
|
-
/* @__PURE__ */
|
|
2634
|
-
/* @__PURE__ */
|
|
2635
|
-
/* @__PURE__ */
|
|
2636
|
-
/* @__PURE__ */
|
|
2308
|
+
/* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-2 gap-x-6 gap-y-3 text-sm", children: [
|
|
2309
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2310
|
+
/* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Thread ID" }),
|
|
2311
|
+
/* @__PURE__ */ jsx7("p", { className: "font-mono text-xs mt-0.5", children: conversation.openai_thread_id || "\u2014" })
|
|
2637
2312
|
] }),
|
|
2638
|
-
/* @__PURE__ */
|
|
2639
|
-
/* @__PURE__ */
|
|
2640
|
-
/* @__PURE__ */
|
|
2313
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2314
|
+
/* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Contato" }),
|
|
2315
|
+
/* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: contactsMap?.get(conversation.id_contact) ?? conversation.id_contact })
|
|
2641
2316
|
] }),
|
|
2642
|
-
/* @__PURE__ */
|
|
2643
|
-
/* @__PURE__ */
|
|
2644
|
-
/* @__PURE__ */
|
|
2317
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2318
|
+
/* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Agente" }),
|
|
2319
|
+
/* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: conversation.id_agent ?? "\u2014" })
|
|
2645
2320
|
] }),
|
|
2646
|
-
/* @__PURE__ */
|
|
2647
|
-
/* @__PURE__ */
|
|
2648
|
-
/* @__PURE__ */
|
|
2321
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2322
|
+
/* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Mensagens" }),
|
|
2323
|
+
/* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: conversation.message_count ?? "\u2014" })
|
|
2649
2324
|
] }),
|
|
2650
|
-
/* @__PURE__ */
|
|
2651
|
-
/* @__PURE__ */
|
|
2652
|
-
/* @__PURE__ */
|
|
2325
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2326
|
+
/* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Tokens" }),
|
|
2327
|
+
/* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: conversation.usage_tokens ?? "\u2014" })
|
|
2653
2328
|
] }),
|
|
2654
|
-
/* @__PURE__ */
|
|
2655
|
-
/* @__PURE__ */
|
|
2656
|
-
/* @__PURE__ */
|
|
2329
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2330
|
+
/* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Rota\xE7\xF5es de Thread" }),
|
|
2331
|
+
/* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: conversation.rotation_count ?? "\u2014" })
|
|
2657
2332
|
] }),
|
|
2658
|
-
/* @__PURE__ */
|
|
2659
|
-
/* @__PURE__ */
|
|
2660
|
-
/* @__PURE__ */
|
|
2333
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2334
|
+
/* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Criado em" }),
|
|
2335
|
+
/* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: formatDateTime(conversation.datetime_add) })
|
|
2661
2336
|
] }),
|
|
2662
|
-
/* @__PURE__ */
|
|
2663
|
-
/* @__PURE__ */
|
|
2664
|
-
/* @__PURE__ */
|
|
2337
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2338
|
+
/* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Atualizado em" }),
|
|
2339
|
+
/* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: formatDateTime(conversation.datetime_alt) })
|
|
2665
2340
|
] })
|
|
2666
2341
|
] })
|
|
2667
2342
|
] });
|
|
2668
2343
|
}
|
|
2669
2344
|
|
|
2670
2345
|
// src/components/conversations/agent-conversations-table.tsx
|
|
2671
|
-
import { jsx as
|
|
2346
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2672
2347
|
function formatRelativeDate(dateStr) {
|
|
2673
2348
|
if (!dateStr) return "\u2014";
|
|
2674
2349
|
const date = new Date(dateStr);
|
|
@@ -2691,29 +2366,29 @@ function AgentConversationsTable({
|
|
|
2691
2366
|
config,
|
|
2692
2367
|
renderChatLink
|
|
2693
2368
|
}) {
|
|
2694
|
-
const [selectedId, setSelectedId] =
|
|
2369
|
+
const [selectedId, setSelectedId] = useState7(null);
|
|
2695
2370
|
if (isLoading) {
|
|
2696
|
-
return /* @__PURE__ */
|
|
2371
|
+
return /* @__PURE__ */ jsx8("div", { className: "space-y-3", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx8(Skeleton4, { className: "h-12 w-full" }, i)) });
|
|
2697
2372
|
}
|
|
2698
2373
|
if (conversations.length === 0) {
|
|
2699
|
-
return /* @__PURE__ */
|
|
2700
|
-
/* @__PURE__ */
|
|
2701
|
-
/* @__PURE__ */
|
|
2374
|
+
return /* @__PURE__ */ jsxs7("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
|
|
2375
|
+
/* @__PURE__ */ jsx8(MessageCircle, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
|
|
2376
|
+
/* @__PURE__ */ jsx8("p", { className: "text-sm text-muted-foreground", children: "Nenhuma conversa encontrada." })
|
|
2702
2377
|
] });
|
|
2703
2378
|
}
|
|
2704
|
-
return /* @__PURE__ */
|
|
2705
|
-
/* @__PURE__ */
|
|
2706
|
-
/* @__PURE__ */
|
|
2707
|
-
/* @__PURE__ */
|
|
2708
|
-
/* @__PURE__ */
|
|
2709
|
-
/* @__PURE__ */
|
|
2710
|
-
/* @__PURE__ */
|
|
2711
|
-
/* @__PURE__ */
|
|
2712
|
-
/* @__PURE__ */
|
|
2713
|
-
/* @__PURE__ */
|
|
2714
|
-
/* @__PURE__ */
|
|
2379
|
+
return /* @__PURE__ */ jsxs7("div", { className: "space-y-4", children: [
|
|
2380
|
+
/* @__PURE__ */ jsxs7(Table, { children: [
|
|
2381
|
+
/* @__PURE__ */ jsx8(TableHeader, { children: /* @__PURE__ */ jsxs7(TableRow, { children: [
|
|
2382
|
+
/* @__PURE__ */ jsx8(TableHead, { children: "ID" }),
|
|
2383
|
+
/* @__PURE__ */ jsx8(TableHead, { children: "Contato" }),
|
|
2384
|
+
/* @__PURE__ */ jsx8(TableHead, { children: "Objetivo" }),
|
|
2385
|
+
/* @__PURE__ */ jsx8(TableHead, { className: "text-right", children: "Mensagens" }),
|
|
2386
|
+
/* @__PURE__ */ jsx8(TableHead, { className: "text-right", children: "Tokens" }),
|
|
2387
|
+
/* @__PURE__ */ jsx8(TableHead, { children: "Criado em" }),
|
|
2388
|
+
/* @__PURE__ */ jsx8(TableHead, { children: "Atualizado em" }),
|
|
2389
|
+
/* @__PURE__ */ jsx8(TableHead, { className: "w-10" })
|
|
2715
2390
|
] }) }),
|
|
2716
|
-
/* @__PURE__ */
|
|
2391
|
+
/* @__PURE__ */ jsx8(TableBody, { children: conversations.map((conversation) => /* @__PURE__ */ jsxs7(
|
|
2717
2392
|
TableRow,
|
|
2718
2393
|
{
|
|
2719
2394
|
className: "cursor-pointer",
|
|
@@ -2732,14 +2407,14 @@ function AgentConversationsTable({
|
|
|
2732
2407
|
},
|
|
2733
2408
|
"data-state": selectedId === conversation.id ? "selected" : void 0,
|
|
2734
2409
|
children: [
|
|
2735
|
-
/* @__PURE__ */
|
|
2736
|
-
/* @__PURE__ */
|
|
2737
|
-
/* @__PURE__ */
|
|
2738
|
-
/* @__PURE__ */
|
|
2739
|
-
/* @__PURE__ */
|
|
2740
|
-
/* @__PURE__ */
|
|
2741
|
-
/* @__PURE__ */
|
|
2742
|
-
/* @__PURE__ */
|
|
2410
|
+
/* @__PURE__ */ jsx8(TableCell, { className: "font-mono text-xs", children: conversation.id }),
|
|
2411
|
+
/* @__PURE__ */ jsx8(TableCell, { children: contactsMap?.get(conversation.id_contact) ?? conversation.id_contact }),
|
|
2412
|
+
/* @__PURE__ */ jsx8(TableCell, { children: conversation.id_objective && objectivesMap?.get(conversation.id_objective) ? /* @__PURE__ */ jsx8(Badge4, { variant: "secondary", className: "text-xs", children: objectivesMap.get(conversation.id_objective) }) : /* @__PURE__ */ jsx8("span", { className: "text-xs text-muted-foreground", children: "\u2014" }) }),
|
|
2413
|
+
/* @__PURE__ */ jsx8(TableCell, { className: "text-right tabular-nums", children: conversation.message_count ?? "\u2014" }),
|
|
2414
|
+
/* @__PURE__ */ jsx8(TableCell, { className: "text-right tabular-nums", children: conversation.usage_tokens ?? "\u2014" }),
|
|
2415
|
+
/* @__PURE__ */ jsx8(TableCell, { children: new Date(conversation.datetime_add).toLocaleDateString("pt-BR") }),
|
|
2416
|
+
/* @__PURE__ */ jsx8(TableCell, { children: formatRelativeDate(conversation.datetime_alt) }),
|
|
2417
|
+
/* @__PURE__ */ jsx8(TableCell, { children: conversation.id_external ? renderChatLink ? /* @__PURE__ */ jsx8("span", { onClick: (e) => e.stopPropagation(), children: renderChatLink(conversation.id_external) }) : /* @__PURE__ */ jsx8(
|
|
2743
2418
|
"a",
|
|
2744
2419
|
{
|
|
2745
2420
|
href: `/gchat/inbox/${conversation.id_external}`,
|
|
@@ -2747,7 +2422,7 @@ function AgentConversationsTable({
|
|
|
2747
2422
|
"aria-label": "Ver no Chat",
|
|
2748
2423
|
onClick: (e) => e.stopPropagation(),
|
|
2749
2424
|
className: "inline-flex items-center justify-center rounded-md p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",
|
|
2750
|
-
children: /* @__PURE__ */
|
|
2425
|
+
children: /* @__PURE__ */ jsx8(ExternalLink, { className: "h-4 w-4" })
|
|
2751
2426
|
}
|
|
2752
2427
|
) : null })
|
|
2753
2428
|
]
|
|
@@ -2755,7 +2430,7 @@ function AgentConversationsTable({
|
|
|
2755
2430
|
conversation.id
|
|
2756
2431
|
)) })
|
|
2757
2432
|
] }),
|
|
2758
|
-
selectedId && /* @__PURE__ */
|
|
2433
|
+
selectedId && /* @__PURE__ */ jsx8(
|
|
2759
2434
|
ConversationView,
|
|
2760
2435
|
{
|
|
2761
2436
|
conversationId: selectedId,
|
|
@@ -2769,7 +2444,7 @@ function AgentConversationsTable({
|
|
|
2769
2444
|
}
|
|
2770
2445
|
|
|
2771
2446
|
// src/components/conversations/agent-conversations-panel.tsx
|
|
2772
|
-
import { jsx as
|
|
2447
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
2773
2448
|
function AgentConversationsPanel({
|
|
2774
2449
|
agent,
|
|
2775
2450
|
config,
|
|
@@ -2788,7 +2463,7 @@ function AgentConversationsPanel({
|
|
|
2788
2463
|
const objectivesMap = new Map(
|
|
2789
2464
|
(objectivesData?.data || []).map((o) => [o.id, o.title])
|
|
2790
2465
|
);
|
|
2791
|
-
return /* @__PURE__ */
|
|
2466
|
+
return /* @__PURE__ */ jsx9("div", { className: "p-4", children: /* @__PURE__ */ jsx9(
|
|
2792
2467
|
AgentConversationsTable,
|
|
2793
2468
|
{
|
|
2794
2469
|
conversations,
|
|
@@ -2802,27 +2477,27 @@ function AgentConversationsPanel({
|
|
|
2802
2477
|
}
|
|
2803
2478
|
|
|
2804
2479
|
// src/pages/agent-capabilities-page.tsx
|
|
2805
|
-
import { useState as
|
|
2480
|
+
import { useState as useState14, useCallback as useCallback6 } from "react";
|
|
2806
2481
|
import {
|
|
2807
2482
|
Tabs,
|
|
2808
2483
|
TabsList,
|
|
2809
2484
|
TabsTrigger,
|
|
2810
2485
|
TabsContent
|
|
2811
2486
|
} from "@greatapps/greatauth-ui/ui";
|
|
2812
|
-
import { Blocks, Plug as Plug3, Settings as
|
|
2487
|
+
import { Blocks, Plug as Plug3, Settings as Settings3 } from "lucide-react";
|
|
2813
2488
|
|
|
2814
2489
|
// src/components/capabilities/capabilities-tab.tsx
|
|
2815
|
-
import { useState as
|
|
2490
|
+
import { useState as useState8, useCallback as useCallback4, useRef as useRef2, useEffect as useEffect4, useMemo as useMemo5 } from "react";
|
|
2816
2491
|
import {
|
|
2817
2492
|
Accordion,
|
|
2818
2493
|
AccordionItem,
|
|
2819
2494
|
AccordionTrigger,
|
|
2820
2495
|
AccordionContent,
|
|
2821
|
-
Switch as
|
|
2496
|
+
Switch as Switch4,
|
|
2822
2497
|
Checkbox,
|
|
2823
|
-
Badge as
|
|
2824
|
-
Button as
|
|
2825
|
-
Skeleton as
|
|
2498
|
+
Badge as Badge5,
|
|
2499
|
+
Button as Button7,
|
|
2500
|
+
Skeleton as Skeleton5
|
|
2826
2501
|
} from "@greatapps/greatauth-ui/ui";
|
|
2827
2502
|
import {
|
|
2828
2503
|
Calendar,
|
|
@@ -2832,8 +2507,8 @@ import {
|
|
|
2832
2507
|
Package,
|
|
2833
2508
|
ChevronDown as ChevronDown2
|
|
2834
2509
|
} from "lucide-react";
|
|
2835
|
-
import { toast as
|
|
2836
|
-
import { jsx as
|
|
2510
|
+
import { toast as toast6 } from "sonner";
|
|
2511
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2837
2512
|
var OPERATION_LABELS = {
|
|
2838
2513
|
list: "Listar",
|
|
2839
2514
|
view: "Visualizar",
|
|
@@ -2888,9 +2563,9 @@ function CapabilitiesTab({ config, agentId }) {
|
|
|
2888
2563
|
const { data: registry, isLoading: isLoadingRegistry } = useCapabilities(config);
|
|
2889
2564
|
const { data: agentCaps, isLoading: isLoadingAgent } = useAgentCapabilities(config, agentId);
|
|
2890
2565
|
const updateMutation = useUpdateAgentCapabilities(config);
|
|
2891
|
-
const [localState, setLocalState] =
|
|
2892
|
-
const [serverState, setServerState] =
|
|
2893
|
-
const [initialized, setInitialized] =
|
|
2566
|
+
const [localState, setLocalState] = useState8(/* @__PURE__ */ new Map());
|
|
2567
|
+
const [serverState, setServerState] = useState8(/* @__PURE__ */ new Map());
|
|
2568
|
+
const [initialized, setInitialized] = useState8(false);
|
|
2894
2569
|
const debounceRef = useRef2(null);
|
|
2895
2570
|
useEffect4(() => {
|
|
2896
2571
|
if (agentCaps && !initialized) {
|
|
@@ -2917,11 +2592,11 @@ function CapabilitiesTab({ config, agentId }) {
|
|
|
2917
2592
|
{
|
|
2918
2593
|
onSuccess: () => {
|
|
2919
2594
|
setServerState(cloneState(nextState));
|
|
2920
|
-
|
|
2595
|
+
toast6.success("Capacidades salvas");
|
|
2921
2596
|
},
|
|
2922
2597
|
onError: () => {
|
|
2923
2598
|
setLocalState(cloneState(serverState));
|
|
2924
|
-
|
|
2599
|
+
toast6.error("Erro ao salvar capacidades");
|
|
2925
2600
|
}
|
|
2926
2601
|
}
|
|
2927
2602
|
);
|
|
@@ -3000,11 +2675,11 @@ function CapabilitiesTab({ config, agentId }) {
|
|
|
3000
2675
|
{
|
|
3001
2676
|
onSuccess: () => {
|
|
3002
2677
|
setServerState(cloneState(localState));
|
|
3003
|
-
|
|
2678
|
+
toast6.success("Capacidades salvas");
|
|
3004
2679
|
},
|
|
3005
2680
|
onError: () => {
|
|
3006
2681
|
setLocalState(cloneState(serverState));
|
|
3007
|
-
|
|
2682
|
+
toast6.error("Erro ao salvar capacidades");
|
|
3008
2683
|
}
|
|
3009
2684
|
}
|
|
3010
2685
|
);
|
|
@@ -3013,51 +2688,51 @@ function CapabilitiesTab({ config, agentId }) {
|
|
|
3013
2688
|
return cat.modules.filter((m) => (localState.get(m.slug)?.size ?? 0) > 0).length;
|
|
3014
2689
|
}
|
|
3015
2690
|
if (isLoadingRegistry || isLoadingAgent) {
|
|
3016
|
-
return /* @__PURE__ */
|
|
2691
|
+
return /* @__PURE__ */ jsx10("div", { className: "space-y-3", children: [1, 2, 3, 4].map((i) => /* @__PURE__ */ jsx10(Skeleton5, { className: "h-14 w-full" }, i)) });
|
|
3017
2692
|
}
|
|
3018
2693
|
if (!registry || !registry.categories.length) {
|
|
3019
|
-
return /* @__PURE__ */
|
|
3020
|
-
/* @__PURE__ */
|
|
3021
|
-
/* @__PURE__ */
|
|
3022
|
-
/* @__PURE__ */
|
|
2694
|
+
return /* @__PURE__ */ jsxs8("div", { className: "flex flex-col items-center justify-center py-12 text-center", children: [
|
|
2695
|
+
/* @__PURE__ */ jsx10(Package, { className: "h-12 w-12 text-muted-foreground mb-3" }),
|
|
2696
|
+
/* @__PURE__ */ jsx10("h3", { className: "text-base font-medium", children: "Nenhuma capacidade dispon\xEDvel" }),
|
|
2697
|
+
/* @__PURE__ */ jsx10("p", { className: "text-sm text-muted-foreground mt-1 max-w-sm", children: "Este produto ainda n\xE3o possui capacidades registadas. As capacidades ser\xE3o adicionadas automaticamente quando o produto for configurado." })
|
|
3023
2698
|
] });
|
|
3024
2699
|
}
|
|
3025
|
-
return /* @__PURE__ */
|
|
3026
|
-
/* @__PURE__ */
|
|
3027
|
-
/* @__PURE__ */
|
|
3028
|
-
/* @__PURE__ */
|
|
3029
|
-
/* @__PURE__ */
|
|
2700
|
+
return /* @__PURE__ */ jsxs8("div", { className: "space-y-4", children: [
|
|
2701
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between", children: [
|
|
2702
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
2703
|
+
/* @__PURE__ */ jsx10("h3", { className: "text-sm font-medium", children: "Capacidades do agente" }),
|
|
2704
|
+
/* @__PURE__ */ jsx10("p", { className: "text-xs text-muted-foreground mt-0.5", children: "Ative ou desative m\xF3dulos e opera\xE7\xF5es dispon\xEDveis para este agente." })
|
|
3030
2705
|
] }),
|
|
3031
|
-
/* @__PURE__ */
|
|
3032
|
-
/* @__PURE__ */
|
|
3033
|
-
/* @__PURE__ */
|
|
2706
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
|
|
2707
|
+
/* @__PURE__ */ jsx10(Button7, { variant: "outline", size: "sm", onClick: enableAll, children: "Ativar tudo" }),
|
|
2708
|
+
/* @__PURE__ */ jsx10(Button7, { variant: "outline", size: "sm", onClick: disableAll, children: "Desativar tudo" })
|
|
3034
2709
|
] })
|
|
3035
2710
|
] }),
|
|
3036
|
-
/* @__PURE__ */
|
|
2711
|
+
/* @__PURE__ */ jsx10(Accordion, { type: "multiple", className: "space-y-2", children: registry.categories.map((cat) => {
|
|
3037
2712
|
const Icon = getCategoryIcon(cat.slug);
|
|
3038
2713
|
const activeCount = countActiveModules(cat);
|
|
3039
2714
|
const totalModules = cat.modules.length;
|
|
3040
|
-
return /* @__PURE__ */
|
|
2715
|
+
return /* @__PURE__ */ jsxs8(
|
|
3041
2716
|
AccordionItem,
|
|
3042
2717
|
{
|
|
3043
2718
|
value: cat.slug,
|
|
3044
2719
|
className: "border rounded-lg px-4",
|
|
3045
2720
|
children: [
|
|
3046
|
-
/* @__PURE__ */
|
|
3047
|
-
/* @__PURE__ */
|
|
3048
|
-
/* @__PURE__ */
|
|
3049
|
-
/* @__PURE__ */
|
|
2721
|
+
/* @__PURE__ */ jsx10(AccordionTrigger, { className: "hover:no-underline py-3", children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-3 flex-1", children: [
|
|
2722
|
+
/* @__PURE__ */ jsx10(Icon, { className: "h-4 w-4 text-muted-foreground" }),
|
|
2723
|
+
/* @__PURE__ */ jsx10("span", { className: "font-medium text-sm", children: cat.label }),
|
|
2724
|
+
/* @__PURE__ */ jsxs8(Badge5, { variant: "secondary", className: "text-xs", children: [
|
|
3050
2725
|
activeCount,
|
|
3051
2726
|
" de ",
|
|
3052
2727
|
totalModules,
|
|
3053
2728
|
" m\xF3dulos ativos"
|
|
3054
2729
|
] })
|
|
3055
2730
|
] }) }),
|
|
3056
|
-
/* @__PURE__ */
|
|
2731
|
+
/* @__PURE__ */ jsx10(AccordionContent, { className: "pb-3 !h-auto", children: /* @__PURE__ */ jsx10("div", { className: "space-y-1", children: cat.modules.map((mod) => {
|
|
3057
2732
|
const enabledOps = localState.get(mod.slug);
|
|
3058
2733
|
const isModuleOn = (enabledOps?.size ?? 0) > 0;
|
|
3059
2734
|
const allOpsEnabled = enabledOps?.size === mod.operations.length;
|
|
3060
|
-
return /* @__PURE__ */
|
|
2735
|
+
return /* @__PURE__ */ jsx10(
|
|
3061
2736
|
ModuleRow,
|
|
3062
2737
|
{
|
|
3063
2738
|
module: mod,
|
|
@@ -3075,12 +2750,12 @@ function CapabilitiesTab({ config, agentId }) {
|
|
|
3075
2750
|
cat.slug
|
|
3076
2751
|
);
|
|
3077
2752
|
}) }),
|
|
3078
|
-
hasChanges && /* @__PURE__ */
|
|
3079
|
-
/* @__PURE__ */
|
|
3080
|
-
/* @__PURE__ */
|
|
3081
|
-
/* @__PURE__ */
|
|
3082
|
-
/* @__PURE__ */
|
|
3083
|
-
|
|
2753
|
+
hasChanges && /* @__PURE__ */ jsxs8("div", { className: "sticky bottom-0 bg-background border-t py-3 px-4 -mx-4 flex items-center justify-between", children: [
|
|
2754
|
+
/* @__PURE__ */ jsx10("span", { className: "text-sm text-muted-foreground", children: "Voc\xEA tem altera\xE7\xF5es n\xE3o salvas." }),
|
|
2755
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
|
|
2756
|
+
/* @__PURE__ */ jsx10(Button7, { variant: "outline", size: "sm", onClick: discard, children: "Descartar" }),
|
|
2757
|
+
/* @__PURE__ */ jsx10(
|
|
2758
|
+
Button7,
|
|
3084
2759
|
{
|
|
3085
2760
|
size: "sm",
|
|
3086
2761
|
onClick: saveNow,
|
|
@@ -3099,10 +2774,10 @@ function ModuleRow({
|
|
|
3099
2774
|
onToggleModule,
|
|
3100
2775
|
onToggleOperation
|
|
3101
2776
|
}) {
|
|
3102
|
-
const [expanded, setExpanded] =
|
|
3103
|
-
return /* @__PURE__ */
|
|
3104
|
-
/* @__PURE__ */
|
|
3105
|
-
/* @__PURE__ */
|
|
2777
|
+
const [expanded, setExpanded] = useState8(false);
|
|
2778
|
+
return /* @__PURE__ */ jsxs8("div", { className: "rounded-md border px-3 py-2", children: [
|
|
2779
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between", children: [
|
|
2780
|
+
/* @__PURE__ */ jsxs8(
|
|
3106
2781
|
"button",
|
|
3107
2782
|
{
|
|
3108
2783
|
type: "button",
|
|
@@ -3111,18 +2786,18 @@ function ModuleRow({
|
|
|
3111
2786
|
"aria-expanded": expanded,
|
|
3112
2787
|
"aria-label": `Expandir ${mod.label}`,
|
|
3113
2788
|
children: [
|
|
3114
|
-
/* @__PURE__ */
|
|
2789
|
+
/* @__PURE__ */ jsx10(
|
|
3115
2790
|
ChevronDown2,
|
|
3116
2791
|
{
|
|
3117
2792
|
className: `h-3.5 w-3.5 text-muted-foreground transition-transform ${expanded ? "rotate-0" : "-rotate-90"}`
|
|
3118
2793
|
}
|
|
3119
2794
|
),
|
|
3120
|
-
/* @__PURE__ */
|
|
3121
|
-
mod.description && /* @__PURE__ */
|
|
2795
|
+
/* @__PURE__ */ jsx10("span", { className: "text-sm font-medium", children: mod.label }),
|
|
2796
|
+
mod.description && /* @__PURE__ */ jsxs8("span", { className: "text-xs text-muted-foreground hidden sm:inline", children: [
|
|
3122
2797
|
"\u2014 ",
|
|
3123
2798
|
mod.description
|
|
3124
2799
|
] }),
|
|
3125
|
-
isOn && /* @__PURE__ */
|
|
2800
|
+
isOn && /* @__PURE__ */ jsxs8(Badge5, { variant: "secondary", className: "text-xs ml-1", children: [
|
|
3126
2801
|
enabledOps.size,
|
|
3127
2802
|
"/",
|
|
3128
2803
|
mod.operations.length
|
|
@@ -3130,8 +2805,8 @@ function ModuleRow({
|
|
|
3130
2805
|
]
|
|
3131
2806
|
}
|
|
3132
2807
|
),
|
|
3133
|
-
/* @__PURE__ */
|
|
3134
|
-
|
|
2808
|
+
/* @__PURE__ */ jsx10(
|
|
2809
|
+
Switch4,
|
|
3135
2810
|
{
|
|
3136
2811
|
checked: isOn,
|
|
3137
2812
|
onCheckedChange: onToggleModule,
|
|
@@ -3139,14 +2814,14 @@ function ModuleRow({
|
|
|
3139
2814
|
}
|
|
3140
2815
|
)
|
|
3141
2816
|
] }),
|
|
3142
|
-
expanded && /* @__PURE__ */
|
|
2817
|
+
expanded && /* @__PURE__ */ jsx10("div", { className: "mt-2 ml-6 flex flex-wrap gap-x-5 gap-y-1.5 pb-1", children: mod.operations.map((op) => {
|
|
3143
2818
|
const checked = enabledOps.has(op);
|
|
3144
|
-
return /* @__PURE__ */
|
|
2819
|
+
return /* @__PURE__ */ jsxs8(
|
|
3145
2820
|
"label",
|
|
3146
2821
|
{
|
|
3147
2822
|
className: "flex items-center gap-1.5 text-sm cursor-pointer",
|
|
3148
2823
|
children: [
|
|
3149
|
-
/* @__PURE__ */
|
|
2824
|
+
/* @__PURE__ */ jsx10(
|
|
3150
2825
|
Checkbox,
|
|
3151
2826
|
{
|
|
3152
2827
|
checked,
|
|
@@ -3154,7 +2829,7 @@ function ModuleRow({
|
|
|
3154
2829
|
"aria-label": `${getOperationLabel(op)} em ${mod.label}`
|
|
3155
2830
|
}
|
|
3156
2831
|
),
|
|
3157
|
-
/* @__PURE__ */
|
|
2832
|
+
/* @__PURE__ */ jsx10("span", { className: checked ? "" : "text-muted-foreground", children: getOperationLabel(op) })
|
|
3158
2833
|
]
|
|
3159
2834
|
},
|
|
3160
2835
|
op
|
|
@@ -3164,20 +2839,20 @@ function ModuleRow({
|
|
|
3164
2839
|
}
|
|
3165
2840
|
|
|
3166
2841
|
// src/components/capabilities/integration-card.tsx
|
|
3167
|
-
import { Badge as
|
|
2842
|
+
import { Badge as Badge6, Button as Button8, Tooltip as Tooltip2, TooltipContent as TooltipContent2, TooltipTrigger as TooltipTrigger2 } from "@greatapps/greatauth-ui/ui";
|
|
3168
2843
|
import {
|
|
3169
2844
|
CalendarSync,
|
|
3170
2845
|
Plug,
|
|
3171
|
-
Settings as
|
|
2846
|
+
Settings as Settings2,
|
|
3172
2847
|
RefreshCw,
|
|
3173
2848
|
Users as Users2,
|
|
3174
2849
|
Clock
|
|
3175
2850
|
} from "lucide-react";
|
|
3176
|
-
import { jsx as
|
|
2851
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3177
2852
|
var ICON_MAP = {
|
|
3178
2853
|
CalendarSync,
|
|
3179
2854
|
Plug,
|
|
3180
|
-
Settings:
|
|
2855
|
+
Settings: Settings2,
|
|
3181
2856
|
RefreshCw,
|
|
3182
2857
|
Users: Users2,
|
|
3183
2858
|
Clock
|
|
@@ -3221,7 +2896,7 @@ function IntegrationCard({ card, onConnect }) {
|
|
|
3221
2896
|
const badge = STATE_BADGES[state];
|
|
3222
2897
|
const actionLabel = getActionLabel(state);
|
|
3223
2898
|
const isComingSoon = state === "coming_soon";
|
|
3224
|
-
return /* @__PURE__ */
|
|
2899
|
+
return /* @__PURE__ */ jsxs9(
|
|
3225
2900
|
"div",
|
|
3226
2901
|
{
|
|
3227
2902
|
className: cn(
|
|
@@ -3240,24 +2915,24 @@ function IntegrationCard({ card, onConnect }) {
|
|
|
3240
2915
|
}
|
|
3241
2916
|
},
|
|
3242
2917
|
children: [
|
|
3243
|
-
/* @__PURE__ */
|
|
3244
|
-
/* @__PURE__ */
|
|
3245
|
-
/* @__PURE__ */
|
|
2918
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-start justify-between gap-2", children: [
|
|
2919
|
+
/* @__PURE__ */ jsx11("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: /* @__PURE__ */ jsx11(Icon, { className: "h-5 w-5" }) }),
|
|
2920
|
+
/* @__PURE__ */ jsx11(Badge6, { variant: "outline", className: cn("text-xs", badge.className), children: badge.label })
|
|
3246
2921
|
] }),
|
|
3247
|
-
/* @__PURE__ */
|
|
3248
|
-
/* @__PURE__ */
|
|
3249
|
-
/* @__PURE__ */
|
|
2922
|
+
/* @__PURE__ */ jsxs9("div", { className: "space-y-1", children: [
|
|
2923
|
+
/* @__PURE__ */ jsx11("h3", { className: "text-sm font-semibold leading-tight", children: definition.name }),
|
|
2924
|
+
/* @__PURE__ */ jsx11("p", { className: "text-xs text-muted-foreground leading-relaxed", children: definition.description })
|
|
3250
2925
|
] }),
|
|
3251
|
-
/* @__PURE__ */
|
|
3252
|
-
sharedByAgentsCount > 0 ? /* @__PURE__ */
|
|
3253
|
-
/* @__PURE__ */
|
|
3254
|
-
/* @__PURE__ */
|
|
2926
|
+
/* @__PURE__ */ jsxs9("div", { className: "mt-auto flex items-center justify-between gap-2 pt-1", children: [
|
|
2927
|
+
sharedByAgentsCount > 0 ? /* @__PURE__ */ jsxs9(Tooltip2, { children: [
|
|
2928
|
+
/* @__PURE__ */ jsx11(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs9("span", { className: "inline-flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400", children: [
|
|
2929
|
+
/* @__PURE__ */ jsx11(Users2, { className: "h-3.5 w-3.5" }),
|
|
3255
2930
|
"Compartilhada"
|
|
3256
2931
|
] }) }),
|
|
3257
|
-
/* @__PURE__ */
|
|
3258
|
-
] }) : /* @__PURE__ */
|
|
3259
|
-
!isComingSoon && /* @__PURE__ */
|
|
3260
|
-
|
|
2932
|
+
/* @__PURE__ */ jsx11(TooltipContent2, { children: "Esta credencial est\xE1 dispon\xEDvel para todos os agentes da conta" })
|
|
2933
|
+
] }) : /* @__PURE__ */ jsx11("span", {}),
|
|
2934
|
+
!isComingSoon && /* @__PURE__ */ jsx11(
|
|
2935
|
+
Button8,
|
|
3261
2936
|
{
|
|
3262
2937
|
variant: state === "expired" ? "destructive" : "outline",
|
|
3263
2938
|
size: "sm",
|
|
@@ -3277,7 +2952,7 @@ function IntegrationCard({ card, onConnect }) {
|
|
|
3277
2952
|
|
|
3278
2953
|
// src/components/capabilities/integrations-tab.tsx
|
|
3279
2954
|
import { Plug as Plug2, Loader2 as Loader24 } from "lucide-react";
|
|
3280
|
-
import { jsx as
|
|
2955
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3281
2956
|
function IntegrationsTab({
|
|
3282
2957
|
config,
|
|
3283
2958
|
agentId,
|
|
@@ -3285,15 +2960,15 @@ function IntegrationsTab({
|
|
|
3285
2960
|
}) {
|
|
3286
2961
|
const { cards, isLoading } = useIntegrationState(config, agentId);
|
|
3287
2962
|
if (isLoading) {
|
|
3288
|
-
return /* @__PURE__ */
|
|
2963
|
+
return /* @__PURE__ */ jsx12("div", { className: "flex items-center justify-center py-16", children: /* @__PURE__ */ jsx12(Loader24, { className: "h-6 w-6 animate-spin text-muted-foreground" }) });
|
|
3289
2964
|
}
|
|
3290
2965
|
if (cards.length === 0) {
|
|
3291
|
-
return /* @__PURE__ */
|
|
3292
|
-
/* @__PURE__ */
|
|
3293
|
-
/* @__PURE__ */
|
|
2966
|
+
return /* @__PURE__ */ jsxs10("div", { className: "flex flex-col items-center justify-center gap-3 py-16 text-muted-foreground", children: [
|
|
2967
|
+
/* @__PURE__ */ jsx12(Plug2, { className: "h-10 w-10" }),
|
|
2968
|
+
/* @__PURE__ */ jsx12("p", { className: "text-sm", children: "Nenhuma integra\xE7\xE3o dispon\xEDvel" })
|
|
3294
2969
|
] });
|
|
3295
2970
|
}
|
|
3296
|
-
return /* @__PURE__ */
|
|
2971
|
+
return /* @__PURE__ */ jsx12("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3", children: cards.map((card) => /* @__PURE__ */ jsx12(
|
|
3297
2972
|
IntegrationCard,
|
|
3298
2973
|
{
|
|
3299
2974
|
card,
|
|
@@ -3304,43 +2979,43 @@ function IntegrationsTab({
|
|
|
3304
2979
|
}
|
|
3305
2980
|
|
|
3306
2981
|
// src/components/capabilities/integration-wizard.tsx
|
|
3307
|
-
import { useCallback as useCallback5, useEffect as useEffect5, useRef as useRef3, useState as
|
|
2982
|
+
import { useCallback as useCallback5, useEffect as useEffect5, useRef as useRef3, useState as useState9 } from "react";
|
|
3308
2983
|
import {
|
|
3309
|
-
Dialog as
|
|
3310
|
-
DialogContent as
|
|
3311
|
-
DialogFooter as
|
|
3312
|
-
DialogHeader as
|
|
3313
|
-
DialogTitle as
|
|
3314
|
-
Button as
|
|
2984
|
+
Dialog as Dialog4,
|
|
2985
|
+
DialogContent as DialogContent4,
|
|
2986
|
+
DialogFooter as DialogFooter4,
|
|
2987
|
+
DialogHeader as DialogHeader4,
|
|
2988
|
+
DialogTitle as DialogTitle4,
|
|
2989
|
+
Button as Button10
|
|
3315
2990
|
} from "@greatapps/greatauth-ui/ui";
|
|
3316
2991
|
import { Loader2 as Loader27, ChevronLeft, ChevronRight, Check as Check2 } from "lucide-react";
|
|
3317
|
-
import { toast as
|
|
2992
|
+
import { toast as toast7 } from "sonner";
|
|
3318
2993
|
|
|
3319
2994
|
// src/components/capabilities/wizard-steps/info-step.tsx
|
|
3320
2995
|
import { Check, Info } from "lucide-react";
|
|
3321
|
-
import { jsx as
|
|
2996
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3322
2997
|
function InfoStep({ integration, meta }) {
|
|
3323
|
-
return /* @__PURE__ */
|
|
3324
|
-
/* @__PURE__ */
|
|
3325
|
-
meta.icon && /* @__PURE__ */
|
|
3326
|
-
/* @__PURE__ */
|
|
3327
|
-
/* @__PURE__ */
|
|
3328
|
-
/* @__PURE__ */
|
|
2998
|
+
return /* @__PURE__ */ jsxs11("div", { className: "space-y-6", children: [
|
|
2999
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-start gap-4", children: [
|
|
3000
|
+
meta.icon && /* @__PURE__ */ jsx13("div", { className: "flex h-12 w-12 shrink-0 items-center justify-center rounded-lg bg-muted", children: meta.icon }),
|
|
3001
|
+
/* @__PURE__ */ jsxs11("div", { className: "space-y-1", children: [
|
|
3002
|
+
/* @__PURE__ */ jsx13("h3", { className: "text-lg font-semibold", children: integration.name }),
|
|
3003
|
+
/* @__PURE__ */ jsx13("p", { className: "text-sm text-muted-foreground", children: integration.description })
|
|
3329
3004
|
] })
|
|
3330
3005
|
] }),
|
|
3331
|
-
meta.capabilities.length > 0 && /* @__PURE__ */
|
|
3332
|
-
/* @__PURE__ */
|
|
3333
|
-
/* @__PURE__ */
|
|
3334
|
-
/* @__PURE__ */
|
|
3006
|
+
meta.capabilities.length > 0 && /* @__PURE__ */ jsxs11("div", { className: "space-y-3", children: [
|
|
3007
|
+
/* @__PURE__ */ jsx13("h4", { className: "text-sm font-medium", children: "O que esta integra\xE7\xE3o permite:" }),
|
|
3008
|
+
/* @__PURE__ */ jsx13("ul", { className: "space-y-2", children: meta.capabilities.map((cap, i) => /* @__PURE__ */ jsxs11("li", { className: "flex items-start gap-2 text-sm", children: [
|
|
3009
|
+
/* @__PURE__ */ jsx13(
|
|
3335
3010
|
Check,
|
|
3336
3011
|
{
|
|
3337
3012
|
"aria-hidden": "true",
|
|
3338
3013
|
className: "mt-0.5 h-4 w-4 shrink-0 text-green-600"
|
|
3339
3014
|
}
|
|
3340
3015
|
),
|
|
3341
|
-
/* @__PURE__ */
|
|
3342
|
-
/* @__PURE__ */
|
|
3343
|
-
cap.description && /* @__PURE__ */
|
|
3016
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
3017
|
+
/* @__PURE__ */ jsx13("span", { className: "font-medium", children: cap.label }),
|
|
3018
|
+
cap.description && /* @__PURE__ */ jsxs11("span", { className: "text-muted-foreground", children: [
|
|
3344
3019
|
" ",
|
|
3345
3020
|
"\u2014 ",
|
|
3346
3021
|
cap.description
|
|
@@ -3348,21 +3023,21 @@ function InfoStep({ integration, meta }) {
|
|
|
3348
3023
|
] })
|
|
3349
3024
|
] }, i)) })
|
|
3350
3025
|
] }),
|
|
3351
|
-
meta.requirements.length > 0 && /* @__PURE__ */
|
|
3352
|
-
/* @__PURE__ */
|
|
3353
|
-
/* @__PURE__ */
|
|
3026
|
+
meta.requirements.length > 0 && /* @__PURE__ */ jsxs11("div", { className: "space-y-3", children: [
|
|
3027
|
+
/* @__PURE__ */ jsx13("h4", { className: "text-sm font-medium", children: "Requisitos:" }),
|
|
3028
|
+
/* @__PURE__ */ jsx13("ul", { className: "space-y-2", children: meta.requirements.map((req, i) => /* @__PURE__ */ jsxs11(
|
|
3354
3029
|
"li",
|
|
3355
3030
|
{
|
|
3356
3031
|
className: "flex items-start gap-2 text-sm text-muted-foreground",
|
|
3357
3032
|
children: [
|
|
3358
|
-
/* @__PURE__ */
|
|
3033
|
+
/* @__PURE__ */ jsx13(
|
|
3359
3034
|
Info,
|
|
3360
3035
|
{
|
|
3361
3036
|
"aria-hidden": "true",
|
|
3362
3037
|
className: "mt-0.5 h-4 w-4 shrink-0 text-blue-500"
|
|
3363
3038
|
}
|
|
3364
3039
|
),
|
|
3365
|
-
/* @__PURE__ */
|
|
3040
|
+
/* @__PURE__ */ jsx13("span", { children: req })
|
|
3366
3041
|
]
|
|
3367
3042
|
},
|
|
3368
3043
|
i
|
|
@@ -3372,9 +3047,9 @@ function InfoStep({ integration, meta }) {
|
|
|
3372
3047
|
}
|
|
3373
3048
|
|
|
3374
3049
|
// src/components/capabilities/wizard-steps/credentials-step.tsx
|
|
3375
|
-
import { CheckCircle2, Loader2 as Loader25, AlertCircle, Shield } from "lucide-react";
|
|
3376
|
-
import { Button as
|
|
3377
|
-
import { jsx as
|
|
3050
|
+
import { CheckCircle2, Loader2 as Loader25, AlertCircle, Shield, Info as Info2 } from "lucide-react";
|
|
3051
|
+
import { Button as Button9, Input as Input6, Label as Label4, Tooltip as Tooltip3, TooltipTrigger as TooltipTrigger3, TooltipContent as TooltipContent3 } from "@greatapps/greatauth-ui/ui";
|
|
3052
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3378
3053
|
function CredentialsStep({
|
|
3379
3054
|
integration,
|
|
3380
3055
|
meta,
|
|
@@ -3383,10 +3058,11 @@ function CredentialsStep({
|
|
|
3383
3058
|
apiKey,
|
|
3384
3059
|
onApiKeyChange,
|
|
3385
3060
|
onStartOAuth,
|
|
3386
|
-
isReconnect = false
|
|
3061
|
+
isReconnect = false,
|
|
3062
|
+
oauthConfigured = false
|
|
3387
3063
|
}) {
|
|
3388
3064
|
if (integration.authType === "oauth2") {
|
|
3389
|
-
return /* @__PURE__ */
|
|
3065
|
+
return /* @__PURE__ */ jsx14(
|
|
3390
3066
|
OAuthCredentials,
|
|
3391
3067
|
{
|
|
3392
3068
|
integration,
|
|
@@ -3394,11 +3070,12 @@ function CredentialsStep({
|
|
|
3394
3070
|
oauthStatus,
|
|
3395
3071
|
oauthResult,
|
|
3396
3072
|
onStartOAuth,
|
|
3397
|
-
isReconnect
|
|
3073
|
+
isReconnect,
|
|
3074
|
+
oauthConfigured
|
|
3398
3075
|
}
|
|
3399
3076
|
);
|
|
3400
3077
|
}
|
|
3401
|
-
return /* @__PURE__ */
|
|
3078
|
+
return /* @__PURE__ */ jsx14(ApiKeyCredentials, { apiKey, onApiKeyChange });
|
|
3402
3079
|
}
|
|
3403
3080
|
function OAuthCredentials({
|
|
3404
3081
|
integration,
|
|
@@ -3406,69 +3083,99 @@ function OAuthCredentials({
|
|
|
3406
3083
|
oauthStatus,
|
|
3407
3084
|
oauthResult,
|
|
3408
3085
|
onStartOAuth,
|
|
3409
|
-
isReconnect
|
|
3086
|
+
isReconnect,
|
|
3087
|
+
oauthConfigured
|
|
3410
3088
|
}) {
|
|
3411
3089
|
const providerLabel = meta.providerLabel || integration.name;
|
|
3412
|
-
return /* @__PURE__ */
|
|
3413
|
-
/* @__PURE__ */
|
|
3414
|
-
/* @__PURE__ */
|
|
3415
|
-
/* @__PURE__ */
|
|
3090
|
+
return /* @__PURE__ */ jsxs12("div", { className: "space-y-6", children: [
|
|
3091
|
+
/* @__PURE__ */ jsxs12("div", { className: "space-y-2", children: [
|
|
3092
|
+
/* @__PURE__ */ jsx14("h3", { className: "text-lg font-semibold", children: "Autentica\xE7\xE3o" }),
|
|
3093
|
+
/* @__PURE__ */ jsx14("p", { className: "text-sm text-muted-foreground", children: isReconnect ? `Reconecte sua conta ${providerLabel} para renovar a autoriza\xE7\xE3o.` : `Conecte sua conta ${providerLabel} para permitir o acesso.` })
|
|
3094
|
+
] }),
|
|
3095
|
+
!oauthConfigured && oauthStatus === "idle" && /* @__PURE__ */ jsxs12("div", { className: "flex items-start gap-3 rounded-lg border border-amber-200 bg-amber-50 p-4 dark:border-amber-900 dark:bg-amber-950/30", children: [
|
|
3096
|
+
/* @__PURE__ */ jsx14(
|
|
3097
|
+
Info2,
|
|
3098
|
+
{
|
|
3099
|
+
"aria-hidden": "true",
|
|
3100
|
+
className: "mt-0.5 h-5 w-5 shrink-0 text-amber-600 dark:text-amber-400"
|
|
3101
|
+
}
|
|
3102
|
+
),
|
|
3103
|
+
/* @__PURE__ */ jsxs12("div", { className: "space-y-1", children: [
|
|
3104
|
+
/* @__PURE__ */ jsx14("p", { className: "text-sm font-medium text-amber-800 dark:text-amber-200", children: "Configura\xE7\xE3o necess\xE1ria" }),
|
|
3105
|
+
/* @__PURE__ */ jsxs12("p", { className: "text-xs text-amber-700 dark:text-amber-300", children: [
|
|
3106
|
+
"A integra\xE7\xE3o com ",
|
|
3107
|
+
providerLabel,
|
|
3108
|
+
" requer configura\xE7\xE3o pelo administrador do sistema. Entre em contato com o suporte para ativar esta funcionalidade."
|
|
3109
|
+
] })
|
|
3110
|
+
] })
|
|
3416
3111
|
] }),
|
|
3417
|
-
/* @__PURE__ */
|
|
3418
|
-
oauthStatus === "idle" && /* @__PURE__ */
|
|
3419
|
-
|
|
3420
|
-
|
|
3112
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-col items-center gap-4 rounded-lg border p-6", children: [
|
|
3113
|
+
oauthStatus === "idle" && /* @__PURE__ */ jsxs12(Tooltip3, { children: [
|
|
3114
|
+
/* @__PURE__ */ jsx14(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx14("span", { tabIndex: !oauthConfigured ? 0 : void 0, children: /* @__PURE__ */ jsxs12(
|
|
3115
|
+
Button9,
|
|
3116
|
+
{
|
|
3117
|
+
onClick: onStartOAuth,
|
|
3118
|
+
size: "lg",
|
|
3119
|
+
className: "gap-2",
|
|
3120
|
+
disabled: !oauthConfigured,
|
|
3121
|
+
children: [
|
|
3122
|
+
meta.icon,
|
|
3123
|
+
isReconnect ? `Reconectar com ${providerLabel}` : `Conectar com ${providerLabel}`
|
|
3124
|
+
]
|
|
3125
|
+
}
|
|
3126
|
+
) }) }),
|
|
3127
|
+
!oauthConfigured && /* @__PURE__ */ jsx14(TooltipContent3, { children: "Integra\xE7\xE3o OAuth ainda n\xE3o configurada no servidor" })
|
|
3421
3128
|
] }),
|
|
3422
|
-
oauthStatus === "waiting" && /* @__PURE__ */
|
|
3423
|
-
/* @__PURE__ */
|
|
3129
|
+
oauthStatus === "waiting" && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
3130
|
+
/* @__PURE__ */ jsx14(
|
|
3424
3131
|
Loader25,
|
|
3425
3132
|
{
|
|
3426
3133
|
"aria-hidden": "true",
|
|
3427
3134
|
className: "h-8 w-8 animate-spin text-muted-foreground"
|
|
3428
3135
|
}
|
|
3429
3136
|
),
|
|
3430
|
-
/* @__PURE__ */
|
|
3431
|
-
/* @__PURE__ */
|
|
3432
|
-
/* @__PURE__ */
|
|
3137
|
+
/* @__PURE__ */ jsxs12("div", { children: [
|
|
3138
|
+
/* @__PURE__ */ jsx14("p", { className: "text-sm font-medium", children: "Aguardando autoriza\xE7\xE3o..." }),
|
|
3139
|
+
/* @__PURE__ */ jsx14("p", { className: "text-xs text-muted-foreground", children: "Complete o login na janela que foi aberta." })
|
|
3433
3140
|
] })
|
|
3434
3141
|
] }),
|
|
3435
|
-
oauthStatus === "success" && oauthResult && /* @__PURE__ */
|
|
3436
|
-
/* @__PURE__ */
|
|
3142
|
+
oauthStatus === "success" && oauthResult && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
3143
|
+
/* @__PURE__ */ jsx14(
|
|
3437
3144
|
CheckCircle2,
|
|
3438
3145
|
{
|
|
3439
3146
|
"aria-hidden": "true",
|
|
3440
3147
|
className: "h-8 w-8 text-green-600"
|
|
3441
3148
|
}
|
|
3442
3149
|
),
|
|
3443
|
-
/* @__PURE__ */
|
|
3444
|
-
/* @__PURE__ */
|
|
3445
|
-
oauthResult.email && /* @__PURE__ */
|
|
3150
|
+
/* @__PURE__ */ jsxs12("div", { children: [
|
|
3151
|
+
/* @__PURE__ */ jsx14("p", { className: "text-sm font-medium text-green-700", children: "Conectado com sucesso!" }),
|
|
3152
|
+
oauthResult.email && /* @__PURE__ */ jsx14("p", { className: "text-xs text-muted-foreground", children: oauthResult.email })
|
|
3446
3153
|
] })
|
|
3447
3154
|
] }),
|
|
3448
|
-
oauthStatus === "error" && /* @__PURE__ */
|
|
3449
|
-
/* @__PURE__ */
|
|
3155
|
+
oauthStatus === "error" && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
3156
|
+
/* @__PURE__ */ jsx14(
|
|
3450
3157
|
AlertCircle,
|
|
3451
3158
|
{
|
|
3452
3159
|
"aria-hidden": "true",
|
|
3453
3160
|
className: "h-8 w-8 text-destructive"
|
|
3454
3161
|
}
|
|
3455
3162
|
),
|
|
3456
|
-
/* @__PURE__ */
|
|
3457
|
-
/* @__PURE__ */
|
|
3458
|
-
oauthResult?.error && /* @__PURE__ */
|
|
3163
|
+
/* @__PURE__ */ jsxs12("div", { children: [
|
|
3164
|
+
/* @__PURE__ */ jsx14("p", { className: "text-sm font-medium text-destructive", children: "Falha na conex\xE3o" }),
|
|
3165
|
+
oauthResult?.error && /* @__PURE__ */ jsx14("p", { className: "text-xs text-muted-foreground", children: oauthResult.error })
|
|
3459
3166
|
] }),
|
|
3460
|
-
/* @__PURE__ */
|
|
3167
|
+
/* @__PURE__ */ jsx14(Button9, { variant: "outline", onClick: onStartOAuth, size: "sm", children: "Tentar novamente" })
|
|
3461
3168
|
] })
|
|
3462
3169
|
] }),
|
|
3463
|
-
/* @__PURE__ */
|
|
3464
|
-
/* @__PURE__ */
|
|
3170
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-start gap-2 rounded-md bg-muted/50 p-3", children: [
|
|
3171
|
+
/* @__PURE__ */ jsx14(
|
|
3465
3172
|
Shield,
|
|
3466
3173
|
{
|
|
3467
3174
|
"aria-hidden": "true",
|
|
3468
3175
|
className: "mt-0.5 h-4 w-4 shrink-0 text-green-600"
|
|
3469
3176
|
}
|
|
3470
3177
|
),
|
|
3471
|
-
/* @__PURE__ */
|
|
3178
|
+
/* @__PURE__ */ jsxs12("p", { className: "text-xs text-muted-foreground", children: [
|
|
3472
3179
|
"Seus dados est\xE3o seguros. Usamos OAuth 2.0 para autentica\xE7\xE3o \u2014 nunca armazenamos sua senha. Voc\xEA pode revogar o acesso a qualquer momento nas configura\xE7\xF5es da sua conta ",
|
|
3473
3180
|
providerLabel,
|
|
3474
3181
|
"."
|
|
@@ -3480,15 +3187,15 @@ function ApiKeyCredentials({
|
|
|
3480
3187
|
apiKey,
|
|
3481
3188
|
onApiKeyChange
|
|
3482
3189
|
}) {
|
|
3483
|
-
return /* @__PURE__ */
|
|
3484
|
-
/* @__PURE__ */
|
|
3485
|
-
/* @__PURE__ */
|
|
3486
|
-
/* @__PURE__ */
|
|
3190
|
+
return /* @__PURE__ */ jsxs12("div", { className: "space-y-6", children: [
|
|
3191
|
+
/* @__PURE__ */ jsxs12("div", { className: "space-y-2", children: [
|
|
3192
|
+
/* @__PURE__ */ jsx14("h3", { className: "text-lg font-semibold", children: "Autentica\xE7\xE3o" }),
|
|
3193
|
+
/* @__PURE__ */ jsx14("p", { className: "text-sm text-muted-foreground", children: "Insira a chave de API para conectar a integra\xE7\xE3o." })
|
|
3487
3194
|
] }),
|
|
3488
|
-
/* @__PURE__ */
|
|
3489
|
-
/* @__PURE__ */
|
|
3490
|
-
/* @__PURE__ */
|
|
3491
|
-
|
|
3195
|
+
/* @__PURE__ */ jsxs12("div", { className: "space-y-2", children: [
|
|
3196
|
+
/* @__PURE__ */ jsx14(Label4, { htmlFor: "integration-api-key", children: "Chave de API" }),
|
|
3197
|
+
/* @__PURE__ */ jsx14(
|
|
3198
|
+
Input6,
|
|
3492
3199
|
{
|
|
3493
3200
|
id: "integration-api-key",
|
|
3494
3201
|
type: "password",
|
|
@@ -3499,15 +3206,15 @@ function ApiKeyCredentials({
|
|
|
3499
3206
|
}
|
|
3500
3207
|
)
|
|
3501
3208
|
] }),
|
|
3502
|
-
/* @__PURE__ */
|
|
3503
|
-
/* @__PURE__ */
|
|
3209
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-start gap-2 rounded-md bg-muted/50 p-3", children: [
|
|
3210
|
+
/* @__PURE__ */ jsx14(
|
|
3504
3211
|
Shield,
|
|
3505
3212
|
{
|
|
3506
3213
|
"aria-hidden": "true",
|
|
3507
3214
|
className: "mt-0.5 h-4 w-4 shrink-0 text-green-600"
|
|
3508
3215
|
}
|
|
3509
3216
|
),
|
|
3510
|
-
/* @__PURE__ */
|
|
3217
|
+
/* @__PURE__ */ jsx14("p", { className: "text-xs text-muted-foreground", children: "Sua chave de API \xE9 armazenada de forma segura e encriptada. Nunca \xE9 exposta no frontend." })
|
|
3511
3218
|
] })
|
|
3512
3219
|
] });
|
|
3513
3220
|
}
|
|
@@ -3515,14 +3222,14 @@ function ApiKeyCredentials({
|
|
|
3515
3222
|
// src/components/capabilities/wizard-steps/config-step.tsx
|
|
3516
3223
|
import { Loader2 as Loader26 } from "lucide-react";
|
|
3517
3224
|
import {
|
|
3518
|
-
Label as
|
|
3519
|
-
Select
|
|
3520
|
-
SelectContent
|
|
3521
|
-
SelectItem
|
|
3522
|
-
SelectTrigger
|
|
3523
|
-
SelectValue
|
|
3225
|
+
Label as Label5,
|
|
3226
|
+
Select,
|
|
3227
|
+
SelectContent,
|
|
3228
|
+
SelectItem,
|
|
3229
|
+
SelectTrigger,
|
|
3230
|
+
SelectValue
|
|
3524
3231
|
} from "@greatapps/greatauth-ui/ui";
|
|
3525
|
-
import { jsx as
|
|
3232
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3526
3233
|
function ConfigStep({
|
|
3527
3234
|
integration,
|
|
3528
3235
|
options,
|
|
@@ -3534,27 +3241,27 @@ function ConfigStep({
|
|
|
3534
3241
|
}) {
|
|
3535
3242
|
const label = selectLabel || getDefaultLabel(integration.slug);
|
|
3536
3243
|
const placeholder = selectPlaceholder || getDefaultPlaceholder(integration.slug);
|
|
3537
|
-
return /* @__PURE__ */
|
|
3538
|
-
/* @__PURE__ */
|
|
3539
|
-
/* @__PURE__ */
|
|
3540
|
-
/* @__PURE__ */
|
|
3244
|
+
return /* @__PURE__ */ jsxs13("div", { className: "space-y-6", children: [
|
|
3245
|
+
/* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
|
|
3246
|
+
/* @__PURE__ */ jsx15("h3", { className: "text-lg font-semibold", children: "Configura\xE7\xE3o" }),
|
|
3247
|
+
/* @__PURE__ */ jsx15("p", { className: "text-sm text-muted-foreground", children: "Configure as op\xE7\xF5es espec\xEDficas da integra\xE7\xE3o." })
|
|
3541
3248
|
] }),
|
|
3542
|
-
isLoading ? /* @__PURE__ */
|
|
3543
|
-
/* @__PURE__ */
|
|
3249
|
+
isLoading ? /* @__PURE__ */ jsxs13("div", { className: "flex flex-col items-center gap-3 py-8", children: [
|
|
3250
|
+
/* @__PURE__ */ jsx15(
|
|
3544
3251
|
Loader26,
|
|
3545
3252
|
{
|
|
3546
3253
|
"aria-hidden": "true",
|
|
3547
3254
|
className: "h-6 w-6 animate-spin text-muted-foreground"
|
|
3548
3255
|
}
|
|
3549
3256
|
),
|
|
3550
|
-
/* @__PURE__ */
|
|
3551
|
-
] }) : options.length === 0 ? /* @__PURE__ */
|
|
3552
|
-
/* @__PURE__ */
|
|
3553
|
-
/* @__PURE__ */
|
|
3554
|
-
/* @__PURE__ */
|
|
3555
|
-
/* @__PURE__ */
|
|
3556
|
-
/* @__PURE__ */
|
|
3557
|
-
opt.description && /* @__PURE__ */
|
|
3257
|
+
/* @__PURE__ */ jsx15("p", { className: "text-sm text-muted-foreground", children: "Carregando op\xE7\xF5es..." })
|
|
3258
|
+
] }) : options.length === 0 ? /* @__PURE__ */ jsx15("div", { className: "rounded-lg border border-dashed p-6 text-center", children: /* @__PURE__ */ jsx15("p", { className: "text-sm text-muted-foreground", children: "Nenhuma op\xE7\xE3o dispon\xEDvel. A configura\xE7\xE3o padr\xE3o ser\xE1 usada." }) }) : /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
|
|
3259
|
+
/* @__PURE__ */ jsx15(Label5, { htmlFor: "integration-config-select", children: label }),
|
|
3260
|
+
/* @__PURE__ */ jsxs13(Select, { value: selectedValue, onValueChange, children: [
|
|
3261
|
+
/* @__PURE__ */ jsx15(SelectTrigger, { id: "integration-config-select", children: /* @__PURE__ */ jsx15(SelectValue, { placeholder }) }),
|
|
3262
|
+
/* @__PURE__ */ jsx15(SelectContent, { children: options.map((opt) => /* @__PURE__ */ jsxs13(SelectItem, { value: opt.id, children: [
|
|
3263
|
+
/* @__PURE__ */ jsx15("span", { children: opt.label }),
|
|
3264
|
+
opt.description && /* @__PURE__ */ jsxs13("span", { className: "ml-2 text-xs text-muted-foreground", children: [
|
|
3558
3265
|
"(",
|
|
3559
3266
|
opt.description,
|
|
3560
3267
|
")"
|
|
@@ -3583,8 +3290,8 @@ function getDefaultPlaceholder(slug) {
|
|
|
3583
3290
|
|
|
3584
3291
|
// src/components/capabilities/wizard-steps/confirm-step.tsx
|
|
3585
3292
|
import { CheckCircle2 as CheckCircle22 } from "lucide-react";
|
|
3586
|
-
import { Label as
|
|
3587
|
-
import { jsx as
|
|
3293
|
+
import { Label as Label6 } from "@greatapps/greatauth-ui/ui";
|
|
3294
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3588
3295
|
function ConfirmStep({
|
|
3589
3296
|
integration,
|
|
3590
3297
|
oauthResult,
|
|
@@ -3592,22 +3299,22 @@ function ConfirmStep({
|
|
|
3592
3299
|
enableOnComplete,
|
|
3593
3300
|
onEnableChange
|
|
3594
3301
|
}) {
|
|
3595
|
-
return /* @__PURE__ */
|
|
3596
|
-
/* @__PURE__ */
|
|
3597
|
-
/* @__PURE__ */
|
|
3598
|
-
/* @__PURE__ */
|
|
3302
|
+
return /* @__PURE__ */ jsxs14("div", { className: "space-y-6", children: [
|
|
3303
|
+
/* @__PURE__ */ jsxs14("div", { className: "space-y-2", children: [
|
|
3304
|
+
/* @__PURE__ */ jsx16("h3", { className: "text-lg font-semibold", children: "Confirma\xE7\xE3o" }),
|
|
3305
|
+
/* @__PURE__ */ jsx16("p", { className: "text-sm text-muted-foreground", children: "Revise as configura\xE7\xF5es antes de concluir." })
|
|
3599
3306
|
] }),
|
|
3600
|
-
/* @__PURE__ */
|
|
3601
|
-
/* @__PURE__ */
|
|
3602
|
-
oauthResult?.email && /* @__PURE__ */
|
|
3603
|
-
selectedConfigOption && /* @__PURE__ */
|
|
3307
|
+
/* @__PURE__ */ jsxs14("div", { className: "space-y-3 rounded-lg border p-4", children: [
|
|
3308
|
+
/* @__PURE__ */ jsx16(SummaryRow, { label: "Integra\xE7\xE3o", value: integration.name }),
|
|
3309
|
+
oauthResult?.email && /* @__PURE__ */ jsx16(SummaryRow, { label: "Conta conectada", value: oauthResult.email }),
|
|
3310
|
+
selectedConfigOption && /* @__PURE__ */ jsx16(
|
|
3604
3311
|
SummaryRow,
|
|
3605
3312
|
{
|
|
3606
3313
|
label: getConfigLabel(integration.slug),
|
|
3607
3314
|
value: selectedConfigOption.label
|
|
3608
3315
|
}
|
|
3609
3316
|
),
|
|
3610
|
-
/* @__PURE__ */
|
|
3317
|
+
/* @__PURE__ */ jsx16(
|
|
3611
3318
|
SummaryRow,
|
|
3612
3319
|
{
|
|
3613
3320
|
label: "Tipo de autentica\xE7\xE3o",
|
|
@@ -3615,12 +3322,12 @@ function ConfirmStep({
|
|
|
3615
3322
|
}
|
|
3616
3323
|
)
|
|
3617
3324
|
] }),
|
|
3618
|
-
/* @__PURE__ */
|
|
3619
|
-
/* @__PURE__ */
|
|
3620
|
-
/* @__PURE__ */
|
|
3621
|
-
/* @__PURE__ */
|
|
3325
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between rounded-lg border p-4", children: [
|
|
3326
|
+
/* @__PURE__ */ jsxs14("div", { className: "space-y-0.5", children: [
|
|
3327
|
+
/* @__PURE__ */ jsx16(Label6, { htmlFor: "enable-on-complete", className: "text-sm font-medium", children: "Ativar imediatamente" }),
|
|
3328
|
+
/* @__PURE__ */ jsx16("p", { className: "text-xs text-muted-foreground", children: "A integra\xE7\xE3o ficar\xE1 ativa assim que concluir o assistente." })
|
|
3622
3329
|
] }),
|
|
3623
|
-
/* @__PURE__ */
|
|
3330
|
+
/* @__PURE__ */ jsx16(
|
|
3624
3331
|
"button",
|
|
3625
3332
|
{
|
|
3626
3333
|
id: "enable-on-complete",
|
|
@@ -3634,7 +3341,7 @@ function ConfirmStep({
|
|
|
3634
3341
|
focus-visible:ring-ring focus-visible:ring-offset-2
|
|
3635
3342
|
${enableOnComplete ? "bg-primary" : "bg-muted"}
|
|
3636
3343
|
`,
|
|
3637
|
-
children: /* @__PURE__ */
|
|
3344
|
+
children: /* @__PURE__ */ jsx16(
|
|
3638
3345
|
"span",
|
|
3639
3346
|
{
|
|
3640
3347
|
"aria-hidden": "true",
|
|
@@ -3648,22 +3355,22 @@ function ConfirmStep({
|
|
|
3648
3355
|
}
|
|
3649
3356
|
)
|
|
3650
3357
|
] }),
|
|
3651
|
-
/* @__PURE__ */
|
|
3652
|
-
/* @__PURE__ */
|
|
3358
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 rounded-md bg-green-50 p-3 dark:bg-green-950/20", children: [
|
|
3359
|
+
/* @__PURE__ */ jsx16(
|
|
3653
3360
|
CheckCircle22,
|
|
3654
3361
|
{
|
|
3655
3362
|
"aria-hidden": "true",
|
|
3656
3363
|
className: "h-4 w-4 shrink-0 text-green-600"
|
|
3657
3364
|
}
|
|
3658
3365
|
),
|
|
3659
|
-
/* @__PURE__ */
|
|
3366
|
+
/* @__PURE__ */ jsx16("p", { className: "text-xs text-green-700 dark:text-green-400", children: 'Tudo pronto! Clique em "Concluir" para finalizar a configura\xE7\xE3o.' })
|
|
3660
3367
|
] })
|
|
3661
3368
|
] });
|
|
3662
3369
|
}
|
|
3663
3370
|
function SummaryRow({ label, value }) {
|
|
3664
|
-
return /* @__PURE__ */
|
|
3665
|
-
/* @__PURE__ */
|
|
3666
|
-
/* @__PURE__ */
|
|
3371
|
+
return /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between text-sm", children: [
|
|
3372
|
+
/* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: label }),
|
|
3373
|
+
/* @__PURE__ */ jsx16("span", { className: "font-medium", children: value })
|
|
3667
3374
|
] });
|
|
3668
3375
|
}
|
|
3669
3376
|
function getConfigLabel(slug) {
|
|
@@ -3676,7 +3383,7 @@ function getConfigLabel(slug) {
|
|
|
3676
3383
|
}
|
|
3677
3384
|
|
|
3678
3385
|
// src/components/capabilities/integration-wizard.tsx
|
|
3679
|
-
import { jsx as
|
|
3386
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3680
3387
|
var STEPS = ["info", "credentials", "config", "confirm"];
|
|
3681
3388
|
var STEP_LABELS = {
|
|
3682
3389
|
info: "Informa\xE7\xE3o",
|
|
@@ -3698,18 +3405,18 @@ function IntegrationWizard({
|
|
|
3698
3405
|
existingConfigValue
|
|
3699
3406
|
}) {
|
|
3700
3407
|
const isReconnect = !!existingCredentialId;
|
|
3701
|
-
const [currentStep, setCurrentStep] =
|
|
3408
|
+
const [currentStep, setCurrentStep] = useState9("info");
|
|
3702
3409
|
const currentIndex = STEPS.indexOf(currentStep);
|
|
3703
|
-
const [oauthStatus, setOauthStatus] =
|
|
3704
|
-
const [oauthResult, setOauthResult] =
|
|
3410
|
+
const [oauthStatus, setOauthStatus] = useState9("idle");
|
|
3411
|
+
const [oauthResult, setOauthResult] = useState9(null);
|
|
3705
3412
|
const popupRef = useRef3(null);
|
|
3706
3413
|
const popupPollRef = useRef3(null);
|
|
3707
|
-
const [apiKey, setApiKey] =
|
|
3708
|
-
const [configOptions, setConfigOptions] =
|
|
3709
|
-
const [configLoading, setConfigLoading] =
|
|
3710
|
-
const [selectedConfigValue, setSelectedConfigValue] =
|
|
3711
|
-
const [enableOnComplete, setEnableOnComplete] =
|
|
3712
|
-
const [isSubmitting, setIsSubmitting] =
|
|
3414
|
+
const [apiKey, setApiKey] = useState9("");
|
|
3415
|
+
const [configOptions, setConfigOptions] = useState9([]);
|
|
3416
|
+
const [configLoading, setConfigLoading] = useState9(false);
|
|
3417
|
+
const [selectedConfigValue, setSelectedConfigValue] = useState9("");
|
|
3418
|
+
const [enableOnComplete, setEnableOnComplete] = useState9(true);
|
|
3419
|
+
const [isSubmitting, setIsSubmitting] = useState9(false);
|
|
3713
3420
|
useEffect5(() => {
|
|
3714
3421
|
return () => {
|
|
3715
3422
|
if (popupPollRef.current) {
|
|
@@ -3860,11 +3567,11 @@ function IntegrationWizard({
|
|
|
3860
3567
|
try {
|
|
3861
3568
|
onComplete();
|
|
3862
3569
|
onOpenChange(false);
|
|
3863
|
-
|
|
3570
|
+
toast7.success(
|
|
3864
3571
|
`${integration.name} ${isReconnect ? "reconectado" : "configurado"} com sucesso!`
|
|
3865
3572
|
);
|
|
3866
3573
|
} catch {
|
|
3867
|
-
|
|
3574
|
+
toast7.error("Erro ao finalizar configura\xE7\xE3o");
|
|
3868
3575
|
} finally {
|
|
3869
3576
|
setIsSubmitting(false);
|
|
3870
3577
|
}
|
|
@@ -3872,18 +3579,18 @@ function IntegrationWizard({
|
|
|
3872
3579
|
const selectedConfigOption = configOptions.find((o) => o.id === selectedConfigValue) || null;
|
|
3873
3580
|
const isLastStep = currentStep === "confirm";
|
|
3874
3581
|
const effectiveSteps = meta.hasConfigStep ? STEPS : STEPS.filter((s) => s !== "config");
|
|
3875
|
-
return /* @__PURE__ */
|
|
3876
|
-
/* @__PURE__ */
|
|
3877
|
-
/* @__PURE__ */
|
|
3878
|
-
/* @__PURE__ */
|
|
3879
|
-
currentStep === "info" && /* @__PURE__ */
|
|
3582
|
+
return /* @__PURE__ */ jsx17(Dialog4, { open, onOpenChange, children: /* @__PURE__ */ jsxs15(DialogContent4, { className: "sm:max-w-lg", children: [
|
|
3583
|
+
/* @__PURE__ */ jsx17(DialogHeader4, { children: /* @__PURE__ */ jsx17(DialogTitle4, { children: integration.name }) }),
|
|
3584
|
+
/* @__PURE__ */ jsx17(StepIndicator, { steps: effectiveSteps, currentStep }),
|
|
3585
|
+
/* @__PURE__ */ jsxs15("div", { className: "min-h-[280px] py-2", children: [
|
|
3586
|
+
currentStep === "info" && /* @__PURE__ */ jsx17(
|
|
3880
3587
|
InfoStep,
|
|
3881
3588
|
{
|
|
3882
3589
|
integration,
|
|
3883
3590
|
meta
|
|
3884
3591
|
}
|
|
3885
3592
|
),
|
|
3886
|
-
currentStep === "credentials" && /* @__PURE__ */
|
|
3593
|
+
currentStep === "credentials" && /* @__PURE__ */ jsx17(
|
|
3887
3594
|
CredentialsStep,
|
|
3888
3595
|
{
|
|
3889
3596
|
integration,
|
|
@@ -3896,7 +3603,7 @@ function IntegrationWizard({
|
|
|
3896
3603
|
isReconnect
|
|
3897
3604
|
}
|
|
3898
3605
|
),
|
|
3899
|
-
currentStep === "config" && /* @__PURE__ */
|
|
3606
|
+
currentStep === "config" && /* @__PURE__ */ jsx17(
|
|
3900
3607
|
ConfigStep,
|
|
3901
3608
|
{
|
|
3902
3609
|
integration,
|
|
@@ -3906,7 +3613,7 @@ function IntegrationWizard({
|
|
|
3906
3613
|
onValueChange: setSelectedConfigValue
|
|
3907
3614
|
}
|
|
3908
3615
|
),
|
|
3909
|
-
currentStep === "confirm" && /* @__PURE__ */
|
|
3616
|
+
currentStep === "confirm" && /* @__PURE__ */ jsx17(
|
|
3910
3617
|
ConfirmStep,
|
|
3911
3618
|
{
|
|
3912
3619
|
integration,
|
|
@@ -3917,48 +3624,48 @@ function IntegrationWizard({
|
|
|
3917
3624
|
}
|
|
3918
3625
|
)
|
|
3919
3626
|
] }),
|
|
3920
|
-
/* @__PURE__ */
|
|
3921
|
-
/* @__PURE__ */
|
|
3922
|
-
|
|
3627
|
+
/* @__PURE__ */ jsxs15(DialogFooter4, { className: "flex-row justify-between sm:justify-between", children: [
|
|
3628
|
+
/* @__PURE__ */ jsx17("div", { children: currentStep === "info" ? /* @__PURE__ */ jsx17(
|
|
3629
|
+
Button10,
|
|
3923
3630
|
{
|
|
3924
3631
|
type: "button",
|
|
3925
3632
|
variant: "outline",
|
|
3926
3633
|
onClick: () => onOpenChange(false),
|
|
3927
3634
|
children: "Cancelar"
|
|
3928
3635
|
}
|
|
3929
|
-
) : /* @__PURE__ */
|
|
3930
|
-
|
|
3636
|
+
) : /* @__PURE__ */ jsxs15(
|
|
3637
|
+
Button10,
|
|
3931
3638
|
{
|
|
3932
3639
|
type: "button",
|
|
3933
3640
|
variant: "outline",
|
|
3934
3641
|
onClick: goPrev,
|
|
3935
3642
|
className: "gap-1",
|
|
3936
3643
|
children: [
|
|
3937
|
-
/* @__PURE__ */
|
|
3644
|
+
/* @__PURE__ */ jsx17(ChevronLeft, { "aria-hidden": "true", className: "h-4 w-4" }),
|
|
3938
3645
|
"Voltar"
|
|
3939
3646
|
]
|
|
3940
3647
|
}
|
|
3941
3648
|
) }),
|
|
3942
|
-
/* @__PURE__ */
|
|
3943
|
-
|
|
3649
|
+
/* @__PURE__ */ jsx17("div", { children: isLastStep ? /* @__PURE__ */ jsxs15(
|
|
3650
|
+
Button10,
|
|
3944
3651
|
{
|
|
3945
3652
|
type: "button",
|
|
3946
3653
|
onClick: handleComplete,
|
|
3947
3654
|
disabled: isSubmitting,
|
|
3948
3655
|
className: "gap-1",
|
|
3949
3656
|
children: [
|
|
3950
|
-
isSubmitting ? /* @__PURE__ */
|
|
3657
|
+
isSubmitting ? /* @__PURE__ */ jsx17(
|
|
3951
3658
|
Loader27,
|
|
3952
3659
|
{
|
|
3953
3660
|
"aria-hidden": "true",
|
|
3954
3661
|
className: "h-4 w-4 animate-spin"
|
|
3955
3662
|
}
|
|
3956
|
-
) : /* @__PURE__ */
|
|
3663
|
+
) : /* @__PURE__ */ jsx17(Check2, { "aria-hidden": "true", className: "h-4 w-4" }),
|
|
3957
3664
|
"Concluir"
|
|
3958
3665
|
]
|
|
3959
3666
|
}
|
|
3960
|
-
) : /* @__PURE__ */
|
|
3961
|
-
|
|
3667
|
+
) : /* @__PURE__ */ jsxs15(
|
|
3668
|
+
Button10,
|
|
3962
3669
|
{
|
|
3963
3670
|
type: "button",
|
|
3964
3671
|
onClick: goNext,
|
|
@@ -3966,7 +3673,7 @@ function IntegrationWizard({
|
|
|
3966
3673
|
className: "gap-1",
|
|
3967
3674
|
children: [
|
|
3968
3675
|
"Continuar",
|
|
3969
|
-
/* @__PURE__ */
|
|
3676
|
+
/* @__PURE__ */ jsx17(ChevronRight, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
3970
3677
|
]
|
|
3971
3678
|
}
|
|
3972
3679
|
) })
|
|
@@ -3978,7 +3685,7 @@ function StepIndicator({
|
|
|
3978
3685
|
currentStep
|
|
3979
3686
|
}) {
|
|
3980
3687
|
const currentIndex = steps.indexOf(currentStep);
|
|
3981
|
-
return /* @__PURE__ */
|
|
3688
|
+
return /* @__PURE__ */ jsx17(
|
|
3982
3689
|
"div",
|
|
3983
3690
|
{
|
|
3984
3691
|
className: "flex items-center justify-center gap-1 py-2",
|
|
@@ -3987,8 +3694,8 @@ function StepIndicator({
|
|
|
3987
3694
|
children: steps.map((step, i) => {
|
|
3988
3695
|
const isCompleted = i < currentIndex;
|
|
3989
3696
|
const isCurrent = step === currentStep;
|
|
3990
|
-
return /* @__PURE__ */
|
|
3991
|
-
/* @__PURE__ */
|
|
3697
|
+
return /* @__PURE__ */ jsxs15("div", { className: "flex items-center", role: "listitem", children: [
|
|
3698
|
+
/* @__PURE__ */ jsx17(
|
|
3992
3699
|
"div",
|
|
3993
3700
|
{
|
|
3994
3701
|
className: `
|
|
@@ -3998,10 +3705,10 @@ function StepIndicator({
|
|
|
3998
3705
|
`,
|
|
3999
3706
|
"aria-current": isCurrent ? "step" : void 0,
|
|
4000
3707
|
"aria-label": `${STEP_LABELS[step]}${isCompleted ? " (conclu\xEDdo)" : isCurrent ? " (atual)" : ""}`,
|
|
4001
|
-
children: isCompleted ? /* @__PURE__ */
|
|
3708
|
+
children: isCompleted ? /* @__PURE__ */ jsx17(Check2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }) : i + 1
|
|
4002
3709
|
}
|
|
4003
3710
|
),
|
|
4004
|
-
/* @__PURE__ */
|
|
3711
|
+
/* @__PURE__ */ jsx17(
|
|
4005
3712
|
"span",
|
|
4006
3713
|
{
|
|
4007
3714
|
className: `
|
|
@@ -4011,7 +3718,7 @@ function StepIndicator({
|
|
|
4011
3718
|
children: STEP_LABELS[step]
|
|
4012
3719
|
}
|
|
4013
3720
|
),
|
|
4014
|
-
i < steps.length - 1 && /* @__PURE__ */
|
|
3721
|
+
i < steps.length - 1 && /* @__PURE__ */ jsx17(
|
|
4015
3722
|
"div",
|
|
4016
3723
|
{
|
|
4017
3724
|
className: `
|
|
@@ -4027,63 +3734,63 @@ function StepIndicator({
|
|
|
4027
3734
|
}
|
|
4028
3735
|
|
|
4029
3736
|
// src/components/capabilities/advanced-tab.tsx
|
|
4030
|
-
import { useState as
|
|
3737
|
+
import { useState as useState13 } from "react";
|
|
4031
3738
|
|
|
4032
3739
|
// src/components/tools/tools-table.tsx
|
|
4033
|
-
import { useMemo as useMemo6, useState as
|
|
3740
|
+
import { useMemo as useMemo6, useState as useState10 } from "react";
|
|
4034
3741
|
import { DataTable as DataTable2 } from "@greatapps/greatauth-ui";
|
|
4035
3742
|
import {
|
|
4036
|
-
Input as
|
|
4037
|
-
Badge as
|
|
4038
|
-
Tooltip as
|
|
4039
|
-
TooltipTrigger as
|
|
4040
|
-
TooltipContent as
|
|
4041
|
-
AlertDialog as
|
|
4042
|
-
AlertDialogAction as
|
|
4043
|
-
AlertDialogCancel as
|
|
4044
|
-
AlertDialogContent as
|
|
4045
|
-
AlertDialogDescription as
|
|
4046
|
-
AlertDialogFooter as
|
|
4047
|
-
AlertDialogHeader as
|
|
4048
|
-
AlertDialogTitle as
|
|
4049
|
-
Button as
|
|
3743
|
+
Input as Input7,
|
|
3744
|
+
Badge as Badge7,
|
|
3745
|
+
Tooltip as Tooltip4,
|
|
3746
|
+
TooltipTrigger as TooltipTrigger4,
|
|
3747
|
+
TooltipContent as TooltipContent4,
|
|
3748
|
+
AlertDialog as AlertDialog3,
|
|
3749
|
+
AlertDialogAction as AlertDialogAction3,
|
|
3750
|
+
AlertDialogCancel as AlertDialogCancel3,
|
|
3751
|
+
AlertDialogContent as AlertDialogContent3,
|
|
3752
|
+
AlertDialogDescription as AlertDialogDescription3,
|
|
3753
|
+
AlertDialogFooter as AlertDialogFooter3,
|
|
3754
|
+
AlertDialogHeader as AlertDialogHeader3,
|
|
3755
|
+
AlertDialogTitle as AlertDialogTitle3,
|
|
3756
|
+
Button as Button11
|
|
4050
3757
|
} from "@greatapps/greatauth-ui/ui";
|
|
4051
|
-
import { Pencil as Pencil3, Trash2 as
|
|
3758
|
+
import { Pencil as Pencil3, Trash2 as Trash23, Search as Search2 } from "lucide-react";
|
|
4052
3759
|
import { format as format2 } from "date-fns";
|
|
4053
3760
|
import { ptBR as ptBR2 } from "date-fns/locale";
|
|
4054
|
-
import { toast as
|
|
4055
|
-
import { Fragment as Fragment2, jsx as
|
|
3761
|
+
import { toast as toast8 } from "sonner";
|
|
3762
|
+
import { Fragment as Fragment2, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4056
3763
|
function useColumns2(onEdit, onDelete) {
|
|
4057
3764
|
return [
|
|
4058
3765
|
{
|
|
4059
3766
|
accessorKey: "name",
|
|
4060
3767
|
header: "Nome",
|
|
4061
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
3768
|
+
cell: ({ row }) => /* @__PURE__ */ jsx18("span", { className: "font-medium", children: row.original.name }),
|
|
4062
3769
|
sortingFn: (rowA, rowB) => rowA.original.name.toLowerCase().localeCompare(rowB.original.name.toLowerCase())
|
|
4063
3770
|
},
|
|
4064
3771
|
{
|
|
4065
3772
|
accessorKey: "slug",
|
|
4066
3773
|
header: "Slug",
|
|
4067
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
3774
|
+
cell: ({ row }) => /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground text-sm font-mono", children: row.original.slug || "\u2014" })
|
|
4068
3775
|
},
|
|
4069
3776
|
{
|
|
4070
3777
|
accessorKey: "type",
|
|
4071
3778
|
header: "Tipo",
|
|
4072
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
3779
|
+
cell: ({ row }) => /* @__PURE__ */ jsx18(Badge7, { variant: "secondary", children: row.original.type })
|
|
4073
3780
|
},
|
|
4074
3781
|
{
|
|
4075
3782
|
accessorKey: "description",
|
|
4076
3783
|
header: "Descri\xE7\xE3o",
|
|
4077
3784
|
cell: ({ row }) => {
|
|
4078
3785
|
const desc = row.original.description;
|
|
4079
|
-
if (!desc) return /* @__PURE__ */
|
|
4080
|
-
return /* @__PURE__ */
|
|
3786
|
+
if (!desc) return /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground text-sm", children: "\u2014" });
|
|
3787
|
+
return /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground text-sm", children: desc.length > 50 ? `${desc.slice(0, 50)}\u2026` : desc });
|
|
4081
3788
|
}
|
|
4082
3789
|
},
|
|
4083
3790
|
{
|
|
4084
3791
|
accessorKey: "datetime_add",
|
|
4085
3792
|
header: "Criado em",
|
|
4086
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
3793
|
+
cell: ({ row }) => /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground text-sm", children: format2(new Date(row.original.datetime_add), "dd/MM/yyyy", {
|
|
4087
3794
|
locale: ptBR2
|
|
4088
3795
|
}) })
|
|
4089
3796
|
},
|
|
@@ -4091,42 +3798,42 @@ function useColumns2(onEdit, onDelete) {
|
|
|
4091
3798
|
id: "actions",
|
|
4092
3799
|
size: 80,
|
|
4093
3800
|
enableSorting: false,
|
|
4094
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
4095
|
-
/* @__PURE__ */
|
|
4096
|
-
/* @__PURE__ */
|
|
4097
|
-
|
|
3801
|
+
cell: ({ row }) => /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1", children: [
|
|
3802
|
+
/* @__PURE__ */ jsxs16(Tooltip4, { children: [
|
|
3803
|
+
/* @__PURE__ */ jsx18(TooltipTrigger4, { asChild: true, children: /* @__PURE__ */ jsx18(
|
|
3804
|
+
Button11,
|
|
4098
3805
|
{
|
|
4099
3806
|
variant: "ghost",
|
|
4100
3807
|
size: "icon",
|
|
4101
3808
|
className: "h-8 w-8",
|
|
4102
3809
|
"aria-label": "Editar",
|
|
4103
3810
|
onClick: () => onEdit(row.original),
|
|
4104
|
-
children: /* @__PURE__ */
|
|
3811
|
+
children: /* @__PURE__ */ jsx18(Pencil3, { className: "h-4 w-4" })
|
|
4105
3812
|
}
|
|
4106
3813
|
) }),
|
|
4107
|
-
/* @__PURE__ */
|
|
3814
|
+
/* @__PURE__ */ jsx18(TooltipContent4, { children: "Editar" })
|
|
4108
3815
|
] }),
|
|
4109
|
-
/* @__PURE__ */
|
|
4110
|
-
/* @__PURE__ */
|
|
4111
|
-
|
|
3816
|
+
/* @__PURE__ */ jsxs16(Tooltip4, { children: [
|
|
3817
|
+
/* @__PURE__ */ jsx18(TooltipTrigger4, { asChild: true, children: /* @__PURE__ */ jsx18(
|
|
3818
|
+
Button11,
|
|
4112
3819
|
{
|
|
4113
3820
|
variant: "ghost",
|
|
4114
3821
|
size: "icon",
|
|
4115
3822
|
className: "h-8 w-8 text-destructive hover:text-destructive",
|
|
4116
3823
|
"aria-label": "Excluir",
|
|
4117
3824
|
onClick: () => onDelete(row.original.id),
|
|
4118
|
-
children: /* @__PURE__ */
|
|
3825
|
+
children: /* @__PURE__ */ jsx18(Trash23, { className: "h-4 w-4" })
|
|
4119
3826
|
}
|
|
4120
3827
|
) }),
|
|
4121
|
-
/* @__PURE__ */
|
|
3828
|
+
/* @__PURE__ */ jsx18(TooltipContent4, { children: "Excluir" })
|
|
4122
3829
|
] })
|
|
4123
3830
|
] })
|
|
4124
3831
|
}
|
|
4125
3832
|
];
|
|
4126
3833
|
}
|
|
4127
3834
|
function ToolsTable({ onEdit, config }) {
|
|
4128
|
-
const [search, setSearch] =
|
|
4129
|
-
const [page, setPage] =
|
|
3835
|
+
const [search, setSearch] = useState10("");
|
|
3836
|
+
const [page, setPage] = useState10(1);
|
|
4130
3837
|
const queryParams = useMemo6(() => {
|
|
4131
3838
|
const params = {
|
|
4132
3839
|
limit: "15",
|
|
@@ -4139,9 +3846,10 @@ function ToolsTable({ onEdit, config }) {
|
|
|
4139
3846
|
}, [search, page]);
|
|
4140
3847
|
const { data, isLoading } = useTools(config, queryParams);
|
|
4141
3848
|
const deleteTool = useDeleteTool(config);
|
|
4142
|
-
const [deleteId, setDeleteId] =
|
|
4143
|
-
const
|
|
4144
|
-
const
|
|
3849
|
+
const [deleteId, setDeleteId] = useState10(null);
|
|
3850
|
+
const rawTools = data?.data || [];
|
|
3851
|
+
const tools = rawTools.filter((t) => !t.slug?.startsWith("gclinic_"));
|
|
3852
|
+
const total = tools.length;
|
|
4145
3853
|
const columns = useColumns2(
|
|
4146
3854
|
(tool) => onEdit(tool),
|
|
4147
3855
|
(id) => setDeleteId(id)
|
|
@@ -4150,21 +3858,21 @@ function ToolsTable({ onEdit, config }) {
|
|
|
4150
3858
|
if (!deleteId) return;
|
|
4151
3859
|
deleteTool.mutate(deleteId, {
|
|
4152
3860
|
onSuccess: () => {
|
|
4153
|
-
|
|
3861
|
+
toast8.success("Ferramenta exclu\xEDda");
|
|
4154
3862
|
setDeleteId(null);
|
|
4155
3863
|
},
|
|
4156
|
-
onError: () =>
|
|
3864
|
+
onError: () => toast8.error("Erro ao excluir ferramenta")
|
|
4157
3865
|
});
|
|
4158
3866
|
}
|
|
4159
3867
|
function handleSearchChange(value) {
|
|
4160
3868
|
setSearch(value);
|
|
4161
3869
|
setPage(1);
|
|
4162
3870
|
}
|
|
4163
|
-
return /* @__PURE__ */
|
|
4164
|
-
/* @__PURE__ */
|
|
4165
|
-
/* @__PURE__ */
|
|
4166
|
-
/* @__PURE__ */
|
|
4167
|
-
|
|
3871
|
+
return /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
3872
|
+
/* @__PURE__ */ jsx18("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs16("div", { className: "relative flex-1 max-w-md", children: [
|
|
3873
|
+
/* @__PURE__ */ jsx18(Search2, { "aria-hidden": "true", className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
3874
|
+
/* @__PURE__ */ jsx18(
|
|
3875
|
+
Input7,
|
|
4168
3876
|
{
|
|
4169
3877
|
placeholder: "Buscar ferramentas\\u2026",
|
|
4170
3878
|
"aria-label": "Buscar ferramentas",
|
|
@@ -4176,7 +3884,7 @@ function ToolsTable({ onEdit, config }) {
|
|
|
4176
3884
|
}
|
|
4177
3885
|
)
|
|
4178
3886
|
] }) }),
|
|
4179
|
-
/* @__PURE__ */
|
|
3887
|
+
/* @__PURE__ */ jsx18(
|
|
4180
3888
|
DataTable2,
|
|
4181
3889
|
{
|
|
4182
3890
|
columns,
|
|
@@ -4189,20 +3897,20 @@ function ToolsTable({ onEdit, config }) {
|
|
|
4189
3897
|
pageSize: 15
|
|
4190
3898
|
}
|
|
4191
3899
|
),
|
|
4192
|
-
/* @__PURE__ */
|
|
4193
|
-
|
|
3900
|
+
/* @__PURE__ */ jsx18(
|
|
3901
|
+
AlertDialog3,
|
|
4194
3902
|
{
|
|
4195
3903
|
open: !!deleteId,
|
|
4196
3904
|
onOpenChange: (open) => !open && setDeleteId(null),
|
|
4197
|
-
children: /* @__PURE__ */
|
|
4198
|
-
/* @__PURE__ */
|
|
4199
|
-
/* @__PURE__ */
|
|
4200
|
-
/* @__PURE__ */
|
|
3905
|
+
children: /* @__PURE__ */ jsxs16(AlertDialogContent3, { children: [
|
|
3906
|
+
/* @__PURE__ */ jsxs16(AlertDialogHeader3, { children: [
|
|
3907
|
+
/* @__PURE__ */ jsx18(AlertDialogTitle3, { children: "Excluir ferramenta?" }),
|
|
3908
|
+
/* @__PURE__ */ jsx18(AlertDialogDescription3, { children: "Esta a\xE7\xE3o n\xE3o pode ser desfeita. A ferramenta ser\xE1 removida permanentemente." })
|
|
4201
3909
|
] }),
|
|
4202
|
-
/* @__PURE__ */
|
|
4203
|
-
/* @__PURE__ */
|
|
4204
|
-
/* @__PURE__ */
|
|
4205
|
-
|
|
3910
|
+
/* @__PURE__ */ jsxs16(AlertDialogFooter3, { children: [
|
|
3911
|
+
/* @__PURE__ */ jsx18(AlertDialogCancel3, { variant: "outline", size: "default", children: "Cancelar" }),
|
|
3912
|
+
/* @__PURE__ */ jsx18(
|
|
3913
|
+
AlertDialogAction3,
|
|
4206
3914
|
{
|
|
4207
3915
|
variant: "default",
|
|
4208
3916
|
size: "default",
|
|
@@ -4219,39 +3927,39 @@ function ToolsTable({ onEdit, config }) {
|
|
|
4219
3927
|
}
|
|
4220
3928
|
|
|
4221
3929
|
// src/components/tools/tool-credentials-form.tsx
|
|
4222
|
-
import { useMemo as useMemo7, useState as
|
|
3930
|
+
import { useMemo as useMemo7, useState as useState11 } from "react";
|
|
4223
3931
|
import { DataTable as DataTable3 } from "@greatapps/greatauth-ui";
|
|
4224
3932
|
import {
|
|
4225
|
-
Input as
|
|
4226
|
-
Button as
|
|
4227
|
-
Badge as
|
|
4228
|
-
Tooltip as
|
|
4229
|
-
TooltipTrigger as
|
|
4230
|
-
TooltipContent as
|
|
4231
|
-
Dialog as
|
|
4232
|
-
DialogContent as
|
|
4233
|
-
DialogHeader as
|
|
4234
|
-
DialogTitle as
|
|
4235
|
-
DialogFooter as
|
|
4236
|
-
AlertDialog as
|
|
4237
|
-
AlertDialogAction as
|
|
4238
|
-
AlertDialogCancel as
|
|
4239
|
-
AlertDialogContent as
|
|
4240
|
-
AlertDialogDescription as
|
|
4241
|
-
AlertDialogFooter as
|
|
4242
|
-
AlertDialogHeader as
|
|
4243
|
-
AlertDialogTitle as
|
|
4244
|
-
Select as
|
|
4245
|
-
SelectContent as
|
|
4246
|
-
SelectItem as
|
|
4247
|
-
SelectTrigger as
|
|
4248
|
-
SelectValue as
|
|
3933
|
+
Input as Input8,
|
|
3934
|
+
Button as Button12,
|
|
3935
|
+
Badge as Badge8,
|
|
3936
|
+
Tooltip as Tooltip5,
|
|
3937
|
+
TooltipTrigger as TooltipTrigger5,
|
|
3938
|
+
TooltipContent as TooltipContent5,
|
|
3939
|
+
Dialog as Dialog5,
|
|
3940
|
+
DialogContent as DialogContent5,
|
|
3941
|
+
DialogHeader as DialogHeader5,
|
|
3942
|
+
DialogTitle as DialogTitle5,
|
|
3943
|
+
DialogFooter as DialogFooter5,
|
|
3944
|
+
AlertDialog as AlertDialog4,
|
|
3945
|
+
AlertDialogAction as AlertDialogAction4,
|
|
3946
|
+
AlertDialogCancel as AlertDialogCancel4,
|
|
3947
|
+
AlertDialogContent as AlertDialogContent4,
|
|
3948
|
+
AlertDialogDescription as AlertDialogDescription4,
|
|
3949
|
+
AlertDialogFooter as AlertDialogFooter4,
|
|
3950
|
+
AlertDialogHeader as AlertDialogHeader4,
|
|
3951
|
+
AlertDialogTitle as AlertDialogTitle4,
|
|
3952
|
+
Select as Select2,
|
|
3953
|
+
SelectContent as SelectContent2,
|
|
3954
|
+
SelectItem as SelectItem2,
|
|
3955
|
+
SelectTrigger as SelectTrigger2,
|
|
3956
|
+
SelectValue as SelectValue2
|
|
4249
3957
|
} from "@greatapps/greatauth-ui/ui";
|
|
4250
|
-
import { Trash2 as
|
|
3958
|
+
import { Trash2 as Trash24, Pencil as Pencil4, Link, Search as Search3 } from "lucide-react";
|
|
4251
3959
|
import { format as format3 } from "date-fns";
|
|
4252
3960
|
import { ptBR as ptBR3 } from "date-fns/locale";
|
|
4253
|
-
import { toast as
|
|
4254
|
-
import { jsx as
|
|
3961
|
+
import { toast as toast9 } from "sonner";
|
|
3962
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4255
3963
|
function formatDate2(dateStr) {
|
|
4256
3964
|
if (!dateStr) return "Sem expira\xE7\xE3o";
|
|
4257
3965
|
return format3(new Date(dateStr), "dd/MM/yyyy", { locale: ptBR3 });
|
|
@@ -4271,18 +3979,18 @@ function useColumns3(tools, onEdit, onConnect, onRemove) {
|
|
|
4271
3979
|
{
|
|
4272
3980
|
accessorKey: "label",
|
|
4273
3981
|
header: "Label",
|
|
4274
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
3982
|
+
cell: ({ row }) => /* @__PURE__ */ jsx19("span", { className: "font-medium", children: row.original.label || "\u2014" })
|
|
4275
3983
|
},
|
|
4276
3984
|
{
|
|
4277
3985
|
accessorKey: "id_tool",
|
|
4278
3986
|
header: "Ferramenta",
|
|
4279
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
3987
|
+
cell: ({ row }) => /* @__PURE__ */ jsx19("span", { className: "text-sm", children: getToolName(row.original.id_tool) })
|
|
4280
3988
|
},
|
|
4281
3989
|
{
|
|
4282
3990
|
accessorKey: "status",
|
|
4283
3991
|
header: "Status",
|
|
4284
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
4285
|
-
|
|
3992
|
+
cell: ({ row }) => /* @__PURE__ */ jsx19(
|
|
3993
|
+
Badge8,
|
|
4286
3994
|
{
|
|
4287
3995
|
variant: row.original.status === "active" ? "default" : "destructive",
|
|
4288
3996
|
children: row.original.status === "active" ? "Ativo" : "Expirado"
|
|
@@ -4292,60 +4000,60 @@ function useColumns3(tools, onEdit, onConnect, onRemove) {
|
|
|
4292
4000
|
{
|
|
4293
4001
|
accessorKey: "expires_at",
|
|
4294
4002
|
header: "Expira em",
|
|
4295
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
4003
|
+
cell: ({ row }) => /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground text-sm", children: formatDate2(row.original.expires_at) })
|
|
4296
4004
|
},
|
|
4297
4005
|
{
|
|
4298
4006
|
accessorKey: "datetime_add",
|
|
4299
4007
|
header: "Criado em",
|
|
4300
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
4008
|
+
cell: ({ row }) => /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground text-sm", children: formatDate2(row.original.datetime_add) })
|
|
4301
4009
|
},
|
|
4302
4010
|
{
|
|
4303
4011
|
id: "actions",
|
|
4304
4012
|
header: "A\xE7\xF5es",
|
|
4305
4013
|
size: 100,
|
|
4306
4014
|
enableSorting: false,
|
|
4307
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
4308
|
-
getToolType(row.original.id_tool) === "oauth2" && /* @__PURE__ */
|
|
4309
|
-
/* @__PURE__ */
|
|
4310
|
-
|
|
4015
|
+
cell: ({ row }) => /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-1", children: [
|
|
4016
|
+
getToolType(row.original.id_tool) === "oauth2" && /* @__PURE__ */ jsxs17(Tooltip5, { children: [
|
|
4017
|
+
/* @__PURE__ */ jsx19(TooltipTrigger5, { asChild: true, children: /* @__PURE__ */ jsx19(
|
|
4018
|
+
Button12,
|
|
4311
4019
|
{
|
|
4312
4020
|
variant: "ghost",
|
|
4313
4021
|
size: "icon",
|
|
4314
4022
|
className: "h-8 w-8",
|
|
4315
4023
|
"aria-label": "Vincular",
|
|
4316
4024
|
disabled: true,
|
|
4317
|
-
children: /* @__PURE__ */
|
|
4025
|
+
children: /* @__PURE__ */ jsx19(Link, { className: "h-4 w-4" })
|
|
4318
4026
|
}
|
|
4319
4027
|
) }),
|
|
4320
|
-
/* @__PURE__ */
|
|
4028
|
+
/* @__PURE__ */ jsx19(TooltipContent5, { children: "Em breve" })
|
|
4321
4029
|
] }),
|
|
4322
|
-
/* @__PURE__ */
|
|
4323
|
-
/* @__PURE__ */
|
|
4324
|
-
|
|
4030
|
+
/* @__PURE__ */ jsxs17(Tooltip5, { children: [
|
|
4031
|
+
/* @__PURE__ */ jsx19(TooltipTrigger5, { asChild: true, children: /* @__PURE__ */ jsx19(
|
|
4032
|
+
Button12,
|
|
4325
4033
|
{
|
|
4326
4034
|
variant: "ghost",
|
|
4327
4035
|
size: "icon",
|
|
4328
4036
|
className: "h-8 w-8",
|
|
4329
4037
|
"aria-label": "Editar",
|
|
4330
4038
|
onClick: () => onEdit(row.original),
|
|
4331
|
-
children: /* @__PURE__ */
|
|
4039
|
+
children: /* @__PURE__ */ jsx19(Pencil4, { className: "h-4 w-4" })
|
|
4332
4040
|
}
|
|
4333
4041
|
) }),
|
|
4334
|
-
/* @__PURE__ */
|
|
4042
|
+
/* @__PURE__ */ jsx19(TooltipContent5, { children: "Editar" })
|
|
4335
4043
|
] }),
|
|
4336
|
-
/* @__PURE__ */
|
|
4337
|
-
/* @__PURE__ */
|
|
4338
|
-
|
|
4044
|
+
/* @__PURE__ */ jsxs17(Tooltip5, { children: [
|
|
4045
|
+
/* @__PURE__ */ jsx19(TooltipTrigger5, { asChild: true, children: /* @__PURE__ */ jsx19(
|
|
4046
|
+
Button12,
|
|
4339
4047
|
{
|
|
4340
4048
|
variant: "ghost",
|
|
4341
4049
|
size: "icon",
|
|
4342
4050
|
className: "h-8 w-8 text-destructive hover:text-destructive",
|
|
4343
4051
|
"aria-label": "Excluir",
|
|
4344
4052
|
onClick: () => onRemove(row.original),
|
|
4345
|
-
children: /* @__PURE__ */
|
|
4053
|
+
children: /* @__PURE__ */ jsx19(Trash24, { className: "h-4 w-4" })
|
|
4346
4054
|
}
|
|
4347
4055
|
) }),
|
|
4348
|
-
/* @__PURE__ */
|
|
4056
|
+
/* @__PURE__ */ jsx19(TooltipContent5, { children: "Remover" })
|
|
4349
4057
|
] })
|
|
4350
4058
|
] })
|
|
4351
4059
|
}
|
|
@@ -4363,34 +4071,43 @@ function ToolCredentialsForm({
|
|
|
4363
4071
|
const updateMutation = useUpdateToolCredential(config);
|
|
4364
4072
|
const deleteMutation = useDeleteToolCredential(config);
|
|
4365
4073
|
const { data: toolsData } = useTools(config);
|
|
4366
|
-
const tools = toolsData?.data || [];
|
|
4367
|
-
const [search, setSearch] =
|
|
4368
|
-
const [internalCreateOpen, setInternalCreateOpen] =
|
|
4074
|
+
const tools = (toolsData?.data || []).filter((t) => !t.slug?.startsWith("gclinic_"));
|
|
4075
|
+
const [search, setSearch] = useState11("");
|
|
4076
|
+
const [internalCreateOpen, setInternalCreateOpen] = useState11(false);
|
|
4369
4077
|
const showCreateDialog = externalCreateOpen ?? internalCreateOpen;
|
|
4370
4078
|
const setShowCreateDialog = onCreateOpenChange ?? setInternalCreateOpen;
|
|
4371
|
-
const [createForm, setCreateForm] =
|
|
4079
|
+
const [createForm, setCreateForm] = useState11({
|
|
4372
4080
|
id_tool: "",
|
|
4373
4081
|
label: "",
|
|
4374
4082
|
credentials_encrypted: "",
|
|
4375
4083
|
expires_at: ""
|
|
4376
4084
|
});
|
|
4377
|
-
const [editTarget, setEditTarget] =
|
|
4378
|
-
const [editForm, setEditForm] =
|
|
4085
|
+
const [editTarget, setEditTarget] = useState11(null);
|
|
4086
|
+
const [editForm, setEditForm] = useState11({
|
|
4379
4087
|
id_tool: "",
|
|
4380
4088
|
label: "",
|
|
4381
4089
|
credentials_encrypted: "",
|
|
4382
4090
|
expires_at: "",
|
|
4383
4091
|
status: ""
|
|
4384
4092
|
});
|
|
4385
|
-
const [removeTarget, setRemoveTarget] =
|
|
4093
|
+
const [removeTarget, setRemoveTarget] = useState11(null);
|
|
4094
|
+
const internalToolIds = useMemo7(() => {
|
|
4095
|
+
const allRawTools = toolsData?.data || [];
|
|
4096
|
+
return new Set(
|
|
4097
|
+
allRawTools.filter((t) => t.slug?.startsWith("gclinic_")).map((t) => t.id)
|
|
4098
|
+
);
|
|
4099
|
+
}, [toolsData]);
|
|
4386
4100
|
const filteredCredentials = useMemo7(() => {
|
|
4387
|
-
|
|
4101
|
+
const visible = credentials.filter(
|
|
4102
|
+
(cred) => !cred.id_tool || !internalToolIds.has(cred.id_tool)
|
|
4103
|
+
);
|
|
4104
|
+
if (!search) return visible;
|
|
4388
4105
|
const term = search.toLowerCase();
|
|
4389
|
-
return
|
|
4106
|
+
return visible.filter((cred) => {
|
|
4390
4107
|
const toolName = tools.find((t) => t.id === cred.id_tool)?.name || "";
|
|
4391
4108
|
return (cred.label || "").toLowerCase().includes(term) || toolName.toLowerCase().includes(term);
|
|
4392
4109
|
});
|
|
4393
|
-
}, [credentials, search, tools]);
|
|
4110
|
+
}, [credentials, search, tools, internalToolIds]);
|
|
4394
4111
|
const columns = useColumns3(
|
|
4395
4112
|
tools,
|
|
4396
4113
|
(cred) => startEdit(cred),
|
|
@@ -4408,14 +4125,14 @@ function ToolCredentialsForm({
|
|
|
4408
4125
|
...createForm.expires_at ? { expires_at: createForm.expires_at } : {}
|
|
4409
4126
|
});
|
|
4410
4127
|
if (result.status === 1) {
|
|
4411
|
-
|
|
4128
|
+
toast9.success("Credencial criada");
|
|
4412
4129
|
setShowCreateDialog(false);
|
|
4413
4130
|
setCreateForm({ id_tool: "", label: "", credentials_encrypted: "", expires_at: "" });
|
|
4414
4131
|
} else {
|
|
4415
|
-
|
|
4132
|
+
toast9.error(result.message || "Erro ao criar credencial");
|
|
4416
4133
|
}
|
|
4417
4134
|
} catch {
|
|
4418
|
-
|
|
4135
|
+
toast9.error("Erro ao criar credencial");
|
|
4419
4136
|
}
|
|
4420
4137
|
}
|
|
4421
4138
|
function startEdit(cred) {
|
|
@@ -4457,13 +4174,13 @@ function ToolCredentialsForm({
|
|
|
4457
4174
|
body
|
|
4458
4175
|
});
|
|
4459
4176
|
if (result.status === 1) {
|
|
4460
|
-
|
|
4177
|
+
toast9.success("Credencial atualizada");
|
|
4461
4178
|
setEditTarget(null);
|
|
4462
4179
|
} else {
|
|
4463
|
-
|
|
4180
|
+
toast9.error(result.message || "Erro ao atualizar credencial");
|
|
4464
4181
|
}
|
|
4465
4182
|
} catch {
|
|
4466
|
-
|
|
4183
|
+
toast9.error("Erro ao atualizar credencial");
|
|
4467
4184
|
}
|
|
4468
4185
|
}
|
|
4469
4186
|
async function handleRemove() {
|
|
@@ -4471,12 +4188,12 @@ function ToolCredentialsForm({
|
|
|
4471
4188
|
try {
|
|
4472
4189
|
const result = await deleteMutation.mutateAsync(removeTarget.id);
|
|
4473
4190
|
if (result.status === 1) {
|
|
4474
|
-
|
|
4191
|
+
toast9.success("Credencial removida");
|
|
4475
4192
|
} else {
|
|
4476
|
-
|
|
4193
|
+
toast9.error(result.message || "Erro ao remover credencial");
|
|
4477
4194
|
}
|
|
4478
4195
|
} catch {
|
|
4479
|
-
|
|
4196
|
+
toast9.error("Erro ao remover credencial");
|
|
4480
4197
|
} finally {
|
|
4481
4198
|
setRemoveTarget(null);
|
|
4482
4199
|
}
|
|
@@ -4488,11 +4205,11 @@ function ToolCredentialsForm({
|
|
|
4488
4205
|
const url = `${gagentsApiUrl}/v1/${language}/${idWl}/accounts/${config.accountId}/oauth/connect?id_tool=${cred.id_tool}`;
|
|
4489
4206
|
window.open(url, "_blank");
|
|
4490
4207
|
}
|
|
4491
|
-
return /* @__PURE__ */
|
|
4492
|
-
/* @__PURE__ */
|
|
4493
|
-
/* @__PURE__ */
|
|
4494
|
-
/* @__PURE__ */
|
|
4495
|
-
|
|
4208
|
+
return /* @__PURE__ */ jsxs17("div", { className: "space-y-4", children: [
|
|
4209
|
+
/* @__PURE__ */ jsx19("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs17("div", { className: "relative flex-1 max-w-md", children: [
|
|
4210
|
+
/* @__PURE__ */ jsx19(Search3, { "aria-hidden": "true", className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
4211
|
+
/* @__PURE__ */ jsx19(
|
|
4212
|
+
Input8,
|
|
4496
4213
|
{
|
|
4497
4214
|
placeholder: "Buscar credenciais\\u2026",
|
|
4498
4215
|
"aria-label": "Buscar credenciais",
|
|
@@ -4504,7 +4221,7 @@ function ToolCredentialsForm({
|
|
|
4504
4221
|
}
|
|
4505
4222
|
)
|
|
4506
4223
|
] }) }),
|
|
4507
|
-
/* @__PURE__ */
|
|
4224
|
+
/* @__PURE__ */ jsx19(
|
|
4508
4225
|
DataTable3,
|
|
4509
4226
|
{
|
|
4510
4227
|
columns,
|
|
@@ -4513,27 +4230,27 @@ function ToolCredentialsForm({
|
|
|
4513
4230
|
emptyMessage: "Nenhuma credencial encontrada"
|
|
4514
4231
|
}
|
|
4515
4232
|
),
|
|
4516
|
-
/* @__PURE__ */
|
|
4517
|
-
/* @__PURE__ */
|
|
4518
|
-
/* @__PURE__ */
|
|
4519
|
-
/* @__PURE__ */
|
|
4520
|
-
/* @__PURE__ */
|
|
4521
|
-
/* @__PURE__ */
|
|
4522
|
-
|
|
4233
|
+
/* @__PURE__ */ jsx19(Dialog5, { open: showCreateDialog, onOpenChange: setShowCreateDialog, children: /* @__PURE__ */ jsxs17(DialogContent5, { children: [
|
|
4234
|
+
/* @__PURE__ */ jsx19(DialogHeader5, { children: /* @__PURE__ */ jsx19(DialogTitle5, { children: "Nova Credencial" }) }),
|
|
4235
|
+
/* @__PURE__ */ jsxs17("div", { className: "space-y-4", children: [
|
|
4236
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
4237
|
+
/* @__PURE__ */ jsx19("label", { htmlFor: "cred-tool", className: "mb-1 block text-sm font-medium", children: "Ferramenta *" }),
|
|
4238
|
+
/* @__PURE__ */ jsxs17(
|
|
4239
|
+
Select2,
|
|
4523
4240
|
{
|
|
4524
4241
|
value: createForm.id_tool,
|
|
4525
4242
|
onValueChange: (val) => setCreateForm((f) => ({ ...f, id_tool: val })),
|
|
4526
4243
|
children: [
|
|
4527
|
-
/* @__PURE__ */
|
|
4528
|
-
/* @__PURE__ */
|
|
4244
|
+
/* @__PURE__ */ jsx19(SelectTrigger2, { id: "cred-tool", children: /* @__PURE__ */ jsx19(SelectValue2, { placeholder: "Selecione a ferramenta" }) }),
|
|
4245
|
+
/* @__PURE__ */ jsx19(SelectContent2, { children: tools.map((tool) => /* @__PURE__ */ jsx19(SelectItem2, { value: String(tool.id), children: tool.name }, tool.id)) })
|
|
4529
4246
|
]
|
|
4530
4247
|
}
|
|
4531
4248
|
)
|
|
4532
4249
|
] }),
|
|
4533
|
-
/* @__PURE__ */
|
|
4534
|
-
/* @__PURE__ */
|
|
4535
|
-
/* @__PURE__ */
|
|
4536
|
-
|
|
4250
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
4251
|
+
/* @__PURE__ */ jsx19("label", { htmlFor: "cred-label", className: "mb-1 block text-sm font-medium", children: "Label *" }),
|
|
4252
|
+
/* @__PURE__ */ jsx19(
|
|
4253
|
+
Input8,
|
|
4537
4254
|
{
|
|
4538
4255
|
id: "cred-label",
|
|
4539
4256
|
name: "label",
|
|
@@ -4543,10 +4260,10 @@ function ToolCredentialsForm({
|
|
|
4543
4260
|
}
|
|
4544
4261
|
)
|
|
4545
4262
|
] }),
|
|
4546
|
-
/* @__PURE__ */
|
|
4547
|
-
/* @__PURE__ */
|
|
4548
|
-
/* @__PURE__ */
|
|
4549
|
-
|
|
4263
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
4264
|
+
/* @__PURE__ */ jsx19("label", { htmlFor: "cred-credential", className: "mb-1 block text-sm font-medium", children: "Credencial *" }),
|
|
4265
|
+
/* @__PURE__ */ jsx19(
|
|
4266
|
+
Input8,
|
|
4550
4267
|
{
|
|
4551
4268
|
id: "cred-credential",
|
|
4552
4269
|
name: "credential",
|
|
@@ -4561,10 +4278,10 @@ function ToolCredentialsForm({
|
|
|
4561
4278
|
}
|
|
4562
4279
|
)
|
|
4563
4280
|
] }),
|
|
4564
|
-
/* @__PURE__ */
|
|
4565
|
-
/* @__PURE__ */
|
|
4566
|
-
/* @__PURE__ */
|
|
4567
|
-
|
|
4281
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
4282
|
+
/* @__PURE__ */ jsx19("label", { htmlFor: "cred-expires", className: "mb-1 block text-sm font-medium", children: "Data de Expira\xE7\xE3o (opcional)" }),
|
|
4283
|
+
/* @__PURE__ */ jsx19(
|
|
4284
|
+
Input8,
|
|
4568
4285
|
{
|
|
4569
4286
|
id: "cred-expires",
|
|
4570
4287
|
name: "expires",
|
|
@@ -4575,17 +4292,17 @@ function ToolCredentialsForm({
|
|
|
4575
4292
|
)
|
|
4576
4293
|
] })
|
|
4577
4294
|
] }),
|
|
4578
|
-
/* @__PURE__ */
|
|
4579
|
-
/* @__PURE__ */
|
|
4580
|
-
|
|
4295
|
+
/* @__PURE__ */ jsxs17(DialogFooter5, { children: [
|
|
4296
|
+
/* @__PURE__ */ jsx19(
|
|
4297
|
+
Button12,
|
|
4581
4298
|
{
|
|
4582
4299
|
variant: "outline",
|
|
4583
4300
|
onClick: () => setShowCreateDialog(false),
|
|
4584
4301
|
children: "Cancelar"
|
|
4585
4302
|
}
|
|
4586
4303
|
),
|
|
4587
|
-
/* @__PURE__ */
|
|
4588
|
-
|
|
4304
|
+
/* @__PURE__ */ jsx19(
|
|
4305
|
+
Button12,
|
|
4589
4306
|
{
|
|
4590
4307
|
onClick: handleCreate,
|
|
4591
4308
|
disabled: !createForm.id_tool || !createForm.label.trim() || !createForm.credentials_encrypted.trim() || createMutation.isPending,
|
|
@@ -4594,32 +4311,32 @@ function ToolCredentialsForm({
|
|
|
4594
4311
|
)
|
|
4595
4312
|
] })
|
|
4596
4313
|
] }) }),
|
|
4597
|
-
/* @__PURE__ */
|
|
4598
|
-
|
|
4314
|
+
/* @__PURE__ */ jsx19(
|
|
4315
|
+
Dialog5,
|
|
4599
4316
|
{
|
|
4600
4317
|
open: !!editTarget,
|
|
4601
4318
|
onOpenChange: (open) => !open && setEditTarget(null),
|
|
4602
|
-
children: /* @__PURE__ */
|
|
4603
|
-
/* @__PURE__ */
|
|
4604
|
-
/* @__PURE__ */
|
|
4605
|
-
/* @__PURE__ */
|
|
4606
|
-
/* @__PURE__ */
|
|
4607
|
-
/* @__PURE__ */
|
|
4608
|
-
|
|
4319
|
+
children: /* @__PURE__ */ jsxs17(DialogContent5, { children: [
|
|
4320
|
+
/* @__PURE__ */ jsx19(DialogHeader5, { children: /* @__PURE__ */ jsx19(DialogTitle5, { children: "Editar Credencial" }) }),
|
|
4321
|
+
/* @__PURE__ */ jsxs17("div", { className: "space-y-4", children: [
|
|
4322
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
4323
|
+
/* @__PURE__ */ jsx19("label", { htmlFor: "edit-cred-tool", className: "mb-1 block text-sm font-medium", children: "Ferramenta *" }),
|
|
4324
|
+
/* @__PURE__ */ jsxs17(
|
|
4325
|
+
Select2,
|
|
4609
4326
|
{
|
|
4610
4327
|
value: editForm.id_tool,
|
|
4611
4328
|
onValueChange: (val) => setEditForm((f) => ({ ...f, id_tool: val })),
|
|
4612
4329
|
children: [
|
|
4613
|
-
/* @__PURE__ */
|
|
4614
|
-
/* @__PURE__ */
|
|
4330
|
+
/* @__PURE__ */ jsx19(SelectTrigger2, { id: "edit-cred-tool", children: /* @__PURE__ */ jsx19(SelectValue2, { placeholder: "Selecione a ferramenta" }) }),
|
|
4331
|
+
/* @__PURE__ */ jsx19(SelectContent2, { children: tools.map((tool) => /* @__PURE__ */ jsx19(SelectItem2, { value: String(tool.id), children: tool.name }, tool.id)) })
|
|
4615
4332
|
]
|
|
4616
4333
|
}
|
|
4617
4334
|
)
|
|
4618
4335
|
] }),
|
|
4619
|
-
/* @__PURE__ */
|
|
4620
|
-
/* @__PURE__ */
|
|
4621
|
-
/* @__PURE__ */
|
|
4622
|
-
|
|
4336
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
4337
|
+
/* @__PURE__ */ jsx19("label", { htmlFor: "edit-cred-label", className: "mb-1 block text-sm font-medium", children: "Label" }),
|
|
4338
|
+
/* @__PURE__ */ jsx19(
|
|
4339
|
+
Input8,
|
|
4623
4340
|
{
|
|
4624
4341
|
id: "edit-cred-label",
|
|
4625
4342
|
name: "label",
|
|
@@ -4629,10 +4346,10 @@ function ToolCredentialsForm({
|
|
|
4629
4346
|
}
|
|
4630
4347
|
)
|
|
4631
4348
|
] }),
|
|
4632
|
-
/* @__PURE__ */
|
|
4633
|
-
/* @__PURE__ */
|
|
4634
|
-
/* @__PURE__ */
|
|
4635
|
-
|
|
4349
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
4350
|
+
/* @__PURE__ */ jsx19("label", { htmlFor: "edit-cred-credential", className: "mb-1 block text-sm font-medium", children: "Nova Credencial (vazio = manter atual)" }),
|
|
4351
|
+
/* @__PURE__ */ jsx19(
|
|
4352
|
+
Input8,
|
|
4636
4353
|
{
|
|
4637
4354
|
id: "edit-cred-credential",
|
|
4638
4355
|
name: "credential",
|
|
@@ -4647,10 +4364,10 @@ function ToolCredentialsForm({
|
|
|
4647
4364
|
}
|
|
4648
4365
|
)
|
|
4649
4366
|
] }),
|
|
4650
|
-
/* @__PURE__ */
|
|
4651
|
-
/* @__PURE__ */
|
|
4652
|
-
/* @__PURE__ */
|
|
4653
|
-
|
|
4367
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
4368
|
+
/* @__PURE__ */ jsx19("label", { htmlFor: "edit-cred-expires", className: "mb-1 block text-sm font-medium", children: "Data de Expira\xE7\xE3o" }),
|
|
4369
|
+
/* @__PURE__ */ jsx19(
|
|
4370
|
+
Input8,
|
|
4654
4371
|
{
|
|
4655
4372
|
id: "edit-cred-expires",
|
|
4656
4373
|
name: "expires",
|
|
@@ -4660,10 +4377,10 @@ function ToolCredentialsForm({
|
|
|
4660
4377
|
}
|
|
4661
4378
|
)
|
|
4662
4379
|
] }),
|
|
4663
|
-
/* @__PURE__ */
|
|
4664
|
-
/* @__PURE__ */
|
|
4665
|
-
/* @__PURE__ */
|
|
4666
|
-
|
|
4380
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
4381
|
+
/* @__PURE__ */ jsx19("label", { htmlFor: "edit-cred-status", className: "mb-1 block text-sm font-medium", children: "Status" }),
|
|
4382
|
+
/* @__PURE__ */ jsxs17(
|
|
4383
|
+
Select2,
|
|
4667
4384
|
{
|
|
4668
4385
|
value: editForm.status || void 0,
|
|
4669
4386
|
onValueChange: (val) => setEditForm((f) => ({
|
|
@@ -4671,20 +4388,20 @@ function ToolCredentialsForm({
|
|
|
4671
4388
|
status: val
|
|
4672
4389
|
})),
|
|
4673
4390
|
children: [
|
|
4674
|
-
/* @__PURE__ */
|
|
4675
|
-
/* @__PURE__ */
|
|
4676
|
-
/* @__PURE__ */
|
|
4677
|
-
/* @__PURE__ */
|
|
4391
|
+
/* @__PURE__ */ jsx19(SelectTrigger2, { id: "edit-cred-status", children: /* @__PURE__ */ jsx19(SelectValue2, {}) }),
|
|
4392
|
+
/* @__PURE__ */ jsxs17(SelectContent2, { children: [
|
|
4393
|
+
/* @__PURE__ */ jsx19(SelectItem2, { value: "active", children: "Ativo" }),
|
|
4394
|
+
/* @__PURE__ */ jsx19(SelectItem2, { value: "expired", children: "Expirado" })
|
|
4678
4395
|
] })
|
|
4679
4396
|
]
|
|
4680
4397
|
}
|
|
4681
4398
|
)
|
|
4682
4399
|
] })
|
|
4683
4400
|
] }),
|
|
4684
|
-
/* @__PURE__ */
|
|
4685
|
-
/* @__PURE__ */
|
|
4686
|
-
/* @__PURE__ */
|
|
4687
|
-
|
|
4401
|
+
/* @__PURE__ */ jsxs17(DialogFooter5, { children: [
|
|
4402
|
+
/* @__PURE__ */ jsx19(Button12, { variant: "outline", onClick: () => setEditTarget(null), children: "Cancelar" }),
|
|
4403
|
+
/* @__PURE__ */ jsx19(
|
|
4404
|
+
Button12,
|
|
4688
4405
|
{
|
|
4689
4406
|
onClick: handleSaveEdit,
|
|
4690
4407
|
disabled: updateMutation.isPending,
|
|
@@ -4695,20 +4412,20 @@ function ToolCredentialsForm({
|
|
|
4695
4412
|
] })
|
|
4696
4413
|
}
|
|
4697
4414
|
),
|
|
4698
|
-
/* @__PURE__ */
|
|
4699
|
-
|
|
4415
|
+
/* @__PURE__ */ jsx19(
|
|
4416
|
+
AlertDialog4,
|
|
4700
4417
|
{
|
|
4701
4418
|
open: !!removeTarget,
|
|
4702
4419
|
onOpenChange: (open) => !open && setRemoveTarget(null),
|
|
4703
|
-
children: /* @__PURE__ */
|
|
4704
|
-
/* @__PURE__ */
|
|
4705
|
-
/* @__PURE__ */
|
|
4706
|
-
/* @__PURE__ */
|
|
4420
|
+
children: /* @__PURE__ */ jsxs17(AlertDialogContent4, { children: [
|
|
4421
|
+
/* @__PURE__ */ jsxs17(AlertDialogHeader4, { children: [
|
|
4422
|
+
/* @__PURE__ */ jsx19(AlertDialogTitle4, { children: "Remover credencial?" }),
|
|
4423
|
+
/* @__PURE__ */ jsx19(AlertDialogDescription4, { children: "A credencial ser\xE1 removida permanentemente." })
|
|
4707
4424
|
] }),
|
|
4708
|
-
/* @__PURE__ */
|
|
4709
|
-
/* @__PURE__ */
|
|
4710
|
-
/* @__PURE__ */
|
|
4711
|
-
|
|
4425
|
+
/* @__PURE__ */ jsxs17(AlertDialogFooter4, { children: [
|
|
4426
|
+
/* @__PURE__ */ jsx19(AlertDialogCancel4, { children: "Cancelar" }),
|
|
4427
|
+
/* @__PURE__ */ jsx19(
|
|
4428
|
+
AlertDialogAction4,
|
|
4712
4429
|
{
|
|
4713
4430
|
onClick: handleRemove,
|
|
4714
4431
|
disabled: deleteMutation.isPending,
|
|
@@ -4723,26 +4440,26 @@ function ToolCredentialsForm({
|
|
|
4723
4440
|
}
|
|
4724
4441
|
|
|
4725
4442
|
// src/components/tools/tool-form-dialog.tsx
|
|
4726
|
-
import { useState as
|
|
4443
|
+
import { useState as useState12 } from "react";
|
|
4727
4444
|
import {
|
|
4728
|
-
Dialog as
|
|
4729
|
-
DialogContent as
|
|
4730
|
-
DialogHeader as
|
|
4731
|
-
DialogTitle as
|
|
4732
|
-
DialogFooter as
|
|
4733
|
-
Button as
|
|
4734
|
-
Input as
|
|
4735
|
-
Textarea as
|
|
4736
|
-
Label as
|
|
4737
|
-
Select as
|
|
4738
|
-
SelectContent as
|
|
4739
|
-
SelectItem as
|
|
4740
|
-
SelectTrigger as
|
|
4741
|
-
SelectValue as
|
|
4445
|
+
Dialog as Dialog6,
|
|
4446
|
+
DialogContent as DialogContent6,
|
|
4447
|
+
DialogHeader as DialogHeader6,
|
|
4448
|
+
DialogTitle as DialogTitle6,
|
|
4449
|
+
DialogFooter as DialogFooter6,
|
|
4450
|
+
Button as Button13,
|
|
4451
|
+
Input as Input9,
|
|
4452
|
+
Textarea as Textarea2,
|
|
4453
|
+
Label as Label7,
|
|
4454
|
+
Select as Select3,
|
|
4455
|
+
SelectContent as SelectContent3,
|
|
4456
|
+
SelectItem as SelectItem3,
|
|
4457
|
+
SelectTrigger as SelectTrigger3,
|
|
4458
|
+
SelectValue as SelectValue3
|
|
4742
4459
|
} from "@greatapps/greatauth-ui/ui";
|
|
4743
4460
|
import { Loader2 as Loader28 } from "lucide-react";
|
|
4744
|
-
import { toast as
|
|
4745
|
-
import { jsx as
|
|
4461
|
+
import { toast as toast10 } from "sonner";
|
|
4462
|
+
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4746
4463
|
var TOOL_AUTH_TYPES = [
|
|
4747
4464
|
{ value: "none", label: "Nenhuma" },
|
|
4748
4465
|
{ value: "api_key", label: "API Key" },
|
|
@@ -4789,9 +4506,9 @@ function ToolFormDialog({
|
|
|
4789
4506
|
const isEditing = !!tool;
|
|
4790
4507
|
const createTool = useCreateTool(config);
|
|
4791
4508
|
const updateTool = useUpdateTool(config);
|
|
4792
|
-
const [form, setForm] =
|
|
4793
|
-
const [slugManuallyEdited, setSlugManuallyEdited] =
|
|
4794
|
-
const [lastResetKey, setLastResetKey] =
|
|
4509
|
+
const [form, setForm] = useState12(() => toolToFormState(tool));
|
|
4510
|
+
const [slugManuallyEdited, setSlugManuallyEdited] = useState12(false);
|
|
4511
|
+
const [lastResetKey, setLastResetKey] = useState12(
|
|
4795
4512
|
() => `${tool?.id}-${open}`
|
|
4796
4513
|
);
|
|
4797
4514
|
const resetKey = `${tool?.id}-${open}`;
|
|
@@ -4838,27 +4555,27 @@ function ToolFormDialog({
|
|
|
4838
4555
|
try {
|
|
4839
4556
|
if (isEditing) {
|
|
4840
4557
|
await updateTool.mutateAsync({ id: tool.id, body });
|
|
4841
|
-
|
|
4558
|
+
toast10.success("Ferramenta atualizada");
|
|
4842
4559
|
} else {
|
|
4843
4560
|
await createTool.mutateAsync(
|
|
4844
4561
|
body
|
|
4845
4562
|
);
|
|
4846
|
-
|
|
4563
|
+
toast10.success("Ferramenta criada");
|
|
4847
4564
|
}
|
|
4848
4565
|
onOpenChange(false);
|
|
4849
4566
|
} catch (err) {
|
|
4850
|
-
|
|
4567
|
+
toast10.error(
|
|
4851
4568
|
err instanceof Error ? err.message : isEditing ? "Erro ao atualizar ferramenta" : "Erro ao criar ferramenta"
|
|
4852
4569
|
);
|
|
4853
4570
|
}
|
|
4854
4571
|
}
|
|
4855
|
-
return /* @__PURE__ */
|
|
4856
|
-
/* @__PURE__ */
|
|
4857
|
-
/* @__PURE__ */
|
|
4858
|
-
/* @__PURE__ */
|
|
4859
|
-
/* @__PURE__ */
|
|
4860
|
-
/* @__PURE__ */
|
|
4861
|
-
|
|
4572
|
+
return /* @__PURE__ */ jsx20(Dialog6, { open, onOpenChange, children: /* @__PURE__ */ jsxs18(DialogContent6, { className: "sm:max-w-lg", children: [
|
|
4573
|
+
/* @__PURE__ */ jsx20(DialogHeader6, { children: /* @__PURE__ */ jsx20(DialogTitle6, { children: isEditing ? "Editar Ferramenta" : "Nova Ferramenta" }) }),
|
|
4574
|
+
/* @__PURE__ */ jsxs18("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
|
|
4575
|
+
/* @__PURE__ */ jsxs18("div", { className: "space-y-2", children: [
|
|
4576
|
+
/* @__PURE__ */ jsx20(Label7, { htmlFor: "tool-name", children: "Nome *" }),
|
|
4577
|
+
/* @__PURE__ */ jsx20(
|
|
4578
|
+
Input9,
|
|
4862
4579
|
{
|
|
4863
4580
|
id: "tool-name",
|
|
4864
4581
|
name: "name",
|
|
@@ -4876,12 +4593,12 @@ function ToolFormDialog({
|
|
|
4876
4593
|
disabled: isPending
|
|
4877
4594
|
}
|
|
4878
4595
|
),
|
|
4879
|
-
form.nameError && /* @__PURE__ */
|
|
4596
|
+
form.nameError && /* @__PURE__ */ jsx20("p", { className: "text-sm text-destructive", children: "Nome \xE9 obrigat\xF3rio" })
|
|
4880
4597
|
] }),
|
|
4881
|
-
/* @__PURE__ */
|
|
4882
|
-
/* @__PURE__ */
|
|
4883
|
-
/* @__PURE__ */
|
|
4884
|
-
|
|
4598
|
+
/* @__PURE__ */ jsxs18("div", { className: "space-y-2", children: [
|
|
4599
|
+
/* @__PURE__ */ jsx20(Label7, { htmlFor: "tool-slug", children: "Slug (identificador \xFAnico) *" }),
|
|
4600
|
+
/* @__PURE__ */ jsx20(
|
|
4601
|
+
Input9,
|
|
4885
4602
|
{
|
|
4886
4603
|
id: "tool-slug",
|
|
4887
4604
|
name: "slug",
|
|
@@ -4898,13 +4615,13 @@ function ToolFormDialog({
|
|
|
4898
4615
|
disabled: isPending
|
|
4899
4616
|
}
|
|
4900
4617
|
),
|
|
4901
|
-
/* @__PURE__ */
|
|
4902
|
-
form.slugError && /* @__PURE__ */
|
|
4618
|
+
/* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground", children: "Gerado automaticamente a partir do nome. Usado internamente para identificar a ferramenta." }),
|
|
4619
|
+
form.slugError && /* @__PURE__ */ jsx20("p", { className: "text-sm text-destructive", children: "Slug \xE9 obrigat\xF3rio" })
|
|
4903
4620
|
] }),
|
|
4904
|
-
/* @__PURE__ */
|
|
4905
|
-
/* @__PURE__ */
|
|
4906
|
-
/* @__PURE__ */
|
|
4907
|
-
|
|
4621
|
+
/* @__PURE__ */ jsxs18("div", { className: "space-y-2", children: [
|
|
4622
|
+
/* @__PURE__ */ jsx20(Label7, { htmlFor: "tool-type", children: "Tipo de Autentica\xE7\xE3o *" }),
|
|
4623
|
+
/* @__PURE__ */ jsxs18(
|
|
4624
|
+
Select3,
|
|
4908
4625
|
{
|
|
4909
4626
|
value: form.type,
|
|
4910
4627
|
onValueChange: (value) => {
|
|
@@ -4916,18 +4633,18 @@ function ToolFormDialog({
|
|
|
4916
4633
|
},
|
|
4917
4634
|
disabled: isPending,
|
|
4918
4635
|
children: [
|
|
4919
|
-
/* @__PURE__ */
|
|
4920
|
-
/* @__PURE__ */
|
|
4636
|
+
/* @__PURE__ */ jsx20(SelectTrigger3, { id: "tool-type", children: /* @__PURE__ */ jsx20(SelectValue3, { placeholder: "Selecione o tipo" }) }),
|
|
4637
|
+
/* @__PURE__ */ jsx20(SelectContent3, { children: TOOL_AUTH_TYPES.map((t) => /* @__PURE__ */ jsx20(SelectItem3, { value: t.value, children: t.label }, t.value)) })
|
|
4921
4638
|
]
|
|
4922
4639
|
}
|
|
4923
4640
|
),
|
|
4924
|
-
/* @__PURE__ */
|
|
4925
|
-
form.typeError && /* @__PURE__ */
|
|
4641
|
+
/* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground", children: "Define se a ferramenta requer credenciais para funcionar." }),
|
|
4642
|
+
form.typeError && /* @__PURE__ */ jsx20("p", { className: "text-sm text-destructive", children: "Tipo \xE9 obrigat\xF3rio" })
|
|
4926
4643
|
] }),
|
|
4927
|
-
/* @__PURE__ */
|
|
4928
|
-
/* @__PURE__ */
|
|
4929
|
-
/* @__PURE__ */
|
|
4930
|
-
|
|
4644
|
+
/* @__PURE__ */ jsxs18("div", { className: "space-y-2", children: [
|
|
4645
|
+
/* @__PURE__ */ jsx20(Label7, { htmlFor: "tool-description", children: "Descri\xE7\xE3o" }),
|
|
4646
|
+
/* @__PURE__ */ jsx20(
|
|
4647
|
+
Textarea2,
|
|
4931
4648
|
{
|
|
4932
4649
|
id: "tool-description",
|
|
4933
4650
|
name: "description",
|
|
@@ -4939,10 +4656,10 @@ function ToolFormDialog({
|
|
|
4939
4656
|
}
|
|
4940
4657
|
)
|
|
4941
4658
|
] }),
|
|
4942
|
-
/* @__PURE__ */
|
|
4943
|
-
/* @__PURE__ */
|
|
4944
|
-
/* @__PURE__ */
|
|
4945
|
-
|
|
4659
|
+
/* @__PURE__ */ jsxs18("div", { className: "space-y-2", children: [
|
|
4660
|
+
/* @__PURE__ */ jsx20(Label7, { htmlFor: "tool-function-defs", children: "Defini\xE7\xF5es de Fun\xE7\xE3o (JSON)" }),
|
|
4661
|
+
/* @__PURE__ */ jsx20(
|
|
4662
|
+
Textarea2,
|
|
4946
4663
|
{
|
|
4947
4664
|
id: "tool-function-defs",
|
|
4948
4665
|
name: "functionDefs",
|
|
@@ -4973,12 +4690,12 @@ function ToolFormDialog({
|
|
|
4973
4690
|
disabled: isPending
|
|
4974
4691
|
}
|
|
4975
4692
|
),
|
|
4976
|
-
/* @__PURE__ */
|
|
4977
|
-
form.jsonError && /* @__PURE__ */
|
|
4693
|
+
/* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground", children: "Array de defini\xE7\xF5es no formato OpenAI Function Calling." }),
|
|
4694
|
+
form.jsonError && /* @__PURE__ */ jsx20("p", { className: "text-sm text-destructive", children: "JSON inv\xE1lido" })
|
|
4978
4695
|
] }),
|
|
4979
|
-
/* @__PURE__ */
|
|
4980
|
-
/* @__PURE__ */
|
|
4981
|
-
|
|
4696
|
+
/* @__PURE__ */ jsxs18(DialogFooter6, { children: [
|
|
4697
|
+
/* @__PURE__ */ jsx20(
|
|
4698
|
+
Button13,
|
|
4982
4699
|
{
|
|
4983
4700
|
type: "button",
|
|
4984
4701
|
variant: "outline",
|
|
@@ -4987,8 +4704,8 @@ function ToolFormDialog({
|
|
|
4987
4704
|
children: "Cancelar"
|
|
4988
4705
|
}
|
|
4989
4706
|
),
|
|
4990
|
-
/* @__PURE__ */
|
|
4991
|
-
isPending ? /* @__PURE__ */
|
|
4707
|
+
/* @__PURE__ */ jsxs18(Button13, { type: "submit", disabled: isPending, children: [
|
|
4708
|
+
isPending ? /* @__PURE__ */ jsx20(Loader28, { "aria-hidden": "true", className: "mr-2 h-4 w-4 animate-spin" }) : null,
|
|
4992
4709
|
isEditing ? "Salvar" : "Criar"
|
|
4993
4710
|
] })
|
|
4994
4711
|
] })
|
|
@@ -4997,13 +4714,13 @@ function ToolFormDialog({
|
|
|
4997
4714
|
}
|
|
4998
4715
|
|
|
4999
4716
|
// src/components/capabilities/advanced-tab.tsx
|
|
5000
|
-
import { Info as
|
|
5001
|
-
import { jsx as
|
|
4717
|
+
import { Info as Info3 } from "lucide-react";
|
|
4718
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
5002
4719
|
function AdvancedTab({ config, agentId, gagentsApiUrl }) {
|
|
5003
4720
|
const { data: credentialsData, isLoading: isLoadingCredentials } = useToolCredentials(config);
|
|
5004
4721
|
const credentials = credentialsData?.data ?? [];
|
|
5005
|
-
const [editingTool, setEditingTool] =
|
|
5006
|
-
const [showToolForm, setShowToolForm] =
|
|
4722
|
+
const [editingTool, setEditingTool] = useState13(null);
|
|
4723
|
+
const [showToolForm, setShowToolForm] = useState13(false);
|
|
5007
4724
|
function handleEditTool(tool) {
|
|
5008
4725
|
setEditingTool(tool);
|
|
5009
4726
|
setShowToolForm(true);
|
|
@@ -5012,24 +4729,24 @@ function AdvancedTab({ config, agentId, gagentsApiUrl }) {
|
|
|
5012
4729
|
setShowToolForm(open);
|
|
5013
4730
|
if (!open) setEditingTool(null);
|
|
5014
4731
|
}
|
|
5015
|
-
return /* @__PURE__ */
|
|
5016
|
-
/* @__PURE__ */
|
|
5017
|
-
/* @__PURE__ */
|
|
5018
|
-
/* @__PURE__ */
|
|
4732
|
+
return /* @__PURE__ */ jsxs19("div", { className: "space-y-8", children: [
|
|
4733
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-start gap-3 rounded-lg border border-blue-200 bg-blue-50 p-4 dark:border-blue-900 dark:bg-blue-950/30", children: [
|
|
4734
|
+
/* @__PURE__ */ jsx21(Info3, { className: "mt-0.5 h-4 w-4 shrink-0 text-blue-600 dark:text-blue-400" }),
|
|
4735
|
+
/* @__PURE__ */ jsxs19("p", { className: "text-sm text-blue-800 dark:text-blue-300", children: [
|
|
5019
4736
|
"Use as abas ",
|
|
5020
|
-
/* @__PURE__ */
|
|
4737
|
+
/* @__PURE__ */ jsx21("strong", { children: "Capacidades" }),
|
|
5021
4738
|
" e ",
|
|
5022
|
-
/* @__PURE__ */
|
|
4739
|
+
/* @__PURE__ */ jsx21("strong", { children: "Integra\xE7\xF5es" }),
|
|
5023
4740
|
" para configura\xE7\xE3o simplificada. Esta aba oferece controlo manual avan\xE7ado sobre ferramentas e credenciais."
|
|
5024
4741
|
] })
|
|
5025
4742
|
] }),
|
|
5026
|
-
/* @__PURE__ */
|
|
5027
|
-
/* @__PURE__ */
|
|
5028
|
-
/* @__PURE__ */
|
|
4743
|
+
/* @__PURE__ */ jsxs19("section", { className: "space-y-3", children: [
|
|
4744
|
+
/* @__PURE__ */ jsx21("h3", { className: "text-sm font-medium", children: "Ferramentas" }),
|
|
4745
|
+
/* @__PURE__ */ jsx21(ToolsTable, { onEdit: handleEditTool, config })
|
|
5029
4746
|
] }),
|
|
5030
|
-
/* @__PURE__ */
|
|
5031
|
-
/* @__PURE__ */
|
|
5032
|
-
/* @__PURE__ */
|
|
4747
|
+
/* @__PURE__ */ jsxs19("section", { className: "space-y-3", children: [
|
|
4748
|
+
/* @__PURE__ */ jsx21("h3", { className: "text-sm font-medium", children: "Credenciais" }),
|
|
4749
|
+
/* @__PURE__ */ jsx21(
|
|
5033
4750
|
ToolCredentialsForm,
|
|
5034
4751
|
{
|
|
5035
4752
|
credentials,
|
|
@@ -5039,7 +4756,7 @@ function AdvancedTab({ config, agentId, gagentsApiUrl }) {
|
|
|
5039
4756
|
}
|
|
5040
4757
|
)
|
|
5041
4758
|
] }),
|
|
5042
|
-
/* @__PURE__ */
|
|
4759
|
+
/* @__PURE__ */ jsx21(
|
|
5043
4760
|
ToolFormDialog,
|
|
5044
4761
|
{
|
|
5045
4762
|
open: showToolForm,
|
|
@@ -5052,7 +4769,7 @@ function AdvancedTab({ config, agentId, gagentsApiUrl }) {
|
|
|
5052
4769
|
}
|
|
5053
4770
|
|
|
5054
4771
|
// src/pages/agent-capabilities-page.tsx
|
|
5055
|
-
import { jsx as
|
|
4772
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5056
4773
|
function defaultResolveWizardMeta(card) {
|
|
5057
4774
|
return {
|
|
5058
4775
|
capabilities: [
|
|
@@ -5070,8 +4787,8 @@ function AgentCapabilitiesPage({
|
|
|
5070
4787
|
loadConfigOptions,
|
|
5071
4788
|
onWizardComplete
|
|
5072
4789
|
}) {
|
|
5073
|
-
const [wizardOpen, setWizardOpen] =
|
|
5074
|
-
const [activeCard, setActiveCard] =
|
|
4790
|
+
const [wizardOpen, setWizardOpen] = useState14(false);
|
|
4791
|
+
const [activeCard, setActiveCard] = useState14(null);
|
|
5075
4792
|
const handleConnect = useCallback6(
|
|
5076
4793
|
(card) => {
|
|
5077
4794
|
setActiveCard(card);
|
|
@@ -5089,28 +4806,28 @@ function AgentCapabilitiesPage({
|
|
|
5089
4806
|
if (!open) setActiveCard(null);
|
|
5090
4807
|
}, []);
|
|
5091
4808
|
const wizardMeta = activeCard ? resolveWizardMeta(activeCard) : null;
|
|
5092
|
-
return /* @__PURE__ */
|
|
5093
|
-
/* @__PURE__ */
|
|
5094
|
-
/* @__PURE__ */
|
|
5095
|
-
/* @__PURE__ */
|
|
4809
|
+
return /* @__PURE__ */ jsxs20("div", { className: "space-y-4", children: [
|
|
4810
|
+
/* @__PURE__ */ jsxs20("div", { children: [
|
|
4811
|
+
/* @__PURE__ */ jsx22("h2", { className: "text-lg font-semibold", children: "Capacidades e Integra\xE7\xF5es" }),
|
|
4812
|
+
/* @__PURE__ */ jsx22("p", { className: "text-sm text-muted-foreground", children: "Configure o que este agente pode fazer e quais servi\xE7os externos ele utiliza." })
|
|
5096
4813
|
] }),
|
|
5097
|
-
/* @__PURE__ */
|
|
5098
|
-
/* @__PURE__ */
|
|
5099
|
-
/* @__PURE__ */
|
|
5100
|
-
/* @__PURE__ */
|
|
4814
|
+
/* @__PURE__ */ jsxs20(Tabs, { defaultValue: "capacidades", children: [
|
|
4815
|
+
/* @__PURE__ */ jsxs20(TabsList, { children: [
|
|
4816
|
+
/* @__PURE__ */ jsxs20(TabsTrigger, { value: "capacidades", className: "flex items-center gap-1.5", children: [
|
|
4817
|
+
/* @__PURE__ */ jsx22(Blocks, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
|
|
5101
4818
|
"Capacidades"
|
|
5102
4819
|
] }),
|
|
5103
|
-
/* @__PURE__ */
|
|
5104
|
-
/* @__PURE__ */
|
|
4820
|
+
/* @__PURE__ */ jsxs20(TabsTrigger, { value: "integracoes", className: "flex items-center gap-1.5", children: [
|
|
4821
|
+
/* @__PURE__ */ jsx22(Plug3, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
|
|
5105
4822
|
"Integra\xE7\xF5es"
|
|
5106
4823
|
] }),
|
|
5107
|
-
/* @__PURE__ */
|
|
5108
|
-
/* @__PURE__ */
|
|
4824
|
+
/* @__PURE__ */ jsxs20(TabsTrigger, { value: "avancado", className: "flex items-center gap-1.5", children: [
|
|
4825
|
+
/* @__PURE__ */ jsx22(Settings3, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
|
|
5109
4826
|
"Avan\xE7ado"
|
|
5110
4827
|
] })
|
|
5111
4828
|
] }),
|
|
5112
|
-
/* @__PURE__ */
|
|
5113
|
-
/* @__PURE__ */
|
|
4829
|
+
/* @__PURE__ */ jsx22(TabsContent, { value: "capacidades", className: "mt-4", children: /* @__PURE__ */ jsx22(CapabilitiesTab, { config, agentId }) }),
|
|
4830
|
+
/* @__PURE__ */ jsx22(TabsContent, { value: "integracoes", className: "mt-4", children: /* @__PURE__ */ jsx22(
|
|
5114
4831
|
IntegrationsTab,
|
|
5115
4832
|
{
|
|
5116
4833
|
config,
|
|
@@ -5118,7 +4835,7 @@ function AgentCapabilitiesPage({
|
|
|
5118
4835
|
onConnect: handleConnect
|
|
5119
4836
|
}
|
|
5120
4837
|
) }),
|
|
5121
|
-
/* @__PURE__ */
|
|
4838
|
+
/* @__PURE__ */ jsx22(TabsContent, { value: "avancado", className: "mt-4", children: /* @__PURE__ */ jsx22(
|
|
5122
4839
|
AdvancedTab,
|
|
5123
4840
|
{
|
|
5124
4841
|
config,
|
|
@@ -5127,7 +4844,7 @@ function AgentCapabilitiesPage({
|
|
|
5127
4844
|
}
|
|
5128
4845
|
) })
|
|
5129
4846
|
] }),
|
|
5130
|
-
activeCard && wizardMeta && /* @__PURE__ */
|
|
4847
|
+
activeCard && wizardMeta && /* @__PURE__ */ jsx22(
|
|
5131
4848
|
IntegrationWizard,
|
|
5132
4849
|
{
|
|
5133
4850
|
open: wizardOpen,
|
|
@@ -5152,8 +4869,8 @@ import {
|
|
|
5152
4869
|
TabsTrigger as TabsTrigger2,
|
|
5153
4870
|
TabsContent as TabsContent2
|
|
5154
4871
|
} from "@greatapps/greatauth-ui/ui";
|
|
5155
|
-
import {
|
|
5156
|
-
import { jsx as
|
|
4872
|
+
import { Target as Target2, FileText as FileText2, MessageCircle as MessageCircle2, Blocks as Blocks2 } from "lucide-react";
|
|
4873
|
+
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5157
4874
|
function AgentTabs({
|
|
5158
4875
|
agent,
|
|
5159
4876
|
config,
|
|
@@ -5164,33 +4881,28 @@ function AgentTabs({
|
|
|
5164
4881
|
onWizardComplete
|
|
5165
4882
|
}) {
|
|
5166
4883
|
const apiUrl = gagentsApiUrl || config.baseUrl;
|
|
5167
|
-
return /* @__PURE__ */
|
|
5168
|
-
/* @__PURE__ */
|
|
5169
|
-
/* @__PURE__ */
|
|
5170
|
-
/* @__PURE__ */
|
|
4884
|
+
return /* @__PURE__ */ jsxs21(Tabs2, { defaultValue: "prompt", children: [
|
|
4885
|
+
/* @__PURE__ */ jsxs21(TabsList2, { children: [
|
|
4886
|
+
/* @__PURE__ */ jsxs21(TabsTrigger2, { value: "prompt", className: "flex items-center gap-1.5", children: [
|
|
4887
|
+
/* @__PURE__ */ jsx23(FileText2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
|
|
5171
4888
|
"Prompt"
|
|
5172
4889
|
] }),
|
|
5173
|
-
/* @__PURE__ */
|
|
5174
|
-
/* @__PURE__ */
|
|
4890
|
+
/* @__PURE__ */ jsxs21(TabsTrigger2, { value: "objetivos", className: "flex items-center gap-1.5", children: [
|
|
4891
|
+
/* @__PURE__ */ jsx23(Target2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
|
|
5175
4892
|
"Objetivos"
|
|
5176
4893
|
] }),
|
|
5177
|
-
/* @__PURE__ */
|
|
5178
|
-
/* @__PURE__ */
|
|
5179
|
-
"Ferramentas"
|
|
5180
|
-
] }),
|
|
5181
|
-
/* @__PURE__ */ jsxs22(TabsTrigger2, { value: "capacidades", className: "flex items-center gap-1.5", children: [
|
|
5182
|
-
/* @__PURE__ */ jsx24(Blocks2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
|
|
4894
|
+
/* @__PURE__ */ jsxs21(TabsTrigger2, { value: "capacidades", className: "flex items-center gap-1.5", children: [
|
|
4895
|
+
/* @__PURE__ */ jsx23(Blocks2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
|
|
5183
4896
|
"Capacidades"
|
|
5184
4897
|
] }),
|
|
5185
|
-
/* @__PURE__ */
|
|
5186
|
-
/* @__PURE__ */
|
|
4898
|
+
/* @__PURE__ */ jsxs21(TabsTrigger2, { value: "conversas", className: "flex items-center gap-1.5", children: [
|
|
4899
|
+
/* @__PURE__ */ jsx23(MessageCircle2, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
|
|
5187
4900
|
"Conversas"
|
|
5188
4901
|
] })
|
|
5189
4902
|
] }),
|
|
5190
|
-
/* @__PURE__ */
|
|
5191
|
-
/* @__PURE__ */
|
|
5192
|
-
/* @__PURE__ */
|
|
5193
|
-
/* @__PURE__ */ jsx24(TabsContent2, { value: "capacidades", className: "mt-4", children: /* @__PURE__ */ jsx24(
|
|
4903
|
+
/* @__PURE__ */ jsx23(TabsContent2, { value: "prompt", className: "mt-4", children: /* @__PURE__ */ jsx23(AgentPromptEditor, { agent, config }) }),
|
|
4904
|
+
/* @__PURE__ */ jsx23(TabsContent2, { value: "objetivos", className: "mt-4", children: /* @__PURE__ */ jsx23(AgentObjectivesList, { agent, config }) }),
|
|
4905
|
+
/* @__PURE__ */ jsx23(TabsContent2, { value: "capacidades", className: "mt-4", children: /* @__PURE__ */ jsx23(
|
|
5194
4906
|
AgentCapabilitiesPage,
|
|
5195
4907
|
{
|
|
5196
4908
|
config,
|
|
@@ -5201,7 +4913,7 @@ function AgentTabs({
|
|
|
5201
4913
|
onWizardComplete
|
|
5202
4914
|
}
|
|
5203
4915
|
) }),
|
|
5204
|
-
/* @__PURE__ */
|
|
4916
|
+
/* @__PURE__ */ jsx23(TabsContent2, { value: "conversas", className: "mt-4", children: /* @__PURE__ */ jsx23(
|
|
5205
4917
|
AgentConversationsPanel,
|
|
5206
4918
|
{
|
|
5207
4919
|
agent,
|
|
@@ -5212,6 +4924,335 @@ function AgentTabs({
|
|
|
5212
4924
|
] });
|
|
5213
4925
|
}
|
|
5214
4926
|
|
|
4927
|
+
// src/components/agents/agent-tools-list.tsx
|
|
4928
|
+
import { useState as useState15 } from "react";
|
|
4929
|
+
import {
|
|
4930
|
+
Switch as Switch5,
|
|
4931
|
+
Badge as Badge9,
|
|
4932
|
+
Button as Button14,
|
|
4933
|
+
Skeleton as Skeleton6,
|
|
4934
|
+
AlertDialog as AlertDialog5,
|
|
4935
|
+
AlertDialogAction as AlertDialogAction5,
|
|
4936
|
+
AlertDialogCancel as AlertDialogCancel5,
|
|
4937
|
+
AlertDialogContent as AlertDialogContent5,
|
|
4938
|
+
AlertDialogDescription as AlertDialogDescription5,
|
|
4939
|
+
AlertDialogFooter as AlertDialogFooter5,
|
|
4940
|
+
AlertDialogHeader as AlertDialogHeader5,
|
|
4941
|
+
AlertDialogTitle as AlertDialogTitle5,
|
|
4942
|
+
Popover,
|
|
4943
|
+
PopoverContent,
|
|
4944
|
+
PopoverTrigger,
|
|
4945
|
+
Input as Input10,
|
|
4946
|
+
Textarea as Textarea3,
|
|
4947
|
+
Dialog as Dialog7,
|
|
4948
|
+
DialogContent as DialogContent7,
|
|
4949
|
+
DialogHeader as DialogHeader7,
|
|
4950
|
+
DialogTitle as DialogTitle7,
|
|
4951
|
+
DialogFooter as DialogFooter7,
|
|
4952
|
+
Label as Label8,
|
|
4953
|
+
Select as Select4,
|
|
4954
|
+
SelectContent as SelectContent4,
|
|
4955
|
+
SelectItem as SelectItem4,
|
|
4956
|
+
SelectTrigger as SelectTrigger4,
|
|
4957
|
+
SelectValue as SelectValue4
|
|
4958
|
+
} from "@greatapps/greatauth-ui/ui";
|
|
4959
|
+
import {
|
|
4960
|
+
Trash2 as Trash25,
|
|
4961
|
+
Plus as Plus2,
|
|
4962
|
+
Wrench,
|
|
4963
|
+
Settings2 as Settings22
|
|
4964
|
+
} from "lucide-react";
|
|
4965
|
+
import { toast as toast11 } from "sonner";
|
|
4966
|
+
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4967
|
+
function AgentToolsList({ agent, config }) {
|
|
4968
|
+
const { data: agentToolsData, isLoading } = useAgentTools(config, agent.id);
|
|
4969
|
+
const { data: allToolsData } = useTools(config);
|
|
4970
|
+
const addMutation = useAddAgentTool(config);
|
|
4971
|
+
const removeMutation = useRemoveAgentTool(config);
|
|
4972
|
+
const updateMutation = useUpdateAgentTool(config);
|
|
4973
|
+
const [removeTarget, setRemoveTarget] = useState15(null);
|
|
4974
|
+
const [addOpen, setAddOpen] = useState15(false);
|
|
4975
|
+
const [search, setSearch] = useState15("");
|
|
4976
|
+
const [configTarget, setConfigTarget] = useState15(null);
|
|
4977
|
+
const [configInstructions, setConfigInstructions] = useState15("");
|
|
4978
|
+
const [configCredentialId, setConfigCredentialId] = useState15("");
|
|
4979
|
+
const { data: credentialsData } = useToolCredentials(config);
|
|
4980
|
+
const allCredentials = credentialsData?.data || [];
|
|
4981
|
+
const agentTools = agentToolsData?.data || [];
|
|
4982
|
+
const allTools = (allToolsData?.data || []).filter((t) => !t.slug?.startsWith("gclinic_"));
|
|
4983
|
+
const assignedToolIds = new Set(agentTools.map((at) => at.id_tool));
|
|
4984
|
+
const visibleAgentTools = agentTools.filter((at) => {
|
|
4985
|
+
const tool = allTools.find((t) => t.id === at.id_tool);
|
|
4986
|
+
return !tool || !tool.slug?.startsWith("gclinic_");
|
|
4987
|
+
});
|
|
4988
|
+
const availableTools = allTools.filter((t) => !assignedToolIds.has(t.id));
|
|
4989
|
+
const filteredAvailable = availableTools.filter(
|
|
4990
|
+
(t) => t.name.toLowerCase().includes(search.toLowerCase())
|
|
4991
|
+
);
|
|
4992
|
+
function getToolInfo(idTool) {
|
|
4993
|
+
return allTools.find((t) => t.id === idTool);
|
|
4994
|
+
}
|
|
4995
|
+
async function handleToggleEnabled(agentTool, checked) {
|
|
4996
|
+
try {
|
|
4997
|
+
await updateMutation.mutateAsync({
|
|
4998
|
+
idAgent: agent.id,
|
|
4999
|
+
id: agentTool.id,
|
|
5000
|
+
body: { enabled: checked }
|
|
5001
|
+
});
|
|
5002
|
+
toast11.success(checked ? "Ferramenta ativada" : "Ferramenta desativada");
|
|
5003
|
+
} catch (err) {
|
|
5004
|
+
toast11.error(
|
|
5005
|
+
err instanceof Error ? err.message : "Erro ao alterar estado da ferramenta"
|
|
5006
|
+
);
|
|
5007
|
+
}
|
|
5008
|
+
}
|
|
5009
|
+
async function handleAdd(tool) {
|
|
5010
|
+
try {
|
|
5011
|
+
await addMutation.mutateAsync({
|
|
5012
|
+
idAgent: agent.id,
|
|
5013
|
+
body: { id_tool: tool.id }
|
|
5014
|
+
});
|
|
5015
|
+
toast11.success("Ferramenta adicionada");
|
|
5016
|
+
setAddOpen(false);
|
|
5017
|
+
setSearch("");
|
|
5018
|
+
} catch (err) {
|
|
5019
|
+
toast11.error(
|
|
5020
|
+
err instanceof Error ? err.message : "Erro ao adicionar ferramenta"
|
|
5021
|
+
);
|
|
5022
|
+
}
|
|
5023
|
+
}
|
|
5024
|
+
async function handleRemove() {
|
|
5025
|
+
if (!removeTarget) return;
|
|
5026
|
+
try {
|
|
5027
|
+
await removeMutation.mutateAsync({
|
|
5028
|
+
idAgent: agent.id,
|
|
5029
|
+
id: removeTarget.id
|
|
5030
|
+
});
|
|
5031
|
+
toast11.success("Ferramenta removida");
|
|
5032
|
+
} catch (err) {
|
|
5033
|
+
toast11.error(
|
|
5034
|
+
err instanceof Error ? err.message : "Erro ao remover ferramenta"
|
|
5035
|
+
);
|
|
5036
|
+
} finally {
|
|
5037
|
+
setRemoveTarget(null);
|
|
5038
|
+
}
|
|
5039
|
+
}
|
|
5040
|
+
function openConfig(agentTool) {
|
|
5041
|
+
setConfigTarget(agentTool);
|
|
5042
|
+
setConfigInstructions(agentTool.custom_instructions || "");
|
|
5043
|
+
setConfigCredentialId(agentTool.id_tool_credential ? String(agentTool.id_tool_credential) : "");
|
|
5044
|
+
}
|
|
5045
|
+
async function handleSaveConfig() {
|
|
5046
|
+
if (!configTarget) return;
|
|
5047
|
+
try {
|
|
5048
|
+
const newCredentialId = configCredentialId ? parseInt(configCredentialId, 10) : null;
|
|
5049
|
+
await updateMutation.mutateAsync({
|
|
5050
|
+
idAgent: agent.id,
|
|
5051
|
+
id: configTarget.id,
|
|
5052
|
+
body: {
|
|
5053
|
+
custom_instructions: configInstructions.trim() || null,
|
|
5054
|
+
id_tool_credential: newCredentialId
|
|
5055
|
+
}
|
|
5056
|
+
});
|
|
5057
|
+
toast11.success("Configura\xE7\xE3o atualizada");
|
|
5058
|
+
setConfigTarget(null);
|
|
5059
|
+
} catch (err) {
|
|
5060
|
+
toast11.error(
|
|
5061
|
+
err instanceof Error ? err.message : "Erro ao atualizar configura\xE7\xE3o"
|
|
5062
|
+
);
|
|
5063
|
+
}
|
|
5064
|
+
}
|
|
5065
|
+
if (isLoading) {
|
|
5066
|
+
return /* @__PURE__ */ jsx24("div", { className: "space-y-3 p-4", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx24(Skeleton6, { className: "h-14 w-full" }, i)) });
|
|
5067
|
+
}
|
|
5068
|
+
return /* @__PURE__ */ jsxs22("div", { className: "space-y-4 p-4", children: [
|
|
5069
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between", children: [
|
|
5070
|
+
/* @__PURE__ */ jsxs22("h3", { className: "text-sm font-medium text-muted-foreground", children: [
|
|
5071
|
+
visibleAgentTools.length,
|
|
5072
|
+
" ferramenta",
|
|
5073
|
+
visibleAgentTools.length !== 1 ? "s" : "",
|
|
5074
|
+
" associada",
|
|
5075
|
+
visibleAgentTools.length !== 1 ? "s" : ""
|
|
5076
|
+
] }),
|
|
5077
|
+
/* @__PURE__ */ jsxs22(Popover, { open: addOpen, onOpenChange: setAddOpen, children: [
|
|
5078
|
+
/* @__PURE__ */ jsx24(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs22(Button14, { size: "sm", disabled: availableTools.length === 0, children: [
|
|
5079
|
+
/* @__PURE__ */ jsx24(Plus2, { className: "mr-2 h-4 w-4" }),
|
|
5080
|
+
"Adicionar Ferramenta"
|
|
5081
|
+
] }) }),
|
|
5082
|
+
/* @__PURE__ */ jsxs22(PopoverContent, { className: "w-72 p-0", align: "end", children: [
|
|
5083
|
+
/* @__PURE__ */ jsx24("div", { className: "p-2", children: /* @__PURE__ */ jsx24(
|
|
5084
|
+
Input10,
|
|
5085
|
+
{
|
|
5086
|
+
placeholder: "Buscar ferramenta\\u2026",
|
|
5087
|
+
"aria-label": "Buscar ferramenta",
|
|
5088
|
+
name: "search",
|
|
5089
|
+
value: search,
|
|
5090
|
+
onChange: (e) => setSearch(e.target.value),
|
|
5091
|
+
className: "h-8"
|
|
5092
|
+
}
|
|
5093
|
+
) }),
|
|
5094
|
+
/* @__PURE__ */ jsx24("div", { className: "max-h-48 overflow-y-auto", children: filteredAvailable.length === 0 ? /* @__PURE__ */ jsx24("p", { className: "p-3 text-center text-sm text-muted-foreground", children: "Nenhuma ferramenta dispon\xEDvel" }) : filteredAvailable.map((tool) => /* @__PURE__ */ jsxs22(
|
|
5095
|
+
"button",
|
|
5096
|
+
{
|
|
5097
|
+
type: "button",
|
|
5098
|
+
className: "flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-accent",
|
|
5099
|
+
onClick: () => handleAdd(tool),
|
|
5100
|
+
disabled: addMutation.isPending,
|
|
5101
|
+
children: [
|
|
5102
|
+
/* @__PURE__ */ jsx24(Wrench, { className: "h-4 w-4 text-muted-foreground" }),
|
|
5103
|
+
/* @__PURE__ */ jsx24("span", { className: "flex-1 font-medium", children: tool.name }),
|
|
5104
|
+
/* @__PURE__ */ jsx24(Badge9, { variant: "secondary", className: "text-xs", children: tool.type })
|
|
5105
|
+
]
|
|
5106
|
+
},
|
|
5107
|
+
tool.id
|
|
5108
|
+
)) })
|
|
5109
|
+
] })
|
|
5110
|
+
] })
|
|
5111
|
+
] }),
|
|
5112
|
+
visibleAgentTools.length === 0 ? /* @__PURE__ */ jsxs22("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
|
|
5113
|
+
/* @__PURE__ */ jsx24(Wrench, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
|
|
5114
|
+
/* @__PURE__ */ jsx24("p", { className: "text-sm text-muted-foreground", children: "Nenhuma ferramenta associada. Clique em 'Adicionar Ferramenta' para come\xE7ar." })
|
|
5115
|
+
] }) : /* @__PURE__ */ jsx24("div", { className: "space-y-2", children: visibleAgentTools.map((agentTool) => {
|
|
5116
|
+
const tool = getToolInfo(agentTool.id_tool);
|
|
5117
|
+
return /* @__PURE__ */ jsxs22(
|
|
5118
|
+
"div",
|
|
5119
|
+
{
|
|
5120
|
+
className: "flex items-center gap-3 rounded-lg border bg-card p-3",
|
|
5121
|
+
children: [
|
|
5122
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex flex-1 flex-col gap-1 min-w-0", children: [
|
|
5123
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-2", children: [
|
|
5124
|
+
/* @__PURE__ */ jsx24("span", { className: "truncate font-medium", children: tool?.name || `Ferramenta #${agentTool.id_tool}` }),
|
|
5125
|
+
tool?.type && /* @__PURE__ */ jsx24(Badge9, { variant: "secondary", className: "shrink-0 text-xs", children: tool.type })
|
|
5126
|
+
] }),
|
|
5127
|
+
agentTool.custom_instructions && /* @__PURE__ */ jsx24("p", { className: "truncate text-xs text-muted-foreground", children: agentTool.custom_instructions })
|
|
5128
|
+
] }),
|
|
5129
|
+
/* @__PURE__ */ jsx24(
|
|
5130
|
+
Switch5,
|
|
5131
|
+
{
|
|
5132
|
+
"aria-label": "Ativar/Desativar",
|
|
5133
|
+
checked: agentTool.enabled,
|
|
5134
|
+
onCheckedChange: (checked) => handleToggleEnabled(agentTool, checked),
|
|
5135
|
+
disabled: updateMutation.isPending
|
|
5136
|
+
}
|
|
5137
|
+
),
|
|
5138
|
+
/* @__PURE__ */ jsx24(
|
|
5139
|
+
Button14,
|
|
5140
|
+
{
|
|
5141
|
+
variant: "ghost",
|
|
5142
|
+
size: "icon",
|
|
5143
|
+
"aria-label": "Configurar",
|
|
5144
|
+
className: "shrink-0 text-muted-foreground hover:text-foreground",
|
|
5145
|
+
onClick: () => openConfig(agentTool),
|
|
5146
|
+
title: "Configurar instru\xE7\xF5es",
|
|
5147
|
+
children: /* @__PURE__ */ jsx24(Settings22, { className: "h-4 w-4" })
|
|
5148
|
+
}
|
|
5149
|
+
),
|
|
5150
|
+
/* @__PURE__ */ jsx24(
|
|
5151
|
+
Button14,
|
|
5152
|
+
{
|
|
5153
|
+
variant: "ghost",
|
|
5154
|
+
size: "icon",
|
|
5155
|
+
"aria-label": "Remover",
|
|
5156
|
+
className: "shrink-0 text-muted-foreground hover:text-destructive",
|
|
5157
|
+
onClick: () => setRemoveTarget(agentTool),
|
|
5158
|
+
children: /* @__PURE__ */ jsx24(Trash25, { className: "h-4 w-4" })
|
|
5159
|
+
}
|
|
5160
|
+
)
|
|
5161
|
+
]
|
|
5162
|
+
},
|
|
5163
|
+
agentTool.id
|
|
5164
|
+
);
|
|
5165
|
+
}) }),
|
|
5166
|
+
/* @__PURE__ */ jsx24(
|
|
5167
|
+
Dialog7,
|
|
5168
|
+
{
|
|
5169
|
+
open: !!configTarget,
|
|
5170
|
+
onOpenChange: (open) => !open && setConfigTarget(null),
|
|
5171
|
+
children: /* @__PURE__ */ jsxs22(DialogContent7, { className: "sm:max-w-lg", children: [
|
|
5172
|
+
/* @__PURE__ */ jsx24(DialogHeader7, { children: /* @__PURE__ */ jsx24(DialogTitle7, { children: "Instru\xE7\xF5es da Ferramenta" }) }),
|
|
5173
|
+
/* @__PURE__ */ jsxs22("div", { className: "space-y-4", children: [
|
|
5174
|
+
configTarget && getToolInfo(configTarget.id_tool)?.type !== "none" && /* @__PURE__ */ jsxs22("div", { className: "space-y-2", children: [
|
|
5175
|
+
/* @__PURE__ */ jsx24(Label8, { htmlFor: "tool-credential", children: "Credencial" }),
|
|
5176
|
+
/* @__PURE__ */ jsxs22(
|
|
5177
|
+
Select4,
|
|
5178
|
+
{
|
|
5179
|
+
value: configCredentialId || void 0,
|
|
5180
|
+
onValueChange: (val) => setConfigCredentialId(val === "__none__" ? "" : val),
|
|
5181
|
+
children: [
|
|
5182
|
+
/* @__PURE__ */ jsx24(SelectTrigger4, { id: "tool-credential", children: /* @__PURE__ */ jsx24(SelectValue4, { placeholder: "Selecione uma credencial (opcional)" }) }),
|
|
5183
|
+
/* @__PURE__ */ jsxs22(SelectContent4, { children: [
|
|
5184
|
+
/* @__PURE__ */ jsx24(SelectItem4, { value: "__none__", children: "Nenhuma (autom\xE1tico)" }),
|
|
5185
|
+
allCredentials.filter((c) => configTarget && c.id_tool === configTarget.id_tool && c.status === "active").map((c) => /* @__PURE__ */ jsx24(SelectItem4, { value: String(c.id), children: c.label || `Credencial #${c.id}` }, c.id))
|
|
5186
|
+
] })
|
|
5187
|
+
]
|
|
5188
|
+
}
|
|
5189
|
+
),
|
|
5190
|
+
/* @__PURE__ */ jsx24("p", { className: "text-xs text-muted-foreground", children: "Vincule uma credencial espec\xEDfica a esta ferramenta neste agente." })
|
|
5191
|
+
] }),
|
|
5192
|
+
/* @__PURE__ */ jsxs22("div", { className: "space-y-2", children: [
|
|
5193
|
+
/* @__PURE__ */ jsx24(Label8, { htmlFor: "tool-instructions", children: "Instru\xE7\xF5es Personalizadas" }),
|
|
5194
|
+
/* @__PURE__ */ jsx24(
|
|
5195
|
+
Textarea3,
|
|
5196
|
+
{
|
|
5197
|
+
id: "tool-instructions",
|
|
5198
|
+
name: "instructions",
|
|
5199
|
+
value: configInstructions,
|
|
5200
|
+
onChange: (e) => setConfigInstructions(e.target.value),
|
|
5201
|
+
placeholder: "Instru\\u00e7\\u00f5es sobre como e quando o agente deve usar esta ferramenta\\u2026",
|
|
5202
|
+
rows: 6
|
|
5203
|
+
}
|
|
5204
|
+
),
|
|
5205
|
+
/* @__PURE__ */ jsx24("p", { className: "text-xs text-muted-foreground", children: "Este texto \xE9 adicionado ao prompt do agente para orientar o uso da ferramenta." })
|
|
5206
|
+
] })
|
|
5207
|
+
] }),
|
|
5208
|
+
/* @__PURE__ */ jsxs22(DialogFooter7, { children: [
|
|
5209
|
+
/* @__PURE__ */ jsx24(
|
|
5210
|
+
Button14,
|
|
5211
|
+
{
|
|
5212
|
+
variant: "outline",
|
|
5213
|
+
onClick: () => setConfigTarget(null),
|
|
5214
|
+
children: "Cancelar"
|
|
5215
|
+
}
|
|
5216
|
+
),
|
|
5217
|
+
/* @__PURE__ */ jsx24(
|
|
5218
|
+
Button14,
|
|
5219
|
+
{
|
|
5220
|
+
onClick: handleSaveConfig,
|
|
5221
|
+
disabled: updateMutation.isPending,
|
|
5222
|
+
children: "Salvar"
|
|
5223
|
+
}
|
|
5224
|
+
)
|
|
5225
|
+
] })
|
|
5226
|
+
] })
|
|
5227
|
+
}
|
|
5228
|
+
),
|
|
5229
|
+
/* @__PURE__ */ jsx24(
|
|
5230
|
+
AlertDialog5,
|
|
5231
|
+
{
|
|
5232
|
+
open: !!removeTarget,
|
|
5233
|
+
onOpenChange: (open) => !open && setRemoveTarget(null),
|
|
5234
|
+
children: /* @__PURE__ */ jsxs22(AlertDialogContent5, { children: [
|
|
5235
|
+
/* @__PURE__ */ jsxs22(AlertDialogHeader5, { children: [
|
|
5236
|
+
/* @__PURE__ */ jsx24(AlertDialogTitle5, { children: "Remover ferramenta?" }),
|
|
5237
|
+
/* @__PURE__ */ jsx24(AlertDialogDescription5, { children: "A ferramenta ser\xE1 desassociada deste agente." })
|
|
5238
|
+
] }),
|
|
5239
|
+
/* @__PURE__ */ jsxs22(AlertDialogFooter5, { children: [
|
|
5240
|
+
/* @__PURE__ */ jsx24(AlertDialogCancel5, { children: "Cancelar" }),
|
|
5241
|
+
/* @__PURE__ */ jsx24(
|
|
5242
|
+
AlertDialogAction5,
|
|
5243
|
+
{
|
|
5244
|
+
onClick: handleRemove,
|
|
5245
|
+
disabled: removeMutation.isPending,
|
|
5246
|
+
children: "Remover"
|
|
5247
|
+
}
|
|
5248
|
+
)
|
|
5249
|
+
] })
|
|
5250
|
+
] })
|
|
5251
|
+
}
|
|
5252
|
+
)
|
|
5253
|
+
] });
|
|
5254
|
+
}
|
|
5255
|
+
|
|
5215
5256
|
// src/pages/agents-page.tsx
|
|
5216
5257
|
import { useState as useState16 } from "react";
|
|
5217
5258
|
import { Button as Button15 } from "@greatapps/greatauth-ui/ui";
|
|
@@ -5433,7 +5474,7 @@ import {
|
|
|
5433
5474
|
TabsList as TabsList3,
|
|
5434
5475
|
TabsTrigger as TabsTrigger3
|
|
5435
5476
|
} from "@greatapps/greatauth-ui/ui";
|
|
5436
|
-
import { Plus as Plus6, Plug as Plug4, KeyRound, Info as
|
|
5477
|
+
import { Plus as Plus6, Plug as Plug4, KeyRound, Info as Info4 } from "lucide-react";
|
|
5437
5478
|
import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
5438
5479
|
function useCredentialAgentSummary(credentials, tools, agents) {
|
|
5439
5480
|
return useMemo8(() => {
|
|
@@ -5493,7 +5534,7 @@ function IntegrationsManagementPage({
|
|
|
5493
5534
|
) }),
|
|
5494
5535
|
/* @__PURE__ */ jsxs27(TabsContent3, { value: "credentials", className: "mt-4", children: [
|
|
5495
5536
|
!credentialsLoading && /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-4 rounded-lg border bg-muted/50 px-4 py-3 mb-4", children: [
|
|
5496
|
-
/* @__PURE__ */ jsx29(
|
|
5537
|
+
/* @__PURE__ */ jsx29(Info4, { className: "h-4 w-4 text-muted-foreground shrink-0" }),
|
|
5497
5538
|
/* @__PURE__ */ jsxs27("div", { className: "flex flex-wrap items-center gap-3 text-sm", children: [
|
|
5498
5539
|
/* @__PURE__ */ jsxs27("span", { children: [
|
|
5499
5540
|
/* @__PURE__ */ jsx29(Badge11, { variant: "secondary", className: "mr-1", children: summary.totalCredentials }),
|