PageSourceSearch

https://clozure.net/assets/PhoneSettings-BvI9ZO4p.js

js clozure.net collected 2026-10-02 01:07:13 UTC 25,516 bytes, 1 lines download raw bytes

1import{r,j as e,p as de}from"./react-vendor-Ca39dfnS.js";import{b as me,a as ie,u as y}from"./query-vendor-CZuItqE6.js";import{C as o,d as m,a as c,b as d,c as v,e as O,B as g,L as f,R as ue,U as xe,V as he,W as pe,X as te,I as F,u as ge,K as je,v as Q}from"./main-klyVOJfp.js";import{d as N,P as V,C as Ne,j as G,as as be,u as fe,l as ne,k as U,V as we,$ as ve,aE as se,db as ae,o as ye,a$ as Se,b0 as Ce}from"./ui-vendor-CDWeqcbU.js";import{f as re}from"./chart-vendor-B24y44e_.js";import"./modulepreload-polyfill-B5Qt9EMX.js";const A={payg:{name:"Pay As You Go",stripeLookupKeyTollFree:"clozure_phone_payg_tollfree",stripeLookupKeyLocal:"clozure_phone_payg_local",monthlyFee:0,monthlyNumberTollFree:6.99,monthlyNumberLocal:3.99,smsOutbound:.018,smsInbound:.011,voiceOutbound:.035,voiceInbound:.013,includesMinutes:0,includesSms:0,overageVoice:.035,overageSms:.018},starter:{name:"Starter",stripeLookupKey:"clozure_phone_starter",monthlyFee:9.99,monthlyNumberTollFree:0,monthlyNumberLocal:0,smsOutbound:0,smsInbound:0,voiceOutbound:0,voiceInbound:0,includesMinutes:100,includesSms:200,overageVoice:.05,overageSms:.02},growth:{name:"Growth",stripeLookupKey:"clozure_phone_growth",monthlyFee:24.99,monthlyNumberTollFree:0,monthlyNumberLocal:0,smsOutbound:0,smsInbound:0,voiceOutbound:0,voiceInbound:0,includesMinutes:500,includesSms:1e3,overageVoice:.04,overageSms:.015},scale:{name:"Scale",stripeLookupKey:"clozure_phone_scale",monthlyFee:49.99,monthlyNumberTollFree:0,monthlyNumberLocal:0,smsOutbound:0,smsInbound:0,voiceOutbound:0,voiceInbound:0,includesMinutes:1500,includesSms:3e3,overageVoice:.03,overageSms:.012}};function Te({businessId:n}){const l=me(),[w,S]=r.useState(null),[u,L]=r.useState("payg"),[C,z]=r.useState("tollfree"),[b,B]=r.useState(""),[j,K]=r.useState([]),[T,J]=r.useState(""),[I,Y]=r.useState(!1),[R,k]=r.useState(!1),{data:x,isLoading:D}=ie({queryKey:["/api/businesses",n,"twilio","phone-number"],enabled:!!n}),M=y({mutationFn:async()=>{Y(!0);const t=new URLSearchParams({country:"US",type:C,limit:"10"});b&&t.set("areaCode",b);const a=await fetch(`/api/businesses/${n}/twilio/available-numbers?${t}`),i=await a.json();if(Y(!1),!a.ok)throw new Error(i.error||"Search failed");return i.numbers},onSuccess:t=>{K(t)},onError:()=>Y(!1)}),_=y({mutationFn:async()=>{k(!0);const t=await fetch(`/api/businesses/${n}/twilio/provision-number`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({phoneNumber:T,numberType:C,pricingPlan:u})}),a=await t.json();if(k(!1),!t.ok)throw new Error(a.error||"Provisioning failed");return a},onSuccess:()=>{l.invalidateQueries({queryKey:["/api/businesses",n,"twilio","phone-number"]})},onError:()=>k(!1)}),E=y({mutationFn:async()=>{const t=await fetch(`/api/businesses/${n}/twilio/phone-number`,{method:"DELETE"}),a=await t.json();if(!t.ok)throw new Error(a.error||"Release failed");return a},onSuccess:()=>{l.invalidateQueries({queryKey:["/api/businesses",n,"twilio","phone-number"]})}}),P=y({mutationFn:async()=>{const t=await fetch(`/api/businesses/${n}/twilio-settings`,{method:"DELETE"}),a=await t.json();if(!t.ok)throw new Error(a.error||"Clear failed");return a},onSuccess:()=>{l.invalidateQueries({queryKey:["/api/businesses",n,"twilio","phone-number"]}),l.invalidateQueries({queryKey:["/api/businesses",n,"twilio-settings"]})}});return D?e.jsx(o,{children:e.jsxs(m,{className:"p-8 text-center text-muted-foreground",children:[e.jsx(N,{className:"mx-auto h-6 w-6 animate-spin mb-2"}),"Loading phone number status..."]})}):x?.hasNumber?e.jsxs(o,{children:[e.jsxs(c,{children:[e.jsxs(d,{className:"flex items-center gap-2",children:[e.jsx(V,{className:"h-5 w-5"}),"Business Phone Number"]}),e.jsx(v,{children:"Your active phone number for calls and SMS."})]}),e.jsxs(m,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ne,{className:"h-5 w-5 text-green-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-lg font-semibold",children:x.phoneNumber}),e.jsx("p",{className:"text-sm text-muted-foreground",children:x.mode==="managed"?"Clozure-managed number":"BYOK number"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(O,{variant:"secondary",children:x.pricingPlan?.toUpperCase()}),x.isConnected&&e.jsx(O,{variant:"outline",className:"text-green-600",children:"Connected"})]}),x.mode==="managed"?e.jsxs(g,{variant:"destructive",size:"sm",onClick:()=>E.mutate(),disabled:E.isPending,children:[E.isPending?e.jsx(N,{className:"h-4 w-4 animate-spin mr-1"}):e.jsx(G,{className:"h-4 w-4 mr-1"}),"Release Number"]}):e.jsxs(g,{variant:"outline",size:"sm",className:"text-red-600 border-red-200 hover:bg-red-50 hover:text-red-700",onClick:()=>{window.confirm("This will clear your phone number and Twilio credentials. Continue?")&&P.mutate()},disabled:P.isPending,children:[P.isPending?e.jsx(N,{className:"h-4 w-4 animate-spin mr-1"}):e.jsx(G,{className:"h-4 w-4 mr-1"}),"Clear Number"]})]})]}):w?w==="byok"?e.jsxs(o,{children:[e.jsxs(c,{children:[e.jsx(d,{children:"Use My Twilio Account"}),e.jsx(v,{children:"Your calls and SMS will use your own Twilio account credentials."})]}),e.jsxs(m,{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your Account SID, Auth Token, and phone number in the BYOK form below."}),e.jsx(g,{variant:"outline",onClick:()=>S(null),children:"Back"})]})]}):e.jsxs(o,{children:[e.jsxs(c,{children:[e.jsx(d,{children:"Get a Clozure Phone Number"}),e.jsx(v,{children:"Choose a plan and search for an available number."})]}),e.jsxs(m,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{children:"Select Plan"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:["payg","starter","growth","scale"].map(t=>{const a=A[t];return e.jsxs("div",{className:`border rounded-lg p-3 cursor-pointer transition-colors ${u===t?"border-primary bg-primary/5":"hover:border-muted-foreground"}`,onClick:()=>L(t),children:[e.jsx("p",{className:"font-semibold text-sm",children:a.name}),e.jsxs("p",{className:"text-lg font-bold",children:["$",a.monthlyFee>0?a.monthlyFee.toFixed(2):"PAYG",a.monthlyFee>0&&e.jsx("span",{className:"text-xs font-normal",children:"/mo"})]}),t!=="payg"&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[a.includesMinutes," min + ",a.includesSms," SMS"]})]},t)})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-col md:flex-row gap-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx(f,{children:"Number Type"}),e.jsxs(ue,{value:C,onValueChange:t=>z(t),children:[e.jsx(xe,{children:e.jsx(he,{})}),e.jsxs(pe,{children:[e.jsx(te,{value:"tollfree",children:"Toll-Free (Recommended)"}),e.jsx(te,{value:"local",children:"Local"})]})]})]}),C==="local"&&e.jsxs("div",{className:"flex-1",children:[e.jsx(f,{children:"Area Code"}),e.jsx(F,{placeholder:"e.g. 212",value:b,onChange:t=>B(t.target.value.replace(/\D/g,"").slice(0,3)),maxLength:3})]})]}),e.jsxs(g,{onClick:()=>M.mutate(),disabled:I||M.isPending,className:"w-full md:w-auto",children:[I?e.jsx(N,{className:"h-4 w-4 animate-spin mr-2"}):e.jsx(be,{className:"h-4 w-4 mr-2"}),"Search Available Numbers"]})]}),j.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{children:"Available Numbers"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-2",children:j.map(t=>e.jsxs(g,{variant:T===t.phoneNumber?"default":"outline",className:"justify-start h-auto py-3",onClick:()=>J(t.phoneNumber),children:[e.jsx(V,{className:"h-4 w-4 mr-2 shrink-0"}),e.jsx("span",{className:"text-sm",children:t.phoneNumber})]},t.phoneNumber))})]}),T&&e.jsxs("div",{className:"pt-4 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"font-medium",children:["Selected: ",T]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Plan: ",A[u].name]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"text-lg font-bold",children:["$",A[u].monthlyFee>0?A[u].monthlyFee.toFixed(2):(C==="tollfree"?A[u].monthlyNumberTollFree:A[u].monthlyNumberLocal).toFixed(2),e.jsx("span",{className:"text-xs font-normal",children:"/mo"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"+ usage"})]})]}),e.jsxs(g,{className:"w-full",onClick:()=>_.mutate(),disabled:R||_.isPending,children:[R?e.jsx(N,{className:"h-4 w-4 animate-spin mr-2"}):e.jsx(fe,{className:"h-4 w-4 mr-2"}),"Activate Number"]})]}),e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>S(null),children:"Back"})]})]}):e.jsxs(o,{children:[e.jsxs(c,{children:[e.jsxs(d,{className:"flex items-center gap-2",children:[e.jsx(V,{className:"h-5 w-5"}),"Get a Business Phone Number"]}),e.jsx(v,{children:"You need a phone number to make calls and send SMS through Clozure."})]}),e.jsx(m,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs(o,{className:"cursor-pointer hover:border-primary transition-colors",onClick:()=>S("managed"),children:[e.jsxs(c,{children:[e.jsx(d,{className:"text-base",children:"Get a Clozure Number"}),e.jsx(v,{className:"text-sm",children:"We provision a dedicated number for your business. Billed through Clozure."})]}),e.jsx(m,{children:e.jsx(O,{children:"Recommended"})})]}),e.jsxs(o,{className:"cursor-pointer hover:border-primary transition-colors",onClick:()=>S("byok"),children:[e.jsxs(c,{children:[e.jsx(d,{className:"text-base",children:"Use My Twilio Account"}),e.jsx(v,{className:"text-sm",children:"Bring your own Twilio Account SID, Auth Token, and phone number."})]}),e.jsx(m,{children:e.jsx(O,{variant:"secondary",children:"BYOK"})})]})]})})]})}function Oe(){const{businessId:n}=de(),{toast:l}=ge(),[w,S]=r.useState(""),[u,L]=r.useState(""),[C,z]=r.useState(""),[b,B]=r.useState("idle"),[j,K]=r.useState(null),[T,J]=r.useState(""),[I,Y]=r.useState(""),[R,k]=r.useState("idle"),[x,D]=r.useState(null),[M,_]=r.useState(""),[E,P]=r.useState("idle"),[t,a]=r.useState(null),{data:i,isLoading:le}=ie({queryKey:["/api/businesses",n,"twilio-settings"],queryFn:async()=>{const s=await fetch(`/api/businesses/${n}/twilio-settings`,{credentials:"include"});if(!s.ok)throw new Error("Failed to fetch Twilio settings");return s.json()},enabled:!!n});r.useEffect(()=>
1{i&&(S(i.accountSid||""),z(i.phoneNumber||""))},[i]);const H=y({mutationFn:async s=>{const h=await fetch(`/api/businesses/${n}/twilio-settings`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s),credentials:"include"});if(!h.ok){const p=await h.json();throw new Error(p.error||"Failed to save Twilio settings")}return h.json()},onSuccess:()=>{Q.invalidateQueries({queryKey:["/api/businesses",n,"twilio-settings"]}),l({title:"Twilio settings saved",description:"Your Twilio credentials have been saved securely."}),L("")},onError:s=>{l({title:"Failed to save Twilio settings",description:s.message,variant:"destructive"})}}),W=y({mutationFn:async({to:s,message:h})=>{const p=await fetch(`/api/businesses/${n}/twilio-settings/test-sms`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({to:s,message:h||void 0}),credentials:"include"}),ee=await p.json();if(!p.ok||!ee.success)throw new Error(ee.error||"Failed to send test SMS");return ee},onSuccess:s=>{k("sent"),D(s),l({title:"Test SMS sent",description:s.message})},onError:s=>{k("error"),D({success:!1,error:s.message}),l({title:"SMS failed",description:s.message,variant:"destructive"})}}),X=y({mutationFn:async({to:s})=>{const h=await fetch(`/api/businesses/${n}/twilio-settings/test-call`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({to:s}),credentials:"include"}),p=await h.json();if(!h.ok||!p.success)throw new Error(p.error||"Failed to initiate test call");return p},onSuccess:s=>{P("success"),a(s),l({title:"Test call initiated",description:s.message})},onError:s=>{P("error"),a({success:!1,error:s.message}),l({title:"Call failed",description:s.message,variant:"destructive"})}}),Z=y({mutationFn:async()=>{const s=await fetch(`/api/businesses/${n}/twilio-settings`,{method:"DELETE",credentials:"include"});if(!s.ok){const h=await s.json();throw new Error(h.error||"Failed to delete Twilio settings")}return s.json()},onSuccess:()=>{Q.invalidateQueries({queryKey:["/api/businesses",n,"twilio-settings"]}),Q.invalidateQueries({queryKey:["/api/businesses",n,"twilio","phone-number"]}),S(""),L(""),z(""),l({title:"Twilio settings deleted",description:"Phone number and credentials have been cleared."})},onError:s=>{l({title:"Failed to delete settings",description:s.message,variant:"destructive"})}}),$=y({mutationFn:async s=>{const h=await fetch(`/api/businesses/${n}/twilio-settings/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s||{}),credentials:"include"}),p=await h.json();if(!h.ok||!p.success)throw new Error(p.error||"Failed to test Twilio connection");return p},onSuccess:s=>{B("success"),K(s),Q.invalidateQueries({queryKey:["/api/businesses",n,"twilio-settings"]})},onError:s=>{B("error"),K({success:!1,error:s.message})}}),oe=async()=>{if(!w){l({title:"Missing Account SID",description:"Please enter your Twilio Account SID.",variant:"destructive"});return}if(!u&&!i?.authToken){l({title:"Missing Auth Token",description:"Please enter your Twilio Auth Token.",variant:"destructive"});return}H.mutate({accountSid:w,authToken:u||"",phoneNumber:C})}
1,ce=async()=>{B("testing"),K(null),w&&u?$.mutate({accountSid:w,authToken:u}):$.mutate(void 0)};if(!n)return e.jsx("div",{className:"p-8 text-center",children:e.jsx("p",{className:"text-muted-foreground",children:"No business selected"})});const q=i?.mode==="managed";return e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsx(je,{department:"SETTINGS",title:"Phone & SMS Settings",subtitle:"Configure your business phone number for calls, SMS, and voice features",compact:!0}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[e.jsxs(o,{children:[e.jsxs(c,{className:"flex flex-row items-center justify-between gap-1 space-y-0 pb-2",children:[e.jsx(d,{className:"text-sm font-medium",children:"Connection Status"}),e.jsx(ne,{className:"w-4 h-4 text-muted-foreground"})]}),e.jsxs(m,{children:[e.jsx("div",{className:"flex items-center gap-2",children:le?e.jsx(N,{className:"w-5 h-5 animate-spin text-muted-foreground"}):i?.isConnected?e.jsxs(e.Fragment,{children:[e.jsx(U,{className:"w-5 h-5 text-green-500"}),e.jsx("span",{className:"text-lg font-semibold text-green-600",children:"Connected"})]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-5 h-5 text-red-500"}),e.jsx("span",{className:"text-lg font-semibold text-red-600",children:"Not Connected"})]})}),i?.lastVerifiedAt&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Last verified: ",re(new Date(i.lastVerifiedAt),"PPp")]})]})]}),e.jsxs(o,{children:[e.jsxs(c,{className:"flex flex-row items-center justify-between gap-1 space-y-0 pb-2",children:[e.jsx(d,{className:"text-sm font-medium",children:"Phone Number"}),e.jsx(V,{className:"w-4 h-4 text-muted-foreground"})]}),e.jsxs(m,{children:[e.jsx("div",{className:"text-lg font-semibold",children:i?.phoneNumber||"Not configured"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:q?"Clozure-managed number":"Used for outbound calls and SMS"})]})]}),e.jsxs(o,{children:[e.jsxs(c,{className:"flex flex-row items-center justify-between gap-1 space-y-0 pb-2",children:[e.jsx(d,{className:"text-sm font-medium",children:"Mode"}),e.jsx(ne,{className:"w-4 h-4 text-muted-foreground"})]}),e.jsxs(m,{children:[e.jsx("div",{className:"text-lg font-semibold capitalize",children:i?.mode||"Platform"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:q?"Clozure provisions and bills the number":"Use your own Twilio account (BYOK)"})]})]})]}),e.jsx(Te,{businessId:n}),!q&&e.jsxs(o,{children:[e.jsxs(c,{children:[e.jsx(d,{children:"Bring Your Own Twilio (BYOK)"}),e.jsx(v,{children:"Enter your own Twilio account credentials to enable SMS and calling features. Your Auth Token is encrypted before storage."})]}),e.jsxs(m,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"accountSid",children:"Account SID"}),e.jsx(F,{id:"accountSid",type:"text",placeholder:"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",value:w,onChange:s=>S(s.target.value),className:"font-mono"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Found on your Twilio Console dashboard"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{htmlFor:"authToken",children:["Auth Token ",i?.authToken&&e.jsx(O,{variant:"outline",className:"ml-2",children:"Saved"})]}),e.jsx(F,{id:"authToken",type:"password",placeholder:i?.authToken?"Enter new token to update":"Enter your Auth Token",value:u,onChange:s=>L(s.target.value),className:"font-mono"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave blank to keep the existing token"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"phoneNumber",children:"Twilio Phone Number"}),e.jsx(F,{id:"phoneNumber",type:"tel",placeholder:"+1234567890",value:C,onChange:s=>z(s.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Your Twilio phone number for outbound calls and SMS (optional but recommended)"})]}),e.jsxs("div",{className:"flex items-center gap-4 pt-4",children:[e.jsx(g,{onClick:oe,disabled:H.isPending,children:H.isPending?e.jsxs(e.Fragment,{children:[e.jsx(N,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(we,{className:"w-4 h-4 mr-2"}),"Save Settings"]})}),e.jsx(g,{variant:"outline",onClick:ce,disabled:$.isPending||!i?.accountSid&&
1!w,children:$.isPending?e.jsxs(e.Fragment,{children:[e.jsx(N,{className:"w-4 h-4 mr-2 animate-spin"}),"Testing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"w-4 h-4 mr-2"}),"Test Connection"]})})]}),e.jsxs("div",{className:"flex items-center gap-4 pt-2 border-t mt-4",children:[e.jsxs(g,{variant:"outline",size:"sm",className:"text-red-600 border-red-200 hover:bg-red-50 hover:text-red-700",onClick:()=>{window.confirm("This will permanently delete your Twilio credentials and phone number. Are you sure?")&&Z.mutate()},disabled:Z.isPending,children:[Z.isPending?e.jsx(N,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(G,{className:"w-4 h-4 mr-2"}),"Delete Twilio Settings"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Clears phone number and credentials so you can start fresh."})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your credentials from the"," ",e.jsx("a",{href:"https://console.twilio.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Twilio Console"}),"."]})]})]}),q&&e.jsx(o,{className:"border-dashed",children:e.jsxs(c,{children:[e.jsx(d,{children:"BYOK Credentials"}),e.jsx(v,{children:"You are currently using a Clozure-managed phone number. Release it above to switch to Bring Your Own Twilio Account."})]})}),(b==="success"||b==="error")&&j&&e.jsxs(o,{className:b==="success"?"border-green-200 dark:border-green-800":"border-red-200 dark:border-red-800",children:[e.jsx(c,{children:e.jsx(d,{className:"flex items-center gap-2",children:b==="success"?e.jsxs(e.Fragment,{children:[e.jsx(U,{className:"w-5 h-5 text-green-500"}),e.jsx("span",{className:"text-green-600 dark:text-green-400",children:"Connection Successful"})]}):e.jsxs(e.Fragment,{children:[e.jsx(se,{className:"w-5 h-5 text-red-500"}),e.jsx("span",{className:"text-red-600 dark:text-red-400",children:"Connection Failed"})]})})}),e.jsxs(m,{children:[b==="success"&&j.accountInfo&&e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Account Name"}),e.jsx("p",{className:"font-medium",children:j.accountInfo.friendlyName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Status"}),e.jsx(O,{variant:j.accountInfo.status==="active"?"default":"secondary",children:j.accountInfo.status})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Account Type"}),e.jsx("p",{className:"font-medium",children:j.accountInfo.type})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Created"}),e.jsx("p",{className:"font-medium",children:re(new Date(j.accountInfo.dateCreated),"PP")})]})]}),b==="error"&&e.jsx("p",{className:"text-red-600 dark:text-red-400",children:j.error})]})]}),i?.isConnected&&e.jsxs(o,{children:[e.jsxs(c,{children:[e.jsxs(d,{className:"flex items-center gap-2",children:[e.jsx(ae,{className:"h-5 w-5"}),"Test Your Number"]}),e.jsx(v,{children:"Send a test SMS or place an AI-powered test call — the recipient will hear a live conversation with your AI sales representative"})]}),e.jsxs(m,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ye,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("h4",{className:"text-sm font-semibold",children:"Test SMS"})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[e.jsxs("div",{className:"md:col-span-1 space-y-2",children:[e.jsx(f,{htmlFor:"testSmsTo",children:"To Number"}),e.jsx(F,{id:"testSmsTo",type:"tel",placeholder:"+1234567890",value:T,onChange:s=>J(s.target.value)})]}),e.jsxs("div",{className:"md:col-span-2 space-y-2",children:[e.jsx(f,{htmlFor:"testSmsMessage",children:"Message (optional)"}),e.jsx(F,{id:"testSmsMessage",type:"text",placeholder:"Test SMS from Clozure",value:I,onChange:s=>Y(s.target.value)})]})]}),e.jsx(g,{onClick:()=>{k("sending"),D(null),W.mutate({to:T,message:I})},disabled:W.isPending||!T,size:"sm",children:W.isPending?e.jsxs(e.Fragment,{children:[e.jsx(N,{className:"w-4 h-4 mr-2 animate-spin"}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Se,{className:"w-4 h-4 mr-2"}),"Send Test SMS"]})}),R==="sent"&&x?.success&&e.jsxs("div",{className:"flex items-start gap-2 p-3 bg-green-500/5 border border-green-500/10 rounded-lg text-sm",children:[e.jsx(U,{className:"h-4 w-4 text-green-500 mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-green-600",children:x.message}),x.sid&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5 font-mono",children:["SID: ",x.sid]})]})]}),R==="error"&&x?.error&&e.jsxs("div",{className:"flex items-start gap-2 p-3 bg-red-500/5 border border-red-500/10 rounded-lg text-sm",children:[e.jsx(se,{className:"h-4 w-4 text-red-500 mt-0.5 shrink-0"}),e.jsx("p",{className:"text-red-600",children:x.error})]})]}),e.jsx("div",{className:"border-t"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ce,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("h4",{className:"text-sm font-semibold",children:"AI Sales Call"})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"testCallTo",children:"To Number"}),e.jsx(F,{id:"testCallTo",type:"tel",placeholder:"+1234567890",value:M,onChange:s=>_(s.target.value)})]})}),e.jsx(g,{onClick:()=>{P("calling"),a(null),X.mutate({to:M})},disabled:X.isPending||!M,size:"sm",children:X.isPending?e.jsxs(e.Fragment,{children:[e.jsx(N,{className:"w-4 h-4 mr-2 animate-spin"}),"Calling..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"w-4 h-4 mr-2"}),"Place Test Call"]})}),E==="success"&&t?.success&&e.jsxs("div",{className:"flex items-start gap-2 p-3 bg-green-500/5 border border-green-500/10 rounded-lg text-sm",children:[e.jsx(U,{className:"h-4 w-4 text-green-500 mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-green-600",children:t.message}),t.callSid&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5 font-mono",children:["Call SID: ",t.callSid]})]})]}),E==="error"&&t?.error&&e.jsxs("div",{className:"flex items-start gap-2 p-3 bg-red-500/5 border border-red-500/10 rounded-lg text-sm",children:[e.jsx(se,{className:"h-4 w-4 text-red-500 mt-0.5 shrink-0"}),e.jsx("p",{className:"text-red-600",children:t.error})]})]})]})]}),e.jsxs(o,{children:[e.jsx(c,{children:e.jsx(d,{children:"About Phone & SMS"})}),e.jsxs(m,{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Clozure provides two ways to connect phone numbers for calls and SMS:"}),e.jsxs("ul",{className:"list-disc list-inside space-y-2 text-sm text-muted-foreground",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Clozure-managed:"})," We provision a number, handle billing, and configure webhooks automatically. Best for most businesses."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Bring Your Own (BYOK):"})," Use your existing Twilio account. You maintain direct billing with Twilio."]})]}),e.jsxs("div",{className:"pt-4",children:[e.jsx("p",{className:"text-sm font-medium",children:"Need a Twilio account?"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.jsx("a",{href:"https://www.twilio.com/try-twilio",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Sign up for free"})," ","and get started with trial credits."]})]})]})]})]})}export{Oe 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.