PageSourceSearch

https://leadsense.solutions/assets/DmvVA5nL.js

js leadsense.solutions collected 2026-09-24 15:12:07 UTC 13,549 bytes, 20 lines download raw bytes

1import{j as e,r as h}from"./COEsLHzF.js";import{C as q}from"./DFdiJ1zT.js";import{a as N,aj as H,ak as R,al as E,am as P,an as b,d as D,k as B,n as U,ao as V,ap as I,aq as z,m as A,ar as G}from"./CkOBBei9.js";import{U as J}from"./CQGdLIvs.js";import{C as K}from"./ClmE6QoT.js";import{C as M}from"./CUXjVy9n.js";import{T as S}from"./DYM33MRS.js";import{M as O}from"./6B1m_NBQ.js";import{S as Q}from"./C53zQfLK.js";import{f as W,p as X}from"./FzBzSa_Y.js";import{T as Y}from"./DdjHb4Fr.js";import{R as u}from"./D0dttLfW.js";import{C as v}from"./DHW2ngtP.js";import{F as Z}from"./77XEqkB4.js";import"./Cv7XXEzQ.js";import"./D_S0ayS7.js";import"./CyTcV1HU.js";import"./ClQeOjb7.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const ee=N("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const se=N("Hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const te=N("ServerCrash",[["path",{d:"M6 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2",key:"4b9dqc"}],["path",{d:"M6 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-2",key:"22nnkd"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m13 6-4 6h6l-4 6",key:"14hqih"}]]);function re(t){switch(t.type){case"cooling_lead":return e.jsx(Q,{className:"w-5 h-5"});case"untranscribed_audio":return e.jsx(O,{className:"w-5 h-5"});case"espera_humano":return e.jsx(se,{className:"w-5 h-5"});case"ops_failure":case"quote_failed":case"quote_degraded":return e.jsx(te,{className:"w-5 h-5"});default:return t.severity==="high"?e.jsx(S,{className:"w-5 h-5"}):e.jsx(b,{className:"w-5 h-5"})}}function ae({alert:t,onAcknowledge:s,showActions:l=!0}){const i=H(t.severity),d=R(t.type);return e.jsx("div",{className:`
17      border rounded-lg p-4
18      ${t.acknowledged?"bg-muted opacity-75":"bg-white"}
19      hover:shadow-md transition-shadow
20    `,children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex gap-3 flex-1",children:[e.jsx("div",{className:`${i} p-2 rounded-lg`,children:re(t)}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium text-foreground mb-1",children:t.message}),e.jsxs("div",{className:"flex flex-wrap gap-3 text-sm text-muted-foreground",children:[t.contact_name&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(J,{className:"w-4 h-4"}),t.contact_name]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(K,{className:"w-4 h-4"}),W(new Date(t.created_at),{addSuffix:!0,locale:X})]})]}),e.jsxs("div",{className:"flex gap-2 mt-2 flex-wrap",children:[e.jsx("span",{className:`text-xs px-2 py-1 rounded-full ${i}`,children:E(t.severity)}),e.jsx("span",{className:`text-xs px-2 py-1 rounded-full ${d}`,children:P(t.type)}),t.acknowledged&&e.jsxs("span",{className:"text-xs px-2 py-1 rounded-full bg-success/10 text-success-text",children:[e.jsx(M,{className:"w-3 h-3 inline"})," Lido"]})]})]})]}),l&&!t.acknowledged&&s&&e.jsx("button",{onClick:()=>s(t.id),className:"px-3 py-1 text-sm bg-primary text-primary-foreground rounded hover:bg-primary/90 transition-colors whitespace-nowrap",children:"Marcar como lido"})]})})}function le({stats:t}){var l;const s=t.total>0?(t.pending/t.total*100).toFixed(1):"0";return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsx("div",{className:"bg-white rounded-lg shadow p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Total de Alertas"}),e.jsx("p",{className:"text-3xl font-bold text-foreground",children:t.total})]}),e.jsx("div",{className:"p-3 bg-primary/10 rounded-lg",children:e.jsx(b,{className:"w-6 h-6 text-primary"})})]})}),e.jsx("div",{className:"bg-white rounded-lg shadow p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Pendentes"}),e.jsx("p",{className:"text-3xl font-bold text-warning",children:t.pending}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[s,"% do total"]})]}),e.jsx("div",{className:"p-3 bg-warning/10 rounded-lg",children:e.jsx(S,{className:"w-6 h-6 text-warning"})})]})}),e.jsx("div",{className:"bg-white rounded-lg shadow p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Reconhecidos"}),e.jsx("p",{className:"text-3xl font-bold text-success-text",children:t.acknowledged})]}),e.jsx("div",{className:"p-3 bg-success/10 rounded-lg",children:e.jsx(M,{className:"w-6 h-6 text-success-text"})})]})}),e.jsx("div",{className:"bg-white rounded-lg shadow p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Críticos"}),e.jsx("p",{className:"text-3xl font-bold text-destructive-text",children:((l=t.by_severity)==null?void 0:l.high)||0})]}),e.jsx("div",{className:"p-3 bg-destructive/10 rounded-lg",children:e.jsx(Y,{className:"w-6 h-6 text-destructive-text"})})]})})]})}function de({embedded:t=!1}={}){const{t:s}=D(),{user:l}=B(),{toast:i}=U(),[d,g]=h.useState("pending"),[o,m]=h.useState(),[p,$]=h.useState(7),{stats:a,loading:f,error:L,refresh:x}=V(p),{alerts:n,loading:j,error:w,refresh:c}=I({acknowledged:d==="all"?void 0:d==="acknowledged",severity:o,days:p}),T=async r=>{try{await z(r,(l==null?void 0:l.name)||(l==null?void 0:l.email)||"user"),await c(),await x()}catch(C){console.error("Error acknowledging alert:",C),alert(A(C))}},[y,k]=h.useState(!1),_=async()=>{k(!0);try{const r=await G();await Promise.all([x(),c()]),i({title:r>0?`${r} alerta(s) marcados como lidos`:"Nao havia alerta por ler"})}catch(r){i({variant:"destructive",title:"Nao consegui marcar como lidos",description:A(r)})}finally{k(!1)}},F=async()=>{await Promise.all([x(),c()])};return e.jsx("div",{className:t?"":"min-h-screen p-6",children:e.jsxs("div",{className:t?"":"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[!t&&e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-foreground",children:s("alerts.title")}),e.jsx("p",{className:"text-muted-foreground mt-1",children:s("alerts.subtitle")})]}),e.jsxs("div",{className:"flex gap-2 ml-auto",children:[e.jsxs("button",{onClick:F,disabled:f||j,className:"px-4 py-2 bg-white border rounded-lg hover:bg-muted transition-colors flex items-center gap-2",children:[e.jsx(u,{className:`w-4 h-4 ${f||j?"animate-spin":""}`}),s("common.refresh")]}),e.jsxs("button",{onClick:_,disabled:y||((a==null?void 0:a.pending)??0)===0,title:((a==null?void 0:a.pending)??0)===0?"Nada por ler":`Marcar ${a==null?void 0:a.pending} alerta(s) como lidos`,className:"px-4 py-2 bg-white border rounded-lg hover:bg-muted transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(ee,{className:`w-4 h-4 ${y?"animate-pulse":""}`}),"Marcar todos como lidos"]})]})]}),f?e.jsx("div",{className:"animate-pulse",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-6",children:[1,2,3,4].map(r=>e.jsx("div",{className:"bg-white rounded-lg shadow p-6 h-28"},r))})}):L&&!a?e.jsxs("div",{className:"mb-6 bg-destructive/10 border border-destructive/20 rounded-lg p-6 text-center",children:[e.jsx(v,{className:"w-8 h-8 text-destructive-text mx-auto mb-2"}),e.jsx("p",{className:"text-destructive-text font-medium",children:s("alerts.errorLoadingStats")}),e.jsx("p",{className:"text-destructive-text text-sm mt-1",children:s("alerts.errorStatsMessage")}),e.jsxs("button",{onClick:x,className:"mt-3 px-4 py-2 bg-destructive/10 text-destructive-text rounded-lg hover:bg-destructive/10 transition-colors text-sm font-medium inline-flex items-center gap-2",children:[e.jsx(u,{className:"w-4 h-4"}),s("common.retry")]})]}):a?e.jsx("div",{className:"mb-6",children:e.jsx(le,{stats:a})}):null,e.jsx("div",{className:"bg-white rounded-lg shadow p-4 mb-6",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:s("alerts.filterLabel")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>g("all"),className:`px-3 py-1 text-sm rounded-lg transition-colors ${d==="all"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted"}`,children:s("alerts.filterAll")}),e.jsx("button",{onClick:()=>g("pending"),className:`px-3 py-1 text-sm rounded-lg transition-colors ${d==="pending"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted"}`,children:s("alerts.filterPending")}),e.jsx("button",{onClick:()=>g("acknowledged"),className:`px-3 py-1 text-sm rounded-lg transition-colors ${d==="acknowledged"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted"}`,children:s("alerts.filterAcknowledged")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>m(void 0),className:`px-3 py-1 text-sm rounded-lg transition-colors ${o?"bg-muted text-muted-foreground hover:bg-muted":"bg-ink text-white"}`,children:s("alerts.allSeverities")}),e.jsx("button",{onClick:()=>m("high"),className:`px-3 py-1 text-sm rounded-lg transition-colors ${o==="high"?"bg-destructive text-destructive-foreground":"bg-muted text-muted-foreground hover:bg-muted"}`,children:s("alerts.severityHigh")}),e.jsx("button",{onClick:()=>m("medium"),className:`px-3 py-1 text-sm rounded-lg transition-colors ${o==="medium"?"bg-warning text-warning-foreground":"bg-muted text-muted-foreground hover:bg-muted"}`,children:s("alerts.severityMedium")}),e.jsx("button",{onClick:()=>m("low"),className:`px-3 py-1 text-sm rounded-lg transition-colors ${o==="low"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted"}`,children:s("alerts.severityLow")})]}),e.jsxs("select",{value:p,onChange:r=>$(Number(r.target.value)),className:"px-3 py-1 text-sm border rounded-lg bg-white",children:[e.jsx("option",{value:1,children:s("alerts.last24h")}),e.jsx("option",{value:7,children:s("alerts.last7d")}),e.jsx("option",{value:30,children:s("alerts.last30d")}),e.jsx("option",{value:90,children:s("alerts.last90d")})]})]})}),e.jsx("div",{className:"space-y-3",children:j?e.jsx("div",{className:"animate-pulse space-y-3",children:[1,2,3,4,5].map(r=>e.jsx("div",{className:"bg-white rounded-lg shadow p-6 h-24"},r))}):w&&n.length===0?e.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg shadow p-12 text-center",children:[e.jsx(v,{className:"w-10 h-10 text-destructive-text mx-auto mb-3"}),e.jsx("p",{className:"text-destructive-text font-medium text-lg",children:s("alerts.errorLoadingAlerts")}),e.jsx("p",{className:"text-destructive-text text-sm mt-2",children:s("alerts.errorAlertsMessage")}),e.jsxs("button",{onClick:c,className:"mt-4 px-5 py-2.5 bg-destructive/10 text-destructive-text rounded-lg hover:bg-destructive/10 transition-colors text-sm font-medium inline-flex items-center gap-2",children:[e.jsx(u,{className:"w-4 h-4"}),s("common.retry")]})]}):n.length===0?e.jsxs("div",{className:"bg-white rounded-lg shadow p-12 text-center",children:[e.jsx("p",{className:"text-muted-foreground text-lg",children:s("alerts.noAlertsFound")}),e.jsx("p",{className:"text-muted-foreground text-sm mt-2",children:s("alerts.noAlertsHint")})]}):e.jsxs(e.Fragment,{children:[w&&e.jsxs("div",{className:"bg-warning/10 border border-warning/20 rounded-lg p-3 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(v,{className:"w-4 h-4 text-warning-text"}),e.jsx("span",{className:"text-warning-text text-sm",children:s("alerts.cachedData")})]}),e.jsxs("button",{onClick:c,className:"text-warning-text text-sm font-medium hover:underline inline-flex items-center gap-1",children:[e.jsx(u,{className:"w-3.5 h-3.5"}),s("common.retry")]})]}),n.map(r=>e.jsx(ae,{alert:r,onAcknowledge:T},r.id))]})}),n.length>0&&e.jsx("div",{className:"mt-6 text-center text-sm text-muted-foreground",children:n.length!==1?s("alerts.showing_other",{count:n.length}):s("alerts.showing_one",{count:n.length})})]})})}function Ce(){return e.jsxs("div",{className:"p-6 max-w-7xl mx-auto",children:[e.jsx(q,{icon:b,title:"Alertas",subtitle:"Leads esfriando, clientes esperando e falhas que pedem ação."}),e.jsx("div",{className:"mt-5",children:e.jsx(de,{embedded:!0})})]})}export{Ce as default};

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.