{"version":3,"file":"SendEmailForm.B3aSlGrB.mjs","names":["useState","useCallback","_Fragment"],"sources":["https:/framerusercontent.com/modules/vkJeNzgSjCkIX5Ctt57S/kYCqDhp0Zb52iMaO3bNP/SendEmailForm.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState,useCallback}from\"react\";import{addPropertyControls,ControlType}from\"framer\";// ============================================================\n// Icons\n// ============================================================\nfunction SpinnerIcon({color,size}){return /*#__PURE__*/_jsx(\"svg\",{width:size,height:size,viewBox:\"0 0 24 24\",fill:\"none\",style:{animation:\"emailSendLinkSpin 0.8s linear infinite\"},children:/*#__PURE__*/_jsx(\"circle\",{cx:\"12\",cy:\"12\",r:\"10\",stroke:color,strokeWidth:\"3\",strokeLinecap:\"round\",strokeDasharray:\"50 20\",fill:\"none\"})});}function CheckIcon({color,size}){return /*#__PURE__*/_jsx(\"svg\",{width:size,height:size,viewBox:\"0 0 24 24\",fill:\"none\",stroke:color,strokeWidth:\"2.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:/*#__PURE__*/_jsx(\"polyline\",{points:\"20 6 9 17 4 12\"})});}// ============================================================\n// Helpers\n// ============================================================\nfunction getAnonymousId(){try{if(typeof window!==\"undefined\"&&window.rudderanalytics&&typeof window.rudderanalytics.getAnonymousId===\"function\"){return window.rudderanalytics.getAnonymousId();}}catch{// Silent fail\n}return null;}function fireEvent(eventName,properties){try{if(typeof window!==\"undefined\"&&window.rudderanalytics&&typeof window.rudderanalytics.track===\"function\"){if(properties){window.rudderanalytics.track(eventName,properties);}else{window.rudderanalytics.track(eventName);}}}catch{// Silent fail\n}}export default function EmailSendLink(props){const[email,setEmail]=useState(\"\");const[formState,setFormState]=useState(\"idle\");const[buttonHover,setButtonHover]=useState(false);// Resolve Framer font picker\nlet fontFamily=\"system-ui, -apple-system, BlinkMacSystemFont, sans-serif\";if(props.fontFamily){if(typeof props.fontFamily===\"string\"){fontFamily=props.fontFamily;}else if(typeof props.fontFamily===\"object\"){fontFamily=props.fontFamily.family||props.fontFamily.name||props.fontFamily.fontFamily||fontFamily;}}// Props with defaults\nconst webhookUrl=props.webhookUrl||\"https://hooks.zapier.com/hooks/catch/22512893/upjyidi/\";const placeholder=props.placeholder||\"Enter your email\";const buttonText=props.buttonText||\"Send link\";const processingText=props.processingText||\"\";const successResetDelay=props.successResetDelay??3e3;const buttonBackground=props.buttonBackground||\"#FFFFFF\";const buttonTextColor=props.buttonTextColor||\"#000000\";const buttonFontSize=props.buttonFontSize??16;const buttonFontWeight=props.buttonFontWeight??600;const buttonBorderRadius=props.buttonBorderRadius??100;const buttonPaddingH=props.buttonPaddingH??24;const buttonPaddingV=props.buttonPaddingV??14;const barBackground=props.barBackground||\"rgba(0, 0, 0, 0.45)\";const barBorderRadius=props.barBorderRadius??100;const barPadding=props.barPadding??6;const inputTextColor=props.inputTextColor||\"#FFFFFF\";const inputPlaceholderColor=props.inputPlaceholderColor||\"rgba(255, 255, 255, 0.45)\";const inputFontSize=props.inputFontSize??16;const errorColor=props.errorColor||\"#EF4444\";const submitEventName=props.submitEventName||\"send download form submission started\";const successEventName=props.successEventName||\"send download form submission result\";const errorEventName=props.errorEventName||\"send download form submission error\";// Simple email validation\nconst isValidEmail=value=>/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value.trim());const handleSubmit=useCallback(async()=>{if(formState===\"processing\"||formState===\"success\")return;const trimmed=email.trim();if(!trimmed||!isValidEmail(trimmed)){setFormState(\"error\");setTimeout(()=>setFormState(\"idle\"),2e3);return;}if(!webhookUrl){console.warn(\"EmailSendLink: No webhook URL configured\");setFormState(\"error\");setTimeout(()=>setFormState(\"idle\"),2e3);return;}setFormState(\"processing\");fireEvent(submitEventName,{email:trimmed});try{const anonymousId=getAnonymousId();const payload={email:trimmed};if(anonymousId){payload.anonymousId=anonymousId;}const response=await fetch(webhookUrl,{method:\"POST\",body:new URLSearchParams(payload)});if(!response.ok){throw new Error(`HTTP ${response.status}`);}setFormState(\"success\");fireEvent(successEventName,{email:trimmed});setEmail(\"\");if(successResetDelay>0){setTimeout(()=>setFormState(\"idle\"),successResetDelay);}}catch(err){console.error(\"EmailSendLink: Webhook request failed\",err);setFormState(\"error\");fireEvent(errorEventName,{email:trimmed});setTimeout(()=>setFormState(\"idle\"),2e3);}},[email,formState,webhookUrl,submitEventName,successEventName,errorEventName,successResetDelay]);const handleKeyDown=useCallback(e=>{if(e.key===\"Enter\"){e.preventDefault();handleSubmit();}},[handleSubmit]);// Inject keyframe animation for spinner\nconst spinnerKeyframes=`\n        @keyframes emailSendLinkSpin {\n            from { transform: rotate(0deg); }\n            to { transform: rotate(360deg); }\n        }\n    `;// Button content based on state\nconst renderButtonContent=()=>{if(formState===\"processing\"){return /*#__PURE__*/_jsxs(\"span\",{style:{display:\"inline-flex\",alignItems:\"center\",gap:8},children:[/*#__PURE__*/_jsx(SpinnerIcon,{color:buttonTextColor,size:18}),processingText&&/*#__PURE__*/_jsx(\"span\",{children:processingText})]});}if(formState===\"success\"){return /*#__PURE__*/_jsx(CheckIcon,{color:buttonTextColor,size:20});}return buttonText;};const barBorderColor=formState===\"error\"?errorColor:\"transparent\";return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{children:spinnerKeyframes}),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"center\",backgroundColor:barBackground,borderRadius:barBorderRadius,padding:barPadding,width:\"100%\",boxSizing:\"border-box\",border:`1.5px solid ${barBorderColor}`,transition:\"border-color 200ms ease\"},children:[/*#__PURE__*/_jsx(\"input\",{type:\"email\",value:email,onChange:e=>{setEmail(e.target.value);if(formState===\"error\")setFormState(\"idle\");},onKeyDown:handleKeyDown,onFocus:()=>fireEvent(\"send download email input focused\"),placeholder:placeholder,disabled:formState===\"processing\",style:{flex:1,minWidth:0,background:\"none\",border:\"none\",outline:\"none\",color:inputTextColor,fontSize:inputFontSize,fontFamily,padding:`${buttonPaddingV}px ${buttonPaddingH*.75}px`,lineHeight:1.2,caretColor:inputTextColor}}),/*#__PURE__*/_jsx(\"style\",{children:`\n                    .email-send-link-input::placeholder {\n                        color: ${inputPlaceholderColor};\n                        opacity: 1;\n                    }\n                `}),/*#__PURE__*/_jsx(\"button\",{onClick:handleSubmit,onMouseEnter:()=>setButtonHover(true),onMouseLeave:()=>setButtonHover(false),disabled:formState===\"processing\",style:{display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",backgroundColor:buttonBackground,color:buttonTextColor,fontSize:buttonFontSize,fontWeight:buttonFontWeight,fontFamily,borderRadius:buttonBorderRadius,padding:`${buttonPaddingV}px ${buttonPaddingH}px`,cursor:formState===\"processing\"?\"default\":\"pointer\",border:\"none\",whiteSpace:\"nowrap\",transition:\"opacity 150ms ease\",opacity:formState===\"processing\"?.7:buttonHover?.85:1,lineHeight:1.2,flexShrink:0,minWidth:100},children:renderButtonContent()})]})]});}// ============================================================\n// Framer Property Controls\n// ============================================================\naddPropertyControls(EmailSendLink,{webhookUrl:{type:ControlType.String,title:\"Webhook URL\",defaultValue:\"https://hooks.zapier.com/hooks/catch/22512893/upjyidi/\",description:\"The URL to POST the email and anonymous ID to.\"},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Enter your email\"},buttonText:{type:ControlType.String,title:\"Button Text\",defaultValue:\"Send link\"},processingText:{type:ControlType.String,title:\"Processing Text\",placeholder:\"Sending...\",description:\"Optional text shown next to the spinner. Leave empty for spinner only.\"},successResetDelay:{type:ControlType.Number,title:\"Success Reset (ms)\",defaultValue:3e3,min:0,max:1e4,step:500,description:\"How long the success checkmark is shown before resetting. Set 0 to stay on success.\"},buttonBackground:{type:ControlType.Color,title:\"Button Background\",defaultValue:\"#FFFFFF\"},buttonTextColor:{type:ControlType.Color,title:\"Button Text Color\",defaultValue:\"#000000\"},buttonFontSize:{type:ControlType.Number,title:\"Button Font Size\",defaultValue:16,min:10,max:32},buttonFontWeight:{type:ControlType.Number,title:\"Button Font Weight\",defaultValue:600,min:100,max:900,step:100,displayStepper:true},buttonBorderRadius:{type:ControlType.Number,title:\"Button Border Radius\",defaultValue:100,min:0,max:100},buttonPaddingH:{type:ControlType.Number,title:\"Button Padding H\",defaultValue:24,min:0,max:60},buttonPaddingV:{type:ControlType.Number,title:\"Button Padding V\",defaultValue:14,min:0,max:40},barBackground:{type:ControlType.Color,title:\"Bar Background\",defaultValue:\"rgba(0, 0, 0, 0.45)\"},barBorderRadius:{type:ControlType.Number,title:\"Bar Border Radius\",defaultValue:100,min:0,max:100},barPadding:{type:ControlType.Number,title:\"Bar Padding\",defaultValue:6,min:0,max:40},inputTextColor:{type:ControlType.Color,title:\"Input Text Color\",defaultValue:\"#FFFFFF\"},inputPlaceholderColor:{type:ControlType.Color,title:\"Placeholder Color\",defaultValue:\"rgba(255, 255, 255, 0.45)\"},inputFontSize:{type:ControlType.Number,title:\"Input Font Size\",defaultValue:16,min:10,max:32},errorColor:{type:ControlType.Color,title:\"Error Border Color\",defaultValue:\"#EF4444\"},fontFamily:{type:ControlType.Font,title:\"Font Family\"},submitEventName:{type:ControlType.String,title:\"Submit Event Name\",placeholder:\"send download form submission started\",description:\"RudderStack event fired when form is submitted.\"},successEventName:{type:ControlType.String,title:\"Success Event Name\",placeholder:\"send download form submission result\",description:\"RudderStack event fired on successful submission.\"},errorEventName:{type:ControlType.String,title:\"Error Event Name\",placeholder:\"send download form submission error\",description:\"RudderStack event fired on failed submission.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"EmailSendLink\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SendEmailForm.map"],"mappings":"8MAGA,SAAS,EAAY,CAAC,QAAM,QAAM,CAAC,OAAoB,EAAK,MAAM,CAAC,MAAM,EAAK,OAAO,EAAK,QAAQ,YAAY,KAAK,OAAO,MAAM,CAAC,UAAU,yCAAyC,CA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