{"version":3,"file":"MailchimpButton.CKSSs1fo.mjs","names":["useId","useMemo","useState"],"sources":["https:/framerusercontent.com/modules/KElp11h2eOermG46AgTB/119dezglHb2rps1Ivs8e/MailchimpButton.js"],"sourcesContent":["// Botón de suscripción a Mailchimp idéntico al diseño proporcionado\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useId,useMemo,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Botón de suscripción a Mailchimp\n * Mailchimp subscription button\n *\n * @framerIntrinsicWidth 450\n * @framerIntrinsicHeight 50\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function MailchimpButton(props){const{placeholder,buttonText,backgroundColor,inputBackground,inputTextColor,placeholderColor,inputBorderColor,buttonBackground,buttonTextColor,buttonHoverBackground,borderRadius,font,buttonFont,successMessage,errorMessage}=props;const reactId=useId();const cssSafeId=useMemo(()=>reactId.replace(/[^a-zA-Z0-9_-]/g,\"\"),[reactId]);const[email,setEmail]=useState(\"\");const[status,setStatus]=useState(\"idle\");const[message,setMessage]=useState(\"\");const[isHovered,setIsHovered]=useState(false);const handleSubmit=async e=>{e.preventDefault();if(!email||!email.includes(\"@\")){startTransition(()=>{setStatus(\"error\");setMessage(\"Please enter a valid email\");});return;}startTransition(()=>setStatus(\"loading\"));try{const response=await fetch(\"https://mailchimp-api-seven.vercel.app/api/subscribe\",{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({email})});const data=await response.json();if(response.ok){startTransition(()=>{setStatus(\"success\");setMessage(successMessage);setEmail(\"\");});}else{startTransition(()=>{setStatus(\"error\");setMessage(data.error||errorMessage);});}}catch(error){startTransition(()=>{setStatus(\"error\");setMessage(errorMessage);});}setTimeout(()=>{startTransition(()=>{setStatus(\"idle\");setMessage(\"\");});},3e3);};const isFixedWidth=props?.style&&props.style.width===\"100%\";return /*#__PURE__*/_jsxs(\"div\",{style:{...props.style,position:\"relative\",width:\"100%\",minHeight:\"max-content\"},children:[/*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,style:{display:\"flex\",flexDirection:\"row\",alignItems:\"stretch\",gap:0,backgroundColor,borderRadius,overflow:\"hidden\",border:`1px solid ${inputBorderColor}`,width:\"100%\",flexWrap:\"nowrap\",boxSizing:\"border-box\"},className:\"mailchimp-form\",children:[/*#__PURE__*/_jsx(\"input\",{type:\"email\",value:email,onChange:e=>setEmail(e.target.value),placeholder:placeholder,disabled:status===\"loading\",style:{flex:\"1 1 auto\",minWidth:0,padding:\"12px 16px\",border:\"none\",outline:\"none\",backgroundColor:inputBackground,color:inputTextColor,boxSizing:\"border-box\",...font},className:`mailchimp-input mailchimp-input-responsive mailchimp-input-${cssSafeId}`}),/*#__PURE__*/_jsx(\"style\",{children:`\n                    .mailchimp-input-${cssSafeId}::placeholder {\n                        color: ${placeholderColor};\n                        opacity: 1;\n                    }\n                    .mailchimp-input-${cssSafeId}::-webkit-input-placeholder {\n                        color: ${placeholderColor};\n                        opacity: 1;\n                    }\n                    .mailchimp-input-${cssSafeId}::-ms-input-placeholder {\n                        color: ${placeholderColor};\n                        opacity: 1;\n                    }\n                    .mailchimp-input-${cssSafeId}:-ms-input-placeholder {\n                        color: ${placeholderColor};\n                        opacity: 1;\n                    }\n                    .mailchimp-button-responsive {\n                        flex-shrink: 0;\n                        display: inline-flex;\n                        box-sizing: border-box;\n                    }\n                    .mailchimp-form,\n                    .mailchimp-input-responsive {\n                        box-sizing: border-box;\n                    }\n                `}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:status===\"loading\",onMouseEnter:()=>setIsHovered(true),onMouseLeave:()=>setIsHovered(false),style:{flex:\"0 0 auto\",minWidth:\"120px\",padding:\"12px 24px\",border:\"none\",outline:\"none\",cursor:status===\"loading\"?\"not-allowed\":\"pointer\",backgroundColor:isHovered&&status!==\"loading\"?buttonHoverBackground:buttonBackground,color:buttonTextColor,transition:\"background-color 0.2s ease\",whiteSpace:\"nowrap\",boxSizing:\"border-box\",...buttonFont},className:\"mailchimp-button-responsive\",children:status===\"loading\"?\"Sending...\":buttonText})]}),message&&/*#__PURE__*/_jsx(\"div\",{style:{marginTop:8,padding:\"8px 12px\",borderRadius:4,backgroundColor:status===\"success\"?\"#d4edda\":\"#f8d7da\",color:status===\"success\"?\"#155724\":\"#721c24\",fontSize:14,...font},children:message})]});}addPropertyControls(MailchimpButton,{placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Enter your email\"},buttonText:{type:ControlType.String,title:\"Button Text\",defaultValue:\"Subscribe\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},inputBackground:{type:ControlType.Color,title:\"Input Background\",defaultValue:\"#F5F5F5\"},inputTextColor:{type:ControlType.Color,title:\"Input Text\",defaultValue:\"#000000\"},placeholderColor:{type:ControlType.Color,title:\"Placeholder Color\",defaultValue:\"#999999\"},inputBorderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#EEEEEE\"},buttonBackground:{type:ControlType.Color,title:\"Button Background\",defaultValue:\"#FFFFFF\"},buttonTextColor:{type:ControlType.Color,title:\"Button Text\",defaultValue:\"#000000\"},buttonHoverBackground:{type:ControlType.Color,title:\"Button Hover\",defaultValue:\"#F5F5F5\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:50,step:1,unit:\"px\"},font:{type:ControlType.Font,title:\"Input Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Regular\",letterSpacing:\"0em\",lineHeight:\"1em\"}},buttonFont:{type:ControlType.Font,title:\"Button Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"0em\",lineHeight:\"1em\"}},successMessage:{type:ControlType.String,title:\"Success Message\",defaultValue:\"Thanks for subscribing!\",displayTextArea:true},errorMessage:{type:ControlType.String,title:\"Error Message\",defaultValue:\"There was an error. Please try again.\",displayTextArea:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MailchimpButton\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"450\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"50\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./MailchimpButton.map"],"mappings":"sMAUG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,cAAY,aAAW,kBAAgB,kBAAgB,iBAAe,mBAAiB,mBAAiB,mBAAiB,kBAAgB,wBAAsB,eAAa,OAAK,aAAW,iBAAe,gBAAc,EAAY,EAAQA,GAAO,CAAO,EAAUC,MAAY,EAAQ,QAAQ,kBAAkB,GAAG,CAAC,CAAC,EAAQ,CAAC,CAAM,CAAC,EAAM,GAAUC,EAAS,GAAG,CAAM,CAAC,EAAO,GAAWA,EAAS,OAAO,CAAM,CAAC,EAAQ,GAAYA,EAAS,GAAG,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAO,EAAa,KAAM,IAAG,CAAoB,GAAnB,EAAE,gBAAgB,CAAI,CAAC,GAAO,CAAC,EAAM,SAAS,IAAI,CAAC,CAAC,MAAoB,CAAC,EAAU,QAAQ,CAAC,EAAW,6BAA6B,EAAG,CAAC,OAAQ,MAAoB,EAAU,UAAU,CAAC,CAAC,GAAG,CAAC,IAAM,EAAS,MAAM,MAAM,uDAAuD,CAAC,OAAO,OAAO,QAAQ,CAAC,eAAe,mBAAmB,CAAC,KAAK,KAAK,UAAU,CAAC,QAAM,CAAC,CAAC,CAAC,CAAO,EAAK,MAAM,EAAS,MAAM,CAAI,EAAS,GAAI,MAAoB,CAAC,EAAU,UAAU,CAAC,EAAW,EAAe,CAAC,EAAS,GAAG,EAAG,CAAO,MAAoB,CAAC,EAAU,QAAQ,CAAC,EAAW,EAAK,OAAO,EAAa,EAAG,MAAe,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