US Live Dispatch Grid Β· 48 States β˜… 4.9/5 Homeowner Rating (18,400+ Repairs) πŸ›‘οΈ FCC 1-to-1 TCPA & TrustedForm Verified
πŸ“ž (888) 419-SUBZ
● LIVE GPS DISPATCH Β· Avg. 38-Min Arrival Β· $0 Diagnostic With Repair

Same-Day Appliance & Emergency HVAC Dispatch in 60 Seconds.

Certified technicians for all 45+ major & luxury brands β€” Samsung, LG, Bosch, Whirlpool, GE, Sub-Zero, Wolf, Carrier & Trane. Select your category below:

All 45+ Brands
Home Appliances
Fridge, Dishwasher, Washer, Oven
VIP Built-In
Luxury Kitchen Pro
Sub-Zero, Wolf, Viking, Miele
38m Avg ETA
Emergency AC
Carrier, Trane, Lennox Cooling
24/7 Rescue
Furnace & Boiler
Emergency No-Heat Service
$245 Avg Call
Emergency Plumbing
Burst Pipe, Tankless Heater, Sewer
High-Ticket
Electrical & Generac
200A Panel, Generator, EV Charger
SJ
Sarah Jenkins Β· Senior US Dispatch Coordinator
"Hi! I'm on duty at the dispatch desk right nowβ€”let's get a local master tech to your door today."
● Live Human Desk (4s Hold)
ALL MAJOR & LUXURY BRANDS Β· SAME-DAY DISPATCH STEP 1 OF 3

Select your brand & primary symptom

Choosing your brand ensures our local service van arrives stocked with genuine factory parts.

Samsung
LG
Bosch
Whirlpool / GE
Sub-Zero ⭐
Wolf / Viking ⭐
Miele / Thermador
Carrier / Trane AC
Certified Factory Repair: $240 – $480 avg. Compared to $2,600+ for purchasing and installing a brand-new unit
Save 85%+ vs. New
🟒 TalexLead Live 5G · 100%
πŸ”§ Contractor App
πŸ‘‘ Your Owner App
πŸ”” NEW EXCLUSIVE PUSH JUST NOW
Sub-Zero PRO 48 Not Cooling
πŸ“ Upper East Side Manhattan (10021) Β· 1.4 mi away
HOMEOWNER VERIFIED ServiceTitan Synced
Jonathan Sterling
+1 (212) 849-3012
🎧 Live Coordinator Handoff (Sarah J.)
"Hi Mike, it's Sarah at the dispatch desk! I have Jonathan on the line right now in Upper East Side, his built-in Sub-Zero PRO 48 stopped cooling. Connecting you two right now!"
Dispatch Notes: Homeowner confirmed warm compressor (54Β°F) and approved same-day afternoon window.
Stripe Auto-Wallet: $1,650.00 Active
● Dispatch CRM Sync Wallet Settings
MOBILE-FIRST ARCHITECTURE (PWA + NATIVE REST API)

Built for Technicians in Vans & Brokers on the Move.

You can also click "πŸ“± Mobile View" in the top black bar at any time to see the entire TalexLead website transform into a 390px smartphone layout with a native bottom navigation bar!

1. 🎧 Live Coordinator Warm Handoff (Click "β–Ά Listen Live Call")

Homeowners never feel like they're talking to a robot β€” warm American dispatch coordinator Sarah Jenkins greets the caller and patches in the local technician seamlessly.

2. πŸ”Œ Direct ServiceTitan, Housecall Pro & Jobber Sync

Every sold lead fires a JSON webhook straight into the contractor's dispatch software with GPS coordinates and TrustedForm TCPA certificate attached.

3. πŸ›‘οΈ 1-Tap Bad-Lead Credit Guarantee

Technicians can tap "1-Tap Credit" in the mobile app or cockpit, and their Stripe wallet is refunded automatically via POST /api/v1/dispute.

⚑ Live US Lead Exchange Simulator
Test instant web leads, 90-second Pay-Per-Call transfers, and 1-Click Contractor Refunds.
Gross Revenue
$0
Web + 90s Calls
Traffic Cost
$0
SEO Grid = $0 CPL
Net Profit
+$0
Margin: 100%
Sold / Credits
0 / 0
TCPA Shield Active
Live Ping-Post & Call Ledger (Click any row)
ID / Mode Brand & ZIP CRM & Buyer Profit Credit
🎧 Live Call Recording, CRM & Refund Inspector
Select a Lead
Connected US Contractors & CRM Sync

πŸ—ΊοΈ Autonomous US Wealth-ZIP SEO Grid ($0 Traffic Cost)

Click any high-income US neighborhood page below to load its localized Sub-Zero & Emergency HVAC dispatch funnel.

● SERVICEDIRECT / RINGBA BENCHMARK CALCULATOR Avg. Close Rate: 62% on 90s Live Calls

Interactive Contractor Monthly ROI Estimator

EST. EXCLUSIVE CALLS
16 Calls
BOOKED REPAIR JOBS
10 Jobs
EST. GROSS REVENUE
$11,500/mo
CONTRACTOR SELF-SERVE ONBOARDING

Connect Your HVAC or Appliance Business in 2 Minutes

Receive exclusive Sub-Zero, Wolf, and Emergency AC repair calls directly inside ServiceTitan, Housecall Pro, Jobber, or our Mobile App.

+ budget.toLocaleString() + '/mo'; document.getElementById('roiTicketVal').textContent = ' const tbody = document.getElementById('txTableBody'); tbody.innerHTML = txs.map((tx) => { let badgeHtml = `SOLD $${tx.salePrice}`; if (tx.sellMode === 'PAY_PER_CALL_90S' && tx.status === 'SOLD') { badgeHtml = `πŸ“ž 90s CALL $${tx.salePrice}`; } else if (tx.status === 'CREDITED_REFUND') { badgeHtml = `β†Ί CREDITED $0`; } else if (tx.status !== 'SOLD') { badgeHtml = `πŸ›‘οΈ TCPA BLOCKED`; } const disputeBtn = tx.status === 'SOLD' ? `` : `${tx.status}`; return ` ${tx.id}
${badgeHtml}
${tx.brand || 'Sub-Zero'}
${tx.city} (${tx.zip})
${tx.winnerBuyerName || 'β€”'}
${tx.crmDelivered || 'ServiceTitan Webhook'} ${tx.netProfit > 0 ? '+$' + tx.netProfit : '$0'} ${disputeBtn} `; }).join(''); if (txs.length > 0) { inspectTx(txs[0]); } } function inspectTx(tx) { document.getElementById('inspTxId').textContent = `${tx.id} Β· ${tx.brand || 'Sub-Zero'} (${tx.status})`; const safeWhisper = (tx.whisperText || '').replace(/'/g, "\\'"); const refundBtn = tx.status === 'SOLD' ? `` : `${tx.rejectReason || tx.status}`; document.getElementById('inspectorBody').innerHTML = `
HOMEOWNER & SYMPTOM
${tx.customerName} Β· ${tx.customerPhone}
${tx.homeowner} (${tx.city})
CRM DELIVERY & TCPA PROOF
${tx.crmDelivered || 'Direct API'}
${tx.trustedFormCert}
🎧 Live Call Recording (Sarah Jenkins · US Dispatch + Tech)
"${tx.whisperText || 'Instant Web Dispatch'}"
Dispatch Log: ${tx.aiTranscript || 'Verified homeowner repair request.'}
Latency: ${tx.latencyMs}ms Β· Source: ${tx.sourceLabel} ${refundBtn}
`; } async function issueLeadCredit(txId) { const res = await fetch('/api/v1/dispute', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ txId, reason: '1-Click Bad-Lead Credit Guarantee (Wallet Refunded Automatically)' }) }); await res.json(); fetchState(); } async function disputeLatestFromMobile() { if (!appState.latestTx || appState.latestTx.status !== 'SOLD') { alert('This lead has already been credited or no active sold lead is selected.'); return; } await issueLeadCredit(appState.latestTx.id); alert(`βœ… 1-Tap Refund Complete! Transaction ${appState.latestTx.id} was credited back to the contractor's Stripe wallet.`); } function renderBuyers(buyers) { const box = document.getElementById('buyerListContainer'); box.innerHTML = buyers.map(b => `
${b.name}
πŸ”Œ ${b.crm || 'ServiceTitan API'}
Web: $${b.bidPrice} Β· Shared: $${b.sharedBidPrice} Β· 90s Call: $${b.callBidPrice}
Wallet: $${b.walletBalance.toLocaleString()}
Today: ${b.soldToday}/${b.dailyCap}
`).join(''); } async function toggleBuyer(buyerId) { await fetch('/api/v1/buyers/toggle', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ buyerId }) }); fetchState(); } function renderSeoGrid(pages) { const grid = document.getElementById('seoCardsGrid'); grid.innerHTML = pages.map(p => `
πŸ“ ZIP ${p.zip} (${p.state}) ${p.monthlySearches}

${p.headline}

${p.subheadline}

Avg Contractor Ticket: ${p.avgTicket}
Your Lead Arbitrage: ${p.leadValue}
`).join(''); } function launchSeoPage(p) { appState.vertical = p.vertical; appState.brand = p.brand; appState.zip = p.zip; appState.sourceType = 'SEO_ORGANIC'; appState.sourceLabel = `SEO City Grid (/city/${p.slug}) β€” $0 CPL`; document.getElementById('activeSeoPill').innerHTML = `πŸ“ LOCAL SEO PAGE ACTIVE: ${p.city} (${p.zip}) Β· $0 Traffic Cost`; document.getElementById('heroDynamicTitle').innerHTML = p.headline; document.getElementById('heroDynamicSub').textContent = p.subheadline; document.getElementById('zipInput').value = p.zip; switchView('consumer'); } async function simulateTraffic(mode) { if (mode === 'LITIGATOR') { await fetch('/api/v1/ingest-quiz', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ vertical: 'subzero', brand: 'Sub-Zero', zip: '33139', fullName: 'Known TCPA Litigator Trap', phone: '3050000000', tcpaConsent: true }) }); fetchState(); return; } const samples = [ { vertical: 'subzero', brand: 'Sub-Zero', zip: '10021', fullName: 'Eleanor Vance', phone: '2125550192', homeowner: 'Sub-Zero BI-48S Built-In Fridge Warm (52Β°F)' }, { vertical: 'hvac_ac', brand: 'Carrier Infinity', zip: '33139', fullName: 'Marcus Sterling', phone: '3055550148', homeowner: 'Carrier Infinity Central AC Compressor Failure' }, { vertical: 'subzero', brand: 'Wolf', zip: '90210', fullName: 'Chloe Kensington', phone: '3105550184', homeowner: 'Wolf 60" Dual-Fuel Range Oven Not Heating' }, { vertical: 'hvac_ac', brand: 'Trane XV', zip: '85253', fullName: 'Harrison Forde', phone: '4805550173', homeowner: 'Trane XV20i AC Emergency (104Β°F Scottsdale)' } ]; const pick = samples[Math.floor(Math.random() * samples.length)]; const isCall = mode === 'PAY_PER_CALL_90S'; const endpoint = isCall ? '/api/v1/ingest-call' : '/api/v1/ingest-quiz'; await fetch(endpoint, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ ...pick, sellMode: isCall ? 'PAY_PER_CALL_90S' : 'SHARED', callDurationSec: 142, sourceType: 'SEO_ORGANIC', sourceLabel: `SEO City Page (${pick.zip}) β€” $0 CPL`, tcpaConsent: true }) }); fetchState(); } async function registerPartner(e) { e.preventDefault(); const statesRaw = document.getElementById('pStates').value; const states = statesRaw.split(',').map(s => s.trim().toUpperCase()).filter(Boolean); await fetch('/api/v1/buyers/add', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ name: document.getElementById('pName').value, vertical: document.getElementById('pVertical').value, crm: document.getElementById('pCrm').value, states, bidPrice: Number(document.getElementById('pBid').value), initialDeposit: Number(document.getElementById('pDeposit').value) }) }); switchView('cockpit'); } async function resetDemoState() { await fetch('/api/v1/reset-demo', { method: 'POST' }); fetchState(); } let callSimTimer = null; let callScenarioIdx = 0; let speechRec = null; const CALL_SCENARIOS = [ { vertical: 'subzero', brand: 'Sub-Zero', zip: '10021', city: 'Manhattan, NY', fullName: 'Eleanor Vance', phone: '(212) 555-0192', homeowner: 'Sub-Zero BI-48S Built-In Fridge Warm (52Β°F)', buyer: 'Manhattan Sub-Zero & Wolf Elite', payout: 230, audioFile: '/audio/call_subzero.mp3', turns: [ { atSec: 0, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (Dispatch Coordinator)', color: '#0284c7', bg: '#f0f9ff', text: '"Hi, thanks for calling local dispatch, this is Sarah! Who am I speaking with today?"' }, { atSec: 12, speaker: '🏠 Eleanor Vance (Homeowner Β· 10021)', color: '#d97706', bg: '#fffbeb', text: '"Hi Sarah, it\'s Eleanor on the Upper East Side. Um, our built-in Sub-Zero fridge just stopped cooling and it\'s blinking 52 degrees."' }, { atSec: 28, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (ZIP Lookup & Warm Call Transfer)', color: '#0284c7', bg: '#f0f9ff', text: '"Oh no, I know how stressful that is! Let me pull up your zip code real quick... okay, 10021, got it. Mike, our senior Sub-Zero tech, just finished a job 10 minutes away on Lexington. Hold on one sec while I patch him right in..." [πŸ“ž Live Warm Transfer Ringtone]' }, { atSec: 48, speaker: 'πŸ”§ Mike (Senior Master Tech Β· Van #14)', color: '#059669', bg: '#ecfdf5', text: '"Hey Sarah, hey Eleanorβ€”Mike here! You said the Sub-Zero refrigerator side is warming up?"' }, { atSec: 58, speaker: '🏠 Eleanor Vance (Homeowner)', color: '#d97706', bg: '#fffbeb', text: '"Yeah, the freezer is fine, but the top fridge is at 52 degrees and we have a full fridge of food."' }, { atSec: 70, speaker: 'πŸ”§ Mike (Master Tech Β· OEM Parts on Truck)', color: '#059669', bg: '#ecfdf5', text: '"Gotcha. On that model it\'s almost always the upper evaporator fan or thermistor, and I\'ve got both genuine Sub-Zero parts right here in my van. I can pull up in about 25 minutesβ€”does that work for you?"' }, { atSec: 84, speaker: '🏠 Eleanor Vance (Address Confirmation)', color: '#d97706', bg: '#fffbeb', text: '"Oh, thank goodness! Yes, 25 minutes is perfect, we\'re at 740 Park Avenue."' } ] }, { vertical: 'hvac_ac', brand: 'Carrier Infinity', zip: '33139', city: 'Miami Beach, FL', fullName: 'Marcus Sterling', phone: '(305) 555-0148', homeowner: 'Carrier Infinity Central AC Compressor Failure', buyer: 'Sunbelt Carrier & Trane Pros', payout: 245, audioFile: '/audio/call_carrier.mp3', turns: [ { atSec: 0, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (Dispatch Coordinator)', color: '#0284c7', bg: '#f0f9ff', text: '"Hi there, Miami Beach emergency dispatch, this is Sarah speaking! How can I help you out today?"' }, { atSec: 12, speaker: '🏠 Marcus Sterling (Homeowner Β· 33139)', color: '#d97706', bg: '#fffbeb', text: '"Hey Sarah, this is Marcus over in South Beach. Our Carrier central AC just went out and it\'s already 86 degrees inside the house."' }, { atSec: 28, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (Live GPS Truck Radar Lookup)', color: '#0284c7', bg: '#f0f9ff', text: '"Oh gosh, in this Florida heat that\'s brutal. Let me check our GPS map for 33139 right now... okay, awesome, Dave is literally 2 miles away near Alton Road. Connecting you straight to his truck!" [πŸ“ž Live Warm Transfer Ringtone]' }, { atSec: 48, speaker: 'πŸ”§ Dave (Lead HVAC Engineer Β· Van #09)', color: '#059669', bg: '#ecfdf5', text: '"Hey Marcus, Dave here! Sarah told me your Carrier Infinity unit stopped cooling. Is the outside fan still spinning, or is it totally dead?"' }, { atSec: 60, speaker: '🏠 Marcus Sterling (Homeowner)', color: '#d97706', bg: '#fffbeb', text: '"The fan outside is spinning, Dave, but the vents inside are just blowing warm air."' }, { atSec: 72, speaker: 'πŸ”§ Dave (Master Tech Β· 20-Min ETA)', color: '#059669', bg: '#ecfdf5', text: '"Okay, that\'s actually good newsβ€”sounds like a capacitor or compressor relay. I carry the factory Carrier parts on my truck and I can be in your driveway in 20 minutes."' }, { atSec: 84, speaker: '🏠 Marcus Sterling (Gate Access Confirmed)', color: '#d97706', bg: '#fffbeb', text: '"Man, you\'re a lifesaver. Come on over, the gate code is 4412."' } ] }, { vertical: 'appliance', brand: 'Bosch 800 Series', zip: '90210', city: 'Beverly Hills, CA', fullName: 'Chloe Kensington', phone: '(310) 555-0184', homeowner: 'Bosch 800 Dishwasher E24 Drain Error & Leak', buyer: 'SoCal Luxury Appliance Dispatch', payout: 230, audioFile: '/audio/call_bosch.mp3', turns: [ { atSec: 0, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (Dispatch Coordinator)', color: '#0284c7', bg: '#f0f9ff', text: '"Hi, thanks for calling Beverly Hills appliance dispatch, this is Sarah! How can I help you today?"' }, { atSec: 12, speaker: '🏠 Chloe Kensington (Homeowner Β· 90210)', color: '#d97706', bg: '#fffbeb', text: '"Hi Sarah, it\'s Chloe. My Bosch dishwasher is beeping with an E24 code on the screen and there\'s water sitting at the bottom."' }, { atSec: 28, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (Connecting Local Specialist)', color: '#0284c7', bg: '#f0f9ff', text: '"Gotcha, E24 on a Bosch is a drain blockage or pump sensor. Let\'s see who\'s closest to 90210... okay, Alex is just off Wilshire Boulevard right now. Let me patch him onto the line!" [πŸ“ž Live Warm Transfer Ringtone]' }, { atSec: 48, speaker: 'πŸ”§ Alex (Appliance Specialist Β· Van #22)', color: '#059669', bg: '#ecfdf5', text: '"Hi Chloe, this is Alex! Did you manage to shut the under-sink water valve off, or is it just standing water inside the tub?"' }, { atSec: 60, speaker: '🏠 Chloe Kensington (Homeowner)', color: '#d97706', bg: '#fffbeb', text: '"Hi Alex! We turned the valve off under the sink just to be safe, so it stopped leaking."' }, { atSec: 72, speaker: 'πŸ”§ Alex (Master Tech Β· Bosch Pump in Stock)', color: '#059669', bg: '#ecfdf5', text: '"Smart move. I\'ve got the genuine Bosch 800-series drain pump and aqua-stop kit in my van right now. I can head over in about 30 minutes and have it running before dinner."' }, { atSec: 84, speaker: '🏠 Chloe Kensington (Appointment Confirmed)', color: '#d97706', bg: '#fffbeb', text: '"That would be wonderful, thank you so much Alex!"' } ] }, { vertical: 'hvac_ac', brand: 'Trane XV20i', zip: '85253', city: 'Scottsdale, AZ', fullName: 'Harrison Forde', phone: '(480) 555-0173', homeowner: 'Trane XV20i Emergency AC Outage (104Β°F Indoor)', buyer: 'Desert Peak HVAC Emergency', payout: 245, audioFile: '/audio/call_trane.mp3', turns: [ { atSec: 0, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (Dispatch Coordinator)', color: '#0284c7', bg: '#f0f9ff', text: '"Hi, Scottsdale cooling dispatch, this is Sarah! What\'s going on with your system today?"' }, { atSec: 12, speaker: '🏠 Harrison Forde (Homeowner Β· 85253)', color: '#d97706', bg: '#fffbeb', text: '"Hi Sarah, it\'s Harrison in Paradise Valley. It\'s 104 degrees out and our upstairs Trane AC just completely shut off."' }, { atSec: 28, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (Priority Emergency Transfer)', color: '#0284c7', bg: '#f0f9ff', text: '"Oh gosh, let\'s get someone out to 85253 immediately... okay, I see Ryan, our lead Trane master tech, is 5 minutes away on Scottsdale Road. Connecting you two right now!" [πŸ“ž Live Warm Transfer Ringtone]' }, { atSec: 48, speaker: 'πŸ”§ Ryan (Lead Trane Engineer Β· Van #11)', color: '#059669', bg: '#ecfdf5', text: '"Hey Harrison, Ryan here! Did the thermostat screen go blank too, or does the thermostat still have power?"' }, { atSec: 60, speaker: '🏠 Harrison Forde (Homeowner)', color: '#d97706', bg: '#fffbeb', text: '"Hey Ryanβ€”yeah, the thermostat screen is totally blank upstairs, nothing\'s turning on."' }, { atSec: 72, speaker: 'πŸ”§ Ryan (Master Tech Β· 5 Mins Away)', color: '#059669', bg: '#ecfdf5', text: '"Aha, that\'s almost certainly the float switch or low-voltage transformer tripping to protect the Trane compressor. I\'m 5 minutes down the roadβ€”I\'ll head straight to your house right now."' }, { atSec: 84, speaker: '🏠 Harrison Forde (Appointment Confirmed)', color: '#d97706', bg: '#fffbeb', text: '"Awesome, appreciate how fast you guys are. See you in 5 minutes!"' } ] } ]; async function openLiveCallSimulator() { const modal = document.getElementById('liveCallSimModal'); if (!modal) return; modal.style.display = 'flex'; const pick = CALL_SCENARIOS[callScenarioIdx % CALL_SCENARIOS.length]; callScenarioIdx++; document.getElementById('simCallerName').textContent = `${pick.fullName} Β· ${pick.phone} (${pick.city} ${pick.zip})`; document.getElementById('simWinnerBuyer').textContent = `${pick.buyer} (Payout: $${pick.payout})`; const turnsBox = document.getElementById('simTurnsContainer'); turnsBox.innerHTML = pick.turns.map((t, i) => `
${t.speaker}
${t.text}
`).join(''); const statusBadge = document.getElementById('simStatusBadge'); const timerLabel = document.getElementById('simTimerCount'); const progressBar = document.getElementById('simTimerBar'); const profitBox = document.getElementById('simProfitResult'); statusBadge.textContent = 'πŸ‘©β€πŸ’Ό LIVE US CALL TRANSFER (DISPATCH DESK + WARM TECH HANDOFF)'; statusBadge.style.background = '#e0f2fe'; statusBadge.style.color = '#0369a1'; timerLabel.textContent = '00:00 / 01:30 (90s Billable Buffer)'; progressBar.style.width = '0%'; progressBar.style.background = '#0284c7'; profitBox.style.display = 'none'; playVoiceWhisper(pick.turns[0].text, pick.audioFile + '?v=' + Date.now()); if (callSimTimer) clearInterval(callSimTimer); let sec = 0; callSimTimer = setInterval(async () => { sec += 1; if (sec > 90) sec = 90; const mins = String(Math.floor(sec / 60)).padStart(2, '0'); const remSecs = String(sec % 60).padStart(2, '0'); timerLabel.textContent = `${mins}:${remSecs} / 01:30 (${sec} sec of 90s buffer)`; progressBar.style.width = `${Math.round((sec / 90) * 100)}%`; pick.turns.forEach((t, idx) => { const nextSec = pick.turns[idx + 1] ? pick.turns[idx + 1].atSec : 999; const el = document.getElementById('simTurn-' + idx); if (!el) return; if (sec >= t.atSec && sec < nextSec) { el.style.background = t.bg; el.style.borderColor = t.color; el.style.opacity = '1'; if (sec === t.atSec && idx > 0) { el.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); } } else if (sec >= nextSec) { el.style.background = '#f8fafc'; el.style.borderColor = '#cbd5e1'; el.style.opacity = '0.82'; } }); if (sec >= 90) { clearInterval(callSimTimer); progressBar.style.background = '#00b67a'; statusBadge.textContent = 'βœ… 90s BILLABLE BUFFER PASSED β€” CALL SOLD FOR +$' + pick.payout + '!'; statusBadge.style.background = '#d1fae5'; statusBadge.style.color = '#065f46'; const res = await fetch('/api/v1/ingest-call', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ ...pick, whisperText: pick.turns[2].text, sellMode: 'PAY_PER_CALL_90S', callDurationSec: 142, sourceType: 'SEO_ORGANIC', sourceLabel: `SEO City Page (${pick.zip}) β€” $0 CPL`, tcpaConsent: true }) }); const data = await res.json(); const paid = (data && data.transaction && data.transaction.netProfit) || pick.payout; document.getElementById('simProfitAmount').textContent = `+$${paid} USD`; profitBox.style.display = 'block'; fetchState(); } }, 380); } // Interactive "Talk to Sarah Yourself" Mode (Microphone or 1-Click Voice Replies) function startInteractiveTalkToSarah(userSpokenText) { if (callSimTimer) clearInterval(callSimTimer); const box = document.getElementById('interactiveSarahBox'); box.style.display = 'block'; const log = document.getElementById('interactiveSarahLog'); if (!userSpokenText) { log.innerHTML = `
πŸ‘©β€πŸ’Ό Sarah: "Hi, thanks for calling local dispatch, this is Sarah! Which appliance or AC unit is giving you trouble today, and what's your ZIP code?"
`; playVoiceWhisper('', '/audio/interactive_greet.mp3?v=' + Date.now()); return; } const lower = userSpokenText.toLowerCase(); let replyAudio = '/audio/interactive_reply_fridge.mp3'; let replyText = "Oh no, I completely understand how stressful a warm fridge is! I just checked your zip code and Mike, our senior refrigeration tech, is 10 minutes away with factory parts in his van. Patching him onto the line for you right now!"; if (lower.includes('ac') || lower.includes('air') || lower.includes('cool') || lower.includes('heat') || lower.includes('carrier') || lower.includes('trane')) { replyAudio = '/audio/interactive_reply_ac.mp3'; replyText = "Ugh, having the AC go out in this heat is the worst! Let me pull up our GPS map... okay, got it! Dave, our lead cooling tech, is two miles away with a fully stocked truck. Let me connect you straight to Dave right now!"; } else if (lower.includes('dish') || lower.includes('leak') || lower.includes('wash') || lower.includes('bosch')) { replyAudio = '/audio/interactive_reply_washer.mp3'; replyText = "Gotcha, let's get that leak taken care of right away! I see Alex, our certified appliance specialist, is just around the corner from you. Hold on one sec while I patch Alex onto the call!"; } log.innerHTML = `
🎀 You said: "${userSpokenText}"
πŸ‘©β€πŸ’Ό Sarah + πŸ”§ Master Tech (Live Response): "${replyText}"
`; playVoiceWhisper(replyText, replyAudio + '?v=' + Date.now()); } function listenFromMicrophone() { const SR = window.SpeechRecognition || window.webkitSpeechRecognition; if (!SR) { startInteractiveTalkToSarah("Hi Sarah, my Sub-Zero refrigerator stopped cooling in Manhattan 10021."); return; } if (speechRec) { try { speechRec.stop(); } catch (e) {} } speechRec = new SR(); speechRec.lang = 'en-US'; speechRec.interimResults = false; const btn = document.getElementById('micListenBtn'); btn.textContent = 'πŸ”΄ Listening to your microphone (speak in English)...'; speechRec.onresult = (e) => { const transcript = e.results[0][0].transcript; btn.textContent = '🎀 Speak Into Microphone'; startInteractiveTalkToSarah(transcript); }; speechRec.onerror = () => { btn.textContent = '🎀 Speak Into Microphone'; startInteractiveTalkToSarah("Hi Sarah, our central AC is blowing warm air and we need a tech today."); }; speechRec.start(); } function closeLiveCallSimulator(openCockpit) { if (callSimTimer) clearInterval(callSimTimer); if (activeCallAudio) { activeCallAudio.pause(); activeCallAudio.currentTime = 0; } if ('speechSynthesis' in window) window.speechSynthesis.cancel(); const modal = document.getElementById('liveCallSimModal'); if (modal) modal.style.display = 'none'; if (openCockpit) switchView('cockpit'); } fetchState(); + ticket.toLocaleString(); const calls = Math.max(5, Math.round(budget / 185)); const jobs = Math.max(3, Math.round(calls * 0.62)); const rev = jobs * ticket; document.getElementById('roiCallsOut').textContent = calls + ' Calls'; document.getElementById('roiJobsOut').textContent = jobs + ' Jobs'; document.getElementById('roiRevOut').textContent = ' const tbody = document.getElementById('txTableBody'); tbody.innerHTML = txs.map((tx) => { let badgeHtml = `SOLD $${tx.salePrice}`; if (tx.sellMode === 'PAY_PER_CALL_90S' && tx.status === 'SOLD') { badgeHtml = `πŸ“ž 90s CALL $${tx.salePrice}`; } else if (tx.status === 'CREDITED_REFUND') { badgeHtml = `β†Ί CREDITED $0`; } else if (tx.status !== 'SOLD') { badgeHtml = `πŸ›‘οΈ TCPA BLOCKED`; } const disputeBtn = tx.status === 'SOLD' ? `` : `${tx.status}`; return ` ${tx.id}
${badgeHtml}
${tx.brand || 'Sub-Zero'}
${tx.city} (${tx.zip})
${tx.winnerBuyerName || 'β€”'}
${tx.crmDelivered || 'ServiceTitan Webhook'} ${tx.netProfit > 0 ? '+$' + tx.netProfit : '$0'} ${disputeBtn} `; }).join(''); if (txs.length > 0) { inspectTx(txs[0]); } } function inspectTx(tx) { document.getElementById('inspTxId').textContent = `${tx.id} Β· ${tx.brand || 'Sub-Zero'} (${tx.status})`; const safeWhisper = (tx.whisperText || '').replace(/'/g, "\\'"); const refundBtn = tx.status === 'SOLD' ? `` : `${tx.rejectReason || tx.status}`; document.getElementById('inspectorBody').innerHTML = `
HOMEOWNER & SYMPTOM
${tx.customerName} Β· ${tx.customerPhone}
${tx.homeowner} (${tx.city})
CRM DELIVERY & TCPA PROOF
${tx.crmDelivered || 'Direct API'}
${tx.trustedFormCert}
🎧 Live Call Recording (Sarah Jenkins · US Dispatch + Tech)
"${tx.whisperText || 'Instant Web Dispatch'}"
Dispatch Log: ${tx.aiTranscript || 'Verified homeowner repair request.'}
Latency: ${tx.latencyMs}ms Β· Source: ${tx.sourceLabel} ${refundBtn}
`; } async function issueLeadCredit(txId) { const res = await fetch('/api/v1/dispute', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ txId, reason: '1-Click Bad-Lead Credit Guarantee (Wallet Refunded Automatically)' }) }); await res.json(); fetchState(); } async function disputeLatestFromMobile() { if (!appState.latestTx || appState.latestTx.status !== 'SOLD') { alert('This lead has already been credited or no active sold lead is selected.'); return; } await issueLeadCredit(appState.latestTx.id); alert(`βœ… 1-Tap Refund Complete! Transaction ${appState.latestTx.id} was credited back to the contractor's Stripe wallet.`); } function renderBuyers(buyers) { const box = document.getElementById('buyerListContainer'); box.innerHTML = buyers.map(b => `
${b.name}
πŸ”Œ ${b.crm || 'ServiceTitan API'}
Web: $${b.bidPrice} Β· Shared: $${b.sharedBidPrice} Β· 90s Call: $${b.callBidPrice}
Wallet: $${b.walletBalance.toLocaleString()}
Today: ${b.soldToday}/${b.dailyCap}
`).join(''); } async function toggleBuyer(buyerId) { await fetch('/api/v1/buyers/toggle', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ buyerId }) }); fetchState(); } function renderSeoGrid(pages) { const grid = document.getElementById('seoCardsGrid'); grid.innerHTML = pages.map(p => `
πŸ“ ZIP ${p.zip} (${p.state}) ${p.monthlySearches}

${p.headline}

${p.subheadline}

Avg Contractor Ticket: ${p.avgTicket}
Your Lead Arbitrage: ${p.leadValue}
`).join(''); } function launchSeoPage(p) { appState.vertical = p.vertical; appState.brand = p.brand; appState.zip = p.zip; appState.sourceType = 'SEO_ORGANIC'; appState.sourceLabel = `SEO City Grid (/city/${p.slug}) β€” $0 CPL`; document.getElementById('activeSeoPill').innerHTML = `πŸ“ LOCAL SEO PAGE ACTIVE: ${p.city} (${p.zip}) Β· $0 Traffic Cost`; document.getElementById('heroDynamicTitle').innerHTML = p.headline; document.getElementById('heroDynamicSub').textContent = p.subheadline; document.getElementById('zipInput').value = p.zip; switchView('consumer'); } async function simulateTraffic(mode) { if (mode === 'LITIGATOR') { await fetch('/api/v1/ingest-quiz', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ vertical: 'subzero', brand: 'Sub-Zero', zip: '33139', fullName: 'Known TCPA Litigator Trap', phone: '3050000000', tcpaConsent: true }) }); fetchState(); return; } const samples = [ { vertical: 'subzero', brand: 'Sub-Zero', zip: '10021', fullName: 'Eleanor Vance', phone: '2125550192', homeowner: 'Sub-Zero BI-48S Built-In Fridge Warm (52Β°F)' }, { vertical: 'hvac_ac', brand: 'Carrier Infinity', zip: '33139', fullName: 'Marcus Sterling', phone: '3055550148', homeowner: 'Carrier Infinity Central AC Compressor Failure' }, { vertical: 'subzero', brand: 'Wolf', zip: '90210', fullName: 'Chloe Kensington', phone: '3105550184', homeowner: 'Wolf 60" Dual-Fuel Range Oven Not Heating' }, { vertical: 'hvac_ac', brand: 'Trane XV', zip: '85253', fullName: 'Harrison Forde', phone: '4805550173', homeowner: 'Trane XV20i AC Emergency (104Β°F Scottsdale)' } ]; const pick = samples[Math.floor(Math.random() * samples.length)]; const isCall = mode === 'PAY_PER_CALL_90S'; const endpoint = isCall ? '/api/v1/ingest-call' : '/api/v1/ingest-quiz'; await fetch(endpoint, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ ...pick, sellMode: isCall ? 'PAY_PER_CALL_90S' : 'SHARED', callDurationSec: 142, sourceType: 'SEO_ORGANIC', sourceLabel: `SEO City Page (${pick.zip}) β€” $0 CPL`, tcpaConsent: true }) }); fetchState(); } async function registerPartner(e) { e.preventDefault(); const statesRaw = document.getElementById('pStates').value; const states = statesRaw.split(',').map(s => s.trim().toUpperCase()).filter(Boolean); await fetch('/api/v1/buyers/add', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ name: document.getElementById('pName').value, vertical: document.getElementById('pVertical').value, crm: document.getElementById('pCrm').value, states, bidPrice: Number(document.getElementById('pBid').value), initialDeposit: Number(document.getElementById('pDeposit').value) }) }); switchView('cockpit'); } async function resetDemoState() { await fetch('/api/v1/reset-demo', { method: 'POST' }); fetchState(); } let callSimTimer = null; let callScenarioIdx = 0; let speechRec = null; const CALL_SCENARIOS = [ { vertical: 'subzero', brand: 'Sub-Zero', zip: '10021', city: 'Manhattan, NY', fullName: 'Eleanor Vance', phone: '(212) 555-0192', homeowner: 'Sub-Zero BI-48S Built-In Fridge Warm (52Β°F)', buyer: 'Manhattan Sub-Zero & Wolf Elite', payout: 230, audioFile: '/audio/call_subzero.mp3', turns: [ { atSec: 0, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (Dispatch Coordinator)', color: '#0284c7', bg: '#f0f9ff', text: '"Hi, thanks for calling local dispatch, this is Sarah! Who am I speaking with today?"' }, { atSec: 12, speaker: '🏠 Eleanor Vance (Homeowner Β· 10021)', color: '#d97706', bg: '#fffbeb', text: '"Hi Sarah, it\'s Eleanor on the Upper East Side. Um, our built-in Sub-Zero fridge just stopped cooling and it\'s blinking 52 degrees."' }, { atSec: 28, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (ZIP Lookup & Warm Call Transfer)', color: '#0284c7', bg: '#f0f9ff', text: '"Oh no, I know how stressful that is! Let me pull up your zip code real quick... okay, 10021, got it. Mike, our senior Sub-Zero tech, just finished a job 10 minutes away on Lexington. Hold on one sec while I patch him right in..." [πŸ“ž Live Warm Transfer Ringtone]' }, { atSec: 48, speaker: 'πŸ”§ Mike (Senior Master Tech Β· Van #14)', color: '#059669', bg: '#ecfdf5', text: '"Hey Sarah, hey Eleanorβ€”Mike here! You said the Sub-Zero refrigerator side is warming up?"' }, { atSec: 58, speaker: '🏠 Eleanor Vance (Homeowner)', color: '#d97706', bg: '#fffbeb', text: '"Yeah, the freezer is fine, but the top fridge is at 52 degrees and we have a full fridge of food."' }, { atSec: 70, speaker: 'πŸ”§ Mike (Master Tech Β· OEM Parts on Truck)', color: '#059669', bg: '#ecfdf5', text: '"Gotcha. On that model it\'s almost always the upper evaporator fan or thermistor, and I\'ve got both genuine Sub-Zero parts right here in my van. I can pull up in about 25 minutesβ€”does that work for you?"' }, { atSec: 84, speaker: '🏠 Eleanor Vance (Address Confirmation)', color: '#d97706', bg: '#fffbeb', text: '"Oh, thank goodness! Yes, 25 minutes is perfect, we\'re at 740 Park Avenue."' } ] }, { vertical: 'hvac_ac', brand: 'Carrier Infinity', zip: '33139', city: 'Miami Beach, FL', fullName: 'Marcus Sterling', phone: '(305) 555-0148', homeowner: 'Carrier Infinity Central AC Compressor Failure', buyer: 'Sunbelt Carrier & Trane Pros', payout: 245, audioFile: '/audio/call_carrier.mp3', turns: [ { atSec: 0, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (Dispatch Coordinator)', color: '#0284c7', bg: '#f0f9ff', text: '"Hi there, Miami Beach emergency dispatch, this is Sarah speaking! How can I help you out today?"' }, { atSec: 12, speaker: '🏠 Marcus Sterling (Homeowner Β· 33139)', color: '#d97706', bg: '#fffbeb', text: '"Hey Sarah, this is Marcus over in South Beach. Our Carrier central AC just went out and it\'s already 86 degrees inside the house."' }, { atSec: 28, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (Live GPS Truck Radar Lookup)', color: '#0284c7', bg: '#f0f9ff', text: '"Oh gosh, in this Florida heat that\'s brutal. Let me check our GPS map for 33139 right now... okay, awesome, Dave is literally 2 miles away near Alton Road. Connecting you straight to his truck!" [πŸ“ž Live Warm Transfer Ringtone]' }, { atSec: 48, speaker: 'πŸ”§ Dave (Lead HVAC Engineer Β· Van #09)', color: '#059669', bg: '#ecfdf5', text: '"Hey Marcus, Dave here! Sarah told me your Carrier Infinity unit stopped cooling. Is the outside fan still spinning, or is it totally dead?"' }, { atSec: 60, speaker: '🏠 Marcus Sterling (Homeowner)', color: '#d97706', bg: '#fffbeb', text: '"The fan outside is spinning, Dave, but the vents inside are just blowing warm air."' }, { atSec: 72, speaker: 'πŸ”§ Dave (Master Tech Β· 20-Min ETA)', color: '#059669', bg: '#ecfdf5', text: '"Okay, that\'s actually good newsβ€”sounds like a capacitor or compressor relay. I carry the factory Carrier parts on my truck and I can be in your driveway in 20 minutes."' }, { atSec: 84, speaker: '🏠 Marcus Sterling (Gate Access Confirmed)', color: '#d97706', bg: '#fffbeb', text: '"Man, you\'re a lifesaver. Come on over, the gate code is 4412."' } ] }, { vertical: 'appliance', brand: 'Bosch 800 Series', zip: '90210', city: 'Beverly Hills, CA', fullName: 'Chloe Kensington', phone: '(310) 555-0184', homeowner: 'Bosch 800 Dishwasher E24 Drain Error & Leak', buyer: 'SoCal Luxury Appliance Dispatch', payout: 230, audioFile: '/audio/call_bosch.mp3', turns: [ { atSec: 0, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (Dispatch Coordinator)', color: '#0284c7', bg: '#f0f9ff', text: '"Hi, thanks for calling Beverly Hills appliance dispatch, this is Sarah! How can I help you today?"' }, { atSec: 12, speaker: '🏠 Chloe Kensington (Homeowner Β· 90210)', color: '#d97706', bg: '#fffbeb', text: '"Hi Sarah, it\'s Chloe. My Bosch dishwasher is beeping with an E24 code on the screen and there\'s water sitting at the bottom."' }, { atSec: 28, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (Connecting Local Specialist)', color: '#0284c7', bg: '#f0f9ff', text: '"Gotcha, E24 on a Bosch is a drain blockage or pump sensor. Let\'s see who\'s closest to 90210... okay, Alex is just off Wilshire Boulevard right now. Let me patch him onto the line!" [πŸ“ž Live Warm Transfer Ringtone]' }, { atSec: 48, speaker: 'πŸ”§ Alex (Appliance Specialist Β· Van #22)', color: '#059669', bg: '#ecfdf5', text: '"Hi Chloe, this is Alex! Did you manage to shut the under-sink water valve off, or is it just standing water inside the tub?"' }, { atSec: 60, speaker: '🏠 Chloe Kensington (Homeowner)', color: '#d97706', bg: '#fffbeb', text: '"Hi Alex! We turned the valve off under the sink just to be safe, so it stopped leaking."' }, { atSec: 72, speaker: 'πŸ”§ Alex (Master Tech Β· Bosch Pump in Stock)', color: '#059669', bg: '#ecfdf5', text: '"Smart move. I\'ve got the genuine Bosch 800-series drain pump and aqua-stop kit in my van right now. I can head over in about 30 minutes and have it running before dinner."' }, { atSec: 84, speaker: '🏠 Chloe Kensington (Appointment Confirmed)', color: '#d97706', bg: '#fffbeb', text: '"That would be wonderful, thank you so much Alex!"' } ] }, { vertical: 'hvac_ac', brand: 'Trane XV20i', zip: '85253', city: 'Scottsdale, AZ', fullName: 'Harrison Forde', phone: '(480) 555-0173', homeowner: 'Trane XV20i Emergency AC Outage (104Β°F Indoor)', buyer: 'Desert Peak HVAC Emergency', payout: 245, audioFile: '/audio/call_trane.mp3', turns: [ { atSec: 0, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (Dispatch Coordinator)', color: '#0284c7', bg: '#f0f9ff', text: '"Hi, Scottsdale cooling dispatch, this is Sarah! What\'s going on with your system today?"' }, { atSec: 12, speaker: '🏠 Harrison Forde (Homeowner Β· 85253)', color: '#d97706', bg: '#fffbeb', text: '"Hi Sarah, it\'s Harrison in Paradise Valley. It\'s 104 degrees out and our upstairs Trane AC just completely shut off."' }, { atSec: 28, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (Priority Emergency Transfer)', color: '#0284c7', bg: '#f0f9ff', text: '"Oh gosh, let\'s get someone out to 85253 immediately... okay, I see Ryan, our lead Trane master tech, is 5 minutes away on Scottsdale Road. Connecting you two right now!" [πŸ“ž Live Warm Transfer Ringtone]' }, { atSec: 48, speaker: 'πŸ”§ Ryan (Lead Trane Engineer Β· Van #11)', color: '#059669', bg: '#ecfdf5', text: '"Hey Harrison, Ryan here! Did the thermostat screen go blank too, or does the thermostat still have power?"' }, { atSec: 60, speaker: '🏠 Harrison Forde (Homeowner)', color: '#d97706', bg: '#fffbeb', text: '"Hey Ryanβ€”yeah, the thermostat screen is totally blank upstairs, nothing\'s turning on."' }, { atSec: 72, speaker: 'πŸ”§ Ryan (Master Tech Β· 5 Mins Away)', color: '#059669', bg: '#ecfdf5', text: '"Aha, that\'s almost certainly the float switch or low-voltage transformer tripping to protect the Trane compressor. I\'m 5 minutes down the roadβ€”I\'ll head straight to your house right now."' }, { atSec: 84, speaker: '🏠 Harrison Forde (Appointment Confirmed)', color: '#d97706', bg: '#fffbeb', text: '"Awesome, appreciate how fast you guys are. See you in 5 minutes!"' } ] } ]; async function openLiveCallSimulator() { const modal = document.getElementById('liveCallSimModal'); if (!modal) return; modal.style.display = 'flex'; const pick = CALL_SCENARIOS[callScenarioIdx % CALL_SCENARIOS.length]; callScenarioIdx++; document.getElementById('simCallerName').textContent = `${pick.fullName} Β· ${pick.phone} (${pick.city} ${pick.zip})`; document.getElementById('simWinnerBuyer').textContent = `${pick.buyer} (Payout: $${pick.payout})`; const turnsBox = document.getElementById('simTurnsContainer'); turnsBox.innerHTML = pick.turns.map((t, i) => `
${t.speaker}
${t.text}
`).join(''); const statusBadge = document.getElementById('simStatusBadge'); const timerLabel = document.getElementById('simTimerCount'); const progressBar = document.getElementById('simTimerBar'); const profitBox = document.getElementById('simProfitResult'); statusBadge.textContent = 'πŸ‘©β€πŸ’Ό LIVE US CALL TRANSFER (DISPATCH DESK + WARM TECH HANDOFF)'; statusBadge.style.background = '#e0f2fe'; statusBadge.style.color = '#0369a1'; timerLabel.textContent = '00:00 / 01:30 (90s Billable Buffer)'; progressBar.style.width = '0%'; progressBar.style.background = '#0284c7'; profitBox.style.display = 'none'; playVoiceWhisper(pick.turns[0].text, pick.audioFile + '?v=' + Date.now()); if (callSimTimer) clearInterval(callSimTimer); let sec = 0; callSimTimer = setInterval(async () => { sec += 1; if (sec > 90) sec = 90; const mins = String(Math.floor(sec / 60)).padStart(2, '0'); const remSecs = String(sec % 60).padStart(2, '0'); timerLabel.textContent = `${mins}:${remSecs} / 01:30 (${sec} sec of 90s buffer)`; progressBar.style.width = `${Math.round((sec / 90) * 100)}%`; pick.turns.forEach((t, idx) => { const nextSec = pick.turns[idx + 1] ? pick.turns[idx + 1].atSec : 999; const el = document.getElementById('simTurn-' + idx); if (!el) return; if (sec >= t.atSec && sec < nextSec) { el.style.background = t.bg; el.style.borderColor = t.color; el.style.opacity = '1'; if (sec === t.atSec && idx > 0) { el.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); } } else if (sec >= nextSec) { el.style.background = '#f8fafc'; el.style.borderColor = '#cbd5e1'; el.style.opacity = '0.82'; } }); if (sec >= 90) { clearInterval(callSimTimer); progressBar.style.background = '#00b67a'; statusBadge.textContent = 'βœ… 90s BILLABLE BUFFER PASSED β€” CALL SOLD FOR +$' + pick.payout + '!'; statusBadge.style.background = '#d1fae5'; statusBadge.style.color = '#065f46'; const res = await fetch('/api/v1/ingest-call', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ ...pick, whisperText: pick.turns[2].text, sellMode: 'PAY_PER_CALL_90S', callDurationSec: 142, sourceType: 'SEO_ORGANIC', sourceLabel: `SEO City Page (${pick.zip}) β€” $0 CPL`, tcpaConsent: true }) }); const data = await res.json(); const paid = (data && data.transaction && data.transaction.netProfit) || pick.payout; document.getElementById('simProfitAmount').textContent = `+$${paid} USD`; profitBox.style.display = 'block'; fetchState(); } }, 380); } // Interactive "Talk to Sarah Yourself" Mode (Microphone or 1-Click Voice Replies) function startInteractiveTalkToSarah(userSpokenText) { if (callSimTimer) clearInterval(callSimTimer); const box = document.getElementById('interactiveSarahBox'); box.style.display = 'block'; const log = document.getElementById('interactiveSarahLog'); if (!userSpokenText) { log.innerHTML = `
πŸ‘©β€πŸ’Ό Sarah: "Hi, thanks for calling local dispatch, this is Sarah! Which appliance or AC unit is giving you trouble today, and what's your ZIP code?"
`; playVoiceWhisper('', '/audio/interactive_greet.mp3?v=' + Date.now()); return; } const lower = userSpokenText.toLowerCase(); let replyAudio = '/audio/interactive_reply_fridge.mp3'; let replyText = "Oh no, I completely understand how stressful a warm fridge is! I just checked your zip code and Mike, our senior refrigeration tech, is 10 minutes away with factory parts in his van. Patching him onto the line for you right now!"; if (lower.includes('ac') || lower.includes('air') || lower.includes('cool') || lower.includes('heat') || lower.includes('carrier') || lower.includes('trane')) { replyAudio = '/audio/interactive_reply_ac.mp3'; replyText = "Ugh, having the AC go out in this heat is the worst! Let me pull up our GPS map... okay, got it! Dave, our lead cooling tech, is two miles away with a fully stocked truck. Let me connect you straight to Dave right now!"; } else if (lower.includes('dish') || lower.includes('leak') || lower.includes('wash') || lower.includes('bosch')) { replyAudio = '/audio/interactive_reply_washer.mp3'; replyText = "Gotcha, let's get that leak taken care of right away! I see Alex, our certified appliance specialist, is just around the corner from you. Hold on one sec while I patch Alex onto the call!"; } log.innerHTML = `
🎀 You said: "${userSpokenText}"
πŸ‘©β€πŸ’Ό Sarah + πŸ”§ Master Tech (Live Response): "${replyText}"
`; playVoiceWhisper(replyText, replyAudio + '?v=' + Date.now()); } function listenFromMicrophone() { const SR = window.SpeechRecognition || window.webkitSpeechRecognition; if (!SR) { startInteractiveTalkToSarah("Hi Sarah, my Sub-Zero refrigerator stopped cooling in Manhattan 10021."); return; } if (speechRec) { try { speechRec.stop(); } catch (e) {} } speechRec = new SR(); speechRec.lang = 'en-US'; speechRec.interimResults = false; const btn = document.getElementById('micListenBtn'); btn.textContent = 'πŸ”΄ Listening to your microphone (speak in English)...'; speechRec.onresult = (e) => { const transcript = e.results[0][0].transcript; btn.textContent = '🎀 Speak Into Microphone'; startInteractiveTalkToSarah(transcript); }; speechRec.onerror = () => { btn.textContent = '🎀 Speak Into Microphone'; startInteractiveTalkToSarah("Hi Sarah, our central AC is blowing warm air and we need a tech today."); }; speechRec.start(); } function closeLiveCallSimulator(openCockpit) { if (callSimTimer) clearInterval(callSimTimer); if (activeCallAudio) { activeCallAudio.pause(); activeCallAudio.currentTime = 0; } if ('speechSynthesis' in window) window.speechSynthesis.cancel(); const modal = document.getElementById('liveCallSimModal'); if (modal) modal.style.display = 'none'; if (openCockpit) switchView('cockpit'); } fetchState(); + rev.toLocaleString() + '/mo'; const depInput = document.getElementById('pDeposit'); if (depInput) depInput.value = budget; } function renderTransactions(txs) { cachedTransactions = txs || []; renderTransactionsList(cachedTransactions); } function renderTransactionsList(txs) { const tbody = document.getElementById('txTableBody'); tbody.innerHTML = txs.map((tx) => { let badgeHtml = `SOLD $${tx.salePrice}`; if (tx.sellMode === 'PAY_PER_CALL_90S' && tx.status === 'SOLD') { badgeHtml = `πŸ“ž 90s CALL $${tx.salePrice}`; } else if (tx.status === 'CREDITED_REFUND') { badgeHtml = `β†Ί CREDITED $0`; } else if (tx.status !== 'SOLD') { badgeHtml = `πŸ›‘οΈ TCPA BLOCKED`; } const disputeBtn = tx.status === 'SOLD' ? `` : `${tx.status}`; return ` ${tx.id}
${badgeHtml}
${tx.brand || 'Sub-Zero'}
${tx.city} (${tx.zip})
${tx.winnerBuyerName || 'β€”'}
${tx.crmDelivered || 'ServiceTitan Webhook'} ${tx.netProfit > 0 ? '+$' + tx.netProfit : '$0'} ${disputeBtn} `; }).join(''); if (txs.length > 0) { inspectTx(txs[0]); } } function inspectTx(tx) { document.getElementById('inspTxId').textContent = `${tx.id} Β· ${tx.brand || 'Sub-Zero'} (${tx.status})`; const safeWhisper = (tx.whisperText || '').replace(/'/g, "\\'"); const refundBtn = tx.status === 'SOLD' ? `` : `${tx.rejectReason || tx.status}`; document.getElementById('inspectorBody').innerHTML = `
HOMEOWNER & SYMPTOM
${tx.customerName} Β· ${tx.customerPhone}
${tx.homeowner} (${tx.city})
CRM DELIVERY & TCPA PROOF
${tx.crmDelivered || 'Direct API'}
${tx.trustedFormCert}
🎧 Live Call Recording (Sarah Jenkins · US Dispatch + Tech)
"${tx.whisperText || 'Instant Web Dispatch'}"
Dispatch Log: ${tx.aiTranscript || 'Verified homeowner repair request.'}
Latency: ${tx.latencyMs}ms Β· Source: ${tx.sourceLabel} ${refundBtn}
`; } async function issueLeadCredit(txId) { const res = await fetch('/api/v1/dispute', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ txId, reason: '1-Click Bad-Lead Credit Guarantee (Wallet Refunded Automatically)' }) }); await res.json(); fetchState(); } async function disputeLatestFromMobile() { if (!appState.latestTx || appState.latestTx.status !== 'SOLD') { alert('This lead has already been credited or no active sold lead is selected.'); return; } await issueLeadCredit(appState.latestTx.id); alert(`βœ… 1-Tap Refund Complete! Transaction ${appState.latestTx.id} was credited back to the contractor's Stripe wallet.`); } function renderBuyers(buyers) { const box = document.getElementById('buyerListContainer'); box.innerHTML = buyers.map(b => `
${b.name}
πŸ”Œ ${b.crm || 'ServiceTitan API'}
Web: $${b.bidPrice} Β· Shared: $${b.sharedBidPrice} Β· 90s Call: $${b.callBidPrice}
Wallet: $${b.walletBalance.toLocaleString()}
Today: ${b.soldToday}/${b.dailyCap}
`).join(''); } async function toggleBuyer(buyerId) { await fetch('/api/v1/buyers/toggle', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ buyerId }) }); fetchState(); } function renderSeoGrid(pages) { const grid = document.getElementById('seoCardsGrid'); grid.innerHTML = pages.map(p => `
πŸ“ ZIP ${p.zip} (${p.state}) ${p.monthlySearches}

${p.headline}

${p.subheadline}

Avg Contractor Ticket: ${p.avgTicket}
Your Lead Arbitrage: ${p.leadValue}
`).join(''); } function launchSeoPage(p) { appState.vertical = p.vertical; appState.brand = p.brand; appState.zip = p.zip; appState.sourceType = 'SEO_ORGANIC'; appState.sourceLabel = `SEO City Grid (/city/${p.slug}) β€” $0 CPL`; document.getElementById('activeSeoPill').innerHTML = `πŸ“ LOCAL SEO PAGE ACTIVE: ${p.city} (${p.zip}) Β· $0 Traffic Cost`; document.getElementById('heroDynamicTitle').innerHTML = p.headline; document.getElementById('heroDynamicSub').textContent = p.subheadline; document.getElementById('zipInput').value = p.zip; switchView('consumer'); } async function simulateTraffic(mode) { if (mode === 'LITIGATOR') { await fetch('/api/v1/ingest-quiz', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ vertical: 'subzero', brand: 'Sub-Zero', zip: '33139', fullName: 'Known TCPA Litigator Trap', phone: '3050000000', tcpaConsent: true }) }); fetchState(); return; } const samples = [ { vertical: 'subzero', brand: 'Sub-Zero', zip: '10021', fullName: 'Eleanor Vance', phone: '2125550192', homeowner: 'Sub-Zero BI-48S Built-In Fridge Warm (52Β°F)' }, { vertical: 'hvac_ac', brand: 'Carrier Infinity', zip: '33139', fullName: 'Marcus Sterling', phone: '3055550148', homeowner: 'Carrier Infinity Central AC Compressor Failure' }, { vertical: 'subzero', brand: 'Wolf', zip: '90210', fullName: 'Chloe Kensington', phone: '3105550184', homeowner: 'Wolf 60" Dual-Fuel Range Oven Not Heating' }, { vertical: 'hvac_ac', brand: 'Trane XV', zip: '85253', fullName: 'Harrison Forde', phone: '4805550173', homeowner: 'Trane XV20i AC Emergency (104Β°F Scottsdale)' } ]; const pick = samples[Math.floor(Math.random() * samples.length)]; const isCall = mode === 'PAY_PER_CALL_90S'; const endpoint = isCall ? '/api/v1/ingest-call' : '/api/v1/ingest-quiz'; await fetch(endpoint, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ ...pick, sellMode: isCall ? 'PAY_PER_CALL_90S' : 'SHARED', callDurationSec: 142, sourceType: 'SEO_ORGANIC', sourceLabel: `SEO City Page (${pick.zip}) β€” $0 CPL`, tcpaConsent: true }) }); fetchState(); } async function registerPartner(e) { e.preventDefault(); const statesRaw = document.getElementById('pStates').value; const states = statesRaw.split(',').map(s => s.trim().toUpperCase()).filter(Boolean); await fetch('/api/v1/buyers/add', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ name: document.getElementById('pName').value, vertical: document.getElementById('pVertical').value, crm: document.getElementById('pCrm').value, states, bidPrice: Number(document.getElementById('pBid').value), initialDeposit: Number(document.getElementById('pDeposit').value) }) }); switchView('cockpit'); } async function resetDemoState() { await fetch('/api/v1/reset-demo', { method: 'POST' }); fetchState(); } let callSimTimer = null; let callScenarioIdx = 0; let speechRec = null; const CALL_SCENARIOS = [ { vertical: 'subzero', brand: 'Sub-Zero', zip: '10021', city: 'Manhattan, NY', fullName: 'Eleanor Vance', phone: '(212) 555-0192', homeowner: 'Sub-Zero BI-48S Built-In Fridge Warm (52Β°F)', buyer: 'Manhattan Sub-Zero & Wolf Elite', payout: 230, audioFile: '/audio/call_subzero.mp3', turns: [ { atSec: 0, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (Dispatch Coordinator)', color: '#0284c7', bg: '#f0f9ff', text: '"Hi, thanks for calling local dispatch, this is Sarah! Who am I speaking with today?"' }, { atSec: 12, speaker: '🏠 Eleanor Vance (Homeowner Β· 10021)', color: '#d97706', bg: '#fffbeb', text: '"Hi Sarah, it\'s Eleanor on the Upper East Side. Um, our built-in Sub-Zero fridge just stopped cooling and it\'s blinking 52 degrees."' }, { atSec: 28, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (ZIP Lookup & Warm Call Transfer)', color: '#0284c7', bg: '#f0f9ff', text: '"Oh no, I know how stressful that is! Let me pull up your zip code real quick... okay, 10021, got it. Mike, our senior Sub-Zero tech, just finished a job 10 minutes away on Lexington. Hold on one sec while I patch him right in..." [πŸ“ž Live Warm Transfer Ringtone]' }, { atSec: 48, speaker: 'πŸ”§ Mike (Senior Master Tech Β· Van #14)', color: '#059669', bg: '#ecfdf5', text: '"Hey Sarah, hey Eleanorβ€”Mike here! You said the Sub-Zero refrigerator side is warming up?"' }, { atSec: 58, speaker: '🏠 Eleanor Vance (Homeowner)', color: '#d97706', bg: '#fffbeb', text: '"Yeah, the freezer is fine, but the top fridge is at 52 degrees and we have a full fridge of food."' }, { atSec: 70, speaker: 'πŸ”§ Mike (Master Tech Β· OEM Parts on Truck)', color: '#059669', bg: '#ecfdf5', text: '"Gotcha. On that model it\'s almost always the upper evaporator fan or thermistor, and I\'ve got both genuine Sub-Zero parts right here in my van. I can pull up in about 25 minutesβ€”does that work for you?"' }, { atSec: 84, speaker: '🏠 Eleanor Vance (Address Confirmation)', color: '#d97706', bg: '#fffbeb', text: '"Oh, thank goodness! Yes, 25 minutes is perfect, we\'re at 740 Park Avenue."' } ] }, { vertical: 'hvac_ac', brand: 'Carrier Infinity', zip: '33139', city: 'Miami Beach, FL', fullName: 'Marcus Sterling', phone: '(305) 555-0148', homeowner: 'Carrier Infinity Central AC Compressor Failure', buyer: 'Sunbelt Carrier & Trane Pros', payout: 245, audioFile: '/audio/call_carrier.mp3', turns: [ { atSec: 0, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (Dispatch Coordinator)', color: '#0284c7', bg: '#f0f9ff', text: '"Hi there, Miami Beach emergency dispatch, this is Sarah speaking! How can I help you out today?"' }, { atSec: 12, speaker: '🏠 Marcus Sterling (Homeowner Β· 33139)', color: '#d97706', bg: '#fffbeb', text: '"Hey Sarah, this is Marcus over in South Beach. Our Carrier central AC just went out and it\'s already 86 degrees inside the house."' }, { atSec: 28, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (Live GPS Truck Radar Lookup)', color: '#0284c7', bg: '#f0f9ff', text: '"Oh gosh, in this Florida heat that\'s brutal. Let me check our GPS map for 33139 right now... okay, awesome, Dave is literally 2 miles away near Alton Road. Connecting you straight to his truck!" [πŸ“ž Live Warm Transfer Ringtone]' }, { atSec: 48, speaker: 'πŸ”§ Dave (Lead HVAC Engineer Β· Van #09)', color: '#059669', bg: '#ecfdf5', text: '"Hey Marcus, Dave here! Sarah told me your Carrier Infinity unit stopped cooling. Is the outside fan still spinning, or is it totally dead?"' }, { atSec: 60, speaker: '🏠 Marcus Sterling (Homeowner)', color: '#d97706', bg: '#fffbeb', text: '"The fan outside is spinning, Dave, but the vents inside are just blowing warm air."' }, { atSec: 72, speaker: 'πŸ”§ Dave (Master Tech Β· 20-Min ETA)', color: '#059669', bg: '#ecfdf5', text: '"Okay, that\'s actually good newsβ€”sounds like a capacitor or compressor relay. I carry the factory Carrier parts on my truck and I can be in your driveway in 20 minutes."' }, { atSec: 84, speaker: '🏠 Marcus Sterling (Gate Access Confirmed)', color: '#d97706', bg: '#fffbeb', text: '"Man, you\'re a lifesaver. Come on over, the gate code is 4412."' } ] }, { vertical: 'appliance', brand: 'Bosch 800 Series', zip: '90210', city: 'Beverly Hills, CA', fullName: 'Chloe Kensington', phone: '(310) 555-0184', homeowner: 'Bosch 800 Dishwasher E24 Drain Error & Leak', buyer: 'SoCal Luxury Appliance Dispatch', payout: 230, audioFile: '/audio/call_bosch.mp3', turns: [ { atSec: 0, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (Dispatch Coordinator)', color: '#0284c7', bg: '#f0f9ff', text: '"Hi, thanks for calling Beverly Hills appliance dispatch, this is Sarah! How can I help you today?"' }, { atSec: 12, speaker: '🏠 Chloe Kensington (Homeowner Β· 90210)', color: '#d97706', bg: '#fffbeb', text: '"Hi Sarah, it\'s Chloe. My Bosch dishwasher is beeping with an E24 code on the screen and there\'s water sitting at the bottom."' }, { atSec: 28, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (Connecting Local Specialist)', color: '#0284c7', bg: '#f0f9ff', text: '"Gotcha, E24 on a Bosch is a drain blockage or pump sensor. Let\'s see who\'s closest to 90210... okay, Alex is just off Wilshire Boulevard right now. Let me patch him onto the line!" [πŸ“ž Live Warm Transfer Ringtone]' }, { atSec: 48, speaker: 'πŸ”§ Alex (Appliance Specialist Β· Van #22)', color: '#059669', bg: '#ecfdf5', text: '"Hi Chloe, this is Alex! Did you manage to shut the under-sink water valve off, or is it just standing water inside the tub?"' }, { atSec: 60, speaker: '🏠 Chloe Kensington (Homeowner)', color: '#d97706', bg: '#fffbeb', text: '"Hi Alex! We turned the valve off under the sink just to be safe, so it stopped leaking."' }, { atSec: 72, speaker: 'πŸ”§ Alex (Master Tech Β· Bosch Pump in Stock)', color: '#059669', bg: '#ecfdf5', text: '"Smart move. I\'ve got the genuine Bosch 800-series drain pump and aqua-stop kit in my van right now. I can head over in about 30 minutes and have it running before dinner."' }, { atSec: 84, speaker: '🏠 Chloe Kensington (Appointment Confirmed)', color: '#d97706', bg: '#fffbeb', text: '"That would be wonderful, thank you so much Alex!"' } ] }, { vertical: 'hvac_ac', brand: 'Trane XV20i', zip: '85253', city: 'Scottsdale, AZ', fullName: 'Harrison Forde', phone: '(480) 555-0173', homeowner: 'Trane XV20i Emergency AC Outage (104Β°F Indoor)', buyer: 'Desert Peak HVAC Emergency', payout: 245, audioFile: '/audio/call_trane.mp3', turns: [ { atSec: 0, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (Dispatch Coordinator)', color: '#0284c7', bg: '#f0f9ff', text: '"Hi, Scottsdale cooling dispatch, this is Sarah! What\'s going on with your system today?"' }, { atSec: 12, speaker: '🏠 Harrison Forde (Homeowner Β· 85253)', color: '#d97706', bg: '#fffbeb', text: '"Hi Sarah, it\'s Harrison in Paradise Valley. It\'s 104 degrees out and our upstairs Trane AC just completely shut off."' }, { atSec: 28, speaker: 'πŸ‘©β€πŸ’Ό Sarah Jenkins (Priority Emergency Transfer)', color: '#0284c7', bg: '#f0f9ff', text: '"Oh gosh, let\'s get someone out to 85253 immediately... okay, I see Ryan, our lead Trane master tech, is 5 minutes away on Scottsdale Road. Connecting you two right now!" [πŸ“ž Live Warm Transfer Ringtone]' }, { atSec: 48, speaker: 'πŸ”§ Ryan (Lead Trane Engineer Β· Van #11)', color: '#059669', bg: '#ecfdf5', text: '"Hey Harrison, Ryan here! Did the thermostat screen go blank too, or does the thermostat still have power?"' }, { atSec: 60, speaker: '🏠 Harrison Forde (Homeowner)', color: '#d97706', bg: '#fffbeb', text: '"Hey Ryanβ€”yeah, the thermostat screen is totally blank upstairs, nothing\'s turning on."' }, { atSec: 72, speaker: 'πŸ”§ Ryan (Master Tech Β· 5 Mins Away)', color: '#059669', bg: '#ecfdf5', text: '"Aha, that\'s almost certainly the float switch or low-voltage transformer tripping to protect the Trane compressor. I\'m 5 minutes down the roadβ€”I\'ll head straight to your house right now."' }, { atSec: 84, speaker: '🏠 Harrison Forde (Appointment Confirmed)', color: '#d97706', bg: '#fffbeb', text: '"Awesome, appreciate how fast you guys are. See you in 5 minutes!"' } ] } ]; async function openLiveCallSimulator() { const modal = document.getElementById('liveCallSimModal'); if (!modal) return; modal.style.display = 'flex'; const pick = CALL_SCENARIOS[callScenarioIdx % CALL_SCENARIOS.length]; callScenarioIdx++; document.getElementById('simCallerName').textContent = `${pick.fullName} Β· ${pick.phone} (${pick.city} ${pick.zip})`; document.getElementById('simWinnerBuyer').textContent = `${pick.buyer} (Payout: $${pick.payout})`; const turnsBox = document.getElementById('simTurnsContainer'); turnsBox.innerHTML = pick.turns.map((t, i) => `
${t.speaker}
${t.text}
`).join(''); const statusBadge = document.getElementById('simStatusBadge'); const timerLabel = document.getElementById('simTimerCount'); const progressBar = document.getElementById('simTimerBar'); const profitBox = document.getElementById('simProfitResult'); statusBadge.textContent = 'πŸ‘©β€πŸ’Ό LIVE US CALL TRANSFER (DISPATCH DESK + WARM TECH HANDOFF)'; statusBadge.style.background = '#e0f2fe'; statusBadge.style.color = '#0369a1'; timerLabel.textContent = '00:00 / 01:30 (90s Billable Buffer)'; progressBar.style.width = '0%'; progressBar.style.background = '#0284c7'; profitBox.style.display = 'none'; playVoiceWhisper(pick.turns[0].text, pick.audioFile + '?v=' + Date.now()); if (callSimTimer) clearInterval(callSimTimer); let sec = 0; callSimTimer = setInterval(async () => { sec += 1; if (sec > 90) sec = 90; const mins = String(Math.floor(sec / 60)).padStart(2, '0'); const remSecs = String(sec % 60).padStart(2, '0'); timerLabel.textContent = `${mins}:${remSecs} / 01:30 (${sec} sec of 90s buffer)`; progressBar.style.width = `${Math.round((sec / 90) * 100)}%`; pick.turns.forEach((t, idx) => { const nextSec = pick.turns[idx + 1] ? pick.turns[idx + 1].atSec : 999; const el = document.getElementById('simTurn-' + idx); if (!el) return; if (sec >= t.atSec && sec < nextSec) { el.style.background = t.bg; el.style.borderColor = t.color; el.style.opacity = '1'; if (sec === t.atSec && idx > 0) { el.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); } } else if (sec >= nextSec) { el.style.background = '#f8fafc'; el.style.borderColor = '#cbd5e1'; el.style.opacity = '0.82'; } }); if (sec >= 90) { clearInterval(callSimTimer); progressBar.style.background = '#00b67a'; statusBadge.textContent = 'βœ… 90s BILLABLE BUFFER PASSED β€” CALL SOLD FOR +$' + pick.payout + '!'; statusBadge.style.background = '#d1fae5'; statusBadge.style.color = '#065f46'; const res = await fetch('/api/v1/ingest-call', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ ...pick, whisperText: pick.turns[2].text, sellMode: 'PAY_PER_CALL_90S', callDurationSec: 142, sourceType: 'SEO_ORGANIC', sourceLabel: `SEO City Page (${pick.zip}) β€” $0 CPL`, tcpaConsent: true }) }); const data = await res.json(); const paid = (data && data.transaction && data.transaction.netProfit) || pick.payout; document.getElementById('simProfitAmount').textContent = `+$${paid} USD`; profitBox.style.display = 'block'; fetchState(); } }, 380); } // Interactive "Talk to Sarah Yourself" Mode (Microphone or 1-Click Voice Replies) function startInteractiveTalkToSarah(userSpokenText) { if (callSimTimer) clearInterval(callSimTimer); const box = document.getElementById('interactiveSarahBox'); box.style.display = 'block'; const log = document.getElementById('interactiveSarahLog'); if (!userSpokenText) { log.innerHTML = `
πŸ‘©β€πŸ’Ό Sarah: "Hi, thanks for calling local dispatch, this is Sarah! Which appliance or AC unit is giving you trouble today, and what's your ZIP code?"
`; playVoiceWhisper('', '/audio/interactive_greet.mp3?v=' + Date.now()); return; } const lower = userSpokenText.toLowerCase(); let replyAudio = '/audio/interactive_reply_fridge.mp3'; let replyText = "Oh no, I completely understand how stressful a warm fridge is! I just checked your zip code and Mike, our senior refrigeration tech, is 10 minutes away with factory parts in his van. Patching him onto the line for you right now!"; if (lower.includes('ac') || lower.includes('air') || lower.includes('cool') || lower.includes('heat') || lower.includes('carrier') || lower.includes('trane')) { replyAudio = '/audio/interactive_reply_ac.mp3'; replyText = "Ugh, having the AC go out in this heat is the worst! Let me pull up our GPS map... okay, got it! Dave, our lead cooling tech, is two miles away with a fully stocked truck. Let me connect you straight to Dave right now!"; } else if (lower.includes('dish') || lower.includes('leak') || lower.includes('wash') || lower.includes('bosch')) { replyAudio = '/audio/interactive_reply_washer.mp3'; replyText = "Gotcha, let's get that leak taken care of right away! I see Alex, our certified appliance specialist, is just around the corner from you. Hold on one sec while I patch Alex onto the call!"; } log.innerHTML = `
🎀 You said: "${userSpokenText}"
πŸ‘©β€πŸ’Ό Sarah + πŸ”§ Master Tech (Live Response): "${replyText}"
`; playVoiceWhisper(replyText, replyAudio + '?v=' + Date.now()); } function listenFromMicrophone() { const SR = window.SpeechRecognition || window.webkitSpeechRecognition; if (!SR) { startInteractiveTalkToSarah("Hi Sarah, my Sub-Zero refrigerator stopped cooling in Manhattan 10021."); return; } if (speechRec) { try { speechRec.stop(); } catch (e) {} } speechRec = new SR(); speechRec.lang = 'en-US'; speechRec.interimResults = false; const btn = document.getElementById('micListenBtn'); btn.textContent = 'πŸ”΄ Listening to your microphone (speak in English)...'; speechRec.onresult = (e) => { const transcript = e.results[0][0].transcript; btn.textContent = '🎀 Speak Into Microphone'; startInteractiveTalkToSarah(transcript); }; speechRec.onerror = () => { btn.textContent = '🎀 Speak Into Microphone'; startInteractiveTalkToSarah("Hi Sarah, our central AC is blowing warm air and we need a tech today."); }; speechRec.start(); } function closeLiveCallSimulator(openCockpit) { if (callSimTimer) clearInterval(callSimTimer); if (activeCallAudio) { activeCallAudio.pause(); activeCallAudio.currentTime = 0; } if ('speechSynthesis' in window) window.speechSynthesis.cancel(); const modal = document.getElementById('liveCallSimModal'); if (modal) modal.style.display = 'none'; if (openCockpit) switchView('cockpit'); } fetchState();