@greatapps/greatagents-ui 0.3.18 → 0.3.19
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.js +245 -195
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/capabilities/integrations-tab.tsx +210 -159
package/dist/index.js
CHANGED
|
@@ -2986,9 +2986,10 @@ function ModuleRow({
|
|
|
2986
2986
|
}
|
|
2987
2987
|
|
|
2988
2988
|
// src/components/capabilities/integrations-tab.tsx
|
|
2989
|
-
import { useCallback as useCallback5, useState as useState9 } from "react";
|
|
2990
|
-
import { Switch as Switch5, Tooltip as Tooltip2, TooltipContent as TooltipContent2, TooltipTrigger as TooltipTrigger2, Checkbox as Checkbox2 } from "@greatapps/greatauth-ui/ui";
|
|
2989
|
+
import { useCallback as useCallback5, useState as useState9, useEffect as useEffect5, useMemo as useMemo6 } from "react";
|
|
2990
|
+
import { Switch as Switch5, Tooltip as Tooltip2, TooltipContent as TooltipContent2, TooltipTrigger as TooltipTrigger2, Checkbox as Checkbox2, Button as Button8 } from "@greatapps/greatauth-ui/ui";
|
|
2991
2991
|
import { Plug, Loader2 as Loader25, ChevronDown as ChevronDown3, Pencil as Pencil4 } from "lucide-react";
|
|
2992
|
+
import { toast as toast7 } from "sonner";
|
|
2992
2993
|
import { CalendarSync } from "lucide-react";
|
|
2993
2994
|
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2994
2995
|
var ICON_MAP = {
|
|
@@ -3031,146 +3032,185 @@ function IntegrationsTab({
|
|
|
3031
3032
|
const createTool = useCreateTool(config);
|
|
3032
3033
|
const agentTools = agentToolsData?.data ?? [];
|
|
3033
3034
|
const allTools = toolsData?.data ?? [];
|
|
3034
|
-
const [
|
|
3035
|
-
const [
|
|
3035
|
+
const [localState, setLocalState] = useState9({});
|
|
3036
|
+
const [serverState, setServerState] = useState9({});
|
|
3037
|
+
const [initialized, setInitialized] = useState9(false);
|
|
3038
|
+
const [isSaving, setIsSaving] = useState9(false);
|
|
3036
3039
|
const [editingFunction, setEditingFunction] = useState9(null);
|
|
3037
3040
|
const [expandedCards, setExpandedCards] = useState9(/* @__PURE__ */ new Set());
|
|
3038
3041
|
const connectedCards = cards.filter(
|
|
3039
3042
|
(c) => !c.isAddNew && (c.state === "connected" || c.state === "expired")
|
|
3040
3043
|
);
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3044
|
+
useEffect5(() => {
|
|
3045
|
+
if (!connectedCards.length || initialized) return;
|
|
3046
|
+
const state = {};
|
|
3047
|
+
for (const card of connectedCards) {
|
|
3048
|
+
const slug = card.definition.slug;
|
|
3049
|
+
const isLinked = card.linkedToAgent;
|
|
3050
|
+
const fns = INTEGRATION_FUNCTIONS[slug] ?? [];
|
|
3051
|
+
if (isLinked) {
|
|
3052
|
+
const toolId = card.tool?.id;
|
|
3053
|
+
const agentTool = toolId ? agentTools.find((at) => at.id_tool === toolId) : null;
|
|
3054
|
+
const existingInstructions = agentTool?.custom_instructions || "";
|
|
3055
|
+
const selectedFns = /* @__PURE__ */ new Set();
|
|
3056
|
+
const fnInstr = {};
|
|
3057
|
+
for (const fn of fns) {
|
|
3058
|
+
if (!existingInstructions || existingInstructions.includes(fn.slug)) {
|
|
3059
|
+
selectedFns.add(fn.slug);
|
|
3060
|
+
}
|
|
3061
|
+
const match = existingInstructions.match(new RegExp(`- ${fn.slug}: (.+)`));
|
|
3062
|
+
fnInstr[fn.slug] = match?.[1] ?? fn.defaultInstructions;
|
|
3063
|
+
}
|
|
3064
|
+
state[slug] = { enabled: true, selectedFunctions: selectedFns, functionInstructions: fnInstr };
|
|
3065
|
+
} else {
|
|
3066
|
+
state[slug] = {
|
|
3067
|
+
enabled: false,
|
|
3068
|
+
selectedFunctions: new Set(fns.map((f) => f.slug)),
|
|
3069
|
+
functionInstructions: Object.fromEntries(fns.map((f) => [f.slug, f.defaultInstructions]))
|
|
3070
|
+
};
|
|
3071
|
+
}
|
|
3072
|
+
}
|
|
3073
|
+
setLocalState(state);
|
|
3074
|
+
setServerState(JSON.parse(JSON.stringify(state, (_k, v) => v instanceof Set ? [...v] : v)));
|
|
3075
|
+
setInitialized(true);
|
|
3076
|
+
}, [connectedCards, agentTools, initialized]);
|
|
3077
|
+
const hasChanges = useMemo6(() => {
|
|
3078
|
+
if (!initialized) return false;
|
|
3079
|
+
const localKeys = Object.keys(localState);
|
|
3080
|
+
for (const slug of localKeys) {
|
|
3081
|
+
const local = localState[slug];
|
|
3082
|
+
const server = serverState[slug];
|
|
3083
|
+
if (!server) return true;
|
|
3084
|
+
if (local.enabled !== server.enabled) return true;
|
|
3085
|
+
const serverFns = server.selectedFunctions instanceof Set ? server.selectedFunctions : new Set(server.selectedFunctions);
|
|
3086
|
+
if (local.selectedFunctions.size !== serverFns.size) return true;
|
|
3087
|
+
for (const fn of local.selectedFunctions) {
|
|
3088
|
+
if (!serverFns.has(fn)) return true;
|
|
3089
|
+
}
|
|
3090
|
+
for (const fn of local.selectedFunctions) {
|
|
3091
|
+
if ((local.functionInstructions[fn] ?? "") !== (server.functionInstructions[fn] ?? "")) return true;
|
|
3092
|
+
}
|
|
3093
|
+
}
|
|
3094
|
+
return false;
|
|
3095
|
+
}, [localState, serverState, initialized]);
|
|
3053
3096
|
const handleToggle = useCallback5(
|
|
3054
|
-
|
|
3097
|
+
(card, checked) => {
|
|
3098
|
+
const slug = card.definition.slug;
|
|
3099
|
+
setLocalState((prev) => ({
|
|
3100
|
+
...prev,
|
|
3101
|
+
[slug]: {
|
|
3102
|
+
...prev[slug],
|
|
3103
|
+
enabled: checked
|
|
3104
|
+
}
|
|
3105
|
+
}));
|
|
3055
3106
|
if (checked) {
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3107
|
+
setExpandedCards((prev) => /* @__PURE__ */ new Set([...prev, slug]));
|
|
3108
|
+
}
|
|
3109
|
+
},
|
|
3110
|
+
[]
|
|
3111
|
+
);
|
|
3112
|
+
const handleToggleFunction = useCallback5(
|
|
3113
|
+
(slug, fnSlug, checked) => {
|
|
3114
|
+
setLocalState((prev) => {
|
|
3115
|
+
const current = prev[slug];
|
|
3116
|
+
if (!current) return prev;
|
|
3117
|
+
const fns = new Set(current.selectedFunctions);
|
|
3118
|
+
if (checked) fns.add(fnSlug);
|
|
3119
|
+
else fns.delete(fnSlug);
|
|
3120
|
+
return { ...prev, [slug]: { ...current, selectedFunctions: fns } };
|
|
3121
|
+
});
|
|
3122
|
+
},
|
|
3123
|
+
[]
|
|
3124
|
+
);
|
|
3125
|
+
const handleUpdateInstruction = useCallback5(
|
|
3126
|
+
(slug, fnSlug, instruction) => {
|
|
3127
|
+
setLocalState((prev) => {
|
|
3128
|
+
const current = prev[slug];
|
|
3129
|
+
if (!current) return prev;
|
|
3130
|
+
return {
|
|
3131
|
+
...prev,
|
|
3132
|
+
[slug]: {
|
|
3133
|
+
...current,
|
|
3134
|
+
functionInstructions: { ...current.functionInstructions, [fnSlug]: instruction }
|
|
3135
|
+
}
|
|
3136
|
+
};
|
|
3137
|
+
});
|
|
3138
|
+
},
|
|
3139
|
+
[]
|
|
3140
|
+
);
|
|
3141
|
+
const saveNow = useCallback5(async () => {
|
|
3142
|
+
setIsSaving(true);
|
|
3143
|
+
try {
|
|
3144
|
+
for (const slug of Object.keys(localState)) {
|
|
3145
|
+
const local = localState[slug];
|
|
3146
|
+
const card = connectedCards.find((c) => c.definition.slug === slug);
|
|
3147
|
+
if (!card) continue;
|
|
3148
|
+
const serverEntry = serverState[slug];
|
|
3149
|
+
const wasEnabled = serverEntry?.enabled ?? false;
|
|
3150
|
+
if (local.enabled && !wasEnabled) {
|
|
3151
|
+
let toolId = card.tool?.id;
|
|
3152
|
+
if (!toolId) {
|
|
3153
|
+
const existingTool = allTools.find((t) => t.slug === slug);
|
|
3154
|
+
if (existingTool) {
|
|
3155
|
+
toolId = existingTool.id;
|
|
3156
|
+
} else {
|
|
3063
3157
|
const result = await createTool.mutateAsync({
|
|
3064
3158
|
name: card.definition.name,
|
|
3065
|
-
slug
|
|
3159
|
+
slug,
|
|
3066
3160
|
type: "integration",
|
|
3067
3161
|
description: card.definition.description
|
|
3068
3162
|
});
|
|
3069
3163
|
const d = result?.data;
|
|
3070
3164
|
toolId = (Array.isArray(d) ? d[0]?.id : d?.id) ?? void 0;
|
|
3071
|
-
if (!toolId)
|
|
3072
|
-
console.error("[IntegrationsTab] Failed to create tool \u2014 no ID returned");
|
|
3073
|
-
return;
|
|
3074
|
-
}
|
|
3075
|
-
} catch (err) {
|
|
3076
|
-
console.error("[IntegrationsTab] Error creating tool:", err);
|
|
3077
|
-
return;
|
|
3165
|
+
if (!toolId) continue;
|
|
3078
3166
|
}
|
|
3079
3167
|
}
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
const
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
addAgentTool.mutate({
|
|
3093
|
-
idAgent: agentId,
|
|
3094
|
-
body: {
|
|
3095
|
-
id_tool: toolId,
|
|
3096
|
-
enabled: true,
|
|
3097
|
-
...customInstructions ? { custom_instructions: customInstructions } : {}
|
|
3168
|
+
const customInstructions = buildCustomInstructions(slug, local.selectedFunctions, local.functionInstructions);
|
|
3169
|
+
await addAgentTool.mutateAsync({
|
|
3170
|
+
idAgent: agentId,
|
|
3171
|
+
body: { id_tool: toolId, enabled: true, ...customInstructions ? { custom_instructions: customInstructions } : {} }
|
|
3172
|
+
});
|
|
3173
|
+
} else if (!local.enabled && wasEnabled) {
|
|
3174
|
+
const toolId = card.tool?.id;
|
|
3175
|
+
if (toolId) {
|
|
3176
|
+
const agentTool = agentTools.find((at) => at.id_tool === toolId);
|
|
3177
|
+
if (agentTool) {
|
|
3178
|
+
await removeAgentTool.mutateAsync({ idAgent: agentId, id: agentTool.id });
|
|
3179
|
+
}
|
|
3098
3180
|
}
|
|
3099
|
-
})
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3181
|
+
} else if (local.enabled && wasEnabled) {
|
|
3182
|
+
const toolId = card.tool?.id;
|
|
3183
|
+
if (toolId) {
|
|
3184
|
+
const agentTool = agentTools.find((at) => at.id_tool === toolId);
|
|
3185
|
+
if (agentTool) {
|
|
3186
|
+
const customInstructions = buildCustomInstructions(slug, local.selectedFunctions, local.functionInstructions);
|
|
3187
|
+
await updateAgentTool.mutateAsync({
|
|
3188
|
+
idAgent: agentId,
|
|
3189
|
+
id: agentTool.id,
|
|
3190
|
+
body: { custom_instructions: customInstructions }
|
|
3191
|
+
});
|
|
3192
|
+
}
|
|
3106
3193
|
}
|
|
3107
3194
|
}
|
|
3108
|
-
setExpandedCards((prev) => {
|
|
3109
|
-
const next = new Set(prev);
|
|
3110
|
-
next.delete(card.definition.slug);
|
|
3111
|
-
return next;
|
|
3112
|
-
});
|
|
3113
|
-
setSelectedFunctions((prev) => {
|
|
3114
|
-
const next = { ...prev };
|
|
3115
|
-
delete next[card.definition.slug];
|
|
3116
|
-
return next;
|
|
3117
|
-
});
|
|
3118
|
-
setFunctionInstructions((prev) => {
|
|
3119
|
-
const next = { ...prev };
|
|
3120
|
-
delete next[card.definition.slug];
|
|
3121
|
-
return next;
|
|
3122
|
-
});
|
|
3123
3195
|
}
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
});
|
|
3143
|
-
},
|
|
3144
|
-
[functionInstructions]
|
|
3145
|
-
);
|
|
3146
|
-
const handleUpdateFunctionInstruction = useCallback5(
|
|
3147
|
-
(card, fnSlug, instruction) => {
|
|
3148
|
-
const integrationSlug = card.definition.slug;
|
|
3149
|
-
setFunctionInstructions((prev) => {
|
|
3150
|
-
const current = { ...prev[integrationSlug] ?? {}, [fnSlug]: instruction };
|
|
3151
|
-
const next = { ...prev, [integrationSlug]: current };
|
|
3152
|
-
const selected = selectedFunctions[integrationSlug] ?? /* @__PURE__ */ new Set();
|
|
3153
|
-
const customInstructions = buildCustomInstructions(integrationSlug, selected, current);
|
|
3154
|
-
updateAgentToolInstructions(card, customInstructions);
|
|
3155
|
-
return next;
|
|
3156
|
-
});
|
|
3157
|
-
},
|
|
3158
|
-
[selectedFunctions]
|
|
3159
|
-
);
|
|
3160
|
-
const updateAgentToolInstructions = useCallback5(
|
|
3161
|
-
(card, customInstructions) => {
|
|
3162
|
-
const toolId = card.tool?.id;
|
|
3163
|
-
if (!toolId) return;
|
|
3164
|
-
const agentTool = agentTools.find((at) => at.id_tool === toolId);
|
|
3165
|
-
if (!agentTool) return;
|
|
3166
|
-
updateAgentTool.mutate({
|
|
3167
|
-
idAgent: agentId,
|
|
3168
|
-
id: agentTool.id,
|
|
3169
|
-
body: { custom_instructions: customInstructions }
|
|
3170
|
-
});
|
|
3171
|
-
},
|
|
3172
|
-
[agentTools, agentId, updateAgentTool]
|
|
3173
|
-
);
|
|
3196
|
+
setServerState(JSON.parse(JSON.stringify(localState, (_k, v) => v instanceof Set ? [...v] : v)));
|
|
3197
|
+
toast7.success("Integra\xE7\xF5es salvas");
|
|
3198
|
+
} catch {
|
|
3199
|
+
toast7.error("Erro ao salvar integra\xE7\xF5es");
|
|
3200
|
+
} finally {
|
|
3201
|
+
setIsSaving(false);
|
|
3202
|
+
}
|
|
3203
|
+
}, [localState, serverState, connectedCards, allTools, agentTools, agentId, addAgentTool, removeAgentTool, updateAgentTool, createTool]);
|
|
3204
|
+
const discard = useCallback5(() => {
|
|
3205
|
+
const restored = {};
|
|
3206
|
+
for (const [slug, entry] of Object.entries(serverState)) {
|
|
3207
|
+
restored[slug] = {
|
|
3208
|
+
...entry,
|
|
3209
|
+
selectedFunctions: entry.selectedFunctions instanceof Set ? entry.selectedFunctions : new Set(entry.selectedFunctions)
|
|
3210
|
+
};
|
|
3211
|
+
}
|
|
3212
|
+
setLocalState(restored);
|
|
3213
|
+
}, [serverState]);
|
|
3174
3214
|
if (isLoading || agentToolsLoading) {
|
|
3175
3215
|
return /* @__PURE__ */ jsx11("div", { className: "flex items-center justify-center py-16", children: /* @__PURE__ */ jsx11(Loader25, { className: "h-6 w-6 animate-spin text-muted-foreground" }) });
|
|
3176
3216
|
}
|
|
@@ -3185,13 +3225,13 @@ function IntegrationsTab({
|
|
|
3185
3225
|
/* @__PURE__ */ jsx11("p", { className: "text-xs text-muted-foreground", children: "Ative ou desative as integra\xE7\xF5es conectadas na conta para este agente." }),
|
|
3186
3226
|
/* @__PURE__ */ jsx11("div", { className: "grid grid-cols-1 gap-3", children: connectedCards.map((card) => {
|
|
3187
3227
|
const Icon = resolveIcon(card.definition.icon);
|
|
3188
|
-
const isLinked = card.linkedToAgent;
|
|
3189
|
-
const isMutating = addAgentTool.isPending || removeAgentTool.isPending || createTool.isPending;
|
|
3190
3228
|
const integrationSlug = card.definition.slug;
|
|
3229
|
+
const local = localState[integrationSlug];
|
|
3230
|
+
const isLinked = local?.enabled ?? false;
|
|
3191
3231
|
const fns = INTEGRATION_FUNCTIONS[integrationSlug];
|
|
3192
3232
|
const isExpanded = expandedCards.has(integrationSlug);
|
|
3193
|
-
const selected = selectedFunctions
|
|
3194
|
-
const instructions = functionInstructions
|
|
3233
|
+
const selected = local?.selectedFunctions ?? /* @__PURE__ */ new Set();
|
|
3234
|
+
const instructions = local?.functionInstructions ?? {};
|
|
3195
3235
|
return /* @__PURE__ */ jsxs9(
|
|
3196
3236
|
"div",
|
|
3197
3237
|
{
|
|
@@ -3240,7 +3280,7 @@ function IntegrationsTab({
|
|
|
3240
3280
|
Switch5,
|
|
3241
3281
|
{
|
|
3242
3282
|
checked: isLinked,
|
|
3243
|
-
disabled:
|
|
3283
|
+
disabled: isSaving,
|
|
3244
3284
|
onCheckedChange: (checked) => handleToggle(card, checked),
|
|
3245
3285
|
"aria-label": `${isLinked ? "Desativar" : "Ativar"} ${card.definition.name} para este agente`
|
|
3246
3286
|
}
|
|
@@ -3258,7 +3298,7 @@ function IntegrationsTab({
|
|
|
3258
3298
|
Checkbox2,
|
|
3259
3299
|
{
|
|
3260
3300
|
checked: isSelected,
|
|
3261
|
-
onCheckedChange: (val) => handleToggleFunction(
|
|
3301
|
+
onCheckedChange: (val) => handleToggleFunction(integrationSlug, fn.slug, val === true),
|
|
3262
3302
|
"aria-label": fn.label
|
|
3263
3303
|
}
|
|
3264
3304
|
),
|
|
@@ -3288,7 +3328,7 @@ function IntegrationsTab({
|
|
|
3288
3328
|
{
|
|
3289
3329
|
className: "w-full rounded-md border bg-background px-3 py-2 text-sm resize-y min-h-[60px] focus:outline-none focus:ring-1 focus:ring-ring",
|
|
3290
3330
|
value: currentInstruction,
|
|
3291
|
-
onChange: (e) =>
|
|
3331
|
+
onChange: (e) => handleUpdateInstruction(integrationSlug, fn.slug, e.target.value),
|
|
3292
3332
|
placeholder: "Instru\xE7\xF5es personalizadas para esta fun\xE7\xE3o...",
|
|
3293
3333
|
rows: 2
|
|
3294
3334
|
}
|
|
@@ -3300,7 +3340,17 @@ function IntegrationsTab({
|
|
|
3300
3340
|
},
|
|
3301
3341
|
`${integrationSlug}-cred-${card.credentialId}`
|
|
3302
3342
|
);
|
|
3303
|
-
}) })
|
|
3343
|
+
}) }),
|
|
3344
|
+
hasChanges && /* @__PURE__ */ jsxs9("div", { className: "sticky bottom-0 z-10 flex items-center justify-between gap-2 rounded-lg border bg-background p-3 shadow-sm", children: [
|
|
3345
|
+
/* @__PURE__ */ jsx11("p", { className: "text-sm text-muted-foreground", children: "Voc\xEA tem altera\xE7\xF5es n\xE3o salvas." }),
|
|
3346
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex gap-2", children: [
|
|
3347
|
+
/* @__PURE__ */ jsx11(Button8, { variant: "ghost", size: "sm", onClick: discard, disabled: isSaving, children: "Descartar" }),
|
|
3348
|
+
/* @__PURE__ */ jsxs9(Button8, { size: "sm", onClick: saveNow, disabled: isSaving, children: [
|
|
3349
|
+
isSaving && /* @__PURE__ */ jsx11(Loader25, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
3350
|
+
"Salvar"
|
|
3351
|
+
] })
|
|
3352
|
+
] })
|
|
3353
|
+
] })
|
|
3304
3354
|
] });
|
|
3305
3355
|
}
|
|
3306
3356
|
|
|
@@ -3361,7 +3411,7 @@ import { useState as useState10 } from "react";
|
|
|
3361
3411
|
import {
|
|
3362
3412
|
Switch as Switch6,
|
|
3363
3413
|
Badge as Badge6,
|
|
3364
|
-
Button as
|
|
3414
|
+
Button as Button9,
|
|
3365
3415
|
Skeleton as Skeleton6,
|
|
3366
3416
|
AlertDialog as AlertDialog3,
|
|
3367
3417
|
AlertDialogAction as AlertDialogAction3,
|
|
@@ -3394,7 +3444,7 @@ import {
|
|
|
3394
3444
|
Wrench,
|
|
3395
3445
|
Settings2
|
|
3396
3446
|
} from "lucide-react";
|
|
3397
|
-
import { toast as
|
|
3447
|
+
import { toast as toast8 } from "sonner";
|
|
3398
3448
|
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3399
3449
|
function AgentToolsList({ agent, config }) {
|
|
3400
3450
|
const { data: agentToolsData, isLoading } = useAgentTools(config, agent.id);
|
|
@@ -3431,9 +3481,9 @@ function AgentToolsList({ agent, config }) {
|
|
|
3431
3481
|
id: agentTool.id,
|
|
3432
3482
|
body: { enabled: checked }
|
|
3433
3483
|
});
|
|
3434
|
-
|
|
3484
|
+
toast8.success(checked ? "Ferramenta ativada" : "Ferramenta desativada");
|
|
3435
3485
|
} catch (err) {
|
|
3436
|
-
|
|
3486
|
+
toast8.error(
|
|
3437
3487
|
err instanceof Error ? err.message : "Erro ao alterar estado da ferramenta"
|
|
3438
3488
|
);
|
|
3439
3489
|
}
|
|
@@ -3444,11 +3494,11 @@ function AgentToolsList({ agent, config }) {
|
|
|
3444
3494
|
idAgent: agent.id,
|
|
3445
3495
|
body: { id_tool: tool.id }
|
|
3446
3496
|
});
|
|
3447
|
-
|
|
3497
|
+
toast8.success("Ferramenta adicionada");
|
|
3448
3498
|
setAddOpen(false);
|
|
3449
3499
|
setSearch("");
|
|
3450
3500
|
} catch (err) {
|
|
3451
|
-
|
|
3501
|
+
toast8.error(
|
|
3452
3502
|
err instanceof Error ? err.message : "Erro ao adicionar ferramenta"
|
|
3453
3503
|
);
|
|
3454
3504
|
}
|
|
@@ -3460,9 +3510,9 @@ function AgentToolsList({ agent, config }) {
|
|
|
3460
3510
|
idAgent: agent.id,
|
|
3461
3511
|
id: removeTarget.id
|
|
3462
3512
|
});
|
|
3463
|
-
|
|
3513
|
+
toast8.success("Ferramenta removida");
|
|
3464
3514
|
} catch (err) {
|
|
3465
|
-
|
|
3515
|
+
toast8.error(
|
|
3466
3516
|
err instanceof Error ? err.message : "Erro ao remover ferramenta"
|
|
3467
3517
|
);
|
|
3468
3518
|
} finally {
|
|
@@ -3486,10 +3536,10 @@ function AgentToolsList({ agent, config }) {
|
|
|
3486
3536
|
id_tool_credential: newCredentialId
|
|
3487
3537
|
}
|
|
3488
3538
|
});
|
|
3489
|
-
|
|
3539
|
+
toast8.success("Configura\xE7\xE3o atualizada");
|
|
3490
3540
|
setConfigTarget(null);
|
|
3491
3541
|
} catch (err) {
|
|
3492
|
-
|
|
3542
|
+
toast8.error(
|
|
3493
3543
|
err instanceof Error ? err.message : "Erro ao atualizar configura\xE7\xE3o"
|
|
3494
3544
|
);
|
|
3495
3545
|
}
|
|
@@ -3507,7 +3557,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
3507
3557
|
visibleAgentTools.length !== 1 ? "s" : ""
|
|
3508
3558
|
] }),
|
|
3509
3559
|
/* @__PURE__ */ jsxs11(Popover, { open: addOpen, onOpenChange: setAddOpen, children: [
|
|
3510
|
-
/* @__PURE__ */ jsx13(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs11(
|
|
3560
|
+
/* @__PURE__ */ jsx13(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs11(Button9, { size: "sm", disabled: availableTools.length === 0, children: [
|
|
3511
3561
|
/* @__PURE__ */ jsx13(Plus2, { className: "mr-2 h-4 w-4" }),
|
|
3512
3562
|
"Adicionar Ferramenta"
|
|
3513
3563
|
] }) }),
|
|
@@ -3568,7 +3618,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
3568
3618
|
}
|
|
3569
3619
|
),
|
|
3570
3620
|
/* @__PURE__ */ jsx13(
|
|
3571
|
-
|
|
3621
|
+
Button9,
|
|
3572
3622
|
{
|
|
3573
3623
|
variant: "ghost",
|
|
3574
3624
|
size: "icon",
|
|
@@ -3580,7 +3630,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
3580
3630
|
}
|
|
3581
3631
|
),
|
|
3582
3632
|
/* @__PURE__ */ jsx13(
|
|
3583
|
-
|
|
3633
|
+
Button9,
|
|
3584
3634
|
{
|
|
3585
3635
|
variant: "ghost",
|
|
3586
3636
|
size: "icon",
|
|
@@ -3639,7 +3689,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
3639
3689
|
] }),
|
|
3640
3690
|
/* @__PURE__ */ jsxs11(DialogFooter4, { children: [
|
|
3641
3691
|
/* @__PURE__ */ jsx13(
|
|
3642
|
-
|
|
3692
|
+
Button9,
|
|
3643
3693
|
{
|
|
3644
3694
|
variant: "outline",
|
|
3645
3695
|
onClick: () => setConfigTarget(null),
|
|
@@ -3647,7 +3697,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
3647
3697
|
}
|
|
3648
3698
|
),
|
|
3649
3699
|
/* @__PURE__ */ jsx13(
|
|
3650
|
-
|
|
3700
|
+
Button9,
|
|
3651
3701
|
{
|
|
3652
3702
|
onClick: handleSaveConfig,
|
|
3653
3703
|
disabled: updateMutation.isPending,
|
|
@@ -3686,7 +3736,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
3686
3736
|
}
|
|
3687
3737
|
|
|
3688
3738
|
// src/components/tools/tools-table.tsx
|
|
3689
|
-
import { useMemo as
|
|
3739
|
+
import { useMemo as useMemo7, useState as useState11 } from "react";
|
|
3690
3740
|
import { DataTable as DataTable2 } from "@greatapps/greatauth-ui";
|
|
3691
3741
|
import {
|
|
3692
3742
|
Input as Input7,
|
|
@@ -3702,12 +3752,12 @@ import {
|
|
|
3702
3752
|
AlertDialogFooter as AlertDialogFooter4,
|
|
3703
3753
|
AlertDialogHeader as AlertDialogHeader4,
|
|
3704
3754
|
AlertDialogTitle as AlertDialogTitle4,
|
|
3705
|
-
Button as
|
|
3755
|
+
Button as Button10
|
|
3706
3756
|
} from "@greatapps/greatauth-ui/ui";
|
|
3707
3757
|
import { Pencil as Pencil5, Trash2 as Trash24, Search as Search2 } from "lucide-react";
|
|
3708
3758
|
import { format as format2 } from "date-fns";
|
|
3709
3759
|
import { ptBR as ptBR2 } from "date-fns/locale";
|
|
3710
|
-
import { toast as
|
|
3760
|
+
import { toast as toast9 } from "sonner";
|
|
3711
3761
|
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3712
3762
|
function useColumns2(onEdit, onDelete) {
|
|
3713
3763
|
return [
|
|
@@ -3750,7 +3800,7 @@ function useColumns2(onEdit, onDelete) {
|
|
|
3750
3800
|
cell: ({ row }) => /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
|
|
3751
3801
|
/* @__PURE__ */ jsxs12(Tooltip3, { children: [
|
|
3752
3802
|
/* @__PURE__ */ jsx14(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx14(
|
|
3753
|
-
|
|
3803
|
+
Button10,
|
|
3754
3804
|
{
|
|
3755
3805
|
variant: "ghost",
|
|
3756
3806
|
size: "icon",
|
|
@@ -3764,7 +3814,7 @@ function useColumns2(onEdit, onDelete) {
|
|
|
3764
3814
|
] }),
|
|
3765
3815
|
/* @__PURE__ */ jsxs12(Tooltip3, { children: [
|
|
3766
3816
|
/* @__PURE__ */ jsx14(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx14(
|
|
3767
|
-
|
|
3817
|
+
Button10,
|
|
3768
3818
|
{
|
|
3769
3819
|
variant: "ghost",
|
|
3770
3820
|
size: "icon",
|
|
@@ -3783,7 +3833,7 @@ function useColumns2(onEdit, onDelete) {
|
|
|
3783
3833
|
function ToolsTable({ onEdit, config }) {
|
|
3784
3834
|
const [search, setSearch] = useState11("");
|
|
3785
3835
|
const [page, setPage] = useState11(1);
|
|
3786
|
-
const queryParams =
|
|
3836
|
+
const queryParams = useMemo7(() => {
|
|
3787
3837
|
const params = {
|
|
3788
3838
|
limit: "15",
|
|
3789
3839
|
page: String(page)
|
|
@@ -3807,10 +3857,10 @@ function ToolsTable({ onEdit, config }) {
|
|
|
3807
3857
|
if (!deleteId) return;
|
|
3808
3858
|
deleteTool.mutate(deleteId, {
|
|
3809
3859
|
onSuccess: () => {
|
|
3810
|
-
|
|
3860
|
+
toast9.success("Ferramenta exclu\xEDda");
|
|
3811
3861
|
setDeleteId(null);
|
|
3812
3862
|
},
|
|
3813
|
-
onError: () =>
|
|
3863
|
+
onError: () => toast9.error("Erro ao excluir ferramenta")
|
|
3814
3864
|
});
|
|
3815
3865
|
}
|
|
3816
3866
|
function handleSearchChange(value) {
|
|
@@ -3883,7 +3933,7 @@ import {
|
|
|
3883
3933
|
DialogHeader as DialogHeader5,
|
|
3884
3934
|
DialogTitle as DialogTitle5,
|
|
3885
3935
|
DialogFooter as DialogFooter5,
|
|
3886
|
-
Button as
|
|
3936
|
+
Button as Button11,
|
|
3887
3937
|
Input as Input8,
|
|
3888
3938
|
Textarea as Textarea3,
|
|
3889
3939
|
Label as Label5,
|
|
@@ -3894,7 +3944,7 @@ import {
|
|
|
3894
3944
|
SelectValue as SelectValue2
|
|
3895
3945
|
} from "@greatapps/greatauth-ui/ui";
|
|
3896
3946
|
import { Loader2 as Loader26 } from "lucide-react";
|
|
3897
|
-
import { toast as
|
|
3947
|
+
import { toast as toast10 } from "sonner";
|
|
3898
3948
|
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3899
3949
|
var TOOL_AUTH_TYPES = [
|
|
3900
3950
|
{ value: "none", label: "Nenhuma" },
|
|
@@ -3991,16 +4041,16 @@ function ToolFormDialog({
|
|
|
3991
4041
|
try {
|
|
3992
4042
|
if (isEditing) {
|
|
3993
4043
|
await updateTool.mutateAsync({ id: tool.id, body });
|
|
3994
|
-
|
|
4044
|
+
toast10.success("Ferramenta atualizada");
|
|
3995
4045
|
} else {
|
|
3996
4046
|
await createTool.mutateAsync(
|
|
3997
4047
|
body
|
|
3998
4048
|
);
|
|
3999
|
-
|
|
4049
|
+
toast10.success("Ferramenta criada");
|
|
4000
4050
|
}
|
|
4001
4051
|
onOpenChange(false);
|
|
4002
4052
|
} catch (err) {
|
|
4003
|
-
|
|
4053
|
+
toast10.error(
|
|
4004
4054
|
err instanceof Error ? err.message : isEditing ? "Erro ao atualizar ferramenta" : "Erro ao criar ferramenta"
|
|
4005
4055
|
);
|
|
4006
4056
|
}
|
|
@@ -4131,7 +4181,7 @@ function ToolFormDialog({
|
|
|
4131
4181
|
] }),
|
|
4132
4182
|
/* @__PURE__ */ jsxs13(DialogFooter5, { children: [
|
|
4133
4183
|
/* @__PURE__ */ jsx15(
|
|
4134
|
-
|
|
4184
|
+
Button11,
|
|
4135
4185
|
{
|
|
4136
4186
|
type: "button",
|
|
4137
4187
|
variant: "outline",
|
|
@@ -4140,7 +4190,7 @@ function ToolFormDialog({
|
|
|
4140
4190
|
children: "Cancelar"
|
|
4141
4191
|
}
|
|
4142
4192
|
),
|
|
4143
|
-
/* @__PURE__ */ jsxs13(
|
|
4193
|
+
/* @__PURE__ */ jsxs13(Button11, { type: "submit", disabled: isPending, children: [
|
|
4144
4194
|
isPending ? /* @__PURE__ */ jsx15(Loader26, { "aria-hidden": "true", className: "mr-2 h-4 w-4 animate-spin" }) : null,
|
|
4145
4195
|
isEditing ? "Salvar" : "Criar"
|
|
4146
4196
|
] })
|
|
@@ -4150,11 +4200,11 @@ function ToolFormDialog({
|
|
|
4150
4200
|
}
|
|
4151
4201
|
|
|
4152
4202
|
// src/components/tools/tool-credentials-form.tsx
|
|
4153
|
-
import { useMemo as
|
|
4203
|
+
import { useMemo as useMemo8, useState as useState13 } from "react";
|
|
4154
4204
|
import { DataTable as DataTable3 } from "@greatapps/greatauth-ui";
|
|
4155
4205
|
import {
|
|
4156
4206
|
Input as Input9,
|
|
4157
|
-
Button as
|
|
4207
|
+
Button as Button12,
|
|
4158
4208
|
Badge as Badge8,
|
|
4159
4209
|
Tooltip as Tooltip4,
|
|
4160
4210
|
TooltipTrigger as TooltipTrigger4,
|
|
@@ -4171,7 +4221,7 @@ import {
|
|
|
4171
4221
|
import { Trash2 as Trash25, Search as Search3 } from "lucide-react";
|
|
4172
4222
|
import { format as format3 } from "date-fns";
|
|
4173
4223
|
import { ptBR as ptBR3 } from "date-fns/locale";
|
|
4174
|
-
import { toast as
|
|
4224
|
+
import { toast as toast11 } from "sonner";
|
|
4175
4225
|
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4176
4226
|
function formatDate2(dateStr) {
|
|
4177
4227
|
if (!dateStr) return "Sem expira\xE7\xE3o";
|
|
@@ -4222,7 +4272,7 @@ function useColumns3(tools, onRemove) {
|
|
|
4222
4272
|
enableSorting: false,
|
|
4223
4273
|
cell: ({ row }) => /* @__PURE__ */ jsx16("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxs14(Tooltip4, { children: [
|
|
4224
4274
|
/* @__PURE__ */ jsx16(TooltipTrigger4, { asChild: true, children: /* @__PURE__ */ jsx16(
|
|
4225
|
-
|
|
4275
|
+
Button12,
|
|
4226
4276
|
{
|
|
4227
4277
|
variant: "ghost",
|
|
4228
4278
|
size: "icon",
|
|
@@ -4248,13 +4298,13 @@ function ToolCredentialsForm({
|
|
|
4248
4298
|
const tools = (toolsData?.data || []).filter((t) => !t.slug?.startsWith("gclinic_"));
|
|
4249
4299
|
const [search, setSearch] = useState13("");
|
|
4250
4300
|
const [removeTarget, setRemoveTarget] = useState13(null);
|
|
4251
|
-
const internalToolIds =
|
|
4301
|
+
const internalToolIds = useMemo8(() => {
|
|
4252
4302
|
const allRawTools = toolsData?.data || [];
|
|
4253
4303
|
return new Set(
|
|
4254
4304
|
allRawTools.filter((t) => t.slug?.startsWith("gclinic_")).map((t) => t.id)
|
|
4255
4305
|
);
|
|
4256
4306
|
}, [toolsData]);
|
|
4257
|
-
const filteredCredentials =
|
|
4307
|
+
const filteredCredentials = useMemo8(() => {
|
|
4258
4308
|
const visible = credentials.filter(
|
|
4259
4309
|
(cred) => !cred.id_tool || !internalToolIds.has(cred.id_tool)
|
|
4260
4310
|
);
|
|
@@ -4274,12 +4324,12 @@ function ToolCredentialsForm({
|
|
|
4274
4324
|
try {
|
|
4275
4325
|
const result = await deleteMutation.mutateAsync(removeTarget.id);
|
|
4276
4326
|
if (result.status === 1) {
|
|
4277
|
-
|
|
4327
|
+
toast11.success("Credencial removida");
|
|
4278
4328
|
} else {
|
|
4279
|
-
|
|
4329
|
+
toast11.error(result.message || "Erro ao remover credencial");
|
|
4280
4330
|
}
|
|
4281
4331
|
} catch {
|
|
4282
|
-
|
|
4332
|
+
toast11.error("Erro ao remover credencial");
|
|
4283
4333
|
} finally {
|
|
4284
4334
|
setRemoveTarget(null);
|
|
4285
4335
|
}
|
|
@@ -4340,7 +4390,7 @@ function ToolCredentialsForm({
|
|
|
4340
4390
|
import { useState as useState14 } from "react";
|
|
4341
4391
|
import {
|
|
4342
4392
|
Badge as Badge9,
|
|
4343
|
-
Button as
|
|
4393
|
+
Button as Button13,
|
|
4344
4394
|
DropdownMenu,
|
|
4345
4395
|
DropdownMenuContent,
|
|
4346
4396
|
DropdownMenuItem,
|
|
@@ -4433,7 +4483,7 @@ function IntegrationCard({
|
|
|
4433
4483
|
] })
|
|
4434
4484
|
] }),
|
|
4435
4485
|
/* @__PURE__ */ jsx17("div", { className: "mt-auto flex items-center justify-end pt-1", children: /* @__PURE__ */ jsx17(
|
|
4436
|
-
|
|
4486
|
+
Button13,
|
|
4437
4487
|
{
|
|
4438
4488
|
variant: "outline",
|
|
4439
4489
|
size: "sm",
|
|
@@ -4488,7 +4538,7 @@ function IntegrationCard({
|
|
|
4488
4538
|
] }),
|
|
4489
4539
|
/* @__PURE__ */ jsx17("div", { className: "mt-auto flex items-center justify-end gap-2 pt-1", children: /* @__PURE__ */ jsxs15(DropdownMenu, { children: [
|
|
4490
4540
|
/* @__PURE__ */ jsx17(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs15(
|
|
4491
|
-
|
|
4541
|
+
Button13,
|
|
4492
4542
|
{
|
|
4493
4543
|
variant: "outline",
|
|
4494
4544
|
size: "sm",
|
|
@@ -4610,17 +4660,17 @@ function AdvancedTab({ config, agentId, gagentsApiUrl }) {
|
|
|
4610
4660
|
}
|
|
4611
4661
|
|
|
4612
4662
|
// src/components/capabilities/integration-wizard.tsx
|
|
4613
|
-
import { useCallback as useCallback6, useEffect as
|
|
4663
|
+
import { useCallback as useCallback6, useEffect as useEffect6, useRef as useRef2, useState as useState16 } from "react";
|
|
4614
4664
|
import {
|
|
4615
4665
|
Dialog as Dialog6,
|
|
4616
4666
|
DialogContent as DialogContent6,
|
|
4617
4667
|
DialogFooter as DialogFooter6,
|
|
4618
4668
|
DialogHeader as DialogHeader6,
|
|
4619
4669
|
DialogTitle as DialogTitle6,
|
|
4620
|
-
Button as
|
|
4670
|
+
Button as Button15
|
|
4621
4671
|
} from "@greatapps/greatauth-ui/ui";
|
|
4622
4672
|
import { Loader2 as Loader29, ChevronLeft, ChevronRight, Check as Check2 } from "lucide-react";
|
|
4623
|
-
import { toast as
|
|
4673
|
+
import { toast as toast12 } from "sonner";
|
|
4624
4674
|
|
|
4625
4675
|
// src/components/capabilities/wizard-steps/info-step.tsx
|
|
4626
4676
|
import { Check, Info as Info2 } from "lucide-react";
|
|
@@ -4679,7 +4729,7 @@ function InfoStep({ integration, meta }) {
|
|
|
4679
4729
|
|
|
4680
4730
|
// src/components/capabilities/wizard-steps/credentials-step.tsx
|
|
4681
4731
|
import { CheckCircle2, Loader2 as Loader27, AlertCircle, Shield } from "lucide-react";
|
|
4682
|
-
import { Button as
|
|
4732
|
+
import { Button as Button14, Input as Input10, Label as Label6 } from "@greatapps/greatauth-ui/ui";
|
|
4683
4733
|
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4684
4734
|
function CredentialsStep({
|
|
4685
4735
|
integration,
|
|
@@ -4722,7 +4772,7 @@ function OAuthCredentials({
|
|
|
4722
4772
|
] }),
|
|
4723
4773
|
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col items-center gap-4 rounded-lg border p-6", children: [
|
|
4724
4774
|
oauthStatus === "idle" && /* @__PURE__ */ jsxs18(
|
|
4725
|
-
|
|
4775
|
+
Button14,
|
|
4726
4776
|
{
|
|
4727
4777
|
onClick: onStartOAuth,
|
|
4728
4778
|
size: "lg",
|
|
@@ -4771,7 +4821,7 @@ function OAuthCredentials({
|
|
|
4771
4821
|
/* @__PURE__ */ jsx20("p", { className: "text-sm font-medium text-destructive", children: "Falha na conex\xE3o" }),
|
|
4772
4822
|
oauthResult?.error && /* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground", children: oauthResult.error })
|
|
4773
4823
|
] }),
|
|
4774
|
-
/* @__PURE__ */ jsx20(
|
|
4824
|
+
/* @__PURE__ */ jsx20(Button14, { variant: "outline", onClick: onStartOAuth, size: "sm", children: "Tentar novamente" })
|
|
4775
4825
|
] })
|
|
4776
4826
|
] }),
|
|
4777
4827
|
/* @__PURE__ */ jsxs18("div", { className: "flex items-start gap-2 rounded-md bg-muted/50 p-3", children: [
|
|
@@ -5024,14 +5074,14 @@ function IntegrationWizard({
|
|
|
5024
5074
|
const [selectedConfigValue, setSelectedConfigValue] = useState16("");
|
|
5025
5075
|
const [enableOnComplete, setEnableOnComplete] = useState16(true);
|
|
5026
5076
|
const [isSubmitting, setIsSubmitting] = useState16(false);
|
|
5027
|
-
|
|
5077
|
+
useEffect6(() => {
|
|
5028
5078
|
return () => {
|
|
5029
5079
|
if (popupPollRef.current) {
|
|
5030
5080
|
clearInterval(popupPollRef.current);
|
|
5031
5081
|
}
|
|
5032
5082
|
};
|
|
5033
5083
|
}, []);
|
|
5034
|
-
|
|
5084
|
+
useEffect6(() => {
|
|
5035
5085
|
if (open) {
|
|
5036
5086
|
setCurrentStep("info");
|
|
5037
5087
|
setOauthStatus("idle");
|
|
@@ -5092,7 +5142,7 @@ function IntegrationWizard({
|
|
|
5092
5142
|
},
|
|
5093
5143
|
[gagentsApiUrl, existingCredentialId, meta.hasConfigStep, loadConfigOptions]
|
|
5094
5144
|
);
|
|
5095
|
-
|
|
5145
|
+
useEffect6(() => {
|
|
5096
5146
|
if (!open) return;
|
|
5097
5147
|
window.addEventListener("message", handleOAuthMessage);
|
|
5098
5148
|
return () => window.removeEventListener("message", handleOAuthMessage);
|
|
@@ -5192,11 +5242,11 @@ function IntegrationWizard({
|
|
|
5192
5242
|
setIsSubmitting(true);
|
|
5193
5243
|
try {
|
|
5194
5244
|
onComplete();
|
|
5195
|
-
|
|
5245
|
+
toast12.success(
|
|
5196
5246
|
`${integration.name} ${isReconnect ? "reconectado" : "configurado"} com sucesso!`
|
|
5197
5247
|
);
|
|
5198
5248
|
} catch {
|
|
5199
|
-
|
|
5249
|
+
toast12.error("Erro ao finalizar configura\xE7\xE3o");
|
|
5200
5250
|
} finally {
|
|
5201
5251
|
setIsSubmitting(false);
|
|
5202
5252
|
}
|
|
@@ -5251,7 +5301,7 @@ function IntegrationWizard({
|
|
|
5251
5301
|
] }),
|
|
5252
5302
|
/* @__PURE__ */ jsxs21(DialogFooter6, { className: "flex-row justify-between sm:justify-between", children: [
|
|
5253
5303
|
/* @__PURE__ */ jsx23("div", { children: currentStep === "info" ? /* @__PURE__ */ jsx23(
|
|
5254
|
-
|
|
5304
|
+
Button15,
|
|
5255
5305
|
{
|
|
5256
5306
|
type: "button",
|
|
5257
5307
|
variant: "outline",
|
|
@@ -5259,7 +5309,7 @@ function IntegrationWizard({
|
|
|
5259
5309
|
children: "Cancelar"
|
|
5260
5310
|
}
|
|
5261
5311
|
) : /* @__PURE__ */ jsxs21(
|
|
5262
|
-
|
|
5312
|
+
Button15,
|
|
5263
5313
|
{
|
|
5264
5314
|
type: "button",
|
|
5265
5315
|
variant: "outline",
|
|
@@ -5272,7 +5322,7 @@ function IntegrationWizard({
|
|
|
5272
5322
|
}
|
|
5273
5323
|
) }),
|
|
5274
5324
|
/* @__PURE__ */ jsx23("div", { children: isLastStep ? /* @__PURE__ */ jsxs21(
|
|
5275
|
-
|
|
5325
|
+
Button15,
|
|
5276
5326
|
{
|
|
5277
5327
|
type: "button",
|
|
5278
5328
|
onClick: handleComplete,
|
|
@@ -5290,7 +5340,7 @@ function IntegrationWizard({
|
|
|
5290
5340
|
]
|
|
5291
5341
|
}
|
|
5292
5342
|
) : /* @__PURE__ */ jsxs21(
|
|
5293
|
-
|
|
5343
|
+
Button15,
|
|
5294
5344
|
{
|
|
5295
5345
|
type: "button",
|
|
5296
5346
|
onClick: goNext,
|
|
@@ -5360,7 +5410,7 @@ function StepIndicator({
|
|
|
5360
5410
|
|
|
5361
5411
|
// src/pages/agents-page.tsx
|
|
5362
5412
|
import { useState as useState17 } from "react";
|
|
5363
|
-
import { Button as
|
|
5413
|
+
import { Button as Button16 } from "@greatapps/greatauth-ui/ui";
|
|
5364
5414
|
import { Plus as Plus4 } from "lucide-react";
|
|
5365
5415
|
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5366
5416
|
function AgentsPage({
|
|
@@ -5376,7 +5426,7 @@ function AgentsPage({
|
|
|
5376
5426
|
/* @__PURE__ */ jsx24("h1", { className: "text-xl font-semibold", children: title }),
|
|
5377
5427
|
/* @__PURE__ */ jsx24("p", { className: "text-sm text-muted-foreground", children: subtitle })
|
|
5378
5428
|
] }),
|
|
5379
|
-
/* @__PURE__ */ jsxs22(
|
|
5429
|
+
/* @__PURE__ */ jsxs22(Button16, { onClick: () => setCreateOpen(true), size: "sm", children: [
|
|
5380
5430
|
/* @__PURE__ */ jsx24(Plus4, { className: "mr-2 h-4 w-4" }),
|
|
5381
5431
|
"Novo Agente"
|
|
5382
5432
|
] })
|
|
@@ -5395,7 +5445,7 @@ function AgentsPage({
|
|
|
5395
5445
|
|
|
5396
5446
|
// src/pages/agent-detail-page.tsx
|
|
5397
5447
|
import { useState as useState18 } from "react";
|
|
5398
|
-
import { Badge as Badge10, Button as
|
|
5448
|
+
import { Badge as Badge10, Button as Button17, Skeleton as Skeleton7 } from "@greatapps/greatauth-ui/ui";
|
|
5399
5449
|
import { EntityAvatar as EntityAvatar2 } from "@greatapps/greatauth-ui";
|
|
5400
5450
|
import { ArrowLeft, Pencil as Pencil6 } from "lucide-react";
|
|
5401
5451
|
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
@@ -5418,7 +5468,7 @@ function AgentDetailPage({
|
|
|
5418
5468
|
if (!agent) {
|
|
5419
5469
|
return /* @__PURE__ */ jsxs23("div", { className: "flex flex-col items-center justify-center gap-2 p-8", children: [
|
|
5420
5470
|
/* @__PURE__ */ jsx25("p", { className: "text-muted-foreground", children: "Agente n\xE3o encontrado" }),
|
|
5421
|
-
onBack && /* @__PURE__ */ jsxs23(
|
|
5471
|
+
onBack && /* @__PURE__ */ jsxs23(Button17, { variant: "ghost", size: "sm", onClick: onBack, children: [
|
|
5422
5472
|
/* @__PURE__ */ jsx25(ArrowLeft, { className: "mr-2 h-4 w-4" }),
|
|
5423
5473
|
"Voltar para agentes"
|
|
5424
5474
|
] })
|
|
@@ -5428,7 +5478,7 @@ function AgentDetailPage({
|
|
|
5428
5478
|
/* @__PURE__ */ jsx25("div", { className: "rounded-lg border p-4 md:p-6", children: /* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-4 md:flex-row md:items-start md:gap-6", children: [
|
|
5429
5479
|
/* @__PURE__ */ jsxs23("div", { className: "flex items-start gap-3 flex-1", children: [
|
|
5430
5480
|
onBack && /* @__PURE__ */ jsx25(
|
|
5431
|
-
|
|
5481
|
+
Button17,
|
|
5432
5482
|
{
|
|
5433
5483
|
variant: "ghost",
|
|
5434
5484
|
size: "icon",
|
|
@@ -5452,7 +5502,7 @@ function AgentDetailPage({
|
|
|
5452
5502
|
] }) })
|
|
5453
5503
|
] }),
|
|
5454
5504
|
/* @__PURE__ */ jsxs23(
|
|
5455
|
-
|
|
5505
|
+
Button17,
|
|
5456
5506
|
{
|
|
5457
5507
|
variant: "outline",
|
|
5458
5508
|
size: "sm",
|
|
@@ -5536,7 +5586,7 @@ function AgentCapabilitiesPage({
|
|
|
5536
5586
|
|
|
5537
5587
|
// src/pages/tools-page.tsx
|
|
5538
5588
|
import { useState as useState19 } from "react";
|
|
5539
|
-
import { Button as
|
|
5589
|
+
import { Button as Button18 } from "@greatapps/greatauth-ui/ui";
|
|
5540
5590
|
import { Plus as Plus5 } from "lucide-react";
|
|
5541
5591
|
import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5542
5592
|
function ToolsPage({
|
|
@@ -5552,7 +5602,7 @@ function ToolsPage({
|
|
|
5552
5602
|
/* @__PURE__ */ jsx27("h1", { className: "text-xl font-semibold", children: title }),
|
|
5553
5603
|
/* @__PURE__ */ jsx27("p", { className: "text-sm text-muted-foreground", children: subtitle })
|
|
5554
5604
|
] }),
|
|
5555
|
-
/* @__PURE__ */ jsxs25(
|
|
5605
|
+
/* @__PURE__ */ jsxs25(Button18, { onClick: () => setCreateOpen(true), size: "sm", children: [
|
|
5556
5606
|
/* @__PURE__ */ jsx27(Plus5, { className: "mr-2 h-4 w-4" }),
|
|
5557
5607
|
"Nova Ferramenta"
|
|
5558
5608
|
] })
|