PageSourceSearch

https://app.verbix.ai/assets/index-93lBYwLW.js

js verbix.ai collected 2026-10-05 13:54:07 UTC 30,951 bytes, 5 lines download raw bytes

1import{f as W,r as d,e as z,m as I,u as T,p as Q,j as e,A as X,S as ee,x as te,h as ae,z as le}from"./index-jmx1CJ5H.js";import{u as ne}from"./useSidebarReset-BAAfTFH4.js";import{l as se}from"./index-DhIYu4O9.js";import{T as A}from"./ThemedDropdown-K28QxV7p.js";import{S as U}from"./search-5NPkC-jz.js";import{C as Y}from"./clock-y7CPUur7.js";import{F as re}from"./funnel-CENRizbI.js";import{C as G}from"./calendar-ev8CgJB_.js";import{U as oe}from"./user-check-BBAEkyPl.js";import{T as q}from"./Tooltip-JC68sH8z.js";import{M as ie}from"./ManagementTable-DCUOCC2g.js";import{P as ce}from"./PageHeader-CkQKu4xM.js";import{P as de}from"./PageWrapper-CCnK_byA.js";import{D as ue}from"./download-DlV7VIMX.js";import"./chevron-up-C-h--f3u.js";import"./frown-CeQm16Ni.js";import"./meh-98-3lrLP.js";import"./message-square-CMqq1ucV.js";import"./target-B1v33X80.js";import"./brain-BTiqJLQH.js";import"./PageToolbar-D7lryljW.js";import"./DataTable-BLniFSoP.js";import"./CommonPagination-CB9HkcoT.js";const me=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],K=W("dollar-sign",me);const ge=[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]],H=W("receipt",ge),xe=()=>{const[s,t]=d.useState({search:"",startDate:"",endDate:"",datePreset:"all",agentName:"",clientName:"",durationRange:"",performance:"",compliance:"",sentiment:"",agentType:"",dateRange:"",phoneNumber:"",sortBy:"",sortOrder:""}),[r,i]=d.useState({...s}),[l,o]=d.useState(s.search),[f,h]=d.useState(!1);return d.useEffect(()=>{const m=setTimeout(()=>{o(s.search)},500);return()=>clearTimeout(m)},[s.search]),{filters:s,setFilters:t,stagedFilters:r,setStagedFilters:i,debouncedSearch:l,showFilters:f,setShowFilters:h,handleDatePresetChange:m=>{const a=new Date,u=c=>{const y=new Date(c),k=""+(y.getMonth()+1),N=""+y.getDate();return[y.getFullYear(),k.padStart(2,"0"),N.padStart(2,"0")].join("-")};let g="",b="";switch(m!=="all"&&m!=="custom"&&(b=u(a)),m){case"today":g=b;break;case"yesterday":{const c=new Date(a);c.setDate(c.getDate()-1),g=u(c),b=g;break}case"last7days":{const c=new Date(a);c.setDate(c.getDate()-6),g=u(c);break}case"last30days":{const c=new Date(a);c.setDate(c.getDate()-29),g=u(c);break}case"thisMonth":{const c=new Date(a.getFullYear(),a.getMonth(),1);g=u(c);break}case"lastMonth":{const c=new Date(a.getFullYear(),a.getMonth()-1,1),y=new Date(a.getFullYear(),a.getMonth(),0);g=u(c),b=u(y);break}case"all":case"custom":g="",b="";break}const p=m==="all"||m==="custom"?"":m;t(c=>({...c,datePreset:m,startDate:g,endDate:b,dateRange:p})),i(c=>({...c,datePreset:m,startDate:g,endDate:b,dateRange:p}))}}},O={fetchAssets:s=>z.get("/assets",{params:s}),getStats:s=>z.get("/assets/stats",{params:s})},E=s=>{if(!s&&s!==0)return"00:00:00";const t=Math.round(s),r=Math.floor(t/3600),i=Math.floor(t%3600/60),l=t%60;return`${r.toString().padStart(2,"0")}:${i.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}`},pe=s=>{let t=`File Name,Customer Name,Agent Name,Call Duration,Creation Date,Cost
2`,r=0;return s.forEach(i=>{const l=i.file_name?`"${i.file_name.replaceAll('"','""')}"`:"N/A",o=i.client_details?.[0]?.client_name?`"${i.client_details[0].client_name.replaceAll('"','""')}"`:"N/A",f=i.agents?.name?`"${i.agents.name.replaceAll('"','""')}"`:"N/A",h=i.call_length||0,x=E(h),m=I(i.created_datetime,!0),a=Number.parseFloat(i?.api_response?.[0]?.llm_usage?.call_price),u=Number.isNaN(a)?0:a;r+=u;const g=u.toFixed(2);t+=`${l},${o},${f},${x},"${m}",$${g}
3`}),t+=`
4,,,,Total Cost,$${r.toFixed(2)}
5`,t},fe=s=>{const t=new Blob([s],{type:"text/csv;charset=utf-8;"}),r=URL.createObjectURL(t),i=document.createElement("a");i.href=r;const l=new Date().toISOString().split("T")[0];i.setAttribute("download",`Call_Billing_Export_${l}.csv`),document.body.appendChild(i),i.click(),i.remove()},he=(s,t)=>{const{t:r}=T(),{showAlert:i}=Q(),[l,o]=d.useState([]),[f,h]=d.useState(0),[x,m]=d.useState(1),[a]=d.useState(10),[u,g]=d.useState(!0),[b,p]=d.useState(0),[c,y]=d.use
5State(0),[k,N]=d.useState(null),[v,n]=d.useState(null),[j,V]=d.useState(!1);d.useEffect(()=>{m(1)},[s,t.startDate,t.endDate,t.agentName,t.clientName,t.durationRange,t.performance,t.compliance,t.sentiment,t.agentType,t.dateRange,t.phoneNumber,t.sortBy,t.sortOrder]),d.useEffect(()=>{_()},[x,s,t.startDate,t.endDate,t.agentName,t.clientName,t.durationRange,t.performance,t.compliance,t.sentiment,t.agentType,t.dateRange,t.phoneNumber,t.sortBy,t.sortOrder]);const _=async()=>{g(!0);try{const C={page:x,limit:a,search:s||void 0,startDate:t.startDate||void 0,endDate:t.endDate||void 0,agentName:t.agentName||void 0,clientName:t.clientName||void 0,durationRange:t.durationRange||void 0,performance:t.performance||void 0,compliance:t.compliance||void 0,sentiment:t.sentiment||void 0,agentType:t.agentType||void 0,dateRange:t.dateRange||void 0,phoneNumber:t.phoneNumber||void 0,sortBy:t.sortBy||void 0,sortOrder:t.sortOrder||void 0},[S,$]=await Promise.all([O.fetchAssets(C),O.getStats(C)]);o(S.data.assets),h(S.data.total),p($.data.totalCost||0),y($.data.totalDuration||0)}catch(C){console.error("Error fetching billing assets:",C)}finally{g(!1)}};d.useEffect(()=>{v&&!u&&l!==v.oldAssets&&l.length>0&&(v.rule==="first"?N(l[0]):v.rule==="last"&&N(l[l.length-1]),n(null))},[u,l,v]);const B=async()=>{if(f===0){i(r("billing.exportError"),r("billing.noDataExport"),"warning");return}V(!0);try{const S=(await O.fetchAssets({page:1,limit:f>0?f:1e4,search:s||void 0,startDate:t.startDate||void 0,endDate:t.endD
5ate||void 0,agentName:t.agentName||void 0,clientName:t.clientName||void 0,durationRange:t.durationRange||void 0,performance:t.performance||void 0,compliance:t.compliance||void 0,sentiment:t.sentiment||void 0,phoneNumber:t.phoneNumber||void 0,agentType:t.agentType||void 0,dateRange:t.dateRange||void 0,sortBy:t.sortBy||void 0,sortOrder:t.sortOrder||void 0}))?.data?.assets||[];if(S.length===0){i(r("billing.exportError"),r("billing.noDataExport"),"warning");return}const $=pe(S);fe($),i(r("common.success",{defaultValue:"Success"}),r("billing.exportSuccess",{defaultValue:"Export completed successfully."}),"success")}catch(C){console.error("Export error",C),i(r("billing.exportError"),r("billing.exportFailed",{defaultValue:"Failed to export data."}),"error")}finally{V(!1)}},R=Math.ceil(f/a)||1,w=l.findIndex(C=>C.id===k?.id),M=(!u||v)&&w!==-1,D=M&&(w>0||x>1),P=M&&(w>=0&&w<l.length-1||x<R),L=D?()=>{w>0?N(l[w-1]):x>1&&(m(x-1),n({rule:"last",oldAssets:l}))}:null,Z=P?()=>{w>=0&&w<l.length-1?N(l[w+1]):x<R&&(m(x+1),n({rule:"first",oldAssets:l}))}:null,J=d.useMemo(()=>[{label:r("sidebar.account")},{label:r("sidebar.billing"),onClick:()=>N(null)},{label:r("callRecordings.callDetails",{defaultValue:"Call Details"})}],[r]);return{assets:l,total:f,page:x,setPage:m,limit:a,loading:u,totalCost:b,totalDuration:c,fetchAssets:_,selectedAsset:k,setSelectedAsset:N,pendingSelection:v,setPendingSelection:n,isExporting:j,setIsExporting:V,handleExportCSV:B,totalPages:R,currentAssetIndex:w,hasPrevious:D,hasNext:P,handleNavigatePrevious:L,handleNavigateNext:Z,baseCrumbs:J}};function F({value:s,onChange:t,placeholder:r,suggestions:i=[]}){const[l,o]=d.useState(s||""),[f,h]=d.useState(!1),x=d.useRef(null);d.useEffect(()=>{o(s||"")},[s]);const m=l.trim().length>0?i.filter(a=>a.toLowerCase().includes(l.toLowerCase())).slice(0,8):[];return d.useEffect(()=>{const a=u=>{x.current&&!x.current.contains(u.target)&&h(!1)};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[]),e.jsxs("div",{ref:x,className:"relative",children:[e.jsx(U,{size:12,className:"absolute start-3 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),e.jsx("input",{type:"text",placeholder:r,className:"w-full h-9 bg-white border border-gray-200 rounded-xl ps-8 pe-3 text-xs focus:ring-2 focus:ring-red-100 focus:border-[#EF4444] outline-none transition-all placeholder:text-gray-400 font-semibold text-gray-700",value:l,onFocus:()=>h(!0),onChange:a=>{o(a.target.value),t(a.target.value),h(!0)}}),f&&m.length>0&&e.jsx("ul",{className:"absolute z-50 top-full mt-1 w-full bg-white border border-gray-200 rounded-xl shadow-lg overflow-hidden max-h-44 overflow-y-auto custom-scrollbar",children:m.map(a=>e.jsx("li",{children:e.jsx("button",{type:"button",className:"w-full text-start px-3 py-2 text-xs font-semibold text-gray-700 cursor-pointer hover:bg-red-50 hover:text-[#EF4444] transition-colors outline-none",onMouseDown:u=>{u.preventDefault(),o(a),t(a),h(!1)},children:a})},a))})]})}function be({value:s,onChange:t}){const{t:r}=T(),i=s?s.split(":")[0]:"gt",l=s&&s.split(":")[1]||"",[o,f]=d.useState(i),[h,x]=d.useState(l),[m,a]=d.useState(!1),u=d.useRef(null);d.useEffect(()=>{s||(f("gt"),x(""))},[s]),d.useEffect(()=>{const p=c=>{u.current&&!u.current.contains(c.target)&&a(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]);const g={gt:r("billing.durationInput.greater",{defaultValue:"Greater >"}),lt:r("billing.durationInput.less",{defaultValue:"Less <"}),eq:r("billing.durationInput.equal",{defaultValue:"Equal ="})},b=(p,c)=>{c&&c.trim()!==""?t(`${p}:${c.trim()}`):t("")};return e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("div",{ref:u,className:"relative shrink-0",children:[e.jsxs("button",{type:"button",onClick:()=>a(!m),className:"h-9 px-2 bg-white border border-gray-200 rounded-xl text-[10px] font-black text-[#EF4444] flex items-center gap-1 hover:border-[#EF4444] transition-all whitespace-nowrap",children:[g[o],e.jsx(ae,{size:10,className:"text-gray-400 shrink-0"})]}),m&&e.jsx("ul",{className:"absolute z-50 top-full mt-1 w-32 bg-white border border-gray-200 rounded-xl shadow-lg overflow-hidden",children:Object.entries(g).map(([p,c])=>e.jsx("li",{children:e.jsx("button",{type:"button",className:`w-full text-start px-3 py-2 text-xs font-semibold cursor-pointer hover:bg-red-50 hover:text-[#EF4444] transition-colors outline-none ${o===p?"bg-red-50 text-[#EF4444]":"text-gray-700"}`,onMouseDown:y=>{y.preventDefault(),f(p),a(!1),b(p,h)},children:c})},p))})]}),e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Y,{size:11,className:"absolute start-2.5 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),e.jsx("input",{type:"number",min:"0",placeholder:r("billing.durationInput.minPlaceholder",{defaultValue:"min"}),className:"w-full h-9 bg-white border border-gray-200 rounded-xl ps-7 pe-2 text-xs font-semibold text-gray-700 placeholder:text-gray-400 focus:ring-2 focus:ring-red-100 focus:border-[#
5EF4444] outline-none transition-all",value:h,onChange:p=>{x(p.target.value),b(o,p.target.value)}})]})]})}const Ne=({filters:s,setFilters:t,showFilters:r,setShowFilters:i,stagedFilters:l,setStagedFilters:o,setPage:f,assets:h=[],totalCost:x=0,totalDuration:m=0})=>{const{t:a}=T(),[u,g]=d.useState(s.search),[b,p]=d.useState([]);d.useEffect(()=>{g(s.search)},[s.search]),d.useEffect(()=>{const n=setTimeout(()=>{u!==s.search&&(t(j=>({...j,search:u})),f(1))},500);return()=>clearTimeout(n)},[u,t,f,s.search]),d.useEffect(()=>{z.get("/agents/list").then(n=>{const j=(Array.isArray(n.data)?n.data:[]).map(V=>V.name).filter(Boolean);p(j)}).catch(()=>{})},[]);const c=Array.from(new Set(h.map(n=>n.client_details?.[0]?.client_name).filter(Boolean))),y=Array.from(new Set(h.map(n=>n.phone_number?.toString()).filter(Boolean))),k=()=>{const n={search:"",startDate:"",endDate:"",datePreset:"all",agentName:"",clientName:"",phoneNumber:"",durationRange:"",performance:"",compliance:"",sentiment:"",agentType:"",dateRange:"",sortBy:s.sortBy||"",sortOrder:s.sortOrder||""};t(n),o(n),f(1),g("")},N=Object.entries(s).some(([n,j])=>n==="sortBy"||n==="sortOrder"||n==="search"||n==="datePreset"?!1:j!==""&&j!==void 0&&j!==null),v=r||N;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"filters-bar flex flex-nowrap items-center gap-2 sm:gap-3 mt-3 mb-3",children:[e.jsxs("div",{className:"search-input relative flex-1 min-w-0",children:[e.jsx(U,{size:14,className:"absolute start-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.jsx("input",{type:"text",placeholder:a("billing.searchPlaceholder",{defaultValue:"Search agent..."}),className:"w-full h-9 bg-gray-50 border border-gray-200 rounded-lg ps-9 pe-3 text-xs focus:ring-2 focus:ring-red-100 focus:border-red-300 outline-none transition-all placeholder:text-gray-400 font-medium text-slate-700",value:u,onChange:n=>{g(n.target.value),o(j=>({...j,search:n.target.value}))}})]}),e.jsxs("div",{className:"hidden sm:flex items-center gap-3 bg-gradient-to-r from-red-50/70 to-rose-50/40 dark:from-red-950/20 dark:to-rose-950/10 border border-red-100/80 dark:border-red-900/30 px-4 py-1.5 rounded-xl text-[10px] font-bold text-gray-500 shadow-sm shadow-red-100/20 transition-all duration-300 hover:shadow-md hover:border-red-200",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-6 h-6 rounded-lg bg-red-100/80 dark:bg-red-900/40 flex items-center justify-center text-red-600 dark:text-red-400",children:e.jsx(Y,{size:12,className:"stroke-[2.5]"})}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-[9px] text-gray-400 font-semibold uppercase tracking-wider leading-none mb-0.5",children:a("billing.TotalHours",{defaultValue:"Total Hours"})}),e.jsx("span",{className:"text-gray-800 dark:text-gray-200 font-black font-mono leading-none",children:E(m)})]})]}),e.jsx("div",{className:"w-[1px] h-5 bg-red-200/60 dark:bg-red-800/40 self-center"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-6 h-6 rounded-lg bg-red-500 flex items-center justify-center text-white shadow-sm shadow-red-200/50",children:e.jsx(K,{size:12,className:"stroke-[2.5]"})}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-[9px] text-gray-400 font-semibold uppercase tracking-wider leading-none mb-0.5",children:a("billing.totalCost",{defaultValue:"Total Cost"})}),e.jsxs("span",{className:"text-[#EF4444] font-black font-mono leading-none",children:["$",x.toFixed(2)]})]})]})]}),e.jsxs("div",{className:"action-buttons flex items-center gap-2 flex-shrink-0",children:[e.jsx("button",{onClick:k,className:"h-9 px-3 rounded-lg border border-gray-200 text-gray-600 hover:bg-gray-100 transition-all flex items-center gap-2 text-xs font-bold",title:a("callRecordings.reset"),children:a("callRecordings.reset")}),e.jsxs("button",{onClick:()=>i(!r),className:`h-9 px-2.5 rounded-lg border transition-all flex items-center gap-2 text-xs font-bold ${v?"bg-red-50 border-red-200 text-red-600":"bg-white border-gray-200 text-gray-700 hover:bg-gray-50"}`,children:[e.jsx(re,{size:14}),e.jsx("span",{className:"inline",children:a("callRecordings.filters",{defaultValue:"Filters"})}),N&&e.jsxs("span",{className:"flex h-2 w-2 relative -ml-1",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-red-500"})]})]})]})]}),e.jsxs("div",{className:"flex sm:hidden items-center justify-around ga
5p-2 bg-gradient-to-r from-red-50/70 to-rose-50/40 dark:from-red-950/20 dark:to-rose-950/10 border border-red-100/80 dark:border-red-900/30 px-3 py-2 rounded-xl text-[10px] font-bold text-gray-500 shadow-sm mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-6 h-6 rounded-lg bg-red-100/80 dark:bg-red-900/40 flex items-center justify-center text-red-600 dark:text-red-400 shrink-0",children:e.jsx(Y,{size:12,className:"stroke-[2.5]"})}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-[9px] text-gray-400 font-semibold uppercase tracking-wider leading-none mb-0.5",children:a("billing.TotalHours",{defaultValue:"Total Hours"})}),e.jsx("span",{className:"text-gray-800 dark:text-gray-200 font-black font-mono leading-none",children:E(m)})]})]}),e.jsx("div",{className:"w-[1px] h-5 bg-red-200/60 dark:bg-red-800/40 self-center"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-6 h-6 rounded-lg bg-red-500 flex items-center justify-center text-white shadow-sm shadow-red-200/50 shrink-0",children:e.jsx(K,{size:12,className:"stroke-[2.5]"})}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-[9px] text-gray-400 font-semibold uppercase tracking-wider leading-none mb-0.5",children:a("billing.totalCost",{defaultValue:"Total Cost"})}),e.jsxs("span",{className:"text-[#EF4444] font-black font-mono leading-none",children:["$",x.toFixed(2)]})]})]})]}),r&&e.jsxs("div",{className:"mb-4 p-3 bg-white rounded-xl border border-gray-200 animate-fade-in-up",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-5 gap-2.5 mb-2.5",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest ps-0.5",children:a("dashboard.filters.timeRange",{defaultValue:"Time Range"})}),e.jsx(A,{value:l.dateRange||"",onChange:n=>o({...l,dateRange:n}),options:[{value:"",label:a("dashboard.filters.allTime",{defaultValue:"All Time"})},{value:"today",label:a("dashboard.filters.today",{defaultValue:"Today"})},{value:"yesterday",label:a("dashboard.filters.yesterday",{defaultValue:"Yesterday"})},{value:"thisWeek",label:a("dashboard.filters.thisWeek",{defaultValue:"This Week"})},{value:"lastWeek",label:a("dashboard.filters.lastWeek",{defaultValue:"Last Week"})},{value:"thisMonth",label:a("dashboard.filters.thisMonth",{defaultValue:"This Month"})},{value:"lastMonth",label:a("dashboard.filters.lastMonth",{defaultValue:"Last Month"})},{value:"last7days",label:a("dashboard.filters.last7days",{defaultValue:"Last 7 Days"})},{value:"last30days",label:a("dashboard.filters.last30days",{defaultValue:"Last 30 Days"})},{value:"lastYear",label:a("dashboard.filters.lastYear",{defaultValue:"Last Year"})},{value:"currentYear",label:a("dashboard.filters.currentYear",{defaultValue:"Current Year"})},{value:"custom",label:a("dashboard.filters.custom",{defaultValue:"Custom Date Range"})}],icon:G,placeholder:a("dashboard.filters.allTime",{defaultValue:"All Time"})}),l.dateRange==="custom"&&e.jsxs("div",{className:"flex gap-1 items-center mt-1 animate-fade-in",children:[e.jsx("input",{type:"date",className:"h-9 flex-1 min-w-0 bg-white border border-gray-200 rounded-xl px-2 text-xs font-semibold text-gray-700 outline-none focus:ring-2 focus:ring-red-100 focus:border-[#EF4444] transition-all",value:l.startDate||"",onChange:n=>o({...l,startDate:n.target.value})}),e.jsx("span",{className:"text-gray-400 text-xs",children:"-"}),e.jsx("input",{type:"date",className:"h-9 flex-1 min-w-0 bg-white border border-gray-200 rounded-xl px-2 text-xs font-semibold text-gray-700 outline-none focus:ring-2 focus:ring-red-100 focus:border-[#EF4444] transition-all",value:l.endDate||"",onChange:n=>o({...l,endDate:n.target.value})})]})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest ps-0.5",children:a("variables.agentName",{defaultValue:"Agent Name"})}),e.jsx(F,{value:l.agentName||"",onChange:n=>o({...l,agentName:n}),placeholder:a("callRecordings.quickSearch",{defaultValue:"Search agent..."}),suggestions:b})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest ps-0.5",children:a("callRecordings.clientName",{defaultValue:"Client Name"})}),e.jsx(F,{value:l.clientName||"",onChange:n=>o({...l,clientName:n}),placeholder:a("callRecordings.searchClient",{defaultValue:"Search client..."}),suggestions:c})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest ps-0.5",children:a("phoneNumbers.title",{defaultValue:"Phone Number"})}),e.jsx(F,{value:l.phoneNumber||"",onChange:n=>o({...l,phoneNumber:n}),placeholder:a("phoneNumbers.searchNumber",{defaultValue:"Search phone..."}),suggestions:y})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest ps-0.5",children:a("callRecordings.callDuration",{defaultValue:"Call Duration"})}),e.jsx(be,{value:l.durationRange||"",onChange:n=>o({...l,durationRange:n})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2.5",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest ps-0.5",children:a("callRecordings.performance",{defaultValue:"Performance"})}),e.jsx(A,{value:l.performance||"",onChange:n=>o({...l,performance:n}),options:[{value:"",label:a("callRecordings.allRatings",{defaultValue:"All Ratings"})},{value:"75",label:a("callRecordings.ratingExcellent",{defaultValue:"Excellent (≥ 75%)"})},{value:"50",label:a("callRecordings.ratingAverage",{defaultValue:"Average (50-74%)"})},{value:"1",label:a("callRecordings.ratingPoor",{defaultValue:"Poor (1-49%)"})},{value:"0",label:a("callRecordings.ratingFail",{defaultValue:"Fail (0%)"})}],icon:X,placeholder:a("callRecordings.allRatings",{defaultValue:"All Ratings"})})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest ps-0.5",children:a("callRecordings.complianceScore",{defaultValue:"Compliance Score"})}),e.jsx(A,{value:l.compliance||"",onChange:n=>o({...l,compliance:n}),options:[{value:"",label:a("callRecordings.allScores",{defaultValue:"All Scores"})},{value:"75",label:a("callRecordings.excellentRange",{defaultValue:"Excellent (≥ 75%)"})},{value:"50",label:a("callRecordings.averageRange",{defaultValue:"Average (50-74%)"})},{value:"1",label:a("callRecordings.poorRange",{defaultValue:"Poor (1-49%)"})},{value:"0",label:a("callRecordings.failRange",{defaultValue:"Fail (0%)"})}],icon:ee,placeholder:a("callRecordings.allScores",{defaultValue:"All Scores"})})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest ps-0.5",children:a("callRecordings.sentiment",{defaultValue:"Sentiment"})}),e.jsx(A,{value:l.sentiment||"",onChange:n=>o({...l,sentiment:n}),options:[{value:"",label:a("callRecordings.allSentiments",{defaultValue:"All Sentiments"})},{value:"positive",label:a("common.positive",{defaultValue:"Positive"})},{value:"neutral",label:a("common.neutral",{defaultValue:"Neutral"})},{value:"negative",label:a("common.negative",{defaultValue:"Negative"})}],icon:te,placeholder:a("callRecordings.allSentiments",{defaultValue:"All Sentiments"})})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest ps-0.5",children:a("callRecordings.agentType",{defaultValue:"Agent Type"})}),e.jsx(A,{value:l.agentType||"",onChange:n=>o({...l,agentType:n}),options:[{value:"",label:a("callRecordings.allTypes",{defaultValue:"All Types"})},{value:"AI",label:a("callRecordings.aiAgent",{defaultValue:"AI Agent"})},{value:"Human",label:a("callRecordings.humanAgent",{defaultValue:"Human Agent"})}],icon:oe,placeholder:a("callRecordings.allTypes",{defaultValue:"All Types"})})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 mt-3 pt-2.5 border-t border-gray-100",children:[e.jsx("button",{onClick:k,className:"px-4 py-1.5 text-xs font-semibold text-gray-500 hover:text-gray-900 transition-colors rounded-lg hover:bg-gray-50",children:a("callRecordings.reset",{defaultValue:"Reset"})}),e.jsx("button",{onClick:()=>{t({...l}),f(1),i(!1)},className:"px-4 py-1.5 bg-[#EF4444] text-white rounded-lg text-xs font-bold hover:bg-red-700 transition-all shadow-sm",children:a("callRecordings.applyFilters",{defaultValue:"Apply Filters"})})]})]})]})};function ye({setSelectedAsset:s}){const{t}=T();return{columns:[{label:t("phoneNumbers.title",{defaultValue:"Phone Number"}),width:"15%",sortable:!0,sortKey:"phone_number",render:l=>e.jsx("button",{type:"button",className:"text-[11px] font-bold text-[#EF4444] hover:text-red-700 cursor-pointer transition-colors text-left",onClick:o=>{o.stopPropagation(),s(l)},title:l.phone_number||t("billing.na",{defaultValue:"N/A"}),children:l.phone_number||t("billing.na",{defaultValue:"N/A"})})},{label:t("billing.tableColumns.fileName"),width:"22%",sortable:!0,sortKey:"fileName",render:l=>e.jsx(q,{content:l.file_name||t("billing.na",{defaultValue:"N/A"}),children:e.jsx("div",{className:"text-xs font-bold text-gray-900 group-hover:text-[#EF4444] transition-colors break-all leading-relaxed line-clamp-2",children:l.file_name||t("billing.na",{defaultValue:"N/A"})})})},{label:t("billing.tableColumns.customerName"),width:"16%",sortable:!0,sortKey:"client",render:l=>e.jsx("span",{className:"text-[11px] font-black text-gray-600 uppercase tracking-widest group-hover:text-gray-900 transition-colors",children:l.client_details?.[0]?.client_name||t("billing.na",{defaultValue:"N/A"})})},{label:t("billing.tableColumns.agentName"),width:"14%",sortable:!0,sortKey:"agent",render:l=>e.jsx("span",{className:"text-[11px] font-black text-[#EF4444] uppercase tracking-widest transition-colors group-hover:text-red-700",children:l.agents?.name||t("billing.na",{defaultValue:"N/A"})})},{label:t("billing.tableColumns.duration"),width:"12%",sortable:!0,sortKey:"duration",headerClassName:"text-start",className:"text-start",render:l=>e.jsx("div",{className:"inline-flex items-center justify-center bg-gray-50 group-hover:bg-gray-100 px-3 py-1.5 rounded-xl border border-gray-100 transition-colors min-w-[60px]",children:e.jsx("span",{className:"text-[10px] font-bold text-gray-500 font-mono",children:E(l.call_length)})})},{label:t("billing.tableColumns.creationDate"),width:"18%",sortable:!0,sortKey:"creationDate",render:l=>e.jsx("div",{className:"text-[11px] font-bold text-gray-600 group-hover:text-gray-900 transition-colors capitalize",children:l.created_datetime?I(l.created_datetime,!0):t("billing.na",{defaultValue:"N/A"})})},{label:t("billing.tableColumns.cost"),width:"6%",sortable:!0,sortKey:"c
5ost",headerClassName:"text-right",className:"text-right",render:l=>{const o=Number.parseFloat(l?.api_response?.[0]?.llm_usage?.call_price);return e.jsx("span",{className:"text-[12px] font-black text-[#EF4444] font-mono",children:Number.isNaN(o)?"$0.00":`$${o.toFixed(2)}`})}}],renderMobileCard:l=>e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden p-5 hover:border-red-200 transition-all",children:[e.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[e.jsx("div",{className:"w-11 h-11 rounded-xl bg-red-50 flex items-center justify-center text-red-600 border border-red-100 shadow-sm shrink-0",children:e.jsx(H,{size:18})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex justify-between items-start gap-2",children:[e.jsx(q,{content:l.file_name||t("billing.na",{defaultValue:"N/A"}),children:e.jsx("button",{type:"button",onClick:()=>s(l),className:"text-xs font-black text-gray-900 line-clamp-2 break-all pr-2 text-left hover:text-[#EF4444] transition-colors",children:l.file_name||t("billing.na",{defaultValue:"N/A"})})}),e.jsx("span",{className:"text-xs font-black text-[#EF4444] font-mono shrink-0",children:(()=>{const o=Number.parseFloat(l?.api_response?.[0]?.llm_usage?.call_price);return Number.isNaN(o)?"$0.00":`$${o.toFixed(2)}`})()})]}),e.jsx("p",{className:"text-[10px] font-bold text-red-500 uppercase tracking-widest mt-0.5",children:l.agents?.name||t("billing.na",{defaultValue:"N/A"})}),e.jsx("button",{type:"button",className:"text-[10px] font-bold text-indigo-600 uppercase tracking-widest mt-0.5 cursor-pointer hover:underline text-left",onClick:()=>s(l),children:l.phone_number||t("billing.na",{defaultValue:"N/A"})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 py-3 border-y border-gray-50",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest block",children:t("billing.tableColumns.customerName")}),e.jsx("span",{className:"text-[10px] font-bold text-gray-700 uppercase",children:l.client_details?.[0]?.client_name||t("billing.na",{defaultValue:"N/A"})})]}),e.jsxs("div",{className:"space-y-1 flex flex-col items-end",children:[e.jsx("span",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest block text-right w-full",children:t("billing.tableColumns.duration")}),e.jsx("span",{className:"text-[10px] font-bold text-gray-600 font-mono text-right w-full",children:E(l.call_length)})]})]}),e.jsxs("div",{className:"mt-4 text-[9px] text-gray-500 font-bold flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(G,{size:10})," ",I(l.created_datetime,!0)]}),e.jsxs("span",{className:"text-[#EF4444]",children:[t("billing.viewDetails")," →"]})]})]})}}function He({setBreadcrumbs:s}){const{t}=T(),{filters:r,setFilters:i,stagedFilters:l,setStagedFilters:o,debouncedSearch:f,showFilters:h,setShowFilters:x}=xe(),{assets:m,total:a,page:u,setPage:g,limit:b,loading:p,totalCost:c,totalDuration:y,selectedAsset:k,setSelectedAsset:N,setPendingSelection:v,isExporting:n,handleExportCSV:j,totalPages:V,handleNavigatePrevious:_,handleNavigateNext:B,baseCrumbs:R}=he(f,r);ne("billing",()=>{N(null),v(null)});const{columns:w,renderMobileCard:M}=ye({setSelectedAsset:N});return k?e.jsx(se,{asset:k,onBack:()=>{N(null),v(null)},setBreadcrumbs:s,baseCrumbs:R,onNavigatePrevious:_,onNavigateNext:B,isParentLoading:p}):e.jsxs(de,{children:[e.jsx(ce,{title:t("billing.title"),icon:H,stats:[{label:`${a} ${t("billing.totalAssets",{defaultValue:"total assets"})}`,valueColorClass:"text-slate-600 font-bold"},{label:t("billing.subtitle")}],actionButton:{label:n?t("billing.exporting",{defaultValue:"Exporting..."}):t("billing.exportCSV"),icon:n?e.jsx(le,{size:14,className:"animate-spin"}):e.jsx(ue,{size:14}),onClick:j,disabled:n}}),e.jsx("div",{className:"flex-1 md:overflow-y-auto overflow-x-hidden custom-scrollbar",children:e.jsxs("div",{className:"p-4 sm:px-8 py-0 flex flex-col min-h-full",children:[e.jsx(Ne,{filters:r,setFilters:i,showFilters:h,setShowFilters:x,stagedFilters:l,setStagedFilters:o,setPage:g,assets:m,totalCost:c,totalDuration:y}
5),e.jsx(ie,{columns:w,data:m,loading:p,loaderIcon:H,loaderMessage:t("billing.loading"),renderMobileCard:M,emptyMessage:t("billing.noData"),onRowClick:D=>N(D),sortBy:r.sortBy,sortOrder:r.sortOrder,onSort:(D,P)=>{i(L=>({...L,sortBy:D,sortOrder:P})),g(1)},page:u,totalPages:V,totalItems:a,limit:b,setPage:g})]})})]})}export{He 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.