{"version":3,"file":"form_white.VHbSp3ZX.mjs","names":["useState","p"],"sources":["https:/framerusercontent.com/modules/dnHxx3EREWKbvYgSfzQD/7J3DB5PkW56nTueXtTCL/form_white.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";// Componente de formulario simple que coincide con tu diseño\nexport default function CustomForm(props){const{submitEndpoint=\"https://hook.eu1.make.com/g9mskslz5pzynkko3yxyn2ypa286rshg\",redirectUrl=\"/thank-you\",submitButtonText=\"VER V\\xcdDEO\",...rest}=props;// Estado para el UUID generado\nconst[uuidValue,setUuidValue]=useState(\"\");// Estado para bloquear doble envío\nconst[submitting,setSubmitting]=useState(false);const getPath=()=>{if(typeof window!==\"undefined\"&&window.location){try{return window.location.pathname||\"/\";}catch{return\"\";}}return\"\";};const[sourceValue,setSourceValue]=useState(getPath());useEffect(()=>{const p=getPath();if(p&&p!==sourceValue)setSourceValue(p);},[]);// Generar UUID una sola vez al montar el componente\nuseEffect(()=>{const generateUUID=()=>{const uuid=\"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g,function(c){const r=Math.random()*16|0;const v=c==\"x\"?r:r&3|8;return v.toString(16);});const base64UUID=btoa(uuid).replace(/[^a-zA-Z0-9]/g,\"\").substring(0,16);console.log(\"Generated UUID for form:\",base64UUID);return base64UUID;};setUuidValue(generateUUID());},[])// Solo se ejecuta una vez\n;// Manejar el envío del formulario\nconst handleSubmit=async event=>{event.preventDefault();if(submitting)return;// ⛔ Ignorar doble clic\nsetSubmitting(true);console.log(\"CustomForm submit started...\");const form=event.currentTarget;const formData=new FormData(form);// Fallback por si el hidden aún no tiene valor en este render\nif(!formData.get(\"source\")){formData.append(\"source\",sourceValue||getPath());}const params=new URLSearchParams;formData.forEach((value,key)=>{params.append(key,value.toString());console.log(`Form field: ${key} = ${value}`);});try{// --- 1. ENVIAR a Make (endpoint original) ---\nconsole.log(\"Sending form data to:\",submitEndpoint);const makeRequest=fetch(submitEndpoint,{method:\"POST\",body:formData,headers:{Accept:\"application/json\"}});// --- 2. ENVIAR a n8n (nuevo webhook) ---\nconst n8nWebhook=\"https://n8n.srv1008987.hstgr.cloud/webhook/056f35d2-1dcd-4397-806f-42f9b5d14de1\";const n8nRequest=fetch(n8nWebhook,{method:\"POST\",body:formData,headers:{Accept:\"application/json\"}});// Esperar a que terminen ambas peticiones en paralelo\nconst[makeResponse,n8nResponse]=await Promise.all([makeRequest,n8nRequest]);console.log(\"Make status:\",makeResponse.status);console.log(\"n8n status:\",n8nResponse.status);// --- 3. Redirigir al usuario ---\nconst separator=redirectUrl.includes(\"?\")?\"&\":\"?\";const finalRedirectURL=`${redirectUrl}${separator}${params.toString()}`;console.log(\"Redirecting to:\",finalRedirectURL);setTimeout(()=>{window.location.href=finalRedirectURL;},100);}catch(error){console.error(\"Error submitting form:\",error);// Redirigir aunque falle\nconst separator=redirectUrl.includes(\"?\")?\"&\":\"?\";const finalRedirectURL=`${redirectUrl}${separator}${params.toString()}`;window.location.href=finalRedirectURL;}finally{setSubmitting(false)// 🔓 Si quieres reintentos en caso de error\n;}};const formStyle={width:\"100%\",display:\"flex\",flexDirection:\"column\",gap:\"24px\",padding:\"24px\",backgroundColor:\"rgba(255, 255, 255, 0.45)\",backdropFilter:\"blur(16px)\",WebkitBackdropFilter:\"blur(16px)\",borderRadius:\"6px\",border:\"1px solid #ffff\"};const fieldStyle={display:\"flex\",flexDirection:\"column\",gap:\"8px\"};const labelStyle={fontSize:\"18px\",fontWeight:\"400\",color:\"rgba(255, 77, 0, 0.34)\",marginBottom:\"4px\",fontFamily:\"inherit\"};const inputStyle={padding:\"16px 20px\",border:\"1px solid rgba(241, 242, 244, 1)\",borderRadius:\"8px\",fontSize:\"16px\",backgroundColor:\"rgba(241, 242, 244, 0.05)\",color:\"rgba(31, 31, 31, 0.25)\",outline:\"none\",fontFamily:\"inherit\",marginBottom:\"20px\"};const buttonStyle={padding:\"18px 24px\",width:\"100%\",backgroundColor:\"#1F1F1F\",color:\"#ffff\",border:\"none\",borderRadius:\"8px\",fontSize:\"18px\",fontWeight:\"700\",cursor:submitting?\"not-allowed\":\"pointer\",marginTop:\"16px\",textTransform:\"uppercase\",letterSpacing:\"0.5px\",opacity:submitting?.6:1};return /*#__PURE__*/_jsxs(\"form\",{style:formStyle,onSubmit:handleSubmit,...rest,children:[/*#__PURE__*/_jsx(\"input\",{type:\"hidden\",name:\"uuid\",value:uuidValue}),/*#__PURE__*/_jsx(\"input\",{type:\"hidden\",name:\"source\",value:sourceValue}),/*#__PURE__*/_jsxs(\"div\",{style:fieldStyle,children:[/*#__PURE__*/_jsx(\"label\",{style:labelStyle,htmlFor:\"name\",children:\"Nombre\"}),/*#__PURE__*/_jsx(\"input\",{style:inputStyle,type:\"text\",id:\"name\",name:\"Name\",placeholder:\"Jose P\\xe9rez\",required:true,onFocus:e=>{e.target.style.borderColor=\"#Ffff\";e.target.style.backgroundColor=\"rgba(241, 242, 244, 0.15)\";e.target.style.color=\"#FF4C00\";},onBlur:e=>{e.target.style.borderColor=\"#ffff\";e.target.style.backgroundColor=\"rgba(241, 242, 244, 0.15)\";}})]}),/*#__PURE__*/_jsxs(\"div\",{style:fieldStyle,children:[/*#__PURE__*/_jsx(\"label\",{style:labelStyle,htmlFor:\"email\",children:\"Email\"}),/*#__PURE__*/_jsx(\"input\",{style:inputStyle,type:\"email\",id:\"email\",name:\"Email\",placeholder:\"jose.perez@gmail.com\",required:true,onFocus:e=>{e.target.style.borderColor=\"#FFFF\";e.target.style.backgroundColor=\"rgba(241, 242, 244, 0.15)\";e.target.style.color=\"#FF4C00\";},onBlur:e=>{e.target.style.borderColor=\"#FFFF\";e.target.style.backgroundColor=\"rgba(241, 242, 244, 0.15)\";}})]}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",style:buttonStyle,disabled:submitting,onMouseEnter:e=>{if(!submitting){e.currentTarget.style.backgroundColor=\"#000000\";e.currentTarget.style.color=\"#ffff\";}},onMouseLeave:e=>{if(!submitting){e.currentTarget.style.backgroundColor=\"#1F1F1F\";e.currentTarget.style.color=\"#ffff\";e.currentTarget.style.transform=\"translateY(0)\";}},children:submitting?\"Enviando...\":submitButtonText})]});}// Controles de propiedades (solo las esenciales)\naddPropertyControls(CustomForm,{submitEndpoint:{type:ControlType.String,title:\"Submit Endpoint\",description:\"URL donde se enviar\\xe1n los datos del formulario\",defaultValue:\"https://example.com/submit\"},redirectUrl:{type:ControlType.String,title:\"Redirect URL\",description:\"URL de redirecci\\xf3n despu\\xe9s del env\\xedo\",defaultValue:\"/thank-you\"},submitButtonText:{type:ControlType.String,title:\"Texto del bot\\xf3n\",defaultValue:\"VER V\\xcdDEO\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CustomForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./form_white.map"],"mappings":"yTACA,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,iBAAe,6DAA6D,cAAY,aAAa,mBAAiB,YAAe,GAAG,GAAM,EACzL,CAAC,EAAU,GAAcA,EAAS,GAAG,CACrC,CAAC,EAAW,GAAeA,EAAS,GAAM,CAAO,MAAY,CAAC,GAAU,IAAS,QAAa,EAAO,SAAU,GAAG,CAAC,OAAO,EAAO,SAAS,UAAU,SAAU,CAAC,MAAM,GAAK,MAAM,IAAU,CAAC,EAAY,GAAgBA,EAAS,GAAS,CAAC,CAAC,MAAc,CAAC,IAAMC,EAAE,GAAS,CAAIA,GAAGA,IAAI,GAAY,EAAeA,EAAE,EAAG,EAAE,CAAC,CAC9T,MAAc,CAAiU,OAAzS,CAAC,IAAM,EAAK,uCAAuC,QAAQ,QAAQ,SAAS,EAAE,CAAC,IAAM,EAAE,KAAK,QAAQ,CAAC,GAAG,EAAyB,OAAf,GAAG,IAAI,EAAE,EAAE,E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