PageSourceSearch

https://verbalo.ai/app/assets/Calls-BwrjCP3O.js

js verbalo.ai collected 2026-10-05 14:49:33 UTC 34,517 bytes, 2 lines download raw bytes

1import{k as Y,j as e,G as ie,B as oe,X as Z,J as ce,C as Q,N as P,F as de,u as I,w as xe,O as me,o as ue,b as V,Q as pe,I as ee}from"./index-C5LQ07Dd.js";import{b as n}from"./react-vendor-Da4qGlXk.js";import{L as z}from"./loader-circle-Dl70_sOt.js";import{T as ge}from"./trash--BEJO725.js";import{U as fe}from"./user-DNvSNTRP.js";import{R as he}from"./refresh-cw-Cogc2dsN.js";import{D as A}from"./download-D7vchdZ1.js";import{b as ye,t as te,a as B,p as J}from"./calendar-grid-DmmDVFJd.js";import{C as be}from"./calendar-days-Bbc48LLw.js";import{C as se}from"./chevron-left-C0B-bHEw.js";import{S as je}from"./search-BTcJc-mj.js";import{C as Ne}from"./chevron-down-Bc3qUnWb.js";import{C as ve}from"./clock-DFQxclZL.js";const R=()=>({Authorization:`Bearer ${localStorage.getItem("verbalo_token")||localStorage.getItem("vb_token")}`}),ae=()=>({...R(),"Content-Type":"application/json"});function E(t){return`/api/v1/conversations/${encodeURIComponent(t)}/record`}async function O(t){try{return await t.json()}catch{return null}}async function we(t){const s=await fetch(E(t),{headers:R()});return s.ok?O(s):null}async function Se(t){const s=await fetch(`${E(t)}/customer`,{headers:R()});return s.ok?O(s):null}async function Ce(t){const s=await fetch(`${E(t)}/sync`,{method:"POST",headers:R()}),a=await O(s);return s.ok?{ok:!0}:{ok:!1,error:(a==null?void 0:a.error)||(a==null?void 0:a.message)||`Sync failed (${s.status})`}}async function ke(t,s){const a=await fetch(`${E(t)}/notes`,{method:"POST",headers:ae(),body:JSON.stringify({body:s})}),r=await O(a);return a.ok?{ok:!0,note:r==null?void 0:r.note}:{ok:!1,error:(r==null?void 0:r.error)||`Failed (${a.status})`}}async function _e(t,s){return(await fetch(`${E(t)}/notes/${encodeURIComponent(s)}`,{method:"DELETE",headers:R()})).ok}async function De(t){const s=await fetch(`${E(t)}/recap/generate`,{method:"POST",headers:R()});return s.ok?O(s):null}async function ze(t,s){const a=await fetch(`${E(t)}/recap`,{method:"PUT",headers:ae(),body:JSON.stringify(s)});return a.ok?O(a):null}async function Te(t,s,a){const r=new URLSearchParams({view:s,format:a}),i=await fetch(`${E(t)}/export?${r}`,{headers:R()});return i.ok?i.blob():null}const L=20,Ee=/^[A-Za-z0-9_-]{1,128}$/,q=()=>({Authorization:`Bearer ${localStorage.getItem("verbalo_token")||localStorage.getItem("vb_token")}`});function U(t){return Y(t*1e3)}function F(t){if(!t)return"—";const s=Math.floor(t/60),a=String(t%60).padStart(2,"0");return`${s}:${a}`}function Re(){const[t,s]=n.useState([]),[a,r]=n.useState(0),[i,l]=n.useState(0),[d,p]=n.useState(!0),[o,m]=n.useState(!1),[g,f]=n.useState(""),[b,x]=n.useState(null),[N,k]=n.useState(null),[y,c]=n.useState(!1),[u,_]=n.useState(""),[v,$]=n.useState(""),[w,M]=n.useState(""),[h,j]=n.useState(""),S=n.useCallback(C=>{p(!0);const T={limit:String(L),offset:String(C),days:"90"};v&&(T.outcome=v),w&&(T.dateFrom=w),h&&(T.dateTo=h),u.trim()&&(T.search=u.trim()),fetch(`/api/v1/conversations?${new URLSearchParams(T)}`,{headers:q()}).then(D=>D.json()).then(D=>
1{if(!D)return;const le=!!D.error||D.integrationStatus==="degraded";m(le),f(D.integrationDetail||D.detail||""),!D.error&&(s(D.conversations||[]),r(D.total||0))}).catch(()=>{m(!0),f("Could not reach the API. Please retry in a moment.")}).finally(()=>p(!1))},[v,w,h,u]);n.useEffect(()=>{l(0),S(0)},[v,w,h]),n.useEffect(()=>{S(i)},[i]),n.useEffect(()=>{const C=setTimeout(()=>{l(0),S(0)},350);return()=>clearTimeout(C)},[u]),n.useEffect(()=>{const C=T=>{T.key==="Escape"&&x(null)};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[]);const G=async C=>{x(C),k(null),c(!0);try{const D=await(await fetch(`/api/v1/conversations/${C}`,{headers:q()})).json();k(D)}catch{}c(!1)},ne=()=>x(null);return n.useEffect(()=>{const C=new URLSearchParams(window.location.search).get("conversation");C&&Ee.test(C)&&G(C)},[]),{convs:t,total:a,offset:i,loading:d,integrationDown:o,integrationDetail:g,selected:b,detail:N,detailLoading:y,search:u,outcome:v,dateFrom:w,dateTo:h,setOffset:l,setSearch:_,setOutcome:$,setDateFrom:M,setDateTo:j,openDetail:G,closeDetail:ne}}function $e(t){const s=["date_time","agent","duration","status","summary","source","tts","language"],a=t.map(d=>[U(d.start_time_unix_secs),d.agent_name,F(d.call_duration_secs),d.call_successful??"",d.call_summary_title||"",d.conversation_initiation_source||"",d.tts_provider||"—",d.main_language||""]),r=[s,...a].map(d=>d.map(p=>`"${String(p).replace(/"/g,'""')}"`).join(",")).join(`
2`),i=new Blob([r],{type:"text/csv;charset=utf-8"}),l=document.createElement("a");l.href=URL.createObjectURL(i),l.download=`verbalo-conversations-${Date.now()}.csv`,l.click(),URL.revokeObjectURL(l.href)}async function Le(t,s,a){const r=await Te(t,s,a);if(!r)return!1;const i="txt",l=document.createElement("a");
2return l.href=URL.createObjectURL(r),l.download=`verbalo-record-${s}-${t}.${i}`,l.click(),URL.revokeObjectURL(l.href),!0}const re={convai_asr_trailing_service_latency:"Speech recognition finish",convai_llm_service_ttfb:"Model first token",convai_llm_service_ttf_sentence:"Model first sentence",convai_llm_service_tt_last_sentence:"Model last sentence",convai_tts_service_ttfb:"Speech first audio"},H=Object.keys(re);function K(t){const s=H.indexOf(t);return s===-1?H.length:s}function Oe({latency:t}){const s=Object.entries((t==null?void 0:t.metrics)??{}).sort(([a],[r])=>K(a)-K(r)||a.localeCompare(r));return!t||s.length===0?null:e.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-4",children:[e.jsx("p",{className:"text-[11px] font-semibold text-gray-500 uppercase tracking-wide mb-2.5",children:"Response timing"}),e.jsx("dl",{className:"space-y-2",children:s.map(([a,r])=>e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-baseline gap-0.5 sm:gap-3",children:[e.jsx("dt",{className:"text-[11px] font-medium text-gray-400 sm:w-2/5 break-words",children:re[a]??a}),e.jsx("dd",{className:"text-xs text-gray-800 sm:flex-1",children:`median ${r.medianMs} ms · max ${r.maxMs} ms · ${r.turns} ${r.turns===1?"turn":"turns"}`})]},a))}),t.truncated&&typeof t.turnsWithMetricsTotal=="number"&&e.jsx("p",{className:"text-[11px] text-amber-700 leading-relaxed mt-3",children:`Covers the first ${t.turnsWithMetrics} of ${t.turnsWithMetricsTotal} turns with timings.`}),e.jsx("p",{className:"text-[11px] text-gray-400 leading-relaxed mt-3",children:"Recorded by the voice runtime for each agent turn. These are stage times, not the full time from the caller finishing to the agent's first audio, which the runtime does not record."})]})}function Fe({conversationId:t,notes:s,onNotesChange:a}){const[r,i]=n.useState(""),[l,d]=n.useState(!1),[p,o]=n.useState(null),[m,g]=n.useState(""),f=async()=>{const x=r.trim();if(!x)return;d(!0),g("");const N=await ke(t,x);N.ok&&N.note?(a([N.note,...s]),i("")):g(N.error||"Failed to add note."),d(!1)},b=async x=>{o(x),g(""),await _e(t,x)?a(s.filter(k=>k.id!==x)):g("Failed to delete note."),o(null)};return e.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-4 space-y-3",children:[e.jsx("p",{className:"text-[11px] font-semibold text-gray-500 uppercase tracking-wide",children:"Internal notes"}),s.length>0?e.jsx("ul",{className:"space-y-2",children:s.map(x=>e.jsxs("li",{className:"flex gap-2 items-start group",children:[e.jsxs("div",{className:"flex-1 text-xs text-gray-700 bg-gray-50 border border-gray-100 rounded-lg px-3 py-2 leading-relaxed whitespace-pre-wrap",children:[x.body,x.createdAt&&e.jsx("p",{className:"text-[10px] text-gray-400 mt-1.5",children:Y(x.createdAt)})]}),e.jsx("button",{type:"button",onClick:()=>b(x.id),disabled:p===x.id,className:"p-1.5 rounded-lg text-gray-400 hover:text-red-500 hover:bg-red-50 opacity-0 group-hover:opacity-100 focus:opacity-100 transition disabled:opacity-50","aria-label":"Delete note",children:p===x.id?e.jsx(z,{size:14,className:"animate-spin"}):e.jsx(ge,{size:14})})]},x.id))}):e.jsx("p",{className:"text-xs text-gray-400",children:"No notes yet."}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("textarea",{value:r,onChange:x=>i(x.target.value),rows:3,placeholder:"Add an internal note…",className:"w-full px-3 py-2 text-xs border border-gray-200 rounded-lg resize-y focus:outline-none focus:border-violet-400"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[11px] text-gray-400",children:m}),e.jsxs("button",{type:"button",onClick:f,disabled:l||!r.trim(),className:"inline-flex items-center gap-1.5 px-3 py-1.5 bg-gray-900 text-white text-xs font-medium rounded-lg hover:bg-gray-800 disabled:opacity-50 transition",children:[l&&e.jsx(z,{size:12,className:"animate-spin"})," Add note"]})]})]})]})}function Me({conversationId:t,customerRecap:s,recapStatus:a,onRecapSaved:r}){const[i,l]=n.useState(s||""),[d,p]=n.useState(a),[o,m]=n.useState(!1),[g,f]=n.useState(null),[b,x]=n.useState("");n.useEffect(()=>{l(s||""),p(a),x("")},[t,s,a]);const N=async()=>{m(!0),x("");const y=await De(t);y!=null&&y.draft?(l(y.draft),p("draft"),x("Draft generated — review and save.")):x("Could not generate recap draft."),m(!1)},k=async y=>{const c=i.trim();if(!c){x("Recap text is required.");return}f(y),x("");const u=await ze(t,{customerRecap:c,recapStatus:y});u?(p(u.recapStatus),r(u.customerRecap,u.recapStatus),x(y==="final"?"Final recap saved.":"Draft saved.")):x("Failed to save recap."),f(null)};return e.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-semibold text-gray-500 uppercase tracking-wide",children:"Customer recap"}),d!=="none"&&e.jsxs("span",{className:"text-[10px] text-gray-400 capitalize",children:["Status: ",d]})]}),e.jsxs("button",{type:"button",onClick:N,disabled:o,className:"inline-flex items-center gap-1 text-[11px] font-medium text-violet-600 hover:text-violet-700 disabled:opacity-50 transition shrink-0",children:[o?e.jsx(z,{size:12,className:"animate-spin"}):e.jsx(ie,{size:12})," Generate draft"]})]}),e.jsx("textarea",{value:i,onChange:y=>l(y.target.value),rows:5,placeholder:"Customer-facing recap…",className:"w-full px-3 py-2 text-xs border border-gray-200 rounded-lg resize-y focus:outline-none focus:border-violet-400 leading-relaxed"}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("span",{className:"text-[11px] text-gray-400",children:b}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>k("draft"),disabled:g!==null,className:"inline-flex items-center gap-1.5 px-3 py-1.5 border border-gray-200 text-xs font-medium text-gray-600 rounded-lg hover:border-gray-300 disabled:opacity-50 transition",children:[g==="draft"&&e.jsx(z,{size:12,className:"animate-spin"})," Save draft"]}),e.jsxs("button",{type:"button",onClick:()=>k("final"),disabled:g!==null,className:"inline-flex items-center gap-1.5 px-3 py-1.5 bg-vi
2olet-600 text-white text-xs font-medium rounded-lg hover:bg-violet-700 disabled:opacity-50 transition",children:[g==="final"&&e.jsx(z,{size:12,className:"animate-spin"})," Save final"]})]})]})]})}function Pe({transcript:t}){return t.length===0?null:e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-semibold text-gray-400 uppercase tracking-wide mb-3",children:"Transcript"}),e.jsx("div",{className:"space-y-2",children:t.map((s,a)=>e.jsxs("div",{className:`flex gap-2.5 ${s.role==="agent"?"":"flex-row-reverse"}`,children:[e.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5 ${s.role==="agent"?"bg-violet-100":"bg-gray-100"}`,children:s.role==="agent"?e.jsx(oe,{size:12,className:"text-violet-600"}):e.jsx(fe,{size:12,className:"text-gray-500"})}),e.jsxs("div",{className:`flex-1 max-w-[85%] px-3 py-2 rounded-xl text-xs leading-relaxed ${s.role==="agent"?"bg-gray-50 border border-gray-100 text-gray-700":"bg-violet-600 text-white"}`,children:[s.message,s.interrupted&&e.jsx("span",{className:"ml-1.5 text-[10px] opacity-50 italic",children:"interrupted"})]})]},a))})]})}function Ie({view:t,onChange:s}){return e.jsxs("div",{className:"inline-flex rounded-lg border border-gray-200 p-0.5 bg-gray-50",children:[e.jsx("button",{type:"button",onClick:()=>s("internal"),className:`px-3 py-1.5 text-xs font-medium rounded-md transition ${t==="internal"?"bg-white text-gray-900 shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:"Internal"}),e.jsx("button",{type:"button",onClick:()=>s("customer"),className:`px-3 py-1.5 text-xs font-medium rounded-md transition ${t==="customer"?"bg-white text-gray-900 shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:"Customer"})]})}function Ae(t){return typeof t.cost=="number"?t.cost_status==="billed_on_phone_call"?`${t.cost} credits (charged on the phone call)`:`${t.cost} credits`:t.cost_status==="in_progress"?"Cost pending":"No charge recorded"}function Ue({detail:t,loading:s,onClose:a}){const[r,i]=n.useState("internal"),[l,d]=n.useState(null),[p,o]=n.useState([]),[m,g]=n.useState(null),[f,b]=n.useState(!1),[x,N]=n.useState(!1),[k,y]=n.useState(!1),[c,u]=n.useState(""),_=async h=>{b(!0),u("");const[j,S]=await Promise.all([we(h),Se(h)]);d((j==null?void 0:j.record)??null),o((j==null?void 0:j.notes)??[]),g(S),b(!1)};n.useEffect(()=>{t!=null&&t.id&&(i("internal"),_(t.id))},[t==null?void 0:t.id]);const v=async()=>{if(!t)return;N(!0),u("");const h=await Ce(t.id);h.ok?(await _(t.id),u("Record synced.")):u(h.error||"Sync failed."),N(!1)},$=async()=>{if(!t)return;y(!0),u(""),await Le(t.id,r,"txt")||u("Export failed."),y(!1)},w=()=>{var h;return(h=l==null?void 0:l.transcript)!=null&&h.length?l.transcript:((t==null?void 0:t.transcript)??[]).map(j=>({role:j.role,message:j.message,timeInCallSecs:j.timeInCallSecs,interrupted:j.interrupted}))},M=(l==null?void 0:l.aiSummary)??(t==null?void 0:t.transcriptSummary)??null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 bg-black/30 z-40 backdrop-blur-[1px]",onClick:a}),e.jsxs("div",{className:"fixed top-0 right-0 h-full w-full max-w-xl bg-white z-50 shadow-2xl flex flex-col",children:[e.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 flex items-center justify-between flex-shrink-0 gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"text-sm font-semibold text-gray-900 truncate",children:s?"Loading…":(t==null?void 0:t.summaryTitle)||(l==null?void 0:l.summaryTitle)||"Conversation"}),t&&e.jsxs("p",{className:"text-[11px] text-gray-400 mt-0.5",children:[t.agentName," · ",U(t.startTime)," · ",F(t.durationSecs)]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[t&&e.jsx(Ie,{view:r,onChange:i}),e.jsx("button",{onClick:a,className:"p-1.5 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 transition",children:e.jsx(Z,{size:16})})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-5 space-y-5",children:s?e.jsx("div",{className:"flex justify-center py-10",children:e.jsx(z,{size:24,className:"animate-spin text-violet-400"})}):t?e.jsxs(e.Fragment,{children:[f&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400",children:[e.jsx(z,{size:14,className:"animate-spin text-violet-400"})," Loading record…"]}),r==="internal"?e.jsx(Ge,{detail:t,aiSummary:M,transcript:w(),notes:p,record:l,recordMessage:c,syncing:x,exporting:k,onNotesChange:o,onRecapSaved:(h,j)=>{d(S=>S&&{...S,customerRecap:h,recapStatus:j}),g(S=>S&&{...S,customerRecap:h})},onSync:v,onExport:$}):e.jsx(He,{detail:t,customerView:m,exporting:k,recordMessage:c,onExport:$})]}):e.jsxs("div",{className:"text-center py-10",children:[e.jsx(ce,{size:24,className:"mx-auto text-gray-200 mb-2"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Failed to load conversation details."})]})})]})]})}
2function Ge({detail:t,aiSummary:s,transcript:a,notes:r,record:i,recordMessage:l,syncing:d,exporting:p,onNotesChange:o,onRecapSaved:m,onSync:g,onExport:f}){var b;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.callSuccessful==="success"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-emerald-600 bg-emerald-50 border border-emerald-100 px-2.5 py-1 rounded-full",children:[e.jsx(Q,{size:11})," Successful"]}),t.callSuccessful==="failure"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-red-500 bg-red-50 border border-red-100 px-2.5 py-1 rounded-full",children:[e.jsx(P,{size:11})," Failed"]}),t.goal_achieved==="success"&&e.jsx("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-emerald-600 bg-emerald-50 border border-emerald-100 px-2.5 py-1 rounded-full",children:"Goal achieved"}),t.goal_achieved==="failure"&&e.jsx("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-amber-700 bg-amber-50 border border-amber-100 px-2.5 py-1 rounded-full",children:"Goal missed"}),((b=t.sentiment)==null?void 0:b.label)&&e.jsxs("span",{className:"text-xs font-medium text-gray-600 bg-gray-50 border border-gray-100 px-2.5 py-1 rounded-full capitalize",children:["Sentiment: ",t.sentiment.label]}),e.jsx("span",{className:"text-xs text-gray-400 bg-gray-50 border border-gray-100 px-2.5 py-1 rounded-full",children:Ae(t)}),e.jsxs("span",{className:"text-xs text-gray-400 bg-gray-50 border border-gray-100 px-2.5 py-1 rounded-full",children:[F(t.durationSecs)," duration"]}),(i==null?void 0:i.capturedAt)&&e.jsxs("span",{className:"text-xs text-gray-400 bg-gray-50 border border-gray-100 px-2.5 py-1 rounded-full",children:["Synced ",de(i.capturedAt)]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:g,disabled:d,className:"inline-flex items-center gap-1.5 px-3 py-1.5 border border-gray-200 rounded-lg text-xs font-medium text-gray-600 hover:border-gray-300 disabled:opacity-50 transition",children:[d?e.jsx(z,{size:13,className:"animate-spin"}):e.jsx(he,{size:13})," Sync record"]}),e.jsxs("button",{type:"button",onClick:f,disabled:p,className:"inline-flex items-center gap-1.5 px-3 py-1.5 border border-gray-200 rounded-lg text-xs font-medium text-gray-600 hover:border-gray-300 disabled:opacity-50 transition",children:[p?e.jsx(z,{size:13,className:"animate-spin"}):e.jsx(A,{size:13})," Export internal"]}),l&&e.jsx("span",{className:"text-[11px] text-gray-400",children:l})]}),s&&e.jsxs("div",{className:"bg-violet-50 border border-violet-100 rounded-xl p-4",children:[e.jsx("p",{className:"text-[11px] font-semibold text-violet-500 uppercase tracking-wide mb-1.5",children:"AI Summary"}),e.jsx("p",{className:"text-xs text-violet-900 leading-relaxed",children:s})]}),e.jsx(Be,{criteria:t.evaluation_criteria_results??null}),e.jsx(qe,{dataCollection:t.data_collection??null}),e.jsx(Oe,{latency:t.turn_latency??null}),e.jsx(Pe,{transcript:a}),e.jsx(Fe,{conversationId:t.id,notes:r,onNotesChange:o}),e.jsx(Me,{conversationId:t.id,customerRecap:(i==null?void 0:i.customerRecap)??null,recapStatus:(i==null?void 0:i.recapStatus)??"none",onRecapSaved:m})]})}function Be({criteria:t}){const s=Object.entries(t??{});return s.length===0?null:e.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-4",children:[e.jsx("p",{className:"text-[11px] font-semibold text-gray-500 uppercase tracking-wide mb-2.5",children:"Evaluation criteria"}),e.jsx("dl",{className:"space-y-2.5",children:s.map(([a,r])=>e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("dt",{className:"text-[11px] font-medium text-gray-400 break-words",children:a.replace(/_/g," ")}),e.jsx("dd",{className:"text-xs font-medium text-gray-800 capitalize",children:r.result||"—"})]}),r.rationale&&e.jsx("p",{className:"text-[11px] text-gray-500 leading-relaxed",children:r.rationale})]},a))})]})}function Je(t){return t==null||t===""?"—":typeof t=="object"?JSON.stringify(t):String(t)}function qe({dataCollection:t}){const s=Object.entries(t??{});return s.length===0?null:e.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-4",children:[e.jsx("p",{className:"text-[11px] font-semibold text-gray-500 uppercase tracking-wide mb-2.5",children:"Data points"}),e.jsx("dl",{className:"space-y-2.5",children:s.map(([a,r])=>e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-baseline gap-0.5 sm:gap-3",children:[e.jsx("dt",{className:"text-[11px] font-medium text-gray-400 sm:w-2/5 break-words",title:r.rationale??void 0,children:a.replace(/_/g," ")}),e.jsx("dd",{className:"text-xs text-gray-800 sm:flex-1 break-words whitespace-pre-wrap",children:Je(r.value)})]},a))})]})}
2function He({detail:t,customerView:s,exporting:a,recordMessage:r,onExport:i}){const l=(s==null?void 0:s.summaryTitle)??t.summaryTitle??"Conversation",d=s==null?void 0:s.customerRecap;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:i,disabled:a,className:"inline-flex items-center gap-1.5 px-3 py-1.5 border border-gray-200 rounded-lg text-xs font-medium text-gray-600 hover:border-gray-300 disabled:opacity-50 transition",children:[a?e.jsx(z,{size:13,className:"animate-spin"}):e.jsx(A,{size:13})," Export customer"]}),r&&e.jsx("span",{className:"text-[11px] text-gray-400",children:r})]}),e.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-semibold text-gray-500 uppercase tracking-wide mb-1",children:"Summary"}),e.jsx("p",{className:"text-sm text-gray-900 font-medium",children:l})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-semibold text-gray-500 uppercase tracking-wide mb-1",children:"Customer recap"}),d?e.jsx("p",{className:"text-xs text-gray-700 leading-relaxed whitespace-pre-wrap",children:d}):e.jsx("p",{className:"text-xs text-gray-400",children:"No customer recap published yet."})]})]})]})}function W(t){const s=J(t);if(s)return s;const a=te("UTC"),r=J(a);if(r)return r;const i=new Date;return{year:i.getUTCFullYear(),month:i.getUTCMonth()}}function X({value:t,onChange:s,placeholder:a,clearLabel:r,className:i=""}){const{locale:l,t:d}=I(),p=n.useId(),o=n.useRef(null),[m,g]=n.useState(!1),[f,b]=n.useState(()=>W(t));n.useEffect(()=>{m&&b(W(t))},[m,t]),n.useEffect(()=>{if(!m)return;const c=_=>{var v;(v=o.current)!=null&&v.contains(_.target)||g(!1)},u=_=>{_.key==="Escape"&&g(!1)};return document.addEventListener("pointerdown",c),document.addEventListener("keydown",u),()=>{document.removeEventListener("pointerdown",c),document.removeEventListener("keydown",u)}},[m]);const x=n.useMemo(()=>ye(f.year,f.month),[f]),N=n.useMemo(()=>xe(l),[l]),k=te("UTC"),y=t?me(t):"";return e.jsxs("div",{ref:o,className:`relative ${i}`,children:[e.jsxs("button",{type:"button",onClick:()=>g(c=>!c),"aria-haspopup":"dialog","aria-expanded":m,"aria-controls":p,className:`inline-flex w-full min-w-[9.5rem] items-center gap-2 rounded-lg border px-3 py-2 text-sm transition focus:outline-none focus:border-violet-400 ${t?"border-gray-200 text-gray-900":"border-gray-200 text-gray-400"}`,children:[e.jsx(be,{size:14,className:"shrink-0 text-gray-400"}),e.jsx("span",{className:"truncate",children:y||a}),t?e.jsx("span",{role:"button",tabIndex:0,"aria-label":r,className:"ml-auto shrink-0 rounded p-0.5 text-gray-300 hover:bg-gray-100 hover:text-gray-500",onClick:c=>{c.stopPropagation(),s(""),g(!1)},onKeyDown:c=>{c.key!=="Enter"&&c.key!==" "||(c.preventDefault(),c.stopPropagation(),s(""),g(!1))},children:e.jsx(Z,{size:12})}):null]}),m?e.jsxs("div",{id:p,role:"dialog","aria-label":a,className:"absolute left-0 z-50 mt-1 w-[17rem] max-w-[calc(100vw-2rem)] rounded-xl border border-gray-200 bg-white p-3 shadow-lg",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[e.jsx("p",{className:"text-sm font-semibold text-gray-900 first-letter:uppercase",children:ue(f.year,f.month,l)}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx("button",{type:"button",onClick:()=>b(c=>B(c.year,c.month,-1)),className:"rounded-md p-1 text-gray-500 hover:bg-gray-100","aria-label":d("agentEdit.calendarSchedule.prevMonth"),children:e.jsx(se,{size:16})}),e.jsx("button",{type:"button",onClick:()=>b(c=>B(c.year,c.month,1)),className:"rounded-md p-1 text-gray-500 hover:bg-gray-100","aria-label":d("agentEdit.calendarSchedule.nextMonth"),children:e.jsx(V,{size:16})})]})]}),e.jsx("div",{className:"mb-1 grid grid-cols-7 gap-1",children:N.map((c,u)=>e.jsx("div",{className:"py-1 text-center text-[10px] font-semibold uppercase tracking-wide text-gray-400",children:c},u))}),e.jsx("div",{className:"grid grid-cols-7 gap-1",children:x.map(c=>{const u=Number(c.slice(8,10)),_=Number(c.slice(5,7))-1===f.month,v=c===t,$=c===k;let w="aspect-square rounded-lg text-sm transition select-none ";return v?w+="bg-violet-600 font-semibold text-white shadow-sm":_?w+="text-gray-700 hover:bg-violet-50":w+="text-gray-300",$&&!v&&(w+=" ring-1 ring-inset ring-violet-300"),e.jsx("button",{type:"button",disabled:!_,onClick:()=>{s(c),g(!1)},className:w+(_?" cursor-pointer":" cursor-default"),children:u},c)})})]}):null]})}function Ke({search:t,outcome:s,dateFrom:a,dateTo:r,onSearchChange:i,onOutcomeChange:l,onDateFromChange:d,onDateToChange:p}){const{t:o}=I();return e.jsxs("div",{className:"bg-white rounded-xl border border-gray-100 p-3 mb-4 flex flex-wrap gap-2",children:[e.jsxs("div",{className:"relative flex-1 min-w-[180px]",children:[e.jsx(je,{size:13,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-300"}),e.jsx("input",{value:t,onChange:m=>i(m.target.value),className:"w-full pl-8 pr-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:border-violet-400 transition",placeholder:"Search agent or summary…"})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{value:s,onChange:m=>l(m.target.value),className:"appearance-none pl-3 pr-8 py-2 text-sm border border-gray-200 rounded-lg bg-white focus:outline-none focus:border-violet-400 cursor-pointer",children:[e.jsx("option",{value:"",children:"All statuses"}),e.jsx("option",{value:"success",children:"Successful"}),e.jsx("option",{value:"failure",children:"Failed"})]}),e.jsx(Ne,{size:12,className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"})]}),e.jsx(X,{value:a,onChange:d,placeholder:o("calls.dateFrom"),clearLabel:o("calls.dateClear"),className:"w-full sm:w-auto"}),e.jsx(X,{value:r,onChange:p,placeholder:o("calls.dateTo"),clearLabel:o("calls.dateClear"),className:"w-full sm:w-auto"})]})}function We({conversations:t,loading:s,offset:a,total:r,onOffsetChange:i,onOpenDetail:l}){const d=Math.ceil(r/L)||1,p=Math.floor(a/L)+1;return s?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx("div",{className:"animate-spin w-7 h-7 border-4 border-violet-500 border-t-transparent roun
2ded-full"})}):t.length===0?e.jsxs("div",{className:"bg-white rounded-xl border border-gray-100 p-16 text-center",children:[e.jsx(pe,{size:40,className:"mx-auto text-gray-200 mb-3"}),e.jsx("h3",{className:"text-sm font-semibold text-gray-600 mb-1",children:"No conversations yet"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Conversations will appear here once your agents start handling them."})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bg-white rounded-xl border border-gray-100 overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-50",children:[e.jsx("th",{className:"px-4 py-2.5 text-left text-[11px] font-medium text-gray-400 uppercase tracking-wide",children:"Date"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-[11px] font-medium text-gray-400 uppercase tracking-wide",children:"Agent"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-[11px] font-medium text-gray-400 uppercase tracking-wide",children:"Summary"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-[11px] font-medium text-gray-400 uppercase tracking-wide",children:"Duration"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-[11px] font-medium text-gray-400 uppercase tracking-wide",children:"Call"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-[11px] font-medium text-gray-400 uppercase tracking-wide",children:"Status"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-[11px] font-medium text-gray-400 uppercase tracking-wide",children:"Goal"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-[11px] font-medium text-gray-400 uppercase tracking-wide",children:"Sentiment"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-[11px] font-medium text-gray-400 uppercase tracking-wide",children:"Source"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-[11px] font-medium text-gray-400 uppercase tracking-wide",children:"TTS"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-50",children:t.map(o=>{var m;return e.jsxs("tr",{onClick:()=>l(o.conversation_id),className:"hover:bg-gray-50/70 cursor-pointer transition group",children:[e.jsx("td",{className:"px-4 py-3 text-xs text-gray-500 whitespace-nowrap",children:U(o.start_time_unix_secs)}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:"text-xs font-medium text-gray-700",children:o.agent_name})}),e.jsx("td",{className:"px-4 py-3 max-w-[280px]",children:e.jsx("span",{className:"text-xs text-gray-500 truncate block",children:o.call_summary_title||"—"})}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:e.jsxs("span",{className:"text-xs text-gray-500 flex items-center gap-1",children:[e.jsx(ve,{size:11,className:"text-gray-300"}),F(o.call_duration_secs)]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(Xe,{status:o.completion_status})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(Ye,{outcome:o.call_successful})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(Ze,{result:o.goal_achieved})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(Qe,{sentiment:o.sentiment})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:"text-[11px] text-gray-400",children:((m=o.conversation_initiation_source)==null?void 0:m.replace(/_/g," "))||"—"})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:"text-[11px] text-gray-500",children:o.tts_provider?o.tts_provider.replace(/_/g," "):"—"})})]},o.conversation_id)})})]})}),e.jsxs("div",{className:"flex items-center justify-between mt-3",children:[e.jsxs("p",{className:"text-xs text-gray-400",children:["Page ",p," of ",d," · ",r," conversations"]}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx("button",{disabled:a===0,onClick:()=>i(o=>Math.max(0,o-L)),className:"p-1.5 border border-gray-200 rounded-lg hover:bg-gray-50 disabled:opacity-30 transition",children:e.jsx(se,{size:15})}),e.jsx("button",{disabled:a+L>=r,onClick:()=>i(o=>o+L),className:"p-1.5 border border-gray-200 rounded-lg hover:bg-gray-50 disabled:opacity-30 transition",children:e.jsx(V,{size:15})})]})]})]})}function Xe({status:t}){return t==="abandoned"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium text-amber-700 bg-amber-50 px-2 py-0.5 rounded-full",children:[e.jsx(ee,{size:10})," Abandoned"]}):t==="failed"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium text-red-500 bg-red-50 px-2 py-0.5 rounded-full",children:[e.jsx(P,{size:10})," Call failed"]}):t==="completed"?e.jsx("span",{className:"text-[11px] text-gray-400",children:"Completed"}):e.jsx("span",{className:"text-[11px] text-gray-400",children:"—"})}function Ye({outcome:t}){return t==="success"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium text-emerald-600 bg-emerald-50 px-2 py-0.5 rounded-full",children:[e.jsx(Q,{size:10})," Success"]}):t==="failure"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium text-red-500 bg-red-50 px-2 py-0.5 rounded-full",children:[e.jsx(P,{size:10})," Failed"]}):e.jsx("span",{className:"text-[11px] text-gray-400",children:"—"})}function Ze({result:t}){return t==="success"?e.jsx("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium text-emerald-600 bg-emerald-50 px-2 py-0.5 rounded-full",children:"Achieved"}):t==="failure"?e.jsx("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium text-amber-700 bg-amber-50 px-2 py-0.5 rounded-full",children:"Missed"}):e.jsx("span",{className:"text-[11px] text-gray-400",children:"—"})}function Qe({sentiment:t}){const s=t==null?void 0:t.label;return s==="positive"?e.jsx("span",{className:"text-[11px] font-medium text-emerald-600 bg-emerald-50 px-2 py-0.5 rounded-full",children:"Positive"}):s==="negative"?e.jsx("span",{className:"text-[11px] font-medium text-red-500 bg-red-50 px-2 py-0.5 rounded-full",children:"Negative"}):s==="neutral"?e.jsx("span",{className:"text-[11px] font-medium text-gray-600 bg-gray-50 px-2 py-0.5 rounded-full",children:"Neutral"}):e.jsx("span",{className:"text-[11px] text-gray-400",children:"—"})}function mt(){const{t}=I(),s=Re();return e.jsxs("div",{children:[s.integrationDown&&e.jsxs("div",{className:"mb-4 flex items-center gap-2 rounded-lg border border-amber-300 bg-amber-50 px-4 py-3 text-amber-800 text-sm",children:[e.jsx(ee,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{children:s.integrationDetail||t("calls.integrationDown")})]}),e.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-900",children:t("calls.title")}),e.jsxs("p",{className:"text-gray-400 text-sm mt-0.5",children:[s.total," ",t("calls.total")]})]}),e.jsxs("button",{onClick:()=>$e(s.convs),className:"inline-flex items-center gap-1.5 px-3 py-1.5 border border-gray-200 rounded-lg text-xs font-medium text-gray-500 hover:border-gray-300 hover:text-gray-700 transition",children:[e.jsx(A,{size:13})," ",t("calls.export")]})]}),e.jsx(Ke,{search:s.search,outcome:s.outcome,dateFrom:s.dateFrom,dateTo:s.dateTo,onSearchChange:s.setSearch,onOutcomeChange:s.setOutcome,onDateFromChange:s.setDateFrom,onDateToChange:s.setDateTo}),e.jsx(We,{conversations:s.convs,loading:s.loading,offset:s.offset,total:s.total,onOffsetChange:s.setOffset,onOpenDetail:s.openDetail}
2),s.selected&&e.jsx(Ue,{detail:s.detail,loading:s.detailLoading,onClose:s.closeDetail})]})}export{mt 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.