{"version":3,"file":"SubscribeButton.DDYsa7wR.mjs","names":["React"],"sources":["https:/framerusercontent.com/modules/lRErTljRN8hVX2mZgjXY/uEZcjCAXBrn5OYy0wdTU/SubscribeButton.js"],"sourcesContent":["// Welcome to Code in Framer\n// Get Started: https://www.framer.com/developers/\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import React from\"react\";/**\n * These annotations control how your component sizes\n * Learn more: https://www.framer.com/developers/#code-components-auto-sizing\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */const FLODESK_BASE_API_ENDPOINT=\"https://api.flodesk.com/v1\";const VITE_APP_FLODESK_API_KEY=\"fd_key_35e66eed825b46e8a015efb767ef80b1.SOC6csXMK0HVmJh3DJuRhpflMSXa7nasbZsExD02TTimmu89EwJVUW0sNFZ80t6ijunrS7v2PgBdxvjPh5dD9ynBaanVEJfkJCrE08a9OUovFCOOHA5vYUzeNxzfuAxgT5dz9eN2HtHeGqOC6wR9NVyFruCHKtoXEg6F2sp2kaWLI4uaGgSLM2Qk48dYxNcP\";const validEmail=/^[\\w-.]+@([\\w-]+\\.)+[\\w-]{2,10}$/;export default function SubscribeButton(props){// This is a React component containing an Example component\n// - Replace <Example /> with your own code\n// - Find inspiration: https://www.framer.com/developers/\nconst[value,setValue]=React.useState();const[inValid,setInvalid]=React.useState(false);const[success,setSuccess]=React.useState(false);const[error,setError]=React.useState(false);const handleChange=event=>{setValue(event.target.value);};const createSubscriber=async data=>{fetch(`${FLODESK_BASE_API_ENDPOINT}/subscribers`,{method:\"POST\",headers:{\"User-Agent\":\"geyser.fund\",Authorization:`Basic ${VITE_APP_FLODESK_API_KEY}`,\"Content-Type\":\"application/json\"},body:JSON.stringify(data)}).then(response=>response.json());};const handleClick=async()=>{const valid=validEmail.test(value);if(!valid){setInvalid(true);setTimeout(()=>{setInvalid(false);},2e3);return;}try{await createSubscriber({email:value,segment_ids:[\"657d655a3d5e2300da54a743\"]});setSuccess(true);setValue(\"\");setTimeout(()=>{setSuccess(false);},2e3);}catch{setError(true);setTimeout(()=>{setError(false);},2e3);}};return /*#__PURE__*/_jsxs(\"div\",{style:containerStyle,children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                \n                .app-slider--tablet-device,\n                .app-slider--mobile-device {\n                    width: 100%;\n                }\n                .email-input {\n                    height: 46px;\n                    font-size: 16px;\n                    border-radius : 10px;\n                    padding: 10px\n                }\n                .email-input.error {\n                    outline-color: red;\n                }\n\n                .email-input.success {\n                    outline-color: #00f5dc;\n                }\n\n                .email-input:focus-visible,.email-input:focus {\n                    outline-color: #00f5dc\n                }\n\n                .subscribe-button {\n                    border-radius: 10px;\n                    background-color: rgba(20, 20, 20, .8);\n                    color: #FFFFFF;\n                    height: 46px;\n                    padding: 10px 24px;\n                    font-size: 16px !important;\n                    outline: none;\n                    border: none;\n                    cursor: pointer;\n                }\n\n                .subscribe-button.success{\n                    background-color: #00f5dc;\n                    color: black;\n                }\n\n                .subscribe-button:active{\n                    background-color: grey;\n                    \n                    transition: background-color 0.2s;\n                }\n\n                .button-container {\n                    display: flex;\n                    flex-direction: row; \n                    gap: 10px;\n                }\n\n                @media screen and (max-width: 400px) {\n                    .button-container {\n                        flex-direction: column;\n                        align-items: stretch;\n                    }\n                }\n                \n                `}),/*#__PURE__*/_jsxs(\"div\",{className:\"button-container\",children:[/*#__PURE__*/_jsx(\"input\",{className:`email-input ${inValid?\"error\":\"\"}`,placeholder:\"satoshi@gmx.com\",onChange:handleChange,value:value}),/*#__PURE__*/_jsx(\"button\",{className:`subscribe-button ${success?\"success\":\"\"}`,onClick:handleClick,children:success?\"Subscribed!!\":\"Subscribe\"})]}),/*#__PURE__*/_jsx(\"p\",{style:{color:\"red\",height:\"14px\"},children:inValid?\"Please enter a valid email address.\":error?\"Could not subscribe at the moment, please try again later.\":\"\"})]});}// Styles are written in object syntax\n// Learn more: https://reactjs.org/docs/dom-elements.html#style\nconst containerStyle={height:\"100%\",display:\"flex\",flexDirection:\"column\",justifyContent:\"center\",alignItems:\"start\",overflow:\"hidden\",gap:\"0px\"};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SubscribeButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SubscribeButton.map"],"mappings":"iKAQ8X,SAAwB,EAAgB,EAAM,CAG5a,GAAK,CAAC,EAAM,GAAUA,EAAM,UAAU,CAAM,CAAC,EAAQ,GAAYA,EAAM,SAAS,GAAM,CAAM,CAAC,EAAQ,GAAYA,EAAM,SAAS,GAAM,CAAM,CAAC,EAAM,GAAUA,EAAM,SAAS,GAAM,CAAO,EAAa,GAAO,CAAC,EAAS,EAAM,OAAO,MAAM,EAAS,EAAiB,KAAM,IAAM,CAAC,MAAM,GAAG,EAA0B,cAAc,CAAC,OAAO,OAAO,QAAQ,CAAC,aAAa,cAAc,cAAc,SAAS,IAA2B,eAAe,mBAAmB,CAAC,KAAK,KAAK,UAAU,EAAK,CAAC,CAAC,CAAC,KAAK,GAAU,EAAS,MAAM,CAAC,EAAyW,OAAoB,EAAM,MAAM,CAAC,MAAM,EAAe,SAAS,CAAc,EAAK,QAAQ,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA4Dh8B,CAAC,CAAc,EAAM,MAAM,CAAC,UAAU,mBAAmB,SAAS,CAAc,EAAK,QAAQ,CAAC,UAAU,eAAe,EAAQ,QAAQ,KAAK,YAAY,kBAAkB,SAAS,EAAmB,QAAM,CAAC,CAAc,EAAK,SAAS,CAAC,UAAU,oBAAoB,EAAQ,UAAU,KAAK,QA5DyO,SAAS,CAAoC,GAAG,CAA1B,EAAW,KAAK,EAAM,CAAW,CAAC,EAAW,GAAK,CAAC,eAAe,CAAC,EAAW,GAAM,EAAG,IAAI,CAAC,OAAQ,GAAG,CAAC,MAAM,EAAiB,CAA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