"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime");require("react");const s=require("semantic-ui-react"),v=require("react-redux"),u=require("../reducers/embeddable.js"),j=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/,p=t=>{const l=()=>{const{email:i,list:a,tag:w}=t;t.onSubmit({email:i,list:a,tag:w})},{status:r,editing:o,list:q,placeholder:d="enter your email address",successmessage:m="Thanks",failuremessage:g="Something didn't go well",label:b="Send",tag:C,email:c,onChange:h}=t;let n="";(r==="OK"||o)&&(n=e.jsx(s.Message,{success:!0,children:e.jsx("p",{children:m})})),(r==="ERROR"||o)&&(n=e.jsx(s.Message,{negative:!0,children:e.jsx("p",{children:g})}));const x=j.test(c);return e.jsxs("div",{className:"viz newsLetter",children:[e.jsxs("div",{className:"viz newsLetter form",children:[e.jsx(s.Input,{icon:"envelope",name:"email",value:c,onChange:(i,a)=>h(a.value),iconPosition:"left",placeholder:d}),e.jsx(s.Button,{disabled:!x,primary:!0,onClick:i=>l(),children:b})]}),n]})},S=(t,l)=>({status:t.getIn(["embeddable","newsletter","status"]),email:t.getIn(["embeddable","newsletter","email"])}),f={onSubmit:u.newsletterSubscription,onChange:u.setEmail},R=v.connect(S,f)(p);exports.default=R;
