{"version":3,"file":"MagicLinkTest.BthbTRBw.mjs","names":["useState","email"],"sources":["https:/framerusercontent.com/modules/UxeqfQ4Q1E6hGv3UbDuE/Ym9kyH4Ixi8aU6TlE8LO/MagicLinkTest.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState}from\"react\";export default function MagicLinkForm(){const[email,setEmail]=useState(\"\");const[message,setMessage]=useState(\"\");const[isLoading,setIsLoading]=useState(false);const[errors,setErrors]=useState({});const isValidEmail=email=>/\\S+@\\S+\\.\\S+/.test(email);const handleMagicLink=async()=>{if(!isValidEmail(email)){setErrors({email:[\"Please enter a valid email address\"]});return;}setErrors({});setMessage(\"\");setIsLoading(true);try{const res=await fetch(\"https://auth.soilbeat.com/api/backend/v1/magic_link\",{method:\"POST\",headers:{\"Content-Type\":\"application/json\",Authorization:\"Bearer fe069edf6f660ca6f3461bab77ffee0538c45eacb5048a226598e4d5633d138e7657c68379cf850407350dd32bb5a9ed\"},body:JSON.stringify({email})});if(res.ok){setMessage(\"✅ Check your email for the activation link!\");// Redirect naar demo na 1.5 seconden\nsetTimeout(()=>{window.location.href=\"https://demo.soilbeat.com/\";},1500);}else{const data=await res.json().catch(()=>null);const errorText=data?.message||res.statusText;setMessage(\"❌ \"+errorText);}}catch(err){setMessage(\"❌ Error: \"+err.message);}finally{setIsLoading(false);}};const inputStyle={width:\"100%\",marginBottom:\"10px\",padding:\"12px\",borderRadius:\"40px\",border:\"1px solid #ccc\",fontSize:\"16px\",boxSizing:\"border-box\"};const errorInputStyle={...inputStyle,border:\"1px solid #ff4d4f\",backgroundColor:\"rgba(255, 77, 79, 0.05)\"};const buttonStyle={width:\"100%\",padding:\"12px\",borderRadius:\"40px\",border:\"none\",fontWeight:\"bold\",fontSize:\"16px\",cursor:\"pointer\",backgroundColor:\"#00A86B\",color:\"white\",opacity:isValidEmail(email)&&!isLoading?1:.5,pointerEvents:isValidEmail(email)&&!isLoading?\"auto\":\"none\",boxSizing:\"border-box\"};const messageStyle={textAlign:\"center\",marginTop:\"15px\",color:message.startsWith(\"✅\")?\"#00A86B\":\"#ff4d4f\",fontSize:\"15px\",fontWeight:\"600\"};return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"auto\",fontFamily:\"Inter, sans-serif\"},children:[/*#__PURE__*/_jsx(\"input\",{type:\"email\",placeholder:\"Email Address\",value:email,onChange:e=>setEmail(e.target.value),required:true,style:errors.email?errorInputStyle:inputStyle,disabled:isLoading}),errors.email&&/*#__PURE__*/_jsx(\"div\",{style:{color:\"#ff4d4f\",fontSize:\"12px\",marginBottom:\"10px\"},children:errors.email[0]}),/*#__PURE__*/_jsx(\"button\",{style:buttonStyle,onClick:handleMagicLink,disabled:!isValidEmail(email)||isLoading,children:isLoading?\"Sending...\":\"Start my free subscription\"}),message&&/*#__PURE__*/_jsx(\"p\",{style:messageStyle,children:message})]});}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MagicLinkForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./MagicLinkTest.map"],"mappings":"0MAAqF,SAAwB,GAAe,CAAC,GAAK,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAQ,GAAYA,EAAS,GAAG,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAM,CAAC,EAAO,GAAWA,EAAS,EAAE,CAAC,CAAO,EAAa,GAAO,eAAe,KAAKC,EAAM,CAAO,EAAgB,SAAS,CAAC,GAAG,CAAC,EAAa,EAAM,CAAC,CAAC,EAAU,CAAC,MAAM,CAAC,qCAAqC,CAAC,CAAC,CAAC,OAAQ,EAAU,EAAE,CAAC,CAAC,EAAW,GAAG,CAAC,EAAa,GAAK,CAAC,GAAG,CAAC,IAAM,EAAI,MAAM,MAAM,sDAAsD,CAAC,OAAO,OAAO,QAAQ,CAAC,eAAe,mBAAmB,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