{"version":3,"file":"EmailSignup_1.CFcIVeoP.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/ndKzLE63rbjafMD74ezJ/WMibIUYmjs0wahHEJf4y/EmailSignup_1.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect,useRef}from\"react\";export function EmailSignup({placeholderText,buttonText}){const[email,setEmail]=useState(\"\");const[error,setError]=useState(\"\");const[placeholder,setPlaceholder]=useState(\"\");const[shake,setShake]=useState(false);const[isClicked,setIsClicked]=useState(false);const[isFocused,setIsFocused]=useState(false);const[isMobile,setIsMobile]=useState(false);const inputRef=useRef(null);const fullText=placeholderText||\"Enter your work email\";// :white_check_mark: Safe window access\nuseEffect(()=>{const handleResize=()=>{if(typeof window!==\"undefined\"){setIsMobile(window.innerWidth<=600);}};handleResize();window.addEventListener(\"resize\",handleResize);return()=>window.removeEventListener(\"resize\",handleResize);},[]);// :white_check_mark: Safe style injection\nuseEffect(()=>{if(typeof document===\"undefined\")return;if(!document.getElementById(\"shake-style\")){const shakeStyle=document.createElement(\"style\");shakeStyle.id=\"shake-style\";shakeStyle.innerHTML=`\n                @keyframes shake {\n                    0% { transform: translateX(0); }\n                    25% { transform: translateX(-5px); }\n                    50% { transform: translateX(5px); }\n                    75% { transform: translateX(-5px); }\n                    100% { transform: translateX(0); }\n                }\n            `;document.head.appendChild(shakeStyle);}if(!document.getElementById(\"placeholder-style\")){const placeholderStyle=document.createElement(\"style\");placeholderStyle.id=\"placeholder-style\";placeholderStyle.innerHTML=`\n                input::placeholder {\n                    color: #52525B;\n                    font-family: Inter;\n                    font-size: 14px;\n                    font-style: normal;\n                    font-weight: 500;\n                    line-height: 20px;\n                }\n            `;document.head.appendChild(placeholderStyle);}},[]);// Typing animation for placeholder\nuseEffect(()=>{let index=0;const interval=setInterval(()=>{setPlaceholder(fullText.slice(0,index+1));index++;if(index===fullText.length)clearInterval(interval);},80);return()=>clearInterval(interval);},[fullText]);const workEmailRegex=/^[a-zA-Z0-9._%+-]+@(?!gmail\\.com|yahoo\\.com|outlook\\.com|hotmail\\.com|aol\\.com|icloud\\.com)([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}$/;const triggerShake=()=>{setShake(true);setTimeout(()=>setShake(false),500);inputRef.current?.focus();setIsClicked(false);};const handleAction=url=>{setIsClicked(true);setError(\"\");if(!email){triggerShake();return;}if(!workEmailRegex.test(email)){inputRef.current?.focus();setError(\"Enter work email only\");setIsClicked(false);return;}if(typeof window!==\"undefined\"){window.location.href=url;}};// Handle Enter key\nuseEffect(()=>{const inputEl=inputRef.current;if(!inputEl)return;const handleKeyDown=e=>{if(e.key===\"Enter\"){handleAction(`/demo?email=${encodeURIComponent(email)}`);}};inputEl.addEventListener(\"keydown\",handleKeyDown);return()=>inputEl.removeEventListener(\"keydown\",handleKeyDown);},[email]);const styles=getResponsiveStyles(shake,Boolean(error),isClicked,isFocused,isMobile);return /*#__PURE__*/_jsx(\"div\",{style:styles.wrapper,children:/*#__PURE__*/_jsxs(\"div\",{style:styles.mainContainer,children:[/*#__PURE__*/_jsxs(\"div\",{style:styles.container,children:[/*#__PURE__*/_jsx(\"div\",{style:styles.inputWrapper,children:/*#__PURE__*/_jsx(\"input\",{type:\"email\",ref:inputRef,value:email,placeholder:placeholder,onChange:e=>setEmail(e.target.value),onBlur:()=>setIsFocused(false),onFocus:()=>setIsFocused(true),style:styles.input})}),/*#__PURE__*/_jsx(\"button\",{style:styles.button,onClick:()=>handleAction(`/demo?email=${encodeURIComponent(email)}`),children:buttonText||\"Get API Keys\"})]}),error&&/*#__PURE__*/_jsxs(\"div\",{style:styles.errorRow,children:[/*#__PURE__*/_jsx(\"div\",{style:styles.errorIconContainer,children:/*#__PURE__*/_jsx(\"span\",{style:styles.iconSpan,children:\"!\"})}),/*#__PURE__*/_jsx(\"div\",{style:styles.errorText,children:error})]})]})});}function getResponsiveStyles(shake,error,isClicked,isFocused,isMobile){return{wrapper:{display:\"flex\",flexDirection:\"column\",justifyContent:\"center\",alignItems:\"center\",width:\"100%\",padding:\"clamp(12px, 4vw, 32px)\"},mainContainer:{display:\"flex\",flexDirection:\"column\",gap:\"10px\",width:isMobile?\"100%\":\"402px\"},container:{display:\"flex\",flexDirection:isMobile?\"column\":\"row\",gap:\"8px\",padding:\"8px\",border:\"1px solid #FFFFFF\",borderRadius:\"8px\",boxShadow:\"0px 0px 0px 1px rgba(0,0,0,0.08), 0px 1px 2px -1px rgba(0,0,0,0.08), 0px 2px 4px rgba(0,0,0,0.04)\",boxSizing:\"border-box\",background:\"#F4F4F5\"},inputWrapper:{display:\"flex\",flexDirection:\"column\",gap:\"8px\",animation:shake?\"shake 0.3s ease-in-out\":\"none\"},input:{width:isMobile?\"100%\":\"288px\",padding:\"8px\",fontSize:\"14px\",borderRadius:\"4px\",border:error?\"1px solid red\":isFocused?\"1px solid black\":\"1px solid #DEDEDF\",outline:\"none\",fontFamily:\"Inter\",boxSizing:\"border-box\",color:\"#27272A\",fontWeight:500,lineHeight:\"20px\"},button:{display:\"flex\",justifyContent:\"center\",alignItems:\"center\",height:isMobile?\"40px\":undefined,gap:\"4px\",alignSelf:\"stretch\",width:isMobile?\"100%\":\"90px\",padding:\"4px 8px\",color:\"white\",background:isClicked?\"linear-gradient(to right, #2759CD, #113997)\":\"#27272A\",border:\"none\",borderRadius:\"6px\",boxShadow:\"inset 0px 0.75px rgba(255,255,255,0.20), 0px 1px 2px rgba(0,0,0,0.40), 0px 0px 0px 1px #18181B\",cursor:\"pointer\",transition:\"background 0.2s ease-in-out\",fontFamily:\"Inter\"},errorRow:{display:\"flex\",alignItems:\"start\",gap:\"5px\"},errorIconContainer:{display:\"flex\",justifyContent:\"center\",alignItems:\"center\",height:\"15px\",width:\"15px\",background:\"red\",borderRadius:\"50%\"},iconSpan:{color:\"white\",fontSize:\"10px\",fontWeight:\"bold\"},errorText:{fontSize:\"clamp(10px, 1.2vw, 12px)\",color:\"red\",textAlign:\"left\"}};}addPropertyControls(EmailSignup,{placeholderText:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Enter your work email\"},buttonText:{type:ControlType.String,title:\"Button Text\",defaultValue:\"Get API Keys\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"EmailSignup\":{\"type\":\"reactComponent\",\"name\":\"EmailSignup\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./EmailSignup_1.map"],"mappings":"iUAA0J,SAAgB,EAAY,CAAC,kBAAgB,cAAY,CAAC,GAAK,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAY,GAAgBA,EAAS,GAAG,CAAM,CAAC,EAAM,GAAUA,EAAS,GAAM,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAM,CAAC,EAAS,GAAaA,EAAS,GAAM,CAAO,EAASC,EAAO,KAAK,CAAO,EAAS,GAAiB,wBACnjB,MAAc,CAAC,IAAM,MAAiB,CAAW,IAAS,QAAa,EAAY,EAAO,YAAY,IAAI,EAAkE,OAA9D,GAAc,CAAC,EAAO,iBAAiB,SAAS,EAAa,KAAW,EAAO,oBAAoB,SAAS,EAAa,EAAG,EAAE,CAAC,CAC7O,MAAc,CAAI,YAAO,SAAW,KAAmB,IAAG,CAAC,SAAS,eAAe,cAAc,CAAC,CAAC,IAAM,EAAW,SAAS,cAAc,QAAQ,CAAC,EAAW,GAAG,cAAc,EAAW,UAAU;;;;;;;;cAQvL,SAAS,KAAK,YAAY,EAAW,CAAE,GAAG,CAAC,SAAS,eAAe,oBAAoB,CAAC,CAAC,IAAM,EAAiB,SAAS,cAAc,QAAQ,CAAC,EAAiB,GAAG,oBAAoB,EAAiB,UAAU;;;;;;;;;cASnN,SAAS,KAAK,YAAY,EAAiB,IAAI,EAAE,CAAC,CACh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