{"version":3,"file":"CaseStudyLeadForm.Bn7E2-AF.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/muzmGqcGAqSlJwFOmuAq/MVtDxQMT6X6IZypOqLFw/CaseStudyLeadForm.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState}from\"react\";/**\n * Gated content lead form (case studies, thesis docs).\n * Submissions are emailed via formsubmit.co to the address in props.\n * On success, if a fileUrl is set the visitor gets an immediate download button.\n * The download is fetched as a blob so it saves with a friendly filename\n * (cross-origin CDN links otherwise ignore the download filename).\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function CaseStudyLeadForm(props){const{email,heading,buttonLabel,successTitle,successBody,subjectLine,pageLabel,fileUrl,downloadLabel,downloadFileName,accentColor,textColor,style}=props;const[name,setName]=useState(\"\");const[workEmail,setWorkEmail]=useState(\"\");const[company,setCompany]=useState(\"\");const[status,setStatus]=useState(\"idle\")// idle | submitting | success | error\n;const inputStyle={width:\"100%\",boxSizing:\"border-box\",padding:\"12px 14px\",borderRadius:8,border:\"1px solid rgba(6, 41, 34, 0.25)\",background:\"#FFFFFF\",color:\"#1C1D20\",fontSize:15,fontFamily:\"Inter, sans-serif\",outline:\"none\"};const labelStyle={fontSize:13,fontWeight:600,color:textColor,fontFamily:\"Inter, sans-serif\",marginBottom:6,display:\"block\"};async function handleSubmit(e){e.preventDefault();if(!name||!workEmail||!company)return;setStatus(\"submitting\");try{const res=await fetch(\"https://formsubmit.co/ajax/\"+encodeURIComponent(email),{method:\"POST\",headers:{\"Content-Type\":\"application/json\",Accept:\"application/json\"},body:JSON.stringify({_subject:subjectLine,Name:name,\"Work email\":workEmail,Company:company,Page:pageLabel})});if(!res.ok)throw new Error(\"Request failed\");setStatus(\"success\");}catch(err){setStatus(\"error\");}}async function handleDownload(e){// Fetch as a blob so the file saves with a friendly name.\n// Falls back to opening the URL directly if the fetch is blocked.\ne.preventDefault();const fname=downloadFileName||\"download.pdf\";try{const r=await fetch(fileUrl);if(!r.ok)throw new Error(\"fetch failed\");const b=await r.blob();const u=URL.createObjectURL(b);const a=document.createElement(\"a\");a.href=u;a.download=fname;document.body.appendChild(a);a.click();a.remove();setTimeout(()=>URL.revokeObjectURL(u),2e3);}catch(err){window.open(fileUrl,\"_blank\");}}if(status===\"success\"){return /*#__PURE__*/_jsxs(\"div\",{style:{...style,background:\"#FFFFFF\",borderRadius:12,padding:32,fontFamily:\"Inter, sans-serif\",display:\"flex\",flexDirection:\"column\",gap:12,justifyContent:\"center\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{fontSize:18,fontWeight:700,color:textColor},children:successTitle}),/*#__PURE__*/_jsx(\"div\",{style:{fontSize:14,lineHeight:1.5,color:\"#1C1D20\"},children:fileUrl?\"Your copy is ready. Download it below. We've also logged your request.\":successBody}),fileUrl&&/*#__PURE__*/_jsx(\"a\",{href:fileUrl,onClick:handleDownload,target:\"_blank\",rel:\"noopener noreferrer\",download:downloadFileName,style:{marginTop:4,padding:\"13px 20px\",borderRadius:8,background:accentColor,color:\"#FFFFFF\",fontSize:15,fontWeight:600,fontFamily:\"Inter, sans-serif\",textAlign:\"center\",textDecoration:\"none\",cursor:\"pointer\"},children:downloadLabel})]});}return /*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,style:{...style,background:\"#FFFFFF\",borderRadius:12,padding:32,fontFamily:\"Inter, sans-serif\",display:\"flex\",flexDirection:\"column\",gap:16,boxSizing:\"border-box\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{fontSize:16,fontWeight:700,color:textColor},children:heading}),/*#__PURE__*/_jsxs(\"div\",{children:[/*#__PURE__*/_jsx(\"label\",{style:labelStyle,children:\"Full name\"}),/*#__PURE__*/_jsx(\"input\",{style:inputStyle,type:\"text\",value:name,onChange:e=>setName(e.target.value),placeholder:\"Jane Smith\",required:true})]}),/*#__PURE__*/_jsxs(\"div\",{children:[/*#__PURE__*/_jsx(\"label\",{style:labelStyle,children:\"Work email\"}),/*#__PURE__*/_jsx(\"input\",{style:inputStyle,type:\"email\",value:workEmail,onChange:e=>setWorkEmail(e.target.value),placeholder:\"jane@yourcompany.com\",required:true})]}),/*#__PURE__*/_jsxs(\"div\",{children:[/*#__PURE__*/_jsx(\"label\",{style:labelStyle,children:\"Company\"}),/*#__PURE__*/_jsx(\"input\",{style:inputStyle,type:\"text\",value:company,onChange:e=>setCompany(e.target.value),placeholder:\"Your software company\",required:true})]}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:status===\"submitting\",style:{marginTop:4,padding:\"14px 20px\",borderRadius:8,border:\"none\",cursor:\"pointer\",background:accentColor,color:\"#FFFFFF\",fontSize:15,fontWeight:600,fontFamily:\"Inter, sans-serif\",opacity:status===\"submitting\"?.7:1},children:status===\"submitting\"?\"Sending...\":buttonLabel}),status===\"error\"&&/*#__PURE__*/_jsx(\"div\",{style:{fontSize:13,color:\"#B3261E\"},children:\"Something went wrong. Please try again, or email us directly.\"})]});}CaseStudyLeadForm.defaultProps={email:\"blake.rouse@valpay.com\",heading:\"Get the case study\",buttonLabel:\"Send me the case study\",successTitle:\"Request received\",successBody:\"Thanks, it's on its way to your inbox.\",subjectLine:\"Gated content request (ValPay website)\",pageLabel:\"Unknown page\",fileUrl:\"https://framerusercontent.com/assets/v98NereBgMEEePp1m8uks4qzV8Q.pdf\",downloadLabel:\"Download the paper\",downloadFileName:\"Why ValPay 2026.pdf\",accentColor:\"#0F705F\",textColor:\"#062922\"};addPropertyControls(CaseStudyLeadForm,{email:{type:ControlType.String,title:\"Notify email\"},heading:{type:ControlType.String,title:\"Form heading\"},buttonLabel:{type:ControlType.String,title:\"Button label\"},successTitle:{type:ControlType.String,title:\"Success title\"},successBody:{type:ControlType.String,title:\"Success body\"},subjectLine:{type:ControlType.String,title:\"Email subject\"},pageLabel:{type:ControlType.String,title:\"Page label\"},fileUrl:{type:ControlType.String,title:\"File URL\"},downloadLabel:{type:ControlType.String,title:\"Download label\"},downloadFileName:{type:ControlType.String,title:\"Download filename\"},accentColor:{type:ControlType.Color,title:\"Button color\"},textColor:{type:ControlType.Color,title:\"Text color\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CaseStudyLeadForm\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CaseStudyLeadForm.map"],"mappings":"+LASG,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,QAAM,UAAQ,cAAY,eAAa,cAAY,cAAY,YAAU,UAAQ,gBAAc,mBAAiB,cAAY,YAAU,SAAO,EAAW,CAAC,EAAK,GAASA,EAAS,EAAE,EAAO,CAAC,EAAU,GAAcA,EAAS,EAAE,EAAO,CAAC,EAAQ,GAAYA,EAAS,EAAE,EAAO,CAAC,EAAO,GAAWA,EAAS,MAAM,EAChW,EAAW,CAAC,MAAM,OAAO,UAAU,aAAa,QAAQ,YAAY,aAAa,EAAE,OAAO,kCAAkC,WAAW,UAAU,MAAM,UAAU,SAAS,GAAG,WAAW,oBAAoB,QAAQ,MAAM,EAAQ,EAAW,CAAC,SAAS,GAAG,WAAW,IAAI,MAAM,EAAU,WAAW,oBAAoB,aAAa,EAAE,QAAQ,OAAO,EAAE,eAAe,EAAa,EAAE,CAAC,KAAE,eAAe,EAAK,GAAC,GAAM,CAAC,GAAW,CAAC,GAAe,GAAU,YAAY,EAAE,GAAG,CAAkR,GAAG,EAAC,MAArQ,MAAM,8BAA8B,mBAAmB,CAAK,EAAE,CAAC,OAAO,OAAO,QAAQ,CAAC,eAAe,mBAAmB,OAAO,kBAAkB,EAAE,KAAK,KAAK,UAAU,CAAC,SAAS,EAAY,KAAK,EAAK,aAAa,EAAU,QAAQ,EAAQ,KAAK,CAAS,CAAC,CAAC,CAAC,EAAA,CAAU,GAA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