var I=Object.defineProperty;var y=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var S=(s,t,e)=>t in s?I(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,v=(s,t)=>{for(var e in t||(t={}))N.call(t,e)&&S(s,e,t[e]);if(y)for(var e of y(t))w.call(t,e)&&S(s,e,t[e]);return s};import{_ as m,j as a,z as f}from"./main.2.8.1.js";import{u as E,d as p}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{S as z}from"./SnackMsg.S8DrwLlT.js";import{S as F}from"./Steps.1hz7v9Vj.js";import{I as T,g as q}from"./Integrations.D2bgBas2.js";import L from"./SendyAuthorization.6p2HW4bS.js";import{S as M,h as P,c as A}from"./SendyIntegLayout.BFDz-jRc.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./BackIcn._kGL_vVw.js";import"./tutorialLinks.kMkIDzcD.js";import"./TutorialLink.BAFX--T3.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";import"./CustomFieldKey.V0UvzBSi.js";function st({formFields:s,setFlow:t,flow:e,allIntegURL:g}){const b=E(),[l,n]=p.useState(!1),[o,h]=p.useState(1),[j,u]=p.useState({show:!1}),k=[{key:"email",label:m("Email","bit-integrations"),required:!0},{key:"name",label:m("Name","bit-integrations"),required:!1}],[i,r]=p.useState({name:"Sendy",type:"Sendy",api_key:"",sendy_url:"",field_map:[{formField:"",sendyField:""}],subscriberFields:k,actions:{}}),C=()=>{n(!0),q(e,t,g,i,b,"","",n).then(d=>{var x;d.success?(f.success((x=d.data)==null?void 0:x.msg),b(g)):f.error(d.data||d)})},_=c=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!A(i)){f.error(m("Please map mandatory fields","bit-integrations"));return}i.field_map.length>0&&h(c)};return a.jsxs("div",{children:[a.jsx(z,{snack:j,setSnackbar:u}),a.jsx("div",{className:"txt-center mt-2",children:a.jsx(F,{step:3,active:o})}),a.jsx(L,{sendyConf:i,setSendyConf:r,step:o,setstep:h,isLoading:l,setIsLoading:n,setSnackbar:u}),a.jsxs("div",{className:"btcd-stp-page",style:v({},o===2&&{width:900,height:"auto",overflow:"visible"}),children:[a.jsx(M,{formFields:s,handleInput:c=>P(c,i,r),sendyConf:i,setSendyConf:r,isLoading:l,setIsLoading:n,setSnackbar:u}),a.jsxs("button",{onClick:()=>_(3),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[m("Next","bit-integrations"),"  ",a.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),a.jsx(T,{step:o,saveConfig:()=>C(),isLoading:l,dataConf:i,setDataConf:r,formFields:s})]})}export{st as default};
