{"version":3,"file":"GatePDF.DRyi0AzN.mjs","names":["p","React.useState","React.useRef","u"],"sources":["https:/framerusercontent.com/modules/T4uXl2Pcqgxefuyx3YdZ/VM8gswq6LQ8s2aDV78vg/GatePDF.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";const EMAIL_RE=/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;const defaults={buttonLabel:\"Download the FAQs PDF\",accentColor:\"#7C83F7\",inputShadow:true,borderRadius:12,gap:12,placeholderName:\"Your Name and Surname\",placeholderEmail:\"you@company.com\",placeholderCompany:\"Company\",placeholderRole:\"Role\",documentName:\"FAQs PDF\",sheetsWebAppUrl:\"\"};export default function GatedDownloadMinimal(p){const props={...defaults,...p};const FONT_STACK=\"Inter, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif\";const[submitting,setSubmitting]=React.useState(false);const[focusId,setFocusId]=React.useState(null);const[emailErr,setEmailErr]=React.useState(\"\");const[statusMsg,setStatusMsg]=React.useState(null);const refName=React.useRef(null);const refEmail=React.useRef(null);const refCompany=React.useRef(null);const refRole=React.useRef(null);// layout\nconst wrap={width:\"100%\",height:\"100%\",display:\"grid\",gridTemplateColumns:\"1fr 1fr\",gridAutoRows:\"min-content\",gap:props.gap,alignContent:\"center\",justifyItems:\"stretch\",boxSizing:\"border-box\",fontFamily:FONT_STACK,fontWeight:400};// inputs: #999 border, #757 text/placeholder\nconst inputBase={width:\"100%\",height:44,padding:\"0 14px\",borderRadius:props.borderRadius,border:\"1px solid #999999\",background:\"#ffffff\",color:\"#757575\",fontSize:14,outline:\"none\",fontWeight:400,boxShadow:props.inputShadow?\"0 2px 8px rgba(0,0,0,0.06)\":\"none\"};const inputFocus={boxShadow:`${props.inputShadow?\"0 2px 8px rgba(0,0,0,0.06),\":\"\"} 0 0 0 3px rgba(124,131,247,0.35)`,borderColor:\"rgba(124,131,247,0.7)\"};const inputError={borderColor:\"#e11d48\",background:\"#fff1f2\"};const button={gridColumn:\"1 / span 2\",height:48,borderRadius:props.borderRadius,border:\"none\",background:props.accentColor,color:\"#fff\",fontSize:15,cursor:\"pointer\",boxShadow:\"0 2px 12px rgba(124,131,247,0.35)\",opacity:submitting?.85:1,fontWeight:400,fontFamily:FONT_STACK};const messageLine={gridColumn:\"1 / span 2\",fontSize:13,marginTop:6,fontFamily:FONT_STACK,fontWeight:400};function triggerDownload(url){const a=document.createElement(\"a\");a.href=url;a.setAttribute(\"download\",\"\");a.rel=\"noopener\";a.target=\"_blank\";document.body.appendChild(a);a.click();a.remove();}async function sendToSheets(payload){if(!props.sheetsWebAppUrl)return;try{const u=new URL(props.sheetsWebAppUrl);Object.entries(payload).forEach(([k,v])=>{u.searchParams.append(k,String(v??\"\"));});// Fire-and-forget GET without CORS issues:\n// Prefer an <img> beacon (works even if the page navigates immediately)\nconst img=new Image;img.src=u.toString();// Optional fallback if Image isn't available (shouldn't happen in browsers)\n// fetch(u.toString(), { method: \"GET\", mode: \"no-cors\" as RequestMode });\n}catch{// ignore errors; never block the download\n}}function validateEmail(){const val=refEmail.current?.value?.trim()??\"\";if(!val){setEmailErr(\"Email is required.\");return false;}if(!EMAIL_RE.test(val)){setEmailErr(\"Enter a valid email.\");return false;}setEmailErr(\"\");return true;}async function onSubmit(e){e.preventDefault();setStatusMsg(null);if(!validateEmail()){setStatusMsg({type:\"error\",text:\"Email is required.\"});refEmail.current?.focus();return;}if(!props.fileUrl||submitting)return;setSubmitting(true);const payload={ts:new Date().toISOString(),page:typeof window!==\"undefined\"?window.location.href:\"\",userAgent:typeof navigator!==\"undefined\"?navigator.userAgent:\"\",documentName:props.documentName||\"\",documentUrl:props.fileUrl||\"\",name:refName.current?.value??\"\",email:refEmail.current?.value??\"\",company:refCompany.current?.value??\"\",role:refRole.current?.value??\"\"};await sendToSheets(payload);triggerDownload(props.fileUrl);setSubmitting(false);setStatusMsg({type:\"success\",text:\"Thanks! Your download will begin shortly.\"});}return /*#__PURE__*/_jsxs(\"form\",{style:wrap,onSubmit:onSubmit,noValidate:true,children:[/*#__PURE__*/_jsx(\"style\",{children:`\n        .gd-input::placeholder { color: #757575; opacity: 1; }\n        .gd-input:-ms-input-placeholder { color: #757575; }\n        .gd-input::-ms-input-placeholder { color: #757575; }\n      `}),/*#__PURE__*/_jsx(\"input\",{ref:refName,className:\"gd-input\",name:\"name\",type:\"text\",placeholder:props.placeholderName,onFocus:()=>setFocusId(\"name\"),onBlur:()=>setFocusId(null),style:{...inputBase,...focusId===\"name\"?inputFocus:{}},autoComplete:\"name\"}),/*#__PURE__*/_jsx(\"input\",{ref:refEmail,className:\"gd-input\",name:\"email\",type:\"email\",placeholder:props.placeholderEmail,onFocus:()=>setFocusId(\"email\"),onBlur:()=>{setFocusId(null);if(refEmail.current?.value)validateEmail();},style:{...inputBase,...focusId===\"email\"?inputFocus:{},...emailErr?inputError:{}},autoComplete:\"email\",\"aria-invalid\":Boolean(emailErr)}),/*#__PURE__*/_jsx(\"input\",{ref:refCompany,className:\"gd-input\",name:\"company\",type:\"text\",placeholder:props.placeholderCompany,onFocus:()=>setFocusId(\"company\"),onBlur:()=>setFocusId(null),style:{...inputBase,...focusId===\"company\"?inputFocus:{}},autoComplete:\"organization\"}),/*#__PURE__*/_jsx(\"input\",{ref:refRole,className:\"gd-input\",name:\"role\",type:\"text\",placeholder:props.placeholderRole,onFocus:()=>setFocusId(\"role\"),onBlur:()=>setFocusId(null),style:{...inputBase,...focusId===\"role\"?inputFocus:{}},autoComplete:\"organization-title\"}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",style:button,disabled:submitting,children:submitting?\"Processing…\":props.buttonLabel}),statusMsg&&/*#__PURE__*/_jsx(\"div\",{style:{...messageLine,color:statusMsg.type===\"error\"?\"#e11d48\":\"#4b5563\"},role:\"status\",children:statusMsg.text})]});}addPropertyControls(GatedDownloadMinimal,{fileUrl:{type:ControlType.File,title:\"File\",allowedFileTypes:[\"pdf\",\"doc\",\"docx\",\"ppt\",\"pptx\",\"zip\",\"csv\",\"xlsx\",\"txt\"]},documentName:{type:ControlType.String,title:\"Document name\",defaultValue:defaults.documentName},buttonLabel:{type:ControlType.String,title:\"Button\",defaultValue:defaults.buttonLabel},accentColor:{type:ControlType.Color,title:\"Button Color\",defaultValue:defaults.accentColor},inputShadow:{type:ControlType.Boolean,title:\"Input Shadow\",defaultValue:defaults.inputShadow},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:defaults.borderRadius,min:4,max:24,unit:\"px\"},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:defaults.gap,min:4,max:24,unit:\"px\"},placeholderName:{type:ControlType.String,title:\"Name\",defaultValue:defaults.placeholderName},placeholderEmail:{type:ControlType.String,title:\"Email\",defaultValue:defaults.placeholderEmail},placeholderCompany:{type:ControlType.String,title:\"Company\",defaultValue:defaults.placeholderCompany},placeholderRole:{type:ControlType.String,title:\"Role\",defaultValue:defaults.placeholderRole},sheetsWebAppUrl:{type:ControlType.String,title:\"Sheets Web App URL\",defaultValue:defaults.sheetsWebAppUrl}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"GatedDownloadMinimal\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GatePDF.map"],"mappings":"6MAAkd,SAAwB,EAAqB,EAAE,CAAC,IAAM,EAAM,CAAC,GAAG,EAAS,GAAGA,EAAE,CAAO,EAAW,2FAAgG,CAAC,EAAW,GAAeC,EAAe,GAAM,CAAM,CAAC,EAAQ,GAAYA,EAAe,KAAK,CAAM,CAAC,EAAS,GAAaA,EAAe,GAAG,CAAM,CAAC,EAAU,GAAcA,EAAe,KAAK,CAAO,EAAQC,EAAa,KAAK,CAAO,EAASA,EAAa,KAAK,CAAO,EAAWA,EAAa,KAAK,CAAO,EAAQA,EAAa,KAAK,CACr9B,EAAK,C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