var L=Object.defineProperty;var w=Object.getOwnPropertySymbols;var v=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var I=(i,s,t)=>s in i?L(i,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[s]=t,b=(i,s)=>{for(var t in s||(s={}))v.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 n,j as e,_ as N,L as k,bm as _,c as A,G as C,g as F,S as T}from"./main-343.js";import"./bf-649-79.js";import{a5 as E,a6 as B,a7 as H}from"./bf-659-81.js";import{I as $}from"./bf-58-184.js";import{N as y}from"./bf-713-109.js";import{t as M}from"./bf-974-82.js";import{M as q,c as D,r as G}from"./bf-857-212.js";import"./bf-594-113.js";function R({mailPoetConf:i,setMailPoetConf:s,step:t,nextPage:x,setSnackbar:f,isInfo:d}){const[h,u]=n.useState(!1),[o,g]=n.useState({integrationName:""}),[j,r]=n.useState(!1),[a,m]=n.useState(!1),p=()=>{m("auth"),A({},"bitforms_mail_poet_authorize").then(l=>{l!=null&&l.success&&(u(!0),f({show:!0,msg:N("Authorized Successfully")})),r(!0),m(!1)})},c=l=>{const P=b({},i),S=b({},o);S[l.target.name]="",P[l.target.name]=l.target.value,g(S),s(P)};return e.jsxs(e.Fragment,{children:[e.jsx(E,{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(_,{size:"15"})}),"Please! First Install Mailpoet Plugins"]}),e.jsx(B,{handleAuthorize:p,isAuthorized:h,isLoading:a}),e.jsx("br",{}),e.jsx(y,{nextPageHandler:()=>x(2),disabled:!h})]})]})}function Z({formFields:i,setIntegration:s,integrations:t,allIntegURL:x}){const f=C(),{formID:d}=F(),[h,u]=n.useState(!1),[o,g]=n.useState(1),[j,r]=n.useState({show:!1}),[a,m]=n.useState({name:"Mail Poet",type:"Mail Poet",field_map:[{formField:"",mailPoetField:""}],actions:{}}),p=c=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),c===3){if(!D(a)){r({show:!0,msg:"Please map all required fields to continue."});return}a.name!==""&&a.field_map.length>0&&g(c)}else g(c),c===2&&a.name&&G(d,a,m,u,r)};return e.jsxs("div",{children:[e.jsx(T,{snack:j,setSnackbar:r}),e.jsx("div",{className:"txt-center w-9 mt-2 cal-width"}),e.jsx(R,{formID:d,mailPoetConf:a,setMailPoetConf:m,step:o,nextPage:p,isLoading:h,setisLoading:u,setSnackbar:r}),e.jsxs("div",{className:"btcd-stp-page",style:{width:o===2&&900,height:o===2&&"100%",minHeight:o===2&&"200px"},children:[e.jsx(q,{formID:d,formFields:i,mailPoetConf:a,setMailPoetConf:m,setSnackbar:r}),e.jsx("br",{}),e.jsx("br",{}),e.jsx("br",{}),e.jsx(y,{nextPageHandler:()=>p(3),disabled:a.lists===""||a.field_map.length<1})]}),e.jsx($,{step:o,saveConfig:()=>H(t,s,x,a,f)})]})}export{Z as default};
