PageSourceSearch

https://xelia.ai/dashboard/assets/BrainPage-DODClan4.js

js xelia.ai collected 2026-10-05 13:42:17 UTC 8,192 bytes, 2 lines download raw bytes

1import{u as V,h as z,r as g,j as e,N as C}from"./index-CoO66CQf.js";import{C as p}from"./CircularStat-BSYnMtSO.js";const v={positive:{label:"Va bien",color:"var(--success, #34C759)"},attention:{label:"Atención",color:"var(--warning, #FF9500)"},opportunity:{label:"Oportunidad",color:"var(--brain, #AF52DE)"}},k={high:"Alto",medium:"Medio",low:"Bajo"};function f({size:t=20}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M9.5 2A2.5 2.5 0 0 1 12 4.5v15a2.5 2.5 0 0 1-4.96.44 2.5 2.5 0 0 1-2.96-3.08 3 3 0 0 1-.34-5.58 2.5 2.5 0 0 1 1.32-4.24 2.5 2.5 0 0 1 4.44-2.04Z"}),e.jsx("path",{d:"M14.5 2A2.5 2.5 0 0 0 12 4.5v15a2.5 2.5 0 0 0 4.96.44 2.5 2.5 0 0 0 2.96-3.08 3 3 0 0 0 .34-5.58 2.5 2.5 0 0 0-1.32-4.24 2.5 2.5 0 0 0-4.44-2.04Z"})]})}function F(){const{t}=V(["dashboard","common"]),{healthScore:o,recommendations:j,analyze:I,isAnalyzing:m,implementRecommendation:S,isImplementing:A}=z(),[w,b]=g.useState(null),[y,u]=g.useState([]),E=async a=>{const i=String(a.id),d=a.category==="positive";b(i);try{const n=(await S({id:i,mode:d?"acknowledge":"execute"})).data;d?u(x=>[{recId:i,title:a.title,summary:"Anotado ✓ — El Brain mantiene esta métrica en observación: cada análisis la re-evalúa y te avisará si cambia de rumbo.",conversationId:null},...x.filter(h=>h.title!==a.title)]):n!=null&&n.executed&&n.summary&&u(x=>[{recId:i,title:a.title,summary:n.summary,conversationId:n.conversationId??null},...x.filter(h=>h.title!==a.title)])}catch{u(c=>[{recId:i,title:a.title,summary:"No pude completar la ejecución — la tarea sigue pendiente. Inténtalo de nuevo o pídemelo directo en el Chat.",conversationId:null,error:!0},...c.filter(n=>n.title!==a.title)])}finally{b(null)}},s=j??[],r=g.useMemo(()=>({attention:s.filter(a=>a.category==="attention").length,opportunity:s.filter(a=>a.category==="opportunity").length,positive:s.filter(a=>a.category==="positive").length}),[s]),l=s.length;return e.jsx("div",{className:"page active",id:"brain-page",children:e.jsxs("div",{className:"content-wrapper",children:[e.jsxs("div",{className:"page-header",children:[e.jsxs("h1",{style:{display:"inline-flex",alignItems:"center",gap:"10px"},children:[e.jsx("span",{style:{color:"var(--brain, #AF52DE)",display:"inline-flex"},children:e.jsx(f,{size:28})}),"XELIA Brain"]}),e.jsx("div",{className:"analytics-controls",children:e.jsx("button",{className:"brain-action-pill accent",onClick:()=>I(),disabled:m,style:{whiteSpace:"nowrap"},children:m?t("dashboard:brain.analyzing",{defaultValue:"Analizando…"}):t("dashboard:brain.analyzeNow",{defaultValue:"Actualizar análisis"})})})]}),e.jsxs("div",{className:"analytics-stats",children:[e.jsx(p,{label:t("dashboard:brain.health",{defaultValue:"Salud del negocio"}),value:o?String(o):"—",change:o>=70?"Sólido":o>0?"Con oportunidades":"Sin análisis aún",chartClass:"fuchsia",percentage:o||0}),e.jsx(p,{label:t("dashboard:brain.attention",{defaultValue:"Requieren atención"}),value:String(r.attention),change:r.attention>0?"Revisar hoy":"Todo en orden",chartClass:"yellow",percentage:l>0?r.attention/l*100:0}),e.jsx(p,{label:t("dashboard:brain.opportunities",{defaultValue:"Oportunidades"}),value:String(r.opportunity),change:"Detectadas por Brain",chartClass:"purple",percentage:l>0?r.opportunity/l*100:0}),e.jsx(p,{label:t("dashboard:brain.positives",{defaultValue:"Fortalezas"}),value:String(r.positive),change:"Lo que va bien",chartClass:"lime",percentage:l>0?r.positive/l*100:0})]}),y.length>0&&e.jsxs("div",{className:"analytics-tab-section",children:[e.jsx("h2",{children:t("dashboard:brain.executed",{defaultValue:"Ejecutado por XELIA"})}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:y.map(a=>e.jsxs("div",{style:{padding:"16px 18px",borderRadius:"var(--radius-lg)",background:"var(--bg-elevated)",border:"1px solid var(--border-light)",borderLeft:`3px solid ${a.error?"var(--danger, #FF3B30)":"var(--brain, #AF52DE)"}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"6px",flexWrap:"wrap"},children:[e.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:"6px",fontSize:"11px",fontWeight:600,padding:"3px 10px",borderRadius:"var(--radius-full)",color:a.error?"var(--danger, #FF3B30)":"var(--brain, #AF52DE)",background:a.error?"rgba(255, 59, 48, 0.10)":"var(--brain-soft, rgba(175, 82, 222, 0.12))"},children:a.error?t("dashboard:brain.execFailed",{defaultValue:"No completado"}):t("dashboard:brain.execDone",{defaultValue:"XELIA lo ejecutó"})}),e.jsx("span",{style:{fontSize:"14px",fontWeight:600,color:"var(--text-primary)"},children:a.title})]}),e.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",lineHeight:1.6,margin:0,whiteSpace:"pre-wrap"},children:a.summary}),a.conversationId&&e.jsx(C,{to:"/chat",search:{id:a.conversationId},className:"brain-action-pill accent",style:{display:"inline-flex",marginTop:"10px",textDecoration:"none"},children:t("dashboard:brain.viewInChat",{defaultValue:"Ver ejecución en Chat"})})]},a.recId))})]}),e.jsxs("div",{className:"analytics-tab-section",children:[e.jsx("h2",{children:t("dashboard:brain.tasks",{defaultValue:"Tareas que XELIA ejecuta por ti"})}),l>0?e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0"},children:s.map(a=>{const i=v[a.category??"opportunity"]??v.opportunity,d=k[a.priority]??"Medio",c=Math.round((Number(a.confidence)||.5)*100);return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px",padding:"18px 4px",borderBottom:"1px solid var(--border-light)"},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",marginBottom:"4px"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"6px",fontSize:"11px",fontWeight:600,padding:"3px 10px",borderRadius:"var(--radius-full)",color:i.color,background:`color-mix(in srgb, ${i.color} 12%, transparent)`},children:[e.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"currentColor"}}),i.label]}),e.jsx("span",{style:{fontSize:"15px",fontWeight:600,color:"var(--text-primary)"},children:a.title})]}),e.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",lineHeight:1.5,margin:"0 0 8px"},children:a.description}),e.jsxs("div",{style:{display:"flex",gap:"20px",fontSize:"12px",color:"var(--text-tertiary)"},children:[e.jsxs("span",{children:["Impacto: ",e.jsx("strong",{style:{color:"var(--text-primary)"},children:d})]}),e.jsxs("span",{children:["Probabilidad: ",e.jsxs("strong",{style:{color:"var(--success)"},children:[c,"%"]})]})]})]}),e.jsx("button",{className:"brain-action-pill",style:{flexShrink:0,whiteSpace:"nowrap"},disabled:A,onClick:()=>E(a),children:w===String(a.id)?e.jsxs(e.Fragment,{children:[(a.category==="positive"?t("dashboard:brain.acknowledging",{defaultValue:"Anotando"}):t("dashboard:brain.executing",{defaultValue:"XELIA ejecutando"})).replace(/(\.{3}|…)\s*$/u,""),e.jsxs("span",{className:"xm-dots","aria-hidden":"true",children:[e.jsx("span",{}),e.jsx("span",{}),e.jsx("span",{})]})]}):a.category==="positive"?t("dashboard:brain.acknowledge",{defaultValue:"Entendido"}):t("dashboard:brain.implement",{defaultValue:"Implementar"})})]},a.id)})}):e.jsxs("div",{style:{textAlign:"center",padding:"48px 24px",color:"var(--text-secondary)"},children:[e.jsx("span",{style:{color:"var(--brain, #AF52DE)",display:"inline-flex",marginBottom:"12px"},children:e.jsx(f,{size:32})}),e.jsx("p",{style:{fontSize:"15px",fontWeight:600,margin:"0 0 6px",color:"var(--text-primary)"},children:t("dashboard:brain.emptyTitle",{defaultValue:"XELIA está aprendiendo de tu negocio"})}),e.jsx("p",{style:{fontSize:"13px",margin:0,lineHeight:1.6,maxWidth:"420px",marginInline:"auto"}
1,children:t("dashboard:brain.emptyDesc",{defaultValue:'Conforme XELIA descubre oportunidades dentro de tu operación, las convierte en tareas que ejecuta por ti. Pulsa "Actualizar análisis" para el primer barrido.'})})]})]})]})})}export{F as BrainPage};
2//# sourceMappingURL=BrainPage-DODClan4.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.