@greatapps/greatagents-ui 0.3.17 → 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 +247 -200
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/capabilities/integrations-tab.tsx +211 -160
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 = {
|
|
@@ -3015,11 +3016,8 @@ function buildCustomInstructions(integrationSlug, selectedFunctions, functionIns
|
|
|
3015
3016
|
const instruction = functionInstructions[f.slug] || f.defaultInstructions;
|
|
3016
3017
|
return `- ${f.slug}: ${instruction}`;
|
|
3017
3018
|
});
|
|
3018
|
-
return `
|
|
3019
|
-
|
|
3020
|
-
${lines.join("\n")}
|
|
3021
|
-
|
|
3022
|
-
Use EXATAMENTE os nomes de fun\xE7\xE3o listados acima.`;
|
|
3019
|
+
return `Fun\xE7\xF5es dispon\xEDveis (${integrationSlug}):
|
|
3020
|
+
${lines.join("\n")}`;
|
|
3023
3021
|
}
|
|
3024
3022
|
function IntegrationsTab({
|
|
3025
3023
|
config,
|
|
@@ -3034,146 +3032,185 @@ function IntegrationsTab({
|
|
|
3034
3032
|
const createTool = useCreateTool(config);
|
|
3035
3033
|
const agentTools = agentToolsData?.data ?? [];
|
|
3036
3034
|
const allTools = toolsData?.data ?? [];
|
|
3037
|
-
const [
|
|
3038
|
-
const [
|
|
3035
|
+
const [localState, setLocalState] = useState9({});
|
|
3036
|
+
const [serverState, setServerState] = useState9({});
|
|
3037
|
+
const [initialized, setInitialized] = useState9(false);
|
|
3038
|
+
const [isSaving, setIsSaving] = useState9(false);
|
|
3039
3039
|
const [editingFunction, setEditingFunction] = useState9(null);
|
|
3040
3040
|
const [expandedCards, setExpandedCards] = useState9(/* @__PURE__ */ new Set());
|
|
3041
3041
|
const connectedCards = cards.filter(
|
|
3042
3042
|
(c) => !c.isAddNew && (c.state === "connected" || c.state === "expired")
|
|
3043
3043
|
);
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
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]);
|
|
3056
3096
|
const handleToggle = useCallback5(
|
|
3057
|
-
|
|
3097
|
+
(card, checked) => {
|
|
3098
|
+
const slug = card.definition.slug;
|
|
3099
|
+
setLocalState((prev) => ({
|
|
3100
|
+
...prev,
|
|
3101
|
+
[slug]: {
|
|
3102
|
+
...prev[slug],
|
|
3103
|
+
enabled: checked
|
|
3104
|
+
}
|
|
3105
|
+
}));
|
|
3058
3106
|
if (checked) {
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
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 {
|
|
3066
3157
|
const result = await createTool.mutateAsync({
|
|
3067
3158
|
name: card.definition.name,
|
|
3068
|
-
slug
|
|
3159
|
+
slug,
|
|
3069
3160
|
type: "integration",
|
|
3070
3161
|
description: card.definition.description
|
|
3071
3162
|
});
|
|
3072
3163
|
const d = result?.data;
|
|
3073
3164
|
toolId = (Array.isArray(d) ? d[0]?.id : d?.id) ?? void 0;
|
|
3074
|
-
if (!toolId)
|
|
3075
|
-
console.error("[IntegrationsTab] Failed to create tool \u2014 no ID returned");
|
|
3076
|
-
return;
|
|
3077
|
-
}
|
|
3078
|
-
} catch (err) {
|
|
3079
|
-
console.error("[IntegrationsTab] Error creating tool:", err);
|
|
3080
|
-
return;
|
|
3165
|
+
if (!toolId) continue;
|
|
3081
3166
|
}
|
|
3082
3167
|
}
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
const
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
addAgentTool.mutate({
|
|
3096
|
-
idAgent: agentId,
|
|
3097
|
-
body: {
|
|
3098
|
-
id_tool: toolId,
|
|
3099
|
-
enabled: true,
|
|
3100
|
-
...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
|
+
}
|
|
3101
3180
|
}
|
|
3102
|
-
})
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
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
|
+
}
|
|
3109
3193
|
}
|
|
3110
3194
|
}
|
|
3111
|
-
setExpandedCards((prev) => {
|
|
3112
|
-
const next = new Set(prev);
|
|
3113
|
-
next.delete(card.definition.slug);
|
|
3114
|
-
return next;
|
|
3115
|
-
});
|
|
3116
|
-
setSelectedFunctions((prev) => {
|
|
3117
|
-
const next = { ...prev };
|
|
3118
|
-
delete next[card.definition.slug];
|
|
3119
|
-
return next;
|
|
3120
|
-
});
|
|
3121
|
-
setFunctionInstructions((prev) => {
|
|
3122
|
-
const next = { ...prev };
|
|
3123
|
-
delete next[card.definition.slug];
|
|
3124
|
-
return next;
|
|
3125
|
-
});
|
|
3126
3195
|
}
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
});
|
|
3146
|
-
},
|
|
3147
|
-
[functionInstructions]
|
|
3148
|
-
);
|
|
3149
|
-
const handleUpdateFunctionInstruction = useCallback5(
|
|
3150
|
-
(card, fnSlug, instruction) => {
|
|
3151
|
-
const integrationSlug = card.definition.slug;
|
|
3152
|
-
setFunctionInstructions((prev) => {
|
|
3153
|
-
const current = { ...prev[integrationSlug] ?? {}, [fnSlug]: instruction };
|
|
3154
|
-
const next = { ...prev, [integrationSlug]: current };
|
|
3155
|
-
const selected = selectedFunctions[integrationSlug] ?? /* @__PURE__ */ new Set();
|
|
3156
|
-
const customInstructions = buildCustomInstructions(integrationSlug, selected, current);
|
|
3157
|
-
updateAgentToolInstructions(card, customInstructions);
|
|
3158
|
-
return next;
|
|
3159
|
-
});
|
|
3160
|
-
},
|
|
3161
|
-
[selectedFunctions]
|
|
3162
|
-
);
|
|
3163
|
-
const updateAgentToolInstructions = useCallback5(
|
|
3164
|
-
(card, customInstructions) => {
|
|
3165
|
-
const toolId = card.tool?.id;
|
|
3166
|
-
if (!toolId) return;
|
|
3167
|
-
const agentTool = agentTools.find((at) => at.id_tool === toolId);
|
|
3168
|
-
if (!agentTool) return;
|
|
3169
|
-
updateAgentTool.mutate({
|
|
3170
|
-
idAgent: agentId,
|
|
3171
|
-
id: agentTool.id,
|
|
3172
|
-
body: { custom_instructions: customInstructions }
|
|
3173
|
-
});
|
|
3174
|
-
},
|
|
3175
|
-
[agentTools, agentId, updateAgentTool]
|
|
3176
|
-
);
|
|
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]);
|
|
3177
3214
|
if (isLoading || agentToolsLoading) {
|
|
3178
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" }) });
|
|
3179
3216
|
}
|
|
@@ -3188,13 +3225,13 @@ function IntegrationsTab({
|
|
|
3188
3225
|
/* @__PURE__ */ jsx11("p", { className: "text-xs text-muted-foreground", children: "Ative ou desative as integra\xE7\xF5es conectadas na conta para este agente." }),
|
|
3189
3226
|
/* @__PURE__ */ jsx11("div", { className: "grid grid-cols-1 gap-3", children: connectedCards.map((card) => {
|
|
3190
3227
|
const Icon = resolveIcon(card.definition.icon);
|
|
3191
|
-
const isLinked = card.linkedToAgent;
|
|
3192
|
-
const isMutating = addAgentTool.isPending || removeAgentTool.isPending || createTool.isPending;
|
|
3193
3228
|
const integrationSlug = card.definition.slug;
|
|
3229
|
+
const local = localState[integrationSlug];
|
|
3230
|
+
const isLinked = local?.enabled ?? false;
|
|
3194
3231
|
const fns = INTEGRATION_FUNCTIONS[integrationSlug];
|
|
3195
3232
|
const isExpanded = expandedCards.has(integrationSlug);
|
|
3196
|
-
const selected = selectedFunctions
|
|
3197
|
-
const instructions = functionInstructions
|
|
3233
|
+
const selected = local?.selectedFunctions ?? /* @__PURE__ */ new Set();
|
|
3234
|
+
const instructions = local?.functionInstructions ?? {};
|
|
3198
3235
|
return /* @__PURE__ */ jsxs9(
|
|
3199
3236
|
"div",
|
|
3200
3237
|
{
|
|
@@ -3243,7 +3280,7 @@ function IntegrationsTab({
|
|
|
3243
3280
|
Switch5,
|
|
3244
3281
|
{
|
|
3245
3282
|
checked: isLinked,
|
|
3246
|
-
disabled:
|
|
3283
|
+
disabled: isSaving,
|
|
3247
3284
|
onCheckedChange: (checked) => handleToggle(card, checked),
|
|
3248
3285
|
"aria-label": `${isLinked ? "Desativar" : "Ativar"} ${card.definition.name} para este agente`
|
|
3249
3286
|
}
|
|
@@ -3261,7 +3298,7 @@ function IntegrationsTab({
|
|
|
3261
3298
|
Checkbox2,
|
|
3262
3299
|
{
|
|
3263
3300
|
checked: isSelected,
|
|
3264
|
-
onCheckedChange: (val) => handleToggleFunction(
|
|
3301
|
+
onCheckedChange: (val) => handleToggleFunction(integrationSlug, fn.slug, val === true),
|
|
3265
3302
|
"aria-label": fn.label
|
|
3266
3303
|
}
|
|
3267
3304
|
),
|
|
@@ -3291,7 +3328,7 @@ function IntegrationsTab({
|
|
|
3291
3328
|
{
|
|
3292
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",
|
|
3293
3330
|
value: currentInstruction,
|
|
3294
|
-
onChange: (e) =>
|
|
3331
|
+
onChange: (e) => handleUpdateInstruction(integrationSlug, fn.slug, e.target.value),
|
|
3295
3332
|
placeholder: "Instru\xE7\xF5es personalizadas para esta fun\xE7\xE3o...",
|
|
3296
3333
|
rows: 2
|
|
3297
3334
|
}
|
|
@@ -3303,7 +3340,17 @@ function IntegrationsTab({
|
|
|
3303
3340
|
},
|
|
3304
3341
|
`${integrationSlug}-cred-${card.credentialId}`
|
|
3305
3342
|
);
|
|
3306
|
-
}) })
|
|
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
|
+
] })
|
|
3307
3354
|
] });
|
|
3308
3355
|
}
|
|
3309
3356
|
|
|
@@ -3364,7 +3411,7 @@ import { useState as useState10 } from "react";
|
|
|
3364
3411
|
import {
|
|
3365
3412
|
Switch as Switch6,
|
|
3366
3413
|
Badge as Badge6,
|
|
3367
|
-
Button as
|
|
3414
|
+
Button as Button9,
|
|
3368
3415
|
Skeleton as Skeleton6,
|
|
3369
3416
|
AlertDialog as AlertDialog3,
|
|
3370
3417
|
AlertDialogAction as AlertDialogAction3,
|
|
@@ -3397,7 +3444,7 @@ import {
|
|
|
3397
3444
|
Wrench,
|
|
3398
3445
|
Settings2
|
|
3399
3446
|
} from "lucide-react";
|
|
3400
|
-
import { toast as
|
|
3447
|
+
import { toast as toast8 } from "sonner";
|
|
3401
3448
|
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3402
3449
|
function AgentToolsList({ agent, config }) {
|
|
3403
3450
|
const { data: agentToolsData, isLoading } = useAgentTools(config, agent.id);
|
|
@@ -3434,9 +3481,9 @@ function AgentToolsList({ agent, config }) {
|
|
|
3434
3481
|
id: agentTool.id,
|
|
3435
3482
|
body: { enabled: checked }
|
|
3436
3483
|
});
|
|
3437
|
-
|
|
3484
|
+
toast8.success(checked ? "Ferramenta ativada" : "Ferramenta desativada");
|
|
3438
3485
|
} catch (err) {
|
|
3439
|
-
|
|
3486
|
+
toast8.error(
|
|
3440
3487
|
err instanceof Error ? err.message : "Erro ao alterar estado da ferramenta"
|
|
3441
3488
|
);
|
|
3442
3489
|
}
|
|
@@ -3447,11 +3494,11 @@ function AgentToolsList({ agent, config }) {
|
|
|
3447
3494
|
idAgent: agent.id,
|
|
3448
3495
|
body: { id_tool: tool.id }
|
|
3449
3496
|
});
|
|
3450
|
-
|
|
3497
|
+
toast8.success("Ferramenta adicionada");
|
|
3451
3498
|
setAddOpen(false);
|
|
3452
3499
|
setSearch("");
|
|
3453
3500
|
} catch (err) {
|
|
3454
|
-
|
|
3501
|
+
toast8.error(
|
|
3455
3502
|
err instanceof Error ? err.message : "Erro ao adicionar ferramenta"
|
|
3456
3503
|
);
|
|
3457
3504
|
}
|
|
@@ -3463,9 +3510,9 @@ function AgentToolsList({ agent, config }) {
|
|
|
3463
3510
|
idAgent: agent.id,
|
|
3464
3511
|
id: removeTarget.id
|
|
3465
3512
|
});
|
|
3466
|
-
|
|
3513
|
+
toast8.success("Ferramenta removida");
|
|
3467
3514
|
} catch (err) {
|
|
3468
|
-
|
|
3515
|
+
toast8.error(
|
|
3469
3516
|
err instanceof Error ? err.message : "Erro ao remover ferramenta"
|
|
3470
3517
|
);
|
|
3471
3518
|
} finally {
|
|
@@ -3489,10 +3536,10 @@ function AgentToolsList({ agent, config }) {
|
|
|
3489
3536
|
id_tool_credential: newCredentialId
|
|
3490
3537
|
}
|
|
3491
3538
|
});
|
|
3492
|
-
|
|
3539
|
+
toast8.success("Configura\xE7\xE3o atualizada");
|
|
3493
3540
|
setConfigTarget(null);
|
|
3494
3541
|
} catch (err) {
|
|
3495
|
-
|
|
3542
|
+
toast8.error(
|
|
3496
3543
|
err instanceof Error ? err.message : "Erro ao atualizar configura\xE7\xE3o"
|
|
3497
3544
|
);
|
|
3498
3545
|
}
|
|
@@ -3510,7 +3557,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
3510
3557
|
visibleAgentTools.length !== 1 ? "s" : ""
|
|
3511
3558
|
] }),
|
|
3512
3559
|
/* @__PURE__ */ jsxs11(Popover, { open: addOpen, onOpenChange: setAddOpen, children: [
|
|
3513
|
-
/* @__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: [
|
|
3514
3561
|
/* @__PURE__ */ jsx13(Plus2, { className: "mr-2 h-4 w-4" }),
|
|
3515
3562
|
"Adicionar Ferramenta"
|
|
3516
3563
|
] }) }),
|
|
@@ -3571,7 +3618,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
3571
3618
|
}
|
|
3572
3619
|
),
|
|
3573
3620
|
/* @__PURE__ */ jsx13(
|
|
3574
|
-
|
|
3621
|
+
Button9,
|
|
3575
3622
|
{
|
|
3576
3623
|
variant: "ghost",
|
|
3577
3624
|
size: "icon",
|
|
@@ -3583,7 +3630,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
3583
3630
|
}
|
|
3584
3631
|
),
|
|
3585
3632
|
/* @__PURE__ */ jsx13(
|
|
3586
|
-
|
|
3633
|
+
Button9,
|
|
3587
3634
|
{
|
|
3588
3635
|
variant: "ghost",
|
|
3589
3636
|
size: "icon",
|
|
@@ -3642,7 +3689,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
3642
3689
|
] }),
|
|
3643
3690
|
/* @__PURE__ */ jsxs11(DialogFooter4, { children: [
|
|
3644
3691
|
/* @__PURE__ */ jsx13(
|
|
3645
|
-
|
|
3692
|
+
Button9,
|
|
3646
3693
|
{
|
|
3647
3694
|
variant: "outline",
|
|
3648
3695
|
onClick: () => setConfigTarget(null),
|
|
@@ -3650,7 +3697,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
3650
3697
|
}
|
|
3651
3698
|
),
|
|
3652
3699
|
/* @__PURE__ */ jsx13(
|
|
3653
|
-
|
|
3700
|
+
Button9,
|
|
3654
3701
|
{
|
|
3655
3702
|
onClick: handleSaveConfig,
|
|
3656
3703
|
disabled: updateMutation.isPending,
|
|
@@ -3689,7 +3736,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
3689
3736
|
}
|
|
3690
3737
|
|
|
3691
3738
|
// src/components/tools/tools-table.tsx
|
|
3692
|
-
import { useMemo as
|
|
3739
|
+
import { useMemo as useMemo7, useState as useState11 } from "react";
|
|
3693
3740
|
import { DataTable as DataTable2 } from "@greatapps/greatauth-ui";
|
|
3694
3741
|
import {
|
|
3695
3742
|
Input as Input7,
|
|
@@ -3705,12 +3752,12 @@ import {
|
|
|
3705
3752
|
AlertDialogFooter as AlertDialogFooter4,
|
|
3706
3753
|
AlertDialogHeader as AlertDialogHeader4,
|
|
3707
3754
|
AlertDialogTitle as AlertDialogTitle4,
|
|
3708
|
-
Button as
|
|
3755
|
+
Button as Button10
|
|
3709
3756
|
} from "@greatapps/greatauth-ui/ui";
|
|
3710
3757
|
import { Pencil as Pencil5, Trash2 as Trash24, Search as Search2 } from "lucide-react";
|
|
3711
3758
|
import { format as format2 } from "date-fns";
|
|
3712
3759
|
import { ptBR as ptBR2 } from "date-fns/locale";
|
|
3713
|
-
import { toast as
|
|
3760
|
+
import { toast as toast9 } from "sonner";
|
|
3714
3761
|
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3715
3762
|
function useColumns2(onEdit, onDelete) {
|
|
3716
3763
|
return [
|
|
@@ -3753,7 +3800,7 @@ function useColumns2(onEdit, onDelete) {
|
|
|
3753
3800
|
cell: ({ row }) => /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
|
|
3754
3801
|
/* @__PURE__ */ jsxs12(Tooltip3, { children: [
|
|
3755
3802
|
/* @__PURE__ */ jsx14(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx14(
|
|
3756
|
-
|
|
3803
|
+
Button10,
|
|
3757
3804
|
{
|
|
3758
3805
|
variant: "ghost",
|
|
3759
3806
|
size: "icon",
|
|
@@ -3767,7 +3814,7 @@ function useColumns2(onEdit, onDelete) {
|
|
|
3767
3814
|
] }),
|
|
3768
3815
|
/* @__PURE__ */ jsxs12(Tooltip3, { children: [
|
|
3769
3816
|
/* @__PURE__ */ jsx14(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx14(
|
|
3770
|
-
|
|
3817
|
+
Button10,
|
|
3771
3818
|
{
|
|
3772
3819
|
variant: "ghost",
|
|
3773
3820
|
size: "icon",
|
|
@@ -3786,7 +3833,7 @@ function useColumns2(onEdit, onDelete) {
|
|
|
3786
3833
|
function ToolsTable({ onEdit, config }) {
|
|
3787
3834
|
const [search, setSearch] = useState11("");
|
|
3788
3835
|
const [page, setPage] = useState11(1);
|
|
3789
|
-
const queryParams =
|
|
3836
|
+
const queryParams = useMemo7(() => {
|
|
3790
3837
|
const params = {
|
|
3791
3838
|
limit: "15",
|
|
3792
3839
|
page: String(page)
|
|
@@ -3810,10 +3857,10 @@ function ToolsTable({ onEdit, config }) {
|
|
|
3810
3857
|
if (!deleteId) return;
|
|
3811
3858
|
deleteTool.mutate(deleteId, {
|
|
3812
3859
|
onSuccess: () => {
|
|
3813
|
-
|
|
3860
|
+
toast9.success("Ferramenta exclu\xEDda");
|
|
3814
3861
|
setDeleteId(null);
|
|
3815
3862
|
},
|
|
3816
|
-
onError: () =>
|
|
3863
|
+
onError: () => toast9.error("Erro ao excluir ferramenta")
|
|
3817
3864
|
});
|
|
3818
3865
|
}
|
|
3819
3866
|
function handleSearchChange(value) {
|
|
@@ -3886,7 +3933,7 @@ import {
|
|
|
3886
3933
|
DialogHeader as DialogHeader5,
|
|
3887
3934
|
DialogTitle as DialogTitle5,
|
|
3888
3935
|
DialogFooter as DialogFooter5,
|
|
3889
|
-
Button as
|
|
3936
|
+
Button as Button11,
|
|
3890
3937
|
Input as Input8,
|
|
3891
3938
|
Textarea as Textarea3,
|
|
3892
3939
|
Label as Label5,
|
|
@@ -3897,7 +3944,7 @@ import {
|
|
|
3897
3944
|
SelectValue as SelectValue2
|
|
3898
3945
|
} from "@greatapps/greatauth-ui/ui";
|
|
3899
3946
|
import { Loader2 as Loader26 } from "lucide-react";
|
|
3900
|
-
import { toast as
|
|
3947
|
+
import { toast as toast10 } from "sonner";
|
|
3901
3948
|
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3902
3949
|
var TOOL_AUTH_TYPES = [
|
|
3903
3950
|
{ value: "none", label: "Nenhuma" },
|
|
@@ -3994,16 +4041,16 @@ function ToolFormDialog({
|
|
|
3994
4041
|
try {
|
|
3995
4042
|
if (isEditing) {
|
|
3996
4043
|
await updateTool.mutateAsync({ id: tool.id, body });
|
|
3997
|
-
|
|
4044
|
+
toast10.success("Ferramenta atualizada");
|
|
3998
4045
|
} else {
|
|
3999
4046
|
await createTool.mutateAsync(
|
|
4000
4047
|
body
|
|
4001
4048
|
);
|
|
4002
|
-
|
|
4049
|
+
toast10.success("Ferramenta criada");
|
|
4003
4050
|
}
|
|
4004
4051
|
onOpenChange(false);
|
|
4005
4052
|
} catch (err) {
|
|
4006
|
-
|
|
4053
|
+
toast10.error(
|
|
4007
4054
|
err instanceof Error ? err.message : isEditing ? "Erro ao atualizar ferramenta" : "Erro ao criar ferramenta"
|
|
4008
4055
|
);
|
|
4009
4056
|
}
|
|
@@ -4134,7 +4181,7 @@ function ToolFormDialog({
|
|
|
4134
4181
|
] }),
|
|
4135
4182
|
/* @__PURE__ */ jsxs13(DialogFooter5, { children: [
|
|
4136
4183
|
/* @__PURE__ */ jsx15(
|
|
4137
|
-
|
|
4184
|
+
Button11,
|
|
4138
4185
|
{
|
|
4139
4186
|
type: "button",
|
|
4140
4187
|
variant: "outline",
|
|
@@ -4143,7 +4190,7 @@ function ToolFormDialog({
|
|
|
4143
4190
|
children: "Cancelar"
|
|
4144
4191
|
}
|
|
4145
4192
|
),
|
|
4146
|
-
/* @__PURE__ */ jsxs13(
|
|
4193
|
+
/* @__PURE__ */ jsxs13(Button11, { type: "submit", disabled: isPending, children: [
|
|
4147
4194
|
isPending ? /* @__PURE__ */ jsx15(Loader26, { "aria-hidden": "true", className: "mr-2 h-4 w-4 animate-spin" }) : null,
|
|
4148
4195
|
isEditing ? "Salvar" : "Criar"
|
|
4149
4196
|
] })
|
|
@@ -4153,11 +4200,11 @@ function ToolFormDialog({
|
|
|
4153
4200
|
}
|
|
4154
4201
|
|
|
4155
4202
|
// src/components/tools/tool-credentials-form.tsx
|
|
4156
|
-
import { useMemo as
|
|
4203
|
+
import { useMemo as useMemo8, useState as useState13 } from "react";
|
|
4157
4204
|
import { DataTable as DataTable3 } from "@greatapps/greatauth-ui";
|
|
4158
4205
|
import {
|
|
4159
4206
|
Input as Input9,
|
|
4160
|
-
Button as
|
|
4207
|
+
Button as Button12,
|
|
4161
4208
|
Badge as Badge8,
|
|
4162
4209
|
Tooltip as Tooltip4,
|
|
4163
4210
|
TooltipTrigger as TooltipTrigger4,
|
|
@@ -4174,7 +4221,7 @@ import {
|
|
|
4174
4221
|
import { Trash2 as Trash25, Search as Search3 } from "lucide-react";
|
|
4175
4222
|
import { format as format3 } from "date-fns";
|
|
4176
4223
|
import { ptBR as ptBR3 } from "date-fns/locale";
|
|
4177
|
-
import { toast as
|
|
4224
|
+
import { toast as toast11 } from "sonner";
|
|
4178
4225
|
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4179
4226
|
function formatDate2(dateStr) {
|
|
4180
4227
|
if (!dateStr) return "Sem expira\xE7\xE3o";
|
|
@@ -4225,7 +4272,7 @@ function useColumns3(tools, onRemove) {
|
|
|
4225
4272
|
enableSorting: false,
|
|
4226
4273
|
cell: ({ row }) => /* @__PURE__ */ jsx16("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxs14(Tooltip4, { children: [
|
|
4227
4274
|
/* @__PURE__ */ jsx16(TooltipTrigger4, { asChild: true, children: /* @__PURE__ */ jsx16(
|
|
4228
|
-
|
|
4275
|
+
Button12,
|
|
4229
4276
|
{
|
|
4230
4277
|
variant: "ghost",
|
|
4231
4278
|
size: "icon",
|
|
@@ -4251,13 +4298,13 @@ function ToolCredentialsForm({
|
|
|
4251
4298
|
const tools = (toolsData?.data || []).filter((t) => !t.slug?.startsWith("gclinic_"));
|
|
4252
4299
|
const [search, setSearch] = useState13("");
|
|
4253
4300
|
const [removeTarget, setRemoveTarget] = useState13(null);
|
|
4254
|
-
const internalToolIds =
|
|
4301
|
+
const internalToolIds = useMemo8(() => {
|
|
4255
4302
|
const allRawTools = toolsData?.data || [];
|
|
4256
4303
|
return new Set(
|
|
4257
4304
|
allRawTools.filter((t) => t.slug?.startsWith("gclinic_")).map((t) => t.id)
|
|
4258
4305
|
);
|
|
4259
4306
|
}, [toolsData]);
|
|
4260
|
-
const filteredCredentials =
|
|
4307
|
+
const filteredCredentials = useMemo8(() => {
|
|
4261
4308
|
const visible = credentials.filter(
|
|
4262
4309
|
(cred) => !cred.id_tool || !internalToolIds.has(cred.id_tool)
|
|
4263
4310
|
);
|
|
@@ -4277,12 +4324,12 @@ function ToolCredentialsForm({
|
|
|
4277
4324
|
try {
|
|
4278
4325
|
const result = await deleteMutation.mutateAsync(removeTarget.id);
|
|
4279
4326
|
if (result.status === 1) {
|
|
4280
|
-
|
|
4327
|
+
toast11.success("Credencial removida");
|
|
4281
4328
|
} else {
|
|
4282
|
-
|
|
4329
|
+
toast11.error(result.message || "Erro ao remover credencial");
|
|
4283
4330
|
}
|
|
4284
4331
|
} catch {
|
|
4285
|
-
|
|
4332
|
+
toast11.error("Erro ao remover credencial");
|
|
4286
4333
|
} finally {
|
|
4287
4334
|
setRemoveTarget(null);
|
|
4288
4335
|
}
|
|
@@ -4343,7 +4390,7 @@ function ToolCredentialsForm({
|
|
|
4343
4390
|
import { useState as useState14 } from "react";
|
|
4344
4391
|
import {
|
|
4345
4392
|
Badge as Badge9,
|
|
4346
|
-
Button as
|
|
4393
|
+
Button as Button13,
|
|
4347
4394
|
DropdownMenu,
|
|
4348
4395
|
DropdownMenuContent,
|
|
4349
4396
|
DropdownMenuItem,
|
|
@@ -4436,7 +4483,7 @@ function IntegrationCard({
|
|
|
4436
4483
|
] })
|
|
4437
4484
|
] }),
|
|
4438
4485
|
/* @__PURE__ */ jsx17("div", { className: "mt-auto flex items-center justify-end pt-1", children: /* @__PURE__ */ jsx17(
|
|
4439
|
-
|
|
4486
|
+
Button13,
|
|
4440
4487
|
{
|
|
4441
4488
|
variant: "outline",
|
|
4442
4489
|
size: "sm",
|
|
@@ -4491,7 +4538,7 @@ function IntegrationCard({
|
|
|
4491
4538
|
] }),
|
|
4492
4539
|
/* @__PURE__ */ jsx17("div", { className: "mt-auto flex items-center justify-end gap-2 pt-1", children: /* @__PURE__ */ jsxs15(DropdownMenu, { children: [
|
|
4493
4540
|
/* @__PURE__ */ jsx17(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs15(
|
|
4494
|
-
|
|
4541
|
+
Button13,
|
|
4495
4542
|
{
|
|
4496
4543
|
variant: "outline",
|
|
4497
4544
|
size: "sm",
|
|
@@ -4613,17 +4660,17 @@ function AdvancedTab({ config, agentId, gagentsApiUrl }) {
|
|
|
4613
4660
|
}
|
|
4614
4661
|
|
|
4615
4662
|
// src/components/capabilities/integration-wizard.tsx
|
|
4616
|
-
import { useCallback as useCallback6, useEffect as
|
|
4663
|
+
import { useCallback as useCallback6, useEffect as useEffect6, useRef as useRef2, useState as useState16 } from "react";
|
|
4617
4664
|
import {
|
|
4618
4665
|
Dialog as Dialog6,
|
|
4619
4666
|
DialogContent as DialogContent6,
|
|
4620
4667
|
DialogFooter as DialogFooter6,
|
|
4621
4668
|
DialogHeader as DialogHeader6,
|
|
4622
4669
|
DialogTitle as DialogTitle6,
|
|
4623
|
-
Button as
|
|
4670
|
+
Button as Button15
|
|
4624
4671
|
} from "@greatapps/greatauth-ui/ui";
|
|
4625
4672
|
import { Loader2 as Loader29, ChevronLeft, ChevronRight, Check as Check2 } from "lucide-react";
|
|
4626
|
-
import { toast as
|
|
4673
|
+
import { toast as toast12 } from "sonner";
|
|
4627
4674
|
|
|
4628
4675
|
// src/components/capabilities/wizard-steps/info-step.tsx
|
|
4629
4676
|
import { Check, Info as Info2 } from "lucide-react";
|
|
@@ -4682,7 +4729,7 @@ function InfoStep({ integration, meta }) {
|
|
|
4682
4729
|
|
|
4683
4730
|
// src/components/capabilities/wizard-steps/credentials-step.tsx
|
|
4684
4731
|
import { CheckCircle2, Loader2 as Loader27, AlertCircle, Shield } from "lucide-react";
|
|
4685
|
-
import { Button as
|
|
4732
|
+
import { Button as Button14, Input as Input10, Label as Label6 } from "@greatapps/greatauth-ui/ui";
|
|
4686
4733
|
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4687
4734
|
function CredentialsStep({
|
|
4688
4735
|
integration,
|
|
@@ -4725,7 +4772,7 @@ function OAuthCredentials({
|
|
|
4725
4772
|
] }),
|
|
4726
4773
|
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col items-center gap-4 rounded-lg border p-6", children: [
|
|
4727
4774
|
oauthStatus === "idle" && /* @__PURE__ */ jsxs18(
|
|
4728
|
-
|
|
4775
|
+
Button14,
|
|
4729
4776
|
{
|
|
4730
4777
|
onClick: onStartOAuth,
|
|
4731
4778
|
size: "lg",
|
|
@@ -4774,7 +4821,7 @@ function OAuthCredentials({
|
|
|
4774
4821
|
/* @__PURE__ */ jsx20("p", { className: "text-sm font-medium text-destructive", children: "Falha na conex\xE3o" }),
|
|
4775
4822
|
oauthResult?.error && /* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground", children: oauthResult.error })
|
|
4776
4823
|
] }),
|
|
4777
|
-
/* @__PURE__ */ jsx20(
|
|
4824
|
+
/* @__PURE__ */ jsx20(Button14, { variant: "outline", onClick: onStartOAuth, size: "sm", children: "Tentar novamente" })
|
|
4778
4825
|
] })
|
|
4779
4826
|
] }),
|
|
4780
4827
|
/* @__PURE__ */ jsxs18("div", { className: "flex items-start gap-2 rounded-md bg-muted/50 p-3", children: [
|
|
@@ -5027,14 +5074,14 @@ function IntegrationWizard({
|
|
|
5027
5074
|
const [selectedConfigValue, setSelectedConfigValue] = useState16("");
|
|
5028
5075
|
const [enableOnComplete, setEnableOnComplete] = useState16(true);
|
|
5029
5076
|
const [isSubmitting, setIsSubmitting] = useState16(false);
|
|
5030
|
-
|
|
5077
|
+
useEffect6(() => {
|
|
5031
5078
|
return () => {
|
|
5032
5079
|
if (popupPollRef.current) {
|
|
5033
5080
|
clearInterval(popupPollRef.current);
|
|
5034
5081
|
}
|
|
5035
5082
|
};
|
|
5036
5083
|
}, []);
|
|
5037
|
-
|
|
5084
|
+
useEffect6(() => {
|
|
5038
5085
|
if (open) {
|
|
5039
5086
|
setCurrentStep("info");
|
|
5040
5087
|
setOauthStatus("idle");
|
|
@@ -5095,7 +5142,7 @@ function IntegrationWizard({
|
|
|
5095
5142
|
},
|
|
5096
5143
|
[gagentsApiUrl, existingCredentialId, meta.hasConfigStep, loadConfigOptions]
|
|
5097
5144
|
);
|
|
5098
|
-
|
|
5145
|
+
useEffect6(() => {
|
|
5099
5146
|
if (!open) return;
|
|
5100
5147
|
window.addEventListener("message", handleOAuthMessage);
|
|
5101
5148
|
return () => window.removeEventListener("message", handleOAuthMessage);
|
|
@@ -5195,11 +5242,11 @@ function IntegrationWizard({
|
|
|
5195
5242
|
setIsSubmitting(true);
|
|
5196
5243
|
try {
|
|
5197
5244
|
onComplete();
|
|
5198
|
-
|
|
5245
|
+
toast12.success(
|
|
5199
5246
|
`${integration.name} ${isReconnect ? "reconectado" : "configurado"} com sucesso!`
|
|
5200
5247
|
);
|
|
5201
5248
|
} catch {
|
|
5202
|
-
|
|
5249
|
+
toast12.error("Erro ao finalizar configura\xE7\xE3o");
|
|
5203
5250
|
} finally {
|
|
5204
5251
|
setIsSubmitting(false);
|
|
5205
5252
|
}
|
|
@@ -5254,7 +5301,7 @@ function IntegrationWizard({
|
|
|
5254
5301
|
] }),
|
|
5255
5302
|
/* @__PURE__ */ jsxs21(DialogFooter6, { className: "flex-row justify-between sm:justify-between", children: [
|
|
5256
5303
|
/* @__PURE__ */ jsx23("div", { children: currentStep === "info" ? /* @__PURE__ */ jsx23(
|
|
5257
|
-
|
|
5304
|
+
Button15,
|
|
5258
5305
|
{
|
|
5259
5306
|
type: "button",
|
|
5260
5307
|
variant: "outline",
|
|
@@ -5262,7 +5309,7 @@ function IntegrationWizard({
|
|
|
5262
5309
|
children: "Cancelar"
|
|
5263
5310
|
}
|
|
5264
5311
|
) : /* @__PURE__ */ jsxs21(
|
|
5265
|
-
|
|
5312
|
+
Button15,
|
|
5266
5313
|
{
|
|
5267
5314
|
type: "button",
|
|
5268
5315
|
variant: "outline",
|
|
@@ -5275,7 +5322,7 @@ function IntegrationWizard({
|
|
|
5275
5322
|
}
|
|
5276
5323
|
) }),
|
|
5277
5324
|
/* @__PURE__ */ jsx23("div", { children: isLastStep ? /* @__PURE__ */ jsxs21(
|
|
5278
|
-
|
|
5325
|
+
Button15,
|
|
5279
5326
|
{
|
|
5280
5327
|
type: "button",
|
|
5281
5328
|
onClick: handleComplete,
|
|
@@ -5293,7 +5340,7 @@ function IntegrationWizard({
|
|
|
5293
5340
|
]
|
|
5294
5341
|
}
|
|
5295
5342
|
) : /* @__PURE__ */ jsxs21(
|
|
5296
|
-
|
|
5343
|
+
Button15,
|
|
5297
5344
|
{
|
|
5298
5345
|
type: "button",
|
|
5299
5346
|
onClick: goNext,
|
|
@@ -5363,7 +5410,7 @@ function StepIndicator({
|
|
|
5363
5410
|
|
|
5364
5411
|
// src/pages/agents-page.tsx
|
|
5365
5412
|
import { useState as useState17 } from "react";
|
|
5366
|
-
import { Button as
|
|
5413
|
+
import { Button as Button16 } from "@greatapps/greatauth-ui/ui";
|
|
5367
5414
|
import { Plus as Plus4 } from "lucide-react";
|
|
5368
5415
|
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5369
5416
|
function AgentsPage({
|
|
@@ -5379,7 +5426,7 @@ function AgentsPage({
|
|
|
5379
5426
|
/* @__PURE__ */ jsx24("h1", { className: "text-xl font-semibold", children: title }),
|
|
5380
5427
|
/* @__PURE__ */ jsx24("p", { className: "text-sm text-muted-foreground", children: subtitle })
|
|
5381
5428
|
] }),
|
|
5382
|
-
/* @__PURE__ */ jsxs22(
|
|
5429
|
+
/* @__PURE__ */ jsxs22(Button16, { onClick: () => setCreateOpen(true), size: "sm", children: [
|
|
5383
5430
|
/* @__PURE__ */ jsx24(Plus4, { className: "mr-2 h-4 w-4" }),
|
|
5384
5431
|
"Novo Agente"
|
|
5385
5432
|
] })
|
|
@@ -5398,7 +5445,7 @@ function AgentsPage({
|
|
|
5398
5445
|
|
|
5399
5446
|
// src/pages/agent-detail-page.tsx
|
|
5400
5447
|
import { useState as useState18 } from "react";
|
|
5401
|
-
import { Badge as Badge10, Button as
|
|
5448
|
+
import { Badge as Badge10, Button as Button17, Skeleton as Skeleton7 } from "@greatapps/greatauth-ui/ui";
|
|
5402
5449
|
import { EntityAvatar as EntityAvatar2 } from "@greatapps/greatauth-ui";
|
|
5403
5450
|
import { ArrowLeft, Pencil as Pencil6 } from "lucide-react";
|
|
5404
5451
|
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
@@ -5421,7 +5468,7 @@ function AgentDetailPage({
|
|
|
5421
5468
|
if (!agent) {
|
|
5422
5469
|
return /* @__PURE__ */ jsxs23("div", { className: "flex flex-col items-center justify-center gap-2 p-8", children: [
|
|
5423
5470
|
/* @__PURE__ */ jsx25("p", { className: "text-muted-foreground", children: "Agente n\xE3o encontrado" }),
|
|
5424
|
-
onBack && /* @__PURE__ */ jsxs23(
|
|
5471
|
+
onBack && /* @__PURE__ */ jsxs23(Button17, { variant: "ghost", size: "sm", onClick: onBack, children: [
|
|
5425
5472
|
/* @__PURE__ */ jsx25(ArrowLeft, { className: "mr-2 h-4 w-4" }),
|
|
5426
5473
|
"Voltar para agentes"
|
|
5427
5474
|
] })
|
|
@@ -5431,7 +5478,7 @@ function AgentDetailPage({
|
|
|
5431
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: [
|
|
5432
5479
|
/* @__PURE__ */ jsxs23("div", { className: "flex items-start gap-3 flex-1", children: [
|
|
5433
5480
|
onBack && /* @__PURE__ */ jsx25(
|
|
5434
|
-
|
|
5481
|
+
Button17,
|
|
5435
5482
|
{
|
|
5436
5483
|
variant: "ghost",
|
|
5437
5484
|
size: "icon",
|
|
@@ -5455,7 +5502,7 @@ function AgentDetailPage({
|
|
|
5455
5502
|
] }) })
|
|
5456
5503
|
] }),
|
|
5457
5504
|
/* @__PURE__ */ jsxs23(
|
|
5458
|
-
|
|
5505
|
+
Button17,
|
|
5459
5506
|
{
|
|
5460
5507
|
variant: "outline",
|
|
5461
5508
|
size: "sm",
|
|
@@ -5539,7 +5586,7 @@ function AgentCapabilitiesPage({
|
|
|
5539
5586
|
|
|
5540
5587
|
// src/pages/tools-page.tsx
|
|
5541
5588
|
import { useState as useState19 } from "react";
|
|
5542
|
-
import { Button as
|
|
5589
|
+
import { Button as Button18 } from "@greatapps/greatauth-ui/ui";
|
|
5543
5590
|
import { Plus as Plus5 } from "lucide-react";
|
|
5544
5591
|
import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5545
5592
|
function ToolsPage({
|
|
@@ -5555,7 +5602,7 @@ function ToolsPage({
|
|
|
5555
5602
|
/* @__PURE__ */ jsx27("h1", { className: "text-xl font-semibold", children: title }),
|
|
5556
5603
|
/* @__PURE__ */ jsx27("p", { className: "text-sm text-muted-foreground", children: subtitle })
|
|
5557
5604
|
] }),
|
|
5558
|
-
/* @__PURE__ */ jsxs25(
|
|
5605
|
+
/* @__PURE__ */ jsxs25(Button18, { onClick: () => setCreateOpen(true), size: "sm", children: [
|
|
5559
5606
|
/* @__PURE__ */ jsx27(Plus5, { className: "mr-2 h-4 w-4" }),
|
|
5560
5607
|
"Nova Ferramenta"
|
|
5561
5608
|
] })
|