@greatapps/greatagents-ui 0.3.18 → 0.3.20
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
CHANGED
|
@@ -2033,9 +2033,15 @@ function buildPreview(promptText, objectives, agentTools, allTools) {
|
|
|
2033
2033
|
}
|
|
2034
2034
|
}
|
|
2035
2035
|
const toolBindings = enabledAgentTools.map((at) => ({ at, tool: toolMap.get(at.id_tool) })).filter((x) => !!x.tool);
|
|
2036
|
-
|
|
2036
|
+
const seenToolIds = /* @__PURE__ */ new Set();
|
|
2037
|
+
const dedupedBindings = toolBindings.filter(({ at }) => {
|
|
2038
|
+
if (seenToolIds.has(at.id_tool)) return false;
|
|
2039
|
+
seenToolIds.add(at.id_tool);
|
|
2040
|
+
return true;
|
|
2041
|
+
});
|
|
2042
|
+
if (dedupedBindings.length > 0) {
|
|
2037
2043
|
preview += "\n\n[TOOLS]";
|
|
2038
|
-
for (const { at, tool } of
|
|
2044
|
+
for (const { at, tool } of dedupedBindings) {
|
|
2039
2045
|
if (at.custom_instructions) {
|
|
2040
2046
|
preview += `
|
|
2041
2047
|
|
|
@@ -2986,9 +2992,10 @@ function ModuleRow({
|
|
|
2986
2992
|
}
|
|
2987
2993
|
|
|
2988
2994
|
// 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";
|
|
2995
|
+
import { useCallback as useCallback5, useState as useState9, useEffect as useEffect5, useMemo as useMemo6 } from "react";
|
|
2996
|
+
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
2997
|
import { Plug, Loader2 as Loader25, ChevronDown as ChevronDown3, Pencil as Pencil4 } from "lucide-react";
|
|
2998
|
+
import { toast as toast7 } from "sonner";
|
|
2992
2999
|
import { CalendarSync } from "lucide-react";
|
|
2993
3000
|
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2994
3001
|
var ICON_MAP = {
|
|
@@ -3031,146 +3038,185 @@ function IntegrationsTab({
|
|
|
3031
3038
|
const createTool = useCreateTool(config);
|
|
3032
3039
|
const agentTools = agentToolsData?.data ?? [];
|
|
3033
3040
|
const allTools = toolsData?.data ?? [];
|
|
3034
|
-
const [
|
|
3035
|
-
const [
|
|
3041
|
+
const [localState, setLocalState] = useState9({});
|
|
3042
|
+
const [serverState, setServerState] = useState9({});
|
|
3043
|
+
const [initialized, setInitialized] = useState9(false);
|
|
3044
|
+
const [isSaving, setIsSaving] = useState9(false);
|
|
3036
3045
|
const [editingFunction, setEditingFunction] = useState9(null);
|
|
3037
3046
|
const [expandedCards, setExpandedCards] = useState9(/* @__PURE__ */ new Set());
|
|
3038
3047
|
const connectedCards = cards.filter(
|
|
3039
3048
|
(c) => !c.isAddNew && (c.state === "connected" || c.state === "expired")
|
|
3040
3049
|
);
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3050
|
+
useEffect5(() => {
|
|
3051
|
+
if (!connectedCards.length || initialized) return;
|
|
3052
|
+
const state = {};
|
|
3053
|
+
for (const card of connectedCards) {
|
|
3054
|
+
const slug = card.definition.slug;
|
|
3055
|
+
const isLinked = card.linkedToAgent;
|
|
3056
|
+
const fns = INTEGRATION_FUNCTIONS[slug] ?? [];
|
|
3057
|
+
if (isLinked) {
|
|
3058
|
+
const toolId = card.tool?.id;
|
|
3059
|
+
const agentTool = toolId ? agentTools.find((at) => at.id_tool === toolId) : null;
|
|
3060
|
+
const existingInstructions = agentTool?.custom_instructions || "";
|
|
3061
|
+
const selectedFns = /* @__PURE__ */ new Set();
|
|
3062
|
+
const fnInstr = {};
|
|
3063
|
+
for (const fn of fns) {
|
|
3064
|
+
if (!existingInstructions || existingInstructions.includes(fn.slug)) {
|
|
3065
|
+
selectedFns.add(fn.slug);
|
|
3066
|
+
}
|
|
3067
|
+
const match = existingInstructions.match(new RegExp(`- ${fn.slug}: (.+)`));
|
|
3068
|
+
fnInstr[fn.slug] = match?.[1] ?? fn.defaultInstructions;
|
|
3069
|
+
}
|
|
3070
|
+
state[slug] = { enabled: true, selectedFunctions: selectedFns, functionInstructions: fnInstr };
|
|
3071
|
+
} else {
|
|
3072
|
+
state[slug] = {
|
|
3073
|
+
enabled: false,
|
|
3074
|
+
selectedFunctions: new Set(fns.map((f) => f.slug)),
|
|
3075
|
+
functionInstructions: Object.fromEntries(fns.map((f) => [f.slug, f.defaultInstructions]))
|
|
3076
|
+
};
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
3079
|
+
setLocalState(state);
|
|
3080
|
+
setServerState(JSON.parse(JSON.stringify(state, (_k, v) => v instanceof Set ? [...v] : v)));
|
|
3081
|
+
setInitialized(true);
|
|
3082
|
+
}, [connectedCards, agentTools, initialized]);
|
|
3083
|
+
const hasChanges = useMemo6(() => {
|
|
3084
|
+
if (!initialized) return false;
|
|
3085
|
+
const localKeys = Object.keys(localState);
|
|
3086
|
+
for (const slug of localKeys) {
|
|
3087
|
+
const local = localState[slug];
|
|
3088
|
+
const server = serverState[slug];
|
|
3089
|
+
if (!server) return true;
|
|
3090
|
+
if (local.enabled !== server.enabled) return true;
|
|
3091
|
+
const serverFns = server.selectedFunctions instanceof Set ? server.selectedFunctions : new Set(server.selectedFunctions);
|
|
3092
|
+
if (local.selectedFunctions.size !== serverFns.size) return true;
|
|
3093
|
+
for (const fn of local.selectedFunctions) {
|
|
3094
|
+
if (!serverFns.has(fn)) return true;
|
|
3095
|
+
}
|
|
3096
|
+
for (const fn of local.selectedFunctions) {
|
|
3097
|
+
if ((local.functionInstructions[fn] ?? "") !== (server.functionInstructions[fn] ?? "")) return true;
|
|
3098
|
+
}
|
|
3099
|
+
}
|
|
3100
|
+
return false;
|
|
3101
|
+
}, [localState, serverState, initialized]);
|
|
3053
3102
|
const handleToggle = useCallback5(
|
|
3054
|
-
|
|
3103
|
+
(card, checked) => {
|
|
3104
|
+
const slug = card.definition.slug;
|
|
3105
|
+
setLocalState((prev) => ({
|
|
3106
|
+
...prev,
|
|
3107
|
+
[slug]: {
|
|
3108
|
+
...prev[slug],
|
|
3109
|
+
enabled: checked
|
|
3110
|
+
}
|
|
3111
|
+
}));
|
|
3055
3112
|
if (checked) {
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3113
|
+
setExpandedCards((prev) => /* @__PURE__ */ new Set([...prev, slug]));
|
|
3114
|
+
}
|
|
3115
|
+
},
|
|
3116
|
+
[]
|
|
3117
|
+
);
|
|
3118
|
+
const handleToggleFunction = useCallback5(
|
|
3119
|
+
(slug, fnSlug, checked) => {
|
|
3120
|
+
setLocalState((prev) => {
|
|
3121
|
+
const current = prev[slug];
|
|
3122
|
+
if (!current) return prev;
|
|
3123
|
+
const fns = new Set(current.selectedFunctions);
|
|
3124
|
+
if (checked) fns.add(fnSlug);
|
|
3125
|
+
else fns.delete(fnSlug);
|
|
3126
|
+
return { ...prev, [slug]: { ...current, selectedFunctions: fns } };
|
|
3127
|
+
});
|
|
3128
|
+
},
|
|
3129
|
+
[]
|
|
3130
|
+
);
|
|
3131
|
+
const handleUpdateInstruction = useCallback5(
|
|
3132
|
+
(slug, fnSlug, instruction) => {
|
|
3133
|
+
setLocalState((prev) => {
|
|
3134
|
+
const current = prev[slug];
|
|
3135
|
+
if (!current) return prev;
|
|
3136
|
+
return {
|
|
3137
|
+
...prev,
|
|
3138
|
+
[slug]: {
|
|
3139
|
+
...current,
|
|
3140
|
+
functionInstructions: { ...current.functionInstructions, [fnSlug]: instruction }
|
|
3141
|
+
}
|
|
3142
|
+
};
|
|
3143
|
+
});
|
|
3144
|
+
},
|
|
3145
|
+
[]
|
|
3146
|
+
);
|
|
3147
|
+
const saveNow = useCallback5(async () => {
|
|
3148
|
+
setIsSaving(true);
|
|
3149
|
+
try {
|
|
3150
|
+
for (const slug of Object.keys(localState)) {
|
|
3151
|
+
const local = localState[slug];
|
|
3152
|
+
const card = connectedCards.find((c) => c.definition.slug === slug);
|
|
3153
|
+
if (!card) continue;
|
|
3154
|
+
const serverEntry = serverState[slug];
|
|
3155
|
+
const wasEnabled = serverEntry?.enabled ?? false;
|
|
3156
|
+
if (local.enabled && !wasEnabled) {
|
|
3157
|
+
let toolId = card.tool?.id;
|
|
3158
|
+
if (!toolId) {
|
|
3159
|
+
const existingTool = allTools.find((t) => t.slug === slug);
|
|
3160
|
+
if (existingTool) {
|
|
3161
|
+
toolId = existingTool.id;
|
|
3162
|
+
} else {
|
|
3063
3163
|
const result = await createTool.mutateAsync({
|
|
3064
3164
|
name: card.definition.name,
|
|
3065
|
-
slug
|
|
3165
|
+
slug,
|
|
3066
3166
|
type: "integration",
|
|
3067
3167
|
description: card.definition.description
|
|
3068
3168
|
});
|
|
3069
3169
|
const d = result?.data;
|
|
3070
3170
|
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;
|
|
3171
|
+
if (!toolId) continue;
|
|
3078
3172
|
}
|
|
3079
3173
|
}
|
|
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 } : {}
|
|
3174
|
+
const customInstructions = buildCustomInstructions(slug, local.selectedFunctions, local.functionInstructions);
|
|
3175
|
+
await addAgentTool.mutateAsync({
|
|
3176
|
+
idAgent: agentId,
|
|
3177
|
+
body: { id_tool: toolId, enabled: true, ...customInstructions ? { custom_instructions: customInstructions } : {} }
|
|
3178
|
+
});
|
|
3179
|
+
} else if (!local.enabled && wasEnabled) {
|
|
3180
|
+
const toolId = card.tool?.id;
|
|
3181
|
+
if (toolId) {
|
|
3182
|
+
const agentTool = agentTools.find((at) => at.id_tool === toolId);
|
|
3183
|
+
if (agentTool) {
|
|
3184
|
+
await removeAgentTool.mutateAsync({ idAgent: agentId, id: agentTool.id });
|
|
3185
|
+
}
|
|
3098
3186
|
}
|
|
3099
|
-
})
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3187
|
+
} else if (local.enabled && wasEnabled) {
|
|
3188
|
+
const toolId = card.tool?.id;
|
|
3189
|
+
if (toolId) {
|
|
3190
|
+
const agentTool = agentTools.find((at) => at.id_tool === toolId);
|
|
3191
|
+
if (agentTool) {
|
|
3192
|
+
const customInstructions = buildCustomInstructions(slug, local.selectedFunctions, local.functionInstructions);
|
|
3193
|
+
await updateAgentTool.mutateAsync({
|
|
3194
|
+
idAgent: agentId,
|
|
3195
|
+
id: agentTool.id,
|
|
3196
|
+
body: { custom_instructions: customInstructions }
|
|
3197
|
+
});
|
|
3198
|
+
}
|
|
3106
3199
|
}
|
|
3107
3200
|
}
|
|
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
3201
|
}
|
|
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
|
-
);
|
|
3202
|
+
setServerState(JSON.parse(JSON.stringify(localState, (_k, v) => v instanceof Set ? [...v] : v)));
|
|
3203
|
+
toast7.success("Integra\xE7\xF5es salvas");
|
|
3204
|
+
} catch {
|
|
3205
|
+
toast7.error("Erro ao salvar integra\xE7\xF5es");
|
|
3206
|
+
} finally {
|
|
3207
|
+
setIsSaving(false);
|
|
3208
|
+
}
|
|
3209
|
+
}, [localState, serverState, connectedCards, allTools, agentTools, agentId, addAgentTool, removeAgentTool, updateAgentTool, createTool]);
|
|
3210
|
+
const discard = useCallback5(() => {
|
|
3211
|
+
const restored = {};
|
|
3212
|
+
for (const [slug, entry] of Object.entries(serverState)) {
|
|
3213
|
+
restored[slug] = {
|
|
3214
|
+
...entry,
|
|
3215
|
+
selectedFunctions: entry.selectedFunctions instanceof Set ? entry.selectedFunctions : new Set(entry.selectedFunctions)
|
|
3216
|
+
};
|
|
3217
|
+
}
|
|
3218
|
+
setLocalState(restored);
|
|
3219
|
+
}, [serverState]);
|
|
3174
3220
|
if (isLoading || agentToolsLoading) {
|
|
3175
3221
|
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
3222
|
}
|
|
@@ -3185,13 +3231,13 @@ function IntegrationsTab({
|
|
|
3185
3231
|
/* @__PURE__ */ jsx11("p", { className: "text-xs text-muted-foreground", children: "Ative ou desative as integra\xE7\xF5es conectadas na conta para este agente." }),
|
|
3186
3232
|
/* @__PURE__ */ jsx11("div", { className: "grid grid-cols-1 gap-3", children: connectedCards.map((card) => {
|
|
3187
3233
|
const Icon = resolveIcon(card.definition.icon);
|
|
3188
|
-
const isLinked = card.linkedToAgent;
|
|
3189
|
-
const isMutating = addAgentTool.isPending || removeAgentTool.isPending || createTool.isPending;
|
|
3190
3234
|
const integrationSlug = card.definition.slug;
|
|
3235
|
+
const local = localState[integrationSlug];
|
|
3236
|
+
const isLinked = local?.enabled ?? false;
|
|
3191
3237
|
const fns = INTEGRATION_FUNCTIONS[integrationSlug];
|
|
3192
3238
|
const isExpanded = expandedCards.has(integrationSlug);
|
|
3193
|
-
const selected = selectedFunctions
|
|
3194
|
-
const instructions = functionInstructions
|
|
3239
|
+
const selected = local?.selectedFunctions ?? /* @__PURE__ */ new Set();
|
|
3240
|
+
const instructions = local?.functionInstructions ?? {};
|
|
3195
3241
|
return /* @__PURE__ */ jsxs9(
|
|
3196
3242
|
"div",
|
|
3197
3243
|
{
|
|
@@ -3240,7 +3286,7 @@ function IntegrationsTab({
|
|
|
3240
3286
|
Switch5,
|
|
3241
3287
|
{
|
|
3242
3288
|
checked: isLinked,
|
|
3243
|
-
disabled:
|
|
3289
|
+
disabled: isSaving,
|
|
3244
3290
|
onCheckedChange: (checked) => handleToggle(card, checked),
|
|
3245
3291
|
"aria-label": `${isLinked ? "Desativar" : "Ativar"} ${card.definition.name} para este agente`
|
|
3246
3292
|
}
|
|
@@ -3258,7 +3304,7 @@ function IntegrationsTab({
|
|
|
3258
3304
|
Checkbox2,
|
|
3259
3305
|
{
|
|
3260
3306
|
checked: isSelected,
|
|
3261
|
-
onCheckedChange: (val) => handleToggleFunction(
|
|
3307
|
+
onCheckedChange: (val) => handleToggleFunction(integrationSlug, fn.slug, val === true),
|
|
3262
3308
|
"aria-label": fn.label
|
|
3263
3309
|
}
|
|
3264
3310
|
),
|
|
@@ -3288,7 +3334,7 @@ function IntegrationsTab({
|
|
|
3288
3334
|
{
|
|
3289
3335
|
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
3336
|
value: currentInstruction,
|
|
3291
|
-
onChange: (e) =>
|
|
3337
|
+
onChange: (e) => handleUpdateInstruction(integrationSlug, fn.slug, e.target.value),
|
|
3292
3338
|
placeholder: "Instru\xE7\xF5es personalizadas para esta fun\xE7\xE3o...",
|
|
3293
3339
|
rows: 2
|
|
3294
3340
|
}
|
|
@@ -3300,7 +3346,17 @@ function IntegrationsTab({
|
|
|
3300
3346
|
},
|
|
3301
3347
|
`${integrationSlug}-cred-${card.credentialId}`
|
|
3302
3348
|
);
|
|
3303
|
-
}) })
|
|
3349
|
+
}) }),
|
|
3350
|
+
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: [
|
|
3351
|
+
/* @__PURE__ */ jsx11("p", { className: "text-sm text-muted-foreground", children: "Voc\xEA tem altera\xE7\xF5es n\xE3o salvas." }),
|
|
3352
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex gap-2", children: [
|
|
3353
|
+
/* @__PURE__ */ jsx11(Button8, { variant: "ghost", size: "sm", onClick: discard, disabled: isSaving, children: "Descartar" }),
|
|
3354
|
+
/* @__PURE__ */ jsxs9(Button8, { size: "sm", onClick: saveNow, disabled: isSaving, children: [
|
|
3355
|
+
isSaving && /* @__PURE__ */ jsx11(Loader25, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
3356
|
+
"Salvar"
|
|
3357
|
+
] })
|
|
3358
|
+
] })
|
|
3359
|
+
] })
|
|
3304
3360
|
] });
|
|
3305
3361
|
}
|
|
3306
3362
|
|
|
@@ -3361,7 +3417,7 @@ import { useState as useState10 } from "react";
|
|
|
3361
3417
|
import {
|
|
3362
3418
|
Switch as Switch6,
|
|
3363
3419
|
Badge as Badge6,
|
|
3364
|
-
Button as
|
|
3420
|
+
Button as Button9,
|
|
3365
3421
|
Skeleton as Skeleton6,
|
|
3366
3422
|
AlertDialog as AlertDialog3,
|
|
3367
3423
|
AlertDialogAction as AlertDialogAction3,
|
|
@@ -3394,7 +3450,7 @@ import {
|
|
|
3394
3450
|
Wrench,
|
|
3395
3451
|
Settings2
|
|
3396
3452
|
} from "lucide-react";
|
|
3397
|
-
import { toast as
|
|
3453
|
+
import { toast as toast8 } from "sonner";
|
|
3398
3454
|
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3399
3455
|
function AgentToolsList({ agent, config }) {
|
|
3400
3456
|
const { data: agentToolsData, isLoading } = useAgentTools(config, agent.id);
|
|
@@ -3431,9 +3487,9 @@ function AgentToolsList({ agent, config }) {
|
|
|
3431
3487
|
id: agentTool.id,
|
|
3432
3488
|
body: { enabled: checked }
|
|
3433
3489
|
});
|
|
3434
|
-
|
|
3490
|
+
toast8.success(checked ? "Ferramenta ativada" : "Ferramenta desativada");
|
|
3435
3491
|
} catch (err) {
|
|
3436
|
-
|
|
3492
|
+
toast8.error(
|
|
3437
3493
|
err instanceof Error ? err.message : "Erro ao alterar estado da ferramenta"
|
|
3438
3494
|
);
|
|
3439
3495
|
}
|
|
@@ -3444,11 +3500,11 @@ function AgentToolsList({ agent, config }) {
|
|
|
3444
3500
|
idAgent: agent.id,
|
|
3445
3501
|
body: { id_tool: tool.id }
|
|
3446
3502
|
});
|
|
3447
|
-
|
|
3503
|
+
toast8.success("Ferramenta adicionada");
|
|
3448
3504
|
setAddOpen(false);
|
|
3449
3505
|
setSearch("");
|
|
3450
3506
|
} catch (err) {
|
|
3451
|
-
|
|
3507
|
+
toast8.error(
|
|
3452
3508
|
err instanceof Error ? err.message : "Erro ao adicionar ferramenta"
|
|
3453
3509
|
);
|
|
3454
3510
|
}
|
|
@@ -3460,9 +3516,9 @@ function AgentToolsList({ agent, config }) {
|
|
|
3460
3516
|
idAgent: agent.id,
|
|
3461
3517
|
id: removeTarget.id
|
|
3462
3518
|
});
|
|
3463
|
-
|
|
3519
|
+
toast8.success("Ferramenta removida");
|
|
3464
3520
|
} catch (err) {
|
|
3465
|
-
|
|
3521
|
+
toast8.error(
|
|
3466
3522
|
err instanceof Error ? err.message : "Erro ao remover ferramenta"
|
|
3467
3523
|
);
|
|
3468
3524
|
} finally {
|
|
@@ -3486,10 +3542,10 @@ function AgentToolsList({ agent, config }) {
|
|
|
3486
3542
|
id_tool_credential: newCredentialId
|
|
3487
3543
|
}
|
|
3488
3544
|
});
|
|
3489
|
-
|
|
3545
|
+
toast8.success("Configura\xE7\xE3o atualizada");
|
|
3490
3546
|
setConfigTarget(null);
|
|
3491
3547
|
} catch (err) {
|
|
3492
|
-
|
|
3548
|
+
toast8.error(
|
|
3493
3549
|
err instanceof Error ? err.message : "Erro ao atualizar configura\xE7\xE3o"
|
|
3494
3550
|
);
|
|
3495
3551
|
}
|
|
@@ -3507,7 +3563,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
3507
3563
|
visibleAgentTools.length !== 1 ? "s" : ""
|
|
3508
3564
|
] }),
|
|
3509
3565
|
/* @__PURE__ */ jsxs11(Popover, { open: addOpen, onOpenChange: setAddOpen, children: [
|
|
3510
|
-
/* @__PURE__ */ jsx13(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs11(
|
|
3566
|
+
/* @__PURE__ */ jsx13(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs11(Button9, { size: "sm", disabled: availableTools.length === 0, children: [
|
|
3511
3567
|
/* @__PURE__ */ jsx13(Plus2, { className: "mr-2 h-4 w-4" }),
|
|
3512
3568
|
"Adicionar Ferramenta"
|
|
3513
3569
|
] }) }),
|
|
@@ -3568,7 +3624,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
3568
3624
|
}
|
|
3569
3625
|
),
|
|
3570
3626
|
/* @__PURE__ */ jsx13(
|
|
3571
|
-
|
|
3627
|
+
Button9,
|
|
3572
3628
|
{
|
|
3573
3629
|
variant: "ghost",
|
|
3574
3630
|
size: "icon",
|
|
@@ -3580,7 +3636,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
3580
3636
|
}
|
|
3581
3637
|
),
|
|
3582
3638
|
/* @__PURE__ */ jsx13(
|
|
3583
|
-
|
|
3639
|
+
Button9,
|
|
3584
3640
|
{
|
|
3585
3641
|
variant: "ghost",
|
|
3586
3642
|
size: "icon",
|
|
@@ -3639,7 +3695,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
3639
3695
|
] }),
|
|
3640
3696
|
/* @__PURE__ */ jsxs11(DialogFooter4, { children: [
|
|
3641
3697
|
/* @__PURE__ */ jsx13(
|
|
3642
|
-
|
|
3698
|
+
Button9,
|
|
3643
3699
|
{
|
|
3644
3700
|
variant: "outline",
|
|
3645
3701
|
onClick: () => setConfigTarget(null),
|
|
@@ -3647,7 +3703,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
3647
3703
|
}
|
|
3648
3704
|
),
|
|
3649
3705
|
/* @__PURE__ */ jsx13(
|
|
3650
|
-
|
|
3706
|
+
Button9,
|
|
3651
3707
|
{
|
|
3652
3708
|
onClick: handleSaveConfig,
|
|
3653
3709
|
disabled: updateMutation.isPending,
|
|
@@ -3686,7 +3742,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
3686
3742
|
}
|
|
3687
3743
|
|
|
3688
3744
|
// src/components/tools/tools-table.tsx
|
|
3689
|
-
import { useMemo as
|
|
3745
|
+
import { useMemo as useMemo7, useState as useState11 } from "react";
|
|
3690
3746
|
import { DataTable as DataTable2 } from "@greatapps/greatauth-ui";
|
|
3691
3747
|
import {
|
|
3692
3748
|
Input as Input7,
|
|
@@ -3702,12 +3758,12 @@ import {
|
|
|
3702
3758
|
AlertDialogFooter as AlertDialogFooter4,
|
|
3703
3759
|
AlertDialogHeader as AlertDialogHeader4,
|
|
3704
3760
|
AlertDialogTitle as AlertDialogTitle4,
|
|
3705
|
-
Button as
|
|
3761
|
+
Button as Button10
|
|
3706
3762
|
} from "@greatapps/greatauth-ui/ui";
|
|
3707
3763
|
import { Pencil as Pencil5, Trash2 as Trash24, Search as Search2 } from "lucide-react";
|
|
3708
3764
|
import { format as format2 } from "date-fns";
|
|
3709
3765
|
import { ptBR as ptBR2 } from "date-fns/locale";
|
|
3710
|
-
import { toast as
|
|
3766
|
+
import { toast as toast9 } from "sonner";
|
|
3711
3767
|
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3712
3768
|
function useColumns2(onEdit, onDelete) {
|
|
3713
3769
|
return [
|
|
@@ -3750,7 +3806,7 @@ function useColumns2(onEdit, onDelete) {
|
|
|
3750
3806
|
cell: ({ row }) => /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
|
|
3751
3807
|
/* @__PURE__ */ jsxs12(Tooltip3, { children: [
|
|
3752
3808
|
/* @__PURE__ */ jsx14(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx14(
|
|
3753
|
-
|
|
3809
|
+
Button10,
|
|
3754
3810
|
{
|
|
3755
3811
|
variant: "ghost",
|
|
3756
3812
|
size: "icon",
|
|
@@ -3764,7 +3820,7 @@ function useColumns2(onEdit, onDelete) {
|
|
|
3764
3820
|
] }),
|
|
3765
3821
|
/* @__PURE__ */ jsxs12(Tooltip3, { children: [
|
|
3766
3822
|
/* @__PURE__ */ jsx14(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx14(
|
|
3767
|
-
|
|
3823
|
+
Button10,
|
|
3768
3824
|
{
|
|
3769
3825
|
variant: "ghost",
|
|
3770
3826
|
size: "icon",
|
|
@@ -3783,7 +3839,7 @@ function useColumns2(onEdit, onDelete) {
|
|
|
3783
3839
|
function ToolsTable({ onEdit, config }) {
|
|
3784
3840
|
const [search, setSearch] = useState11("");
|
|
3785
3841
|
const [page, setPage] = useState11(1);
|
|
3786
|
-
const queryParams =
|
|
3842
|
+
const queryParams = useMemo7(() => {
|
|
3787
3843
|
const params = {
|
|
3788
3844
|
limit: "15",
|
|
3789
3845
|
page: String(page)
|
|
@@ -3807,10 +3863,10 @@ function ToolsTable({ onEdit, config }) {
|
|
|
3807
3863
|
if (!deleteId) return;
|
|
3808
3864
|
deleteTool.mutate(deleteId, {
|
|
3809
3865
|
onSuccess: () => {
|
|
3810
|
-
|
|
3866
|
+
toast9.success("Ferramenta exclu\xEDda");
|
|
3811
3867
|
setDeleteId(null);
|
|
3812
3868
|
},
|
|
3813
|
-
onError: () =>
|
|
3869
|
+
onError: () => toast9.error("Erro ao excluir ferramenta")
|
|
3814
3870
|
});
|
|
3815
3871
|
}
|
|
3816
3872
|
function handleSearchChange(value) {
|
|
@@ -3883,7 +3939,7 @@ import {
|
|
|
3883
3939
|
DialogHeader as DialogHeader5,
|
|
3884
3940
|
DialogTitle as DialogTitle5,
|
|
3885
3941
|
DialogFooter as DialogFooter5,
|
|
3886
|
-
Button as
|
|
3942
|
+
Button as Button11,
|
|
3887
3943
|
Input as Input8,
|
|
3888
3944
|
Textarea as Textarea3,
|
|
3889
3945
|
Label as Label5,
|
|
@@ -3894,7 +3950,7 @@ import {
|
|
|
3894
3950
|
SelectValue as SelectValue2
|
|
3895
3951
|
} from "@greatapps/greatauth-ui/ui";
|
|
3896
3952
|
import { Loader2 as Loader26 } from "lucide-react";
|
|
3897
|
-
import { toast as
|
|
3953
|
+
import { toast as toast10 } from "sonner";
|
|
3898
3954
|
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3899
3955
|
var TOOL_AUTH_TYPES = [
|
|
3900
3956
|
{ value: "none", label: "Nenhuma" },
|
|
@@ -3991,16 +4047,16 @@ function ToolFormDialog({
|
|
|
3991
4047
|
try {
|
|
3992
4048
|
if (isEditing) {
|
|
3993
4049
|
await updateTool.mutateAsync({ id: tool.id, body });
|
|
3994
|
-
|
|
4050
|
+
toast10.success("Ferramenta atualizada");
|
|
3995
4051
|
} else {
|
|
3996
4052
|
await createTool.mutateAsync(
|
|
3997
4053
|
body
|
|
3998
4054
|
);
|
|
3999
|
-
|
|
4055
|
+
toast10.success("Ferramenta criada");
|
|
4000
4056
|
}
|
|
4001
4057
|
onOpenChange(false);
|
|
4002
4058
|
} catch (err) {
|
|
4003
|
-
|
|
4059
|
+
toast10.error(
|
|
4004
4060
|
err instanceof Error ? err.message : isEditing ? "Erro ao atualizar ferramenta" : "Erro ao criar ferramenta"
|
|
4005
4061
|
);
|
|
4006
4062
|
}
|
|
@@ -4131,7 +4187,7 @@ function ToolFormDialog({
|
|
|
4131
4187
|
] }),
|
|
4132
4188
|
/* @__PURE__ */ jsxs13(DialogFooter5, { children: [
|
|
4133
4189
|
/* @__PURE__ */ jsx15(
|
|
4134
|
-
|
|
4190
|
+
Button11,
|
|
4135
4191
|
{
|
|
4136
4192
|
type: "button",
|
|
4137
4193
|
variant: "outline",
|
|
@@ -4140,7 +4196,7 @@ function ToolFormDialog({
|
|
|
4140
4196
|
children: "Cancelar"
|
|
4141
4197
|
}
|
|
4142
4198
|
),
|
|
4143
|
-
/* @__PURE__ */ jsxs13(
|
|
4199
|
+
/* @__PURE__ */ jsxs13(Button11, { type: "submit", disabled: isPending, children: [
|
|
4144
4200
|
isPending ? /* @__PURE__ */ jsx15(Loader26, { "aria-hidden": "true", className: "mr-2 h-4 w-4 animate-spin" }) : null,
|
|
4145
4201
|
isEditing ? "Salvar" : "Criar"
|
|
4146
4202
|
] })
|
|
@@ -4150,11 +4206,11 @@ function ToolFormDialog({
|
|
|
4150
4206
|
}
|
|
4151
4207
|
|
|
4152
4208
|
// src/components/tools/tool-credentials-form.tsx
|
|
4153
|
-
import { useMemo as
|
|
4209
|
+
import { useMemo as useMemo8, useState as useState13 } from "react";
|
|
4154
4210
|
import { DataTable as DataTable3 } from "@greatapps/greatauth-ui";
|
|
4155
4211
|
import {
|
|
4156
4212
|
Input as Input9,
|
|
4157
|
-
Button as
|
|
4213
|
+
Button as Button12,
|
|
4158
4214
|
Badge as Badge8,
|
|
4159
4215
|
Tooltip as Tooltip4,
|
|
4160
4216
|
TooltipTrigger as TooltipTrigger4,
|
|
@@ -4171,7 +4227,7 @@ import {
|
|
|
4171
4227
|
import { Trash2 as Trash25, Search as Search3 } from "lucide-react";
|
|
4172
4228
|
import { format as format3 } from "date-fns";
|
|
4173
4229
|
import { ptBR as ptBR3 } from "date-fns/locale";
|
|
4174
|
-
import { toast as
|
|
4230
|
+
import { toast as toast11 } from "sonner";
|
|
4175
4231
|
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4176
4232
|
function formatDate2(dateStr) {
|
|
4177
4233
|
if (!dateStr) return "Sem expira\xE7\xE3o";
|
|
@@ -4222,7 +4278,7 @@ function useColumns3(tools, onRemove) {
|
|
|
4222
4278
|
enableSorting: false,
|
|
4223
4279
|
cell: ({ row }) => /* @__PURE__ */ jsx16("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxs14(Tooltip4, { children: [
|
|
4224
4280
|
/* @__PURE__ */ jsx16(TooltipTrigger4, { asChild: true, children: /* @__PURE__ */ jsx16(
|
|
4225
|
-
|
|
4281
|
+
Button12,
|
|
4226
4282
|
{
|
|
4227
4283
|
variant: "ghost",
|
|
4228
4284
|
size: "icon",
|
|
@@ -4248,13 +4304,13 @@ function ToolCredentialsForm({
|
|
|
4248
4304
|
const tools = (toolsData?.data || []).filter((t) => !t.slug?.startsWith("gclinic_"));
|
|
4249
4305
|
const [search, setSearch] = useState13("");
|
|
4250
4306
|
const [removeTarget, setRemoveTarget] = useState13(null);
|
|
4251
|
-
const internalToolIds =
|
|
4307
|
+
const internalToolIds = useMemo8(() => {
|
|
4252
4308
|
const allRawTools = toolsData?.data || [];
|
|
4253
4309
|
return new Set(
|
|
4254
4310
|
allRawTools.filter((t) => t.slug?.startsWith("gclinic_")).map((t) => t.id)
|
|
4255
4311
|
);
|
|
4256
4312
|
}, [toolsData]);
|
|
4257
|
-
const filteredCredentials =
|
|
4313
|
+
const filteredCredentials = useMemo8(() => {
|
|
4258
4314
|
const visible = credentials.filter(
|
|
4259
4315
|
(cred) => !cred.id_tool || !internalToolIds.has(cred.id_tool)
|
|
4260
4316
|
);
|
|
@@ -4274,12 +4330,12 @@ function ToolCredentialsForm({
|
|
|
4274
4330
|
try {
|
|
4275
4331
|
const result = await deleteMutation.mutateAsync(removeTarget.id);
|
|
4276
4332
|
if (result.status === 1) {
|
|
4277
|
-
|
|
4333
|
+
toast11.success("Credencial removida");
|
|
4278
4334
|
} else {
|
|
4279
|
-
|
|
4335
|
+
toast11.error(result.message || "Erro ao remover credencial");
|
|
4280
4336
|
}
|
|
4281
4337
|
} catch {
|
|
4282
|
-
|
|
4338
|
+
toast11.error("Erro ao remover credencial");
|
|
4283
4339
|
} finally {
|
|
4284
4340
|
setRemoveTarget(null);
|
|
4285
4341
|
}
|
|
@@ -4340,7 +4396,7 @@ function ToolCredentialsForm({
|
|
|
4340
4396
|
import { useState as useState14 } from "react";
|
|
4341
4397
|
import {
|
|
4342
4398
|
Badge as Badge9,
|
|
4343
|
-
Button as
|
|
4399
|
+
Button as Button13,
|
|
4344
4400
|
DropdownMenu,
|
|
4345
4401
|
DropdownMenuContent,
|
|
4346
4402
|
DropdownMenuItem,
|
|
@@ -4433,7 +4489,7 @@ function IntegrationCard({
|
|
|
4433
4489
|
] })
|
|
4434
4490
|
] }),
|
|
4435
4491
|
/* @__PURE__ */ jsx17("div", { className: "mt-auto flex items-center justify-end pt-1", children: /* @__PURE__ */ jsx17(
|
|
4436
|
-
|
|
4492
|
+
Button13,
|
|
4437
4493
|
{
|
|
4438
4494
|
variant: "outline",
|
|
4439
4495
|
size: "sm",
|
|
@@ -4488,7 +4544,7 @@ function IntegrationCard({
|
|
|
4488
4544
|
] }),
|
|
4489
4545
|
/* @__PURE__ */ jsx17("div", { className: "mt-auto flex items-center justify-end gap-2 pt-1", children: /* @__PURE__ */ jsxs15(DropdownMenu, { children: [
|
|
4490
4546
|
/* @__PURE__ */ jsx17(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs15(
|
|
4491
|
-
|
|
4547
|
+
Button13,
|
|
4492
4548
|
{
|
|
4493
4549
|
variant: "outline",
|
|
4494
4550
|
size: "sm",
|
|
@@ -4610,17 +4666,17 @@ function AdvancedTab({ config, agentId, gagentsApiUrl }) {
|
|
|
4610
4666
|
}
|
|
4611
4667
|
|
|
4612
4668
|
// src/components/capabilities/integration-wizard.tsx
|
|
4613
|
-
import { useCallback as useCallback6, useEffect as
|
|
4669
|
+
import { useCallback as useCallback6, useEffect as useEffect6, useRef as useRef2, useState as useState16 } from "react";
|
|
4614
4670
|
import {
|
|
4615
4671
|
Dialog as Dialog6,
|
|
4616
4672
|
DialogContent as DialogContent6,
|
|
4617
4673
|
DialogFooter as DialogFooter6,
|
|
4618
4674
|
DialogHeader as DialogHeader6,
|
|
4619
4675
|
DialogTitle as DialogTitle6,
|
|
4620
|
-
Button as
|
|
4676
|
+
Button as Button15
|
|
4621
4677
|
} from "@greatapps/greatauth-ui/ui";
|
|
4622
4678
|
import { Loader2 as Loader29, ChevronLeft, ChevronRight, Check as Check2 } from "lucide-react";
|
|
4623
|
-
import { toast as
|
|
4679
|
+
import { toast as toast12 } from "sonner";
|
|
4624
4680
|
|
|
4625
4681
|
// src/components/capabilities/wizard-steps/info-step.tsx
|
|
4626
4682
|
import { Check, Info as Info2 } from "lucide-react";
|
|
@@ -4679,7 +4735,7 @@ function InfoStep({ integration, meta }) {
|
|
|
4679
4735
|
|
|
4680
4736
|
// src/components/capabilities/wizard-steps/credentials-step.tsx
|
|
4681
4737
|
import { CheckCircle2, Loader2 as Loader27, AlertCircle, Shield } from "lucide-react";
|
|
4682
|
-
import { Button as
|
|
4738
|
+
import { Button as Button14, Input as Input10, Label as Label6 } from "@greatapps/greatauth-ui/ui";
|
|
4683
4739
|
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4684
4740
|
function CredentialsStep({
|
|
4685
4741
|
integration,
|
|
@@ -4722,7 +4778,7 @@ function OAuthCredentials({
|
|
|
4722
4778
|
] }),
|
|
4723
4779
|
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col items-center gap-4 rounded-lg border p-6", children: [
|
|
4724
4780
|
oauthStatus === "idle" && /* @__PURE__ */ jsxs18(
|
|
4725
|
-
|
|
4781
|
+
Button14,
|
|
4726
4782
|
{
|
|
4727
4783
|
onClick: onStartOAuth,
|
|
4728
4784
|
size: "lg",
|
|
@@ -4771,7 +4827,7 @@ function OAuthCredentials({
|
|
|
4771
4827
|
/* @__PURE__ */ jsx20("p", { className: "text-sm font-medium text-destructive", children: "Falha na conex\xE3o" }),
|
|
4772
4828
|
oauthResult?.error && /* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground", children: oauthResult.error })
|
|
4773
4829
|
] }),
|
|
4774
|
-
/* @__PURE__ */ jsx20(
|
|
4830
|
+
/* @__PURE__ */ jsx20(Button14, { variant: "outline", onClick: onStartOAuth, size: "sm", children: "Tentar novamente" })
|
|
4775
4831
|
] })
|
|
4776
4832
|
] }),
|
|
4777
4833
|
/* @__PURE__ */ jsxs18("div", { className: "flex items-start gap-2 rounded-md bg-muted/50 p-3", children: [
|
|
@@ -5024,14 +5080,14 @@ function IntegrationWizard({
|
|
|
5024
5080
|
const [selectedConfigValue, setSelectedConfigValue] = useState16("");
|
|
5025
5081
|
const [enableOnComplete, setEnableOnComplete] = useState16(true);
|
|
5026
5082
|
const [isSubmitting, setIsSubmitting] = useState16(false);
|
|
5027
|
-
|
|
5083
|
+
useEffect6(() => {
|
|
5028
5084
|
return () => {
|
|
5029
5085
|
if (popupPollRef.current) {
|
|
5030
5086
|
clearInterval(popupPollRef.current);
|
|
5031
5087
|
}
|
|
5032
5088
|
};
|
|
5033
5089
|
}, []);
|
|
5034
|
-
|
|
5090
|
+
useEffect6(() => {
|
|
5035
5091
|
if (open) {
|
|
5036
5092
|
setCurrentStep("info");
|
|
5037
5093
|
setOauthStatus("idle");
|
|
@@ -5092,7 +5148,7 @@ function IntegrationWizard({
|
|
|
5092
5148
|
},
|
|
5093
5149
|
[gagentsApiUrl, existingCredentialId, meta.hasConfigStep, loadConfigOptions]
|
|
5094
5150
|
);
|
|
5095
|
-
|
|
5151
|
+
useEffect6(() => {
|
|
5096
5152
|
if (!open) return;
|
|
5097
5153
|
window.addEventListener("message", handleOAuthMessage);
|
|
5098
5154
|
return () => window.removeEventListener("message", handleOAuthMessage);
|
|
@@ -5192,11 +5248,11 @@ function IntegrationWizard({
|
|
|
5192
5248
|
setIsSubmitting(true);
|
|
5193
5249
|
try {
|
|
5194
5250
|
onComplete();
|
|
5195
|
-
|
|
5251
|
+
toast12.success(
|
|
5196
5252
|
`${integration.name} ${isReconnect ? "reconectado" : "configurado"} com sucesso!`
|
|
5197
5253
|
);
|
|
5198
5254
|
} catch {
|
|
5199
|
-
|
|
5255
|
+
toast12.error("Erro ao finalizar configura\xE7\xE3o");
|
|
5200
5256
|
} finally {
|
|
5201
5257
|
setIsSubmitting(false);
|
|
5202
5258
|
}
|
|
@@ -5251,7 +5307,7 @@ function IntegrationWizard({
|
|
|
5251
5307
|
] }),
|
|
5252
5308
|
/* @__PURE__ */ jsxs21(DialogFooter6, { className: "flex-row justify-between sm:justify-between", children: [
|
|
5253
5309
|
/* @__PURE__ */ jsx23("div", { children: currentStep === "info" ? /* @__PURE__ */ jsx23(
|
|
5254
|
-
|
|
5310
|
+
Button15,
|
|
5255
5311
|
{
|
|
5256
5312
|
type: "button",
|
|
5257
5313
|
variant: "outline",
|
|
@@ -5259,7 +5315,7 @@ function IntegrationWizard({
|
|
|
5259
5315
|
children: "Cancelar"
|
|
5260
5316
|
}
|
|
5261
5317
|
) : /* @__PURE__ */ jsxs21(
|
|
5262
|
-
|
|
5318
|
+
Button15,
|
|
5263
5319
|
{
|
|
5264
5320
|
type: "button",
|
|
5265
5321
|
variant: "outline",
|
|
@@ -5272,7 +5328,7 @@ function IntegrationWizard({
|
|
|
5272
5328
|
}
|
|
5273
5329
|
) }),
|
|
5274
5330
|
/* @__PURE__ */ jsx23("div", { children: isLastStep ? /* @__PURE__ */ jsxs21(
|
|
5275
|
-
|
|
5331
|
+
Button15,
|
|
5276
5332
|
{
|
|
5277
5333
|
type: "button",
|
|
5278
5334
|
onClick: handleComplete,
|
|
@@ -5290,7 +5346,7 @@ function IntegrationWizard({
|
|
|
5290
5346
|
]
|
|
5291
5347
|
}
|
|
5292
5348
|
) : /* @__PURE__ */ jsxs21(
|
|
5293
|
-
|
|
5349
|
+
Button15,
|
|
5294
5350
|
{
|
|
5295
5351
|
type: "button",
|
|
5296
5352
|
onClick: goNext,
|
|
@@ -5360,7 +5416,7 @@ function StepIndicator({
|
|
|
5360
5416
|
|
|
5361
5417
|
// src/pages/agents-page.tsx
|
|
5362
5418
|
import { useState as useState17 } from "react";
|
|
5363
|
-
import { Button as
|
|
5419
|
+
import { Button as Button16 } from "@greatapps/greatauth-ui/ui";
|
|
5364
5420
|
import { Plus as Plus4 } from "lucide-react";
|
|
5365
5421
|
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5366
5422
|
function AgentsPage({
|
|
@@ -5376,7 +5432,7 @@ function AgentsPage({
|
|
|
5376
5432
|
/* @__PURE__ */ jsx24("h1", { className: "text-xl font-semibold", children: title }),
|
|
5377
5433
|
/* @__PURE__ */ jsx24("p", { className: "text-sm text-muted-foreground", children: subtitle })
|
|
5378
5434
|
] }),
|
|
5379
|
-
/* @__PURE__ */ jsxs22(
|
|
5435
|
+
/* @__PURE__ */ jsxs22(Button16, { onClick: () => setCreateOpen(true), size: "sm", children: [
|
|
5380
5436
|
/* @__PURE__ */ jsx24(Plus4, { className: "mr-2 h-4 w-4" }),
|
|
5381
5437
|
"Novo Agente"
|
|
5382
5438
|
] })
|
|
@@ -5395,7 +5451,7 @@ function AgentsPage({
|
|
|
5395
5451
|
|
|
5396
5452
|
// src/pages/agent-detail-page.tsx
|
|
5397
5453
|
import { useState as useState18 } from "react";
|
|
5398
|
-
import { Badge as Badge10, Button as
|
|
5454
|
+
import { Badge as Badge10, Button as Button17, Skeleton as Skeleton7 } from "@greatapps/greatauth-ui/ui";
|
|
5399
5455
|
import { EntityAvatar as EntityAvatar2 } from "@greatapps/greatauth-ui";
|
|
5400
5456
|
import { ArrowLeft, Pencil as Pencil6 } from "lucide-react";
|
|
5401
5457
|
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
@@ -5418,7 +5474,7 @@ function AgentDetailPage({
|
|
|
5418
5474
|
if (!agent) {
|
|
5419
5475
|
return /* @__PURE__ */ jsxs23("div", { className: "flex flex-col items-center justify-center gap-2 p-8", children: [
|
|
5420
5476
|
/* @__PURE__ */ jsx25("p", { className: "text-muted-foreground", children: "Agente n\xE3o encontrado" }),
|
|
5421
|
-
onBack && /* @__PURE__ */ jsxs23(
|
|
5477
|
+
onBack && /* @__PURE__ */ jsxs23(Button17, { variant: "ghost", size: "sm", onClick: onBack, children: [
|
|
5422
5478
|
/* @__PURE__ */ jsx25(ArrowLeft, { className: "mr-2 h-4 w-4" }),
|
|
5423
5479
|
"Voltar para agentes"
|
|
5424
5480
|
] })
|
|
@@ -5428,7 +5484,7 @@ function AgentDetailPage({
|
|
|
5428
5484
|
/* @__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
5485
|
/* @__PURE__ */ jsxs23("div", { className: "flex items-start gap-3 flex-1", children: [
|
|
5430
5486
|
onBack && /* @__PURE__ */ jsx25(
|
|
5431
|
-
|
|
5487
|
+
Button17,
|
|
5432
5488
|
{
|
|
5433
5489
|
variant: "ghost",
|
|
5434
5490
|
size: "icon",
|
|
@@ -5452,7 +5508,7 @@ function AgentDetailPage({
|
|
|
5452
5508
|
] }) })
|
|
5453
5509
|
] }),
|
|
5454
5510
|
/* @__PURE__ */ jsxs23(
|
|
5455
|
-
|
|
5511
|
+
Button17,
|
|
5456
5512
|
{
|
|
5457
5513
|
variant: "outline",
|
|
5458
5514
|
size: "sm",
|
|
@@ -5536,7 +5592,7 @@ function AgentCapabilitiesPage({
|
|
|
5536
5592
|
|
|
5537
5593
|
// src/pages/tools-page.tsx
|
|
5538
5594
|
import { useState as useState19 } from "react";
|
|
5539
|
-
import { Button as
|
|
5595
|
+
import { Button as Button18 } from "@greatapps/greatauth-ui/ui";
|
|
5540
5596
|
import { Plus as Plus5 } from "lucide-react";
|
|
5541
5597
|
import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5542
5598
|
function ToolsPage({
|
|
@@ -5552,7 +5608,7 @@ function ToolsPage({
|
|
|
5552
5608
|
/* @__PURE__ */ jsx27("h1", { className: "text-xl font-semibold", children: title }),
|
|
5553
5609
|
/* @__PURE__ */ jsx27("p", { className: "text-sm text-muted-foreground", children: subtitle })
|
|
5554
5610
|
] }),
|
|
5555
|
-
/* @__PURE__ */ jsxs25(
|
|
5611
|
+
/* @__PURE__ */ jsxs25(Button18, { onClick: () => setCreateOpen(true), size: "sm", children: [
|
|
5556
5612
|
/* @__PURE__ */ jsx27(Plus5, { className: "mr-2 h-4 w-4" }),
|
|
5557
5613
|
"Nova Ferramenta"
|
|
5558
5614
|
] })
|