{"version":3,"file":"ForgotPasswordForm.5hhtQkUn.mjs","names":["useState","useMemo","auth","__esmMin","pe","init_npm_react_18_3_1","_e","init_jsx_runtime","c","ce","addPropertyControls","withCSS","init_framer_BWFVvmND","ControlType","init_framerauth_esm","N","basePropertyControls","init_BaseForm","BaseForm","baseInputs","formId","defaultButtonLabel","buttonLabelKey","ForgotPasswordForm","snakeToCamel","inputsPropertyControls","exportBasePropertyControls","init_ForgotPasswordForm","baseProps","inputs","setInputs","buttonProps","newInputs","inputControlName","input","inputField","display","label","placeholder","onSubmit","_","formData","error","str","index","word"],"sources":["https:/framerusercontent.com/modules/V7ZJ0Ra8qPTMQrbcXXqD/U18ja8XA04kYJzDtKzXj/ForgotPasswordForm.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useMemo,useState}from\"react\";// @ts-ignore\nimport{addPropertyControls,ControlType,withCSS}from\"framer\";// @ts-ignore\nimport{auth}from\"https://cdn.framerauth.com/packages/sdk/live/latest/framerauth.esm.js\";import BaseForm,{basePropertyControls}from\"https://framerusercontent.com/modules/ExV5oOjPmSTY0gHEjmby/NpqywsqBSPokrP5l2Kmw/BaseForm.js\";//////////////////////////////////\n/////// FORM CONFIGURATION ///////\n//////////////////////////////////\n// Define inputs\nconst baseInputs=[{label:\"Email\",name:\"email\",type:\"email\",required:true,extra:false,placeholder:\"Email\"}];const formId=\"forgot_password\"// Unique form ID for this form.\n;const defaultButtonLabel=\"Send Reset Email\"// Default submit button label on this form.\n;const buttonLabelKey=`${formId}_button_label`// Key for button label property control.\n;/**\n * Forgot Password Form\n * By Joel Whitaker\n *\n * @framerDisableUnlink\n *\n * @framerIntrinsicWidth 300\n * @framerIntrinsicHeight 40\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight any\n */const ForgotPasswordForm=withCSS(function ForgotPasswordForm({...baseProps}){const[inputs,setInputs]=useState(baseInputs)// We can override inputs with property controls.\n;const buttonProps=useMemo(()=>{// Map button label to button\n// This is to avoid style copy-pasting of the button label.\nreturn{...baseProps.button,label:baseProps.button[buttonLabelKey]};},[baseProps.button,baseProps.button[buttonLabelKey]]);useEffect(()=>{// Map input labels to inputs\nif(baseProps.inputFields){const newInputs=[];baseInputs.forEach((input,_idx)=>{const inputControlName=snakeToCamel(input.name);if(!(inputControlName in baseProps.inputFields)){// If the input is not in the inputFields object, skip it.\nconsole.log(`Input ${inputControlName} not found in inputFields object.`);return;}const inputField=baseProps.inputFields[inputControlName];const display=inputField.display;const label=inputField.label;const placeholder=label;if(display===true||display===undefined){newInputs.push({...input,label,placeholder});}});setInputs(newInputs);}},[baseProps.inputFields]);const onSubmit=async formData=>{const{data:_,error}=await auth.resetPasswordForEmail({email:formData.email});if(error){return{ok:false,message:error.message};}return{ok:true,message:\"Email instructions sent.\"};};return /*#__PURE__*/_jsx(BaseForm,{...baseProps,button:buttonProps,inputs:inputs,onSubmit:onSubmit});},[]);const snakeToCamel=str=>{return str.split(\"_\").map((word,index)=>{if(index===0){return word;}return word.charAt(0).toUpperCase()+word.slice(1);}).join(\"\");};// Here we can override property controls if we don't want to expose them to the user.\n// We generate the inputs property controls dynamically based on the inputs array.\nconst inputsPropertyControls={};baseInputs.forEach((input,_idx)=>{const inputControlName=snakeToCamel(input.name);inputsPropertyControls[inputControlName]={title:`${input.label}`,type:ControlType.Object,controls:{display:input.extra===true?{title:\"Display\",type:ControlType.Boolean,defaultValue:true}:undefined,label:{title:\"Label\",type:ControlType.String,defaultValue:input.label}}};});const exportBasePropertyControls={...basePropertyControls,inputFields:{title:\"Inputs\",type:ControlType.Object,controls:inputsPropertyControls},link:{title:\"Redirect\",type:ControlType.Link},button:{// Inject default button label\n...basePropertyControls.button,controls:{...basePropertyControls.button.controls,label:undefined,[buttonLabelKey]:{...basePropertyControls.button.controls.label,defaultValue:defaultButtonLabel}}}};// @ts-ignore - TS doesn't like our basePropertyControls type.\naddPropertyControls(ForgotPasswordForm,exportBasePropertyControls);ForgotPasswordForm.defaultProps={...BaseForm.defaultProps,...ForgotPasswordForm.defaultProps};export default ForgotPasswordForm;\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ForgotPasswordForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicWidth\":\"300\",\"framerSupportedLayoutHeight\":\"any\",\"framerDisableUnlink\":\"*\",\"framerIntrinsicHeight\":\"40\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"A,+UAMM,EAAW,CAAC,CAAC,MAAM,QAAQ,KAAK,QAAQ,KAAK,QAAQ,SAAS,GAAK,MAAM,GAAM,YAAY,OAAO,CAAC,EAAQ,EAAO,kBACjH,EAAmB,mBACnB,EAAe,GAAGoB,EAAO,eAYvB,EAAmBT,EAAQ,SAA4B,CAAC,GAAGiB,GAAW,CAAC,GAAK,CAACC,EAAOC,GAAW9B,EAASmB,CAAU,EACpHY,EAAY9B,OAEb,CAAC,GAAG2B,EAAU,OAAO,MAAMA,EAAU,OAAON,EAAe,GAAI,CAACM,EAAU,OAAOA,EAAU,OAAON,EAAe,CAAC,EAAEb,MAAc,CACxI,GAAGmB,EAAU,YAAY,CAAC,IAAMI,EAAU,CAAC,EAAEb,EAAW,SAAS,EAAM,IAAO,CAAC,IAAMc,EAAiBT,EAAaU,EAAM,IAAI,EAAE,GAAG,EAAED,KAAoBL,EAAU,aAAa,CAC/K,QAAQ,IAAI,SAASK,EAAiB,kCAAkC,EAAE,MAAO,CAAC,IAAME,EAAWP,EAAU,YAAYK,GAAwBG,EAAQD,EAAW,QAAcE,EAAMF,EAAW,MAAYG,EAAYD,GAASD,IAAU,IAAMA,IAAU,IAAA,KAAWJ,EAAU,KAAK,CAAC,GAAGE,EAAM,QAAM,aAAW,CAAC,CAAG,CAAC,EAAEJ,EAAUE,CAAS,CAAE,CAAC,EAAE,CAACJ,EAAU,WAAW,CAAC,EAAE,IAAMW,EAAS,KAAM,I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