From 86eb0e84b44d57aff131b71be916f0c60b7d1f82 Mon Sep 17 00:00:00 2001 From: kleap-admin Date: Fri, 16 Jan 2026 16:31:27 +0000 Subject: [PATCH] Update components/kleap-form.tsx --- components/kleap-form.tsx | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/components/kleap-form.tsx b/components/kleap-form.tsx index 14dc666..6b8c8b7 100644 --- a/components/kleap-form.tsx +++ b/components/kleap-form.tsx @@ -13,6 +13,11 @@ import { } from "@/components/ui/form"; import { Button } from "./ui/button"; +interface KleapFormFieldOption { + label: string; + value: string; +} + interface KleapFormField { name: string; label: string; @@ -28,7 +33,7 @@ interface KleapFormField { | "number"; placeholder?: string; required?: boolean; - options?: string[]; // For select, radio + options?: KleapFormFieldOption[]; // For select, radio rows?: number; // For textarea validation?: { min?: number; @@ -171,7 +176,7 @@ export function KleapForm({ try { // Get app_id from environment or URL const envAppId = process.env.NEXT_PUBLIC_APP_ID; - const urlAppId = new URLSearchParams(window.location.search).get( + const urlAppId = new URLSearchParams(typeof window !== 'undefined' ? window.location.search : '').get( "app_id", ); const appId = envAppId || urlAppId || ""; @@ -197,13 +202,6 @@ export function KleapForm({ formData.append(key, String(value)); }); - // 📤 DEBUG HELPER - Log request details - console.group("📤 KLEAP FORM REQUEST"); - for (const [_key, _value] of formData.entries()) { - // Debug logging entries - } - console.groupEnd(); - // Submit to Kleap's form API const response = await fetch("https://form.kleap.co", { method: "POST", @@ -325,8 +323,8 @@ export function KleapForm({ > {field.options?.map((option) => ( - ))} @@ -349,16 +347,16 @@ export function KleapForm({ ) : field.type === "radio" && field.options ? (
{field.options.map((option) => ( -