{"version":3,"file":"FreemiumForm.DX_2BAFf.mjs","names":["useState","useMemo"],"sources":["https:/framerusercontent.com/modules/3FQvSplwCAYzYvjQu3mv/ZzubqDmT2dFe6UZZKj1e/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,useEffect,useMemo}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]});export default function HealthForm(props){const[isFetching,setFetching]=useState(false);const[error,setError]=useState(\"\");const[form,setForm]=useState({name:\"\",lastname:\"\",acceptTerms:false,email:\"\"});// Responsive: stack inputs on mobile\nconst[isMobile,setIsMobile]=useState(false);useEffect(()=>{const media=window.matchMedia(\"(max-width: 767px)\");const update=()=>setIsMobile(media.matches);update();media.addEventListener?.(\"change\",update);return()=>media.removeEventListener?.(\"change\",update);},[]);const rowStyleResponsive=useMemo(()=>({...rowStyle,flexDirection:isMobile?\"column\":\"row\"}),[isMobile]);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 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})});if(!res.ok){throw{status:res.status,message:`Unexpected error ${await res.status}`};}// 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=\"https://formacion.ninja/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__*/_jsxs(\"div\",{style:rowStyleResponsive,children:[/*#__PURE__*/_jsx(Input,{labelText:\"Nombre*\",required:true,placeholder:\"Tu nombre\",onChange:onChange.bind(onChange,\"name\")}),/*#__PURE__*/_jsx(Input,{labelText:\"Apellido*\",required:true,placeholder:\"Tu apellido\",onChange:onChange.bind(onChange,\"lastname\")})]}),/*#__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.\"})]}),/*#__PURE__*/_jsx(\"style\",{children:`\n/* Minimal shadcn-ish base */\n:root {\n  --radius: 12px;\n}\n\n* { box-sizing: border-box; }\n\ninput {\n  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, \"Apple Color Emoji\", \"Segoe UI Emoji\";\n}\n\ninput::placeholder {\n  color: #94A3B8; /* slate-400 */\n}\n\n/* Focus ring like shadcn */\ninput:focus {\n  outline: none;\n  border-color: rgba(227, 6, 19, 0.6);\n  box-shadow: 0 0 0 4px rgba(227, 6, 19, 0.12);\n}\n\n/* Disabled button */\nbutton:disabled {\n  opacity: 0.75;\n  cursor: not-allowed;\n}\n\n/* Subtle hover for inputs */\ninput:hover {\n  border-color: #94A3B8; /* slate-400 */\n}\n                    `})]})});}/* ---------- 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":"kPAE2lB,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,EAAW,GAAaA,EAAS,GAAM,CAAM,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAK,GAASA,EAAS,CAAC,KAAK,GAAG,SAAS,GAAG,YAAY,GAAM,MAAM,GAAG,CAAC,CAC/xB,CAAC,EAAS,GAAaA,EAAS,GAAM,CAAC,MAAc,CAAC,IAAM,EAAM,EAAO,WAAW,qBAAqB,CAAO,MAAW,EAAY,EAAM,QAAQ,CAAoD,OAAnD,GAAQ,CAAC,EAAM,mBAAmB,SAAS,EAAO,KAAW,EAAM,sBAAsB,SAAS,EAAO,EAAG,EAAE,CAAC,CAAC,IAAM,EAAmBC,OAAa,CAAC,GAAG,EAAS,cAAc,EAAS,SAAS,MAAM,EAAE,CAAC,EAAS,CAAC,CAAO,EAAS,KAAM,IAAI,CAAqB,GAApB,EAAG,gBAAgB,CAAI,CAAC,EAAW,CAAC,EAAY,GAAK,CACvb,IAAS,QAAa,EAAO,SAAS,EAAO,QAAQ,QAAQ,+BAA+B,CAAC,KAAK,EAAO,SAAS,SAAS,CAAC,CAAE,GAAG,CAAC,IAAM,EAAI,MAAM,MAAM,0DAA0D,CAAC,OAAO,OAAO,QAAQ,CAAC,eAAe,kCAAkC,CAAC,KAAK,KAAK,UAAU,CAAC,GA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