PageSourceSearch

https://app.verbix.ai/assets/CustomerExperienceReport-DuzZyWnm.js

js verbix.ai collected 2026-10-05 13:54:15 UTC 30,569 bytes, 1 lines download raw bytes

1import{r as h,e as q,u as R,x as P,ac as N,U as T,l as Y,af as G,K as Z,a6 as Q,j as s,aj as ee,g as te,N as se}from"./index-jmx1CJ5H.js";import{G as V,R as W,I as U,T as H,a as S,A as M,b as re,c as F}from"./TableCard-B4YTqdId.js";import{L as ae}from"./layout-grid-CPgYrGx9.js";import{K as k}from"./KPIStatCard-R7ImH-8M.js";import{H as ne}from"./heart-Dhtey8NH.js";import{P as oe}from"./PieChartCard-DSvypwF9.js";import{M as ie}from"./meh-98-3lrLP.js";import{F as X}from"./frown-CeQm16Ni.js";import{R as ce,L as le,m as pe}from"./ComposedChart-DItjKEdv.js";import{C as ue}from"./calendar-ev8CgJB_.js";import{D as de}from"./download-DlV7VIMX.js";import"./PieChart-NzNvBUGQ.js";const me=()=>{const[e,t]=h.useState("thisMonth"),[r,o]=h.useState(""),[a,i]=h.useState(""),[c,l]=h.useState("all"),[n,p]=h.useState("all");return{dateRange:e,setDateRange:t,customStartDate:r,customEndDate:a,handleCustomDateSelect:(u,m)=>{o(u),i(m),t("custom")},department:c,setDepartment:l,dataType:n,setDataType:p}},xe=async e=>await q.get(`/compliance/settings/type/Rules Group?companyId=${e}`),he=async e=>await q.get("/reports/cx-summary",{params:e}),ge=()=>{const{t:e}=R(),[t,r]=h.useState([{value:"all",label:e("report.cxReport.filters.allDepartments","All Departments")}]);h.useEffect(()=>{r(a=>a.map(i=>i.value==="all"?{...i,label:e("report.cxReport.filters.allDepartments","All Departments")}:i))},[e]);const o=async()=>{try{const a=globalThis.localStorage.getItem("user");if(!a)return;const c=JSON.parse(a)?.company_id;if(!c)return;const l=await xe(c);if(!l.data||!Array.isArray(l.data))return;const n=l.data.filter(u=>u.mandatory==="Yes").map(u=>({value:u.statement,label:u.statement})),d=Array.from(new Set(n.map(u=>u.value))).map(u=>n.find(m=>m.value===u));r([{value:"all",label:e("report.cxReport.filters.allDepartments","All Departments")},...d])}catch(a){console.error("Failed to fetch departments",a)}};return h.useEffect(()=>{o()},[e]),{deptOptions:t}},ve=[{date:"May 1",thisMonth:3500,lastMonth:2100},{date:"May 8",thisMonth:4800,lastMonth:3400},{date:"May 15",thisMonth:5400,lastMonth:3e3},{date:"May 22",thisMonth:6100,lastMonth:4200},{date:"May 29",thisMonth:7200,lastMonth:5100}],fe=[{name:"Issue Not Resolved",value:38},{name:"Long Resolution Time",value:24},{name:"Had to Contact Multiple Times",value:18},{name:"Wrong Information Provided",value:12},{name:"Others",value:8}],be=[{name:"Billing Issues",value:32},{name:"Price / Charges",value:21},{name:"Refund / Return",value:16},{name:"Service Issues",value:15},{name:"Product Issues",value:12}],Re=[{name:"Not getting issue resolved",mentions:1562,impact:-9.2},{name:"Repetitive information",mentions:1221,impact:-8.7},{name:"Long hold/queue time",mentions:1045,impact:-8.3},{name:"Unhelpful agent",mentions:768,impact:-7.6},{name:"Lack of communication",mentions:612,impact:-7.1}],ye=[{name:"Agent was helpful",mentions:2146,impact:9.4},{name:"Issue resolved quickly",mentions:1789,impact:9.1},{name:"Polite and respectful service",mentions:1456,impact:8.8},{name:"Clear information provided",mentions:1123,impact:8.2},{name:"Easy to reach support",mentions:987,impact:7.9}],Ce=["#22c55e","#3b82f6","#f97316","#ef4444","#b91c1c"],B=(e,t,r=6)=>Array.from({length:r},(o,a)=>({value:Number((e-(r-1-a)*t).toFixed(2))})),je=e=>{switch(e){case"improvement":return P;case"warning":return N;case"risk":return N;case"info":return Y;case"success":return G;default:return Z}},ke=e=>{switch(e){case"improvement":return"text-green-500";case"warning":return"text-amber-500";case"risk":return"text-red-500";case"info":return"text-blue-500";case"success":return"text-green-500";default:return"text-[#EF4444]"}},we=(e,t,r)=>t?{detractorsPercent:0,promotersPercent:0,passivesPercent:0,promotersCount:0,passivesCount:0,detractorsCount:0,ces:0}:e?.kpis?{detractorsPercent:e.kpis.detractorsPercent??6,promotersPercent:e.kpis.promotersPercent??78,passivesPercent:e.kpis.passivesPercent??16,promotersCount:e.kpis.promotersCount??815,passivesCount:e.kpis.passivesCount??168,detractorsCount:e.kpis.detractorsCount??63,ces:e.kpis.ces??Number((6-r/100*3).toFixed(1))}:{detractorsPercent:6,promotersPercent:78,passivesPercent:16,promotersCount:815,passivesCount:168,detractorsCount:63,ces:Number((6-r/100*3).toFixed(1))},De=(e,t)=>{if(t)return{sentimentPositive:0,sentimentNeutral:0,sentimentNegative:0,sentimentScore:0,totalSentimentConversations:0};const r=e?.sentimentData||[{name:"Positive",value:620},{name:"Neutral",value:230},{name:"Negative",value:150}],o=r.find(l=>
1l.name==="Positive")?.value??620,a=r.find(l=>l.name==="Neutral")?.value??230,i=r.find(l=>l.name==="Negative")?.value??150,c=e?.kpis?.sentimentScore!==void 0&&e?.kpis?.sentimentScore!==null?Math.round(e.kpis.sentimentScore):73;return{sentimentPositive:o,sentimentNeutral:a,sentimentNegative:i,sentimentScore:c,totalSentimentConversations:o+a+i}},Se=(e,t,r)=>{if(t)return{repeatContactRate:0,repeatContacts:0};const o=e?.kpis?.repeatContactRate!==void 0&&e?.kpis?.repeatContactRate!==null?e.kpis.repeatContactRate:13.4,a=Math.round(Number(o)),i=Math.round(r*1.6),c=e?.kpis?.repeatContactsCount!==void 0&&e?.kpis?.repeatContactsCount!==null?e.kpis.repeatContactsCount:Math.round(i*(a/100));return{repeatContactRate:a,repeatContacts:c}},Ne=(e,t)=>{let r=1046,o=89,a=72,i=88;t?(r=0,o=0,a=0,i=0):e?.kpis&&(r=e.kpis.total??1046,o=e.kpis.csat??89,a=e.kpis.nps??72,i=e.kpis.resolutionSatisfaction??88);const c=Math.round(o),l=Math.round(a),n=Math.round(i),{detractorsPercent:p,promotersPercent:d,passivesPercent:u,promotersCount:m,passivesCount:y,detractorsCount:g,ces:C}=we(e,t,c),v=Math.round(r*.94),f=t?[]:[{name:"Very Easy (1-2)",value:Math.round(v*.45)},{name:"Easy (3)",value:Math.round(v*.3)},{name:"Neutral (4)",value:Math.round(v*.15)},{name:"Difficult (5)",value:Math.round(v*.07)},{name:"Very Difficult (6-7)",value:Math.round(v*.03)}],{sentimentPositive:w,sentimentNeutral:j,sentimentNegative:x,sentimentScore:b,totalSentimentConversations:L}=De(e,t),{repeatContactRate:D,repeatContacts:E}=Se(e,t,r),$=t?0:(l+100)/2,A=(5-C)/4*100,K=100-D,O=Math.round(.3*c+.25*$+.15*A+.15*n+.1*b+.05*K);return{totalInts:r,csat:c,nps:l,detractorsPercent:p,promotersPercent:d,passivesPercent:u,promotersCount:m,passivesCount:y,detractorsCount:g,ces:C,totalCesResponses:v,cesDistributionData:f,sentimentPositive:w,sentimentNeutral:j,sentimentNegative:x,totalSentimentConversations:L,sentimentScore:b,repeatContactRate:D,repeatContacts:E,resolutionSatisfaction:n,cxHealthScore:O}},Pe=(e,t,r,o,a)=>{const i=o?[]:a?.csatTrendData||e.map((n,p)=>({date:n.date,thisMonth:Math.round(t-6+p*1.5),lastMonth:Math.round(t-10+p*1.5*.8)})),c=o?[]:a?.resSatTrendData||e.map((n,p)=>({date:n.date,thisMonth:Math.round(r-5+p*1.2),lastMonth:Math.round(r-9+p*1.2*.7)})),l=o?[]:a?.sentimentOverTimeData||e.map((n,p)=>{const d=Math.max(0,Math.min(100,50+p*1.5)),u=Math.max(0,Math.min(100-d,20-p*1.5*.5)),m=100-d-u;return{date:n.date,Positive:d,Neutral:m,Negative:u}});return{csatTrendData:i,resSatTrendData:c,sentimentOverTimeData:l}},Me=(e,t,r)=>{const o=t?[]:r?.negativeTopicsData||be,a=o.reduce((n,p)=>n+p.value,0),i=t?[]:r?.painPointsData||o.map(n=>({name:n.name,mentions:Math.round(e*.15*(n.value/a)),impact:`${a>0?Math.round(n.value/a*100):n.value}%`,trend:B(n.value,-1.5,5),strokeColor:"#ef4444"})),c=t?[]:r?.frustrationDriversData||Re.map(n=>({name:n.name,mentions:Math.round(e*.2*(n.mentions/1562)),impact:`${n.impact}`,impactClass:"text-red-500",trend:B(Math.abs(n.impact),.2,5),strokeColor:"#f97316"})),l=t?[]:r?.satisfactionDriversData||ye.map(n=>({name:n.name,mentions:Math.round(e*.25*(n.mentions/2146)),impact:`+${n.impact}`,impactClass:"text-green-600",trend:B(n.impact,-.2,5),strokeColor:"#22c55e"}));return{topPainPoints:i,topFrustrations:c,topSatisfaction:l}},Ie=(e,t,r,o,a,i,c)=>{if(t)return[];if(e?.aiInsights)return e.aiInsights.map(n=>({type:n.type,icon:je(n.type),color:ke(n.type),text:n.text}));const l=[];if(r>85?l.push({type:"improvement",icon:P,color:"text-green-500",textKey:"csatHigh",params:{csat:r},text:`Customer satisfaction is highly positive at ${r}%, driven by helpful agent behavior and quick resolutions.`}):l.push({type:"warning",icon:N,color:"text-amber-500",textKey:"csatLow",params:{csat:r},text:`Customer satisfaction sits at ${r}%. Effort reduction and better resolution rates are recommended.`}),o>a*.15){const n=Math.round(o/a*100);l.push({type:"risk",icon:N,color:"text-red-500",textKey:"sentLow",params:{pct:n},text:`Negative sentiment sits near risk levels at ${n}%. Monitor billing complaint volumes closely.`})}return i>10&&l.push({type:"warning",icon:T,color:"text-orange-500",textKey:"repeatLow",params:{repeatContactRate:i},text:`Repeat contact rate is elevated at ${i}%. Review ticketing handoffs to prevent callbacks.`}),c>3?l.push({type:"info",icon:Y,color:"text-blue-500",textKey:"cesLow",params:{ces:c},text:`CES is ${c} (Needs Improvement). Expand self-service tools and chatbot coverage to ease customer effort.`}):l.push({type:"success",icon:G,color:"text-green-500",textKey:"cesHigh",params:{ces:c},text:`CES is ${c} (Good/Excellent), indicating streamlined customer journeys with low friction.`}),l},Te=e=>h.useMemo(()=>{const t=e&&(e.kpis?.total===0||!e.kpis),r=Ne(e,t),{totalInts:o,csat:a,nps:i,detractorsPercent:c,promotersPercent:l,passivesPercent:n,promotersCount:p,passivesCount:d,detractorsCount:u,ces:m,cesDistributionData:y,sentimentPositive:g,sentimentNeutral:C,sentimentNegative:v,totalSentimentConversations:f,sentimentScore:w,repeatContactRate:j,repeatContacts:x,resolutionSatisfaction:b,cxHealthScore:L}=r;let D=[];t||(D=e?.trendData&&e.trendData.length>=3?e.trendData:ve);const{csatTrendData:E,resSatTrendData:$,sentimentOverTimeData:A}=Pe(D,a,b,t,e),K=t?[]:fe,{topPainPoints:O,topFrustrations:_,topSatisfaction:z}=Me(o,t,e),J=Ie(e,t,a,v,f,j,m);return{apiData:e,csat:a,nps:i,ces:m,sentimentScore:w,repeatContactRate:j,resolutionSatisfaction:b,cxHealthScore:L,promotersPercent:l,passivesPercent:n,detractorsPercent:c,promotersCount:p,passivesCount:d,detractorsCount:u,cesDistributionData:y,sentimentPositive:g,sentimentNeutral:C,sentimentNegative:v,totalSentimentConversations:f,repeatContacts:x,csatTrendData:E,resSatTrendData:$,sentimentOverTimeData:A,repeatReasonsData:K,topPainPoints:O,topFrustrations:_,topSatisfaction:z,insights:J}},[e]),Le=()=>{const e=me(),{deptOptions:t}=ge(),[r,o]=h.useState(!0),[a,i]=h.useState(null),c=h.useCallback(async()=>{o(!0);try{const p={dateRange:e.dateRange,department:e.department,dataType:e.dataType};e.dateRange==="custom"&&(p.startDate=e.customStartDate,p.endDate=e.customEndDate);const d=await he(p);d?.data&&i(d.data)}catch(p){console.error("Failed to fetch CX summary data",p)}finally{setTimeout(()=>
1o(!1),500)}},[e.dateRange,e.department,e.dataType,e.customStartDate,e.customEndDate]);h.useEffect(()=>{if(e.dateRange){if(e.dateRange==="custom"&&(!e.customStartDate||!e.customEndDate))return;c()}},[e.dateRange,e.department,e.dataType,e.customStartDate,e.customEndDate,c]);const l=Te(a);return{...e,deptOptions:t,loading:r,handleRefresh:c,getPrevMonthLabel:p=>{if(!p)return"vs Prev";const[d]=p.split("-"),u=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],m=u.indexOf(d.toLowerCase());if(m!==-1){const y=m===0?11:m-1,g=u[y];return"vs "+g.charAt(0).toUpperCase()+g.slice(1)}return"vs Prev"},...l}},Ee=[{value:"today",label:"Today"},{value:"yesterday",label:"Yesterday"},{value:"thisWeek",label:"This Week"},{value:"lastWeek",label:"Last Week"},{value:"thisMonth",label:"This Month"},{value:"lastMonth",label:"Last Month"},{value:"last30days",label:"Last 30 Days"},{value:"last60days",label:"Last 60 Days"},{value:"last90days",label:"Last 90 Days"},{value:"thisQuarter",label:"This Quarter"},{value:"lastQuarter",label:"Last Quarter"},{value:"last3months",label:"Last 3 Months"},{value:"last6months",label:"Last 6 Months"},{value:"last12months",label:"Last 12 Months"},{value:"thisYear",label:"This Year"},{value:"lastYear",label:"Last Year"}],$e=[{value:"all",label:"All Data",icon:ae},{value:"ai",label:"AI Data",icon:Q},{value:"human",label:"Human Data",icon:T}],Ae=({data:e,getPrevMonthLabel:t,dateRange:r})=>{const{t:o}=R();return s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 xl:grid-cols-6 gap-1.5",children:[s.jsx(k,{title:o("report.cxReport.kpis.csat","CSAT SCORE"),value:e.csat,valueSuffix:"%",icon:P,iconBgColor:"bg-green-50",iconColor:"text-green-600",changeValue:e.apiData?.kpis?e.apiData.kpis.csatChange:"6.3%",changeLabel:t(r),isPositive:e.apiData?.kpis?e.apiData.kpis.csatIsPos:!0}),s.jsx(k,{title:o("report.cxReport.kpis.nps","NPS SCORE"),value:e.nps,icon:ee,iconBgColor:"bg-red-50",iconColor:"text-red-500",changeValue:e.apiData?.kpis?`${e.apiData.kpis.npsChange} pts`:"4.8 pts",changeLabel:t(r),isPositive:e.apiData?.kpis?e.apiData.kpis.npsIsPos:!0}),s.jsx(k,{title:o("report.cxReport.kpis.ces","CES SCORE"),value:e.ces,valueSuffix:" / 5",icon:Q,iconBgColor:"bg-red-50",iconColor:"text-red-500",changeValue:e.apiData?.kpis?e.apiData.kpis.cesChange:"0.2",changeLabel:t(r),isPositive:e.apiData?.kpis?e.apiData.kpis.cesIsPos:!1}),s.jsx(k,{title:o("report.cxReport.kpis.sentiment","SENTIMENT SCORE"),value:e.sentimentScore,valueSuffix:"%",icon:ne,iconBgColor:"bg-rose-50",iconColor:"text-rose-500",changeValue:e.apiData?.kpis?e.apiData.kpis.sentimentChange:"5.7%",changeLabel:t(r),isPositive:e.apiData?.kpis?e.apiData.kpis.sentimentIsPos:!0}),s.jsx(k,{title:o("report.cxReport.kpis.repeatRate","REPEAT RATE"),value:e.repeatContactRate,valueSuffix:"%",icon:T,iconBgColor:"bg-orange-50",iconColor:"text-orange-600",changeValue:e.apiData?.kpis?e.apiData.kpis.repeatChange:"1.6%",changeLabel:t(r),isPositive:e.apiData?.kpis?e.apiData.kpis.repeatIsPos:!0}),s.jsx(k,{title:o("report.cxReport.kpis.resolutionCsat","RESOLUTION CSAT"),value:e.resolutionSatisfaction,valueSuffix:"%",icon:G,iconBgColor:"bg-emerald-50",iconColor:"text-emerald-600",changeValue:e.apiData?.kpis?e.apiData.kpis.resolutionChange:"5.2%",changeLabel:t(r),isPositive:e.apiData?.kpis?e.apiData.kpis.resolutionIsPos:!0})]})},Ke=({data:e})=>{const{t}=R();return s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4 mb-4",children:[s.jsx("div",{className:"lg:col-span-1",children:s.jsx(V,{title:t("report.cxReport.csatTrend.title","Customer Satisfaction Trend"),data:e.csatTrendData,xAxisKey:"date",minHeight:"auto",config:[{type:"line",dataKey:"thisMonth",name:t("report.cxReport.csatTrend.thisMonth","This Month"),stroke:W.colors.primary},{type:"line",dataKey:"lastMonth",name:t("report.cxReport.csatTrend.lastMonth","Last Month"),stroke:W.colors.slate,dasharray:"5 5",dot:!1,activeDot:!1}]})}),s.jsx("div",{className:"lg:col-span-1",children:s.jsx(U,{title:t("report.cxReport.npsBreakdown.title","Net Promoter Score Breakdown"),className:"h-full",children:s.jsxs("div",{className:"h-full flex flex-col justify-between",children:[s.jsxs("div",{className:"flex-1 w-full flex flex-col gap-1.5",children:[s.jsxs("div",{className:"bg-green-50 rounded-lg p-2.5 flex items-center justify-between border border-green-100",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx(P,{className:"w-6 h-6 text-green-500"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-xs font-bold text-slate-800",children:t("report.cxReport.npsBreakdown.promoters","Promoters")}),s.jsxs("div",{className:"text-[10px] text-slate-500",children:[e.promotersCount," ",t("report.cxReport.npsBreakdown.responses","responses")]})]})]}),s.jsxs("div",{className:"text-lg font-black text-green-700",children:[e.promotersPercent,"%"]})]}),s.jsxs("div",{className:"flex gap-1.5 flex-1",children:[s.jsxs("div",{className:"bg-yellow-50 rounded-lg p-2 flex-1 flex flex-col items-center justify-center border border-yellow-100",children:[s.jsx(ie,{className:"w-5 h-5 text-yellow-500 mb-1"}),s.jsx("div",{className:"text-[11px] font-bold text-slate-800",children:t("report.cxReport.npsBreakdown.passives","Passives")}),s.jsxs("div",{className:"text-base font-black text-yellow-700 leading-tight",children:[e.passivesPercent,"%"]}),s.jsx("div",{className:"text-[9px] text-slate-500",children:e.passivesCount})]}),s.jsxs("div",{className:"bg-red-50 rounded-lg p-2 flex-1 flex flex-col items-center justify-center border border-red-100",children:[s.jsx(X,{className:"w-5 h-5 text-red-500 mb-1"}),s.jsx("div",{className:"text-[11px] font-bold text-slate-800",children:t("report.cxReport.npsBreakdown.detractors","Detractors")}),s.jsxs("div",{className:"text-base font-black text-red-700 leading-tight",children:[e.detractorsPercent,"%"]}),s.jsx("div",{className:"text-[9px] text-slate-500",children:e.detractorsCount})]})]})]}),s.jsxs("div",{className:"mt-4 pt-3 border-t border-slate-100 flex items-center justify-between text-xs font-bold shrink-0",children:[s.jsx("span",{className:"text-slate-600",children:t("report.cxReport.npsBreakdown.formula","NPS = Promoters % - Detractors %")}
1),s.jsxs("span",{className:"text-slate-800",children:[e.promotersPercent,"% - ",e.detractorsPercent,"% = ",s.jsx("span",{className:"text-[#EF4444] text-sm",children:e.nps})]})]})]})})}),s.jsx("div",{className:"lg:col-span-1",children:s.jsx(oe,{title:t("report.cxReport.cesDistribution.title","Customer Effort Score (CES) Distribution"),data:e.cesDistributionData,dataKey:"value",nameKey:"name",minHeight:"auto",colors:Ce,centerLabel:t("report.cxReport.cesDistribution.avgCes","Average CES"),centerValue:`${e.ces} / 5`,innerRadius:42,outerRadius:56})})]})},Oe=({data:e})=>{const{t}=R();return s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4 mb-4",children:[s.jsx("div",{className:"lg:col-span-1",children:s.jsx(V,{title:t("report.cxReport.sentimentOverTime.title","Sentiment Over Time"),data:e.sentimentOverTimeData,xAxisKey:"date",minHeight:"auto",config:[{type:"area",dataKey:"Positive",name:t("report.cxReport.dataLabels.sentPositive","Positive"),stroke:"#22c55e",fill:"#22c55e"},{type:"area",dataKey:"Neutral",name:t("report.cxReport.dataLabels.sentNeutral","Neutral"),stroke:"#94a3b8",fill:"#94a3b8"},{type:"area",dataKey:"Negative",name:t("report.cxReport.dataLabels.sentNegative","Negative"),stroke:"#ef4444",fill:"#ef4444"}]})}),s.jsx("div",{className:"lg:col-span-1",children:s.jsx(V,{title:t("report.cxReport.resSatTrend.title","Resolution Satisfaction"),data:e.resSatTrendData,xAxisKey:"date",minHeight:"auto",config:[{type:"line",dataKey:"thisMonth",name:t("report.cxReport.resSatTrend.thisMonth","This Month"),stroke:"#F87171"},{type:"line",dataKey:"lastMonth",name:t("report.cxReport.resSatTrend.lastMonth","Last Month"),stroke:W.colors.slate,dasharray:"5 5",dot:!1,activeDot:!1}]})}),s.jsx("div",{className:"lg:col-span-1",children:s.jsx(U,{title:t("report.cxReport.repeatContact.title","Repeat Contact Rate by Reason"),className:"h-full",children:s.jsxs("div",{className:"flex flex-col h-full justify-between",children:[s.jsx("div",{className:"flex-1 flex flex-col justify-center space-y-4 mb-3 mt-1",children:e.repeatReasonsData?.map((r,o)=>s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex justify-between text-xs font-bold text-slate-700",children:[s.jsx("span",{className:"truncate max-w-[200px]",children:r.name}),s.jsxs("span",{children:[r.value,"%"]})]}),s.jsx("div",{className:"w-full h-1.5 bg-slate-100 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#EF4444] rounded-full",style:{width:`${r.value}%`}})})]},r.name))}),s.jsxs("div",{className:"pt-3 border-t border-slate-100 flex justify-between items-center text-xs font-bold shrink-0",children:[s.jsx("span",{className:"text-slate-600",children:t("report.cxReport.repeatContact.total","Total Repeat Contacts")}),s.jsxs("span",{className:"text-[#EF4444]",children:[e.repeatContacts?.toLocaleString()," (",e.repeatContactRate,"%)"]})]})]})})})]})},He=({data:e,strokeColor:t})=>s.jsx("div",{className:"w-12 h-5 mx-auto",children:s.jsx(ce,{width:"100%",height:"100%",children:s.jsx(le,{data:e,margin:{top:1,right:1,left:1,bottom:1},children:s.jsx(pe,{type:"monotone",dataKey:"value",stroke:t,strokeWidth:1.2,dot:!1})})})}),Fe=({data:e})=>{const{t}=R(),r=(o,a)=>[{header:o,key:"name",align:"left",render:i=>s.jsx("span",{className:"block truncate max-w-[130px] xl:max-w-[150px]",title:i,children:i})},{header:t("report.cxReport.painPoints.mentions","Mentions"),key:"mentions",align:"right",render:i=>i.toLocaleString()},{header:a,key:"impact",align:"right",render:(i,c)=>s.jsx("span",{className:c.impactClass||"text-slate-500",children:i})},{header:t("report.cxReport.painPoints.trend","Trend"),key:"trend",align:"center",render:(i,c)=>s.jsx(He,{data:i,strokeColor:c.strokeColor||"#6366f1"})}];return s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4 mb-4",children:[s.jsx("div",{className:"lg:col-span-1",children:s.jsx(H,{title:t("report.cxReport.painPoints.title","Top Pain Points"),icon:X,iconColor:"text-red-500",data:e.topPainPoints,columns:r(t("report.cxReport.painPoints.painPoint","Pain Point"),t("report.cxReport.painPoints.percent","% of Total")),minHeight:"310px"})}),s.jsx("div",{className:"lg:col-span-1",children:s.jsx(H,{title:t("report.cxReport.frustrationDrivers.title","Top Customer Frustration Drivers"),icon:N,iconColor:"text-orange-500",data:e.topFrustrations,columns:r(t("report.cxReport.frustrationDrivers.driver","Driver"),t("report.cxReport.frustrationDrivers.impactScore","Impact Score")),minHeight:"310px"})}),s.jsx("div",{className:"lg:col-span-1",children:s.jsx(H,{title:t("report.cxReport.satisfactionDrivers.title","Top Satisfaction Drivers"),icon:P,iconColor:"text-green-500",data:e.topSatisfaction,columns:r(t("report.cxReport.frustrationDrivers.driver","Driver"),t("report.cxReport.frustrationDrivers.impactScore","Impact Score")),minHeight:"310px"})})]})},Be=(e,t)=>{if(e.textKey)switch(e.textKey){case"csatLow":return`${t("report.cxReport.aiInsights.csatLow1","Customer satisfaction sits at")} ${e.params.csat}%. ${t("report.cxReport.aiInsights.csatLow2","Effort reduction and better resolution rates are recommended.")}`;case"csatHigh":return`${t("report.cxReport.aiInsights.csatHigh1","Customer satisfaction is highly positive at")} ${e.params.csat}%. ${t("report.cxReport.aiInsights.csatHigh2","Focus on maintaining this level of service.")}`;case"sentLow":return`${t("report.cxReport.aiInsights.sentLow1","Negative sentiment sits near risk levels at")} ${e.params.pct}%. ${t("report.cxReport.aiInsights.sentLow2","Monitor billing complaint volumes closely.")}`;case"repeatLow":return`${t("report.cxReport.aiInsights.repeatLow1","Repeat contact rate is elevated at")} ${e.params.repeatContactRate}%. ${t("report.cxReport.aiInsights.repeatLow2","Review ticketing handoffs to prevent callbacks.")}`;case"cesLow":return`${t("report.cxReport.aiInsights.cesLow1","CES is")} ${e.params.ces} (${t("report.cxReport.aiInsights.needsImprovement","Needs Improvement")}). ${t("report.cxReport.aiInsights.cesLow2","Expand self-service tools and chatbot coverage to ease customer effort.")}`;case"cesHigh":return`${t("report.cxReport.aiInsights.cesHigh1","CES is")} ${e.params.ces} (${t("report.cxReport.aiInsights.good","Good")}). ${t("report.cxReport.aiInsights.cesHigh2","Customers are finding it relatively easy to get their issues resolved.")}`;default:return e.text}return e.text},Ve=({insights:e=[]})=>{const{t}=R();return s.jsx(U,{title:t("report.cxReport.aiInsights.title","AI Insights"),className:"h-full min-h-[160px]",children:s.jsxs("div",{className:"flex flex-col justify-between h-full",children:[s.jsx("ul",{className:"space-y-2.5",children:e.length>0?e.map((r,o)=>s.jsxs("li",{className:"flex items-start gap-2 text-[11px] text-slate-600 leading-relaxed font-medium",children:[s.jsx(r.icon,{className:`w-3.5 h-3.5 shrink-0 mt-0.5 ${r.color}`}),s.jsx("span",{children:Be(r,t)})]},r.text)):s.jsx("li",{className:"text-slate-400 text-[11px] italic font-medium",children:t("report.cxReport.aiInsights.noInsights","No AI insights available for this period.")})}),s.jsx("p",{className:"text-[9px] text-slate-400 mt-3 font-medium italic",children:t("report.cxReport.aiInsights.disclaimer","AI insights are computed dynamically based on current period performance trends.")})]})})},I=({title:e,value:t,subtitle:r,icon:o,iconBg:a,iconColor:i,valueClassName:c})=>s.jsxs("div",{className:"bg-white p-3 rounded-xl border border-slate-200 shadow-sm flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-[9px] font-bold text-slate-400 block tracking-wider up
1percase font-sans",children:e}),s.jsx("span",{className:`text-base font-black mt-0.5 block ${c||"text-slate-800"}`,children:t}),s.jsx("span",{className:"text-[8px] text-slate-400 font-semibold",children:r})]}),s.jsx("div",{className:`p-1.5 rounded-full ${a} ${i} shadow-sm shrink-0`,children:s.jsx(o,{size:16,className:i})})]}),We=({colorClass:e="text-red-500",size:t=28})=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("path",{d:"M16 16s-1.5-2-4-2-4 2-4 2"}),s.jsx("line",{x1:"9",x2:"9.01",y1:"9",y2:"9"}),s.jsx("line",{x1:"15",x2:"15.01",y1:"9",y2:"9"})]}),Ge=(e,t)=>{const r=e?.kpis;return r?{sentiment:{value:r.sentimentChange,subtitle:r.sentimentIsPos?t("report.cxReport.widgets.increasePos","Increase in positive sentiment"):t("report.cxReport.widgets.decreasePos","Decrease in positive sentiment"),icon:r.sentimentIsPos?S:M,bg:r.sentimentIsPos?"bg-green-50":"bg-red-50",color:r.sentimentIsPos?"text-green-500":"text-red-500"},repeat:{value:r.repeatChange,subtitle:r.repeatIsPos?t("report.cxReport.widgets.decreaseRepeat","Decrease in repeat contact rate"):t("report.cxReport.widgets.increaseRepeat","Increase in repeat contact rate"),icon:r.repeatIsPos?M:S,bg:r.repeatIsPos?"bg-green-50":"bg-red-50",color:r.repeatIsPos?"text-green-500":"text-red-500"},resolution:{value:r.resolutionChange,subtitle:r.resolutionIsPos?t("report.cxReport.widgets.resSatImproving","Resolution satisfaction is improving"):t("report.cxReport.widgets.resSatDeclining","Resolution satisfaction is declining"),icon:r.resolutionIsPos?S:M,bg:r.resolutionIsPos?"bg-green-50":"bg-red-50",color:r.resolutionIsPos?"text-green-500":"text-red-500"}}:{sentiment:{value:"+12.5%",subtitle:t("report.cxReport.widgets.increasePos","Increase in positive sentiment"),icon:S,bg:"bg-green-50",color:"text-green-500"},repeat:{value:"-1.6%",subtitle:t("report.cxReport.widgets.decreaseRepeat","Decrease in repeat contact rate"),icon:M,bg:"bg-orange-50",color:"text-orange-500"},resolution:{value:"+5.2%",subtitle:t("report.cxReport.widgets.resSatImproving","Resolution satisfaction is improving"),icon:S,bg:"bg-emerald-50",color:"text-emerald-500"}}},Ue=({data:e})=>{const{t}=R(),r=Ge(e.apiData,t);return s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3 items-stretch",children:[s.jsx(Ve,{insights:e.insights}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 h-full",children:[s.jsx(I,{title:t("report.cxReport.widgets.sentimentGrowth","Sentiment Growth"),value:r.sentiment.value,subtitle:r.sentiment.subtitle,icon:r.sentiment.icon,iconBg:r.sentiment.bg,iconColor:r.sentiment.color}),s.jsx(I,{title:t("report.cxReport.widgets.repeatContacts","Repeat contacts"),value:r.repeat.value,subtitle:r.repeat.subtitle,icon:r.repeat.icon,iconBg:r.repeat.bg,iconColor:r.repeat.color}),s.jsx(I,{title:t("report.cxReport.widgets.needsAttention","Needs Attention"),value:e.repeatContacts.toLocaleString(),subtitle:t("report.cxReport.widgets.repeatNeedsAttention","Repeat contacts needing attention"),icon:We,iconBg:"bg-red-50",iconColor:"text-red-500"}),s.jsx(I,{title:t("report.cxReport.widgets.resSat","Resolution Satisfaction"),value:r.resolution.value,subtitle:r.resolution.subtitle,icon:r.resolution.icon,iconBg:r.resolution.bg,iconColor:r.resolution.color})]})]})},at=({setBreadcrumbs:e})=>{const{t,i18n:r}=R(),o=r.dir()==="rtl";h.useEffect(()=>{e&&e([{label:t("sidebar.reportsAnalytics","Reports & Analytics")},{label:t("sidebar.customerExperience","Customer Experience"),path:"/admin/cx-report"}])},[e,t]);const{dateRange:a,setDateRange:i,customStartDate:c,customEndDate:l,handleCustomDateSelect:n,dataType:p,setDataType:d,department:u,setDepartment:m,deptOptions:y,loading:g,handleRefresh:C,getPrevMonthLabel:v,...f}=Le(),w=Ee.map(x=>({...x,label:x.value==="custom"?t("report.execSummary.filters.customRange",x.label):t(`report.execSummary.filters.${x.value}`,x.label)})),j=$e.map(x=>{let b="humanData";return x.value==="all"?b="allData":x.value==="ai"&&(b="aiData"),{...x,label:t(`report.execSummary.filters.${b}`,x.label)}});return s.jsxs("div",{dir:o?"rtl":"ltr",className:"flex-1 flex flex-col h-full bg-slate-50 overflow-y-auto animate-fadeIn custom-scrollbar outline-none focus:outline-none",children:[s.jsxs(re,{title:t("report.cxReport.title","Customer Experience (CX) Report"),subtitle:t("report.cxReport.subtitle","Understand customer satisfaction, effort, sentiment and experience drivers"),icon:te,children:[s.jsx(F,{value:a,onChange:i,options:w,icon:ue,t
1itle:t("report.cxReport.timeRange","Time Range"),onCustomDateSelect:n,startDate:c,endDate:l}),s.jsx(F,{value:p,onChange:d,options:j,title:t("report.cxReport.dataType","Data Type"),sectionTitle:t("report.cxReport.dataType","Data Type")}),s.jsx(F,{value:u,onChange:m,options:y,icon:T,title:t("report.cxReport.department","Department")}),s.jsx("button",{onClick:C,disabled:g,className:`hidden sm:block p-1.5 rounded-lg border border-slate-200 text-slate-500 hover:bg-slate-50 hover:text-slate-700 transition-colors bg-white shadow-sm outline-none cursor-pointer ${g?"opacity-50 cursor-not-allowed":""}`,title:t("report.cxReport.refreshData","Refresh Data"),children:s.jsx(se,{className:`w-3.5 h-3.5 ${g?"animate-spin":""}`})}),s.jsx("button",{className:"hidden sm:block p-1.5 rounded-lg bg-[#EF4444] hover:bg-red-600 text-white shadow-sm shadow-red-200 transition-all active:scale-95 outline-none cursor-pointer flex items-center justify-center",title:t("report.cxReport.export","Export Data"),children:s.jsx(de,{className:"w-3.5 h-3.5"})})]}),g?s.jsx("div",{className:"flex-1 flex items-center justify-center h-full bg-slate-50",children:s.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-4 border-[#EF4444] border-t-transparent"})}):s.jsxs("div",{className:"p-2 lg:p-3 space-y-3",children:[s.jsx(Ae,{data:f,getPrevMonthLabel:v,dateRange:a}),s.jsx(Ke,{data:f}),s.jsx(Oe,{data:f}),s.jsx(Fe,{data:f}),s.jsx(Ue,{data:f})]})]})};export{at 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.