PageSourceSearch

https://tappin.ai/static/js/2910.67d505c9.chunk.js

js tappin.ai collected 2026-10-05 12:44:16 UTC 10,653 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[2910],{2910(e,a,s){s.r(a),s.d(a,{default:()=>w});var t=s(7224),l=s(9950),r=s(2828),n=s(5833),d=s(5924),i=s(8406),c=s(7453),o=s(7684),x=s(6987),m=s(9975),h=s(9401),b=s(4162),p=s(4414);const u={healthy:{label:"Healthy",icon:n.A,className:"bg-emerald-100 text-emerald-800 dark:bg-emerald-950/50 dark:text-emerald-300"},warning:{label:"Warning",icon:d.A,className:"bg-amber-100 text-amber-800 dark:bg-amber-950/50 dark:text-amber-300"},critical:{label:"Critical",icon:r.A,className:"bg-red-100 text-red-800 dark:bg-red-950/50 dark:text-red-300"}},g=[{key:"agent_name",label:"Agent",sortable:!0},{key:"calls_30d",label:"Calls (30d)",sortable:!0,numeric:!0},{key:"logins_7d",label:"Logins (7d)",sortable:!0,numeric:!0},{key:"tap_spend_30d",label:"TAP Spend (30d)",sortable:!0,numeric:!0},{key:"pipeline_compliance",label:"Compliance",sortable:!0,numeric:!0},{key:"risk_level",label:"Risk",sortable:!0}];function k(e){return e>=80?"text-emerald-700 bg-emerald-50 dark:text-emerald-300 dark:bg-emerald-950/40":e>=50?"text-amber-700 bg-amber-50 dark:text-amber-300 dark:bg-amber-950/40":"text-red-700 bg-red-50 dark:text-red-300 dark:bg-red-950/40"}const v={critical:0,warning:1,healthy:2},f="rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden dark:border-white/[0.08] dark:bg-slate-900/40 dark:shadow-none";function w(e){let{brokerageId:a,teamLeadId:s,agentIds:r}=e;const[n,d]=(0,l.useState)([]),[w,j]=(0,l.useState)(!0),[N,y]=(0,l.useState)("agent_name"),[_,A]=(0,l.useState)("asc"),[C,S]=(0,l.useState)(new Set),[P,L]=(0,l.useState)(""),T=(0,l.useCallback)(async()=>{j(!0),L("");try{let e="/api/am/usage";a?e+="?brokerage_id="+a:s?e+="?team_lead_id="+s:r&&r.length>0&&(e+="?agent_ids="+r.join(","));const t=await h.default.get(e);d(t.snapshots||[])}catch(l){var e,t;const a=(null===l||void 0===l||null===(e=l.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||(null===l||void 0===l?void 0:l.message)||"Unknown error";L(a),b.A.error("Failed to load usage data: "+a)}j(!1)},[a,s,r]);(0,l.useEffect)(()=>{T()},[T]);const F=[...n].sort((e,a)=>{let s=e[N],t=a[N];var l,r;"risk_level"===N&&(s=null!==(l=v[s])&&void 0!==l?l:3,t=null!==(r=v[t])&&void 0!==r?r:3);if("number"===typeof s&&"number"===typeof t)return"asc"===_?s-t:t-s;const n=String(s||"").toLowerCase(),d=String(t||"").toLowerCase();return n<d?"asc"===_?-1:1:n>d?"asc"===_?1:-1:0}),M=e=>{const a=u[e]||u.healthy,s=a.icon;return(0,p.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full ".concat(a.className),children:[(0,p.jsx)(s,{className:"w-3 h-3"}),a.label]})},U=e=>{var a,s,t,l,r,n,d;const i=[{label:"Orders",value:null!==(a=e.orders)&&void 0!==a?a:"-"},{label:"Door Knocks",value:null!==(s=e.door_knocks)&&void 0!==s?s:"-"},{label:"Practice Sessions",value:null!==(t=e.practice_sessions)&&void 0!==t?t:"-"},{label:"Leads Contacted",value:null!==(l=e.leads_contacted)&&void 0!==l?l:"-"},{label:"Pipeline Stages Updated",value:null!==(r=e.pipeline_updates)&&void 0!==r?r:"-"},{label:"SMS Sent",value:null!==(n=e.sms_sent)&&void 0!==n?n:"-"},{label:"Appointments Set",value:null!==(d=e.appointments_set)&&void 0!==d?d:"-"},{label:"Avg Call Duration",value:e.avg_call_duration?"".concat(e.avg_call_duration,"s"):"-"}];return(0,p.jsx)("tr",{children:(0,p.jsx)("td",{colSpan:g.length+1,className:"px-0 py-0",children:(0,p.jsxs)("div",{className:"border-y border-slate-200 bg-slate-50 px-6 py-3 dark:border-white/[0.06] dark:bg-slate-950/50",children:[(0,p.jsx)("p",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-slate-600 dark:text-slate-400",children:"Full Metric Breakdown"}),(0,p.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:i.map(e=>(0,p.jsxs)("div",{className:"rounded-lg border border-slate-200 bg-white px-3 py-2 dark:border-white/[0.08] dark:bg-slate-900/60",children:[(0,p.jsx)("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:e.label}),(0,p.jsx)("p",{className:"text-sm font-semibold text-kw-dark dark:text-slate-100",children:e.value})]},e.label))})]})})},"".concat(e.agent_id,"-detail"))},I=a?"Calls, logins, TAP spend, pipeline compliance, and risk across agents in your brokerage.":s?"Calls, logins, TAP spend, pipeline compliance, and risk for agents on your team.":"Calls, logins, TAP spend, pipeline compliance, and risk for monitored agents.",z=(0,p.jsxs)("div",{className:"mb-5 flex flex-wrap shrink-0 flex-col justify-between gap-4 sm:flex-row sm:items-start",children:[(0,p.jsxs)("div",{className:"min-w-0",children:[(0,p.jsxs)("h2",{className:"font-heading flex items-center gap-2 text-xl font-bold text-kw-dark dark:text-white",children:[(0,p.jsx)(i.A,{size:22,className:"shrink-0 text-kw-red","aria-hidden":!0}),"Team Usage"]}),(0,p.jsx)("p",{className:"mt-1 text-sm text-slate-500 dark:text-slate-400",children:I})]}),(0,p.jsxs)("button",{type:"button",onClick:()=>T(),disabled:w,className:"inline-flex shrink-0 items-center gap-2 self
1-start rounded-lg border border-slate-300 bg-white px-3 py-2 text-xs font-semibold text-slate-700 shadow-sm transition-colors hover:bg-slate-50 disabled:opacity-50 dark:border-white/[0.12] dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700/80",children:[(0,p.jsx)(x.A,{size:14,className:w?"animate-spin":"","aria-hidden":!0}),"Refresh"]})]});return w?(0,p.jsx)("div",{className:"flex min-h-0 w-full flex-1 flex-col","data-testid":"team-usage-panel",children:(0,p.jsx)(t.A,{})}):0===n.length?(0,p.jsxs)("div",{className:"flex min-h-0 w-full flex-1 flex-col","data-testid":"team-usage-panel",children:[z,(0,p.jsxs)("div",{className:"".concat(f," flex flex-col items-center justify-center px-6 py-16"),children:[(0,p.jsx)(m.A,{className:"mb-2 h-10 w-10 text-slate-300 dark:text-slate-600","aria-hidden":!0}),(0,p.jsx)("p",{className:"text-sm font-medium text-slate-600 dark:text-slate-300",children:P?"Could not load usage data":"No usage data available"}),(0,p.jsx)("p",{className:"mt-1 max-w-sm text-center text-xs text-slate-500 dark:text-slate-400",children:P||"When agents in scope have activity, their snapshots will appear here."})]})]}):(0,p.jsxs)("div",{className:"flex min-h-0 w-full flex-1 flex-col","data-testid":"team-usage-panel",children:[z,(0,p.jsxs)("div",{className:f,children:[(0,p.jsx)("div",{className:"overflow-x-auto",children:(0,p.jsxs)("table",{className:"w-full text-sm",children:[(0,p.jsx)("thead",{children:(0,p.jsxs)("tr",{className:"border-b border-slate-200 bg-slate-50 dark:border-white/[0.08] dark:bg-slate-800/80",children:[(0,p.jsx)("th",{className:"w-8 px-2 py-2.5","aria-hidden":!0}),g.map(e=>{return(0,p.jsx)("th",{className:"px-3 py-2.5 whitespace-nowrap text-left text-xs font-semibold uppercase tracking-wider text-slate-600 dark:text-slate-300\n                      ".concat(e.sortable?"cursor-pointer select-none transition-colors hover:bg-slate-100 dark:hover:bg-slate-700/50":""),onClick:e.sortable?()=>{return a=e.key,void(N===a?A(e=>"asc"===e?"desc":"asc"):(y(a),A("asc")));var a}:void 0,children:(0,p.jsxs)("div",{className:"flex items-center gap-1",children:[e.label,e.sortable&&(a=e.key,N!==a?(0,p.jsx)(c.A,{className:"h-3 w-3 text-slate-300 dark:text-slate-600"}):"asc"===_?(0,p.jsx)(o.A,{className:"w-3 h-3 text-kw-red"}):(0,p.jsx)(c.A,{className:"w-3 h-3 text-kw-red"}))]})},e.key);var a})]})}),(0,p.jsx)("tbody",{children:F.map(e=>{var a,s,t;const r=e.agent_id,n=C.has(r),d=null!==(a=e.pipeline_compliance)&&void 0!==a?a:0;return(0,p.jsxs)(l.Fragment,{children:[(0,p.jsxs)("tr",{className:"border-b border-slate-100 transition-colors hover:bg-slate-50/80 dark:border-white/[0.06] dark:hover:bg-slate-800/40\n                        ".concat(n?"bg-slate-50/50 dark:bg-slate-800/25":""),children:[(0,p.jsx)("td",{className:"px-2 py-2.5 text-center",children:(0,p.jsx)("button",{type:"button",onClick:()=>(e=>{S(a=>{const s=new Set(a);return s.has(e)?s.delete(e):s.add(e),s})})(r),className:"rounded p-0.5 transition-colors hover:bg-slate-200 dark:hover:bg-slate-600","aria-label":n?"Collapse row":"Expand row",children:n?(0,p.jsx)(o.A,{className:"h-4 w-4 text-slate-500 dark:text-slate-400"}):(0,p.jsx)(c.A,{className:"h-4 w-4 text-slate-400 dark:text-slate-500"})})}),(0,p.jsx)("td",{className:"px-3 py-2.5",children:(0,p.jsx)("span",{className:"font-medium text-kw-dark dark:text-slate-100",children:e.agent_name||"Unknown Agent"})}),(0,p.jsx)("td",{className:"px-3 py-2.5 tabular-nums text-slate-700 dark:text-slate-300",children:null!==(s=e.calls_30d)&&void 0!==s?s:0}),(0,p.jsx)("td",{className:"px-3 py-2.5 tabular-nums text-slate-700 dark:text-slate-300",children:null!==(t=e.logins_7d)&&void 0!==t?t:0}),(0,p.jsx)("td",{className:"px-3 py-2.5 tabular-nums text-slate-700 dark:text-slate-300",children:null!=e.tap_spend_30d?"$".concat(Number(e.tap_spend_30d).toFixed(2)):"$0.00"}),(0,p.jsx)("td",{className:"px-3 py-2.5",children:(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)("div",{className:"h-2 max-w-[80px] flex-1 overflow-hidden rounded-full bg-slate-200 dark:bg-slate-700",children:(0,p.jsx)("div",{className:"h-full rounded-full transition-all ".concat((i=d,i>=80?"bg-emerald-500":i>=50?"bg-amber-500":"bg-red-500")),style:{width:"".concat(Math.min(100,Math.max(0,d)),"%")}
1})}),(0,p.jsxs)("span",{className:"rounded px-1.5 py-0.5 text-xs font-medium ".concat(k(d)),children:[d,"%"]})]})}),(0,p.jsx)("td",{className:"px-3 py-2.5",children:M(e.risk_level)})]}),n&&U(e)]},r);var i})})]})}),(0,p.jsxs)("div",{className:"flex items-center justify-between border-t border-slate-200 bg-slate-50 px-4 py-2.5 dark:border-white/[0.08] dark:bg-slate-950/40",children:[(0,p.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-slate-600 dark:text-slate-400",children:[(0,p.jsx)(m.A,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),n.length," agent",1!==n.length?"s":""]}),(0,p.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-xs text-slate-600 dark:text-slate-400",children:[(0,p.jsxs)("span",{className:"flex items-center gap-1",children:[(0,p.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-emerald-500"}),n.filter(e=>"healthy"===e.risk_level).length," healthy"]}),(0,p.jsxs)("span",{className:"flex items-center gap-1",children:[(0,p.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-amber-500"}),n.filter(e=>"warning"===e.risk_level).length," warning"]}),(0,p.jsxs)("span",{className:"flex items-center gap-1",children:[(0,p.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-red-500"}),n.filter(e=>"critical"===e.risk_level).length," critical"]})]})]})]})]})}}}]);

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.