{"version":3,"file":"HubSpotNewsletterSignup.BR4Gi40F.mjs","names":["React.useState"],"sources":["https:/framerusercontent.com/modules/mHMessQuDRzxuJg7lDhy/VWBRbQydKofYbeR0FH1H/HubSpotNewsletterSignup.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function HubSpotNewsletterSignup(props){const{portalId=\"243987595\",formId=\"12aa457b-b73c-446d-8283-a17297016c48\",placeholder=\"Enter your work email to get our newsletter\",buttonText=\"Subscribe\",successText=\"You’re subscribed — welcome to the newsletter!\",errorText=\"We couldn’t subscribe you. Please try again.\",height=46,buttonWidth=110,radius=4,fontSize=14,textColor=\"#242229\",inputBackground=\"#FFFFFF\",buttonBackground=\"#F2485B\",buttonColor=\"#FFFFFF\",borderColor=\"#D8D6DC\",errorColor=\"#C92E40\",footerStyle=false}=props;const[email,setEmail]=React.useState(\"\");const[status,setStatus]=React.useState(\"idle\");const[message,setMessage]=React.useState(\"\");async function handleSubmit(event){event.preventDefault();if(status===\"loading\")return;const cleanEmail=email.trim();if(!cleanEmail||!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(cleanEmail)){setStatus(\"error\");setMessage(\"Enter a valid work email.\");return;}setStatus(\"loading\");setMessage(\"\");try{const endpoint=\"https://api.hsforms.com/submissions/v3/integration/submit/\"+portalId+\"/\"+formId;const response=await fetch(endpoint,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({fields:[{name:\"email\",value:cleanEmail}],context:{pageUri:typeof window!==\"undefined\"?window.location.href:\"\",pageName:typeof document!==\"undefined\"?document.title:\"Peerbound Newsletter\"}})});if(!response.ok)throw new Error(\"HubSpot rejected the submission.\");setEmail(\"\");setStatus(\"success\");setMessage(successText);}catch{setStatus(\"error\");setMessage(errorText);}}if(status===\"success\"){return /*#__PURE__*/_jsx(\"div\",{\"data-hubspot-newsletter\":\"success\",role:\"status\",style:{width:\"100%\",minHeight:height,display:\"flex\",alignItems:\"center\",fontFamily:\"Roobert, Inter, sans-serif\",fontSize,color:footerStyle?\"#FFFFFF\":textColor},children:message});}return /*#__PURE__*/_jsxs(\"div\",{\"data-hubspot-newsletter\":\"form\",\"data-layout\":footerStyle?\"footer\":\"default\",style:{width:\"100%\",fontFamily:\"Roobert, Inter, sans-serif\",opacity:footerStyle?.8:1},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                @media (max-width: 600px) {\n                    [data-hubspot-newsletter=\"form\"][data-layout=\"default\"] form {\n                        height: 100px !important;\n                        flex-direction: column !important;\n                    }\n\n                    [data-hubspot-newsletter=\"form\"][data-layout=\"default\"] input,\n                    [data-hubspot-newsletter=\"form\"][data-layout=\"default\"] button {\n                        width: 100% !important;\n                        height: 46px !important;\n                        flex: 0 0 46px !important;\n                    }\n                }\n            `}),/*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,style:{width:\"100%\",height:Number(height)||46,display:\"flex\",alignItems:\"stretch\",position:\"relative\",gap:footerStyle?0:8},children:[/*#__PURE__*/_jsx(\"input\",{type:\"email\",name:\"email\",autoComplete:\"email\",inputMode:\"email\",\"aria-label\":\"Work email\",placeholder:placeholder,value:email,onChange:event=>{setEmail(event.target.value);if(status===\"error\"){setStatus(\"idle\");setMessage(\"\");}},style:{minWidth:0,flex:\"1 1 auto\",height:\"100%\",padding:footerStyle?\"0 125px 0 15px\":\"0 16px\",border:footerStyle?\"none\":\"1px solid \"+borderColor,borderRadius:footerStyle?36:radius,outline:\"none\",background:footerStyle?\"transparent\":inputBackground,color:footerStyle?\"#FFFFFF\":textColor,font:\"inherit\",fontSize,boxSizing:\"border-box\",boxShadow:footerStyle?\"inset 0 0 0 1px rgba(200, 200, 200, 0.5)\":\"none\"}}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:status===\"loading\",style:{flex:footerStyle?\"none\":\"0 0 \"+buttonWidth+\"px\",position:footerStyle?\"absolute\":\"static\",top:footerStyle?4:undefined,right:footerStyle?4:undefined,bottom:footerStyle?4:undefined,width:footerStyle?buttonWidth:undefined,height:footerStyle?\"auto\":\"100%\",padding:footerStyle?\"0 15px\":0,border:0,borderRadius:footerStyle?32:radius,background:footerStyle?\"rgba(255, 255, 255, 0.3)\":buttonBackground,color:footerStyle?\"#FFFFFF\":buttonColor,font:\"inherit\",fontSize,fontWeight:footerStyle?500:600,cursor:status===\"loading\"?\"wait\":\"pointer\",opacity:status===\"loading\"?.7:1},children:status===\"loading\"?\"Subscribing…\":buttonText})]}),status===\"error\"&&/*#__PURE__*/_jsx(\"div\",{role:\"alert\",style:{marginTop:6,fontSize:Math.max(11,fontSize-2),color:errorColor},children:message})]});}addPropertyControls(HubSpotNewsletterSignup,{portalId:{type:ControlType.String,title:\"Portal ID\",defaultValue:\"243987595\"},formId:{type:ControlType.String,title:\"Form ID\",defaultValue:\"12aa457b-b73c-446d-8283-a17297016c48\"},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Enter your work email to get our newsletter\"},buttonText:{type:ControlType.String,title:\"Button\",defaultValue:\"Subscribe\"},successText:{type:ControlType.String,title:\"Success\",defaultValue:\"You’re subscribed — welcome to the newsletter!\"},errorText:{type:ControlType.String,title:\"Error\",defaultValue:\"We couldn’t subscribe you. Please try again.\"},footerStyle:{type:ControlType.Boolean,title:\"Footer Style\",defaultValue:false},height:{type:ControlType.Number,title:\"Height\",defaultValue:46,min:36,max:72},buttonWidth:{type:ControlType.Number,title:\"Button Width\",defaultValue:110,min:80,max:180},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:4,min:0,max:24},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:14,min:11,max:22},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#242229\"},inputBackground:{type:ControlType.Color,title:\"Input\",defaultValue:\"#FFFFFF\"},buttonBackground:{type:ControlType.Color,title:\"Button BG\",defaultValue:\"#F2485B\"},buttonColor:{type:ControlType.Color,title:\"Button Text\",defaultValue:\"#FFFFFF\"},borderColor:{type:ControlType.Color,title:\"Border\",defaultValue:\"#D8D6DC\"},errorColor:{type:ControlType.Color,title:\"Error Color\",defaultValue:\"#C92E40\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HubSpotNewsletterSignup\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HubSpotNewsletterSignup.map"],"mappings":"+LAGG,SAAwB,EAAwB,EAAM,CAAC,GAAK,CAAC,WAAS,YAAY,SAAO,uCAAuC,cAAY,8CAA8C,aAAW,YAAY,cAAY,iDAAiD,YAAU,+CAA+C,SAAO,GAAG,cAAY,IAAI,SAAO,EAAE,WAAS,GAAG,YAAU,UAAU,kBAAgB,UAAU,mBAAiB,UAAU,cAAY,UAAU,cAAY,UAAU,aAAW,UAAU,cAAY,IAAO,EAAW,CAAC,EAAM,GAAUA,EAAe,EAAE,EAAO,CAAC,EAAO,GAAWA,EAAe,MAAM,EAAO,CAAC,EAAQ,GAAYA,EAAe,EAAE,EAAE,eAAe,EAAa,EAAM,CAAwB,GAAvB,EAAM,eAAe,EAAK,IAAS,UAAU,OAAO,IAAM,EAAW,EAAM,KAAK,EAAE,GAAG,CAAC,GAAY,CAAC,6BAA6B,KAAK,CAAU,EAAE,CAAC,EAAU,OAAO,EAAE,EAAW,2BAA2B,EAAE,MAAO,CAAC,EAAU,SAAS,EAAE,EAAW,EAAE,EAAE,GAAG,CAAC,IAAM,EAAS,6DAA6D,EAAS,IAAI,EAA2T,GAAG,EAAC,MAAnS,MAAM,EAAS,CAAC,OAAO,OAAO,QAAQ,CAAC,eAAe,kBAAkB,EAAE,KAAK,KAAK,UAAU,CAAC,OAAO,CAAC,CAAC,KAAK,QAAQ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