var v=Object.defineProperty;var w=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var I=(i,s,t)=>s in i?v(i,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[s]=t,b=(i,s)=>{for(var t in s||(s={}))y.call(s,t)&&I(i,t,s[t]);if(w)for(var t of w(s))z.call(s,t)&&I(i,t,s[t]);return i};import{r as o,j as e,_ as N,L as k,aL as A,c as _,v as C,w as T,S as F}from"./main-40.js";/* empty css          */import{b as E}from"./bf-132-75.js";import{I as B}from"./bf-94-335.js";import{N as L}from"./bf-504-404.js";import{t as M}from"./bf-892-199.js";import{T as H}from"./bf-679-136.js";import{A as $}from"./bf-541-403.js";import{M as q,c as D,r as R}from"./bf-554-378.js";import"./bf-586-70.js";import"./bf-141-80.js";import"./bf-860-126.js";import"./bf-528-128.js";import"./bf-200-122.js";import"./bf-689-131.js";function G({mailPoetConf:i,setMailPoetConf:s,step:t,nextPage:g,setSnackbar:x,isInfo:d}){const[h,p]=o.useState(!1),[r,u]=o.useState({integrationName:""}),[j,n]=o.useState(!1),[a,m]=o.useState(!1),f=()=>{m("auth"),_({},"bitforms_mail_poet_authorize").then(l=>{l!=null&&l.success&&(p(!0),x({show:!0,msg:N("Authorized Successfully")})),n(!0),m(!1)})},c=l=>{const P=b({},i),S=b({},r);S[l.target.name]="",P[l.target.name]=l.target.value,u(S),s(P)};return e.jsxs(e.Fragment,{children:[e.jsx(H,{title:M.mailPoet.title,youTubeLink:M.mailPoet.link}),e.jsxs("div",{className:"btcd-stp-page",style:{width:t===1&&900,height:t===1&&"100%"},children:[e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:N("Integration Name:")})}),e.jsx("input",{"aria-label":"Integration Name",className:"btcd-paper-inp w-6 mt-1",onChange:c,name:"name",value:i.name,type:"text",placeholder:N("Integration Name..."),disabled:d}),a==="auth"&&e.jsxs("div",{className:"flx mt-5",children:[e.jsx(k,{size:25,clr:"#022217",className:"mr-2"}),"Checking if MailPoet is active!!!"]}),j&&!h&&!a&&e.jsxs("div",{className:"flx mt-5",style:{color:"red"},children:[e.jsx("span",{className:"mr-2",style:{fontSize:30,marginTop:-5},children:e.jsx(A,{size:"15"})}),"Please! First Install Mailpoet Plugins"]}),e.jsx($,{handleAuthorize:f,isAuthorized:h,isLoading:a}),e.jsx("br",{}),e.jsx(L,{nextPageHandler:()=>g(2),disabled:!h})]})]})}function re({formFields:i,setIntegration:s,integrations:t,allIntegURL:g}){const x=C(),{formID:d}=T(),[h,p]=o.useState(!1),[r,u]=o.useState(1),[j,n]=o.useState({show:!1}),[a,m]=o.useState({name:"Mail Poet",type:"Mail Poet",field_map:[{formField:"",mailPoetField:""}],actions:{}}),f=c=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),c===3){if(!D(a)){n({show:!0,msg:"Please map all required fields to continue."});return}a.name!==""&&a.field_map.length>0&&u(c)}else u(c),c===2&&a.name&&R(d,a,m,p,n)};return e.jsxs("div",{children:[e.jsx(F,{snack:j,setSnackbar:n}),e.jsx("div",{className:"txt-center w-9 mt-2 cal-width"}),e.jsx(G,{formID:d,mailPoetConf:a,setMailPoetConf:m,step:r,nextPage:f,isLoading:h,setisLoading:p,setSnackbar:n}),e.jsxs("div",{className:"btcd-stp-page",style:{width:r===2&&900,height:r===2&&"100%",minHeight:r===2&&"200px"},children:[e.jsx(q,{formID:d,formFields:i,mailPoetConf:a,setMailPoetConf:m,setSnackbar:n}),e.jsx("br",{}),e.jsx("br",{}),e.jsx("br",{}),e.jsx(L,{nextPageHandler:()=>f(3),disabled:a.lists===""||a.field_map.length<1})]}),e.jsx(B,{step:r,saveConfig:()=>E(t,s,g,a,x)})]})}export{re as default};
