{"version":3,"file":"GuideGateEmailForm.CVAB3hSf.mjs","names":["useState","useCallback"],"sources":["https:/framerusercontent.com/modules/1al1UvZ2Dmm070j7uuRu/URyOaKKvgPFRZQQzf1zT/GuideGateEmailForm.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useCallback}from\"react\";import{addPropertyControls,ControlType}from\"framer\";function readCookie(name){if(typeof document===\"undefined\")return\"\";const match=document.cookie.match(new RegExp(\"(^| )\"+name+\"=([^;]+)\"));return match?match[2]:\"\";}/**\n * Guide Gate Email Form\n *\n * Email-only capture that posts to HubSpot Forms v3, then sends the\n * visitor on to the gated page.\n *\n * @framerIntrinsicWidth 420\n * @framerIntrinsicHeight 52\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function GuideGateEmailForm(props){const{portalId=\"3063515\",formId=\"\",redirectUrl=\"/guide-document-automation\",placeholder=\"Work email\",buttonLabel=\"Get the guide\",sendingLabel=\"Opening…\",errorMessage=\"That didn’t go through. Please check your email and try again.\",accentColor=\"rgb(254, 162, 147)\",accentHoverColor=\"#FF8F79\",accentTextColor=\"rgb(0, 10, 48)\",inputBackground=\"rgba(255,255,255,0.08)\",inputBorderColor=\"rgba(255,255,255,0.2)\",inputTextColor=\"rgb(244, 244, 241)\",placeholderColor=\"rgb(150, 156, 178)\",style}=props;const[email,setEmail]=useState(\"\");const[state,setState]=useState(\"idle\");const[hovered,setHovered]=useState(false);const submit=useCallback(async event=>{event.preventDefault();if(state===\"sending\")return;if(!email||!email.includes(\"@\")){setState(\"error\");return;}setState(\"sending\");try{const context={};const hutk=readCookie(\"hubspotutk\");if(hutk)context.hutk=hutk;if(typeof window!==\"undefined\"){context.pageUri=window.location.href;context.pageName=typeof document!==\"undefined\"?document.title:\"\";}const response=await fetch(`https://api.hsforms.com/submissions/v3/integration/submit/${portalId}/${formId}`,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({fields:[{objectTypeId:\"0-1\",name:\"email\",value:email}],context})});if(!response.ok)throw new Error(String(response.status));if(typeof window!==\"undefined\"){// Lets the on-page ContentGatePopup know this visitor is already in.\ntry{window.localStorage.setItem(\"avvoka-content-unlocked\",JSON.stringify({email,at:Date.now()}));}catch(e){// Storage unavailable: the popup may ask once more.\n}window.location.href=redirectUrl;}}catch(error){setState(\"error\");}},[email,state,portalId,formId,redirectUrl]);return /*#__PURE__*/_jsxs(\"form\",{onSubmit:submit,style:{...style,position:\"relative\",width:\"100%\",display:\"flex\",flexDirection:\"column\",gap:8},children:[/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexWrap:\"wrap\",gap:8,width:\"100%\"},children:[/*#__PURE__*/_jsxs(\"label\",{style:{flex:\"1 1 200px\",display:\"block\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{position:\"absolute\",width:1,height:1,overflow:\"hidden\",clip:\"rect(0 0 0 0)\",whiteSpace:\"nowrap\"},children:\"Work email\"}),/*#__PURE__*/_jsx(\"input\",{className:\"avvoka-gate-input\",type:\"email\",name:\"email\",autoComplete:\"email\",required:true,value:email,placeholder:placeholder,onChange:e=>{setEmail(e.target.value);if(state===\"error\")setState(\"idle\");},style:{width:\"100%\",boxSizing:\"border-box\",padding:\"14px 16px\",borderRadius:8,border:`1px solid ${inputBorderColor}`,background:inputBackground,color:inputTextColor,fontFamily:\"Figtree, sans-serif\",fontSize:15,lineHeight:\"1.2em\",outline:\"none\"}})]}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:state===\"sending\",onMouseEnter:()=>setHovered(true),onMouseLeave:()=>setHovered(false),style:{flex:\"0 0 auto\",padding:\"14px 22px\",borderRadius:8,border:\"none\",background:hovered?accentHoverColor:accentColor,color:accentTextColor,fontFamily:\"Figtree, sans-serif\",fontWeight:600,fontSize:14,lineHeight:\"1.2em\",cursor:\"pointer\",whiteSpace:\"nowrap\",transition:\"background 0.25s ease\",opacity:state===\"sending\"?.6:1},children:state===\"sending\"?sendingLabel:buttonLabel})]}),state===\"error\"&&/*#__PURE__*/_jsx(\"p\",{role:\"alert\",style:{margin:0,color:\"#FF9A9A\",fontFamily:\"Figtree, sans-serif\",fontSize:13,lineHeight:\"1.35em\"},children:errorMessage}),/*#__PURE__*/_jsx(\"style\",{children:`.avvoka-gate-input::placeholder { color: ${placeholderColor}; }`})]});}addPropertyControls(GuideGateEmailForm,{portalId:{type:ControlType.String,title:\"Portal ID\",defaultValue:\"3063515\"},formId:{type:ControlType.String,title:\"Form ID\",defaultValue:\"\"},redirectUrl:{type:ControlType.Link,title:\"Redirect To\",defaultValue:\"/guide-document-automation\"},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Work email\"},buttonLabel:{type:ControlType.String,title:\"Button\",defaultValue:\"Get the guide\"},sendingLabel:{type:ControlType.String,title:\"Sending\",defaultValue:\"Opening…\"},errorMessage:{type:ControlType.String,title:\"Error\",displayTextArea:true,defaultValue:\"That didn’t go through. Please check your email and try again.\"},accentColor:{type:ControlType.Color,title:\"Button BG\",defaultValue:\"rgb(254, 162, 147)\"},accentHoverColor:{type:ControlType.Color,title:\"Button Hover\",defaultValue:\"#FF8F79\"},accentTextColor:{type:ControlType.Color,title:\"Button Text\",defaultValue:\"rgb(0, 10, 48)\"},inputBackground:{type:ControlType.Color,title:\"Input BG\",defaultValue:\"rgba(255,255,255,0.08)\"},inputBorderColor:{type:ControlType.Color,title:\"Input Border\",defaultValue:\"rgba(255,255,255,0.2)\"},inputTextColor:{type:ControlType.Color,title:\"Input Text\",defaultValue:\"rgb(244, 244, 241)\"},placeholderColor:{type:ControlType.Color,title:\"Placeholder\",defaultValue:\"rgb(150, 156, 178)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"GuideGateEmailForm\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"52\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerInt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