PageSourceSearch

https://www.smallbizagent.ai/assets/index-BIQLemby.js

js smallbizagent.ai collected 2026-10-05 15:05:44 UTC 63,846 bytes, 23 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PhoneProvisioningCard-C9qBB5FZ.js","assets/vendor-query-CnAhr2B8.js","assets/index-CLUtDhnY.js","assets/vendor-ui-CYA7SV0W.js","assets/vendor-charts-CPMWc2oJ.js","assets/vendor-forms-UY-il7MQ.js","assets/index-CqeBjaCM.css","assets/alert-dialog-CVgn4OwE.js","assets/accordion-DFlr1gaC.js","assets/table-2PZjRc6u.js","assets/switch-wa839A7l.js","assets/power-DcDc0xOi.js","assets/info-CEGee0l4.js","assets/CallQualityTrendChart-BoYjn3s_.js","assets/FlaggedCalls-CJAj5uh8.js","assets/api-c_Wfq480.js","assets/textarea-VdIEZsUv.js","assets/calendar-VsbRkqvx.js","assets/popover-En2VDOLx.js","assets/user-D7D5Y3_w.js","assets/play-rh91jfbb.js","assets/brain-C4pXsSiY.js","assets/pencil-XqPqJhqP.js","assets/trash-2-B9b4XGw8.js","assets/shield-alert-CwUUYaq9.js","assets/feature-tip-D5lKzg4O.js","assets/lightbulb-CC4qJ2Zf.js","assets/phone-forwarded-Du9grn4B.js"])))=>i.map(i=>d[i]);
2import{c as Re,b8 as is,b9 as ls,ba as Xe,az as pe,bb as cs,a as Ne,t as os,p as F,s as q,q as G,r as Y,aT as B,v as ds,w as V,x as Q,y as K,z,I as se,G as O,A as X,O as je,Q as fe,R as ye,T as be,V as P,B as x,ak as I,bc as ms,$,ae,aE as Ke,aF as Oe,d as N,Y as Me,J as Ze,H as Ve,i as us,j as xs,k as hs,l as gs,N as ps,n as ve,g as es,C as js,ay as Ie,P as te,f as Ee,bd as fs,ab as ze,aN as ss,aA as as,M as Fe,be as ys,bf as bs,o as Te,ar as $e,b6 as vs,a6 as Ns,aG as oe,h as ws,bg as Cs,bh as Z,aJ as As,aK as Ss,aL as le,aM as ce,_ as ks,as as Le}from"./index-CLUtDhnY.js";import{j as e,e as we,r as o,u as S,d as _}from"./vendor-query-CnAhr2B8.js";import{d as Is,b as Es,h as Ts,s as ee,n as He,c as he}from"./vendor-forms-UY-il7MQ.js";import{a as L}from"./api-c_Wfq480.js";import{T as W}from"./textarea-VdIEZsUv.js";import{S as ge}from"./switch-wa839A7l.js";import{C as Ps}from"./calendar-VsbRkqvx.js";import{P as Fs,a as qs,b as Rs}from"./popover-En2VDOLx.js";import{U as Ms}from"./user-D7D5Y3_w.js";import{P as Ls}from"./play-rh91jfbb.js";import{B as qe}from"./brain-C4pXsSiY.js";import{P as ts}from"./pencil-XqPqJhqP.js";import{T as Ds}from"./trash-2-B9b4XGw8.js";import{A as _s,a as Qs,b as Ks,c as Os}from"./accordion-DFlr1gaC.js";import{S as Vs}from"./shield-alert-CwUUYaq9.js";import{F as zs}from"./feature-tip-D5lKzg4O.js";import{P as $s}from"./phone-forwarded-Du9grn4B.js";import{I as Hs}from"./info-CEGee0l4.js";/**
3 * @license lucide-react v0.453.0 - ISC
4 *
5 * This source code is licensed under the ISC license.
6 * See the LICENSE file in the root directory of this source tree.
7 */const Us=Re("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
8 * @license lucide-react v0.453.0 - ISC
9 *
10 * This source code is licensed under the ISC license.
11 * See the LICENSE file in the root directory of this source tree.
12 */const Gs=Re("PhoneOff",[["path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91",key:"z86iuo"}],["line",{x1:"22",x2:"2",y1:"2",y2:"22",key:"11kh81"}]]);/**
13 * @license lucide-react v0.453.0 - ISC
14 *
15 * This source code is licensed under the ISC license.
16 * See the LICENSE file in the root directory of this source tree.
17 */const Ys=Re("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);function U({content:i,side:a="top",className:d}){return e.jsxs(is,{children:[e.jsx(ls,{asChild:!0,children:e.jsx("button",{type:"button",className:pe("inline-flex items-center justify-center h-4 w-4 rounded-full text-muted-foreground hover:text-foreground transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",d),"aria-label":"Help",children:e.jsx(Xe,{className:"h-3.5 w-3.5"})})}),e.jsx(cs,{side:a,className:"max-w-xs text-sm",children:i})]})}const Bs=[{id:"11labs-Adrian",name:"Adrian",gender:"Male",provider:"ElevenLabs"},{id:"11labs-Myra",name:"Myra",gender:"Female",provider:"ElevenLabs"},{id:"11labs-Brian",name:"Brian",gender:"Male",provider:"ElevenLabs"},{id:"11labs-Hailey",name:"Hailey",gender:"Female",provider:"ElevenLabs"},{id:"11labs-Sarah",name:"Sarah",gender:"Female",provider:"ElevenLabs"}
17,{id:"11labs-Jason",name:"Jason",gender:"Male",provider:"ElevenLabs"},{id:"11labs-Jenny",name:"Jenny",gender:"Female",provider:"ElevenLabs"},{id:"11labs-James",name:"James",gender:"Male",provider:"ElevenLabs"},{id:"cartesia-Ryan",name:"Ryan",gender:"Male",provider:"Cartesia"},{id:"cartesia-Marissa",name:"Marissa",gender:"Female",provider:"Cartesia"},{id:"cartesia-Nathan",name:"Nathan",gender:"Male",provider:"Cartesia"},{id:"cartesia-Cimo",name:"Cimo",gender:"Female",provider:"Cartesia"},{id:"cartesia-Sarah",name:"Sarah",gender:"Female",provider:"Cartesia"},{id:"cartesia-Adam",name:"Adam",gender:"Male",provider:"Cartesia"},{id:"cartesia-Hailey",name:"Hailey",gender:"Female",provider:"Cartesia"},{id:"cartesia-Jason",name:"Jason",gender:"Male",provider:"Cartesia"},{id:"openai-Alloy",name:"Alloy",gender:"Male",provider:"OpenAI"},{id:"openai-Echo",name:"Echo",gender:"Male",provider:"OpenAI"},{id:"openai-Nova",name:"Nova",gender:"Female",provider:"OpenAI"},{id:"openai-Shimmer",name:"Shimmer",gender:"Female",provider:"OpenAI"},{id:"openai-Sage",name:"Sage",gender:"Female",provider:"OpenAI"},{id:"openai-Coral",name:"Coral",gender:"Female",provider:"OpenAI"}],Ws=Es({businessId:He(),assistantName:ee().min(1,"Assistant name is required").max(30,"Name cannot exceed 30 characters").default("Alex"),voiceId:ee().default("paula"),greeting:ee().min(10,"Greeting must be at least 10 characters"),afterHoursMessage:ee().min(10,"After hours message must be at least 10 characters"),customInstructions:ee().max(2e3,"Custom instructions cannot exceed 2000 characters").optional().default(""),voicemailEnabled:he().default(!0),callRecordingEnabled:he().default(!1),transcriptionEnabled:he().default(!0),aiInsightsEnabled:he().default(!1),maxCallLengthMinutes:He().min(1,"Max call length must be at least 1 minute").max(60,"Max call length cannot exceed 60 minutes"),transferPhoneNumbers:Ts(ee()).optional()});function Js({businessId:i}){var ue,J;const{toast:a}=Ne(),d=we(),[m,h]=o.useState(!1),[c,w]=o.useState(""),[g,j]=o.useState(null),[p,f]=o.useState(!1),k=o.useRef(new Audio),y=o.useRef(null);o.useEffect(()=>{const t=k.current,n=()=>{j(null),y.current=null},R=()=>{f(!1),j(null),y.current=null};return t.addEventListener("ended",n),t.addEventListener("error",R),()=>{t.removeEventListener("ended",n),t.removeEventListener("error",R),t.pause(),t.src=""}},[]);const E=t=>{const n=k.current;if(y.current===t){n.pause(),n.currentTime=0,j(null),f(!1),y.current=null;return}n.pause(),n.currentTime=0,f(!0),j(null),y.current=null,n.src=`/api/voice-preview/${t}`;const R=n.play();R!==void 0&&R.then(()=>{f(!1),j(t),y.current=t}).catch(()=>{f(!1),j(null),y.current=null,a({title:"Preview unavailable",description:"Could not play audio. Please try again.",variant:"destructive"})})},{data:u,isLoading:T}=S({queryKey:[`/api/receptionist-config/${i}`],enabled:!!i}),{data:b}=S({queryKey:[`/api/business/${i}`],enabled:!!i}),A=()=>{const t=i??0;return u?{businessId:t,assistantName:u.assistantName||"Alex",voiceId:u.voiceId||"paula",greeting:u.greeting||"Hi, thanks for calling! Just so you know, this call may be recorded to make sure we're giving you the best service possible. How can I help you today?",afterHoursMessage:u.afterHoursMessage||"I'm sorry, our office is currently closed. If this is an emergency, please say 'emergency' to be connected with our on-call staff. Otherwise, I'd be happy to schedule an appointment for you.",customInstructions:u.customInstructions||"",voicemailEnabled:u.voicemailEnabled,callRecordingEnabled:u.callRecordingEnabled,transcriptionEnabled:u.transcriptionEnabled,aiInsightsEnabled:u.aiInsightsEnabled??!1,maxCallLengthMinutes:u.maxCallLengthMinutes||15,transferPhoneNumbers:u.transferPhoneNumbers||[]}:{businessId:t,assistantName:"Alex",voiceId:"paula",greeting:"Hi, thanks for calling! Just so you know, this call may be recorded to make sure we're giving you the best service possible. How can I help you today?",afterHoursMessage:"I'm sorry, our office is currently closed. If this is an emergency, please say 'emergency' to be connected with our on-call staff. Otherwise, I'd be happy to schedule an appointment for you.",customInstru
17ctions:"",voicemailEnabled:!0,callRecordingEnabled:!1,transcriptionEnabled:!0,aiInsightsEnabled:!1,maxCallLengthMinutes:15,transferPhoneNumbers:[]}},s=Is({resolver:os(Ws),defaultValues:A()});o.useEffect(()=>{u&&s.reset(A())},[u]),o.useEffect(()=>{const t=n=>{s.formState.isDirty&&n.preventDefault()};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)},[s.formState.isDirty]);const r=()=>{if(!c.trim())return;const t=s.getValues("transferPhoneNumbers")||[];t.includes(c.trim())||s.setValue("transferPhoneNumbers",[...t,c.trim()]),w("")},v=t=>{const n=s.getValues("transferPhoneNumbers")||[];s.setValue("transferPhoneNumbers",n.filter(R=>R!==t))},[D,re]=o.useState(!1),ne=_({mutationFn:t=>u!=null&&u.id?L("PUT",`/api/receptionist-config/${u.id}`,t):L("POST","/api/receptionist-config",t),onSuccess:async()=>{d.invalidateQueries({queryKey:[`/api/receptionist-config/${i}`]}),a({title:"Configuration saved",description:"Syncing changes to your AI receptionist..."}),await ie()},onError:t=>{a({title:"Error",description:"Failed to update configuration. Please try again.",variant:"destructive"}),console.error("Error updating configuration:",t)}}),[de,H]=o.useState(!1),ie=async()=>{re(!0),H(!1);try{const t=await fetch(`/api/retell/refresh/${i}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"}),n=await t.json().catch(()=>({}));t.ok&&n.success?(a({title:"AI Receptionist Updated",description:"Your greeting, voice, and settings are now live."}),H(!1)):(a({title:"Sync failed",description:n.error||"Could not push changes. Try again.",variant:"destructive"}),H(!0))}catch{a({title:"Sync failed",description:"Could not reach the server. Try again.",variant:"destructive"}),H(!0)}finally{re(!1)}},me=async t=>{h(!0);try{await ne.mutateAsync(t)}finally{h(!1)}};return T?e.jsx(F,{children:e.jsx(q,{className:"p-8 flex justify-center items-center",children:e.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full"})})}):e.jsxs(F,{children:[e.jsxs(G,{children:[e.jsx(Y,{children:"Virtual Receptionist Configuration"}),e.jsx(B,{children:"Configure how your virtual receptionist will interact with callers"})]}),e.jsx(q,{children:e.jsx(ds,{...s,children:e.jsxs("form",{onSubmit:s.handleSubmit(me),className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsx(V,{control:s.control,name:"assistantName",render:({field:t})=>e.jsxs(Q,{children:[e.jsxs(K,{className:"flex items-center gap-1.5",children:["Assistant Name ",e.jsx(U,{content:"The name your AI introduces itself as on calls. Callers will hear 'Hi, this is [name]'."})]}),e.jsx(z,{children:e.jsx(se,{placeholder:"Alex",...t})}),e.jsx(O,{children:"The name your AI receptionist introduces itself as"}),e.jsx(X,{})]})}),e.jsx(V,{control:s.control,name:"voiceId",render:({field:t})=>e.jsxs(Q,{children:[e.jsxs(K,{className:"flex items-center gap-1.5",children:["Voice ",e.jsx(U,{content:"Choose the voice callers will hear. Click the speaker icon to preview each voice."})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(je,{onValueChange:t.onChange,value:t.value,children:[e.jsx(z,{children:e.jsx(fe,{children:e.jsx(ye,{placeholder:"Select a voice"})})}),e.jsx(be,{children:Bs.map(n=>e.jsxs(P,{value:n.id,children:[n.name," (",n.gender,") — ",n.provider]},n.id))})]}),e.jsx(x,{type:"button",variant:g===t.value?"destructive":"outline",size:"icon",className:"shrink-0",onClick:()=>E(t.value),disabled:p,title:g===t.value?"Stop preview":"Preview voice","aria-label":g===t.value?"Stop voice preview":"Preview voice",children:p?e.jsx(I,{className:"h-4 w-4 animate-spin"}):g===t.value?e.jsx(Ys,{className:"h-4 w-4"}):e.jsx(ms,{className:"h-4 w-4"})})]}),e.jsx(O,{children:"Choose the voice for your AI receptionist — click the speaker icon to preview"}),e.jsx(X,{})]})})]}),e.jsx(V,{control:s.control,name:"greeting",render:({field:t})=>e.jsxs(Q,{children:[e.jsxs(K,{className:"flex items-center gap-1.5",children:["Greeting Message ",e.jsx(U,{content:"First thing callers hear when the AI answers. Keep it warm and natural. Recording disclosure is added automatically if Call Recording is on."})]}),e.jsx(z,{children:e.jsx(W,{placeholder:"Hi, thanks for calling! Just so you know, this call may be recorded to make sure we're giving you the best service possible. How can I help you today?",className:"min-h-[80px]",...t})}),e.jsx(O,{children:"This is the first message callers will hear when they call your business"}),e.jsx(X,{})]})}),e.jsx(V,{control:s.control,name:"afterHoursMessage",render:({field:t})=>e.jsxs(Q,{children:[e.jsxs(K,{className:"flex items-center gap-1.5",children:["After Hours Message ",e.jsx(U,{content:"What callers hear outside business hours. The AI can still book appointments and answer questions when closed."})]}),e.jsx(z,{children:e.jsx(W,{placeholder:"I'm sorry, our office is currently closed. If this is an emergency, please say 'emergency' to be connected with our on-call staff.",className:"min-h-[80px]",...t})}),e.jsx(O,{children:"This message plays when someone calls outside of business hours"}),e.jsx(X,{})]})}
17),e.jsx(V,{control:s.control,name:"customInstructions",render:({field:t})=>e.jsxs(Q,{children:[e.jsxs(K,{className:"flex items-center gap-1.5",children:["Custom Instructions ",e.jsx(U,{content:"Special rules for your AI — promotions, emergency handling, upsells, restrictions, or anything specific to your business."})]}),e.jsx(z,{children:e.jsx(W,{placeholder:`Examples:
18• Always mention our 10% new customer discount
19• If someone mentions a water leak or gas smell, transfer to a human immediately
20• We deliver within 5 miles — let callers know
21• Never book appointments on Sundays
22• Try to upsell our premium package on every call`,className:"min-h-[120px]",...t})}),e.jsx(O,{children:"Tell your AI receptionist what to say, how to behave, or when to take action. These rules are followed on every call — use them for promotions, emergency handling, upsells, restrictions, or anything specific to your business."}),e.jsx(X,{})]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsx(V,{control:s.control,name:"voicemailEnabled",render:({field:t})=>e.jsxs(Q,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(K,{className:"text-base",children:"Voicemail Enabled"}),e.jsx(O,{children:"Allow callers to leave voicemail messages"})]}),e.jsx(z,{children:e.jsx(ge,{checked:t.value,onCheckedChange:t.onChange})})]})}),e.jsx(V,{control:s.control,name:"callRecordingEnabled",render:({field:t})=>e.jsxs(Q,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(K,{className:"text-base",children:"Call Recording"}),e.jsx(O,{children:"Record calls for quality and training purposes"})]}),e.jsx(z,{children:e.jsx(ge,{checked:t.value,onCheckedChange:t.onChange})})]})}),e.jsx(V,{control:s.control,name:"transcriptionEnabled",render:({field:t})=>e.jsxs(Q,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(K,{className:"text-base",children:"Call Transcription"}),e.jsx(O,{children:"Automatically transcribe calls to text"})]}),e.jsx(z,{children:e.jsx(ge,{checked:t.value,onCheckedChange:t.onChange})})]})}),e.jsx(V,{control:s.control,name:"aiInsightsEnabled",render:({field:t})=>{const n=s.watch("callRecordingEnabled");return e.jsxs(Q,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(K,{className:"text-base flex items-center gap-1.5",children:[e.jsx($,{className:"h-4 w-4 text-amber-500"}),"AI Insights"]}),e.jsx(O,{children:"Weekly AI analysis of calls to suggest improvements"}),!n&&e.jsxs("p",{className:"text-xs text-amber-600 flex items-center gap-1 mt-1",children:[e.jsx(ae,{className:"h-3 w-3"}),"Requires Call Recording to be enabled"]})]}),e.jsx(z,{children:e.jsx(ge,{checked:t.value,onCheckedChange:R=>{if(R&&!n){a({title:"Call Recording required",description:"Enable Call Recording to use AI Insights. The recording disclosure will be added to your greeting automatically.",variant:"destructive"});return}t.onChange(R)}})})]})}}),e.jsx(V,{control:s.control,name:"maxCallLengthMinutes",render:({field:t})=>e.jsxs(Q,{children:[e.jsxs(K,{className:"flex items-center gap-1.5",children:["Max Call Length (minutes) ",e.jsx(U,{content:"Calls automatically end after this limit. Most calls complete in 2-5 minutes."})]}),e.jsx(z,{children:e.jsx(se,{type:"number",min:1,max:60,...t,onChange:n=>t.onChange(parseInt(n.target.value))})}),e.jsx(O,{children:"Maximum duration for calls before automatic disconnection"}),e.jsx(X,{})]})})]}),e.jsxs(Q,{children:[e.jsxs(K,{className:"flex items-center gap-1.5",children:["Call Transfer Numbers ",e.jsx(U,{content:"Numbers the AI can transfer callers to when they insist on speaking with a person. Use a cell phone or direct line — not your main business number."})]}),e.jsxs(O,{className:"mb-2",children:["When a caller insists on speaking to a person, the AI will transfer the call to these numbers. Use a cell phone or direct line — ",e.jsx("strong",{children:"not"})," your main business number if it forwards to the AI (this would create a loop)."]}),(b==null?void 0:b.phone)&&((ue=s.watch("transferPhoneNumbers"))==null?void 0:ue.some(t=>{const n=R=>R.replace(/\D/g,"").slice(-10);return n(t)===n(b.phone)}))&&e.jsxs(Ke,{variant:"destructive",className:"mb-2",children:[e.jsx(ae,{className:"h-4 w-4"}),e.jsx(Oe,{children:"One of your transfer numbers matches your business phone number. If your business phone forwards to the AI, this will create an infinite loop. Use a different number like a cell phone."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 mb-2",children:[(J=s.watch("transferPhoneNumbers"))==null?void 0:J.map(t=>e.jsxs(N,{className:"px-3 py-1",children:[t,e.jsx(x,{type:"button",variant:"ghost",size:"sm",className:"h-4 w-4 p-0 ml-2 text-gray-500 hover:text-gray-700",onClick:()=>v(t),children:e.jsx(Me,{className:"h-3 w-3"})})]},t)),(!s.watch("transferPhoneNumbers")||(s.watch("transferPhoneNumbers")??[]).length===0)&&e.jsx("span",{className:"text-sm text-gray-500",children:"No transfer numbers added — AI will offer to take a message instead"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(se,{placeholder:"Add phone number (555-123-4567)",value:c,onChange:t=>w(t.target.value)}),e.jsxs(x,{type:"button",onClick:r,disabled:!c.trim(),children:[e.jsx(Ze,{className:"h-4 w-4 mr-1"}),"Add"]})]})]}),s.formState.isDirty&&e.jsxs(Ke,{className:"border-amber-300 bg-amber-50",children:[e.jsx(ae,{className:"h-4 w-4 text-amber-600"}),e.jsxs(Oe,{className:"text-amber-700 flex items-center justify-between",children:[e.jsx("span",{children:"You have unsaved changes. Click Save Configuration to apply them."}),e.jsx(x,{type:"submit",size:"sm",disabled:m,className:"ml-4 shrink-0",children:m?"Saving...":"Save Now"})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:D?"Syncing changes to AI receptionist...":"Changes are automatically pushed to your AI receptionist when you save."}),e.jsxs("div",{className:"flex gap-2",children:[de&&e.jsxs(x,{type:"button",variant:"outline",onClick:ie,disabled:D,children:[D?e.jsx(I,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Retry Sync to AI"]}),e.jsx(x,{type:"submit",disabled:m||D,children:D?e.jsxs(e.Fragment,{children:[e.jsx(I,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing to AI..."]}):m?"Saving...":"Save & Update AI"})]})]})]})})})]})}function Ue(i){return i>=8?{bg:"bg-green-500/15",text:"text-green-700 dark:text-green-400",border:"border-green-500/30"}:i>=6?{bg:"bg-amber-500/15",text:"text-amber-700 dark:text-amber-400",border:"border-amber-500/30"}:{bg:"bg-red-500/15",text:"text-red-700 dark:text-red-400",border:"border-red-500/30"}}function Ge(i){return i.replace(/_/g," ").replace(/\b\w/g,a=>a.toUpperCase())}function Xs({callLogId:i}
22){const[a,d]=o.useState(!1),{toast:m}=Ne(),h=we(),{data:c,isLoading:w}=S({queryKey:[`/api/call-quality/${i}`],queryFn:async()=>{try{const p=await Ve("GET",`/api/call-quality/${i}`);return p.status===404?null:await p.json()}catch{return null}},staleTime:6e4,retry:!1}),g=_({mutationFn:async()=>(await Ve("POST",`/api/call-quality/${i}/dismiss-flag`)).json(),onSuccess:()=>{h.invalidateQueries({queryKey:[`/api/call-quality/${i}`]}),h.invalidateQueries({queryKey:["/api/call-quality/business/flagged"]}),h.invalidateQueries({queryKey:["/api/call-quality/business/summary"]}),m({title:"Flag dismissed",description:"Marked as reviewed."})},onError:()=>{m({title:"Failed to dismiss",variant:"destructive"})}});if(w||!c)return null;const j=Ue(c.totalScore);return e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>d(!0),className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-xs font-semibold border ${j.bg} ${j.text} ${j.border} hover:opacity-80 transition-opacity`,"data-testid":`call-quality-badge-${i}`,title:c.flagged&&!c.flagDismissed?"Flagged for review":"View quality breakdown",children:[e.jsx($,{className:"h-3 w-3"}),c.totalScore.toFixed(1),c.flagged&&!c.flagDismissed&&e.jsx(ae,{className:"h-3 w-3 ml-0.5"})]}),e.jsx(us,{open:a,onOpenChange:d,children:e.jsxs(xs,{className:"sm:max-w-md",children:[e.jsxs(hs,{children:[e.jsxs(gs,{className:"flex items-center gap-2",children:[e.jsx($,{className:"h-5 w-5 text-purple-500"}),"AI Quality Score",e.jsxs(N,{variant:"outline",className:`${j.text}`,children:[c.totalScore.toFixed(1)," / 10"]})]}),e.jsx(ps,{children:"How the AI handled this call, scored against an industry rubric."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"space-y-2",children:Object.entries(c.dimensions).map(([p,f])=>{const k=Ue(f.score);return e.jsxs("div",{className:"border rounded-md p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-medium text-sm",children:Ge(p)}),e.jsxs("span",{className:`text-sm font-semibold ${k.text}`,children:[f.score,"/10"]})]}),f.justification&&e.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:f.justification})]},p)})}),c.failureModes&&c.failureModes.length>0&&e.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-50 dark:bg-amber-950/20 p-3",children:[e.jsx("p",{className:"text-xs font-semibold text-amber-700 dark:text-amber-400 mb-1",children:"Issues detected"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:c.failureModes.map(p=>e.jsx(N,{variant:"outline",className:"text-xs",children:Ge(p)},p))})]}),c.flagged&&!c.flagDismissed&&e.jsx("div",{className:"flex justify-end pt-2 border-t",children:e.jsxs(x,{variant:"outline",size:"sm",onClick:()=>g.mutate(),disabled:g.isPending,children:[e.jsx(ve,{className:"h-4 w-4 mr-1"}),"Mark as reviewed"]})}),c.flagDismissed&&e.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(ve,{className:"h-3 w-3 text-green-600"}),"Reviewed",c.flagDismissedAt?` on ${new Date(c.flagDismissedAt).toLocaleDateString()}`:""]})]})]})})]})}function Pe(i){if(!i)return"answered";const a=i.toLowerCase();return a==="answered"||a==="completed"||a.includes("customer-ended")||a.includes("assistant-ended")||a.includes("end-call")||a.includes("assistant-said")||a.includes("agent_hangup")||a.includes("user_hangup")?"answered":a==="missed"||a.includes("did-not-answer")||a.includes("silence")||a.includes("no-input")||a.includes("dial_no_answer")||a.includes("no_answer")?"missed":a==="voicemail"||a.includes("voicemail")?"voicemail":"answered"}function Ye(i){return i?i==="ai-call"||i==="vapi-ai-call"?"AI Call":i.charAt(0).toUpperCase()+i.slice(1):"General"}function Zs({businessId:i}){const{user:a}=es(),d=(a==null?void 0:a.role)==="admin",[m,h]=o.useState({from:void 0,to:void 0}),[c,w]=o.useState(""),[g,j]=o.useState(""),[p,f]=o.useState(null),k=()=>{const s={businessId:i};return m.from&&(s.startDate=m.from.toISOString()),m.to&&(s.endDate=m.to.toISOString()),c&&c!=="all"&&(s.status=c),g==="true"?s.isEmergency=!0:g==="false"&&(s.isEmergency=!1),s},{data:y=[],isLoading:E}=S({queryKey:["/api/call-logs",k()],enabled:!!i}),u=()=>{h({from:void 0,to:void 0}),w(""),j("")},T=s=>{switch(Pe(s)){case"answered":return e.jsx(bs,{className:"h-4 w-4 text-green-500"});case"missed":return e.jsx(Gs,{className:"h-4 w-4 text-yellow-500"});case"voicemail":return e.jsx(ys,{className:"h-4 w-4 text-blue-500"});default:return e.jsx(te,{className:"h-4 w-4 text-gray-500"})}},b=s=>{const r=Pe(s);switch(r){case"answered":return e.jsx(N,{className:"bg-green-100 text-green-800 hover:bg-green-100 dark:bg-green-900/30 dark:text-green-400",children:"Answered"});case"missed":return e.jsx(N,{className:"bg-yellow-100 text-yellow-800 hover:bg-yellow-100 dark:bg-yellow-900/30 dark:text-yellow-400",children:"Missed"});case"voicemail":return e.jsx(N,{className:"bg-blue-100 text-blue-800 hover:bg-blue-100 dar
22k:bg-blue-900/30 dark:text-blue-400",children:"Voicemail"});default:return e.jsx(N,{children:r})}},A=s=>{if(!s)return"0:00";const r=Math.floor(s/60),v=s%60;return`${r}:${v.toString().padStart(2,"0")}`};return e.jsxs(F,{children:[e.jsxs(G,{children:[e.jsx(Y,{children:"Call History"}),e.jsx(B,{children:"View and filter call logs handled by your virtual receptionist"})]}),e.jsxs(q,{children:[e.jsxs("div",{className:"mb-6 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Date Range"}),e.jsxs(Fs,{children:[e.jsx(qs,{asChild:!0,children:e.jsxs(x,{variant:"outline",className:pe("w-full justify-start text-left font-normal",!m.from&&!m.to&&"text-muted-foreground"),children:[e.jsx(js,{className:"mr-2 h-4 w-4"}),m.from?m.to?e.jsxs(e.Fragment,{children:[Ie(m.from)," -"," ",Ie(m.to)]}):Ie(m.from):"Select date range"]})}),e.jsx(Rs,{className:"w-auto p-0",align:"start",children:e.jsx(Ps,{mode:"range",selected:m,onSelect:s=>h({from:s==null?void 0:s.from,to:s==null?void 0:s.to}),initialFocus:!0})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Status"}),e.jsxs(je,{value:c,onValueChange:w,children:[e.jsx(fe,{children:e.jsx(ye,{placeholder:"All statuses"})}),e.jsxs(be,{children:[e.jsx(P,{value:"all",children:"All statuses"}),e.jsx(P,{value:"answered",children:"Answered"}),e.jsx(P,{value:"missed",children:"Missed"}),e.jsx(P,{value:"voicemail",children:"Voicemail"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Emergency"}),e.jsxs(je,{value:g,onValueChange:j,children:[e.jsx(fe,{children:e.jsx(ye,{placeholder:"All calls"})}),e.jsxs(be,{children:[e.jsx(P,{value:"all",children:"All calls"}),e.jsx(P,{value:"true",children:"Emergency only"}),e.jsx(P,{value:"false",children:"Non-emergency only"})]})]})]}),e.jsx("div",{className:"flex items-end",children:e.jsx(x,{variant:"outline",onClick:u,className:"w-full",children:"Reset Filters"})})]}),E?e.jsx("div",{className:"space-y-3",children:Array.from({length:4}).map((s,r)=>e.jsx("div",{className:"animate-pulse p-4 rounded-lg border",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-muted"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("div",{className:"h-4 bg-muted rounded w-1/3"}),e.jsx("div",{className:"h-3 bg-muted rounded w-1/4"})]})]})},r))}):y.length===0?e.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[e.jsx(te,{className:"h-10 w-10 mx-auto mb-3 opacity-40"}),e.jsx("p",{className:"text-sm font-medium",children:"No calls found"}),e.jsx("p",{className:"text-xs mt-1",children:"Calls handled by your AI receptionist will appear here"})]}):e.jsx("div",{className:"space-y-2",children:y.map(s=>{const r=p===s.id,v=Pe(s.status);return e.jsxs("div",{className:pe("border rounded-lg transition-all cursor-pointer",r?"border-primary/30 shadow-sm":"hover:border-border/80 hover:bg-muted/30"),children:[e.jsxs("div",{className:"flex items-center gap-3 p-4",onClick:()=>f(r?null:s.id),children:[e.jsx("div",{className:pe("w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",v==="answered"&&"bg-green-50 dark:bg-green-900/20",v==="missed"&&"bg-yellow-50 dark:bg-yellow-900/20",v==="voicemail"&&"bg-blue-50 dark:bg-blue-900/20"),children:T(s.status)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium text-sm",children:s.callerName||Ee(s.callerId)}),s.callerName&&e.jsx("span",{className:"text-xs text-muted-foreground",children:Ee(s.callerId)}),s.isEmergency&&e.jsxs(N,{className:"bg-red-100 text-red-800 hover:bg-red-100 dark:bg-red-900/30 dark:text-red-400 text-[10px]",children:[e.jsx(ae,{className:"h-3 w-3 mr-0.5"}),"Emergency"]})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-0.5 text-xs text-muted-foreground",children:[e.jsx("span",{children:fs(s.callTime)}),e.jsx("span",{children:"•"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ze,{className:"h-3 w-3"}),A(s.callDuration)]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",onClick:D=>D.stopPropagation(),children:[b(s.status),e.jsx(N,{variant:"outline",className:"text-[10px] hidden sm:inline-flex",children:Ye(s.intentDetected)}),e.jsx(Xs,{callLogId:s.id}),r?e.jsx(ss,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(as,{className:"h-4 w-4 text-muted-foreground"})]})]}),r&&e.jsx("div",{className:"px-4 pb-4 border-t bg-muted/20",children:e.jsxs("div",{className:"pt-4 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 text-sm",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-xs text-muted-foreground mb-0.5 flex items-center gap-1",children:[e.jsx(te,{className:"h-3 w-3"})," Caller"]}),e.jsx("p",{className:"font-medium",children:Ee(s.callerId)}),s.callerName&&e.jsx("p",{className:"text-xs text-muted-foreground",children:s.callerName})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-xs text-muted-foreground mb-0.5 flex items-center gap-1",children:[e.jsx(ze,{className:"h-3 w-3"})," Duration"]}),e.jsx("p",{className:"font-medium",children:A(s.callDuration)})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-xs text-muted-foreground mb-0.5 flex items-center gap-1",children:[e.jsx(Fe,{className:"h-3 w-3"})," Intent"]}),e.jsx("p",{className:"font-medium",children:Ye(s.intentDetected)})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-xs text-muted-foreground mb-0.5 flex items-center gap-1",children:[e.jsx(Ms,{className:"h-3 w-3"})," Status"]}),b(s.status)]})]}),d&&s.recordingUrl&&e.jsxs("div",{children:[e.jsxs("p",{className:"text-xs text-muted-foreground mb-2 flex items-center gap-1",children:[e.jsx(Ls,{className:"h-3 w-3"})," Recording"]}),e.jsx("audio",{controls:!0,className:"w-full h-10",src:s.recordingUrl,children:"Your browser does not support audio playback."})]}),d?e.jsxs("div",{children:[e.jsxs("p",{className:"text-xs text-muted-foreground mb-2 flex items-center gap-1",children:[e.jsx(Fe,{className:"h-3 w-3"})," Full Transcript"]}),s.transcript?e.jsx("div",{className:"bg-background border rounded-lg p-4 text-sm whitespace-pre-wrap max-h-96 overflow-y-auto leading-relaxed",children:s.transcript}):e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No transcript available for this call"})]}):e.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Call transcripts are managed by the platform administrator"})]})})]},s.id)})})]})]})}const ea={policies:"Policies",service_area:"Service Area",faq:"FAQ",pricing:"Pricing",about:"About",general:"General"},sa={website:"Website",owner:"Manual",unanswered_question:"From Call"};function aa({businessId:i}){const{toast:a}
22=Ne(),d=we(),[m,h]=o.useState(!1),[c,w]=o.useState(""),[g,j]=o.useState(""),[p,f]=o.useState("faq"),[k,y]=o.useState(null),[E,u]=o.useState(""),[T,b]=o.useState(""),[A,s]=o.useState(null),[r,v]=o.useState(""),[D,re]=o.useState(""),[ne,de]=o.useState(!1),[H,ie]=o.useState(!1),{data:me=[],isLoading:ue}=S({queryKey:["/api/knowledge"],enabled:!!i}),{data:J=[],isLoading:t}=S({queryKey:["/api/unanswered-questions",{status:"pending"}],queryFn:async()=>await L("GET","/api/unanswered-questions?status=pending"),enabled:!!i}),{data:n,isLoading:R}=S({queryKey:["/api/knowledge/scrape-status"],enabled:!!i,refetchInterval:l=>{const M=l.state.data;return(M==null?void 0:M.status)==="scraping"?3e3:!1}}),De=o.useRef();o.useEffect(()=>{const l=n==null?void 0:n.status;De.current==="scraping"&&(l==="completed"||l==="failed")&&d.invalidateQueries({queryKey:["/api/knowledge"]}),De.current=l},[n==null?void 0:n.status,d]);const{data:C}=S({queryKey:["/api/business"],enabled:!!i});o.useEffect(()=>{C!=null&&C.phone&&!D&&re(C.phone)},[C==null?void 0:C.phone]);const xe=_({mutationFn:async l=>await L("POST","/api/receptionist/test-call",{phoneNumber:l}),onSuccess:()=>{ie(!0),de(!0),setTimeout(()=>de(!1),3e4),setTimeout(()=>ie(!1),1e4),a({title:"Calling you now!",description:"Answer your phone to test your AI receptionist."})},onError:l=>{a({title:"Test call failed",description:l.message||"Could not initiate test call. Please try again.",variant:"destructive"})}}),Ce=_({mutationFn:async()=>await L("POST","/api/knowledge/scrape-website"),onSuccess:()=>{a({title:"Website scan started",description:"Scanning your website for knowledge..."}),d.invalidateQueries({queryKey:["/api/knowledge/scrape-status"]})},onError:l=>{a({title:"Error",description:l.message||"Failed to start website scan",variant:"destructive"})}}),Ae=_({mutationFn:async l=>await L("POST","/api/knowledge",l),onSuccess:()=>{a({title:"FAQ added",description:"Your AI receptionist will now use this knowledge."}),d.invalidateQueries({queryKey:["/api/knowledge"]}),h(!1),w(""),j(""),f("faq")},onError:()=>{a({title:"Error",description:"Failed to add FAQ entry",variant:"destructive"})}}),Se=_({mutationFn:async({id:l,...M})=>await L("PUT",`/api/knowledge/${l}`,M),onSuccess:()=>{a({title:"Updated",description:"Knowledge entry updated."}),d.invalidateQueries({queryKey:["/api/knowledge"]}),y(null)},onError:()=>{a({title:"Error",description:"Failed to update entry",variant:"destructive"})}}),_e=_({mutationFn:async l=>await L("DELETE",`/api/knowledge/${l}`),onSuccess:()=>{a({title:"Deleted",description:"Knowledge entry removed."}),d.invalidateQueries({queryKey:["/api/knowledge"]})},onError:()=>{a({title:"Error",description:"Failed to delete entry",variant:"destructive"})}}),ke=_({mutationFn:async({id:l,answer:M})=>await L("POST",`/api/unanswered-questions/${l}/answer`,{answer:M}),onSuccess:()=>{a({title:"Answer saved!",description:"Your AI receptionist will now know this answer."}),d.invalidateQueries({queryKey:["/api/unanswered-questions"]}),d.invalidateQueries({queryKey:["/api/unanswered-questions/count"]}),d.invalidateQueries({queryKey:["/api/knowledge"]}),s(null),v("")},onError:()=>{a({title:"Error",description:"Failed to save answer",variant:"destructive"})}}),Qe=_({mutationFn:async l=>await L("POST",`/api/unanswered-questions/${l}/dismiss`),onSuccess:()=>{d.invalidateQueries({queryKey:["/api/unanswered-questions"]}),d.invalidateQueries({queryKey:["/api/unanswered-questions/count"]})},onError:()=>{a({title:"Error",description:"Failed to dismiss question",variant:"destructive"})}}),rs=l=>{y(l.id),u(l.question),b(l.answer)},ns=()=>{!k||!E||!T||Se.mutate({id:k,question:E,answer:T})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(F,{className:"border-green-200",children:[e.jsx(G,{className:"bg-green-50 dark:bg-green-950/30 border-b border-green-200",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(te,{className:"h-5 w-5 text-green-600"}),e.jsxs("div",{children:[e.jsx(Y,{className:"text-lg text-green-800 dark:text-green-200",children:"Test Your AI Receptionist"}),e.jsx(B,{className:"text-green-600 dark:text-green-400",children:"Call yourself to hear exactly what your customers experience"})]})]})}),e.jsx(q,{className:"p-4",children:C!=null&&C.retellAgentId&&(C!=null&&C.retellPhoneNumberId)?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your phone number and we'll call you, connecting you to your AI receptionist. You'll hear the same greeting, voice, and responses your customers do."}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{type:"tel",placeholder:"(555) 123-4567",value:D,onChange:l=>re(l.target.value),className:"max-w-xs"}),e.jsxs(x,{onClick:()=>xe.mutate(D),disabled:!D.trim()||xe.isPending||ne,className:"gap-2 bg-green-600 hover:bg-green-700 text-white",children:[xe.isPending?e.jsx(I,{className:"h-4 w-4 animate-spin"}):e.jsx(te,{className:"h-4 w-4"}),xe.isPending?"Calling...":ne?"Please wait...":"Call Me Now"]})]}),H&&e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-green-50 dark:bg-green-950/30 border border-green-200",children:[e.jsx(ve,{className:"h-4 w-4 text-green-600 flex-shrink-0"}),e.jsx("p",{className:"text-sm text-green-700 dark:text-green-300",children:"Calling you now! Answer your phone to speak with your AI receptionist."})]}),ne&&!H&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"You can place another test call in a few seconds."})]}):e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-yellow-50 dark:bg-yellow-950/30 border border-yellow-200",children:[e.jsx(Te,{className:"h-4 w-4 text-yellow-600 flex-shrink-0"}),e.jsxs("p",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:["Your AI receptionist needs to be set up before you can test it. Go to ",e.jsx("span",{className:"font-medium",children:"Configuration"})," to provision your receptionist."]})]})})]}),e.jsxs(F,{children:[e.jsx(G,{children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($e,{className:"h-5 w-5 text-blue-500"}),e.jsxs("div",{children:[e.jsx(Y,{className:"text-lg",children:"Website Scanner"}),e.jsx(B,{children:"Scan your business website to automatically teach your AI receptionist"})]})]})})}),e.jsx(q,{children:e.jsxs("div",{className:"space-y-4",children:[n&&n.status!=="none"&&e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-gray-50",children:[n.status==="scraping"&&e.jsxs(e.Fragment,{children:[e.jsx(I,{className:"h-4 w-4 animate-spin text-blue-500"}),e.jsx("span",{className:"text-sm text-blue-600",children:"Scanning your website..."})]}),n.status==="completed"&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"h-4 w-4 text-green-500"}),e.jsxs("span",{className:"text-sm text-gray-600",children:["Last scanned: ",n.lastScrapedAt?new Date(n.lastScrapedAt).toLocaleDateString():"Unknown",n.pagesScraped?` (${n.pagesScraped} pages)`:"",n.knowledgeEntriesCount!==void 0?` · ${n.knowledgeEntriesCount}
22 knowledge entries extracted`:""]})]}),n.status==="failed"&&e.jsxs(e.Fragment,{children:[e.jsx(Te,{className:"h-4 w-4 text-red-500"}),e.jsxs("span",{className:"text-sm text-red-600",children:["Scan failed: ",n.errorMessage||"Unknown error"]})]})]}),C!=null&&C.website?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-gray-100 rounded-md text-sm text-gray-700 max-w-md truncate",children:[e.jsx($e,{className:"h-3.5 w-3.5 text-gray-400 flex-shrink-0"}),C.website]}),e.jsxs(x,{onClick:()=>Ce.mutate(),disabled:Ce.isPending||(n==null?void 0:n.status)==="scraping",className:"gap-2 whitespace-nowrap",children:[Ce.isPending||(n==null?void 0:n.status)==="scraping"?e.jsx(I,{className:"h-4 w-4 animate-spin"}):e.jsx(vs,{className:"h-4 w-4"}),(n==null?void 0:n.status)==="completed"?"Re-scan Website":"Scan My Website"]})]}),e.jsx("p",{className:"text-xs text-gray-500",children:"Extracts FAQs, policies, service areas, and more from your website"})]}):e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-yellow-50 border border-yellow-200",children:[e.jsx(Te,{className:"h-4 w-4 text-yellow-600 flex-shrink-0"}),e.jsxs("p",{className:"text-sm text-yellow-700",children:["No website URL set. Add your website URL in"," ",e.jsx("span",{className:"font-medium",children:"Settings → Business Profile"})," ","to enable website scanning."]})]})]})})]}),J.length>0&&e.jsxs(F,{className:"border-orange-200",children:[e.jsx(G,{className:"bg-orange-50 border-b border-orange-200",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Us,{className:"h-5 w-5 text-orange-500"}),e.jsxs("div",{children:[e.jsxs(Y,{className:"text-lg text-orange-700",children:["Questions Your AI Couldn't Answer (",J.length,")"]}),e.jsx(B,{className:"text-orange-600",children:"Callers asked these questions and the AI didn't have a good answer. Provide an answer to teach your AI!"})]})]})}),e.jsx(q,{className:"p-4",children:e.jsx("div",{className:"space-y-3",children:J.map(l=>e.jsxs("div",{className:"p-4 border rounded-lg bg-white",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Xe,{className:"h-4 w-4 text-orange-500"}),e.jsx("p",{className:"font-medium text-sm",children:l.question})]}),l.context&&e.jsxs("p",{className:"text-xs text-gray-500 italic ml-6 mb-2",children:['Context: "',l.context,'"']}),l.callerPhone&&e.jsxs("p",{className:"text-xs text-gray-400 ml-6",children:["Caller: ",l.callerPhone]})]}),A!==l.id&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(x,{size:"sm",onClick:()=>{s(l.id),v("")},className:"gap-1",children:[e.jsx(Ns,{className:"h-3 w-3"}),"Answer"]}),e.jsx(x,{size:"sm",variant:"ghost",onClick:()=>Qe.mutate(l.id),disabled:Qe.isPending,children:e.jsx(Me,{className:"h-3 w-3"})})]})]}),A===l.id&&e.jsxs("div",{className:"mt-3 ml-6 space-y-2",children:[e.jsx(W,{placeholder:"Type the answer your AI should give callers...",value:r,onChange:M=>v(M.target.value),rows:2,className:"text-sm"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(x,{size:"sm",onClick:()=>ke.mutate({id:l.id,answer:r}),disabled:!r.trim()||ke.isPending,className:"gap-1",children:[ke.isPending?e.jsx(I,{className:"h-3 w-3 animate-spin"}):e.jsx(oe,{className:"h-3 w-3"}),"Save Answer"]}),e.jsx(x,{size:"sm",variant:"ghost",onClick:()=>{s(null),v("")},children:"Cancel"})]})]})]},l.id))})})]}),e.jsxs(F,{children:[e.jsx(G,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(qe,{className:"h-5 w-5 text-purple-500"}),e.jsxs("div",{children:[e.jsx(Y,{className:"text-lg",children:"Knowledge Base"}),e.jsx(B,{children:"Everything your AI receptionist knows. Add, edit, or remove entries."})]})]}),e.jsxs(x,{size:"sm",onClick:()=>h(!0),disabled:m,className:"gap-1",children:[e.jsx(Ze,{className:"h-4 w-4"}),"Add FAQ"]})]})}),e.jsx(q,{children:e.jsxs("div",{className:"space-y-3",children:[m&&e.jsxs("div",{className:"p-4 border-2 border-dashed border-purple-200 rounded-lg bg-purple-50",children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"Add New FAQ"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-gray-600",children:"Question (what a caller might ask)"}),e.jsx(se,{placeholder:"e.g., Do you offer free estimates?",value:c,onChange:l=>w(l.target.value),className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-gray-600",children:"Answer (wh
22at the AI should say)"}),e.jsx(W,{placeholder:"e.g., Yes! We offer free in-home estimates for all of our services.",value:g,onChange:l=>j(l.target.value),rows:2,className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-gray-600",children:"Category"}),e.jsxs(je,{value:p,onValueChange:f,children:[e.jsx(fe,{className:"mt-1",children:e.jsx(ye,{})}),e.jsxs(be,{children:[e.jsx(P,{value:"faq",children:"FAQ"}),e.jsx(P,{value:"policies",children:"Policies"}),e.jsx(P,{value:"pricing",children:"Pricing"}),e.jsx(P,{value:"service_area",children:"Service Area"}),e.jsx(P,{value:"about",children:"About"}),e.jsx(P,{value:"general",children:"General"})]})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(x,{size:"sm",onClick:()=>Ae.mutate({question:c,answer:g,category:p}),disabled:!c.trim()||!g.trim()||Ae.isPending,className:"gap-1",children:[Ae.isPending?e.jsx(I,{className:"h-3 w-3 animate-spin"}):e.jsx(oe,{className:"h-3 w-3"}),"Add Entry"]}),e.jsx(x,{size:"sm",variant:"ghost",onClick:()=>{h(!1),w(""),j("")},children:"Cancel"})]})]})]}),ue?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(I,{className:"h-6 w-6 animate-spin text-gray-400"})}):me.length===0?e.jsxs("div",{className:"text-center py-8 text-gray-500",children:[e.jsx(qe,{className:"h-12 w-12 mx-auto mb-3 text-gray-300"}),e.jsx("p",{className:"font-medium",children:"No knowledge entr
22ies yet"}),e.jsx("p",{className:"text-sm mt-1",children:"Scan your website or add FAQs to teach your AI receptionist"})]}):me.map(l=>e.jsx("div",{className:"p-4 border rounded-lg hover:bg-gray-50 transition-colors",children:k===l.id?e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{value:E,onChange:M=>u(M.target.value),className:"text-sm"}),e.jsx(W,{value:T,onChange:M=>b(M.target.value),rows:2,className:"text-sm"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(x,{size:"sm",onClick:ns,disabled:Se.isPending,className:"gap-1",children:[Se.isPending?e.jsx(I,{className:"h-3 w-3 animate-spin"}):e.jsx(oe,{className:"h-3 w-3"}),"Save"]}),e.jsx(x,{size:"sm",variant:"ghost",onClick:()=>y(null),children:"Cancel"})]})]}):e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"font-medium text-sm",children:["Q: ",l.question]}),e.jsxs("p",{className:"text-sm text-gray-600 mt-1",children:["A: ",l.answer]}),e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx(N,{variant:"outline",className:"text-xs",children:ea[l.category||"general"]||l.category}),e.jsx(N,{variant:"secondary",className:`text-xs ${l.source==="website"?"bg-blue-50 text-blue-700":l.source==="owner"?"bg-green-50 text-green-700":"bg-orange-50 text-orange-700"}`,children:sa[l.source]||l.source})]})]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(x,{size:"sm",variant:"ghost",onClick:()=>rs(l),children:e.jsx(ts,{className:"h-3 w-3"})}),e.jsx(x,{size:"sm",variant:"ghost",onClick:()=>_e.mutate(l.id),disabled:_e.isPending,className:"text-red-500 hover:text-red-700",children:e.jsx(Ds,{className:"h-3 w-3"})})]})]})},l.id))]})})]})]})}const Be=i=>{switch(i){case"NEW_FAQ":return"New FAQ";case"UPDATE_GREETING":return"Greeting";case"UPDATE_INSTRUCTIONS":return"Instructions";case"UPDATE_AFTER_HOURS":return"After Hours";case"ADD_EMERGENCY_KEYWORD":return"Emergency";case"GENERAL_INSIGHT":return"Insight";default:return i}},We=i=>{switch(i){case"NEW_FAQ":return"bg-blue-100 text-blue-800 hover:bg-blue-100";case"UPDATE_GREETING":return"bg-purple-100 text-purple-800 hover:bg-purple-100";case"UPDATE_INSTRUCTIONS":return"bg-purple-100 text-purple-800 hover:bg-purple-100";case"UPDATE_AFTER_HOURS":return"bg-indigo-100 text-indigo-800 hover:bg-indigo-100";case"ADD_EMERGENCY_KEYWORD":return"bg-red-100 text-red-800 hover:bg-red-100";case"GENERAL_INSIGHT":return"bg-gray-100 text-gray-800 hover:bg-gray-100";default:return""}};function Je(i,a){if(!a)return"";if(i==="NEW_FAQ")try{const d=JSON.parse(a);return`Q: ${d.question}
23A: ${d.answer}`}catch{return a}return a}function ta({businessId:i,aiInsightsEnabled:a,hasRecordingDisclosure:d,callRecordingEnabled:m}){const{toast:h}=Ne(),c=we(),[w,g]=o.useState(null),[j,p]=o.useState(""),{data:f=[],isLoading:k}=S({queryKey:["/api/receptionist/suggestions"],enabled:!!i&&a===!0}),{data:y}=S({queryKey:["/api/receptionist/suggestions/count"],enabled:!!i}),E=_({mutationFn:r=>L("POST",`/api/receptionist/suggestions/${r}/accept`),onSuccess:()=>{c.invalidateQueries({queryKey:["/api/receptionist/suggestions"]}),c.invalidateQueries({queryKey:["/api/receptionist/suggestions/count"]}),h({title:"Suggestion applied",description:"Your AI receptionist has been updated."})},onError:()=>{h({title:"Error",description:"Failed to apply suggestion.",variant:"destructive"})}}),u=_({mutationFn:r=>L("POST",`/api/receptionist/suggestions/${r}/dismiss`),onSuccess:()=>{c.invalidateQueries({queryKey:["/api/receptionist/suggestions"]}),c.invalidateQueries({queryKey:["/api/receptionist/suggestions/count"]}),h({title:"Suggestion dismissed"})}}),T=_({mutationFn:({id:r,editedValue:v})=>L("POST",`/api/receptionist/suggestions/${r}/edit`,{editedValue:v}),onSuccess:()=>{g(null),p(""),c.invalidateQueries({queryKey:["/api/receptionist/suggestions"]}),c.invalidateQueries({queryKey:["/api/receptionist/suggestions/count"]}),h({title:"Edited suggestion applied",description:"Your AI receptionist has been updated."})},onError:()=>{h({title:"Error",description:"Failed to apply edited suggestion.",variant:"destructive"})}});if(!a)return e.jsx(F,{children:e.jsxs(q,{className:"flex flex-col items-center justify-center py-12",children:[e.jsx($,{className:"h-12 w-12 text-gray-300 mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-gray-500",children:"AI Insights Disabled"}),e.jsxs("p",{className:"text-sm text-gray-400 mt-1 text-center max-w-md",children:["Enable AI Insights in the ",e.jsx("strong",{children:"Configuration"})," tab to let your AI receptionist analyze calls weekly and suggest improvements automatically."]})]})});if(!(m??d??!1))return e.jsx(F,{className:"border-amber-200",children:e.jsxs(q,{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(Vs,{className:"h-12 w-12 text-amber-400 mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-amber-700",children:"Call Recording Required"}),e.jsxs("p",{className:"text-sm text-gray-500 mt-1 text-center max-w-md",children:["AI Insights requires Call Recording to be enabled. Turn on Call Recording in the",e.jsx("strong",{children:" Configuration"})," tab — the recording disclosure will be added to your greeting automatically."]})]})});if(k)return e.jsx(F,{children:e.jsx(q,{className:"flex items-center justify-center py-12",children:e.jsx(I,{className:"h-6 w-6 animate-spin text-gray-400"})})});const A=f.filter(r=>r.status==="pending"),s=f.filter(r=>r.status!=="pending");return f.length===0?e.jsx(F,{children:e.jsxs(q,{className:"flex flex-col items-center justify-center py-12",children:[e.jsx($,{className:"h-12 w-12 text-gray-300 mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-gray-500",children:"No AI Insights Yet"}),e.jsx("p",{className:"text-sm text-gray-400 mt-1 text-center max-w-md",children:"Your AI receptionist will analyze call patterns weekly and suggest improvements. Insights will appear here after your first week of calls."})]})}):e.jsxs("div",{className:"space-y-4",children:[e.jsx(F,{children:e.jsx(q,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx($,{className:"h-5 w-5 text-amber-500"}),e.jsxs("span",{className:"font-medium",children:[A.length," suggestion",A.length!==1?"s":""," to review"]})]}),e.jsxs("span",{className:"text-sm text-gray-500",children:[(y==null?void 0:y.acceptedCount)||0," accepted all-time"]})]})})}),A.map(r=>e.jsx(F,{className:"border-l-4 border-l-amber-400",children:e.jsxs(q,{className:"p-4 space-y-3",children:[e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(N,{className:We(r.type),children:Be(r.type)}),e.jsx(N,{variant:r.riskLevel==="high"?"destructive":"outline",className:r.riskLevel==="low"?"bg-green-50 text-green-700 border-green-200":"",children:r.riskLevel==="high"?e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"h-3 w-3 mr-1"})," HIGH risk"]}):"LOW risk"}),r.occurrenceCount>1&&e.jsxs("span",{className:"text-xs text-gray-500",children:["Seen ",r.occurrenceCount,"x this week"]})]})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium",children:r.title}),e.jsx("p",{className:"text-sm text-gray-600 mt-1",children:r.description})]}),r.currentValue&&e.jsxs("div",{className:"bg-red-50 p-3 rounded-md text-sm",children:[e.jsx("span",{className:"font-medium text-red-700",children:"Current: "}),e.jsx("span",{className:"text-red-600",children:r.currentValue})]}),r.suggestedValue&&e.jsxs("div",{className:"bg-green-50 p-3 rounded-md text-sm",children:[e.jsx("span",{className:"font-medium text-green-700",children:"Suggested: "}),e.jsx("span",{className:"text-green-600 whitespace-pre-wrap",children:Je(r.type,r.suggestedValue)})]}),w===r.id&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{value:j,onChange:v=>p(v.target.value),rows:4,placeholder:"Edit the suggested value..."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(x,{size:"sm",onClick:()=>T.mutate({id:r.id,editedValue:j}),disabled:T.isPending,children:[T.isPending?e.jsx(I,{className:"h-3.5 w-3.5 mr-1 animate-spin"}):e.jsx(oe,{className:"h-3.5 w-3.5 mr-1"}),"Save & Apply"]}),e.jsx(x,{size:"sm",variant:"outline",onClick:()=>{g(null),p("")},children:"Cancel"})]})]}),w!==r.id&&e.jsxs("div",{className:"flex gap-2 pt-1",children:[r.type!=="GENERAL_INSIGHT"&&e.jsxs(x,{size:"sm",onClick:()=>E.mutate(r.id),disabled:E.isPending,children:[E.isPending?e.jsx(I,{className:"h-3.5 w-3.5 mr-1 animate-spin"}):e.jsx(oe,{className:"h-3.5 w-3.5 mr-1"}),"Accept"]}),r.suggestedValue&&r.type!=="GENERAL_INSIGHT"&&e.jsxs(x,{size:"sm",variant:"outline",onClick:()=>{g(r.id),p(Je(r.type,r.suggestedValue))},children:[e.jsx(ts,{className:"h-3.5 w-3.5 mr-1"})," Edit"]}),e.jsxs(x,{size:"sm",variant:"ghost",onClick:()=>u.mutate(r.id),disabled:u.isPending,children:[e.jsx(Me,{className:"h-3.5 w-3.5 mr-1"})," Dismiss"]})]})]})},r.id)),s.length>0&&e.jsx(_s,{type:"single",collapsible:!0,children:e.jsxs(Qs,{value:"history",children:[e.jsxs(Ks,{className:"text-sm text-gray-500",children:["Past suggestions (",s.length,")"]}),e.jsx(Os,{children:e.jsx("div",{className:"space-y-2",children:s.map(r=>e.jsxs("div",{className:"flex items-center justify-between py-2 border-b last:border-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{className:We(r.type)+" text-[10px]",children:Be(r.type)}),e.jsx("span",{className:"text-sm text-gray-600",children:r.title})]}),e.jsx(N,{variant:"outline",className:r.status==="accepted"||r.status==="edited"?"bg-green-50 text-green-700 border-green-200":"bg-gray-50 text-gray-500",children:r.status})]},r.id))})})]})})]})}const ra=o.lazy(()=>Le(()=>import("./PhoneProvisioningCard-C9qBB5FZ.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))),na=o.lazy(()=>Le(()=>import("./CallQualityTrendChart-BoYjn3s_.js"),__vite__mapDeps([13,1,2,3,4,5,6]))),ia=o.lazy(()=>Le(()=>import("./FlaggedCalls-CJAj5uh8.js"),__vite__mapDeps([14,1,2,3,4,5,6,15,16,10,17,18,19,20,21,22,23,8,24,25,26,27,12]))),la=["recorded","recording","monitored","monitor"];function ca(i){if(!i)return!1;const a=i.toLowerCase();return la.some(d=>a.includes(d))}function oa({lastRefreshAt:i}){if(!i)return null;const a=new Date(i).getTime();if(Number.isNaN(a))return null;const d=Date.now()-a,m=Math.floor(d/(1e3*60*60*24)),h=Math.floor(d/(1e3*60*60));let c;return m>=2?c=`${m} days ago`:m===1?c="1 day ago":h>=1?c=`${h} hour${h===1?"":"s"} ago`:c="just now",e.jsxs("div",{className:"mt-2 inline-flex items-center gap-1.5 text-xs text-gray-500 bg-gray-50 border border-gray-200 rounded-full px-2.5 py-1",title:"Your AI receptionist automatically learns from recent calls each week — common questions, frequently mentioned services, and caller sentiment.","data-testid":"ai-learning-indicator",children:[e.jsx(ks,{className:"h-3 w-3 text-amber-500"}),e.jsxs("span",{children:["AI last learned from your calls: ",e.jsx("strong",{className:"font-medium text-gray-700",children:c})]})]})}function da(){const{user:i}=es(),a=i==null?void 0:i.businessId,{data:d}=S({queryKey:["/api/call-logs"],enabled:!!a}),m=((d==null?void 0:d.length)??0)>0,[h,c]=o.useState(null);o.useEffect(()=>{h===null&&d!==void 0&&c(m?"calls":"settings")},[d,h,m]);const w=`sba-receptionist-info-collapsed-${a||"default"}`,[g,j]=o.useState(()=>{try{return localStorage.getItem(w)==="true"}catch{return!1}}),p=()=>{const v=!g;j(v);
23try{localStorage.setItem(w,String(v))}catch{}},{data:f}=S({queryKey:["/api/unanswered-questions/count"],enabled:!!a,refetchInterval:6e4}),k=(f==null?void 0:f.count)||0,{data:y}=S({queryKey:["/api/receptionist/suggestions/count"],enabled:!!a,refetchInterval:6e4}),E=(y==null?void 0:y.count)||0,{data:u}=S({queryKey:["/api/call-quality/business/summary",a],enabled:!!a,staleTime:6e4}),T=(u==null?void 0:u.flaggedCount)||0,{data:b}=S({queryKey:[`/api/receptionist-config/${a}`],enabled:!!a}),{data:A}=S({queryKey:["/api/business"],enabled:!!a}),s=(b==null?void 0:b.aiInsightsEnabled)===!0,r=(b==null?void 0:b.callRecordingEnabled)!==!1;return ca(b==null?void 0:b.greeting),e.jsx(ws,{title:"Virtual Receptionist",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(zs,{tipId:"receptionist-forwarding",title:"Forward your business phone",description:"Set up call forwarding from your business line to your AI receptionist number. It will answer calls, take messages, and book appointments.",icon:$s,actionLabel:"View setup guide",actionHref:"/settings?tab=profile"}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Virtual Receptionist Management"}),e.jsx("p",{className:"text-gray-500",children:"Manage your virtual receptionist settings and view call history"}),e.jsx(oa,{lastRefreshAt:A==null?void 0:A.lastIntelligenceRefreshAt})]}),e.jsxs(F,{className:"mb-6",children:[e.jsx(G,{className:"bg-blue-50 border-b cursor-pointer",onClick:p,children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start",children:[e.jsx(Hs,{className:"h-5 w-5 text-blue-500 mr-2 mt-0.5"}),e.jsxs("div",{children:[e.jsx(Y,{className:"text-blue-700",children:"Virtual Receptionist"}),e.jsx(B,{className:"text-blue-600",children:"Your virtual receptionist uses AI to handle your calls 24/7, schedule appointments, and manage customer inquiries even when you're not available."})]})]}),e.jsx(x,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-blue-500 hover:text-blue-700 flex-shrink-0","aria-label":g?"Expand info card":"Collapse info card",children:g?e.jsx(as,{className:"h-4 w-4"}):e.jsx(ss,{className:"h-4 w-4"})})]})}),!g&&e.jsx(q,{className:"p-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"flex flex-col items-center p-4 bg-gray-50 rounded-lg",children:[e.jsx("div",{className:"h-12 w-12 rounded-full bg-blue-100 flex items-center justify-center mb-3",children:e.jsx(te,{className:"h-6 w-6 text-blue-600"})}),e.jsx("h3",{className:"font-medium text-lg mb-1",children:"24/7 Call Handling"}),e.jsx("p",{className:"text-sm text-center text-gray-500",children:"Never miss a call. The virtual receptionist answers calls anytime, even after hours."})]}),e.jsxs("div",{className:"flex flex-col items-center p-4 bg-gray-50 rounded-lg",children:[e.jsx("div",{className:"h-12 w-12 rounded-full bg-green-100 flex items-center justify-center mb-3",children:e.jsx(Fe,{className:"h-6 w-6 text-green-600"})}),e.jsx("h3",{className:"font-medium text-lg mb-1",children:"Smart Conversations"}),e.jsx("p",{className:"text-sm text-center text-gray-500",children:"Understands caller needs and responds intelligently to schedule appointments or answer questions."})]}),e.jsxs("div",{className:"flex flex-col items-center p-4 bg-gray-50 rounded-lg",children:[e.jsx("div",{className:"h-12 w-12 rounded-full bg-purple-100 flex items-center justify-center mb-3",children:e.jsx(Cs,{className:"h-6 w-6 text-purple-600"})}),e.jsx("h3",{className:"font-medium text-lg mb-1",children:"Fully Customizable"}),e.jsx("p",{className:"text-sm text-center text-gray-500",children:"Customize greetings, after-hours messages, and emergency handling to match your business needs."})]})]})})]}),e.jsx(Z,{fallbackTitle:"Phone provisioning",children:e.jsx(o.Suspense,{fallback:e.jsx("div",{className:"flex justify-center py-8",children:e.jsx(I,{className:"h-6 w-6 animate-spin text-primary"})}),children:e.jsx(ra,{})})}),e.jsxs(As,{defaultValue:"calls",value:h||"calls",onValueChange:c,children:[e.jsxs(Ss,{className:"flex w-full overflow-x-auto sm:grid sm:w-full sm:grid-cols-5 mb-6",children:[e.jsx(le,{value:"calls",children:"Call History"}
23),e.jsxs(le,{value:"quality",className:"relative",children:[e.jsx($,{className:"h-4 w-4 mr-1.5"}),"Quality",T>0&&e.jsx(N,{variant:"destructive",className:"ml-1.5 h-5 min-w-[20px] rounded-full px-1.5 text-[10px]",children:T})]}),e.jsxs(le,{value:"knowledge",className:"relative",children:[e.jsx(qe,{className:"h-4 w-4 mr-1.5"}),"Knowledge Base",k>0&&e.jsx(N,{variant:"destructive",className:"ml-1.5 h-5 min-w-[20px] rounded-full px-1.5 text-[10px]",children:k})]}),e.jsxs(le,{value:"insights",className:"relative",children:[e.jsx($,{className:"h-4 w-4 mr-1.5"}),"AI Insights",E>0&&e.jsx(N,{variant:"destructive",className:"ml-1.5 h-5 min-w-[20px] rounded-full px-1.5 text-[10px]",children:E})]}),e.jsx(le,{value:"settings",children:"Configuration"})]}),e.jsx(ce,{value:"calls",className:"space-y-4",children:e.jsx(Z,{fallbackTitle:"Call history",children:e.jsx(Zs,{businessId:a})})}),e.jsx(ce,{value:"quality",className:"space-y-4",children:e.jsx(Z,{fallbackTitle:"AI quality",children:e.jsxs(o.Suspense,{fallback:e.jsx("div",{className:"flex justify-center py-8",children:e.jsx(I,{className:"h-6 w-6 animate-spin text-primary"})}),children:[e.jsx(na,{}),e.jsx(ia,{})]})})}),e.jsx(ce,{value:"knowledge",className:"space-y-4",children:e.jsx(Z,{fallbackTitle:"Knowledge base",children:e.jsx(aa,{businessId:a??void 0})})}),e.jsx(ce,{value:"insights",className:"space-y-4",children:e.jsx(Z,{fallbackTitle:"AI insights",children:e.jsx(ta,{businessId:a??void 0,aiInsightsEnabled:s,callRecordingEnabled:r})})}),e.jsx(ce,{value:"settings",className:"space-y-4",children:e.jsx(Z,{fallbackTitle:"Receptionist configuration",children:e.jsx(Js,{businessId:a})})})]})]})})}const Ea=Object.freeze(Object.defineProperty({__proto__:null,default:da},Symbol.toStringTag,{value:"Module"}));export{Xs as C,Ea as i};

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.