PageSourceSearch

https://maasy.ai/assets/MaasBridgePanel-DSi01e5P.js

js maasy.ai collected 2026-09-24 13:57:00 UTC 4,989 bytes, 2 lines download raw bytes

1import{bt as B,r as _,z as m,c6 as D,e as v,j as e,p as w,n as j,aH as p,aI as g,q as y,S,a as C,b as M,c as q,d as A,B as F,Q as K,be as L,aC as T,bi as E,s as b}from"./index-CuMcGkrh.js";import{A as I}from"./arrow-right-left-OEXdRCCS.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new r.Error().stack;t&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[t]="b1757465-b164-4559-956a-b0f23aae07cd",r._sentryDebugIdIdentifier="sentry-dbid-b1757465-b164-4559-956a-b0f23aae07cd")}catch{}})();function f(r,t={}){return b.functions.invoke("maas-bridge",{body:{action:r,...t}})}function P(){const r=B(),[t,x]=_.useState(""),[l,N]=_.useState(""),{data:c}=m({queryKey:["maasy-projects-for-bridge"],queryFn:async()=>{const{data:s}=await b.from("projects").select("id, brand_name").order("brand_name");return(s||[]).map(a=>({id:a.id,name:a.brand_name}))}}),{data:d,isLoading:k}=m({queryKey:["maas2-projects"],queryFn:async()=>{const{data:s,error:a}=await f("list_maas2_projects");if(a)throw a;return(s==null?void 0:s.projects)||[]}}),{data:n}=m({queryKey:["bridge-mappings"],queryFn:async()=>{const{data:s}=await b.from("maas_bridge_project_map").select("*").order("created_at",{ascending:!1});return s||[]}}),{data:o}=m({queryKey:["bridge-transfers"],queryFn:async()=>{const{data:s,error:a}=await f("get_transfers");if(a)throw a;return(s==null?void 0:s.transfers)||[]}}),u=D({mutationFn:async()=>{var i;const s=(i=d==null?void 0:d.find(h=>h.id===l))==null?void 0:i.name,{error:a}=await f("sync_mapping",{maasy_project_id:t,maas2_project_id:l,maas2_project_name:s});if(a)throw a},onSuccess:()=>{v.success("Mapeo guardado"),r.invalidateQueries({queryKey:["bridge-mappings"]}),x(""),N("")},onError:s=>v.error(s.message)});return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(I,{className:"h-5 w-5 text-primary"}),e.jsx("h2",{className:"text-lg font-semibold",children:"Bridge MAASY → MAAS 2.0"}),e.jsx(w,{variant:"outline",className:"text-xs",children:"Admin only"})]}),e.jsxs(j,{children:[e.jsx(p,{children:e.jsx(g,{className:"text-sm",children:"Mapear proyecto"})}),e.jsx(y,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 items-end",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Proyecto MAASY"}),e.jsxs(S,{value:t,onValueChange:x,children:[e.jsx(C,{children:e.jsx(M,{placeholder:"Seleccionar..."})}),e.jsx(q,{children:c==null?void 0:c.map(s=>e.jsx(A,{value:s.id,children:s.name},s.id))})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Proyecto MAAS 2.0"}),e.jsxs(S,{value:l,onValueChange:N,children:[e.jsx(C,{children:e.jsx(M,{placeholder:k?"Cargando...":"Seleccionar..."})}),e.jsx(q,{children:d==null?void 0:d.map(s=>e.jsx(A,{value:s.id,children:s.name},s.id))})]})]}),e.jsxs(F,{onClick:()=>u.mutate(),disabled:!t||!l||u.isPending,children:[u.isPending?e.jsx(K,{className:"h-4 w-4 animate-spin"}):e.jsx(L,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-1.5",children:"Vincular"})]})]})})]}),e.jsxs(j,{children:[e.jsx(p,{children:e.jsxs(g,{className:"text-sm",children:["Mapeos activos (",(n==null?void 0:n.length)||0,")"]})}),e.jsx(y,{children:n!=null&&n.length?e.jsx("div",{className:"space-y-2",children:n.map(s=>{var i;const a=(i=c==null?void 0:c.find(h=>h.id===s.maasy_project_id))==null?void 0:i.name;return e.jsxs("div",{className:"flex items-center gap-2 text-sm p-2 rounded bg-muted/30",children:[e.jsx("span",{className:"font-medium",children:a||s.maasy_project_id.slice(0,8)}),e.jsx(I,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("span",{children:s.maas2_project_name||s.maas2_project_id.slice(0,8)})]},s.id)})}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Sin mapeos configurados"})})]}),e.jsxs(j,{children:[e.jsx(p,{children:e.jsx(g,{className:"text-sm",children:"Transferencias recientes"})}),e.jsx(y,{children:o!=null&&o.length?e.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:o.map(s=>{var a;return e.jsxs("div",{className:"flex items-center justify-between text-xs p-2 rounded bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[s.status==="confirmed"?e.jsx(T,{className:"h-3.5 w-3.5 text-primary"}):e.jsx(E,{className:"h-3.5 w-3.5 text-destructive"}),e.jsx(w,{variant:"secondary",className:"text-[10px]",children:s.asset_type}),e.jsx("span",{className:"text-muted-foreground",children:((a=s.metadata)==null?void 0:a.name)||s.id.slice(0,8)})]}),e.jsx("span",{className:"text-muted-foreground",children:new Date(s.created_at).toLocaleDateString("es")})]},s.id)})}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Sin transferencias aún"})})]})]})}export{P as default};
2//# sourceMappingURL=MaasBridgePanel-DSi01e5P.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.