PageSourceSearch

https://dash-mestre-atitude.lovable.app/assets/ComunicacaoTabContent-CtdCwn76.js

js dash-mestre-atitude.lovable.app collected 2026-10-03 03:24:15 UTC 25,884 bytes, 1 lines download raw bytes

1import{u as fe,r as c,s as g,j as e,b8 as be,S as B,e as q,f as F,g as A,h as V,b9 as W,aH as _e,R as N,V as y,ai as je,aj as Ne,an as ye,ak as we,al as ve,am as ke,T as P,o as Se,n as ee,ba as Ce,a1 as se,bb as De,ad as Le,ax as Te,aZ as $e,t as Re,bc as Ee,B as ae,J as D,Y as Ie,Z as Me,_ as L,bd as Oe,be as Be,as as qe,$ as T,bf as Fe,bg as Ae,bh as Ve}from"./index-krtc1qwT.js";const We=[{value:"7",label:"Últimos 7 dias"},{value:"30",label:"Último mês"},{value:"90",label:"Últimos 3 meses"},{value:"180",label:"Últimos 6 meses"},{value:"365",label:"Último ano"},{value:"all",label:"Todos"}],ze=[{value:3,label:"3 meses"},{value:6,label:"6 meses"},{value:12,label:"1 ano"},{value:24,label:"2 anos"}];function Ue(u){const o=new Date(u),p=new Date,d=p.getTime()-o.getTime(),i=Math.floor(d/6e4);if(i<1)return"agora";if(i<60)return`${i}min`;const _=o.toLocaleString("pt-BR",{hour:"2-digit",minute:"2-digit"});if(o.toDateString()===p.toDateString())return _;const j=new Date(p);return j.setDate(j.getDate()-1),o.toDateString()===j.toDateString()?`Ontem ${_}`:o.toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit"})+` ${_}`}function Ge(u){return new Date(u).toLocaleString("pt-BR",{hour:"2-digit",minute:"2-digit"})}function He(u){const o=new Date(u),p=new Date;if(o.toDateString()===p.toDateString())return"Hoje";const d=new Date;return d.setDate(d.getDate()-1),o.toDateString()===d.toDateString()?"Ontem":o.toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"2-digit"})}function te(u){const o=u.replace(/\D/g,"");if(o.startsWith("55")&&o.length>=12){const p=o.slice(2,4),d=o.slice(4);return d.length===9?`(${p}) ${d.slice(0,5)}-${d.slice(5)}`:d.length===8?`(${p}) ${d.slice(0,4)}-${d.slice(4)}`:`+55 (${p}) ${d}`}return u}function ne(u){return u?u.split(" ").map(o=>o[0]).filter(Boolean).slice(0,2).join("").toUpperCase():"?"}function le({src:u,name:o,size:p="md",isActive:d=!1}){const[i,_]=c.useState(!1),j=p==="sm"?"h-10 w-10":"h-11 w-11",w="text-xs";return u&&!i?e.jsx("img",{src:u,alt:o||"Perfil",className:`${j} rounded-full object-cover`,style:{border:d?"2px solid rgba(0,191,254,0.4)":"1px solid rgba(255,255,255,0.1)"},onError:()=>_(!0)}):e.jsx("div",{className:`${j} rounded-full flex items-center justify-center ${w} font-bold`,style:{background:d?"rgba(0,191,254,0.1)":"rgba(255,255,255,0.05)",color:d?"#00bffe":"#a3a3a3",border:d?"1px solid rgba(0,191,254,0.2)":"1px solid rgba(255,255,255,0.06)"},children:ne(o)})}function Ke(){var Q;fe();const[u,o]=c.useState(!0),[p,d]=c.useState([]),[i,_]=c.useState(""),[j,w]=c.useState([]),[n,$]=c.useState(null),[re,z]=c.useState([]),[ie,U]=c.useState(!1),[R,ce]=c.useState(""),[v,oe]=c.useState("180"),[x,k]=c.useState(null),[me,G]=c.useState(!1),[H,K]=c.useState(!1),[de,E]=c.useState(!1),[t,Z]=c.useState(null),[xe,J]=c.useState(!1),I=c.useRef(null);c.useEffect(()=>{g.from("tracking_clients").select("id, nome, evolution_instance").eq("active",!0).order("nome").then(({data:s})=>{const a=s||[];d(a),a.length>
10&&!i&&_(a[0].id)})},[]),c.useEffect(()=>{i&&g.from("whatsapp_retention_settings").select("*").eq("client_id",i).maybeSingle().then(({data:s})=>{k(s||{client_id:i,retention_months:12,auto_cleanup_enabled:!1,last_cleanup_at:null})})},[i]);const S=c.useCallback(async()=>{if(!i)return;o(!0);let s=g.from("whatsapp_messages").select("telefone, push_name, client_id, instance_name, message_text, message_timestamp, from_me, lead_id, profile_pic_url").eq("client_id",i).order("message_timestamp",{ascending:!1}).limit(500);if(v!=="all"){const m=new Date;m.setDate(m.getDate()-parseInt(v)),s=s.gte("message_timestamp",m.toISOString())}const{data:a,error:l}=await s;if(l){console.error("Error loading conversations:",l),o(!1);return}const r={};for(const m of a||[]){const h=m.telefone;r[h]?(r[h].message_count++,!r[h].push_name&&m.push_name&&(r[h].push_name=m.push_name),!r[h].profile_pic_url&&m.profile_pic_url&&(r[h].profile_pic_url=m.profile_pic_url)):r[h]={telefone:m.telefone,push_name:m.push_name,client_id:m.client_id,instance_name:m.instance_name,last_message:m.message_text,last_timestamp:m.message_timestamp,message_count:1,lead_origem:null,lead_nome:null,profile_pic_url:m.profile_pic_url||null}}const b=Object.keys(r);if(b.length>0){const{data:m}=await g.from("leads").select("telefone, nome, origem").eq("client_id",i).in("telefone",b);for(const h of m||[])r[h.telefone]&&(r[h.telefone].lead_origem=h.origem,r[h.telefone].lead_nome=h.nome)}const f=Object.values(r).sort((m,h)=>new Date(h.last_timestamp).getTime()-new Date(m.last_timestamp).getTime());w(f),o(!1)},[i,v]);c.useEffect(()=>{S()},[S]);const X=c.useCallback(async s=>{$(s),U(!0);const{data:a,error:l}=await g.from("whatsapp_messages").select("id, message_text, message_type, from_me, push_name, message_timestamp, profile_pic_url").eq("client_id",s.client_id).eq("telefone",s.telefone).order("message_timestamp",{ascending:!0}).limit(100);l&&console.error("Error loading messages:",l),z(a||[]),U(!1),setTimeout(()=>{var r;(r=I.current)==null||r.scrollIntoView({behavior:"smooth"})},100)},[]),Y=c.useCallback(async s=>{J(!0),E(!0);const{data:a}=await g.from("leads").select("id, telefone, nome, email, origem, primeira_mensagem, first_response_at, response_time_minutes, created_at").eq("client_id",s.client_id).eq("telefone",s.telefone).maybeSingle();if(a){const{data:l}=await g.from("ad_clicks").select("plataforma, campanha, conjunto, anuncio, click_timestamp").eq("lead_id",a.id).order("click_timestamp",{ascending:!1}).limit(5);Z({...a,ad_clicks:l||[]})}else Z({id:"",telefone:s.telefone,nome:s.push_name,email:null,origem:s.lead_origem||"WhatsApp",primeira_mensagem:null,first_response_at:null,response_time_minutes:null,created_at:s.last_timestamp,ad_clicks:[]});J(!1)},[]);c.useEffect(()=>{if(!i)return;const s=g.channel("whatsapp-messages-realtime").on("postgres_changes",{event:"INSERT",schema:"public",table:"whatsapp_messages",filter:`client_id=eq.${i}`},a=>{const l=a.new;w(r=>{const b=r.findIndex(f=>f.telefone===l.telefone);if(b>=0){const f=[...r];f[b]={...f[b],last_message:l.message_text,last_timestamp:l.message_timestamp,message_count:f[b].message_count+1,profile_pic_url:l.profile_pic_url||f[b].profile_pic_url};const[m]=f.splice(b,1);return[m,...f]}return[{telefone:l.telefone,push_name:l.push_name,client_id:l.client_id,instance_name:l.instance_name,last_message:l.message_text,last_timestamp:l.message_timestamp,message_count:1,lead_origem:null,lead_nome:null,profile_pic_url:l.profile_pic_url||null},...r]}),(n==null?void 0:n.telefone)===l.telefone&&(z(r=>[...r,{id:l.id,message_text:l.message_text,message_type:l.message_type,from_me:l.from_me,push_name:l.push_name,message_timestamp:l.message_timestamp,profile_pic_url:l.profile_pic_url||null}]),setTimeout(()=>{var r;(r=I.current)==null||r.scrollIntoView({behavior:"smooth"})},100))}).subscribe();return()=>{g.removeChannel(s)}},[i,n==null?void 0:n.telefone]);const M=j.filter(s=>{if(!R)return!0;const a=R.toLowerCase();return s.telefone.includes(a)||(s.push_name||"").toLowerCase().includes(a)||(s.lead_nome||"").toLowerCase().includes(a)}),ue={formsite:{label:"Formulário",color:"bg-red-600"},formulario:{label:"Formulário",color:"bg-red-600"},formulario_site:{label:"Formulário",color:"bg-red-600"},fluent_forms:{label:"Formulário",color:"bg-red-600"},Instagram:{label:"Instagram",color:"bg-pink-500"},"Meta CTWA":{label:"Meta CTWA",color:"bg-blue-600"},google_ads:{label:"Google Ads",color:"bg-green-600"}
1,Ligação:{label:"Ligação",color:"bg-amber-900"},linkbio:{label:"Link Bio",color:"bg-orange-500"},email:{label:"E-mail",color:"bg-purple-700"},linksite:{label:"Link Site",color:"bg-yellow-500"},forminsta:{label:"Form Insta",color:"bg-red-800"},Site:{label:"Site",color:"bg-yellow-300 text-black"},linkdirect:{label:"Link Direct",color:"bg-gray-300 text-black"},formdirect:{label:"Form Direct",color:"bg-blue-900"},WhatsApp:{label:"WhatsApp",color:"bg-green-600"}},O=s=>{if(!s)return null;const a=ue[s]||{label:s,color:"bg-gray-600"};return e.jsx(ae,{variant:"default",className:`text-[10px] ${a.color}`,children:a.label})},pe=re.reduce((s,a)=>{const l=He(a.message_timestamp),r=s[s.length-1];return r&&r.date===l?r.msgs.push(a):s.push({date:l,msgs:[a]}),s},[]),C=s=>s.lead_nome||s.push_name||s.telefone,he=async()=>{if(!x||!i)return;K(!0);const s={client_id:i,retention_months:x.retention_months,auto_cleanup_enabled:x.auto_cleanup_enabled},{error:a}=x.id?await g.from("whatsapp_retention_settings").update(s).eq("id",x.id):await g.from("whatsapp_retention_settings").insert(s).select().single();if(a)D.error("Erro ao salvar configurações"),console.error(a);else{D.success("Configurações de retenção salvas!"),G(!1);const{data:l}=await g.from("whatsapp_retention_settings").select("*").eq("client_id",i).maybeSingle();k(l)}K(!1)},ge=async()=>{if(!x||!i)return;const s=new Date;s.setMonth(s.getMonth()-x.retention_months);const{count:a,error:l}=await g.from("whatsapp_messages").delete({count:"exact"}).eq("client_id",i).lt("message_timestamp",s.toISOString());l?D.error("Erro ao limpar mensagens"):(D.success(`${a||0} mensagens removidas do banco de dados`),S())};return(Q=p.find(s=>s.id===i))!=null&&Q.nome,e.jsxs("div",{className:"flex h-[700px] rounded-xl overflow-hidden neon-shadow-cyan",style:{border:"1px solid rgba(0,191,254,0.1)"},children:[e.jsxs("div",{className:`${n?"hidden md:flex":"flex"} flex-col w-full md:w-[420px] min-w-[340px] luminous-chat-sidebar`,children:[e.jsx("div",{className:"px-4 py-3",style:{borderBottom:"1px solid rgba(255,255,255,0.05)"},children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-full flex items-center justify-center text-sm font-bold flex-shrink-0",style:{background:"rgba(0,191,254,0.1)",color:"#00bffe",border:"1px solid rgba(0,191,254,0.2)"},children:e.jsx(be,{className:"h-5 w-5"})}),e.jsxs(B,{value:i,onValueChange:s=>{_(s),$(null),E(!1)},children:[e.jsx(q,{className:"flex-1 border-0 text-sm font-semibold focus:ring-0",style:{background:"rgba(255,255,255,0.05)",color:"#fff",border:"1px solid rgba(255,255,255,0.06)"},children:e.jsx(F,{placeholder:"Selecione o cliente"})}),e.jsx(A,{children:p.map(s=>e.jsx(V,{value:s.id,children:s.nome},s.id))})]})]})}),e.jsxs("div",{className:"px-4 py-2 space-y-2",style:{borderBottom:"1px solid rgba(255,255,255,0.04)"},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{className:"h-3.5 w-3.5 text-neutral-500 flex-shrink-0"}),e.jsxs(B,{value:v,onValueChange:oe,children:[e.jsx(q,{className:"flex-1 h-8 border-0 text-xs focus:ring-0",style:{background:"rgba(255,255,255,0.03)",color:"#a3a3a3",border:"1px solid rgba(255,255,255,0.04)"},children:e.jsx(F,{})}),e.jsx(A,{children:We.map(s=>e.jsx(V,{value:s.value,children:s.label},s.value))})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(_e,{className:"absolute left-3 top-2.5 h-4 w-4 text-neutral-500"}),e.jsx("input",{type:"text",placeholder:"Buscar nome ou telefone...",value:R,onChange:s=>ce(s.target.value),className:"w-full pl-9 pr-3 py-2 rounded-lg text-sm luminous-chat-search"})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto luminous-scrollbar",children:u?e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(N,{className:"h-5 w-5 animate-spin text-cyan-500"})}):M.length===0?e.jsx("p",{className:"text-center text-sm py-16 text-neutral-500",children:"Nenhuma conversa encontrada"}):M.map(s=>{const a=(n==null?void 0:n.telefone)===s.telefone;return e.jsxs("div",{className:`flex items-center gap-3 px-4 py-3 cursor-pointer luminous-chat-contact ${a?"luminous-chat-contact-active":""}`,onClick:()=>X(s),children:[e.jsxs("div",{className:"relative flex-shrink-0",children:[e.jsx(le,{src:s.profile_pic_url,name:s.lead_nome||s.push_name,isActive:a}),e.jsx("span",{className:"absolute -top-0.5 -left-0.5 h-3 w-3 rounded-full border-2",style:{background:"#22c55e",borderColor:a?"rgba(0,191,254,0.06)":"#0a0d12",boxShadow:"0 0 6px rgba(34,197,94,0.4)"}})]}),e.jsxs("div",{className:"flex-1 min-w-0 hidden md:block",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:`text-sm font-semibold truncate ${a?"text-white":"text-neutral-200"}`,children:C(s)}),e.jsx("span",{className:"text-[10px] flex-shrink-0 text-neutral-500",children:Ue(s.last_timestamp)})]}),C(s)!==s.telefone&&e.jsx("p",{className:"text-[11px] text-neutral-500 mt-0.5",children:te(s.telefone)}),e.jsx("p",{className:"text-xs truncate mt-0.5 text-neutral-500",children:s.last_message||"(mídia)"}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-1",children:[O(s.lead_origem),e.jsxs("span",{className:"text-[10px] text-neutral-600",children:[s.message_count," msgs"]}),e.jsxs("span",{className:"text-[10px] text-neutral-600 flex items-center gap-0.5",children:[e.jsx(W,{className:"h-2.5 w-2.5"}),new Date(s.last_timestamp).toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"2-digit"})]})]})]})]},s.telefone)})}),e.jsxs("div",{className:"flex",style:{borderTop:"1px solid rgba(255,255,255,0.05)"},children:[e.jsxs("button",{className:"flex-1 py-2.5 text-xs font-medium flex items-center justify-center gap-1.5 text-neutral-400 hover:text-cyan-400 hover:bg-white/5 transition-all",onClick:S,children:[e.jsx(N,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"hidden md:inline",children:"Atualizar"})]}),e.jsxs("button",{className:"flex-1 py-2.5 text-xs font-medium flex items-center justify-center gap-1.5 text-neutral-400 transition-all",style:{borderLeft:"1px solid rgba(255,255,255,0.05)"},children:[e.jsx(y,{className:"h-3.5 w-3.5"}),e.jsxs("span",{className:"hidden md:inline",children:[M.length," conversas"]})]}),e.jsxs(je,{open:me,onOpenChange:G,children:[e.jsx(Ne,{asChild:!0,children:e.jsx("button",{className:"py-2.5 px-3 text-xs font-medium flex items-center justify-center gap-1.5 text-neutral-400 hover:text-cyan-400 hover:bg-white/5 transition-all",style:{borderLeft:"1px solid rgba(255,255,255,0.05)"},children:e.jsx(ye,{className:"h-3.5 w-3.5"})})}),e.jsxs(we,{className:"sm:max-w-md",children:[e.jsx(ve,{children:e.jsxs(ke,{className:"flex items-center gap-2",children:[e.jsx(P,{className:"h-5 w-5 text-red-400"}),"Retenção de Mensagens"]})}),e.jsxs("div",{className:"space-y-5 py-3",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Configure por quanto tempo as mensagens ficam armazenadas no banco de dados.",e.jsx("strong",{className:"text-foreground",children:" Isso NÃO afeta as conversas no WhatsApp"}),", apenas a cópia local."]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Período de retenção"}),e.jsxs(B,{value:String((x==null?void 0:x.retention_months)||12),onValueChange:s=>k(a=>a?{...a,retention_months:parseInt(s)}:null),children:[e.jsx(q,{children:e.jsx(F,{})}),e.jsx(A,{children:ze.map(s=>
1e.jsx(V,{value:String(s.value),children:s.label},s.value))})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Limpeza automática"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Executa diariamente às 3h"})]}),e.jsx(Se,{checked:(x==null?void 0:x.auto_cleanup_enabled)||!1,onCheckedChange:s=>k(a=>a?{...a,auto_cleanup_enabled:s}:null)})]}),(x==null?void 0:x.last_cleanup_at)&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Última limpeza: ",new Date(x.last_cleanup_at).toLocaleString("pt-BR")]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ee,{onClick:he,disabled:H,className:"flex-1",children:H?"Salvando...":"Salvar"}),e.jsxs(ee,{variant:"destructive",onClick:ge,className:"flex-shrink-0",children:[e.jsx(P,{className:"h-4 w-4 mr-1"}),"Limpar agora"]})]})]})]})]})]})]}),e.jsx("div",{className:`${n?"flex":"hidden md:flex"} flex-col flex-1 luminous-chat-area`,children:n?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 h-[60px] luminous-chat-header",children:[e.jsx("button",{className:"md:hidden p-1 rounded-lg text-neutral-400 hover:text-white hover:bg-white/5 transition-colors",onClick:()=>$(null),children:e.jsx(Ce,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex items-center gap-3 flex-1 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>Y(n),children:[e.jsx(le,{src:n.profile_pic_url,name:n.lead_nome||n.push_name,size:"sm",isActive:!0}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-semibold text-sm text-white",children:C(n)}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs flex items-center gap-1 text-neutral-500",children:[e.jsx(se,{className:"h-3 w-3"}),n.telefone]}),O(n.lead_origem)]})]})]}),e.jsx("button",{className:"p-2 rounded-lg text-neutral-400 hover:text-cyan-400 hover:bg-white/5 transition-all",onClick:()=>Y(n),title:"Ver perfil do contato",children:e.jsx(De,{className:"h-4 w-4"})}),e.jsx("button",{className:"p-2 rounded-lg text-neutral-400 hover:text-cyan-400 hover:bg-white/5 transition-all",onClick:()=>X(n),children:e.jsx(N,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3 luminous-scrollbar",children:ie?e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(N,{className:"h-5 w-5 animate-spin text-cyan-500"})}):e.jsxs("div",{className:"space-y-4",children:[pe.map(s=>e.jsxs("div",{children:[e.jsx("div",{className:"flex justify-center mb-3",children:e.jsx("span",{className:"text-[10px] px-3 py-1 rounded-full luminous-chat-date-pill",children:s.date})}),e.jsx("div",{className:"space-y-2",children:s.msgs.map(a=>e.jsx("div",{className:`flex ${a.from_me?"justify-end":"justify-start"}`,children:e.jsxs("div",{className:`max-w-[70%] px-3.5 py-2.5 text-sm leading-relaxed ${a.from_me?"luminous-chat-bubble-sent":"luminous-chat-bubble-received"}`,style:{borderRadius:a.from_me?"16px 16px 4px 16px":"16px 16px 16px 4px"},children:[e.jsx("p",{className:"whitespace-pre-wrap break-words",children:a.message_text||`[${a.message_type}]`}),e.jsx("p",{className:"text-[10px] text-right mt-1 text-neutral-500",children:Ge(a.message_timestamp)})]})},a.id))})]},s.date)),e.jsx("div",{ref:I})]})}),e.jsx("div",{className:"luminous-chat-input-bar flex items-center px-4 h-[44px]",children:e.jsx("p",{className:"text-xs w-full text-center text-neutral-500",children:"Modo visualização — somente leitura"})})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"relative inline-block mb-4",children:[e.jsx(y,{className:"h-16 w-16 text-neutral-700"}),e.jsx("div",{className:"absolute inset-0 blur-xl",style:{background:"rgba(0,191,254,0.05)"}})]}),e.jsx("p",{className:"text-sm font-medium text-neutral-500",children:"Selecione uma conversa para visualizar"})]})})}),de&&n&&e.jsxs("div",{className:"hidden md:flex flex-col w-[300px] min-w-[260px] luminous-chat-sidebar overflow-y-auto luminous-scrollbar",style:{borderLeft:"1px solid rgba(255,255,255,0.05)"},children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{borderBottom:"1px solid rgba(255,255,255,0.05)"},children:[e.jsx("p",{className:"text-sm font-semibold text-white",children:"Perfil do Contato"}),e.jsx("button",{className:"p-1.5 rounded-lg text-neutral-400 hover:text-white hover:bg-white/5 transition-colors",onClick:()=>E(!1),children:e.jsx(Le,{className:"h-4 w-4"})})]}),xe?e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(N,{className:"h-5 w-5 animate-spin text-cyan-500"})}):e.jsxs("div",{className:"flex flex-col items-center px-4 py-5 space-y-5",children:[e.jsx("div",{className:"relative",children:n.profile_pic_url?e.jsx("img",{src:n.profile_pic_url,alt:C(n),className:"h-24 w-24 rounded-full object-cover",style:{border:"2px s
1olid rgba(0,191,254,0.3)"},onError:s=>{s.target.style.display="none"}}):e.jsx("div",{className:"h-24 w-24 rounded-full flex items-center justify-center text-2xl font-bold",style:{background:"rgba(0,191,254,0.1)",color:"#00bffe",border:"2px solid rgba(0,191,254,0.2)"},children:ne((t==null?void 0:t.nome)||n.push_name)})}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-base font-semibold text-white",children:(t==null?void 0:t.nome)||n.push_name||"Sem nome"}),n.push_name&&(t==null?void 0:t.nome)&&n.push_name!==t.nome&&e.jsxs("p",{className:"text-xs text-neutral-500 mt-0.5",children:["WhatsApp: ",n.push_name]})]}),e.jsxs("div",{className:"w-full space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.04)"},children:[e.jsx(se,{className:"h-4 w-4 text-cyan-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-neutral-500 uppercase tracking-wider",children:"Telefone"}),e.jsx("p",{className:"text-sm text-neutral-200",children:te(n.telefone)})]})]}),(t==null?void 0:t.email)&&e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.04)"},children:[e.jsx(Te,{className:"h-4 w-4 text-cyan-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-neutral-500 uppercase tracking-wider",children:"Email"}),e.jsx("p",{className:"text-sm text-neutral-200 break-all",children:t.email})]})]}),e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.04)"},children:[e.jsx($e,{className:"h-4 w-4 text-cyan-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-neutral-500 uppercase tracking-wider",children:"Origem"}),e.jsx("div",{className:"mt-0.5",children:O((t==null?void 0:t.origem)||n.lead_origem)})]})]}),e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.04)"},children:[e.jsx(W,{className:"h-4 w-4 text-cyan-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-neutral-500 uppercase tracking-wider",children:"Lead desde"}),e.jsx("p",{className:"text-sm text-neutral-200",children:t!=null&&t.created_at?new Date(t.created_at).toLocaleDateString("pt-BR",{day:"2-digit",month:"long",year:"numeric"}):"—"})]})]}),(t==null?void 0:t.response_time_minutes)!=null&&e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.04)"},children:[e.jsx(Re,{className:"h-4 w-4 text-cyan-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-neutral-500 uppercase tracking-wider",children:"Tempo de resposta"}),e.jsx("p",{className:"text-sm text-neutral-200",children:t.response_time_minutes<60?`${t.response_time_minutes} min`:`${Math.floor(t.response_time_minutes/60)}h ${t.response_time_minutes%60}min`})]})]}),(t==null?void 0:t.primeira_mensagem)&&e.jsxs("div",{className:"px-3 py-2.5 rounded-lg",style:{background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.04)"},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(y,{className:"h-4 w-4 text-cyan-500 flex-shrink-0"}),e.jsx("p",{className:"text-[10px] text-neutral-500 uppercase tracking-wider",children:"Primeira mensagem"})]}),e.jsx("p",{className:"text-xs text-neutral-300 leading-relaxed line-clamp-4",children:t.primeira_mensagem})]}),(t==null?void 0:t.ad_clicks)&&t.ad_clicks.length>0&&e.jsxs("div",{className:"px-3 py-2.5 rounded-lg",style:{background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.04)"},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Ee,{className:"h-4 w-4 text-cyan-500 flex-shrink-0"}),e.jsx("p",{className:"text-[10px] text-neutral-500 uppercase tracking-wider",children:"Campanhas"})]}),e.jsx("div",{className:"space-y-2",children:t.ad_clicks.map((s,a)=>e.jsxs("div",{className:"text-xs space-y-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(ae,{variant:"default",className:`text-[9px] ${s.plataforma==="meta"?"bg-blue-600":"bg-yellow-600"}`,children:s.plataforma==="meta"?"Meta":"Google"}),e.jsx("span",{className:"text-neutral-500",children:new Date(s.click_timestamp).toLocaleDateString("pt-BR")})]}),s.campanha&&e.jsx("p",{className:"text-neutral-300 truncate",children:s.campanha}),s.anuncio&&e.jsx("p",{className:"text-neutral-500 truncate text-[10px]",children:s.anuncio})]},a))})]}),e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.04)"},children:[e.jsx(y,{className:"h-4 w-4 text-cyan-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-neutral-500 uppercase tracking-wider",children:"Mensagens"}),e.jsxs("p",{className:"text-sm text-neutral-200",children:[n.message_count," mensagens"]})]})]})]})]})]})]})}const Je=()=>e.jsxs(Ie,{defaultValue:"conversations",className:"w-full",children:[e.jsxs(Me,{className:"luminous-tabs-list mx-auto mb-4",children:[e.jsxs(L,{value:"conversations",children:[e.jsx(y,{className:"h-4 w-4 mr-2"}),"Conversas"]}),e.jsxs(L,{value:"kanban",children:[e.jsx(Oe,{className:"h-4 w-4 mr-2"}),"Kanban Leads"]}),e.jsxs(L,{value:"funnel",children:[e.jsx(Be,{className:"h-4 w-4 mr-2"}),"Funil"]}),e.jsxs(L,{value:"followup",children:[e.jsx(qe,{className:"h-4 w-4 mr-2"}),"Follow-Up"]})]}),e.jsx(T,{value:"conversations",children:e.jsx(Ke,{})}),e.jsx(T,{value:"kanban",children:e.jsx(Fe,{})}),e.jsx(T,{value:"funnel",children:e.jsx(Ae,{})}),e.jsx(T,{value:"followup",children:e.jsx(Ve,{})})]});
1export{Je as ComunicacaoTabContent};

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.