{"version":3,"file":"ForgotPasswordForm.BtKzdAPI.mjs","names":["ForgotPasswordForm","BaseForm"],"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\"}},\"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