{"version":3,"file":"Email.sTiFsMC1.mjs","names":["p","React.useState"],"sources":["https:/framerusercontent.com/modules/wUhvvVq8LiC1AEGSovoh/rOKj07fphCclwP7m0zf3/Email.js"],"sourcesContent":["// Klaviyo Email Capture (Hardcoded List ID)\n// Framer Code Component – paste into a new code file\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";// ✅ Replace with your actual Klaviyo List ID (Lists & Segments → your list → Settings)\nconst LIST_ID=\"YOUR_LIST_ID_HERE\";function getUTMs(){if(typeof window===\"undefined\")return{};const p=new URLSearchParams(window.location.search);return{utm_source:p.get(\"utm_source\")||\"\",utm_medium:p.get(\"utm_medium\")||\"\",utm_campaign:p.get(\"utm_campaign\")||\"\",utm_content:p.get(\"utm_content\")||\"\",utm_term:p.get(\"utm_term\")||\"\"};}export default function KlaviyoEmailCapture(){const[email,setEmail]=React.useState(\"\");const[loading,setLoading]=React.useState(false);const[error,setError]=React.useState(\"\");const[success,setSuccess]=React.useState(false);async function onSubmit(e){e.preventDefault();setError(\"\");// basic validation\nif(!/^\\S+@\\S+\\.\\S+$/.test(email)){setError(\"Please enter a valid email.\");return;}if(!LIST_ID||LIST_ID===\"YOUR_LIST_ID_HERE\"){setError(\"List not configured.\");return;}setLoading(true);try{const utms=getUTMs();const payload=new URLSearchParams;payload.append(\"g\",LIST_ID)// list id\n;payload.append(\"email\",email);payload.append(\"$source\",\"Framer Email Capture\");if(typeof window!==\"undefined\"){payload.append(\"$page\",window.location.href);}Object.entries(utms).forEach(([k,v])=>v&&payload.append(k,v));const res=await fetch(\"https://manage.kmail-lists.com/ajax/subscriptions/subscribe\",{method:\"POST\",headers:{\"Content-Type\":\"application/x-www-form-urlencoded; charset=UTF-8\"},body:payload.toString()});const data=await res.json();if(data?.success){setSuccess(true);setEmail(\"\");}else{setError(data?.errors?.[0]||\"Something went wrong. Please try again.\");}}catch{setError(\"Network error. Please try again.\");}finally{setLoading(false);}}// Success state\nif(success){return /*#__PURE__*/_jsxs(\"div\",{style:wrapStyle,children:[/*#__PURE__*/_jsx(\"div\",{style:successTitle,children:\"You're in!\"}),/*#__PURE__*/_jsx(\"div\",{style:successText,children:\"Check your inbox to confirm your subscription.\"})]});}// Form state\nreturn /*#__PURE__*/_jsxs(\"form\",{onSubmit:onSubmit,style:wrapStyle,children:[/*#__PURE__*/_jsx(\"label\",{style:labelStyle,children:\"Join Our Newsletter!\"}),/*#__PURE__*/_jsxs(\"div\",{style:rowStyle,children:[/*#__PURE__*/_jsx(\"input\",{type:\"email\",value:email,onChange:e=>setEmail(e.target.value),placeholder:\"Enter your email\",style:inputStyle,autoComplete:\"email\",required:true}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:loading,style:buttonStyle,children:loading?\"Submitting...\":\"Subscribe\"})]}),error&&/*#__PURE__*/_jsx(\"div\",{style:errorStyle,children:error}),/*#__PURE__*/_jsx(\"div\",{style:finePrint,children:\"By subscribing, you agree to receive emails. Unsubscribe anytime.\"})]});}// ————— Inline styles —————\nconst wrapStyle={width:\"100%\",height:\"fit-content\",background:\"#D9D9D9\",borderRadius:12,padding:16,display:\"flex\",flexDirection:\"column\",gap:10,fontFamily:\"Inter, system-ui, sans-serif\",color:\"#111827\"};const rowStyle={display:\"flex\",gap:8,width:\"100%\"};const labelStyle={fontSize:14,fontWeight:600};const inputStyle={flex:1,padding:\"12px 14px\",borderRadius:8,border:\"1px solid #E5E7EB\",outline:\"none\",fontSize:14,background:\"#FFFFFF\"};const buttonStyle={padding:\"12px 16px\",borderRadius:8,border:\"1px solid transparent\",background:\"#111827\",color:\"#FFFFFF\",fontWeight:700,cursor:\"pointer\",whiteSpace:\"nowrap\"};const errorStyle={color:\"#B91C1C\",fontSize:12};const finePrint={fontSize:12,opacity:.75};const successTitle={fontWeight:700,marginBottom:6};const successText={opacity:.9};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"KlaviyoEmailCapture\",\"slots\":[],\"annotations\":{\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