1import{r as t,j as e}from"./index-DKJ0tKwF.js";import{aU as ye,aE as fe,d as we,fy as Ne,R as Se,iq as le,dz as ne,q as u,J as p,aQ as O,aI as g,aJ as b,s as ie,v as ce,w as de,x as me,y as ue,r as R,aT as Ce,cS as ke,cT as Ae,cU as Pe,aK as Re,T as qe}from"./App-CL-mfmhu.js";import{D as f,p as Ie,r as Me,q as Ee,J as pe}from"./button-DFML8rOM.js";import{am as n,al as h,f as Te}from"./V2Layout-DEbe2yZA.js";import"./tracker-DzJH7QDt.js";import"./v3LegalOverrides-BUgTGJPl.js";import"./mouse-pointer-2-CzsmklB8.js";import"./index-BNGwt955.js";import"./SEOHead-B5IBZJEm.js";import"./types-DU7944Yl.js";const w=[{id:"leads",title:"Leads & Enquiries",maxScore:15,products:["AI Agents","Landing Pages","Forms","Lead Marketplace","Marketing Package"],questions:[{question:"Where do leads come from?",options:[{label:"Word of mouth only",score:0},{label:"One source â ads OR referrals",score:1},{label:"Multiple sources but not tracked",score:2},{label:"Multiple sources, tracked",score:3}]},{question:"How fast does someone respond to a new enquiry?",options:[{label:"Same day or next day",score:0},{label:"Within a few hours",score:1},{label:"Within 30 minutes",score:2},{label:"Instantly / automated",score:3}]},{question:"Do they have a website lead capture tool?",options:[{label:"No website or no capture",score:0},{label:"Basic contact form, not monitored",score:1},{label:"Form with someone checking it",score:2},{label:"Live chat or automated capture",score:3}]},{question:"Have they lost deals due to slow response?",options:[{label:"Yes, definitely",score:0},{label:"Probably",score:1},{label:"Rarely",score:2},{label:"Never â they respond instantly",score:3}]},{question:"Do they buy leads?",options:[{label:"Yes, from poor quality sources",score:0},{label:"Yes but cost is too high",score:1},{label:"Occasionally",score:2},{label:"No â generate enough themselves",score:3}]}]},{id:"crm",title:"CRM & Data",maxScore:12,products:["CRM Starter","CRM Professional","Visual Pipeline","Company Profiles","AI Lead Scoring"],questions:[{question:"Where does customer and lead data live?",options:[{label:"Nowhere / paper / personal phones",score:0},{label:"Spreadsheets",score:1},{label:"Basic CRM, not well used",score:2},{label:"Proper CRM, well managed",score:3}]},{question:"Can they see their pipeline right now?",options:[{label:"No idea what's in the pipeline",score:0},{label:"Rough idea, nothing structured",score:1},{label:"Some visibility",score:2},{label:"Full pipeline visibility",score:3}]},{question:"Do they have a lead scoring system?",options:[{label:"No â everyone treated the same",score:0},{label:"Informal gut feel only",score:1},{label:"Basic tagging system",score:2},{label:"Proper scoring in place",score:3}]},{question:"Do they do B2B â managing company accounts?",options:[{label:"Yes â currently no company management",score:0},{label:"Yes â basic tracking",score:1},{label:"No B2B",score:3}]}]},{id:"followup",title:"Follow Up & Communication",maxScore:18,products:["SMS Campaigns","Email Marketing","Workflow Automation","Unified Inbox","Power Dialler","Voice AI"],questions:[{question:"How many contact attempts before giving up on a lead?",options:[{label:"Once",score:0},{label:"Twice",score:1},{label:"3-4 times",score:2},{label:"5+ structured touches",score:3}]},{question:"Do they send follow-up text messages?",options:[{label:"Never",score:0},{label:"Ad hoc from personal phones",score:1},{label:"Sometimes, no system",score:2},{label:"Yes, automated",score:3}]},{question:"Do they send email campaigns to their database?",options:[{label:"Never",score:0},{label:"Occasionally, manual",score:1},{label:"Regular but no automation",score:2},{label:"Automated sequences running",score:3}]},{question:"Is WhatsApp managed centrally?",options:[{label:"Personal phones, no records",score:0},{label:"One business account, manual",score:1},{label:"Business account with some logging",score:2},{label:"Fully integrated and logged",score:3}]},{question:"Do they have workflow automation in place?",options:[{label:"Nothing automated",score:0},{label:"Basic auto-replies only",score:1},{label:"Some automations",score:2},{label:"Full automation workflows",score:3}]},{question:"Call volume â how many calls per day per person?",options:[{label:"Under 20",score:0},{label:"20-50",score:1},{label:"50-100",score:2},{label:"100+ with a system",score:3}]}]},{id:"database",title:"Dead Database",maxScore:6,products:["Bulk SMS","Email Reactivation","Automation Sequences"],questions:[{question:"When did they last contact their cold database?",options:[{label:"Never systematically",score:0},{label:"Over a year ago",score:1},{label:"Within last 6 months",score:2},{label:"Regular reactivation running",score:3}]},{question:"Estimated % of database that is cold/dormant:",options:[{label:"Over 70%",score:0},{label:"40-70%",score:1},{label:"Under 40%",score:2},{label:"Actively managed",score:3}]}]},{id:"bookings",title:"Bookings & Appointments",maxScore:9,products:["Calendar & Booking","Automated Reminders","AI Agent Meeting Booking"],questions:[{question:"How do people book appointments?",options:[{label:"Phone only, manual",score:0},{label:"WhatsApp/email back and forth",score:1},{label:"Online booking, basic",score:2},{label:"Fully automated with reminders",score:3}]},{question:"No-show rate?",options:[{label:"High â over 20%",score:0},{label:"Medium â 10-20%",score:1},{label:"Low â under 10% with reminders",score:2},{label:"Near zero â automated reminders",score:3}]},{question:"Hours per week spent on booking admin?",options:[{label:"5+ hours",score:0},{label:"2-5 hours",score:1},{label:"Under 2 hours",score:2},{label:"Fully automated",score:3}]}]},{id:"online",title:"Online Presence & Marketing",maxScore:12,products:["Review Automation","Conversion Website","SEO Package","Marketing Package","Landing Pages"],questions:[{question:"Google review count and collection process?",options:[{label:"Under 10, no process",
1score:0},{label:"Some reviews, asked manually",score:1},{label:"Good reviews, manual collection",score:2},{label:"Automated review collection",score:3}]},{question:"Website generating enquiries?",options:[{label:"No website or not generating leads",score:0},{label:"Website but minimal enquiries",score:1},{label:"Some enquiries but underperforming",score:2},{label:"Strong lead-generating website",score:3}]},{question:"Google ranking for main service + location?",options:[{label:"Not visible / page 3+",score:0},{label:"Page 2",score:1},{label:"Page 1, not top 3",score:2},{label:"Top 3 in Google",score:3}]},{question:"Do they run paid ads?",options:[{label:"No ads at all",score:0},{label:"Tried and stopped â didn't work",score:1},{label:"Running ads, not tracking ROI",score:2},{label:"Running ads, tracking ROI",score:3}]}]},{id:"team",title:"Team & Compliance",maxScore:9,products:["Multi-User CRM","Analytics","Agency Plan","Data Lookups","FCA/SRA/CQC Checks"],questions:[{question:"Team visibility of pipeline and leads?",options:[{label:"Everyone in silos, no shared system",score:0},{label:"Some sharing, mostly manual",score:1},{label:"Partial shared system",score:2},{label:"Full shared CRM visibility",score:3}]},{question:"Reporting on sales performance?",options:[{label:"No data at all",score:0},{label:"Basic spreadsheet tracking",score:1},{label:"Some reporting",score:2},{label:"Real-time dashboards",score:3}]},{question:"Do they need compliance/data lookups?",options:[{label:"Yes â currently manual and slow",score:0},{label:"Yes â using multiple websites",score:1},{label:"Occasionally",score:2},{label:"No need",score:3}]}]}],he=[{min:0,max:20,label:"Critical",color:"destructive",recommendation:"CRM Starter (£99/mo) + AI Agent Starter (£799/mo). Get data organised and lead response automated first."},{min:21,max:35,label:"Struggling",color:"destructive",recommendation:"CRM Professional (£199/mo) + Workflow Automation + SMS/Email Campaigns. Fix follow-up first. Reactivation campaign on dead database."},{min:36,max:50,label:"Developing",color:"secondary",recommendation:"Scale Bundle (£999/mo â CRM Professional + AI Agent Professional). Automate lead qualification and follow-up."},{min:51,max:65,label:"Established",color:"default",recommendation:"Complete Marketing Package (from £2,500/mo). Lead generation infrastructure is the next lever."},{min:66,max:81,label:"Advanced",color:"default",recommendation:"Agency Empire Bundle (£1,999/mo) or AI App Building (from £19,995). Scale and white-label."}],De=["Insurance","Solar/Renewables","Financial Services","Home Improvement","Real Estate","Wellness","Other"],Fe=["Solo","2-5","6-15","16-50","50+"];function Be(){var se,ae,oe;const{toast:N}=ye(),{workspace:S}=fe(),{user:q}=we(),[C,W]=t.useState(""),[I,_]=t.useState(""),[G,U]=t.useState(""),[z,L]=t.useState(""),[M,H]=t.useState(""),[E,Y]=t.useState(""),[v,$]=t.useState({}),[i,V]=t.useState([{description:"",revenueImpact:"",product:""},{description:"",revenueImpact:"",product:""},{description:"",revenueImpact:"",product:""}]),[T,J]=t.useState(""),[k,Q]=t.useState(!1),[xe,ge]=t.useState(Object.fromEntries(w.map(s=>[s.id,!0]))),be=(s,a,o)=>{$(r=>({...r,[s]:{...r[s],[a]:o}}))},D=(s,a,o)=>{V(r=>r.map((l,m)=>m===s?{...l,[a]:o}:l))},c=t.useMemo(()=>{const s={};for(const a of w){const o=v[a.id]||{};s[a.id]=Object.values(o).reduce((r,l)=>r+l,0)}return s},[v]),d=t.useMemo(()=>Object.values(c).reduce((s,a)=>s+a,0),[c]),F=81,x=t.useMemo(()=>he.find(s=>d>=s.min&&d<=s.max)||he[0],[d]),A=t.useMemo(()=>{const s=new Set;for(const a of w)(c[a.id]||0)/a.maxScore<.5&&a.products.forEach(l=>s.add(l));return Array.from(s)},[c]),P=t.useMemo(()=>i.reduce((s,a)=>{const o=parseFloat(a.revenueImpact.replace(/[^0-9.]/g,""));return s+(isNaN(o)?0:o)},0),[i]),K=t.useMemo(()=>Object.values(v).reduce((s,a)=>s+Object.keys(a).length,0),[v]),Z=w.reduce((s,a)=>s+a.questions.length,0),X=async()=>{if(!(S!=null&&S.id)||!C.trim()){N({title:"Missing info",description:"Please enter at least the prospect name.",variant:"destructive"});return}Q(!0);try{const{error:s}=await pe.from("prospect_audits").insert({workspace_id:S.id,reseller_id:q==null?void 0:q.id,prospect_name:C,prospect_company:I,prospect_email:G,prospect_phone:z,industry:M,team_size:E,section_scores:c,total_score:d,gaps:i,total_revenue_at_risk:P,recommended_package:x.recommendation,flagged_products:A,notes:T});if(s)throw s;N({title:"Audit saved",description:"Prospect audit has been saved successfully."})}catch(s){N({title:"Error saving",description:s.message,variant:"destructive"})}finally{Q(!1)}},ee=async()=>{try{const s="fujtwtslpgahaburozky",{data:{session:a}}=await pe.auth.getSession(),r=await(await fetch(`https://${s}.supabase.co/functions/v1/generate-audit-pdf`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a==null?void 0:a.access_token}`},body:JSON.stringify({prospectName:C,prospectCompany:I,industry:M,teamSize:E,sectionScores:c,totalScore:d,maxScore:F,scoreBand:x.label,recommendation:x.recommendation,gaps:i,totalRevenueAtRisk:P,flaggedProducts:A,notes:T})})).json();if(r.html){const l=window.open("","_blank");l&&(l.document.write(r.html),l.document.close(),setTimeout(()=>l.print(),500))}}catch(s){N({title:"Export error",description:s.message,variant:"destructive"})}},ve=()=>{W(""),_(""),U(""),L(""),H(""),Y(""),$({}),V([{description:"",revenueImpact:"",product:""},{description:"",revenueImpact:"",product:""},{description:"",revenueImpact:"",product:""}]),J("")},je=s=>{ge(a=>({...a,[s]:!a[s]}))};return e.jsxs("div",{className:"space-y-6 p-6 max-w-4xl mx-auto",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[e.jsx(Ne,{className:"h-6 w-6 text-primary"}),"Prospect Audit Tool"]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Score prospects across 7 areas. Get package recommendations automatically."})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(f,{variant:"outline",size:"sm",onClick:ve,children:[e.jsx(Se,{className:"h-4 w-4 mr-1"})," Reset"]}),e.jsxs(f,{variant:"outline",size:"sm",onClick:ee,children:[e.jsx(le,{className:"h-4 w-4 mr-1"})," Export PDF"]}),e.jsxs(f,{size:"sm",onClick:X,disabled:k,children:[e.jsx(ne,{className:"h-4 w-4 mr-1"})," ",k?"Saving...":"Save Audit"]})]})]}),e.jsx(u,{children:e.jsxs(p,{className:"pt-4 pb-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium",children:"Progress"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[K,"/",Z," questions"]})]}),e.jsx(O,{value:K/Z*100,className:"h-2"})]})}),e.jsxs(u,{children:[e.jsx(g,{className:"pb-3",children:e.jsx(b,{className:"text-base",children:"Prospect Information"})}),e.jsx(p,{children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(n,{children:"Name *"}),e.jsx(h,{value:C,onChange:s=>W(s.target.value),placeholder:"Contact name"})]}),e.jsxs("div",{children:[e.jsx(n,{children:"Company"}
1),e.jsx(h,{value:I,onChange:s=>_(s.target.value),placeholder:"Business name"})]}),e.jsxs("div",{children:[e.jsx(n,{children:"Email"}),e.jsx(h,{type:"email",value:G,onChange:s=>U(s.target.value),placeholder:"[email protected]"})]}),e.jsxs("div",{children:[e.jsx(n,{children:"Phone"}),e.jsx(h,{value:z,onChange:s=>L(s.target.value),placeholder:"Phone number"})]}),e.jsxs("div",{children:[e.jsx(n,{children:"Industry"}),e.jsxs(ie,{value:M,onValueChange:H,children:[e.jsx(ce,{children:e.jsx(de,{placeholder:"Select industry"})}),e.jsx(me,{children:De.map(s=>e.jsx(ue,{value:s,children:s},s))})]})]}),e.jsxs("div",{children:[e.jsx(n,{children:"Team Size"}),e.jsxs(ie,{value:E,onValueChange:Y,children:[e.jsx(ce,{children:e.jsx(de,{placeholder:"Select size"})}),e.jsx(me,{children:Fe.map(s=>e.jsx(ue,{value:s,children:s},s))})]})]})]})})]}),w.map((s,a)=>{const o=c[s.id]||0,r=o/s.maxScore*100,l=xe[s.id];return e.jsxs(u,{children:[e.jsxs(g,{className:"cursor-pointer pb-3",onClick:()=>je(s.id),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(b,{className:"text-base",children:["Section ",a+1," â ",s.title]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(R,{variant:r<40?"destructive":r<70?"secondary":"default",children:[o," / ",s.maxScore]}),l?e.jsx(Ce,{className:"h-4 w-4"}):e.jsx(Te,{className:"h-4 w-4"})]})]}),e.jsx(O,{value:r,className:"h-1.5 mt-2"})]}),l&&e.jsxs(p,{className:"space-y-6",children:[s.questions.map((m,j)=>{var re;const te=(re=v[s.id])==null?void 0:re[j];return e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-3",children:m.question}),e.jsx(ke,{value:te!==void 0?String(te):void 0,onValueChange:y=>be(s.id,j,parseInt(y)),className:"space-y-2",children:m.options.map((y,B)=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ae,{value:String(y.score),id:`${s.id}-${j}-${B}`}),e.jsxs(n,{htmlFor:`${s.id}-${j}-${B}`,className:"text-sm font-normal cursor-pointer",children:[y.label," ",e.jsxs("span",{className:"text-muted-foreground",children:["(",y.score,")"]})]})]},B))})]},j)}),e.jsx(Pe,{}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx("span",{className:"text-xs text-muted-foreground mr-1",children:"Products flagged:"}),s.products.map(m=>e.jsx(R,{variant:"outline",className:"text-xs",children:m},m))]})]})]},s.id)}),e.jsxs(u,{className:"border-2 border-primary/30",children:[e.jsx(g,{children:e.jsxs(b,{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"h-5 w-5"}),"Total Score & Recommendation"]})}),e.jsxs(p,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-4xl font-bold",children:d}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["/ ",F]})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx(O,{value:d/F*100,className:"h-3 mb-2"}),e.jsx(R,{variant:x.color,className:"text-sm",children:x.label})]})]}),e.jsxs("div",{className:"p-4 rounded-lg bg-muted/50 border",children:[e.jsx("p",{className:"text-sm font-medium mb-1",children:"Recommended Package:"}),e.jsx("p",{className:"text-sm",children:x.recommendation})]}),A.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"Flagged Products:"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:A.map(s=>e.jsx(R,{variant:"outline",children:s},s))})]})]})]}),e.jsxs(u,{children:[e.jsxs(g,{children:[e.jsxs(b,{className:"flex items-center gap-2",children:[e.jsx(Me,{className:"h-5 w-5 text-amber-500"}),"Three Biggest Gaps Identified"]}),e.jsx(Re,{children:"Fill in during the call â read back to the prospect at close."})]}),e.jsxs(p,{className:"space-y-6",children:[i.map((s,a)=>e.jsxs("div",{className:"p-4 rounded-lg border bg-muted/30 space-y-3",children:[e.jsxs("h4",{className:"font-semibold text-sm",children:["Gap ",a+1]}),e.jsxs("div",{children:[e.jsx(n,{children:"Description"}),e.jsx(h,{value:s.description,onChange:o=>D(a,"description",o.target.value),placeholder:"What's the gap?"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(n,{children:"Monthly Revenue Impact (£)"}),e.jsx(h,{value:s.revenueImpact,onChange:o=>D(a,"revenueImpact",o.target.value),placeholder:"e.g. 5000"})]}),e.jsxs("div",{children:[e.jsx(n,{children:"Product That Fixes It"}),e.jsx(h,{value:s.product,onChange:o=>D(a,"product",o.target.value),placeholder:"e.g. AI Agents"})]})]})]},a)),e.jsxs("div",{className:"p-4 rounded-lg bg-destructive/10 border border-destructive/30",children:[e.jsx("p",{className:"text-sm font-medium",children:"Total Estimated Revenue at Risk Per Month:"}),e.jsxs("p",{className:"text-2xl font-bold text-destructive",children:["£",P.toLocaleStr
1ing("en-GB",{minimumFractionDigits:0})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Read this number back to the prospect before you close."})]})]})]}),e.jsxs(u,{children:[e.jsx(g,{children:e.jsxs(b,{className:"flex items-center gap-2",children:[e.jsx(Ee,{className:"h-5 w-5"}),"Close Script"]})}),e.jsx(p,{children:e.jsxs("div",{className:"p-4 rounded-lg bg-primary/5 border border-primary/20 text-sm space-y-3",children:[e.jsxs("p",{className:"italic",children:['"Right, so based on everything you have told me, the three areas where you are losing the most right now are'," ",e.jsx("strong",{children:((se=i[0])==null?void 0:se.description)||"[Gap 1]"}),","," ",e.jsx("strong",{children:((ae=i[1])==null?void 0:ae.description)||"[Gap 2]"})," and"," ",e.jsx("strong",{children:((oe=i[2])==null?void 0:oe.description)||"[Gap 3]"}),". Conservatively that is around ",e.jsxs("strong",{children:["£",P.toLocaleString("en-GB")]})," per month that is either being left on the table or going to someone else."]}),e.jsx("p",{className:"italic",children:"The good news is all of that is solved inside one platform. What I would like to do is arrange for you to see it properly â someone from our team will walk you through exactly how it would be configured for your business. We actually build part of your system live on the call so you leave with something working."}),e.jsx("p",{className:"italic",children:'It takes 30 minutes. Does [Day] or [Day] work for you?"'})]})})]}),e.jsxs(u,{children:[e.jsx(g,{children:e.jsx(b,{className:"text-base",children:"Post-Call Notes"})}),e.jsx(p,{children:e.jsx(qe,{value:T,onChange:s=>J(s.target.value),placeholder:"Anything specific to mention on the demo â industry, pain points, names, context...",rows:4})})]}),e.jsxs("div",{className:"flex justify-end gap-2 pb-8",children:[e.jsxs(f,{variant:"outline",onClick:ee,children:[e.jsx(le,{className:"h-4 w-4 mr-1"})," Export PDF"]}),e.jsxs(f,{onClick:X,disabled:k,children:[e.jsx(ne,{className:"h-4 w-4 mr-1"})," ",k?"Saving...":"Save Audit"]})]})]})}function Ve(){return e.jsx("div",{style:{fontFamily:"'Segoe UI Variable','Segoe UI',system-ui,-apple-system,sans-serif",color:"var(--win-text-primary,#FFFFFF)",minHeight:"100%",background:"transparent"},children:e.jsx(Be,{})})}export{Ve 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.