@greatapps/greatagents-ui 0.3.13 → 0.3.14

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
@@ -2511,7 +2511,7 @@ import {
2511
2511
  Skeleton as Skeleton5
2512
2512
  } from "@greatapps/greatauth-ui/ui";
2513
2513
  import {
2514
- Calendar,
2514
+ CalendarCheck,
2515
2515
  Users,
2516
2516
  Settings,
2517
2517
  HeartHandshake,
@@ -2531,7 +2531,7 @@ function getOperationLabel(slug) {
2531
2531
  return OPERATION_LABELS[slug] ?? slug;
2532
2532
  }
2533
2533
  var CATEGORY_ICONS = {
2534
- agenda: Calendar,
2534
+ agenda: CalendarCheck,
2535
2535
  cadastros: Users,
2536
2536
  infraestrutura: Settings,
2537
2537
  relacionamentos: HeartHandshake
@@ -2833,33 +2833,29 @@ function IntegrationsTab({
2833
2833
  config,
2834
2834
  agentId
2835
2835
  }) {
2836
- const { cards, isLoading } = useIntegrationState(config, null);
2837
- const { data: toolsData } = useTools(config);
2836
+ const { cards, isLoading } = useIntegrationState(config, agentId);
2838
2837
  const { data: agentToolsData, isLoading: agentToolsLoading } = useAgentTools(config, agentId);
2839
2838
  const addAgentTool = useAddAgentTool(config);
2840
2839
  const removeAgentTool = useRemoveAgentTool(config);
2841
- const tools = toolsData?.data ?? [];
2842
2840
  const agentTools = agentToolsData?.data ?? [];
2843
2841
  const connectedCards = cards.filter(
2844
2842
  (c) => !c.isAddNew && (c.state === "connected" || c.state === "expired")
2845
2843
  );
2846
2844
  const handleToggle = useCallback5(
2847
- (credentialId, toolSlug, checked) => {
2848
- const tool = tools.find((t) => t.slug === toolSlug);
2849
- if (!tool) return;
2845
+ (toolId, checked) => {
2850
2846
  if (checked) {
2851
2847
  addAgentTool.mutate({
2852
2848
  idAgent: agentId,
2853
- body: { id_tool: tool.id, enabled: true }
2849
+ body: { id_tool: toolId, enabled: true }
2854
2850
  });
2855
2851
  } else {
2856
- const agentTool = agentTools.find((at) => at.id_tool === tool.id);
2852
+ const agentTool = agentTools.find((at) => at.id_tool === toolId);
2857
2853
  if (agentTool) {
2858
2854
  removeAgentTool.mutate({ idAgent: agentId, id: agentTool.id });
2859
2855
  }
2860
2856
  }
2861
2857
  },
2862
- [tools, agentTools, agentId, addAgentTool, removeAgentTool]
2858
+ [agentTools, agentId, addAgentTool, removeAgentTool]
2863
2859
  );
2864
2860
  if (isLoading || agentToolsLoading) {
2865
2861
  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" }) });
@@ -2875,8 +2871,7 @@ function IntegrationsTab({
2875
2871
  /* @__PURE__ */ jsx11("p", { className: "text-xs text-muted-foreground", children: "Ative ou desative as integra\xE7\xF5es conectadas na conta para este agente." }),
2876
2872
  /* @__PURE__ */ jsx11("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3", children: connectedCards.map((card) => {
2877
2873
  const Icon = resolveIcon(card.definition.icon);
2878
- const tool = tools.find((t) => t.slug === card.definition.slug);
2879
- const isLinked = tool ? agentTools.some((at) => at.id_tool === tool.id) : false;
2874
+ const isLinked = card.linkedToAgent;
2880
2875
  const isMutating = addAgentTool.isPending || removeAgentTool.isPending;
2881
2876
  return /* @__PURE__ */ jsxs9(
2882
2877
  "div",
@@ -2899,8 +2894,8 @@ function IntegrationsTab({
2899
2894
  Switch5,
2900
2895
  {
2901
2896
  checked: isLinked,
2902
- disabled: isMutating,
2903
- onCheckedChange: (checked) => card.credentialId && handleToggle(card.credentialId, card.definition.slug, checked),
2897
+ disabled: isMutating || !card.tool,
2898
+ onCheckedChange: (checked) => card.tool && handleToggle(card.tool.id, checked),
2904
2899
  "aria-label": `${isLinked ? "Desativar" : "Ativar"} ${card.definition.name} para este agente`
2905
2900
  }
2906
2901
  )
@@ -3767,11 +3762,6 @@ import {
3767
3762
  Tooltip as Tooltip4,
3768
3763
  TooltipTrigger as TooltipTrigger4,
3769
3764
  TooltipContent as TooltipContent4,
3770
- Dialog as Dialog6,
3771
- DialogContent as DialogContent6,
3772
- DialogHeader as DialogHeader6,
3773
- DialogTitle as DialogTitle6,
3774
- DialogFooter as DialogFooter6,
3775
3765
  AlertDialog as AlertDialog5,
3776
3766
  AlertDialogAction as AlertDialogAction5,
3777
3767
  AlertDialogCancel as AlertDialogCancel5,
@@ -3779,14 +3769,9 @@ import {
3779
3769
  AlertDialogDescription as AlertDialogDescription5,
3780
3770
  AlertDialogFooter as AlertDialogFooter5,
3781
3771
  AlertDialogHeader as AlertDialogHeader5,
3782
- AlertDialogTitle as AlertDialogTitle5,
3783
- Select as Select3,
3784
- SelectContent as SelectContent3,
3785
- SelectItem as SelectItem3,
3786
- SelectTrigger as SelectTrigger3,
3787
- SelectValue as SelectValue3
3772
+ AlertDialogTitle as AlertDialogTitle5
3788
3773
  } from "@greatapps/greatauth-ui/ui";
3789
- import { Trash2 as Trash25, Pencil as Pencil4, Link, Search as Search3 } from "lucide-react";
3774
+ import { Trash2 as Trash25, Search as Search3 } from "lucide-react";
3790
3775
  import { format as format3 } from "date-fns";
3791
3776
  import { ptBR as ptBR3 } from "date-fns/locale";
3792
3777
  import { toast as toast10 } from "sonner";
@@ -3795,17 +3780,12 @@ function formatDate2(dateStr) {
3795
3780
  if (!dateStr) return "Sem expira\xE7\xE3o";
3796
3781
  return format3(new Date(dateStr), "dd/MM/yyyy", { locale: ptBR3 });
3797
3782
  }
3798
- function useColumns3(tools, onEdit, onConnect, onRemove) {
3783
+ function useColumns3(tools, onRemove) {
3799
3784
  function getToolName(idTool) {
3800
3785
  if (!idTool) return "\u2014";
3801
3786
  const tool = tools.find((t) => t.id === idTool);
3802
3787
  return tool?.name || `Ferramenta #${idTool}`;
3803
3788
  }
3804
- function getToolType(idTool) {
3805
- if (!idTool) return null;
3806
- const tool = tools.find((t) => t.id === idTool);
3807
- return tool?.type || null;
3808
- }
3809
3789
  return [
3810
3790
  {
3811
3791
  accessorKey: "label",
@@ -3843,50 +3823,20 @@ function useColumns3(tools, onEdit, onConnect, onRemove) {
3843
3823
  header: "A\xE7\xF5es",
3844
3824
  size: 100,
3845
3825
  enableSorting: false,
3846
- cell: ({ row }) => /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-1", children: [
3847
- getToolType(row.original.id_tool) === "oauth2" && /* @__PURE__ */ jsxs14(Tooltip4, { children: [
3848
- /* @__PURE__ */ jsx16(TooltipTrigger4, { asChild: true, children: /* @__PURE__ */ jsx16(
3849
- Button11,
3850
- {
3851
- variant: "ghost",
3852
- size: "icon",
3853
- className: "h-8 w-8",
3854
- "aria-label": "Vincular",
3855
- disabled: true,
3856
- children: /* @__PURE__ */ jsx16(Link, { className: "h-4 w-4" })
3857
- }
3858
- ) }),
3859
- /* @__PURE__ */ jsx16(TooltipContent4, { children: "Em breve" })
3860
- ] }),
3861
- /* @__PURE__ */ jsxs14(Tooltip4, { children: [
3862
- /* @__PURE__ */ jsx16(TooltipTrigger4, { asChild: true, children: /* @__PURE__ */ jsx16(
3863
- Button11,
3864
- {
3865
- variant: "ghost",
3866
- size: "icon",
3867
- className: "h-8 w-8",
3868
- "aria-label": "Editar",
3869
- onClick: () => onEdit(row.original),
3870
- children: /* @__PURE__ */ jsx16(Pencil4, { className: "h-4 w-4" })
3871
- }
3872
- ) }),
3873
- /* @__PURE__ */ jsx16(TooltipContent4, { children: "Editar" })
3874
- ] }),
3875
- /* @__PURE__ */ jsxs14(Tooltip4, { children: [
3876
- /* @__PURE__ */ jsx16(TooltipTrigger4, { asChild: true, children: /* @__PURE__ */ jsx16(
3877
- Button11,
3878
- {
3879
- variant: "ghost",
3880
- size: "icon",
3881
- className: "h-8 w-8 text-destructive hover:text-destructive",
3882
- "aria-label": "Excluir",
3883
- onClick: () => onRemove(row.original),
3884
- children: /* @__PURE__ */ jsx16(Trash25, { className: "h-4 w-4" })
3885
- }
3886
- ) }),
3887
- /* @__PURE__ */ jsx16(TooltipContent4, { children: "Remover" })
3888
- ] })
3889
- ] })
3826
+ cell: ({ row }) => /* @__PURE__ */ jsx16("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxs14(Tooltip4, { children: [
3827
+ /* @__PURE__ */ jsx16(TooltipTrigger4, { asChild: true, children: /* @__PURE__ */ jsx16(
3828
+ Button11,
3829
+ {
3830
+ variant: "ghost",
3831
+ size: "icon",
3832
+ className: "h-8 w-8 text-destructive hover:text-destructive",
3833
+ "aria-label": "Excluir",
3834
+ onClick: () => onRemove(row.original),
3835
+ children: /* @__PURE__ */ jsx16(Trash25, { className: "h-4 w-4" })
3836
+ }
3837
+ ) }),
3838
+ /* @__PURE__ */ jsx16(TooltipContent4, { children: "Remover" })
3839
+ ] }) })
3890
3840
  }
3891
3841
  ];
3892
3842
  }
@@ -3894,33 +3844,12 @@ function ToolCredentialsForm({
3894
3844
  credentials,
3895
3845
  isLoading,
3896
3846
  config,
3897
- gagentsApiUrl,
3898
- createOpen: externalCreateOpen,
3899
- onCreateOpenChange
3847
+ gagentsApiUrl
3900
3848
  }) {
3901
- const createMutation = useCreateToolCredential(config);
3902
- const updateMutation = useUpdateToolCredential(config);
3903
3849
  const deleteMutation = useDeleteToolCredential(config);
3904
3850
  const { data: toolsData } = useTools(config);
3905
3851
  const tools = (toolsData?.data || []).filter((t) => !t.slug?.startsWith("gclinic_"));
3906
3852
  const [search, setSearch] = useState12("");
3907
- const [internalCreateOpen, setInternalCreateOpen] = useState12(false);
3908
- const showCreateDialog = externalCreateOpen ?? internalCreateOpen;
3909
- const setShowCreateDialog = onCreateOpenChange ?? setInternalCreateOpen;
3910
- const [createForm, setCreateForm] = useState12({
3911
- id_tool: "",
3912
- label: "",
3913
- credentials_encrypted: "",
3914
- expires_at: ""
3915
- });
3916
- const [editTarget, setEditTarget] = useState12(null);
3917
- const [editForm, setEditForm] = useState12({
3918
- id_tool: "",
3919
- label: "",
3920
- credentials_encrypted: "",
3921
- expires_at: "",
3922
- status: ""
3923
- });
3924
3853
  const [removeTarget, setRemoveTarget] = useState12(null);
3925
3854
  const internalToolIds = useMemo7(() => {
3926
3855
  const allRawTools = toolsData?.data || [];
@@ -3941,79 +3870,8 @@ function ToolCredentialsForm({
3941
3870
  }, [credentials, search, tools, internalToolIds]);
3942
3871
  const columns = useColumns3(
3943
3872
  tools,
3944
- (cred) => startEdit(cred),
3945
- (cred) => handleConnect(cred),
3946
3873
  (cred) => setRemoveTarget(cred)
3947
3874
  );
3948
- async function handleCreate() {
3949
- const idTool = parseInt(createForm.id_tool, 10);
3950
- if (!idTool || !createForm.label.trim() || !createForm.credentials_encrypted.trim()) return;
3951
- try {
3952
- const result = await createMutation.mutateAsync({
3953
- id_tool: idTool,
3954
- label: createForm.label.trim(),
3955
- credentials_encrypted: createForm.credentials_encrypted.trim(),
3956
- ...createForm.expires_at ? { expires_at: createForm.expires_at } : {}
3957
- });
3958
- if (result.status === 1) {
3959
- toast10.success("Credencial criada");
3960
- setShowCreateDialog(false);
3961
- setCreateForm({ id_tool: "", label: "", credentials_encrypted: "", expires_at: "" });
3962
- } else {
3963
- toast10.error(result.message || "Erro ao criar credencial");
3964
- }
3965
- } catch {
3966
- toast10.error("Erro ao criar credencial");
3967
- }
3968
- }
3969
- function startEdit(cred) {
3970
- setEditTarget(cred);
3971
- setEditForm({
3972
- id_tool: cred.id_tool ? String(cred.id_tool) : "",
3973
- label: cred.label || "",
3974
- credentials_encrypted: "",
3975
- expires_at: cred.expires_at || "",
3976
- status: cred.status
3977
- });
3978
- }
3979
- async function handleSaveEdit() {
3980
- if (!editTarget) return;
3981
- const body = {};
3982
- const newIdTool = editForm.id_tool ? parseInt(editForm.id_tool, 10) : null;
3983
- if (newIdTool && newIdTool !== editTarget.id_tool) {
3984
- body.id_tool = newIdTool;
3985
- }
3986
- if (editForm.label.trim() && editForm.label.trim() !== (editTarget.label || "")) {
3987
- body.label = editForm.label.trim();
3988
- }
3989
- if (editForm.credentials_encrypted.trim()) {
3990
- body.credentials_encrypted = editForm.credentials_encrypted.trim();
3991
- }
3992
- if (editForm.expires_at !== (editTarget.expires_at || "")) {
3993
- body.expires_at = editForm.expires_at || null;
3994
- }
3995
- if (editForm.status && editForm.status !== editTarget.status) {
3996
- body.status = editForm.status;
3997
- }
3998
- if (Object.keys(body).length === 0) {
3999
- setEditTarget(null);
4000
- return;
4001
- }
4002
- try {
4003
- const result = await updateMutation.mutateAsync({
4004
- id: editTarget.id,
4005
- body
4006
- });
4007
- if (result.status === 1) {
4008
- toast10.success("Credencial atualizada");
4009
- setEditTarget(null);
4010
- } else {
4011
- toast10.error(result.message || "Erro ao atualizar credencial");
4012
- }
4013
- } catch {
4014
- toast10.error("Erro ao atualizar credencial");
4015
- }
4016
- }
4017
3875
  async function handleRemove() {
4018
3876
  if (!removeTarget) return;
4019
3877
  try {
@@ -4029,13 +3887,6 @@ function ToolCredentialsForm({
4029
3887
  setRemoveTarget(null);
4030
3888
  }
4031
3889
  }
4032
- function handleConnect(cred) {
4033
- if (!config.accountId || !config.token) return;
4034
- const language = config.language ?? "pt-br";
4035
- const idWl = config.idWl ?? 1;
4036
- const url = `${gagentsApiUrl}/v1/${language}/${idWl}/accounts/${config.accountId}/oauth/connect?id_tool=${cred.id_tool}`;
4037
- window.open(url, "_blank");
4038
- }
4039
3890
  return /* @__PURE__ */ jsxs14("div", { className: "space-y-4", children: [
4040
3891
  /* @__PURE__ */ jsx16("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs14("div", { className: "relative flex-1 max-w-md", children: [
4041
3892
  /* @__PURE__ */ jsx16(Search3, { "aria-hidden": "true", className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
@@ -4061,188 +3912,6 @@ function ToolCredentialsForm({
4061
3912
  emptyMessage: "Nenhuma credencial encontrada"
4062
3913
  }
4063
3914
  ),
4064
- /* @__PURE__ */ jsx16(Dialog6, { open: showCreateDialog, onOpenChange: setShowCreateDialog, children: /* @__PURE__ */ jsxs14(DialogContent6, { children: [
4065
- /* @__PURE__ */ jsx16(DialogHeader6, { children: /* @__PURE__ */ jsx16(DialogTitle6, { children: "Nova Credencial" }) }),
4066
- /* @__PURE__ */ jsxs14("div", { className: "space-y-4", children: [
4067
- /* @__PURE__ */ jsxs14("div", { children: [
4068
- /* @__PURE__ */ jsx16("label", { htmlFor: "cred-tool", className: "mb-1 block text-sm font-medium", children: "Ferramenta *" }),
4069
- /* @__PURE__ */ jsxs14(
4070
- Select3,
4071
- {
4072
- value: createForm.id_tool,
4073
- onValueChange: (val) => setCreateForm((f) => ({ ...f, id_tool: val })),
4074
- children: [
4075
- /* @__PURE__ */ jsx16(SelectTrigger3, { id: "cred-tool", children: /* @__PURE__ */ jsx16(SelectValue3, { placeholder: "Selecione a ferramenta" }) }),
4076
- /* @__PURE__ */ jsx16(SelectContent3, { children: tools.map((tool) => /* @__PURE__ */ jsx16(SelectItem3, { value: String(tool.id), children: tool.name }, tool.id)) })
4077
- ]
4078
- }
4079
- )
4080
- ] }),
4081
- /* @__PURE__ */ jsxs14("div", { children: [
4082
- /* @__PURE__ */ jsx16("label", { htmlFor: "cred-label", className: "mb-1 block text-sm font-medium", children: "Label *" }),
4083
- /* @__PURE__ */ jsx16(
4084
- Input9,
4085
- {
4086
- id: "cred-label",
4087
- name: "label",
4088
- value: createForm.label,
4089
- onChange: (e) => setCreateForm((f) => ({ ...f, label: e.target.value })),
4090
- placeholder: "Ex: Google Calendar - Cl\xEDnica S\xE3o Paulo"
4091
- }
4092
- )
4093
- ] }),
4094
- /* @__PURE__ */ jsxs14("div", { children: [
4095
- /* @__PURE__ */ jsx16("label", { htmlFor: "cred-credential", className: "mb-1 block text-sm font-medium", children: "Credencial *" }),
4096
- /* @__PURE__ */ jsx16(
4097
- Input9,
4098
- {
4099
- id: "cred-credential",
4100
- name: "credential",
4101
- autoComplete: "off",
4102
- type: "password",
4103
- value: createForm.credentials_encrypted,
4104
- onChange: (e) => setCreateForm((f) => ({
4105
- ...f,
4106
- credentials_encrypted: e.target.value
4107
- })),
4108
- placeholder: "Credencial encriptada"
4109
- }
4110
- )
4111
- ] }),
4112
- /* @__PURE__ */ jsxs14("div", { children: [
4113
- /* @__PURE__ */ jsx16("label", { htmlFor: "cred-expires", className: "mb-1 block text-sm font-medium", children: "Data de Expira\xE7\xE3o (opcional)" }),
4114
- /* @__PURE__ */ jsx16(
4115
- Input9,
4116
- {
4117
- id: "cred-expires",
4118
- name: "expires",
4119
- type: "date",
4120
- value: createForm.expires_at,
4121
- onChange: (e) => setCreateForm((f) => ({ ...f, expires_at: e.target.value }))
4122
- }
4123
- )
4124
- ] })
4125
- ] }),
4126
- /* @__PURE__ */ jsxs14(DialogFooter6, { children: [
4127
- /* @__PURE__ */ jsx16(
4128
- Button11,
4129
- {
4130
- variant: "outline",
4131
- onClick: () => setShowCreateDialog(false),
4132
- children: "Cancelar"
4133
- }
4134
- ),
4135
- /* @__PURE__ */ jsx16(
4136
- Button11,
4137
- {
4138
- onClick: handleCreate,
4139
- disabled: !createForm.id_tool || !createForm.label.trim() || !createForm.credentials_encrypted.trim() || createMutation.isPending,
4140
- children: "Criar"
4141
- }
4142
- )
4143
- ] })
4144
- ] }) }),
4145
- /* @__PURE__ */ jsx16(
4146
- Dialog6,
4147
- {
4148
- open: !!editTarget,
4149
- onOpenChange: (open) => !open && setEditTarget(null),
4150
- children: /* @__PURE__ */ jsxs14(DialogContent6, { children: [
4151
- /* @__PURE__ */ jsx16(DialogHeader6, { children: /* @__PURE__ */ jsx16(DialogTitle6, { children: "Editar Credencial" }) }),
4152
- /* @__PURE__ */ jsxs14("div", { className: "space-y-4", children: [
4153
- /* @__PURE__ */ jsxs14("div", { children: [
4154
- /* @__PURE__ */ jsx16("label", { htmlFor: "edit-cred-tool", className: "mb-1 block text-sm font-medium", children: "Ferramenta *" }),
4155
- /* @__PURE__ */ jsxs14(
4156
- Select3,
4157
- {
4158
- value: editForm.id_tool,
4159
- onValueChange: (val) => setEditForm((f) => ({ ...f, id_tool: val })),
4160
- children: [
4161
- /* @__PURE__ */ jsx16(SelectTrigger3, { id: "edit-cred-tool", children: /* @__PURE__ */ jsx16(SelectValue3, { placeholder: "Selecione a ferramenta" }) }),
4162
- /* @__PURE__ */ jsx16(SelectContent3, { children: tools.map((tool) => /* @__PURE__ */ jsx16(SelectItem3, { value: String(tool.id), children: tool.name }, tool.id)) })
4163
- ]
4164
- }
4165
- )
4166
- ] }),
4167
- /* @__PURE__ */ jsxs14("div", { children: [
4168
- /* @__PURE__ */ jsx16("label", { htmlFor: "edit-cred-label", className: "mb-1 block text-sm font-medium", children: "Label" }),
4169
- /* @__PURE__ */ jsx16(
4170
- Input9,
4171
- {
4172
- id: "edit-cred-label",
4173
- name: "label",
4174
- value: editForm.label,
4175
- onChange: (e) => setEditForm((f) => ({ ...f, label: e.target.value })),
4176
- placeholder: "Label da credencial"
4177
- }
4178
- )
4179
- ] }),
4180
- /* @__PURE__ */ jsxs14("div", { children: [
4181
- /* @__PURE__ */ jsx16("label", { htmlFor: "edit-cred-credential", className: "mb-1 block text-sm font-medium", children: "Nova Credencial (vazio = manter atual)" }),
4182
- /* @__PURE__ */ jsx16(
4183
- Input9,
4184
- {
4185
- id: "edit-cred-credential",
4186
- name: "credential",
4187
- autoComplete: "off",
4188
- type: "password",
4189
- value: editForm.credentials_encrypted,
4190
- onChange: (e) => setEditForm((f) => ({
4191
- ...f,
4192
- credentials_encrypted: e.target.value
4193
- })),
4194
- placeholder: "Nova credencial"
4195
- }
4196
- )
4197
- ] }),
4198
- /* @__PURE__ */ jsxs14("div", { children: [
4199
- /* @__PURE__ */ jsx16("label", { htmlFor: "edit-cred-expires", className: "mb-1 block text-sm font-medium", children: "Data de Expira\xE7\xE3o" }),
4200
- /* @__PURE__ */ jsx16(
4201
- Input9,
4202
- {
4203
- id: "edit-cred-expires",
4204
- name: "expires",
4205
- type: "date",
4206
- value: editForm.expires_at,
4207
- onChange: (e) => setEditForm((f) => ({ ...f, expires_at: e.target.value }))
4208
- }
4209
- )
4210
- ] }),
4211
- /* @__PURE__ */ jsxs14("div", { children: [
4212
- /* @__PURE__ */ jsx16("label", { htmlFor: "edit-cred-status", className: "mb-1 block text-sm font-medium", children: "Status" }),
4213
- /* @__PURE__ */ jsxs14(
4214
- Select3,
4215
- {
4216
- value: editForm.status || void 0,
4217
- onValueChange: (val) => setEditForm((f) => ({
4218
- ...f,
4219
- status: val
4220
- })),
4221
- children: [
4222
- /* @__PURE__ */ jsx16(SelectTrigger3, { id: "edit-cred-status", children: /* @__PURE__ */ jsx16(SelectValue3, {}) }),
4223
- /* @__PURE__ */ jsxs14(SelectContent3, { children: [
4224
- /* @__PURE__ */ jsx16(SelectItem3, { value: "active", children: "Ativo" }),
4225
- /* @__PURE__ */ jsx16(SelectItem3, { value: "expired", children: "Expirado" })
4226
- ] })
4227
- ]
4228
- }
4229
- )
4230
- ] })
4231
- ] }),
4232
- /* @__PURE__ */ jsxs14(DialogFooter6, { children: [
4233
- /* @__PURE__ */ jsx16(Button11, { variant: "outline", onClick: () => setEditTarget(null), children: "Cancelar" }),
4234
- /* @__PURE__ */ jsx16(
4235
- Button11,
4236
- {
4237
- onClick: handleSaveEdit,
4238
- disabled: updateMutation.isPending,
4239
- children: "Salvar"
4240
- }
4241
- )
4242
- ] })
4243
- ] })
4244
- }
4245
- ),
4246
3915
  /* @__PURE__ */ jsx16(
4247
3916
  AlertDialog5,
4248
3917
  {
@@ -4271,13 +3940,12 @@ function ToolCredentialsForm({
4271
3940
  }
4272
3941
 
4273
3942
  // src/components/capabilities/integration-card.tsx
4274
- import { Badge as Badge9, Button as Button12, Tooltip as Tooltip5, TooltipContent as TooltipContent5, TooltipTrigger as TooltipTrigger5 } from "@greatapps/greatauth-ui/ui";
3943
+ import { Badge as Badge9, Button as Button12 } from "@greatapps/greatauth-ui/ui";
4275
3944
  import {
4276
3945
  CalendarSync as CalendarSync2,
4277
3946
  Plug as Plug3,
4278
3947
  Settings as Settings3,
4279
3948
  RefreshCw,
4280
- Users as Users2,
4281
3949
  Clock,
4282
3950
  Plus as Plus3
4283
3951
  } from "lucide-react";
@@ -4287,7 +3955,6 @@ var ICON_MAP2 = {
4287
3955
  Plug: Plug3,
4288
3956
  Settings: Settings3,
4289
3957
  RefreshCw,
4290
- Users: Users2,
4291
3958
  Clock,
4292
3959
  Plus: Plus3
4293
3960
  };
@@ -4326,7 +3993,7 @@ function getActionLabel(card) {
4326
3993
  }
4327
3994
  }
4328
3995
  function IntegrationCard({ card, onConnect }) {
4329
- const { definition, state, sharedByAgentsCount, isAddNew, accountLabel } = card;
3996
+ const { definition, state, isAddNew, accountLabel } = card;
4330
3997
  const Icon = resolveIcon2(definition.icon);
4331
3998
  const isComingSoon = state === "coming_soon";
4332
3999
  const actionLabel = getActionLabel(card);
@@ -4405,28 +4072,19 @@ function IntegrationCard({ card, onConnect }) {
4405
4072
  /* @__PURE__ */ jsx17("h3", { className: "text-sm font-semibold leading-tight", children: definition.name }),
4406
4073
  accountLabel ? /* @__PURE__ */ jsx17("p", { className: "text-xs text-muted-foreground leading-relaxed truncate", title: accountLabel, children: accountLabel }) : /* @__PURE__ */ jsx17("p", { className: "text-xs text-muted-foreground leading-relaxed", children: definition.description })
4407
4074
  ] }),
4408
- /* @__PURE__ */ jsxs15("div", { className: "mt-auto flex items-center justify-between gap-2 pt-1", children: [
4409
- sharedByAgentsCount > 0 ? /* @__PURE__ */ jsxs15(Tooltip5, { children: [
4410
- /* @__PURE__ */ jsx17(TooltipTrigger5, { asChild: true, children: /* @__PURE__ */ jsxs15("span", { className: "inline-flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400", children: [
4411
- /* @__PURE__ */ jsx17(Users2, { className: "h-3.5 w-3.5" }),
4412
- "Compartilhada"
4413
- ] }) }),
4414
- /* @__PURE__ */ jsx17(TooltipContent5, { children: "Esta credencial est\xE1 dispon\xEDvel para todos os agentes da conta" })
4415
- ] }) : /* @__PURE__ */ jsx17("span", {}),
4416
- !isComingSoon && /* @__PURE__ */ jsx17(
4417
- Button12,
4418
- {
4419
- variant: state === "expired" ? "destructive" : "outline",
4420
- size: "sm",
4421
- className: "text-xs",
4422
- onClick: (e) => {
4423
- e.stopPropagation();
4424
- onConnect(card);
4425
- },
4426
- children: actionLabel
4427
- }
4428
- )
4429
- ] })
4075
+ /* @__PURE__ */ jsx17("div", { className: "mt-auto flex items-center justify-end gap-2 pt-1", children: !isComingSoon && /* @__PURE__ */ jsx17(
4076
+ Button12,
4077
+ {
4078
+ variant: state === "expired" ? "destructive" : "outline",
4079
+ size: "sm",
4080
+ className: "text-xs",
4081
+ onClick: (e) => {
4082
+ e.stopPropagation();
4083
+ onConnect(card);
4084
+ },
4085
+ children: actionLabel
4086
+ }
4087
+ ) })
4430
4088
  ]
4431
4089
  }
4432
4090
  );
@@ -4477,11 +4135,11 @@ function AdvancedTab({ config, agentId, gagentsApiUrl }) {
4477
4135
  // src/components/capabilities/integration-wizard.tsx
4478
4136
  import { useCallback as useCallback6, useEffect as useEffect5, useRef as useRef2, useState as useState14 } from "react";
4479
4137
  import {
4480
- Dialog as Dialog7,
4481
- DialogContent as DialogContent7,
4482
- DialogFooter as DialogFooter7,
4483
- DialogHeader as DialogHeader7,
4484
- DialogTitle as DialogTitle7,
4138
+ Dialog as Dialog6,
4139
+ DialogContent as DialogContent6,
4140
+ DialogFooter as DialogFooter6,
4141
+ DialogHeader as DialogHeader6,
4142
+ DialogTitle as DialogTitle6,
4485
4143
  Button as Button14
4486
4144
  } from "@greatapps/greatauth-ui/ui";
4487
4145
  import { Loader2 as Loader29, ChevronLeft, ChevronRight, Check as Check2 } from "lucide-react";
@@ -4695,11 +4353,11 @@ function ApiKeyCredentials({
4695
4353
  import { Loader2 as Loader28 } from "lucide-react";
4696
4354
  import {
4697
4355
  Label as Label7,
4698
- Select as Select4,
4699
- SelectContent as SelectContent4,
4700
- SelectItem as SelectItem4,
4701
- SelectTrigger as SelectTrigger4,
4702
- SelectValue as SelectValue4
4356
+ Select as Select3,
4357
+ SelectContent as SelectContent3,
4358
+ SelectItem as SelectItem3,
4359
+ SelectTrigger as SelectTrigger3,
4360
+ SelectValue as SelectValue3
4703
4361
  } from "@greatapps/greatauth-ui/ui";
4704
4362
  import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
4705
4363
  function ConfigStep({
@@ -4729,9 +4387,9 @@ function ConfigStep({
4729
4387
  /* @__PURE__ */ jsx21("p", { className: "text-sm text-muted-foreground", children: "Carregando op\xE7\xF5es..." })
4730
4388
  ] }) : options.length === 0 ? /* @__PURE__ */ jsx21("div", { className: "rounded-lg border border-dashed p-6 text-center", children: /* @__PURE__ */ jsx21("p", { className: "text-sm text-muted-foreground", children: "Nenhuma op\xE7\xE3o dispon\xEDvel. A configura\xE7\xE3o padr\xE3o ser\xE1 usada." }) }) : /* @__PURE__ */ jsxs19("div", { className: "space-y-2", children: [
4731
4389
  /* @__PURE__ */ jsx21(Label7, { htmlFor: "integration-config-select", children: label }),
4732
- /* @__PURE__ */ jsxs19(Select4, { value: selectedValue, onValueChange, children: [
4733
- /* @__PURE__ */ jsx21(SelectTrigger4, { id: "integration-config-select", children: /* @__PURE__ */ jsx21(SelectValue4, { placeholder }) }),
4734
- /* @__PURE__ */ jsx21(SelectContent4, { children: options.map((opt) => /* @__PURE__ */ jsxs19(SelectItem4, { value: opt.id, children: [
4390
+ /* @__PURE__ */ jsxs19(Select3, { value: selectedValue, onValueChange, children: [
4391
+ /* @__PURE__ */ jsx21(SelectTrigger3, { id: "integration-config-select", children: /* @__PURE__ */ jsx21(SelectValue3, { placeholder }) }),
4392
+ /* @__PURE__ */ jsx21(SelectContent3, { children: options.map((opt) => /* @__PURE__ */ jsxs19(SelectItem3, { value: opt.id, children: [
4735
4393
  /* @__PURE__ */ jsx21("span", { children: opt.label }),
4736
4394
  opt.description && /* @__PURE__ */ jsxs19("span", { className: "ml-2 text-xs text-muted-foreground", children: [
4737
4395
  "(",
@@ -5070,8 +4728,8 @@ function IntegrationWizard({
5070
4728
  const selectedConfigOption = configOptions.find((o) => o.id === selectedConfigValue) || null;
5071
4729
  const isLastStep = currentStep === "confirm";
5072
4730
  const effectiveSteps = meta.hasConfigStep ? STEPS : STEPS.filter((s) => s !== "config");
5073
- return /* @__PURE__ */ jsx23(Dialog7, { open, onOpenChange, children: /* @__PURE__ */ jsxs21(DialogContent7, { className: "sm:max-w-lg", children: [
5074
- /* @__PURE__ */ jsx23(DialogHeader7, { children: /* @__PURE__ */ jsx23(DialogTitle7, { children: integration.name }) }),
4731
+ return /* @__PURE__ */ jsx23(Dialog6, { open, onOpenChange, children: /* @__PURE__ */ jsxs21(DialogContent6, { className: "sm:max-w-lg", children: [
4732
+ /* @__PURE__ */ jsx23(DialogHeader6, { children: /* @__PURE__ */ jsx23(DialogTitle6, { children: integration.name }) }),
5075
4733
  /* @__PURE__ */ jsx23(StepIndicator, { steps: effectiveSteps, currentStep }),
5076
4734
  /* @__PURE__ */ jsxs21("div", { className: "min-h-[280px] py-2", children: [
5077
4735
  currentStep === "info" && /* @__PURE__ */ jsx23(
@@ -5115,7 +4773,7 @@ function IntegrationWizard({
5115
4773
  }
5116
4774
  )
5117
4775
  ] }),
5118
- /* @__PURE__ */ jsxs21(DialogFooter7, { className: "flex-row justify-between sm:justify-between", children: [
4776
+ /* @__PURE__ */ jsxs21(DialogFooter6, { className: "flex-row justify-between sm:justify-between", children: [
5119
4777
  /* @__PURE__ */ jsx23("div", { children: currentStep === "info" ? /* @__PURE__ */ jsx23(
5120
4778
  Button14,
5121
4779
  {
@@ -5263,7 +4921,7 @@ function AgentsPage({
5263
4921
  import { useState as useState16 } from "react";
5264
4922
  import { Badge as Badge10, Button as Button16, Skeleton as Skeleton7 } from "@greatapps/greatauth-ui/ui";
5265
4923
  import { EntityAvatar as EntityAvatar2 } from "@greatapps/greatauth-ui";
5266
- import { ArrowLeft, Pencil as Pencil5 } from "lucide-react";
4924
+ import { ArrowLeft, Pencil as Pencil4 } from "lucide-react";
5267
4925
  import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
5268
4926
  function AgentDetailPage({
5269
4927
  config,
@@ -5325,7 +4983,7 @@ function AgentDetailPage({
5325
4983
  className: "shrink-0 self-start",
5326
4984
  onClick: () => setEditOpen(true),
5327
4985
  children: [
5328
- /* @__PURE__ */ jsx25(Pencil5, { className: "mr-2 h-4 w-4" }),
4986
+ /* @__PURE__ */ jsx25(Pencil4, { className: "mr-2 h-4 w-4" }),
5329
4987
  "Editar"
5330
4988
  ]
5331
4989
  }
@@ -5445,9 +5103,6 @@ function ToolsPage({
5445
5103
  }
5446
5104
 
5447
5105
  // src/pages/credentials-page.tsx
5448
- import { useState as useState18 } from "react";
5449
- import { Button as Button18 } from "@greatapps/greatauth-ui/ui";
5450
- import { Plus as Plus6 } from "lucide-react";
5451
5106
  import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
5452
5107
  function CredentialsPage({
5453
5108
  config,
@@ -5456,44 +5111,34 @@ function CredentialsPage({
5456
5111
  subtitle = "Gerencie as credenciais de autentica\xE7\xE3o das ferramentas"
5457
5112
  }) {
5458
5113
  const { data: credentialsData, isLoading: credentialsLoading } = useToolCredentials(config);
5459
- const [createOpen, setCreateOpen] = useState18(false);
5460
5114
  const credentials = credentialsData?.data || [];
5461
5115
  return /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-4 p-4 md:p-6", children: [
5462
- /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
5463
- /* @__PURE__ */ jsxs26("div", { children: [
5464
- /* @__PURE__ */ jsx28("h1", { className: "text-xl font-semibold", children: title }),
5465
- /* @__PURE__ */ jsx28("p", { className: "text-sm text-muted-foreground", children: subtitle })
5466
- ] }),
5467
- /* @__PURE__ */ jsxs26(Button18, { onClick: () => setCreateOpen(true), size: "sm", children: [
5468
- /* @__PURE__ */ jsx28(Plus6, { className: "mr-2 h-4 w-4" }),
5469
- "Nova Credencial"
5470
- ] })
5471
- ] }),
5116
+ /* @__PURE__ */ jsx28("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxs26("div", { children: [
5117
+ /* @__PURE__ */ jsx28("h1", { className: "text-xl font-semibold", children: title }),
5118
+ /* @__PURE__ */ jsx28("p", { className: "text-sm text-muted-foreground", children: subtitle })
5119
+ ] }) }),
5472
5120
  /* @__PURE__ */ jsx28(
5473
5121
  ToolCredentialsForm,
5474
5122
  {
5475
5123
  config,
5476
5124
  gagentsApiUrl,
5477
5125
  credentials,
5478
- isLoading: credentialsLoading,
5479
- createOpen,
5480
- onCreateOpenChange: setCreateOpen
5126
+ isLoading: credentialsLoading
5481
5127
  }
5482
5128
  )
5483
5129
  ] });
5484
5130
  }
5485
5131
 
5486
5132
  // src/pages/integrations-management-page.tsx
5487
- import { useState as useState19, useMemo as useMemo8, useCallback as useCallback7 } from "react";
5133
+ import { useMemo as useMemo8, useCallback as useCallback7, useState as useState18 } from "react";
5488
5134
  import {
5489
5135
  Badge as Badge11,
5490
- Button as Button19,
5491
5136
  Tabs as Tabs3,
5492
5137
  TabsContent as TabsContent3,
5493
5138
  TabsList as TabsList3,
5494
5139
  TabsTrigger as TabsTrigger3
5495
5140
  } from "@greatapps/greatauth-ui/ui";
5496
- import { Plus as Plus7, Plug as Plug5, KeyRound, Info as Info3, Loader2 as Loader210 } from "lucide-react";
5141
+ import { Plug as Plug5, KeyRound, Info as Info3, Loader2 as Loader210 } from "lucide-react";
5497
5142
  import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
5498
5143
  function useCredentialAgentSummary(credentials, tools, agents) {
5499
5144
  return useMemo8(() => {
@@ -5523,10 +5168,9 @@ function IntegrationsManagementPage({
5523
5168
  const { data: credentialsData, isLoading: credentialsLoading } = useToolCredentials(config);
5524
5169
  const { data: agentsData } = useAgents(config);
5525
5170
  const { data: toolsData } = useTools(config);
5526
- const [createOpen, setCreateOpen] = useState19(false);
5527
5171
  const { cards, isLoading: cardsLoading } = useIntegrationState(config, null);
5528
- const [wizardOpen, setWizardOpen] = useState19(false);
5529
- const [activeCard, setActiveCard] = useState19(null);
5172
+ const [wizardOpen, setWizardOpen] = useState18(false);
5173
+ const [activeCard, setActiveCard] = useState18(null);
5530
5174
  const credentials = credentialsData?.data || [];
5531
5175
  const agents = agentsData?.data || [];
5532
5176
  const tools = toolsData?.data || [];
@@ -5623,19 +5267,13 @@ function IntegrationsManagementPage({
5623
5267
  ] })
5624
5268
  ] })
5625
5269
  ] }),
5626
- /* @__PURE__ */ jsx29("div", { className: "flex items-center justify-end mb-4", children: /* @__PURE__ */ jsxs27(Button19, { onClick: () => setCreateOpen(true), size: "sm", children: [
5627
- /* @__PURE__ */ jsx29(Plus7, { className: "mr-2 h-4 w-4" }),
5628
- "Nova Credencial"
5629
- ] }) }),
5630
5270
  /* @__PURE__ */ jsx29(
5631
5271
  ToolCredentialsForm,
5632
5272
  {
5633
5273
  config,
5634
5274
  gagentsApiUrl,
5635
5275
  credentials,
5636
- isLoading: credentialsLoading,
5637
- createOpen,
5638
- onCreateOpenChange: setCreateOpen
5276
+ isLoading: credentialsLoading
5639
5277
  }
5640
5278
  )
5641
5279
  ] })