{"version":3,"file":"EmailCapture.BO9gdcVR.mjs","names":["useState","useCallback"],"sources":["https:/framerusercontent.com/modules/sA9DAydFwZe9O7ccjeVz/KrcYfSEsH7vCSdpxI1mE/EmailCapture.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useCallback}from\"react\";import{addPropertyControls,ControlType}from\"framer\";const HUBSPOT_PORTAL_ID=\"244134603\";const HUBSPOT_FORM_ID=\"b8ec2ecc-f144-479b-87f5-3af5563e2e23\";/**\n * Submits just the email to a simple HubSpot form (email-only).\n * This creates/updates a contact immediately.\n */async function submitEmailToHubSpot(email,portalId,formId){const endpoints=[`https://forms-na2.hsforms.com/submissions/v3/integration/submit/${portalId}/${formId}`,`https://api.hsforms.com/submissions/v3/integration/submit/${portalId}/${formId}`];const payload=JSON.stringify({fields:[{name:\"email\",value:email}],context:{pageUri:window.location.href,pageName:document.title}});for(const url of endpoints){try{const response=await fetch(url,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:payload});if(response.ok||response.status===200){return true;}}catch(e){// Try next endpoint\n}}return false;}/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function EmailCapture(props){const{placeholder=\"Enter your work email\",buttonLabel=\"Book a Demo\",targetUrl=\"/request-demo\",emailParam=\"email\",hubspotPortalId=HUBSPOT_PORTAL_ID,hubspotFormId=HUBSPOT_FORM_ID,backgroundColor=\"transparent\",inputBackgroundColor=\"rgba(255, 255, 255, 0.06)\",inputTextColor=\"#FCFBFB\",buttonBackgroundColor=\"#121212\",buttonTextColor=\"#FCFBFB\",borderColor=\"rgb(232, 231, 231)\",focusBorderColor=\"rgb(24, 24, 24)\",borderRadius=8,fontSize=15,buttonFontSize=15}=props;const[email,setEmail]=useState(\"\");const[isFocused,setIsFocused]=useState(false);const[isSubmitting,setIsSubmitting]=useState(false);const handleSubmit=useCallback(async()=>{const trimmed=email.trim();if(!trimmed||isSubmitting)return;setIsSubmitting(true);// Submit to HubSpot and wait for it to complete before redirecting\nawait submitEmailToHubSpot(trimmed,hubspotPortalId,hubspotFormId);// Redirect to the demo page with email pre-filled\nconst separator=targetUrl.includes(\"?\")?\"&\":\"?\";const url=`${targetUrl}${separator}${emailParam}=${encodeURIComponent(trimmed)}`;window.location.href=url;},[email,targetUrl,emailParam,hubspotPortalId,hubspotFormId,isSubmitting]);const handleKeyDown=useCallback(e=>{if(e.key===\"Enter\"){e.preventDefault();handleSubmit();}},[handleSubmit]);return /*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"row\",alignItems:\"center\",width:\"100%\",height:\"100%\",backgroundColor:inputBackgroundColor,borderRadius:borderRadius,border:`1px solid ${isFocused?focusBorderColor:borderColor}`,overflow:\"hidden\",transition:\"border-color 0.2s ease\",boxSizing:\"border-box\"},children:[/*#__PURE__*/_jsx(\"input\",{type:\"email\",value:email,onChange:e=>setEmail(e.target.value),onKeyDown:handleKeyDown,onFocus:()=>setIsFocused(true),onBlur:()=>setIsFocused(false),placeholder:placeholder,disabled:isSubmitting,style:{flex:1,height:\"100%\",border:\"none\",outline:\"none\",background:\"transparent\",color:inputTextColor,fontSize:fontSize,fontFamily:\"Inter, system-ui, sans-serif\",padding:\"0 16px\",boxSizing:\"border-box\",opacity:isSubmitting?.6:1}}),/*#__PURE__*/_jsx(\"button\",{onClick:handleSubmit,disabled:isSubmitting,style:{height:\"calc(100% - 8px)\",padding:\"0 20px\",marginRight:4,border:\"none\",borderRadius:Math.max(borderRadius-2,2),backgroundColor:buttonBackgroundColor,color:buttonTextColor,fontSize:buttonFontSize,fontFamily:\"Inter, system-ui, sans-serif\",fontWeight:500,cursor:isSubmitting?\"wait\":\"pointer\",whiteSpace:\"nowrap\",transition:\"opacity 0.15s ease\",flexShrink:0,opacity:isSubmitting?.6:1},onMouseEnter:e=>{if(!isSubmitting)e.currentTarget.style.opacity=\"0.85\";},onMouseLeave:e=>{if(!isSubmitting)e.currentTarget.style.opacity=\"1\";},children:isSubmitting?\"...\":buttonLabel})]});}addPropertyControls(EmailCapture,{placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Enter your work email\"},buttonLabel:{type:ControlType.String,title:\"Button Label\",defaultValue:\"Book a Demo\"},targetUrl:{type:ControlType.String,title:\"Target URL\",defaultValue:\"/request-demo\",description:\"Page to redirect to with email param\"},emailParam:{type:ControlType.String,title:\"Email Param\",defaultValue:\"email\",description:\"URL parameter name for the email\"},hubspotPortalId:{type:ControlType.String,title:\"HubSpot Portal\",defaultValue:HUBSPOT_PORTAL_ID,description:\"HubSpot Portal ID\"},hubspotFormId:{type:ControlType.String,title:\"HubSpot Form\",defaultValue:HUBSPOT_FORM_ID,description:\"HubSpot Form ID for email-only capture\"},inputBackgroundColor:{type:ControlType.Color,title:\"Input BG\",defaultValue:\"rgba(255, 255, 255, 0.06)\"},inputTextColor:{type:ControlType.Color,title:\"Input Text\",defaultValue:\"#FCFBFB\"},buttonBackgroundColor:{type:ControlType.Color,title:\"Button BG\",defaultValue:\"#121212\"},buttonTextColor:{type:ControlType.Color,title:\"Button Text\",defaultValue:\"#FCFBFB\"},borderColor:{type:ControlType.Color,title:\"Border\",defaultValue:\"rgb(232, 231, 231)\"},focusBorderColor:{type:ControlType.Color,title:\"Focus Border\",defaultValue:\"rgb(24, 24, 24)\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:50},fontSize:{type:ControlType.Number,title:\"Input Font\",defaultValue:15,min:10,max:24},buttonFontSize:{type:ControlType.Number,title:\"Button Font\",defaultValue:15,min:10,max:24}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"EmailCapture\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./EmailCapture.map"],"mappings":"uMAGG,eAAe,EAAqB,EAAM,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