import { useState, useRef, useEffect } from "react"; /* ───────────────────────────────────────────── ADWISE CANADA — Production Landing Page Design: Editorial dark luxury, sharp typography Font: Clash Display + DM Sans feel via CSS Color: Deep navy-black + electric amber accent ───────────────────────────────────────────── */ const SYSTEM_PROMPT = `You are the AdWise AI consultant — a sharp, confident advisor for small Canadian businesses who want to run effective advertising without hiring an agency. Your job: have a natural conversation to collect key info, then deliver a personalized ad strategy. Collect (ONE question at a time, conversationally): 1. Business type and location (city/province) 2. Main goal (more customers, calls, bookings, online sales) 3. Target customer (who buys from them) 4. Monthly ad budget in CAD 5. Do they have a website? Ask for URL. If no site → recommend AdWise build one ($299 CAD, 5 days) 6. Preferred platforms OR let AI decide After collecting all info, deliver a PERSONALIZED CAMPAIGN PLAN: - Recommended platforms with reasoning - Budget split (e.g. 70% Meta, 30% Google) - Target audience specifics - Ad format recommendations - Expected results (leads/month estimate) - Clear next step: "Click 'Launch My Campaign' to get started" Tone: Direct, confident, friendly. Like a smart friend who knows marketing. No fluff. Use $ CAD amounts. Keep messages concise — 2-4 sentences max per message unless delivering the final plan.`; const STATS = [ { num: "3 min", label: "Average setup time" }, { num: "4.8×", label: "Average ROI for clients" }, { num: "500+", label: "Canadian businesses served" }, { num: "$149", label: "Starting at CAD/mo" }, ]; const NICHES = [ { icon: "🔨", title: "Contractors & Trades", desc: "Roofing, HVAC, renovation, plumbing. High-ticket jobs, targeted local reach.", roi: "Up to 20× ROI" }, { icon: "🦷", title: "Dental & Medical", desc: "Fill your calendar with new patients. Target by location and demographics.", roi: "Up to 15× ROI" }, { icon: "🍽️", title: "Restaurants & Cafés", desc: "Drive foot traffic and reservations. Hyper-local targeting within 5km.", roi: "Up to 8× ROI" }, { icon: "⚖️", title: "Law Firms", desc: "Generate qualified consultations. Precision targeting by legal need.", roi: "Up to 25× ROI" }, { icon: "🏋️", title: "Fitness & Wellness", desc: "Memberships, classes, and bookings. Seasonal campaigns that convert.", roi: "Up to 10× ROI" }, { icon: "🏡", title: "Real Estate Agents", desc: "Listings and buyer leads. Target active movers in your market.", roi: "Up to 30× ROI" }, ]; const PLANS = [ { name: "Starter", price: "149", desc: "Perfect for local shops and restaurants", color: "#F5A623", features: ["1 platform (Meta or Google)", "AI campaign setup", "Up to $1,000 ad budget", "Weekly performance report", "Email support"], }, { name: "Growth", price: "349", desc: "Most popular for contractors & clinics", color: "#00E5FF", popular: true, features: ["Meta + Google Ads", "Competitor analysis", "Up to $5,000 ad budget", "Auto-optimization weekly", "Live chat support", "Website audit included"], }, { name: "Pro", price: "699", desc: "For high-spend, multi-location businesses", color: "#B8FF57", features: ["Meta + Google + TikTok", "Unlimited ad budget", "Priority AI optimization", "Dedicated account AI", "Phone support", "Custom monthly report"], }, ]; const HOW = [ { n: "01", title: "Tell us about your business", body: "Chat with our AI for 3 minutes. Describe your business, goals, and budget. No forms, no jargon." }, { n: "02", title: "AI analyzes your market", body: "We study your competitors' ads, identify winning audiences, and build your campaign strategy." }, { n: "03", title: "Connect your ad account", body: "One click to connect Facebook or Google. Your money goes directly to the platform — we never touch it." }, { n: "04", title: "Campaigns launch automatically", body: "AdWise creates and launches your ads via API. You get a dashboard with live results." }, ]; export default function AdWiseCanada() { const [view, setView] = useState("landing"); // landing | chat const [messages, setMessages] = useState([ { role: "assistant", content: "Hey! I'm AdWise — your AI advertising consultant.\n\nI'll get your business in front of the right customers in under 5 minutes. No agencies, no complexity.\n\nLet's start: what kind of business do you run, and where are you located?", }, ]); const [input, setInput] = useState(""); const [loading, setLoading] = useState(false); const [history, setHistory] = useState([]); const [step, setStep] = useState(1); const [menuOpen, setMenuOpen] = useState(false); const bottomRef = useRef(null); const inputRef = useRef(null); useEffect(() => { bottomRef.current?.scrollIntoView({ behavior: "smooth" }); }, [messages, loading]); const detectStep = (text) => { const t = text.toLowerCase(); if (t.includes("goal") || t.includes("objective") || t.includes("result")) return 2; if (t.includes("customer") || t.includes("audience") || t.includes("who")) return 3; if (t.includes("budget") || t.includes("spend") || t.includes("cad")) return 4; if (t.includes("website") || t.includes("url") || t.includes("site")) return 5; if (t.includes("platform") || t.includes("facebook") || t.includes("google") || t.includes("instagram")) return 6; if (t.includes("campaign") || t.includes("launch") || t.includes("recommend") || t.includes("plan")) return 7; return null; }; const send = async () => { if (!input.trim() || loading) return; const userMsg = { role: "user", content: input.trim() }; const newHist = [...history, userMsg]; setMessages(m => [...m, userMsg]); setHistory(newHist); setInput(""); setLoading(true); try { const res = await fetch("https://api.anthropic.com/v1/messages", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ model: "claude-sonnet-4-20250514", max_tokens: 1000, system: SYSTEM_PROMPT, messages: newHist, }), }); const data = await res.json(); const reply = data.content?.map(b => b.text || "").join("") || "Something went wrong. Please try again."; const aMsg = { role: "assistant", content: reply }; setMessages(m => [...m, aMsg]); setHistory(h => [...h, aMsg]); const s = detectStep(reply); if (s && s > step) setStep(s); } catch { setMessages(m => [...m, { role: "assistant", content: "Connection error. Please try again." }]); } setLoading(false); setTimeout(() => inputRef.current?.focus(), 50); }; const onKey = (e) => { if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); send(); } }; const STEPS = ["Business", "Goals", "Audience", "Budget", "Website", "Platforms", "Your Plan"]; /* ── CHAT VIEW ── */ if (view === "chat") return (
{/* Chat Nav */}
AdWise Canada
AI Online
{/* Progress Steps */}
{STEPS.map((s, i) => (
i + 1 ? "#F5A623" : step === i + 1 ? "#F5A623" : "rgba(255,255,255,0.1)", boxShadow: step === i + 1 ? "0 0 16px #F5A623" : "none", transform: step === i + 1 ? "scale(1.2)" : "scale(1)", }}> {step > i + 1 ? "✓" : i + 1}
= i + 1 ? "#F5A623" : "rgba(255,255,255,0.25)" }}>{s}
))}
{/* Messages */}
{messages.map((m, i) => (
{m.role === "assistant" &&
W
}
{m.content.split("\n").map((line, j) => ( {line}{j < m.content.split("\n").length - 1 &&
}
))}
))} {loading && (
W
)}
{/* Input */}