{"version":3,"file":"ResetPasswordForm.CfdY7GMP.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/tMILhh9fdh2byAeaY5sm/mmqr8ZoCq3SOA6mRY7gS/ResetPasswordForm.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{fetchData}from\"https://framerusercontent.com/modules/isEeIcye7ChOHOrloOwT/HfmhQso7rzmL5H2oUzFp/Fetch.js\";import{addPropertyControls,ControlType}from\"framer\";export default function CreatePasswordForm({fm,formInput}){const[password,setPassword]=useState(\"\");const[confirmPassword,setConfirmPassword]=useState(\"\");const[token,setToken]=useState(\"\");const[loading,setLoading]=useState(false);const[success,setSuccess]=useState(false);const[error,setError]=useState(\"\");useEffect(()=>{const urlParams=new URLSearchParams(window.location.search);const tokenParam=urlParams.get(\"token\");if(tokenParam)setToken(tokenParam);},[]);const handleSubmit=async e=>{e.preventDefault();setError(\"\");if(!password||password!==confirmPassword){setError(\"Passwords do not match.\");return;}setLoading(true);try{const response=await fetchData(\"/web/auth/password/reset/confirm\",{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:{token,password,confirmPassword}});if(response?.code===200){setSuccess(true);setPassword(\"\");setConfirmPassword(\"\");}else{setError(\"There was a problem. Please try again later.\");}}catch{setError(\"There was a problem. Please try again later.\");}finally{setLoading(false);}};if(success){return /*#__PURE__*/_jsxs(\"div\",{style:{...fm,textAlign:\"center\",padding:\"20px\"},children:[/*#__PURE__*/_jsx(\"h2\",{style:{fontFamily:formInput.fontFamily},children:\"Create Password!\"}),/*#__PURE__*/_jsx(\"p\",{style:{fontSize:`${formInput.fontSize}px`,fontFamily:formInput.fontFamily},children:\"Your password has been successfully created.\"}),/*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:()=>window.location.href=\"/login\",style:{marginTop:\"20px\",background:\"#ff1313\",color:\"white\",border:\"none\",padding:\"12px 24px\",borderRadius:\"8px\",cursor:\"pointer\",fontSize:`${formInput.fontSize}px`},children:\"Go to Login\"})]});}return /*#__PURE__*/_jsxs(\"form\",{style:{...fm},onSubmit:handleSubmit,children:[/*#__PURE__*/_jsx(\"h2\",{style:{marginBottom:\"10px\",textAlign:\"center\",fontFamily:formInput.fontFamily},children:\"Create Password\"}),/*#__PURE__*/_jsx(\"p\",{style:{textAlign:\"center\",fontSize:`${formInput.fontSize}px`,marginBottom:\"10px\",fontFamily:formInput.fontFamily},children:\"Enter your new password and confirm it.\"}),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"grid\",gap:fm.gap,width:\"100%\",gridTemplateColumns:\"1fr\"},className:\"form-grid\",children:[/*#__PURE__*/_jsx(\"input\",{type:\"password\",name:\"password\",placeholder:\"New password *\",value:password,onChange:e=>setPassword(e.target.value),required:true,style:{width:\"100%\",boxSizing:\"border-box\",...formInput,...formInput.border,fontSize:`${formInput.fontSize}px`}}),/*#__PURE__*/_jsx(\"input\",{type:\"password\",name:\"confirmPassword\",placeholder:\"Confirm password *\",value:confirmPassword,onChange:e=>setConfirmPassword(e.target.value),required:true,style:{width:\"100%\",boxSizing:\"border-box\",...formInput,...formInput.border,fontSize:`${formInput.fontSize}px`}})]}),error&&/*#__PURE__*/_jsx(\"p\",{style:{marginTop:\"10px\",fontSize:`${formInput.fontSize}px`,color:\"#c00\",fontFamily:formInput.fontFamily,textAlign:\"center\"},children:error}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:loading,style:{marginTop:\"15px\",width:\"100%\",background:loading?\"#999\":\"#ff1313\",color:\"white\",padding:\"12px\",border:\"none\",borderRadius:\"8px\",fontSize:`${formInput.fontSize}px`,cursor:loading?\"not-allowed\":\"pointer\"},children:loading?\"Processing...\":\"Create New Password\"}),/*#__PURE__*/_jsx(\"div\",{style:{textAlign:\"center\",marginTop:\"10px\"},children:/*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:()=>window.location.href=\"/login\",style:{background:\"transparent\",border:\"none\",color:\"#ff1313\",cursor:\"pointer\",fontSize:`${formInput.fontSize}px`},children:\"Back to Login\"})})]});}addPropertyControls(CreatePasswordForm,{fm:{type:ControlType.Object,title:\"Form\",controls:{border:{type:ControlType.Border},borderRadius:{type:ControlType.BorderRadius},padding:{type:ControlType.Padding},background:{type:ControlType.Color,defaultValue:\"white\"},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:10,unit:\"px\"}}},formInput:{type:ControlType.Object,title:\"Input\",controls:{fontFamily:{type:ControlType.String,defaultValue:'\"Inter\", sans-serif'},fontSize:{type:ControlType.Number,defaultValue:14,unit:\"px\"},border:{type:ControlType.Border,defaultValue:{borderColor:\"#F0F0F0\",borderStyle:\"solid\",borderWidth:2}},borderRadius:{type:ControlType.BorderRadius,defaultValue:\"8px\"},padding:{type:ControlType.Padding,defaultValue:\"10px\"},background:{type:ControlType.Color,defaultValue:\"white\"}}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CreatePasswordForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ResetPasswordForm.map"],"mappings":"uPAAmQ,SAAwB,EAAmB,CAAC,KAAG,aAAW,CAAC,GAAK,CAAC,EAAS,GAAaA,EAAS,GAAG,CAAM,CAAC,EAAgB,GAAoBA,EAAS,GAAG,CAAM,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAQ,GAAYA,EAAS,GAAM,CAAM,CAAC,EAAQ,GAAYA,EAAS,GAAM,CAAM,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAC,MAAc,CAA6D,IAAM,EAAlD,IAAI,gBAAgB,EAAO,SAAS,OAAO,CAA4B,IAAI,QAAQ,CAAI,GAAW,EAAS,EAAW,EAAG,EAAE,CAAC,CAAC,IAAM,EAAa,KAAM,IAAG,CAAiC,GAAhC,EAAE,gBAAgB,CAAC,EAAS,GAAG,CAAI,CAAC,GAAU,IAAW,EAAgB,CAAC,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