@greatapps/greatagents-ui 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -493,8 +493,9 @@ interface AgentFormDialogProps {
493
493
  open: boolean;
494
494
  onOpenChange: (open: boolean) => void;
495
495
  agent?: Agent;
496
+ idAccount?: string | number | null;
496
497
  }
497
- declare function AgentFormDialog({ config, open, onOpenChange, agent, }: AgentFormDialogProps): react_jsx_runtime.JSX.Element;
498
+ declare function AgentFormDialog({ config, open, onOpenChange, agent, idAccount, }: AgentFormDialogProps): react_jsx_runtime.JSX.Element;
498
499
 
499
500
  interface AgentEditFormProps {
500
501
  config: GagentsHookConfig;
package/dist/index.js CHANGED
@@ -744,6 +744,7 @@ import {
744
744
  } from "@greatapps/greatauth-ui/ui";
745
745
  import { Loader2 } from "lucide-react";
746
746
  import { toast as toast2 } from "sonner";
747
+ import { ImageCropUpload } from "@greatapps/greatauth-ui";
747
748
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
748
749
  function msToSeconds(ms) {
749
750
  if (ms == null || ms === 0) return "";
@@ -776,7 +777,8 @@ function AgentFormDialog({
776
777
  config,
777
778
  open,
778
779
  onOpenChange,
779
- agent
780
+ agent,
781
+ idAccount
780
782
  }) {
781
783
  const isEditing = !!agent;
782
784
  const createAgent = useCreateAgent(config);
@@ -829,21 +831,19 @@ function AgentFormDialog({
829
831
  return /* @__PURE__ */ jsx2(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs2(DialogContent, { className: "sm:max-w-lg", children: [
830
832
  /* @__PURE__ */ jsx2(DialogHeader, { children: /* @__PURE__ */ jsx2(DialogTitle, { children: isEditing ? "Editar Agente" : "Novo Agente" }) }),
831
833
  /* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
832
- /* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
833
- /* @__PURE__ */ jsx2(Label, { htmlFor: "agent-photo", children: "Foto (URL)" }),
834
- /* @__PURE__ */ jsx2(
835
- Input2,
836
- {
837
- id: "agent-photo",
838
- name: "photo",
839
- value: form.photo,
840
- onChange: (e) => updateField("photo", e.target.value),
841
- placeholder: "https://exemplo.com/foto.jpg",
842
- disabled: isPending
843
- }
844
- ),
845
- /* @__PURE__ */ jsx2("p", { className: "text-xs text-muted-foreground", children: "URL da imagem de avatar do agente" })
846
- ] }),
834
+ /* @__PURE__ */ jsx2("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx2(
835
+ ImageCropUpload,
836
+ {
837
+ value: form.photo || null,
838
+ onChange: (url) => updateField("photo", url),
839
+ onRemove: () => updateField("photo", ""),
840
+ entityType: "agents",
841
+ entityId: agent?.id,
842
+ idAccount: typeof idAccount === "string" ? Number(idAccount) : idAccount ?? Number(config.accountId) ?? 0,
843
+ name: form.title || null,
844
+ disabled: isPending
845
+ }
846
+ ) }),
847
847
  /* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
848
848
  /* @__PURE__ */ jsx2(Label, { htmlFor: "agent-title", children: "Nome do Agente *" }),
849
849
  /* @__PURE__ */ jsx2(
@@ -951,7 +951,7 @@ import {
951
951
  } from "@greatapps/greatauth-ui/ui";
952
952
  import { Loader2 as Loader22 } from "lucide-react";
953
953
  import { toast as toast3 } from "sonner";
954
- import { ImageCropUpload } from "@greatapps/greatauth-ui";
954
+ import { ImageCropUpload as ImageCropUpload2 } from "@greatapps/greatauth-ui";
955
955
  import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
956
956
  function msToSeconds2(ms) {
957
957
  if (ms == null || ms === 0) return "";
@@ -1009,7 +1009,7 @@ function AgentEditForm({ config, agent, idAccount, open, onOpenChange }) {
1009
1009
  }
1010
1010
  const formContent = /* @__PURE__ */ jsxs3("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
1011
1011
  /* @__PURE__ */ jsx3("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx3(
1012
- ImageCropUpload,
1012
+ ImageCropUpload2,
1013
1013
  {
1014
1014
  value: form.photo || null,
1015
1015
  onChange: (url) => updateField("photo", url),