https://vault22.com/_next/static/chunks/pages/admin/customer-support/tara-health-30bb04c8edbd3884.js
1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4226],{33640:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/customer-support/tara-health",function(){return a(92746)}])},92746:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>g});var l=a(37876),s=a(14232),n=a(77328),i=a.n(n),o=a(37497),r=a(93341),c=a(21567),d=a(66803);let u=[{label:"Last 7 days",days:7},{label:"Last 30 days",days:30},{label:"Last 90 days",days:90}],m=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20;return(null!=e?e:[]).slice(0,t).map(e=>({label:e.key,value:e.count}))},b=(e,t)=>t>0?"".concat(Math.round(e/t*100),"%"):"â",v=["issue_regulatory","issue_security"];function g(){var e,t,a,n;let[g,h]=(0,s.useState)(30),[x,y]=(0,s.useState)(null),[p,j]=(0,s.useState)(!0),[f,w]=(0,s.useState)(null),T=(0,s.useCallback)(async e=>{j(!0),w(null);try{let t=new Date,a=new Date(t.getTime()-24*e*36e5),l=await (0,r.c)(a,t);if(!l.ok)throw Error("HTTP ".concat(l.status));y(await l.json())}catch(e){w((null==e?void 0:e.message)||"Failed to load"),y(null)}finally{j(!1)}},[]);(0,s.useEffect)(()=>{T(g)},[g,T]);let N=(0,s.useMemo)(()=>x?x.total-x.escalated:0,[x]),S=(0,s.useMemo)(()=>{var e;return(null!=(e=null==x?void 0:x.byIssueType)?e:[]).filter(e=>v.includes(e.key)).reduce((e,t)=>e+t.count,0)},[x]),k=(0,s.useMemo)(()=>{var e;return(null!=(e=null==x?void 0:x.byFeedbackType)?e:[]).filter(e=>"complaint"===e.key||"defect"===e.key)},[x]);return(0,l.jsxs)(o.A,{requireRoles:["Admin","Sven","Analyst"],children:[(0,l.jsx)(i(),{children:(0,l.jsx)("title",{children:"Tara Health Dashboard"})}),(0,l.jsxs)("div",{className:"mx-auto max-w-7xl px-4 py-6",children:[(0,l.jsxs)("div",{className:"mb-5 flex flex-wrap items-center justify-between gap-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"text-2xl font-bold text-gray-900",children:"Tara Health Dashboard"}),(0,l.jsxs)("p",{className:"mt-0.5 text-sm text-gray-500",children:["Management view over the Tara interaction store \xb7 ",x?"".concat(x.total.toLocaleString()," interactions"):"â"," in the selected window"]})]}),(0,l.jsx)("div",{className:"flex items-center gap-2",children:u.map(e=>(0,l.jsx)("button",{onClick:()=>h(e.days),className:"rounded-lg px-3 py-1.5 text-sm font-medium ".concat(g===e.days?"bg-indigo-600 text-white":"bg-white text-gray-600 ring-1 ring-gray-200 hover:bg-gray-50"),children:e.label},e.days))})]}),f&&(0,l.jsxs)("div",{className:"mb-5 rounded-lg border border-rose-200 bg-rose-50 px-4 py-3 text-sm text-rose-700",children:["LIVE FETCH FAILED: ",f,". Needs a valid admin session and the core tara-interactions endpoint deployed."]}),(0,l.jsx)(c.No,{num:1,title:"Health headline",blurb:"The numbers leadership watches."}),(0,l.jsxs)(c.F2,{children:[(0,l.jsx)(c.Vu,{value:p?void 0:x?b(N,x.total):"â",label:"Ticket avoidance rate",sub:"Resolved by Tara, no human",loading:p,error:f,accent:"emerald"}),(0,l.jsx)(c.Vu,{value:p?void 0:(null==x?void 0:x.avgCsat)!=null?x.avgCsat.toFixed(1):"â",label:"Customer sentiment (CSAT)",sub:x?"".concat(x.csatCount.toLocaleString()," ratings"):void 0,loading:p,error:f,accent:"blue"}),(0,l.jsx)(c.Vu,{value:p?void 0:(null!=(e=null==x?void 0:x.revenueAtRisk)?e:0).toLocaleString(),label:"Revenue at risk",sub:"Customers signalling churn",loading:p,error:f,accent:"rose"}),(0,l.jsx)(c.Vu,{value:p?void 0:S.toLocaleString(),label:"Regulatory / compliance incidents",sub:"Security + regulatory escalations",loading:p,error:f,accent:"amber"})]}),(0,l.jsx)("div",{className:"mt-4",children:(0,l.jsxs)(c.F2,{children:[(0,l.jsx)(c.Vu,{value:p?void 0:(null!=(t=null==x?void 0:x.productDefects)?t:0).toLocaleString(),label:"Bugs identified by Tara",sub:"Routed to Product / Engineering",loading:p,error:f,accent:"purple"}),(0,l.jsx)(c.Vu,{value:p?void 0:(null!=(a=null==x?void 0:x.providerIssues)?a:0).toLocaleString(),label:"Provider outages flagged",loading:p,error:f,accent:"amber"}),(0,l.jsx)(c.Vu,{value:p?void 0:x?b(x.escalated,x.total):"â",label:"Escalation rate",loading:p,error:f,accent:"indigo"}),(0,l.jsx)(c.Vu,{value:p?void 0:(null!=(n=null==x?void 0:x.total)?n:0).toLocaleStr
1ing(),label:"Total interactions",loading:p,error:f,accent:"teal"})]})}),(0,l.jsxs)("div",{className:"mt-6",children:[(0,l.jsx)(c.No,{num:2,title:"Top 20 customer issues",blurb:"Where the demand concentrates - by issue type."}),(0,l.jsx)(c.do,{id:"2.0",title:"Top customer issues",subtitle:"By issue type (top 20)",children:(0,l.jsx)(d.bK,{data:m(null==x?void 0:x.byIssueType,20),valueLabel:"Interactions",height:340})})]}),(0,l.jsxs)("div",{className:"mt-6",children:[(0,l.jsx)(c.No,{num:3,title:"Friction + sentiment",blurb:"Product-friction hotspots and how customers feel."}),(0,l.jsxs)(c.h6,{children:[(0,l.jsx)(c.do,{id:"3.0",title:"Product-friction hotspots",subtitle:"Complaints + defects",children:(0,l.jsx)(d.bK,{data:m(k,10),valueLabel:"Interactions"})}),(0,l.jsx)(c.do,{id:"3.1",title:"Customer sentiment",subtitle:"Per interaction",children:(0,l.jsx)(d.We,{data:m(null==x?void 0:x.bySentiment,5),valueLabel:"Interactions"})})]})]})]})]})}},93341:(e,t,a)=>{"use strict";a.d(t,{c:()=>r});var l=a(34803),s=a(56722);let n="".concat(s.JR,"/platform/tara-interactions"),i="".concat(s.JR,"/admin/tara-interactions"),o=n;async function r(e,t){let a="aggregate?from=".concat(e.toISOString(),"&to=").concat(t.toISOString()),s=await (0,l.$)("".concat(o,"/").concat(a));return 404===s.status&&o===n&&(o=i,s=await (0,l.$)("".concat(o,"/").concat(a))),s}}},e=>{e.O(0,[9660,7550,7497,6803,1306,1567,636,6593,8792],()=>e(e.s=33640)),_N_E=e.O()}]);
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.