{"version":3,"file":"BrevoButton.CSpmIXoy.mjs","names":["useState","useCallback"],"sources":["https:/framerusercontent.com/modules/jFpOuGQQhR1XSlr62zyk/EaFsa7QOhFT3sOgt8czG/BrevoButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useCallback,useState}from\"react\";import{motion}from\"framer-motion\";/**\n * These annotations control how your component sizes\n * Learn more: https://www.framer.com/docs/guides/auto-sizing\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function BrevoButton(props){const[isLoading,setIsLoading]=useState(false);const[isSigned,setIsSigned]=useState(false);const handleSubmit=useCallback(event=>{if(isLoading)return;setIsLoading(true);event.preventDefault();const headers=new Headers;headers.set(\"api-key\",props.apiKey);headers.set(\"accept\",\" application/json\");let requestOptions={method:\"post\",headers:headers};headers.append(\"Content-Type\",\"application/json\");const formData=new FormData(event.target);let createDoiContact;createDoiContact={attributes:{},email:event.target[0].value,includeListIds:[2],templateId:1,redirectionUrl:\"http://amazonia.yoga/newsletter/please-confirm\"};requestOptions[\"body\"]=JSON.stringify(createDoiContact);fetch(props.url,requestOptions).then(response=>{setIsLoading(false);setIsSigned(true);}).catch(error=>{setIsLoading(false);setIsSigned(true);});},[]);const Spinner=props=>{return /*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",borderRadius:\"0px 8px 8px 0px\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\",inset:0,zIndex:2,color:\"rgba(255, 255, 255, 1.0)\",background:\"rgba(0, 0, 0, 0.8)\"},children:/*#__PURE__*/_jsx(motion.div,{style:{height:16,width:16},initial:{rotate:0},animate:{rotate:360},transition:{duration:1,repeat:Infinity},children:/*#__PURE__*/_jsx(motion.div,{children:/*#__PURE__*/_jsxs(\"svg\",{xmlns:\"http://www.w3.org/2000/svg\",width:\"16\",height:\"16\",style:{fill:\"currentColor\",color:props.color},children:[/*#__PURE__*/_jsx(\"path\",{d:\"M 8 0 C 3.582 0 0 3.582 0 8 C 0 12.419 3.582 16 8 16 C 12.418 16 16 12.419 16 8 C 15.999 3.582 12.418 0 8 0 Z M 8 14 C 4.687 14 2 11.314 2 8 C 2 4.687 4.687 2 8 2 C 11.314 2 14 4.687 14 8 C 14 11.314 11.314 14 8 14 Z\",fill:\"currentColor\",opacity:\"0.2\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M 8 0 C 12.418 0 15.999 3.582 16 8 C 16 8 16 9 15 9 C 14 9 14 8 14 8 C 14 4.687 11.314 2 8 2 C 4.687 2 2 4.687 2 8 C 2 8 2 9 1 9 C 0 9 0 8 0 8 C 0 3.582 3.582 0 8 0 Z\",fill:\"currentColor\"})]})})})});};return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",display:\"flex\",justifyContent:\"center\",height:\"60px\",alignItems:\"center\"},children:[isSigned&&/*#__PURE__*/_jsx(motion.div,{initial:{scale:0},animate:{scale:1},transition:{duration:.5},style:{height:\"46px\",width:\"46px\",background:\"#C8AB2D\",color:\"rgb(27, 29, 28)\",borderRadius:\"50%\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\",transform:\"none\"},children:/*#__PURE__*/_jsx(\"svg\",{xmlns:\"http://www.w3.org/2000/svg\",width:28,height:28,children:/*#__PURE__*/_jsx(\"path\",{d:\"M 2 14 L 10 22 L 26 6\",fill:\"transparent\",strokeWidth:4,stroke:\"currentColor\",strokeLinecap:\"round\"})})}),!isSigned&&/*#__PURE__*/_jsx(\"div\",{style:{borderRadius:\"9px\",background:\"transparent\",width:\"100%\",padding:\"2px\"},children:/*#__PURE__*/_jsx(\"form\",{method:\"POST\",onSubmit:handleSubmit,children:/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",gap:\"15px\",width:\"100%\",height:\"100%\",alignItems:\"center\"},children:[/*#__PURE__*/_jsx(\"input\",{name:\"EMAIL\",required:true,placeholder:props.input.placeholder,autoComplete:\"off\",autoCapitalize:\"off\",autoCorrect:\"off\",spellCheck:false,style:{width:\"100%\",outline:\"none\",fontSize:\"16px\",border:\"none\",padding:\"16px 24px\",borderRadius:\"8px\",...props.font,background:\"rgb(235, 235, 235)\",color:\"rgb(0, 0, 0)\"}}),/*#__PURE__*/_jsxs(motion.div,{whileHover:{opacity:.5},style:{height:\"100%\",display:\"flex\",position:\"relative\"},children:[/*#__PURE__*/_jsx(\"input\",{type:\"submit\",value:props.button.label,style:{appearance:\"none\",width:\"100%\",height:\"100%\",minWidth:\"80px\",outline:\"none\",border:\"none\",fontSize:\"15px\",fontWeight:\"600\",cursor:\"pointer\",borderRadius:\"200px\",padding:\"16px 24px\",...props.font,background:\"#ffffff\",color:\"rgb(27, 29, 28)\",zIndex:1,opacity:1}}),isLoading&&/*#__PURE__*/_jsx(Spinner,{})]})]})})})]});}addPropertyControls(BrevoButton,{url:{title:\"Url\",type:ControlType.String},apiKey:{title:\"apiKey\",type:ControlType.String,defaultValue:\"Your Brevo Api Key\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\"},input:{title:\"Input\",type:ControlType.Object,controls:{placeholder:{title:\"Placeholder\",type:ControlType.String,defaultValue:\"Enter your email\"}}},button:{title:\"Button\",type:ControlType.Object,controls:{label:{title:\"Label\",type:ControlType.String,defaultValue:\"Submit\"}}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BrevoButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./BrevoButton.map"],"mappings":"0OAMG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,EAAU,GAAcA,EAAS,EAAK,EAAO,CAAC,EAAS,GAAaA,EAAS,EAAK,EAAQ,EAAaC,EAAY,GAAO,CAAC,GAAG,EAAU,OAAO,EAAa,EAAI,EAAE,EAAM,eAAe,EAAE,IAAM,EA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