{"version":3,"file":"EmailCaptureForm.PCADbAsu.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/1in8I30LHvlBadZiMmO7/Ol9V0ZwMMbhFnvYUr2Wp/EmailCaptureForm.js"],"sourcesContent":["// Email capture form for HubSpot with redirect on success\n// Input and button are side by side on desktop, stacked on mobile\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * HubSpot Email Form\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function EmailCaptureForm(props){const{portalId,formId,redirectUrl,placeholder,buttonLabel,inputBackground,inputTextColor,buttonBackground,buttonTextColor,inputFont,buttonFont,inputBorderColor,inputBorderRadius,inputPadding,buttonBorderRadius,buttonPadding,style,variant=\"auto\"}=props;const[email,setEmail]=useState(\"\");const[submitting,setSubmitting]=useState(false);const[error,setError]=useState(\"\");async function handleSubmit(e){e.preventDefault();setError(\"\");startTransition(()=>setSubmitting(true));try{const res=await fetch(`https://api.hsforms.com/submissions/v3/integration/submit/${portalId}/${formId}`,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({fields:[{name:\"email\",value:email}]})});if(res.ok){if(typeof window!==\"undefined\"){window.location.href=redirectUrl;}}else{setError(\"Submission failed. Please try again.\");}}catch{setError(\"Submission failed. Please try again.\");}finally{startTransition(()=>setSubmitting(false));}}// Determine flexDirection based on variant and window width\nlet flexDirection=\"row\";let gap=12;let alignItems=\"center\";if(variant===\"mobile\"){flexDirection=\"column\";gap=10;alignItems=\"stretch\";}else if(variant===\"auto\"){if(typeof window!==\"undefined\"&&window.innerWidth<=500){flexDirection=\"column\";gap=10;alignItems=\"stretch\";}}return /*#__PURE__*/_jsxs(\"form\",{className:\"framer-email-capture-form\",onSubmit:handleSubmit,style:{display:\"flex\",flexDirection:flexDirection,gap,width:\"100%\",alignItems,...style},\"aria-label\":\"Email signup form\",autoComplete:\"off\",children:[variant===\"auto\"&&/*#__PURE__*/_jsx(\"style\",{children:`\n                    @media (max-width: 500px) {\n                        .framer-email-capture-form {\n                            flex-direction: column !important;\n                            gap: 10px !important;\n                            align-items: stretch !important;\n                        }\n                    }\n                `}),/*#__PURE__*/_jsx(\"input\",{type:\"email\",name:\"email\",value:email,onChange:e=>setEmail(e.target.value),placeholder:placeholder,style:{...inputFont,border:`1px solid ${inputBorderColor}`,borderRadius:inputBorderRadius,padding:inputPadding,background:inputBackground,color:inputTextColor,outline:\"none\",flex:1,minWidth:0,boxSizing:\"border-box\"},required:true,\"aria-label\":\"Email\",autoComplete:\"email\"}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",style:{...buttonFont,background:buttonBackground,color:buttonTextColor,border:\"none\",borderRadius:buttonBorderRadius,padding:buttonPadding,cursor:submitting?\"not-allowed\":\"pointer\",whiteSpace:\"nowrap\",boxSizing:\"border-box\",opacity:submitting?.7:1},disabled:submitting,\"aria-label\":buttonLabel,children:submitting?\"Submitting...\":buttonLabel}),error&&/*#__PURE__*/_jsx(\"span\",{style:{color:\"#D32F2F\",marginLeft:8,fontSize:13},children:error})]});}addPropertyControls(EmailCaptureForm,{portalId:{type:ControlType.String,title:\"Portal ID\",defaultValue:\"24249649\"},formId:{type:ControlType.String,title:\"Form ID\",defaultValue:\"be2c90e5-913e-4c43-89d3-013f68a54c2f\"},redirectUrl:{type:ControlType.String,title:\"Redirect URL\",defaultValue:\"https://framer.com/\"},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Enter your email\"},buttonLabel:{type:ControlType.String,title:\"Button Label\",defaultValue:\"Subscribe\"},inputBackground:{type:ControlType.Color,title:\"Input BG\",defaultValue:\"#fff\"},inputTextColor:{type:ControlType.Color,title:\"Input Text\",defaultValue:\"#222\"},buttonBackground:{type:ControlType.Color,title:\"Button BG\",defaultValue:\"#111\"},buttonTextColor:{type:ControlType.Color,title:\"Button Text\",defaultValue:\"#fff\"},inputFont:{type:ControlType.Font,title:\"Input Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{variant:\"Medium\",fontSize:\"15px\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"}},buttonFont:{type:ControlType.Font,title:\"Button Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{variant:\"Semibold\",fontSize:\"14px\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}},inputBorderColor:{type:ControlType.Color,title:\"Input Border\",defaultValue:\"#CCCCCC\"},inputBorderRadius:{type:ControlType.Number,title:\"Input Radius\",defaultValue:8,min:0,max:32},inputPadding:{type:ControlType.String,title:\"Input Padding\",defaultValue:\"12px 16px\"},buttonBorderRadius:{type:ControlType.Number,title:\"Button Radius\",defaultValue:8,min:0,max:32},buttonPadding:{type:ControlType.String,title:\"Button Padding\",defaultValue:\"12px 24px\"},variant:{type:ControlType.Enum,title:\"Variant\",options:[\"auto\",\"desktop\",\"mobile\"],optionTitles:[\"Auto (Responsive)\",\"Desktop (Horizontal)\",\"Mobile (Vertical)\"],defaultValue:\"auto\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"EmailCaptureForm\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./EmailCaptureForm.map"],"mappings":"wTAOG,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,WAAS,SAAO,cAAY,cAAY,cAAY,kBAAgB,iBAAe,mBAAiB,kBAAgB,YAAU,aAAW,mBAAiB,oBAAkB,eAAa,qBAAmB,gBAAc,QAAM,UAAQ,OAAO,CAAC,EAAW,CAAC,EAAM,EAAS,CAACA,EAAS,IAAS,CAAC,EAAW,EAAc,CAACA,EAAS,IAAY,CAAC,EAAM,EAAS,CAACA,EAAS,IAAI,eAAe,EAAa,EAAE,C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