/* Buyer journey: screens inside the phone */ const { useState: useStateP, useEffect: useEffectP } = React; function PhoneTop({ title, onBack, right }) { return (
{onBack ? : {FCONFIG.brand}} {title && {title}} {right}
); } /* ---------- ATTRACT ---------- */ function ScreenAd({ go }) { const c = FSTOCK[0]; return (

Where buyers first see you

Three doors, one site

Tap any entry point. The funnel records where each lead came from.

); } /* ---------- MATCH ---------- */ function ScreenQuiz({ go, quiz, setQuiz }) { const [step, setStep] = useStateP(0); const set = (k, v) => setQuiz({ ...quiz, [k]: v }); const Q = [ { t: "What monthly payment feels comfortable?", body: (
{RM(quiz.monthly)}/mo
set("monthly", +e.target.value)} />

Estimated on 10% down, 9 years, {FCONFIG.reconRate}% (recon) / {FCONFIG.flatRate}% (local) flat.

) }, { t: "Recon import or local pre-owned?", body: (
{[["recon", "Recon: first owner, lower bank rate"], ["local", "Local: Malaysian history, service records"], ["any", "No preference, show me the best"]].map(([v, l]) => ( ))}
) }, { t: "Who's the car mostly for?", body: (
{[["city", "Me, mostly city driving"], ["family", "The family, needs space"], ["exec", "Business / executive image"]].map(([v, l]) => ( ))}
) } ]; const cur = Q[step]; const ready = step === 0 || (step === 1 && quiz.charge) || (step === 2 && quiz.km); return (
step ? setStep(step - 1) : go("ad")} title="Car finder" right={{step + 1}/3} />

{cur.t}

{cur.body}
); } function scoreCar(c, q) { let s = 0, why = []; const m = instalment(c.price); if (m <= q.monthly) { s += 3; why.push(`~${RM(m)}/mo fits your budget`); } else s -= 4; if (q.charge === "recon" && c.src === "Recon") { s += 2; why.push(`recon${c.auction ? ", grade " + c.auction : ""}`); } else if (q.charge === "local" && c.src === "Local") { s += 2; why.push("local, history verified"); } else if (q.charge !== "any") s -= 1; if (q.km === "family" && (c.body === "MPV" || c.body === "SUV")) { s += 2; why.push(c.body === "MPV" ? "7 seats" : "family SUV"); } if (q.km === "city" && (c.body === "Hatchback" || c.body === "Sedan")) { s += 2; why.push("easy in city traffic"); } if (q.km === "exec" && /Lexus|Mercedes|BMW|Porsche|Alphard|Vellfire/.test(c.make + " " + c.model)) { s += 2; why.push("premium marque"); } if (c.soh >= 90) { s += 1; why.push(`battery at ${c.soh}%`); } return { s, why }; } function ScreenResults({ go, quiz, stock }) { const list = stock.filter(c => c.status !== "sold").map(c => ({ c, ...scoreCar(c, quiz) })).sort((a, b) => b.s - a.s); const good = list.filter(x => x.s > 0); return (
go("quiz")} title="Your matches" />

{good.length} of {list.length} cars fit. Sorted by fit, not by who paid for placement.

{(good.length ? good : list.slice(0, 2)).map(({ c, why }) => ( ))}
); } /* ---------- PROVE ---------- */ function ScreenCar({ go, car, log }) { const [tab, setTab] = useStateP("paint"); const [down, setDown] = useStateP(10); const [yrs, setYrs] = useStateP(9); const r = onRoad(car); const pick = t => { setTab(t); log("prove", `Opened “${t === "paint" ? "Paint map" : t === "batt" ? "Battery report" : t === "price" ? "All-in price" : "Monthly"}” on ${car.id}`); }; const avail = car.status === "available"; return (
go("results")} title={car.id} right={} />
▶

{car.year} {car.make} {car.model}

{car.km.toLocaleString()} km · {car.src}{car.auction ? ` · Grade ${car.auction}` : ""} · on lot {car.days} days

{RM(car.price)}~{RM(instalment(car.price))}/mo
{[["paint", "Paint"], car.soh ? ["batt", "Battery"] : ["batt", "175-pt"], ["price", "All-in"], ["loan", "Monthly"]].map(([k, l]) => ( ))}
{tab === "paint" &&
FactoryResprayFiller
} {tab === "batt" && !car.soh &&
  • Frame & pinch weldsNo pulling or structural welds
  • Flood scanSeat rails, spare-wheel tub, firewall clean
  • True odometer{car.src === "Recon" ? "Matched to auction sheet + export cert" : "Matched to ECU / gearbox hours"}
  • OBD-II scanNo transmission, ABS or timing faults
} {tab === "batt" && car.soh &&

{car.soh >= 90 ? "Strong: close to original capacity." : car.soh >= 82 ? "Healthy for its age; expect a modest drop vs new." : "Usable but ageing. Replacement quote is on file."}

Diagnostic scan · [scan date] · [workshop]

} {tab === "price" && (
Car price{RM(car.price)}
JPJ transfer & handling{RM(r.transfer)}
Road tax (12 mo, est.){RM(r.roadTax)}
Insurance (est.){RM(r.insurance)}
On the road{RM(r.total)}
)} {tab === "loan" && (
{RM(instalment(car.price, down, FCONFIG.flatRate, yrs))}/mo

Estimate only. Bank sets the final rate.

)}
{car.status === "reserved" && }
); } /* ---------- COMMIT ---------- */ function ScreenForm({ go, car, kind, onSubmit }) { const [name, setName] = useStateP(""); const [phone, setPhone] = useStateP(""); const [date, setDate] = useStateP("Sat 11:00"); const [loan, setLoan] = useStateP("Need a loan"); const [ok, setOk] = useStateP(false); const title = kind === "reserve" ? "Reserve this car" : kind === "waitlist" ? "Join the waitlist" : "Book a test drive"; const fill = () => { setName("Farah Iskandar"); setPhone("012-345 6789"); setOk(true); }; return (
go("car")} title={title} />
{car.year} {car.make} {car.model}{car.id} · {RM(car.price)}
{kind === "reserve" &&

Pay {RM(FCONFIG.deposit)} to hold it for 72 hours. Fully refundable if the inspection or loan doesn't work out.

} {kind === "test" && (
{["Sat 11:00", "Sat 15:00", "Sun 10:00", "Mon 18:30"].map(s => )}
)}
); } function ScreenChat({ go, car, kind, quiz, onSend }) { const text = kind === "car" ? `Hi, I'm interested in ${car.id}: ${car.year} ${car.make} ${car.model} (${RM(car.price)}). Is it still available?` : `Hi, I'm looking for a car around ${RM(quiz.monthly)}/month. Can you let me know when one that passes your check comes in?`; const [sent, setSent] = useStateP(false); const [reply, setReply] = useStateP(0); useEffectP(() => { if (!sent) return; const a = setTimeout(() => setReply(1), 900), b = setTimeout(() => setReply(2), 2200); return () => { clearTimeout(a); clearTimeout(b); }; }, [sent]); return (
{FCONFIG.owner[0]}
{FCONFIG.owner} · {FCONFIG.brand}{reply ? "online" : "typically replies in minutes"}
Messages from this listing are tagged with the car's stock number
{sent &&
{text}✓✓
} {reply >= 1 &&
Hi! {FCONFIG.owner} here from Motors Confidence, Taman Sea. {kind === "car" ? `Yes, ${car.id} is ${car.status}.` : "I'll put you on my sourcing list."}
} {reply >= 2 &&
{kind === "car" ? "Sending you the full inspection PDF and the cold-start video now. Want to see it this weekend?" : "We check auctions and owner offers every week. I'll WhatsApp you the uncropped sheet and 175-pt report before we buy."}
}
{!sent ? (
{text}
) : (
)}
); } function ScreenConfirm({ go, car, kind, lead }) { const steps = kind === "reserve" ? [["Now", "Deposit link on WhatsApp, car marked Reserved for 72 h"], ["+1 h", "Full proof pack PDF + inspection report"], ["+1 day", "Loan pre-check with partner banks"], ["+3 days", "Hand-over, warranty card, JPJ transfer done"]] : kind === "test" ? [["Now", "Slot confirmed on WhatsApp"], ["Day before", "Reminder + location pin + proof pack"], ["After drive", "Owner follow-up and loan estimate"]] : [["Now", "You're on the waitlist for this car"], ["If released", "Instant WhatsApp alert, first in line"], ["Meanwhile", "Similar matches sent as they arrive"]]; return (
✓

{kind === "reserve" ? "Car reserved" : kind === "test" ? "Test drive booked" : "You're on the list"}

{car.year} {car.make} {car.model} · ref {lead?.id}

    {steps.map(([w, d]) =>
  1. {w}{d}
  2. )}
); } /* ---------- NURTURE ---------- */ function ScreenNurture({ go, car, log }) { const MSG = [ { d: "Day 0", t: `Proof pack for ${car.id}: inspection PDF, auction sheet${car.auction ? "" : " (n/a, local car)"}, paint map, 175-point report.`, a: "Open PDF" }, { d: "Day 1", t: "Panel bank pre-check: Public Bank and Maybank both indicate approval. Want me to lock the rate?", a: "Yes, lock it" }, { d: "Day 2", t: `${FCONFIG.owner} calling to answer anything left. 5 minutes, no hard sell.`, a: "Call me 6pm" }, { d: "Day 4", t: "Still thinking? A 2020 Honda Accord just came in from a direct owner. Paint all factory, 54,000 km verified.", a: "See it first" } ]; const [n, setN] = useStateP(1); const next = () => { if (n < MSG.length) { setN(n + 1); log("nurture", `Follow-up sent: ${MSG[n].d}`); } }; return (
go("car")} title="Follow-up sequence" />

What the buyer receives after they raise a hand. Advance time to see each touch.

{MSG.slice(0, n).map(m => (
{m.d}

{m.t}

))}
{n < MSG.length ? : }
); } /* ---------- RETAIN ---------- */ function ScreenAfter({ go, car, log }) { const [ref, setRef] = useStateP(false); const back = Math.round(car.price * 0.82 / 500) * 500; return (
owner hub} />
{car.year} {car.make} {car.model}Delivered · warranty active
Next · in 5 months Free 6-month health check

We re-scan the ECU and re-check paint and tyres every 6 months and add it to the car's history, which helps its resale value.

Refer a friend RM300 Touch 'n Go credit each

When a friend buys with your code, you both get it. [set your own reward]

{ref ?
FARAH-CH300
: }
Sell-back guarantee ~{RM(back)} if you sell back within 2 years

Indicative, subject to inspection. Your car becomes our next clean, known-history stock.

); } /* ---------- SOURCE ---------- */ function ScreenSell({ go, onSubmit }) { const [f, setF] = useStateP({ car: "", year: "", km: "", mode: "Get an offer", name: "", phone: "" }); const set = (k, v) => setF({ ...f, [k]: v }); const fill = () => setF({ car: "Honda Accord 1.5 TC", year: "2020", km: "54000", mode: "Consign with you", name: "Rohani", phone: "019-778 1234" }); const ok = f.car && f.year && f.km && f.name && f.phone; return (
go("ad")} title="Sell or consign" />

Selling or trading in?

Get a direct offer, or let us sell it with the same proof pack, usually for more than a trade-in.

{["Get an offer", "Consign with you"].map(m => )}
); } function ScreenSellDone({ go, sell }) { return (
✓

Got it, {sell?.name}

{sell?.year} {sell?.car} · {(+sell?.km || 0).toLocaleString()} km

  1. TodayWhatsApp valuation range within one working day
  2. VisitPaint map + OBD scan done free, you keep the report. Any loan settled by us
  3. {sell?.mode === "Consign with you" ? "Listed" : "Paid"}{sell?.mode === "Consign with you" ? "Car listed with full proof pack; you're paid when it sells" : "Same-day transfer and JPJ paperwork handled"}
); } Object.assign(window, { ScreenAd, ScreenQuiz, ScreenResults, ScreenCar, ScreenForm, ScreenChat, ScreenConfirm, ScreenNurture, ScreenAfter, ScreenSell, ScreenSellDone });