"use client"; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { z } from "zod"; import { Form, FormControl, FormField, FormItem, FormMessage, } from "@/components/ui/form"; import Link from "next/link"; import { IconBrandGithub, IconBrandLinkedin, IconBrandX, } from "@tabler/icons-react"; import { Button } from "./ui/button"; const formSchema = z.object({ name: z .string({ message: "Please enter your name", }) .min(1, "Please enter email"), email: z .string({ message: "Please enter email", }) .email("Please enter valid email") .min(1, "Please enter email"), company: z .string({ message: "Please enter your company's name", }) .min(1, "Please enter your company's name"), message: z .string({ message: "Please enter your message", }) .min(1, "Please enter your message"), }); export type LoginUser = z.infer; export function ContactForm() { const form = useForm({ resolver: zodResolver(formSchema), defaultValues: { name: "", email: "", company: "", message: "", }, }); async function onSubmit(values: LoginUser) { try { // Get app_id from environment or URL const appId = process.env.NEXT_PUBLIC_APP_ID || new URLSearchParams(window.location.search).get("app_id") || ""; // Create form data const formData = new FormData(); formData.append("app_id", appId); formData.append("name", values.name); formData.append("email", values.email); formData.append("company", values.company); formData.append("message", values.message); formData.append("form_type", "contact"); // Help identify form type in Kleap // Submit to Kleap's form API const response = await fetch("https://form.kleap.co", { method: "POST", body: formData, }); if (response.ok) { // Success! Reset form and show success message form.reset(); // You can add a toast notification here alert("Thank you for your message! We'll get back to you soon."); } else { throw new Error("Failed to submit form"); } } catch (e) { // Handle error console.error("Form submission error:", e); alert( "Sorry, there was an error submitting your message. Please try again.", ); } } const socials = [ { title: "twitter", href: "", icon: ( ), }, { title: "github", href: "", icon: ( ), }, { title: "linkedin", href: "https://linkedin.com/manuarora28", icon: ( ), }, ]; return (

Contact Us

Please reach out to us and we will get back to you at the speed of light.

(
)} /> (
)} /> (
)} /> (