this.answers[q.k]).map(q => q.q + ' ' + this.answers[q.k]).join('; ');
const first = (f.name.trim().split(' ')[0] || 'there');
this.aiSummary = this.scoreLabel + ' — ' + svc + (f.urgency ? ', ' + f.urgency + ' urgency' : '') + (f.timeline ? ', timeline ' + f.timeline.replace(/-/g, ' ') : '') + (qa ? '. ' + qa : '') + '.';
const fb = 'Hi ' + first + ', thanks for reaching out about ' + svc.toLowerCase() + '. ' +
(this.score >= 70 ? 'We can get a technician to you today — reply YES or call us and we will lock in the next available slot.' :
this.score >= 45 ? 'We have openings this week. What day and time window works best for you?' :
'Happy to help when you are ready. Could you share a few more details or photos so we can give you an accurate price?') +
' — The Peak Home Services team';
const prompt = 'You are the office manager of Peak Home Services, a local home-service company. A new web lead came in. Write a short, friendly reply (2-3 sentences, under 60 words) to send by text message. Address them by first name (' + first + '). Do not promise exact prices, times or phone numbers. ' +
(this.score >= 70 ? 'They are urgent: offer a same-day visit.' : this.score >= 45 ? 'Offer to book a visit this week and ask for a preferred time.' : 'Ask one clarifying question to understand the job.') +
' Sign off as the Peak Home Services team.\\n\\nLead details: service ' + svc + '; urgency ' + (f.urgency || 'not set') + '; timeline ' + (f.timeline || 'not set') + '; ' + (qa ? qa + '; ' : '') + 'notes: ' + (f.description.trim().slice(0, 400) || 'none');
this.aiLoading = true; this.aiReply = '';
window.aiDraft(prompt, fb, 25000).then(r => {
this.aiEngine = r.engine;
window.aiType(r.text.slice(0, 600), (partial, done) => {
this.aiReply = partial;
if (done) this.aiLoading = false;
});
});
},
copyReply() { window.aiCopy(this.aiReply).then(ok => { this.copied = ok; setTimeout(() => this.copied = false, 1600); }); },
maskPhone(e) {
let v = e.target.value.replace(/\\D/g, '').slice(0, 10);
if (v.length === 0) { this.formData.phone = ''; return; }
let f = '';
if (v.length" %} <= 3) f = '(' + v;
else if (v.length <= 6) f = '(' + v.slice(0,3) + ') ' + v.slice(3);
else f = '(' + v.slice(0,3) + ') ' + v.slice(3,6) + '-' + v.slice(6);
this.formData.phone = f;
e.target.value = f;
},
isValidEmail(e) { return /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(e); },
validateStep(n) {
this.errors = {};
if (n === 1) {
if (!this.formData.name.trim()) this.errors.name = 'Name is required';
if (!this.formData.email.trim()) this.errors.email = 'Email is required';
else if (!this.isValidEmail(this.formData.email)) this.errors.email = 'Enter a valid email';
} else if (n === 2) {
if (!this.formData.service) this.errors.service = 'Select a service';
}
return Object.keys(this.errors).length === 0;
},
nextStep() {
if (this.validateStep(this.step)) { this.step++; }
else {
let first = Object.keys(this.errors)[0];
this.shakeField = first;
setTimeout(() => { this.shakeField = ''; }, 600);
}
},
runScoring() {
let pts = 0;
let fx = [];
// --- Contact signals (max ~20) ---
if (this.formData.name.trim().length > 1) { pts += 3; fx.push({label:'Name provided', val:'+3', good:true}); }
else { fx.push({label:'No name', val:'+0', good:false}); }
if (this.formData.email.trim().includes('@')) {
let domain = (this.formData.email.split('@')[1] || '').toLowerCase();
let free = ['gmail.com','yahoo.com','hotmail.com','outlook.com','aol.com','icloud.com','mail.com','protonmail.com','yandex.com','mail.ru'];
if (free.includes(domain)) { pts += 3; fx.push({label:'Personal email', val:'+3', good:true}); }
else if (domain) { pts += 7; fx.push({label:'Business email', val:'+7', good:true}); }
} else { fx.push({label:'No valid email', val:'+0', good:false}); }
if (this.formData.phone.replace(/\D/g,'').length >= 7) { pts += 5; fx.push({label:'Phone provided', val:'+5', good:true}); }
else { fx.push({label:'No phone', val:'+0', good:false}); }
if (this.formData.company.trim().length > 1) { pts += 5; fx.push({label:'Company name', val:'+5', good:true}); }
else { fx.push({label:'No company', val:'+0', good:false}); }
// --- Service (max 12) ---
let svcMap = {'tv-mounting':9,'plumbing':12,'electrical':11,'hvac':12,'handyman':8,'cleaning':7};
if (this.formData.service && svcMap[this.formData.service]) {
pts += svcMap[this.formData.service]; fx.push({label:'Service: ' + this.services[this.formData.service], val:'+' + svcMap[this.formData.service], good:true});
} else { fx.push({label:'No service selected', val:'+0', good:false}); }
// --- Follow-up answers (max 8) ---
let answered = this.questions.filter(q => this.answers[q.k]).length;
if (this.questions.length) {
let ap = Math.round(answered / this.questions.length * 5);
let hot = ['Yes', 'Power outage', 'No heat', 'No cooling', 'Leak', 'Panel upgrade', '85 in +', 'Over a fireplace', 'Move-out', '5+'];
let hotHits = Object.values(this.answers).filter(v => hot.includes(v)).length;
ap += Math.min(3, hotHits);
pts += ap; fx.push({label:'Follow-up answers (' + answered + '/' + this.questions.length + ')', val:'+' + ap, good: ap > 0});
}
// --- Budget (max 20) ---
let budgetMap = {'under-200':4,'200-500':10,'500-1500':16,'1500-5000':20,'5000-plus':20};
if (this.formData.budget && budgetMap[this.formData.budget]) {
pts += budgetMap[this.formData.budget]; fx.push({label:'Budget disclosed', val:'+' + budgetMap[this.formData.budget], good:true});
} else { fx.push({label:'No budget indicated', val:'+0', good:false}); }
// --- Timeline (max 15) ---
let tlMap = {'asap':15,'1-month':12,'1-3-months':10,'3-6-months':6,'no-rush':3};
if (this.formData.timeline && tlMap[this.formData.timeline]) {
pts += tlMap[this.formData.timeline]; fx.push({label:'Timeline: ' + this.formData.timeline.replace(/-/g,' '), val:'+' + tlMap[this.formData.timeline], good:true});
} else { fx.push({label:'No timeline set', val:'+0', good:false}); }
// --- Description (max 15 + 8 intent bonus) ---
let desc = this.formData.description.trim();
let dl = desc.length;
if (dl === 0) { fx.push({label:'No description', val:'+0', good:false}); }
else if (dl < 20) { pts += 2; fx.push({label:'Very brief description', val:'+2', good:false}); }
else if (dl < 60) { pts += 5; fx.push({label:'Short description', val:'+5', good:true}); }
else if (dl < 150) { pts += 10; fx.push({label:'Good description', val:'+10', good:true}); }
else { pts += 15; fx.push({label:'Detailed description', val:'+15', good:true}); }
if (dl > {% trans "0) {
let kw = ['today','asap','need','urgent','leak','ready','book','replace','install','upgrade','quote','estimate','broken','not working','this week','tomorrow','emergency','price','schedule','repair'];
let hits = kw.filter(w => desc.toLowerCase().includes(w)).length;
if (hits >= 3) { pts += 8; fx.push({label:'Strong intent (' + hits + ' signals)', val:'+8', good:true}); }
else if (hits >= 1) { pts += 4; fx.push({label:'Some intent (' + hits + ' signal' + (hits>1?'s':'') + ')', val:'+4', good:true}); }
}
// --- Urgency (max 10) ---
let urgMap = {'low':3,'medium':5,'high':8,'emergency':10};
if (this.formData.urgency && urgMap[this.formData.urgency]) {
pts += urgMap[this.formData.urgency]; fx.push({label:'Urgency: ' + this.formData.urgency, val:'+' + urgMap[this.formData.urgency], good:true});
} else { fx.push({label:'No urgency set', val:'+0', good:false}); }
this.score = Math.min(pts, 100);
this.factors = fx;
if (this.score >= 70) { this.scoreLabel='Hot Lead'; this.scoreColor='text-green-500'; this.statusDot='bg-green-500'; }
else if (this.score >= 45) { this.scoreLabel='Warm Lead'; this.scoreColor='text-amber-500'; this.statusDot='bg-amber-500'; }
else if (this.score >= 20) { this.scoreLabel='Cool Lead'; this.scoreColor='text-blue-500'; this.statusDot='bg-blue-500'; }
else { this.scoreLabel='Cold Lead'; this.scoreColor='text-gray-400'; this.statusDot='bg-gray-400'; }
if (this.score >= 70) { this.estValue='$600 – $2,500'; this.priority='High'; this.priorityColor='text-red-500'; this.recommendation='Call back within 5 minutes and offer a same-day slot. Strong buying signals — urgency, budget, and a specific problem are all present.'; }
else if (this.score >= 45) { this.estValue='$250 – $900'; this.priority='Medium'; this.priorityColor='text-amber-500'; this.recommendation='Text within 1 hour with two available time windows this week. Ask for photos of the job to firm up the price.'; }
else if (this.score >= 20) { this.estValue='$100 – $300'; this.priority='Low'; this.priorityColor='text-blue-500'; this.recommendation='Add to the nurture sequence. Still researching — send a price guide and a seasonal maintenance reminder.'; }
else { this.estValue='" %}< $500'; this.priority='Minimal'; this.priorityColor='text-gray-400'; this.recommendation='Unlikely qualified. Submission is mostly empty — monitor for future engagement but do not prioritize outreach.'; }
}
}" class="max-w-2xl mx-auto">
Contact Information
Tell us how to reach you. We respond within 1 hour.
Fill sample lead
Job Details
Pick a service — the form asks the follow-up questions a dispatcher would.
Service Type *
Select a service...
TV Mounting
Plumbing
Electrical
HVAC Repair
Handyman
House Cleaning
Budget Range
Select budget...
Under $200
$200 – $500
$500 – $1,500
$1,500 – $5,000
$5,000+
Timeline
Select timeline...
ASAP / Urgent
Within 1 month
1 – 3 months
3 – 6 months
No rush / Exploring
Job Description
Urgency
Low
Medium
High
Emergency
AI Lead Qualification
Our AI analyzes your submission and scores it in real time.
Analyzing your submission...
Lead Score
= 45 ? 'bg-gradient-to-r from-amber-400 to-amber-500' : score >= 20 ? 'bg-gradient-to-r from-blue-400 to-blue-500' : 'bg-gray-400'\"
:style=\"{ width: score + '%' }\">" %}
Suggested first reply (SMS)
Click Run AI Analysis to score your lead data.
Previous
Next
Run AI Analysis
Start Over