!function(){try{var n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},e=Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="ad2161d7-79a6-4de8-8438-96425f05aace",n._sentryDebugIdIdentifier="sentry-dbid-ad2161d7-79a6-4de8-8438-96425f05aace")}catch(n){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6],{17006:function(n,e,t){t.r(e),t.d(e,{default:function(){return MailSubscriptionBanner_MailSubscriptionBanner}});var i=t(57437),r=t(2265),a=t(60230),o=t(5805),l=t(90341),c=t(83776),d=t(16691),s=t.n(d);function _templateObject(){let n=(0,a._)(["\n height: 214px;\n background: #010e27;\n border-bottom: 1px solid #0f1d3a;\n position: relative;\n margin-top: ",";\n\n @media screen and (min-width: 768px) {\n margin-top: ",";\n }\n\n @media screen and (min-width: 1280px) {\n margin-top: ",";\n }\n"]);return _templateObject=function(){return n},n}function _templateObject1(){let n=(0,a._)(["\n display: flex;\n flex-direction: column;\n padding: 24px 24px 24px;\n background: #062763;\n position: absolute;\n margin: 0 16px;\n width: calc(100% - 32px);\n height: auto;\n bottom: 48px;\n background-repeat: no-repeat;\n background-position: center;\n background-size: cover;\n background-image: url(",");\n border-radius: 32px;\n\n @media screen and (min-width: 768px) {\n padding: 40px;\n margin: 0 auto;\n width: auto;\n border-radius: 32px;\n left: 50%;\n transform: translate(-50%, 0);\n bottom: 66px;\n }\n\n @media screen and (min-width: 1280px) {\n width: ",";\n padding: 40px 56px;\n background-image: url(",");\n display: flex;\n flex-direction: row;\n align-items: center;\n bottom: 64px;\n gap: 16px;\n height: 220px;\n }\n"]);return _templateObject1=function(){return n},n}function _templateObject2(){let n=(0,a._)(["\n margin: 0 0 4px 0;\n font-family: Inter;\n font-size: 16px;\n font-weight: 400;\n line-height: 160%;\n color: #ffffff;\n\n @media screen and (min-width: 768px) {\n margin: 0;\n font-family: Poppins;\n font-size: 30px;\n font-weight: 400;\n line-height: 120%;\n }\n\n @media screen and (min-width: 1280px) {\n text-align: left;\n }\n"]);return _templateObject2=function(){return n},n}function _templateObject3(){let n=(0,a._)(['\n font-family: "Inter";\n font-weight: 400;\n font-size: 14px;\n line-height: 140%;\n text-align: center;\n color: #f2f7fe;\n\n p {\n margin: 0;\n }\n\n @media (min-width: 768px) {\n font-size: 14px;\n line-height: 160%;\n width: 420px;\n margin: 0 auto;\n }\n\n @media screen and (min-width: 1280px) {\n font-size: 16px;\n width: 584px;\n text-align: left;\n margin: 0;\n }\n']);return _templateObject3=function(){return n},n}function _templateObject4(){let n=(0,a._)(['\n flex: 0 1 auto;\n display: block;\n outline: 0;\n border: 0;\n border-radius: 8px;\n width: 100%;\n height: 56px;\n padding: 0;\n background: #0f75fc;\n font-family: "Inter";\n font-weight: 400;\n font-size: 14px;\n line-height: 160%;\n text-align: center;\n color: #ffffff;\n cursor: pointer;\n\n @media (min-width: 768px) {\n }\n\n @media screen and (min-width: 1280px) {\n \n margin: 0;\n &:hover {\n background: #004ad9;\n }\n }\n']);return _templateObject4=function(){return n},n}function _templateObject5(){let n=(0,a._)(["\n order: 2;\n flex: 1 0 auto;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n max-width: 692px;\n\n a {\n color: ",";\n text-decoration: none;\n cursor: pointer;\n }\n\n @media screen and (min-width: ",") {\n align-items: flex-start;\n }\n\n @media screen and (min-width: ",") {\n order: 1;\n }\n"]);return _templateObject5=function(){return n},n}function _templateObject6(){let n=(0,a._)(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n max-width: 692px;\n\n @media screen and (min-width: ",") {\n width: 100%;\n }\n\n @media screen and (min-width: ",") {\n align-items: center;\n flex-direction: row;\n max-width: auto;\n gap: 36px;\n }\n"]);return _templateObject6=function(){return n},n}function _templateObject7(){let n=(0,a._)(["\n position: relative;\n order: 1;\n -ms-flex-order: 1;\n height: 92px;\n margin: 0 auto;\n\n @media screen and (min-width: ",") {\n flex: 0 1 auto;\n width: auto;\n height: 72px;\n }\n\n @media screen and (min-width: ",") {\n order: 2;\n height: auto;\n flex: 0 1 auto;\n width: 410px;\n }\n"]);return _templateObject7=function(){return n},n}function _templateObject8(){let n=(0,a._)(["\n margin: 16px 0 8px 0;\n display: flex;\n flex-direction: column;\n width: 100%;\n\n @media screen and (min-width: ",") {\n }\n\n @media screen and (min-width: ",") {\n margin-top: 8px;\n flex-direction: row;\n gap: 16px;\n }\n"]);return _templateObject8=function(){return n},n}function _templateObject9(){let n=(0,a._)(["\n width: 100%;\n margin: 0 auto 8px auto;\n & div {\n border: 0;\n }\n\n div {\n width: 100%;\n }\n\n @media screen and (min-width: ",") {\n margin: 0 0 8px 0;\n }\n\n @media screen and (min-width: ",") {\n margin: 0 0 0 0;\n }\n"]);return _templateObject9=function(){return n},n}function _templateObject10(){let n=(0,a._)(["\n flex: 1 0 auto;\n background-color: ",";\n color: ",";\n \n div {\n border-radius: 8px;\n }\n\n &:hover {\n color: ",";\n }\n\n &:active {\n color: ",";\n }\n\n @media screen and (min-width: ",") {\n width: 448px;\n }\n"]);return _templateObject10=function(){return n},n}function _templateObject11(){let n=(0,a._)(["\n display: none;\n\n @media screen and (min-width: ",") {\n display: block;\n width: 567px;\n height: 354px;\n transform: translate(-16%, -16%);\n /* position: absolute;\n color: transparent;\n top:0;\n left: 0; */\n }\n"]);return _templateObject11=function(){return n},n}function _templateObject12(){let n=(0,a._)(["\n display: none;\n\n @media screen and (min-width: ",") {\n display: block;\n position: relative;\n top: -154px;\n left: 0;\n }\n\n @media screen and (min-width: ",") {\n display: none;\n }\n"]);return _templateObject12=function(){return n},n}function _templateObject13(){let n=(0,a._)(["\n display: block;\n position: relative;\n top: -100%;\n left: 0;\n\n @media screen and (min-width: ",") {\n display: none;\n }\n"]);return _templateObject13=function(){return n},n}function _templateObject14(){let n=(0,a._)(["\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 16px;\n\n label {\n margin: 0;\n }\n\n span {\n background-color: #fff;\n }\n"]);return _templateObject14=function(){return n},n}function _templateObject15(){let n=(0,a._)(["\n font-family: Inter;\n font-size: 8px;\n font-weight: 500;\n line-height: 120%;\n color: #fff;\n\n @media screen and (min-width: ",") {\n font-size: 12px;\n line-height: 130%;\n }\n"]);return _templateObject15=function(){return n},n}function _templateObject16(){let n=(0,a._)(["\n font-family: Poppins;\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 120%;\n color: ",";\n text-align: center;\n margin-bottom: 16px;\n\n @media screen and (min-width: ",") {\n text-align: center;\n }\n\n @media screen and (min-width: ",") {\n flex: 1 0 auto;\n font-size: 30px;\n text-align: left;\n max-width: 278px;\n }\n"]);return _templateObject16=function(){return n},n}function _templateObject17(){let n=(0,a._)([""]);return _templateObject17=function(){return n},n}let m=(0,o.ZP)("article").withConfig({componentId:"sc-b1f034b2-0"})(_templateObject(),n=>{let{mtMobile:e}=n;return null!=e?e:"150px"},n=>{let{mtTablet:e}=n;return null!=e?e:"100px"},n=>{let{mtDesk:e}=n;return null!=e?e:"100px"}),p=(0,o.ZP)(m).withConfig({componentId:"sc-b1f034b2-1"})(_templateObject1(),{src:"/learn/_next/static/media/bg-small.0044f8c4.svg",height:350,width:1920,blurWidth:0,blurHeight:0},n=>{let{desckWidth:e}=n;return null!=e?e:"auto"},{src:"/learn/_next/static/media/back.c61583f0.svg",height:962,width:1920,blurWidth:0,blurHeight:0}),u=o.ZP.h2.withConfig({componentId:"sc-b1f034b2-2"})(_templateObject2());o.ZP.div.withConfig({componentId:"sc-b1f034b2-3"})(_templateObject3());let b=o.ZP.button.withConfig({componentId:"sc-b1f034b2-4"})(_templateObject4()),f=o.ZP.div.withConfig({componentId:"sc-b1f034b2-5"})(_templateObject5(),n=>{var e;let{theme:t}=n;return null===(e=t.colors)||void 0===e?void 0:e.primary},l.rS.breakpoints.tablet.min,l.rS.breakpoints.desktop.min),h=o.ZP.div.withConfig({componentId:"sc-b1f034b2-6"})(_templateObject6(),l.rS.breakpoints.tablet.min,l.rS.breakpoints.desktop.min),g=o.ZP.div.withConfig({componentId:"sc-b1f034b2-7"})(_templateObject7(),l.rS.breakpoints.tablet.min,l.rS.breakpoints.desktop.min),x=o.ZP.div.withConfig({componentId:"sc-b1f034b2-8"})(_templateObject8(),l.rS.breakpoints.tablet.min,l.rS.breakpoints.desktop.min),w=o.ZP.form.withConfig({componentId:"sc-b1f034b2-9"})(_templateObject9(),l.rS.breakpoints.tablet.min,l.rS.breakpoints.desktop.min),_=(0,o.ZP)(c.II).withConfig({componentId:"sc-b1f034b2-10"})(_templateObject10(),l.rS.colors.exchange.button.dark,l.rS.colors.primaryWhite,l.rS.colors.text.title,l.rS.colors.text.title,l.rS.breakpoints.desktop.min),j=(0,o.ZP)(s()).attrs({src:{src:"/learn/_next/static/media/Mail-banner_desktop.f24bad71.svg",height:355,width:568,blurWidth:0,blurHeight:0},alt:"mail box"}).withConfig({componentId:"sc-b1f034b2-11"})(_templateObject11(),l.rS.breakpoints.desktop.min),k=(0,o.ZP)(s()).attrs({src:{src:"/learn/_next/static/media/Mail-banner_tablet.4d1deaac.svg",height:215,width:510,blurWidth:0,blurHeight:0},alt:"mail box"}).withConfig({componentId:"sc-b1f034b2-12"})(_templateObject12(),l.rS.breakpoints.tablet.min,l.rS.breakpoints.desktop.min),S=(0,o.ZP)(s()).attrs({src:{src:"/learn/_next/static/media/Mail-banner_mob.170365ea.svg",height:173,width:288,blurWidth:0,blurHeight:0},alt:"mail box"}).withConfig({componentId:"sc-b1f034b2-13"})(_templateObject13(),l.rS.breakpoints.tablet.min),O=o.ZP.div.withConfig({componentId:"sc-b1f034b2-14"})(_templateObject14()),v=o.ZP.p.withConfig({componentId:"sc-b1f034b2-15"})(_templateObject15(),l.rS.breakpoints.tablet.min),y=o.ZP.span.withConfig({componentId:"sc-b1f034b2-16"})(_templateObject16(),l.rS.colors.primaryWhite,l.rS.breakpoints.tablet.min,l.rS.breakpoints.desktop.min),I=(0,o.ZP)(c.XZ).withConfig({componentId:"sc-b1f034b2-17"})(_templateObject17());var C=t(55998);async function saveUserEmail(n){let e=await C.Zd.post("/users-emails",{data:{email:n}});if(null===e.data)throw Error("Failed to add user email");return e}var P=t(35691);let Z=P.Ry().shape({email:P.Z_().email("Incorrect email").nonNullable().required("Fill email field"),terms:P.O7().isTrue("Terms reuired").defined()}),validateEmailForm=(n,e)=>{try{Z.validateSync(n);let e=Z.isValidSync(n);return e}catch(n){if(n instanceof P.p8&&n.path){let t={[n.path]:n.errors[0]};e(n=>({...n,...t}))}return!1}},E={email:null,terms:null},NotSubmitedBanner=n=>{let{isSubmited:e,value:t,isCheckedTerms:r,change:a,submit:o,changeTerms:l,errors:c}=n;return e?null:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(u,{children:"Subscribe to Analytics digest"}),(0,i.jsxs)(v,{children:["By providing my email, I agree to the"," ",(0,i.jsx)("a",{href:"https://simpleswap.io/terms-of-service",target:"_blank",rel:"noreferrer",children:"Terms of Service"})]}),(0,i.jsxs)(x,{children:[(0,i.jsx)(w,{onSubmit:n=>{n.preventDefault()},id:"mail-subscription-form",children:(0,i.jsx)(_,{value:t,id:"email",type:"email",error:c.email,onChange:a,placeholder:"Email address"})}),(0,i.jsx)(b,{type:"submit",onClick:n=>{n.preventDefault(),o()},children:"Subscribe"})]}),(0,i.jsxs)(O,{children:[(0,i.jsx)(I,{role:"checkbox",onChange:l,checked:r,error:!!c.terms}),(0,i.jsxs)(v,{children:["By entering my email, I agree to the"," ",(0,i.jsx)("a",{href:"https://simpleswap.io/privacy-policy",target:"_blank",rel:"noreferrer",children:"Privacy Policy"})]})]})]})},SubmitedBanner=n=>{let{isSubmited:e,isResendDisabled:t,resendEmail:r}=n;return(0,i.jsx)(i.Fragment,{children:e&&(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(h,{children:[(0,i.jsxs)(y,{role:"textbox",children:["Done! Expect our first digest soon ","\uD83D\uDE0C"]}),(0,i.jsx)(b,{disabled:t,onClick:r,children:t?"Subscription limit exceeded":"Enter another email"})]})})})};var MailSubscriptionBanner_MailSubscriptionBanner=()=>{let[n,e]=(0,r.useState)(!1),[t,a]=(0,r.useState)(!1),[o,l]=(0,r.useState)(""),[c,d]=(0,r.useState)(!1),[s,u]=(0,r.useState)(E),b=(0,r.useCallback)(n=>{l(n.target.value),u(n=>({...n,email:null}))},[]),countSubscritions=()=>{let n=Number(localStorage.getItem("learnSubcriptions"));if(!n){localStorage.setItem("learnSubcriptions","1");return}localStorage.setItem("learnSubcriptions",(n+1).toString())};return(0,r.useEffect)(()=>{let n=Number(localStorage.getItem("learnSubcriptions"));n&&n>=3&&(e(!0),d(!0))},[n]),(0,i.jsx)(m,{role:"banner",mtDesk:"258px",mtTablet:"404px",mtMobile:"328px",children:(0,i.jsxs)(p,{desckWidth:"1222px",children:[(0,i.jsxs)(f,{children:[(0,i.jsx)(SubmitedBanner,{isSubmited:n,resendEmail:()=>{e(!1),l(""),u(E)},isResendDisabled:c}),(0,i.jsx)(NotSubmitedBanner,{isSubmited:n,value:o,change:b,submit:()=>{validateEmailForm({email:o,terms:t},u)&&saveUserEmail(o).then(()=>{e(!0),countSubscritions()}).catch(()=>{u(n=>({...n,email:"Something gone wrong, please resend email"}))})},errors:s,changeTerms:n=>{var e,t;(null==n?void 0:null===(e=n.target)||void 0===e?void 0:e.checked)&&a(!0),(null==n?void 0:null===(t=n.target)||void 0===t?void 0:t.checked)||a(!1),u(n=>({...n,terms:null}))},isCheckedTerms:t})]}),(0,i.jsxs)(g,{children:[(0,i.jsx)(j,{width:567,height:354}),(0,i.jsx)(k,{width:510,height:215}),(0,i.jsx)(S,{width:288,height:173})]})]})})}}}]);ERROR: learn / _next / static / chunks / 6-4d293342fe8ed01f.js