// Hero: left = headline + CTAs + stat row; right = multi-step "Start your project" lead form. // On tablet/mobile the form stacks first (top) via .hero-form order in index.html CSS. const NS_HERO = window.AnsysDigitalDesignSystem_4543d7; function HeroForm() { const { Input, Select, Textarea, Button } = NS_HERO; const REG = window.ANSYS_REGION || {}; const steps = ["Contact", "Project", "Timeline"]; const [step, setStep] = React.useState(0); const [sent, setSent] = React.useState(false); const [busy, setBusy] = React.useState(false); const [err, setErr] = React.useState({}); const [f, setF] = React.useState({ fullName: "", email: "", phone: "", company: "", service: "", platform: "", revenue: "", products: "", timeline: "", message: "", source: "", website: "", besttime: "", }); const set = (k) => (e) => { const v = e.target.value; setF((p) => ({ ...p, [k]: v })); if (err[k]) setErr((p) => ({ ...p, [k]: undefined })); }; const go = (n) => setStep(Math.max(0, Math.min(2, n))); const validateStep = (s) => { const e = {}; if (s === 0) { if (!f.fullName.trim()) e.fullName = "Please enter your name."; if (!/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(f.email.trim())) e.email = "Enter a valid email address."; if (f.phone.trim() && f.phone.replace(/[^\d]/g, "").length < 7) e.phone = "Enter a valid phone number."; if (!f.company.trim()) e.company = "Please enter your company or brand."; } setErr(e); return Object.keys(e).length === 0; }; const next = () => { if (validateStep(step)) go(step + 1); }; const submit = (ev) => { ev.preventDefault(); if (step < 2) { next(); return; } if (!validateStep(0)) { go(0); return; } if (f.website) { setSent(true); return; } // honeypot: silently drop bots setBusy(true); const dial = REG.dial ? REG.dial + " " : ""; const payload = new URLSearchParams({ name: f.fullName, email: f.email, phone: dial + f.phone, company: f.company, service: f.service, platform: f.platform, revenue: f.revenue, products: f.products, timeline: f.timeline, message: f.message, source: f.source, besttime: f.besttime, region: REG.name || "", }); // Premium enquiry brief — reads like a proposal request, not a raw form dump. const has = (v) => v && !/^select|^when do you want/i.test(v); const row = (label, v) => (has(v) ? "• " + label + ": " + v : null); const first = (f.fullName.trim().split(/\s+/)[0] || "there"); const lines = [ "*ANSYS DIGITAL* — Premium Shopify Growth Partner", "──────────────────────", "Hello Ansys Digital team,", "", "I'd like to discuss a Shopify project with you. Here are my details:", "", "*━ ABOUT ME ━*", row("Name", f.fullName.trim()), row("Brand", f.company.trim()), row("Email", f.email.trim()), f.phone.trim() ? "• Phone: " + dial + f.phone.trim() : null, "", "*━ THE PROJECT ━*", row("What I need", f.service), row("Current platform", f.platform), row("Monthly revenue", f.revenue), row("Catalogue size", f.products), "", "*━ TIMING ━*", row("Start timeline", f.timeline), row("Best time to reach me", f.besttime), "", f.message.trim() ? "*━ GOALS & CONTEXT ━*" : null, f.message.trim() || null, f.message.trim() ? "" : null, "──────────────────────", row("Enquiry from", REG.name), row("Heard about you via", f.source), "", "Looking forward to your reply. Thank you!", "— " + first, ].filter((l) => l !== null && l !== undefined); const wa = "https://wa.me/919278024499?text=" + encodeURIComponent(lines.join("\n")); // International route: a properly formatted business email brief. const mrow = (label, v) => (has(v) ? " " + label.padEnd(24, ".") + " " + v : null); const mailLines = [ "Hello Ansys Digital team,", "", "I'm exploring a Shopify project and would like to discuss it with you.", "Below is a summary of my requirements.", "", "ABOUT THE BUSINESS", "------------------", mrow("Contact name", f.fullName.trim()), mrow("Brand / company", f.company.trim()), mrow("Email", f.email.trim()), f.phone.trim() ? " " + "Phone".padEnd(24, ".") + " " + dial + f.phone.trim() : null, mrow("Location", REG.name), "", "PROJECT REQUIREMENTS", "--------------------", mrow("Scope", f.service), mrow("Current platform", f.platform), mrow("Monthly revenue", f.revenue), mrow("Catalogue size", f.products), "", "TIMING & AVAILABILITY", "---------------------", mrow("Preferred start", f.timeline), mrow("Best time to reach me", f.besttime), "", f.message.trim() ? "GOALS & CONTEXT" : null, f.message.trim() ? "---------------" : null, f.message.trim() || null, f.message.trim() ? "" : null, has(f.source) ? "Found you via: " + f.source : null, "", "Please let me know your availability for an introductory call, along with", "an indicative scope and timeline.", "", "Kind regards,", f.fullName.trim() || first, f.company.trim(), ].filter((l) => l !== null && l !== undefined && l !== ""); const subject = "Shopify project enquiry — " + (f.company.trim() || f.fullName.trim() || "New enquiry") + (has(f.service) ? " (" + f.service + ")" : ""); const mail = "mailto:support@ansysdigital.com?subject=" + encodeURIComponent(subject) + "&body=" + encodeURIComponent(mailLines.join("\n")); const isIndia = (REG.code || "in") === "in"; const done = () => { setBusy(false); setSent(true); window.open(isIndia ? wa : mail, isIndia ? "_blank" : "_self", "noopener"); }; fetch("send.php", { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: payload }) .then(done).catch(done); // preview has no PHP — still confirm + open WhatsApp }; return (
Thank you{f.fullName ? ", " + f.fullName.split(" ")[0] : ""} — your details are on their way to us. We'll be in touch within one business day.
Free consultation — no commitment required
{REG.audience || "We design, develop and optimize premium Shopify stores that help businesses launch faster, convert more customers, and grow confidently."}