{"version":3,"file":"FreemiumForm.DBOG3cVB.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/3FQvSplwCAYzYvjQu3mv/BIHpfwTKb56JzBzntaYO/FreemiumForm.js"],"sourcesContent":["// Welcome to Code in Framer\n// Get Started: https://www.framer.com/developers/\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState}from\"react\";import Loading from\"https://framerusercontent.com/modules/oFDGXI3y7IFZfIXmwLmw/6NnntuOYmBMUai08NNon/Loading.js\";import{motion}from\"framer-motion\";const Input=({labelText,errorText,...props})=>/*#__PURE__*/_jsxs(\"div\",{style:inputContainerStyle,children:[/*#__PURE__*/_jsx(\"label\",{style:labelStyle,children:labelText}),/*#__PURE__*/_jsx(\"input\",{style:{...inputStyle,...errorText?inputStyleError:null},...props}),errorText?/*#__PURE__*/_jsx(\"span\",{style:fieldErrorStyle,children:errorText}):null]});// Lee los UTM del navegador, igual que hace tu función sE / el script de AC:\n// 1) la URL (?utm_source=...)  2) el helper global  3) localStorage 'tracking'\nfunction getUtms(){if(typeof window===\"undefined\")return{};const urlParams=new URLSearchParams(window.location.search);let trk=null;try{const trkstr=localStorage.getItem(\"tracking\");if(trkstr)trk=JSON.parse(trkstr);}catch(e){}const pick=(urlKey,trkKey)=>{const fromUrl=urlParams.get(urlKey);if(fromUrl)return fromUrl;if(window.getQueryParamsFromLocalStorage){const v=window.getQueryParamsFromLocalStorage(urlKey);if(v)return v;}if(trk&&trk[trkKey])return trk[trkKey];if(trk&&trk[urlKey])return trk[urlKey];return undefined;};return{utm_source:pick(\"utm_source\",\"utmSource\"),utm_medium:pick(\"utm_medium\",\"utmMedium\"),utm_campaign:pick(\"utm_campaign\",\"utmCampaign\"),utm_content:pick(\"utm_content\",\"utmContent\")};}export default function HealthForm(props){const[isFetching,setFetching]=useState(false);const[error,setError]=useState(\"\");const[form,setForm]=useState({name:\"\",acceptTerms:false,email:\"\"});const onSubmit=async ev=>{ev.preventDefault();if(!isFetching){setFetching(true);// TRACKING: el usuario pulsa el botón de registro\nif(typeof window!==\"undefined\"&&window.posthog){window.posthog.capture(\"formulario_registro_iniciado\",{page:window.location.pathname});}try{const utms=getUtms();const res=await fetch(\"https://app.formacion.ninja/api/account/create-freemium\",{method:\"POST\",headers:{\"Content-Type\":\"application/json; charset=utf-8\"},body:JSON.stringify({...form,...utms})});if(!res.ok){throw{status:res.status,message:`Unexpected error ${await res.status}`};}// ⬇️ ⬇️ ⬇️  CAMBIO: leer la respuesta y guardar el magic link\nconst data=await res.json();if(data?.magicLoginUrl){// Guardamos el enlace de autologin para que /gracias lo use.\n// sessionStorage NO expone el token en la URL. Funciona porque\n// el form y /gracias están ambos bajo formacion.ninja.\nsessionStorage.setItem(\"ninja_magic\",data.magicLoginUrl);}// ⬆️ ⬆️ ⬆️  FIN CAMBIO\n// TRACKING: registro completado con éxito (este es el KPI real)\nif(typeof window!==\"undefined\"&&window.posthog){window.posthog.capture(\"formulario_registro_enviado\",{page:window.location.pathname,email:form.email});}window.location.href=\"/gracias/sistema-ninja\";}catch(ex){// TRACKING: error en el registro\nif(typeof window!==\"undefined\"&&window.posthog){window.posthog.capture(\"formulario_registro_error\",{page:window.location.pathname,error_status:ex?.status??\"unknown\",email_duplicate:ex?.status===409});}setError(ex?.status===409?\"Ya existe una cuenta asociada a este email. Elige un email diferente o inicia sesi\\xf3n en la plataforma.\":\"Vaya, parece que tenemos problemas a la hora de registrarte, int\\xe9ntalo m\\xe1s tarde.\");console.error(ex);}setFetching(false);}};const onChange=(field,ev)=>{setError(\"\");setForm({...form,[field]:field===\"acceptTerms\"?ev.target.checked:ev.target.value});};return /*#__PURE__*/_jsx(\"div\",{style:pageStyle,children:/*#__PURE__*/_jsxs(\"form\",{onSubmit:onSubmit,style:cardStyle,children:[/*#__PURE__*/_jsxs(\"div\",{style:headerStyle,children:[/*#__PURE__*/_jsx(\"div\",{style:titleStyle,children:\"Reg\\xedstrate gratis\"}),/*#__PURE__*/_jsx(\"div\",{style:subtitleStyle,children:\"Accede al curso gratuito ahora.\"})]}),/*#__PURE__*/_jsxs(\"div\",{style:formBodyStyle,children:[/*#__PURE__*/_jsx(\"div\",{style:rowStyle,children:/*#__PURE__*/_jsx(Input,{labelText:\"Nombre*\",required:true,placeholder:\"Tu nombre\",onChange:onChange.bind(onChange,\"name\")})}),/*#__PURE__*/_jsx(\"div\",{style:rowStyle,children:/*#__PURE__*/_jsx(Input,{labelText:\"Email*\",required:true,placeholder:\"Tu correo\",type:\"email\",onChange:onChange.bind(onChange,\"email\")})}),/*#__PURE__*/_jsxs(\"div\",{style:termsRowStyle,children:[/*#__PURE__*/_jsx(\"input\",{type:\"checkbox\",onChange:onChange.bind(onChange,\"acceptTerms\"),style:checkboxStyle,required:true}),/*#__PURE__*/_jsxs(\"span\",{style:policeStyle,children:[\"He le\\xeddo y acepto la\",\" \",/*#__PURE__*/_jsx(\"a\",{style:linkStyle,href:\"https://formacion.ninja/aviso-legal/politica-de-privacidad\",children:\"Pol\\xedtica de Privacidad\"})]})]}),/*#__PURE__*/_jsx(\"div\",{style:rowStyle,children:/*#__PURE__*/_jsx(motion.button,{whileTap:{scale:.98},whileHover:{scale:1.02},style:buttonStyle,type:\"submit\",disabled:isFetching,children:!isFetching?\"Reg\\xedstrate gratis\":/*#__PURE__*/_jsx(\"span\",{style:loadingWrapStyle,children:/*#__PURE__*/_jsx(Loading,{color:\"#FFFFFF\"})})})}),error?/*#__PURE__*/_jsx(\"div\",{style:errorBoxStyle,children:error}):null,/*#__PURE__*/_jsx(\"div\",{style:footerHintStyle,children:\"Al registrarte, se crear\\xe1 tu cuenta y podr\\xe1s iniciar sesi\\xf3n en la plataforma.\"})]})]})});}/* ---------- Styles (Minimal / shadcn-ish) ---------- */const pageStyle={width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",padding:24,background:\"transparent\"};const cardStyle={width:\"100%\",maxWidth:560,borderRadius:16,border:\"1px solid #E2E8F0\",background:\"#FFFFFF\",boxShadow:\"0 1px 2px rgba(15, 23, 42, 0.06), 0 12px 32px rgba(15, 23, 42, 0.08)\",padding:20};const headerStyle={display:\"flex\",flexDirection:\"column\",gap:6,paddingBottom:14,borderBottom:\"1px solid #F1F5F9\",marginBottom:16};const titleStyle={fontSize:20,fontWeight:800,letterSpacing:-.3,color:\"#0F172A\"};const subtitleStyle={fontSize:14,color:\"#475569\",lineHeight:1.4};const formBodyStyle={display:\"flex\",flexDirection:\"column\",gap:14};const rowStyle={gap:12,display:\"flex\",flexDirection:\"row\",width:\"100%\"};const termsRowStyle={display:\"flex\",flexDirection:\"row\",alignItems:\"center\",gap:10,padding:\"8px 10px\",borderRadius:12,border:\"1px solid #F1F5F9\",background:\"#FFFFFF\"};const inputContainerStyle={position:\"relative\",display:\"flex\",flexDirection:\"column\",width:\"100%\",gap:6};const labelStyle={fontSize:13,fontWeight:600,color:\"#334155\"};const inputStyle={width:\"100%\",height:48,borderRadius:12,border:\"1px solid #CBD5E1\",background:\"#FFFFFF\",padding:\"0 14px\",fontSize:15,color:\"#0F172A\",boxShadow:\"0 1px 0 rgba(15, 23, 42, 0.02)\"};const inputStyleError={borderColor:\"rgba(220, 38, 38, 0.65)\",boxShadow:\"0 0 0 4px rgba(220, 38, 38, 0.10)\"};const checkboxStyle={width:18,height:18,accentColor:\"#E30613\",cursor:\"pointer\"};const policeStyle={fontSize:13,color:\"#475569\",lineHeight:1.4};const linkStyle={color:\"#E30613\",fontWeight:600,textDecoration:\"none\"};const buttonStyle={cursor:\"pointer\",display:\"flex\",width:\"100%\",height:52,alignItems:\"center\",justifyContent:\"center\",fontSize:15,fontWeight:800,letterSpacing:.2,color:\"#FFFFFF\",borderRadius:12,border:\"1px solid rgba(0,0,0,0.02)\",background:\"#E30613\",boxShadow:\"0 12px 28px rgba(227, 6, 19, 0.18)\"};const loadingWrapStyle={display:\"flex\",alignItems:\"center\",justifyContent:\"center\"};const errorBoxStyle={width:\"100%\",borderRadius:12,border:\"1px solid rgba(220, 38, 38, 0.25)\",background:\"rgba(220, 38, 38, 0.06)\",color:\"#991B1B\",padding:\"10px 12px\",fontSize:13,lineHeight:1.4};const fieldErrorStyle={fontSize:12,color:\"#DC2626\"};const footerHintStyle={fontSize:12,color:\"#64748B\",textAlign:\"center\",paddingTop:6};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HealthForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FreemiumForm.map"],"mappings":"0OAIA,SAAS,GAAS,CAAC,GAAU,IAAS,OAAY,MAAM,EAAE,CAAC,IAAM,EAAU,IAAI,gBAAgB,EAAO,SAAS,OAAO,CAAK,EAAI,KAAK,GAAG,CAAC,IAAM,EAAO,aAAa,QAAQ,WAAW,CAAI,IAAO,EAAI,KAAK,MAAM,EAAO,OAAU,EAAE,IAAM,GAAM,EAAO,IAAS,CAAC,IAAM,EAAQ,EAAU,IAAI,EAAO,CAAC,GAAG,EAAQ,OAAO,EAAQ,GAAG,EAAO,+BAA+B,CAAC,IAAM,EAAE,EAAO,+BAA+B,EAAO,CAAC,GAAG,EAAE,OAAO,EAAG,GAAG,GAAK,EAAI,GAAQ,OAAO,EAAI,GAAQ,GAAG,GAAK,EAAI,GAAQ,OAAO,EAAI,IAA2B,MAAM,CAAC,WAAW,EAAK,aAAa,YAAY,CAAC,WAAW,EAAK,aAAa,YAAY,CAAC,aAAa,EAAK,eAAe,cAAc,CAAC,YAAY,EAAK,cAAc,aAAa,CAAC,CAAE,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,EAAW,GAAaA,EAAS,GAAM,CAAM,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAK,GAASA,EAAS,CAAC,KAAK,GAAG,YAAY,GAAM,MAAM,GAAG,CAAC,CAAO,EAAS,KAAM,IAAI,CAAqB,GAApB,EAAG,gBAAgB,CAAI,CAAC,EAAW,CAAC,E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