1import{aC as We,r,u as ve,j as t,aD as R,aE as g,aF as Be,c as Pe}from"./index-CyIDn5oY.js";import{g as Fe,R as ue,s as Oe}from"./ReplyButtons-CcKIjPp_.js";import{S as Ke}from"./StoppedLinkNotice-DhI6P17-.js";import{A as ge}from"./emailActions-CidhdU_b.js";import{p as De}from"./resolution.functions-CPMNqOIM.js";import{g as Ie,r as Le,s as Me,a as He}from"./plan.functions-NJR93Zfx.js";const Ve={critical:"#b42318",high:"#b54708",medium:"#a86a16",low:"#0088b0"},Ye={customer:"Customer",affiliate:"Affiliate",internal:"Our staff",spam:"Spam",other:"Other"},fe=[{v:"right",label:"Right",color:"#0a8f66",sub:null},{v:"wrong_flag",label:"AI misread it",color:"#b0472e",sub:"Teaches the model, for everyone"},{v:"not_for_me",label:"Right, not for me",color:"#0088b0",sub:"Stops this alert for you right away"}],M=(l,m)=>{if(!l)return"";const v=new Date(l);return Number.isNaN(v.getTime())?"":v.toLocaleString("en-US",{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",...m?{timeZone:m}:{}})+(m?` ${Be(m,v)}`:"")},Ue=l=>l==null?null:`${l<=-.1?"Negative":l>=.1?"Positive":"Neutral"} tone`,Ze=` 2.erv-page{min-height:100dvh;display:grid;place-items:start center;background:#f6f5f4;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif;color:#201e1d;padding:24px} 3.erv-card{background:#fff;border-radius:16px;box-shadow:0 1px 3px rgba(0,0,0,.06);max-width:640px;width:100%;box-sizing:border-box;padding:30px} 4.erv-kicker{font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:#b0472e;font-weight:700} 5.erv-h1{font-size:21px;font-weight:700;margin:6px 0 0;line-height:1.3;overflow-wrap:anywhere} 6.erv-meta{font-size:13px;color:#6b6864;margin-top:6px;line-height:1.6;overflow-wrap:anywhere} 7.erv-sec{margin-top:20px} 8.erv-label{font-size:11px;letter-spacing:.08em;text-transform:uppercase;font-weight:700;color:#6f8494;margin-bottom:8px} 9.erv-panel{background:#f1fafc;border-radius:10px;padding:13px 15px;font-size:14.5px;line-height:1.6} 10.erv-note{background:#fbf3df;border:1px solid rgba(191,125,36,.35);border-radius:10px;padding:10px 13px;font-size:13px;line-height:1.55} 11.erv-flag{border:1.5px solid #ebe8e4;border-radius:12px;padding:12px 14px;margin-top:10px} 12.erv-flaghd{display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:14px;font-weight:700} 13.erv-sev{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.05em} 14.erv-quote{margin:8px 0 0;padding:6px 12px;border-left:3px solid #dcdad5;font-size:13.5px;line-height:1.55;color:#4a4744} 15.erv-opts{display:flex;gap:6px;flex-wrap:wrap;margin-top:10px} 16.erv-opt{flex:1 1 150px;min-height:40px;border-radius:9px;padding:8px 10px;font:inherit;font-size:13px;font-weight:600;cursor:pointer;background:#fff;color:#4a4744;border:1.5px solid #dcdad5} 17.erv-sub{font-size:11.5px;color:#9a9793;margin-top:5px} 18.erv-in{width:100%;box-sizing:border-box;border:1px solid #dcdad5;border-radius:9px;padding:9px 11px;min-height:40px;font:inherit;font-size:13px;margin-top:8px;background:#fff} 19.erv-rate{display:flex;gap:8px;margin-top:4px} 20.erv-rate button{flex:1;min-height:40px;border-radius:9px;padding:9px 10px;font:inherit;font-size:13px;font-weight:600;cursor:pointer;background:#fff;color:#4a4744;border:1.5px solid #dcdad5} 21.erv-save{margin-top:12px;width:100%;min-height:42px;border:none;background:#201e1d;color:#fff;border-radius:9px;padding:10px 14px;font:inherit;font-size:14px;font-weight:600;cursor:pointer} 22.erv-save:disabled{opacity:.5;cursor:default} 23.erv-funnel{display:flex;flex-direction:column;gap:7px} 24.erv-funnel button{display:block;text-align:left;border-radius:11px;padding:12px 14px;cursor:pointer;font:inherit;border:1.5px solid #dcdad5;background:#fff;min-height:40px} 25.erv-funnel button.on{border-color:#0a8f66;background:#e6f5ef} 26.erv-link{border:none;background:transparent;color:#b0472e;font:inherit;font-weight:700;text-decoration:underline;cursor:pointer;min-height:40px;padding:0 4px} 27.erv-ok{font-size:12.5px;color:#0a8f66;font-weight:600;margin-top:10px} 28.erv-muted{font-size:12px;color:#0a6e50;margin-top:6px;line-height:1.5} 29.erv-quiet{font-size:12px;color:#9a9793;margin-top:6px;line-height:1.5} 30.erv-text{white-space:pre-wrap;font-size:14px;line-height:1.6;overflow-wrap:anywhere;background:#faf9f8;border-radius:10px;padding:12px 14px} 31.erv-thread{font-size:13px;line-height:1.5} 32.erv-thread .it{padding:8px 0;border-top:1px solid #efedea} 33.erv-thread .it:first-child{border-top:none} 34.erv-thread .sum{font-weight:400;color:#6b6864;padding-top:2px} 35.erv-foot{font-size:12px;color:#9a9793;margin-top:22px;line-height:1.5} 36.erv-foot a{color:#006786;font-weight:600;text-decoration:none} 37@media (max-width:820px){ 38 .erv-page{padding:12px 12px calc(16px + env(safe-area-inset-bottom))} 39 .erv-card{padding:22px 16px;border-radius:14px} 40 .erv-sec{margin-top:14px} 41 .erv-card input,.erv-card textarea{font-size:16px!important} 42} 43`;function at(){const{token:l}=We.useSearch(),[m,v]=r.useState("loading"),[o,xe]=r.useState(null),[H,V]=r.useState({}),[Y,U]=r.useState({}),[E,Z]=r.useState(null),[$,G]=r.useState(""),[p,J]=r.useState(!1),[d,b]=r.useState(null),[Q,y]=r.useState(null),[X,ee]=r.useState(null),[te,A]=r.useState([]);r.useEffect(()=>{(async()=>
43{if(!l)return v("invalid");try{const e=await Fe({data:{token:l}});if(!e.found||!e.email)return v("invalid");const a={},s={};for(const n of e.feedbackItems)a[n.flagKey]=n.verdict,n.why&&(s[n.flagKey]=n.why);V(a),U(s),Z(e.feedback),xe(e),v("ready")}catch(e){const a=ve(e);a?(ee(a),v("stopped")):v("error")}})()},[l]);const ae=new Set(o?.matchedFlags??[]),W=(o?.flags??[]).filter(e=>ae.has(e.key)&&o?.flagAlertModes[e.key]!=="context"),se=e=>H[e]??(E==="bad"?void 0:"right"),j=E==="bad"?W.filter(e=>!H[e.key]).map(e=>e.key):[],B=async()=>{if(!l||!E||p)return!1;if(j.length)return A(j),document.getElementById(`eflag-${j[0]}`)?.scrollIntoView({behavior:"smooth",block:"center"}),!1;J(!0),y(null),A([]);const e=W.flatMap(a=>{const s=se(a.key);if(!s)return[];const n=s==="right"?"":(Y[a.key]??"").trim();return[{flagKey:a.key,verdict:s,why:n||void 0}]});try{const a=await Oe({data:{token:l,feedback:E,note:h==="handled"?void 0:$.trim()||void 0,items:e}});return b(a),!0}catch(a){const s=ve(a);return s?(ee(s),v("stopped")):y("That did not save. Try again in a moment."),!1}finally{J(!1)}},[h,ye]=r.useState(null),be=e=>{ye(e),Z(e===null?null:e==="bad"?"bad":"good"),b(null)},[w,je]=r.useState(null),[f,C]=r.useState(null),[k,ne]=r.useState(!1),[q,P]=r.useState(null),[F,we]=r.useState(""),[re,ke]=r.useState([]),[oe,Ne]=r.useState(null),[N,ie]=r.useState(!1),[Se,Ce]=r.useState([]),[O,K]=r.useState(!1),[z,le]=r.useState(null),[Te,Re]=r.useState({}),D=async()=>{if(l)try{je(await Ie({data:{token:l}}))}catch{}};r.useEffect(()=>{m==="ready"&&D()},[m]);const I=r.useRef(!1),de=async(e,a)=>{if(!(!l||I.current)){I.current=!0,ne(!0),P(null);try{const s=await De({data:{token:l,explanation:e.trim(),reuse:a}});C(s.actions.map(n=>({...n,accepted:!0}))),(s.patterns.length||!e.trim())&&ke(s.patterns),Ne(s.draftedAt?{at:s.draftedAt,reused:!!s.reused}:null)}catch(s){P(s instanceof Error?s.message:"Couldn't draft the plan.")}finally{I.current=!1,ne(!1)}}},S=w?.steps??[];r.useEffect(()=>{h!=="act"||f||k||q||!w||S.length||de("",!0)},[h,f,k,q,w]);const x=(e,a)=>C(s=>s&&s.map((n,c)=>c===e?{...n,...a}:n)),_e=e=>C(a=>[...a??[],{kind:e,owner:e==="reply_customer"?o?.reply?.to[0]??"":e==="train_employee"?w?.staff??"":"",subject:"",detail:"",whatDid:"",shouldHave:"",why:"",accepted:!0}]),ce=e=>!!e.trim()&&!!w?.team.some(a=>a.noManager&&a.name===e.trim()),Ee=async()=>{if(!(!l||p)&&await B())try{await Le({data:{token:l,note:$.trim()||void 0}}),K(!0)}catch(e){y(e instanceof Error?e.message:"That did not save. Try again in a moment.")}},$e=async()=>{if(!l||N||!f)return;const e=f.filter(n=>n.accepted&&[n.owner,n.detail,n.subject,n.whatDid,n.shouldHave].some(c=>c&&c.trim())||n.accepted&&n.kind==="reply_customer");if(e.some(n=>n.kind==="escalate"&&!n.owner.trim())){y("Pick who the escalation goes to.");return}const a=e.filter(n=>n.kind==="escalate").length,s=e.filter(n=>n.kind==="train_employee"&&n.owner.trim()&&!ce(n.owner)).length;if(!((a||s)&&!await Pe({title:"Confirm the plan?",body:`${a?`${a===1?"The escalation goes":`${a} escalations go`} out now, with a link to the email and a mark solved button. `:""}${s?`${s===1?"The coaching note goes":`${s} coaching notes go`} to each person's manager now, for a face-to-face talk; nothing goes to the person. `:""}A sent email cannot be taken back. Nothing is sent to the customer.`,confirmLabel:"Confirm and send"}))){ie(!0),y(null);try{if(!await B())return;const n=await Me({data:{token:l,items:e.map(c=>({kind:c.kind,owner:c.owner.trim()||void 0,detail:c.detail.trim()||void 0,subject:c.subject.trim()||void 0,whatDid:c.whatDid.trim()||void 0,shouldHave:c.shouldHave.trim()||void 0,done:!1}))}});Ce(n.sent),n.resolved&&K(!0),C(null),await D()}catch(n){y(n instanceof Error?n.message:"Couldn't save the plan.")}finally{ie(!1)}}},he=async(e,a)=>{if(!(!l||z)){le(e);try{(await He({data:{token:l,id:e,done:a}})).resolved&&K(!0),await D()}catch(s){y(s instanceof Error?s.message:"Couldn't save that.")}finally{le(null)}}};if(m==="loading")return t.jsx(_,{children:t.jsx("div",{style:{fontSize:14,color:"#6b6864"},children:"Loadingâ¦"})});if(m==="stopped"&&X)return t.jsx(_,{children:t.jsx(Ke,{...X})});if(m==="invalid")return t.jsxs(_,{children:[t.jsx("div",{className:"erv-h1",children:"This link is no longer valid."}),t.jsx("div",{className:"erv-meta",children:"Open TeleServ and find the email under Emails."})]});
43if(m==="error"||!o||!o.email)return t.jsxs(_,{children:[t.jsx("div",{className:"erv-h1",children:"Something went wrong."}),t.jsx("div",{className:"erv-meta",children:"Reload the page in a moment."})]});const i=o.email,qe=i.fromName?`${i.fromName} <${i.fromAddress}>`:i.fromAddress,pe=[i.senderType?Ye[i.senderType]??i.senderType:null,i.topic,Ue(i.sentiment),i.language&&i.language!=="en"?`Written in ${i.language.toUpperCase()}`:null].filter(Boolean),ze=!!d&&d.learned>0;return t.jsxs(_,{children:[t.jsxs("div",{className:"erv-kicker",children:[o.orgName?`${o.orgName} · `:"","Email flagged for review"]}),t.jsx("div",{className:"erv-h1",children:i.subject||"(no subject)"}),t.jsxs("div",{className:"erv-meta",children:["From ",qe,i.forwardedBy?`, forwarded by ${i.forwardedBy}`:"",t.jsx("br",{}),M(i.receivedAt,o.timezone),i.deliveredTo?` · to ${i.deliveredTo}`:"",pe.length?t.jsxs(t.Fragment,{children:[t.jsx("br",{}),pe.join(" · ")]}):null]}),o.why&&t.jsxs("div",{className:"erv-meta",children:['You got this because of the alert rule "',o.why,'".']}),i.summary&&t.jsx("div",{className:"erv-sec",children:t.jsx("div",{className:"erv-panel",children:i.summary})}),i.injectionSuspected&&t.jsx("div",{className:"erv-sec",children:t.jsx("div",{className:"erv-note",children:"This email contains text aimed at an AI. TeleServ ignored it."})}),t.jsxs("div",{className:"erv-sec",children:[t.jsx("div",{className:"erv-label",children:"What TeleServ flagged"}),!o.flags.length&&t.jsx("div",{className:"erv-quiet",children:"No flags on this email any more. It may have been read again since the alert."}),o.flags.map(e=>{const a=o.flagAlertModes[e.key]==="context",s=ae.has(e.key),n=se(e.key),c=fe.find(u=>u.v===n),me=!n&&te.includes(e.key);return t.jsxs("div",{id:`eflag-${e.key}`,className:"erv-flag",style:me?{borderColor:"#b0472e"}:void 0,children:[t.jsxs("div",{className:"erv-flaghd",children:[R(e.key),e.severity&&t.jsx("span",{className:"erv-sev",style:{color:Ve[e.severity]??"#6b6864"},children:e.severity}),a&&t.jsx("span",{className:"erv-sev",style:{color:"#9a9793"},children:"Context only"}),!a&&!s&&t.jsx("span",{className:"erv-sev",style:{color:"#9a9793"},children:"Not part of this alert"})]}),t.jsx("blockquote",{className:"erv-quote",children:e.quote}),!a&&s&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"erv-opts",children:fe.map(u=>{const L=n===u.v;return t.jsx("button",{className:"erv-opt",disabled:p,onClick:()=>{V(T=>({...T,[e.key]:u.v})),A(T=>T.filter(Ae=>Ae!==e.key)),b(null)},style:L?{borderColor:u.color,background:u.color,color:"#fff"}:void 0,children:u.label},u.v)})}),c?.sub&&t.jsx("div",{className:"erv-sub",children:c.sub}),me&&t.jsx("div",{className:"erv-sub",style:{color:"#b0472e",fontWeight:600},children:"Choose one answer for this flag."}),n&&n!=="right"&&t.jsx("input",{className:"erv-in",value:Y[e.key]??"",maxLength:1e3,disabled:p,onChange:u=>{const L=u.target.value;U(T=>({...T,[e.key]:L})),b(null)},placeholder:n==="wrong_flag"?"What the email really says (optional)":"Why it is not for you (optional)"})]})]},e.ruleId)})]}),t.jsxs("div",{className:"erv-sec",children:[t.jsx("div",{className:"erv-label",children:"Was this alert worth your attention?"}),t.jsx("div",{className:"erv-funnel",children:[{v:"bad",title:"Not worth it",sub:"Right flag, not worth an alert. Teaches TeleServ, closes the conversation"},{v:"handled",title:"Worth it, already handled",sub:"Say how, and it resolves"},{v:"act",title:"Worth it, needs action",sub:"A plan is suggested for you; adjust it if needed"}].map(e=>{const a=h===e.v;return t.jsxs("button",{disabled:p||N,onClick:()=>be(a?null:e.v),className:a?"on":"",children:[t.jsx("span",{style:{display:"block",fontSize:14,fontWeight:600,color:"#201e1d"},children:e.title}),t.jsx("span",{style:{display:"block",fontSize:12,color:"#9a9793",marginTop:1},children:e.sub})]},e.v)})}),h==="bad"&&W.length>0&&t.jsx("div",{className:"erv-sub",children:"Answer each flag above. Right on an alert that was not worth it teaches TeleServ the flag was correct but not worth interrupting anyone."}),h==="bad"&&t.jsxs(t.Fragment,{children:[t.jsx("input",{className:"erv-in",value:$,maxLength:1e3,disabled:p,onChange:e=>{G(e.target.value),b(null)},placeholder:"Why wasn't it useful? (optional)"}),t.jsx("button",{className:"erv-save",disabled:p,onClick:()=>{B()},children:p?"Savingâ¦":"Send feedback and close"})]}),h==="handled"&&t.jsxs(t.Fragment,{children:[t.jsx("textarea",{className:"erv-in",rows:2,value:$,maxLength:1e3,disabled:p,onChange:e=>{G(e.target.value),b(null)},placeholder:"How was it handled? For example: replied from Outlook, the invoice was fixed"}),t.jsx("button",{className:"erv-save",style:{background:"#0a8f66"},disabled:p||O,onClick:()=>{Ee()},children:p?"Savingâ¦":O?"Resolved":"Mark resolved"})]}),h==="act"&&!S.length&&t.jsxs("div",{style:{marginTop:12},children:[k&&!f&&t.jsx("div",{className:"erv-quiet",children:"Reading the email and suggesting a planâ¦"}),q&&t.jsxs("div",{className:"erv-quiet",style:{color:"#b0472e"},children:["Couldn't suggest a plan from the email: ",q," ",t.jsx("button",{className:"erv-link",onClick:()=>P(null),children:"Try again"})]}),f&&t.jsxs(t.Fragment,{children:[re.length>0&&t.jsxs("div",{className:"erv-panel",style:{fontSize:13,marginBottom:10},children:[t.jsx("b",{children:"Patterns"})," · From this sender's and the agent's history",re.map((e,a)=>t.jsxs("div",{children:["· ",e]},a))]}),t.jsx("div",{className:"erv-label",style:{marginTop:4},children:"Suggested plan"}),oe?.reused&&t.jsxs("div",{className:"erv-quiet",style:{marginTop:0,marginBottom:6},children:["Saved draft from ",M(oe.at,o.timezone),". Redo drafts a new one."]}),f.length===0&&t.jsx("div",{className:"erv-quiet",children:"Nothing to do based on the email alone. Add a step below, or confirm to resolve it."}),f.map((e,a)=>t.jsxs("div",{className:"erv-flag",style:{opacity:e.accepted?1:.6},children:[t.jsxs("label",{className:"erv-flaghd",style:{cursor:"pointer"},children:[t.jsx("input",{type:"checkbox",checked:e.accepted,onChange:s=>x(a,{accepted:s.target.checked}),style:{width:16,height:16}}),e.kind==="reply_customer"?"Reply to the customer":e.kind==="train_employee"?"Coach and train":e.kind==="escalate"?"Escalate internally":"Check on something",e.why&&t.jsxs("span",{className:"erv-sev",style:{color:"#9a9793",textTransform:"none",letterSpacing:0,fontWeight:400},children:["· ",e.why]})]}),e.accepted&&e.kind==="reply_customer"&&t.jsxs(t.Fragment,{children:[t.jsx("textarea",{className:"erv-in",rows:6,value:e.detail,onChange:s=>x(a,{detail:s.target.value}),placeholder:"The replyâ¦"}),t.jsx("div",{className:"erv-quiet",children:"TeleServ never sends it. After Confirm, Reply opens it in your own mail."})]}),e.accepted&&e.kind==="train_employee"&&t.jsxs(t.Fragment,{children:[t.jsx("input",{list:"erv-team",className:"erv-in",value:e.owner,onChange:s=>x(a,{owner:s.target.value}),placeholder:"Agent (pick a name)"}),t.jsx("input",{className:"erv-in",value:e.subject,onChange:s=>x(a,{subject:s.target.value}),placeholder:"Subject"}),t.jsx("textarea",{className:"erv-in",rows:2,value:e.whatDid,onChange:s=>x(a,{whatDid:s.target.value}),placeholder:"What happenedâ¦"}),t.jsx("textarea",{className:"erv-in",rows:2,value:e.shouldHave,onChange:s=>x(a,{shouldHave:s.target.value}),placeholder:"What to do next timeâ¦"}),ce(e.owner)&&t.jsx("div",{className:"erv-quiet",children:`${e.owner.trim()} has no manager with an email on the roster, so the note is saved and not sent.`})]}),e.accepted&&(e.kind==="escalate"||e.kind==="follow_up")&&t.jsxs(t.Fragment,{children:[t.jsx("input",{list:"erv-team",className:"erv-in",value:e.owner,onChange:s=>x(a,{owner:s.target.value}),placeholder:e.kind==="escalate"?"Assign to (pick a name from the team)":"Owner (optional)"}),t.jsx("textarea",{className:"erv-in",rows:3,value:e.detail,onChange:s=>x(a,{detail:s.target.value}),placeholder:e.kind==="escalate"?"What happened and what needs decidingâ¦":"What to checkâ¦"})]})]},a)),t.jsx("datalist",{id:"erv-team",children:(w?.team??[]).map(e=>t.jsx("option",{value:e.name},`${e.kind}${e.name}`))}),t.jsx("div",{className:"erv-opts",children:[["reply_customer","Reply to the customer"],["escalate","Escalate internally"],["train_employee","Coach and train"],["follow_up","Check on something"]].map(([e,a])=>t.jsxs("button",{className:"erv-opt",style:{flex:"0 1 auto",borderStyle:"dashed"},disabled:N,onClick:()=>_e(e),children:["+ ",a]},e))}),t.jsx("textarea",{className:"erv-in",rows:2,value:F,onChange:e=>we(e.target.value),placeholder:"Not quite right? Say what to change, for example: we already fixed the invoice, skip the coaching"}),t.jsxs("div",{style:{display:"flex",gap:8},children:[t.jsx("button",{className:"erv-save",style:{background:"#0088b0"},disabled:N||k,onClick:()=>{$e()},children:N?"Workingâ¦":"Confirm the plan"}),t.jsx("button",{className:"erv-save",style:{background:"#fff",color:"#4a4744",border:"1px solid #dcdad5",flex:"0 0 auto",width:"auto"},disabled:N||k,onClick:()=>{C(null),de(F.trim().length>=3?F:"",!1)},children:k?"Redraftingâ¦":"Redo"})]}),t.jsx("div",{className:"erv-quiet",children:"Escalations go out on Confirm. A coaching note goes to the person's manager, never the person. The reply waits for you below. Everything is saved on the email in TeleServ."})]})]}),S.length>0&&(h==="act"||h===null)&&t.jsxs("div",{style:{marginTop:12},children:[t.jsx("div",{className:"erv-label",children:"The plan"}),S.map(e=>t.jsxs("div",{className:"erv-flag",children:[t.jsxs("div",{className:"erv-flaghd",children:[e.done?"Done: ":"",e.kind==="reply_customer"?"Reply to the customer":e.kind==="train_employee"?`Coaching note for ${e.owner??"the agent"}`:e.kind==="escalate"?`Escalation to ${e.owner??"the team"}`:e.detail??"Check on something"]}),e.kind==="reply_customer"&&!e.done&&o.reply&&t.jsxs(t.Fragment,{children:[e.detail&&t.jsx("div",{className:"erv-text",style:{marginTop:8},children:e.detail}),t.jsx(ue,{app:o.reply.app,reply:o.reply,draft:e.detail,onOpened:()=>Re(a=>({...a,[e.id]:!0}))}),Te[e.id]&&t.jsx("button",{className:"erv-save",disabled:z===e.id,onClick:()=>{he(e.id,!0)},children:z===e.id?"Savingâ¦":"I sent it"})]}),e.kind==="follow_up"&&!e.done&&t.jsx("button",{className:"erv-opt",style:{marginTop:8},disabled:z===e.id,onClick:()=>{he(e.id,!0)},children:"Mark done"})]},e.id))]}),Se.map((e,a)=>t.jsx("div",{className:e.sent?"erv-ok":"erv-quiet",children:e.sent?`${e.kind==="escalate"?"Escalation sent to":"Coaching note sent to the manager of"} ${e.to}.`:`${e.kind==="escalate"?"Escalation":"Coaching note"} not sent: ${e.why??"unknown reason"}.`},a)),O&&t.jsx("div",{className:"erv-ok",children:"The email is resolved."}
43),!h&&!S.length&&t.jsx("div",{className:"erv-quiet",children:"Choose an answer to save."}),h&&j.length>0&&t.jsxs("div",{className:"erv-quiet",style:te.length?{color:"#b0472e",fontWeight:600}:void 0,children:[j.map(e=>R(e)).join(" and ")," still ",j.length===1?"needs":"need"," an answer above."]}),Q&&t.jsx("div",{className:"erv-quiet",style:{color:"#b0472e"},children:Q}),d&&!p&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"erv-ok",children:ze?"Saved. TeleServ reads this on every email and call.":d.changes.length?"Saved. Your alerts will be narrowed for this flag.":"Saved."}),d.conversation==="closed"&&t.jsx("div",{className:"erv-quiet",children:g.alertClosed}),d.conversation==="reopened"&&t.jsx("div",{className:"erv-quiet",children:g.alertReopened}),d.conversation==="kept_open"&&t.jsx("div",{className:"erv-quiet",children:g.alertKeptOpen}),d.conversation==="kept_open_flag"&&t.jsx("div",{className:"erv-quiet",children:g.alertKeptOpenFlag}),d.conversation==="already_resolved"&&t.jsx("div",{className:"erv-quiet",children:g.alertAlreadyResolved}),d.conversation==="already_closed"&&t.jsx("div",{className:"erv-quiet",children:g.alertAlreadyClosed}),d.conversation==="kept_resolved"&&t.jsx("div",{className:"erv-quiet",children:g.alertKeptResolved}),d.conversation==="kept_open_other"&&t.jsx("div",{className:"erv-quiet",children:g.alertKeptOpenOther}),d.conversation==="reopened_resolve"&&t.jsx("div",{className:"erv-quiet",children:g.alertReopenedResolve}),d.conversation==="back_to_resolve"&&t.jsx("div",{className:"erv-quiet",children:g.alertBackToResolve}),d.changes.map(e=>{const a=d.changes.filter(s=>s.flagKey===e.flagKey).length>1||d.notMuted.some(s=>s.flagKey===e.flagKey);return t.jsxs("div",{className:"erv-muted",children:[R(e.flagKey)," no longer alerts you",a?` through "${e.ruleTitle}"`:"",". It still shows on the email. You can turn it back on under Settings, Notifications."]},`${e.flagKey}:${e.ruleTitle}`)}),d.notMuted.map(e=>{const a=d.changes.some(s=>s.flagKey===e.flagKey);return t.jsx("div",{className:"erv-quiet",children:a?`${R(e.flagKey)} still reaches you through a shared rule: ${e.why}.`:`Right, not for me could not change your alerts for ${R(e.flagKey)}: ${e.why}.`},e.flagKey)})]})]}),t.jsxs("div",{className:"erv-sec",children:[t.jsx("div",{className:"erv-label",children:"What the sender wrote"}),t.jsx("div",{className:"erv-text",children:i.newText||"(no text)"}),i.attachments.length>0&&t.jsxs("div",{className:"erv-quiet",children:["Attachments: ",i.attachments.map(e=>e.name).filter(Boolean).join(", "),". TeleServ keeps only their names."]})]}),o.reply&&!S.some(e=>e.kind==="reply_customer")&&h!=="act"&&t.jsxs("div",{className:"erv-sec",children:[t.jsx("div",{className:"erv-label",children:ge.replyTitle}),t.jsx("div",{className:"erv-quiet",style:{marginTop:0,marginBottom:2},children:ge.replySub}),t.jsx(ue,{app:o.reply.app,reply:o.reply})]}),o.thread.length>1&&t.jsxs("div",{className:"erv-sec",children:[t.jsx("div",{className:"erv-label",children:"This conversation"}),t.jsx("div",{className:"erv-thread",children:o.thread.map(e=>t.jsxs("div",{className:"it",style:e.current?{fontWeight:600}:void 0,children:[M(e.receivedAt,o.timezone)," · ",e.from,e.current?" (this email)":"",e.summary&&t.jsx("div",{className:"sum",children:e.summary})]},e.id))})]}),t.jsxs("div",{className:"erv-foot",children:["Card numbers and passwords are masked before TeleServ stores an email. ",t.jsx("a",{href:`/emails/${i.id}`,children:"Open it in TeleServ"})," to see the whole email (sign-in needed)."]})]})}function _({children:l}){return t.jsxs("div",{className:"erv-page",children:[t.jsx("style",{children:Ze}),t.jsx("div",{className:"erv-card",children:l})]})}export{at as component};
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.