1import{l as We,j as e,X as Ve,b as x,a as g,e as t,f as he}from"./index-BxsKcnXk.js";import{b as a,d as Me,L as ue}from"./vendor-BPYN3F7l.js";import{C,q as z,W as pe,L as Q,Q as G,z as me,g as Re,a1 as De,y as _e,E as D,d as Ye,ar as Oe}from"./icons-tq9NNN10.js";function ge(...i){return i.filter(Boolean).join(" ")}function be({open:i,onClose:y,title:u,description:I,children:$,footer:v,size:U="md",className:w="",bodyClassName:H="",closeOnOverlay:Z=!0,closeOnEscape:E=!0}){const B=a.useId(),P=a.useId();if(a.useEffect(()=>{if(!i)return;const f=We(),N=d=>{d.key==="Escape"&&E&&y?.()};return window.addEventListener("keydown",N),()=>{f(),window.removeEventListener("keydown",N)}},[E,y,i]),!i)return null;const F=e.jsx("div",{className:"v-modal-backdrop",role:"presentation",onMouseDown:Z?y:void 0,children:e.jsxs("section",{className:ge("v-modal-surface",`v-modal-size-${U}`,w),role:"dialog","aria-modal":"true","aria-labelledby":u?B:void 0,"aria-describedby":I?P:void 0,onMouseDown:f=>f.stopPropagation(),children:[(u||y)&&e.jsxs("header",{className:"v-modal-header",children:[e.jsxs("div",{children:[u&&e.jsx("h2",{className:"v-modal-title",id:B,children:u}),I&&e.jsx("p",{className:"v-modal-description",id:P,children:I})]}),y&&e.jsx("button",{type:"button",className:"v-modal-close",onClick:y,"aria-label":"Close dialog",children:e.jsx(Ve,{size:18})})]}),e.jsx("div",{className:ge("v-modal-body",H),children:$}),v&&e.jsx("footer",{className:"v-modal-footer",children:v})]})});return Me.createPortal(F,document.body)}function Qe(){const[i,y]=a.useState([]),[u,I]=a.useState([]),[$,v]=a.useState(!1),[U,w]=a.useState(!1),[H,Z]=a.useState(null),[E,B]=a.useState(!0),[P,F]=a.useState(null),[f,N]=a.useState(1),[d,ee]=a.useState("twilio"),[l,A]=a.useState({accountSid:"",authToken:""}),[p,L]=a.useState({authId:"",authToken:"",phoneNumber:""}),[m,W]=a.useState({authId:"",authToken:"",phoneNumber:""}),[_,xe]=a.useState([]),[je,se]=a.useState([]),[V,ne]=a.useState(""),[h,Y]=a.useState({label:"",assistantId:""}),[O,ae]=a.useState(!1),[ve,te]=a.useState(!1),[K,S]=a.useState(!1),[ie,re]=a.useState(new Set),[X,oe]=a.useState(!1);a.useEffect(()=>{k(),fe(),le()},[]);const b=()=>{localStorage.clear(),t("Your session has expired. Please log in again."),window.location.href="/login"},k=async()=>{try{const s=localStorage.getItem("token"),o=(await x.get(g.getApiUrl("/api/phone-numbers"),{headers:{Authorization:`Bearer ${localStorage.getItem("token")}`}})).data;o.success?y(o.phoneNumbers||[]):F(o.error)}catch(s){s.response?.status===401?b():(console.error("Error fetching phone numbers:",s),F("Failed to load phone numbers"))}finally{B(!1)}},fe=async()=>{try{const n=(await x.get(g.getApiUrl("/api/assistants"),{headers:{Authorization:`Bearer ${localStorage.getItem("token")}`}})).data;n.success&&I(n.assistants||[])}catch(s){s.response?.status===401&&b(),console.error("Error fetching assistants:",s)}},le=async()=>{try{const s=await x.get(g.getApiUrl("/api/whatsapp/connections"),{headers:{Authorization:`Bearer ${localStorage.getItem("token")}`}});xe(s.data?.connections||[])}catch(s){s.response?.status===401?b():console.error("Error fetching WhatsApp connections:",s)}},Ne=async()=>{if(!l.accountSid||!l.authToken){t("Please enter both Account SID and Auth Token");return}ae(!0);try{const n=(await x.post(g.getApiUrl("/api/phone-numbers/test-credentials"),l,{headers:{Authorization:`Bearer ${localStorage.getItem("token")}`}})).data;n.success?(t("â
Credentials are valid!"),N(2),ye()):t(`â ${n.error}`)}catch(s){s.response?.status===401?b():t(`â Error testing credentials: ${s.message}`)}finally{ae(!1)}},ye=async()=>{te(!0);try{const n=(await x.post(g.getApiUrl("/api/phone-numbers/fetch-numbers"),l,{headers:{Authorization:`Bearer ${localStorage.getItem("token")}`}})).data;n.success?se(n.phoneNumbers||[]):t(`â ${n.error}`)}catch(s){s.response?.status===401?b():t(`â Error fetching numbers: ${s.message}`)}finally{te(!1)}},we=async()=>{if(!V||!h.label){t("Please select a number and add a label");return}S(!0);try{const s=localStorage.getItem("token"),n=await x.post(g.getApiUrl("/api/phone-numbers/save-credentials"),l,{headers:{Authorization:`Bearer ${s}`}});if(!n.data.success)throw new Error(n.data.error);const o=await x.post(g.getApiUrl("/api/phone-numbers/add"),{phoneNumber:V,label:h.label,assignedAssistantId:h.assistantId||void 0},{headers:{Authorization:`Bearer ${s}`}});if(o.data.success)t("â
Phone number added successfully!"),v(!1),M(),k();else throw new Error(o.data.error)}catch(s){s.response?.status===401?b():t(`â Error: ${s.message}`)}finally{S(!1)}},Ae=async(s,n)=>{const o=i.find(c=>
1String(c.id)===String(s)),r=o?.assignedAssistantId||"";if(r&&String(r)!==String(n)){const c=u.find(J=>J.id===r),j=n?u.find(J=>J.id===n):null,T=c?.name||"another assistant",Le=n?`${o?.phoneNumber||"This number"} is currently assigned to "${T}". Reassign it to "${j?.name||"the selected assistant"}"? Calls on this number will start using the new assistant.`:`${o?.phoneNumber||"This number"} is currently assigned to "${T}". Unassign it? This number will stop routing calls to any assistant.`;if(!await he({title:n?"Reassign phone number":"Unassign phone number",message:Le,confirmLabel:n?"Reassign":"Unassign",cancelLabel:"Cancel",kind:"danger"})){k();return}}re(c=>new Set([...c,s]));try{const c=n?`/api/phone-numbers/${s}/assign-assistant`:`/api/phone-numbers/${s}/unassign`,j=await x.post(g.getApiUrl(c),n?{assignedAssistantId:n}:{},{headers:{Authorization:`Bearer ${localStorage.getItem("token")}`}});if(j.data.success){const T=document.querySelector(`[data-phone-id="${s}"]`);T&&(T.classList.add("update-success"),setTimeout(()=>T.classList.remove("update-success"),2e3)),k()}else t(`â ${j.data.error}`)}catch(c){c.response?.status===401?b():t(`â Error updating assignment: ${c.message}`)}finally{re(c=>{const j=new Set(c);return j.delete(s),j})}},ke=async s=>{const n=i.find(r=>String(r.id)===String(s));if(await he({title:"Remove phone number",message:"Are you sure you want to remove this phone number?",confirmLabel:"Remove number",cancelLabel:"Cancel",kind:"danger"}))try{const r=n?.provider==="whatsapp_business"?n?.metadata?.whatsappConnectionId:"",c=r?`/api/whatsapp/connections/${encodeURIComponent(r)}`:`/api/phone-numbers/${s}`,j=await x.delete(g.getApiUrl(c),{headers:{Authorization:`Bearer ${localStorage.getItem("token")}`}});j.data.success?(k(),le()):t(`â ${j.data.error}`)}catch(r){r.response?.status===401?b():t(`â Error deleting phone number: ${r.message}`)}},Ce=async()=>{if(!l.accountSid||!l.authToken){t("Please enter both Account SID and Auth Token");return}oe(!0);try{const s=localStorage.getItem("token"),n=await fetch(g.getApiUrl("/api/phone-numbers/update-credentials"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify(l)});if(n.status===401){b();return}const o=await n.json();o.success?(t("â
Credentials updated successfully! API keys have been created for human transfer."),w(!1),A({accountSid:"",authToken:""}),k()):t(`â ${o.error}`)}catch(s){t(`â Error updating credentials: ${s.message}`)}finally{oe(!1)}},Se=async()=>{if(!p.authId||!p.authToken||!p.phoneNumber||!h.label){t("Please fill Plivo credentials, phone number, and label");return}S(!0);try{const s=await x.post(g.getApiUrl("/api/phone-numbers/connect-provider-number"),{provider:"plivo_india",authId:p.authId,authToken:p.authToken,phoneNumber:p.phoneNumber,label:h.label,assignedAssistantId:h.assistantId||void 0},{headers:{Authorization:`Bearer ${localStorage.getItem("token")}`}});if(s.data.success)t(s.data.webhookConfigured?"Plivo India number connected successfully.":"Plivo India number connected. Please review webhook status in Plivo."),v(!1),M(),k();else throw new Error(s.data.error)}catch(s){s.response?.status===401?b():t(`Error connecting Plivo number: ${s.response?.data?.error||s.message}`)}finally{S(!1)}},Te=async()=>{if(!m.authId||!m.authToken||!m.phoneNumber||!h.label){t("Please fill Vobiz credentials, phone number, and label");return}S(!0);try{const s=await x.post(g.getApiUrl("/api/phone-numbers/connect-provider-number"),{provider:"vobiz",authId:m.authId,authToken:m.authToken,phoneNumber:m.phoneNumber,label:h.label,assignedAssistantId:h.assistantId||void 0},{headers:{Authorization:`Bearer ${localStorage.getItem("token")}`}});if(s.data.success)t(s.data.webhookConfigured?"Vobiz number connected successfully.":"Vobiz number connected. Please review webhook status in the Vobiz console."),v(!1),M(),k();else throw new Error(s.data.error)}catch(s){s.response?.status===401?b():t(`Error connecting Vobiz number: ${s.response?.data?.error||s.message}`)}finally{S(!1)}},M=()=>{N(1),ee("twilio"),A({accountSid:"",authToken:""}),L({authId:"",authToken:"",phoneNumber:""}),W({authId:"",authToken:"",phoneNumber:""}),se([]),ne(""),Y({label:"",assistantId:""})},q=i.filter(s=>s.assignedAssistantId).length,ce=Math.max(i.length-q,0),Ie=i.length>0?"Connected":"Not connected",Pe=i.filter(s=>s.provider==="plivo_india").length,ze=i.filter(s=>s.provider==="vobiz").length,$e=i.filter(s=>s.provider==="whatsapp_business").length,Ue=i.filter(s=>!s.provider||s.provider==="twilio").length,Ee=`${u.length} ${u.length===1?"assistant":"assistants"}`,R=i.find(s=>s.assignedAssistantId&&(!s.status||s.status==="active")),de=R?`/make-call?assistantId=${encodeURIComponent(R.assignedAssistantId)}`:"/make-call",Be=s=>s.providerLabel||(s.provider==="whatsapp_business"?"WhatsApp Business":s.provider==="plivo_india"?"Plivo India":s.provider==="vobiz"?"Vobiz":"Twilio"),Fe=s=>s.provider==="whatsapp_business"?s.capabilities?.whatsappCalling?"WhatsApp calling ready":"Messaging ready":s.capabilities?.mediaStream===!1?"Voice only":"Live stream ready";return E?e.jsx("div",{className:"phone-numbers",children:e.jsxs("div",{className:"loading-state",children:[e.jsx(C,{className:"loading-spinner"}),e.jsx("p",{children:"Loading phone numbers..."})]})}):e.jsxs("div",{className:"phone-numbers",children:[e.jsxs("div",{className:"page-header phone-numbers-header",children:[e.jsxs("div",{className:"header-content",children:[e.jsxs("span",{className:"page-eyebrow",children:[e.jsx(z,{})," Telephony workspace"]}),e.jsx("h1",{children:"Phone Numbers"}),e.jsx("p",{children:"Connect Twilio, Plivo India, Vobiz, or WhatsApp Business lines, assign each number to the right assistant, and keep live call routing production-ready."}),e.jsxs("div",{className:"header-actions",children:[e.jsxs("button",{className:"btn-primary",onClick:()=>v(!0),children:[e.jsx(pe,{})," Add Phone Number"]}),R&&e.jsxs(ue,{className:"btn-secondary",to:de,style:{textDecoration:"none"},children:[e.jsx(z,{})," Make a Test Call ",e.jsx(Q,{})]}),e.jsxs("button",{className:"btn-secondary",onClick:()=>w(!0),children:[e.jsx(C,{})," Update Twilio Keys"]}),e.jsxs("button",{className:"btn-secondary",type:"button",onClick:()=>{window.location.href="/whatsapp"},children:[e.jsx(G,{})," WhatsApp setup"]})]})]}),e.jsxs("div",{className:"header-routing-card",children:[e.jsx("div",{className:"routing-icon",children:e.jsx(me,{})}),e.jsxs("div",{children:[e.jsx("span",{children:"Active routing"}),e.jsxs("strong",{children:[q,"/",i.length||0]})]})]})]}),P&&e.jsxs("div",{className:"error-message",children:[e.jsx(Re,{}),e.jsx("span",{children:P})]}),e.jsxs("div",{className:"phone-stats-grid",children:[e.jsxs("div",{className:"phone-stat-card",children:[e.jsx("span",{children:"Total numbers"}),e.jsx("strong",{children:i.length}),e.jsxs("small",{children:[Ue," Twilio, ",Pe," Plivo India, ",ze," Vobiz, ",$e," WhatsApp"]})]}),e.jsxs("div",{className:"phone-stat-card",children:[e.jsx("span",{children:"Assigned"}),e.jsx("strong",{children:q}),e.jsx("small",{children:ce?`${ce} still needs routing`:"Every number has an assistant"})]}),e.jsxs("div",{className:"phone-stat-card",children:[e.jsx("span",{children:"Assistants"}),e.jsx("strong",{children:Ee}),e.jsx("small",{children:"Available for inbound call routing"})]}),e.jsxs("div",{className:"phone-stat-card",children:[e.jsx("span",{children:"Provider status"}),e.jsx("strong",{children:Ie}),e.jsx("small",{children:i.length?"Ready for live call assignment":"Add credentials to begin"})]})]}),e.jsxs("div",{className:"phone-workspace-grid",children:[e.jsxs("section",{className:"phone-list-panel",children:[e.jsxs("div",{className:"section-toolbar",children:[e.jsxs("div",{children:[e.jsx("h2",{children:"Connected Numbers"}),e.jsx("p",{children:"Manage call routing and assistant ownership for every phone line."})]}),e.jsxs("span",{children:[i.length," total"]})]}
1),e.jsx("div",{className:"phone-numbers-grid",children:i.length===0?e.jsxs("div",{className:"empty-state",children:[e.jsx(z,{className:"empty-icon"}),e.jsx("h3",{children:"No phone numbers connected"}),e.jsx("p",{children:"Add a Twilio, Plivo India, Vobiz, or WhatsApp Business number, assign an assistant, then run one test before going live."}),e.jsxs("button",{className:"btn-primary",onClick:()=>v(!0),children:[e.jsx(pe,{})," Add Phone Number"]})]}):i.map(s=>{const n=u.find(r=>r.id===s.assignedAssistantId),o=!!s.assignedAssistantId;return e.jsxs("div",{className:"phone-number-card","data-phone-id":s.id,children:[e.jsxs("div",{className:"card-header",children:[e.jsxs("div",{className:"phone-title-row",children:[e.jsx("div",{className:"phone-avatar",children:e.jsx(z,{})}),e.jsxs("div",{className:"phone-info",children:[e.jsx("h3",{children:s.phoneNumber}),e.jsx("span",{className:"phone-label",children:s.label||"Primary line"}),e.jsx("span",{className:"phone-provider",children:Be(s)})]})]}),e.jsx("span",{className:`status-badge ${o?"active":"inactive"}`,children:o?"Active":"Needs assistant"})]}),e.jsxs("div",{className:"phone-card-meta",children:[e.jsxs("div",{children:[e.jsx("span",{children:"Assistant"}),e.jsx("strong",{children:n?.name||"Not assigned"})]}),e.jsxs("div",{children:[e.jsx("span",{children:"Call mode"}),e.jsx("strong",{children:Fe(s)})]})]}),e.jsx("div",{className:"card-content",children:e.jsxs("div",{className:"form-group assistant-picker",children:[e.jsxs("label",{children:["Assigned Assistant",ie.has(s.id)&&e.jsxs("span",{className:"saving-indicator",children:[e.jsx(C,{className:"loading-spinner"})," Saving..."]})]}),e.jsxs("select",{value:s.assignedAssistantId||"",onChange:r=>Ae(s.id,r.target.value),disabled:ie.has(s.id),children:[e.jsx("option",{value:"",children:"Select Assistant"}),u.map(r=>e.jsx("option",{value:r.id,children:r.name},r.id))]})]})}),e.jsxs("div",{className:"card-actions",children:[e.jsxs("button",{className:"btn-ghost",onClick:()=>w(!0),title:"Update Twilio Credentials",disabled:s.provider&&s.provider!=="twilio",children:[e.jsx(C,{})," Update keys"]}),e.jsxs("button",{className:"btn-danger-light",onClick:()=>ke(s.id),children:[e.jsx(De,{})," Remove"]})]})]},s.id)})})]}),e.jsxs("aside",{className:"phone-guide-card",children:[e.jsx("div",{className:"guide-icon",children:e.jsx(_e,{})}),e.jsx("h2",{children:"Production Checklist"}),e.jsx("p",{children:"Use this before routing real inbound traffic through a number."}),e.jsxs("div",{className:"guide-checklist",children:[e.jsxs("div",{children:[e.jsx(D,{}),e.jsx("span",{children:"Twilio credentials are current"})]}),e.jsxs("div",{children:[e.jsx(G,{}),e.jsx("span",{children:"WhatsApp webhook and capabilities are reviewed"})]}),e.jsxs("div",{children:[e.jsx(Ye,{}),e.jsx("span",{children:"One assistant is assigned per number"})]}),e.jsxs("div",{children:[e.jsx(me,{}),e.jsx("span",{children:"Run a live test call after changes"})]})]}),R?e.jsxs(ue,{className:"btn-secondary guide-action",to:de,style:{textDecoration:"none"},children:[e.jsx(z,{})," Next: Make a Test Call ",e.jsx(Q,{})]}):e.jsxs("button",{className:"btn-secondary guide-action",onClick:()=>w(!0),children:[e.jsx(Oe,{})," Manage credentials ",e.jsx(Q,{})]})]})]}),$&&e.jsxs(be,{open:$,title:"Add Phone Number",description:"Connect an existing provider number and route it to the right assistant.",size:"md",className:"phone-number-modal",onClose:()=>{v(!1),M()},footer:f===1?d==="twilio"?e.jsxs("button",{className:"btn-primary",onClick:Ne,disabled:O,children:[O?e.jsx(C,{className:"loading-spinner"}):e.jsx(D,{}),O?"Testing...":"Test & Continue"]}):d==="plivo_india"||d==="vobiz"?e.jsx("button",{className:"btn-primary",type:"button",onClick:()=>N(3),children:"Continue"}):e.jsxs("button",{className:"btn-primary",type:"button",onClick:()=>{window.location.href="/whatsapp"},children:[e.jsx(G,{})," Open WhatsApp setup"]}):f===2?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn-secondary",onClick:()=>N(1),children:"Back"}),e.jsx("button",{className:"btn-primary",onClick:()=>N(3),disabled:!V,children:"Continue"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn-secondary",onClick:()=>N(d==="plivo_india"||d==="vobiz"?1:2),children:"Back"}),e.jsxs("button",{className:"btn-success",onClick:d==="plivo_india"?Se:d==="vobiz"?Te:we,disabled:K,children:[K?e.jsx(C,{className:"loading-spinner"}):e.jsx(D,{}),K?"Saving...":"Add Phone Number"]})]}),children:[f===1&&e.jsxs("div",{className:"step-content",children:[e.jsx("h3",{children:"Step 1: Choose Provider"}),e.jsx("p",{children:"Connect an existing provider number you already own."}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Provider"}),e.jsxs("select",{value:d,onChange:s=>ee(s.target.value),children:[e.jsx("option",{value:"twilio",children:"Twilio"}),e.jsx("option",{value:"plivo_india",children:"Plivo India"}),e.jsx("option",{value:"vobiz",children:"Vobiz"}),e.jsx("option",{value:"whatsapp_business",children:"WhatsApp Business"})]})]}),d==="twilio"?e.jsxs(e.Fragment,{children:[e.jsx("h3",{children:"Twilio Credentials"}),e.jsx("p",{children:"Enter your Twilio Account SID and Auth Token"}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Account SID"}),e.jsx("input",{type:"text",placeholder:"AC...",value:l.accountSid,onChange:s=>A({...l,accountSid:s.target.value})})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Auth Token"}),e.jsx("input",{type:"password",placeholder:"Your auth token",value:l.authToken,onChange:s=>A({...l,authToken:s.target.value})})]})]}):d==="plivo_india"?e.jsxs(e.Fragment,{children:[e.jsx("h3",{children:"Plivo India BYO Number"}),e.jsx("p",{children:"Use an existing Plivo number. Public number purchase stays disabled until KYC and provider purchase flow are verified."}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Plivo Auth ID"}),e.jsx("input",{type:"text",placeholder:"MAX...",value:p.authId,onChange:s=>L({...p,authId:s.target.value})})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Plivo Auth Token"}),e.jsx("input",{type:"password",placeholder:"Your Plivo auth token",value:p.authToken,onChange:s=>L({...p,authToken:s.target.value})})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Plivo Number"}),e.jsx("input",{type:"text",placeholder:"+919876543210",value:p.phoneNumber,onChange:s=>L({...p,phoneNumber:s.target.value})})]})]}):d==="vobiz"?e.jsxs(e.Fragment,{children:[e.jsx("h3",{children:"Vobiz Number"}),e.jsx("p",{children:"Connect a number you already purchased in the Vobiz console (Vobiz numbers can't be ported in â buy directly on their platform first)."}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Vobiz Auth ID"}),e.jsx("input",{type:"text",placeholder:"MA_...",value:m.authId,onChange:s=>W({...m,authId:s.target.value})})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Vobiz Auth Token"}),e.jsx("input",{type:"password",placeholder:"Your Vobiz auth token",value:m.authToken,onChange:s=>W({...m,authToken:s.target.value})})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Vobiz Number"}),e.jsx("input",{type:"text",placeholder:"+919876543210",value:m.phoneNumber,onChange:s=>W({...m,phoneNumber:s.target.value})})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("h3",{children:"WhatsApp Business Number"}),e.jsx("p",{children:"WhatsApp has its own setup page for Meta sign-in, c
1onnected numbers, assistant assignment, webhook status, messaging, Smart Assets, and calling capability."}),e.jsxs("div",{className:"info-box",children:[e.jsx("h4",{children:"Use the WhatsApp page"}),e.jsx("p",{children:"Open WhatsApp setup to connect through Meta Embedded Signup and manage saved WhatsApp Business numbers."})]}),_.length>0&&e.jsxs("div",{className:"info-box",children:[e.jsx("h4",{children:"Already connected"}),e.jsxs("p",{children:[_.length," WhatsApp Business connection",_.length===1?"":"s"," saved in this workspace."]})]})]})]}),f===2&&e.jsxs("div",{className:"step-content",children:[e.jsx("h3",{children:"Step 2: Select Phone Number"}),e.jsx("p",{children:"Choose a phone number from your Twilio account"}),ve?e.jsxs("div",{className:"loading-state",children:[e.jsx(C,{className:"loading-spinner"}),e.jsx("p",{children:"Fetching your phone numbers..."})]}):e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Available Phone Numbers"}),e.jsxs("select",{value:V,onChange:s=>ne(s.target.value),children:[e.jsx("option",{value:"",children:"Select a phone number"}),je.map(s=>e.jsxs("option",{value:s.phoneNumber,children:[s.phoneNumber," ",s.friendlyName&&`(${s.friendlyName})`]},s.phoneNumber))]})]})]}),f===3&&e.jsxs("div",{className:"step-content",children:[e.jsx("h3",{children:"Step 3: Configure"}),e.jsx("p",{children:"Set up your phone number with a label. You can assign an assistant now or later from Phone Numbers, Tool Workspace, or Enterprise Console."}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Label"}),e.jsx("input",{type:"text",placeholder:"e.g., Sales Line, Support",value:h.label,onChange:s=>Y({...h,label:s.target.value})})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Assign Assistant (optional)"}),e.jsxs("select",{value:h.assistantId,onChange:s=>Y({...h,assistantId:s.target.value}),children:[e.jsx("option",{value:"",children:"No assistant yet"}),u.map(s=>e.jsx("option",{value:s.id,children:s.name},s.id))]})]})]})]}),U&&e.jsx(be,{open:U,title:"Update Twilio Credentials",description:"Refresh provider keys while preserving existing number routing.",size:"md",className:"phone-number-modal",onClose:()=>{w(!1),A({accountSid:"",authToken:""})},footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn-secondary",onClick:()=>{w(!1),A({accountSid:"",authToken:""})},children:"Cancel"}),e.jsxs("button",{className:"btn-success",onClick:Ce,disabled:X,children:[X?e.jsx(C,{className:"loading-spinner"}):e.jsx(D,{}),X?"Updating...":"Update Credentials"]})]}),children:e.jsxs("div",{className:"step-content",children:[e.jsxs("div",{className:"info-box",children:[e.jsx("h4",{children:"Why update credentials?"}),e.jsx("p",{children:"This will create the necessary API keys for human transfer functionality. Your existing phone number configuration will be preserved."})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Account SID"}),e.jsx("input",{type:"text",placeholder:"AC...",value:l.accountSid,onChange:s=>A({...l,accountSid:s.target.value})})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Auth Token"}),e.jsx("input",{type:"password",placeholder:"Your auth token",value:l.authToken,onChange:s=>A({...l,authToken:s.target.value})})]})]})})]})}export{Qe 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.