1/*! For license information please see 699.9e25c94c.chunk.js.LICENSE.txt */ 2"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[699],{2580(e,t,a){a.d(t,{A:()=>s});const s=(0,a(7784).A)("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]])},3699(e,t,a){a.r(t),a.d(t,{default:()=>y});var s=a(5043),r=a(9722),n=a(1140),d=a(5949),l=a(1180),c=a(2291),i=a(7734),o=a(2185),x=a(6026),u=a(379),h=a(96),m=a(7869),p=a(2580);const f=(0,a(7784).A)("trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);var b=a(579);const g="https://nextgen-staging.emergent.host",j={backgroundColor:"#0A0A0A",border:"1px solid #27272A",borderRadius:"4px",fontSize:"12px"},y=()=>{const[e,t]=(0,s.useState)(null),[a,y]=(0,s.useState)(!0),[v,N]=(0,s.useState)(0);(0,s.useEffect)(()=>{let e=!1;y(!0);const a=v?"".concat(g,"/api/admin/quotes/analytics-deep?since_days=").concat(v):"".concat(g,"/api/admin/quotes/analytics-deep");return r.A.get(a,{withCredentials:!0}).then(a=>{e||t(a.data)}).catch(()=>{e||t(null)}).finally(()=>{e||y(!1)}),()=>{e=!0}},[v]);const w=(0,s.useMemo)(()=>{var t;return null!==e&&void 0!==e&&null!==(t=e.funnel)&&void 0!==t&&t.length?Math.max(...e.funnel.map(e=>e.count||0),1):1},[e]);return(0,b.jsxs)(n.Zp,{className:"p-6 border-border","data-testid":"quote-analytics-deep-dive",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 mb-5",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm uppercase tracking-widest text-muted-foreground mb-1",children:"Quote Analytics \u2014 Deep Dive"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Funnel \xb7 Time-to-accept \xb7 Per-staff conversion"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,b.jsx)(p.A,{className:"w-3 h-3 text-muted-foreground"}),[{label:"Lifetime",value:0},{label:"90 days",value:90},{label:"30 days",value:30},{label:"7 days",value:7}].map(e=>{const t=v===e.value;return(0,b.jsx)("button",{type:"button","data-testid":"window-chip-".concat(e.value),onClick:()=>N(e.value),className:"px-2.5 py-1 rounded-full uppercase tracking-widest text-[10px] font-bold transition-colors "+(t?"bg-primary text-primary-foreground":"border border-border text-muted-foreground hover:text-foreground"),children:e.label},e.label)})]})]}),a&&(0,b.jsx)("div",{className:"py-12 text-center text-xs text-muted-foreground",children:"Loading\u2026"}),!a&&!e&&(0,b.jsx)("div",{className:"py-12 text-center text-xs text-muted-foreground",children:"No analytics available."}),!a&&e&&(0,b.jsxs)("div",{className:"space-y-8",children:[(0,b.jsxs)("div",{"data-testid":"qa-funnel",children:[(0,b.jsx)("p",{className:"text-xs uppercase tracking-widest text-muted-foreground mb-3",children:"Funnel"}),(0,b.jsx)("div",{className:"space-y-2",children:e.funnel.map(e=>{const t=w>0?e.count/w*100:0;return(0,b.jsxs)("div",{"data-testid":"qa-funnel-".concat(e.stage),className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"w-24 text-xs text-muted-foreground uppercase tracking-widest",children:e.label}),(0,b.jsxs)("div",{className:"flex-1 h-7 rounded-sm bg-muted/30 overflow-hidden relative",children:[(0,b.jsx)("div",{className:"h-full bg-primary/80 transition-all",style:{width:"".concat(t,"%")}}),(0,b.jsx)("span",{className:"absolute inset-0 flex items-center px-3 text-xs font-mono font-bold",children:e.count})]})]},e.stage)})})]}),(0,b.jsxs)("div",{"data-testid":"qa-tta",children:[(0,b.jsx)("p",{className:"text-xs uppercase tracking-widest text-muted-foreground mb-3",children:"Time to accept"}),(e.tta_histogram||[]).every(e=>0===e.count)?(0,b.jsx)("p",{className:"text-xs text-muted-foreground italic py-6 text-center",children:"No accepted quotes in this window yet."}):(0,b.jsx)(l.u,{width:"100%",height:180,children:(0,b.jsxs)(c.E,{data:e.tta_histogram,margin:{top:5,right:10,left:0,bottom:0},children:[(0,b.jsx)(i.d,{strokeDasharray:"3 3",stroke:"#27272A"}),(0,b.jsx)(o.W,{dataKey:"bucket",stroke:"#A1A1AA",fontSize:11}),(0,b.jsx)(x.h,{stroke:"#A1A1AA",fontSize:11,allowDecimals:!1}),(0,b.jsx)(u.m,{contentStyle:j}),(0,b.jsx)(h.yP,{dataKey:"count",radius:[4,4,0,0],children:e.tta_histogram.map((e,t)=>(0,b.jsx)(m.f,{fill:t<=2?"#00FF00":t<=4?"#3B82F6":"#F59E0B"},t))})]})})]}),(0,b.jsxs)("div",{"data-testid":"qa-per-staff",children:[(0,b.jsx)("p",{className:"text-xs uppercase tracking-widest text-muted-foreground mb-3",children:"Per-staff conversion"}),0===(e.per_staff||[]).length?(0,b.jsx)("p",{className:"text-xs text-muted-foreground italic py-6 text-center",children:"No quotes sent in this window yet."}):(0,b.jsx)("div",{className:"overflow-x-auto rounded border border-border",children:(0,b.jsxs)("table",{className:"w-full text-sm",children:[(0,b.jsx)("thead",{className:"bg-muted/30",children:(0,b.jsxs)("tr",{className:"text-[10px] uppercase tracking-widest text-muted-foreground",children:[(0,b.jsx)("th",{className:"text-left p-3 font-bold",children:"Staff"}),(0,b.jsx)("th",{className:"text-right p-3 font-bold",children:"Sent"}),(0,b.jsx)("th",{className:"text-right p-3 font-bold",children:"Accepted"}),(0,b.jsx)("th",{className:"text-right p-3 font-bold",children:"Rate"}),(0,b.jsx)("th",{className:"text-right p-3 font-bold",children:"Median TTA"})]})}),(0,b.jsx)("tbody",{children:e.per_staff.map((e,t)=>{const a=0===t&&e.sent>0;return(0,b.jsxs)("tr",{"data-testid":"qa-staff-row-".concat(e.actor),className:"border-t border-border/40",children:[(0,b.jsxs)("td",{className:"p-3 font-mono text-xs flex items-center gap-2",children:[a&&(0,b.jsx)(f,{className:"w-3.5 h-3.5 text-primary shrink-0"}),(0,b.jsx)("span",{className:"truncate max-w-[260px]",children:e.actor})]}),(0,b.jsx)("td",{className:"text-right p-3 tabular-nums",children:e.sent}),(0,b.jsx)("td",{className:"text-right p-3 tabular-nums",children:e.accepted}),(0,b.jsx)("td",{className:"text-right p-3 tabular-nums",children:(0,b.jsxs)(d.E,{variant:"outline",className:e.rate_pct>=60?"text-primary border-primary/40":e.rate_pct>=30?"text-blue-400 border-blue-400/40":"text-muted-foreground",children:[e.rate_pct.toFixed(1),"%"]})}),(0,b.jsx)("td",{className:"text-right p-3 tabular-nums text-xs",children:(s=e.median_tta_hours,!s||s<=0?"\u2014":s<1?"".concat(Math.round(60*s)," min"):s<48?"".concat(s.toFixed(1)," hr"):"".concat((s/24).toFixed(1)," days"))})]},e.actor);var s})})]})})]})]})]})}}}]); 3//# sourceMappingURL=699.9e25c94c.chunk.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.