import { useState } from "react"; import ReactDOM from "react-dom"; import { sendCustomTemplateRequest } from "../api/enterprise"; interface Props { open: boolean; onClose: () => void; } export default function DesignerTemplateRequestModal({ open, onClose }: Props) { const [description, setDescription] = useState(""); const [altContact, setAltContact] = useState(""); const [loading, setLoading] = useState(false); const [success, setSuccess] = useState(false); const [error, setError] = useState(null); const handleClose = () => { if (loading) return; onClose(); setTimeout(() => { setDescription(""); setAltContact(""); setSuccess(false); setError(null); }, 200); }; const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); if (!description.trim()) return; setLoading(true); setError(null); try { await sendCustomTemplateRequest({ description: description.trim(), alternate_contact: altContact.trim() || undefined, }); setSuccess(true); setTimeout(() => { handleClose(); }, 3000); } catch { setError("Failed to send request. Please try again."); } finally { setLoading(false); } }; if (!open) return null; return ReactDOM.createPortal(
{success ? (

Request Successfully Sent

Thank you! Our design team will review your request and reach out with next steps shortly. You'll hear back from us within 1–2 business days.

) : ( <>

Request a Designer Template

Tell us what you need and our design team will create a custom Designer Template tailored to your brand.