var E=Object.defineProperty;var y=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var v=(s,t,e)=>t in s?E(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,j=(s,t)=>{for(var e in t||(t={}))F.call(t,e)&&v(s,e,t[e]);if(y)for(var e of y(t))z.call(t,e)&&v(s,e,t[e]);return s};import{_ as c,j as a,z as p}from"./main.2.8.10.js";import{u as L,b as o}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as T}from"./SnackMsg.7BjcJK1j.js";import{S as q}from"./Steps.B84Ui3GU.js";import{I as B,g as M}from"./Integrations.BFhED4ck.js";import P from"./SmailyAuthorization.Bm0-G35K.js";import{h as A,c as _}from"./SmailyCommonFunc.MDX9uQzb.js";import{S as D}from"./SmailyIntegLayout.34vWIMko.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";function et({formFields:s,setFlow:t,flow:e,allIntegURL:u}){const f=L(),[k,g]=o.useState(!1),[b,h]=o.useState({auth:!1}),[n,S]=o.useState(1),[C,d]=o.useState({show:!1}),I=[{key:"email",label:c("Email","bit-integrations"),required:!0},{key:"birthday",label:c("Birthday","bit-integrations"),required:!1}],[i,r]=o.useState({name:"Smaily",type:"Smaily",subdomain:"",api_user_name:"",api_user_password:"",field_map:[{formField:"",smailyFormField:""}],staticFields:I,actions:{}}),w=()=>{g(!0),M(e,t,u,i,f,"","",g).then(l=>{var x;l.success?(p.success((x=l.data)==null?void 0:x.msg),f(u)):p.error(l.data||l)})},N=m=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!_(i)){p.error(c("Please map mandatory fields","bit-integrations"));return}i.field_map.length>0&&S(m)};return a.jsxs("div",{children:[a.jsx(T,{snack:C,setSnackbar:d}),a.jsx("div",{className:"txt-center mt-2",children:a.jsx(q,{step:3,active:n})}),a.jsx(P,{smailyConf:i,setSmailyConf:r,step:n,setStep:S,loading:b,setLoading:h,setSnackbar:d}),a.jsxs("div",{className:"btcd-stp-page",style:j({},n===2&&{width:900,height:"auto",overflow:"visible"}),children:[a.jsx(D,{formFields:s,handleInput:m=>A(m,i,r),smailyConf:i,setSmailyConf:r,loading:b,setLoading:h,setSnackbar:d}),a.jsxs("button",{onClick:()=>N(3),disabled:!_(i),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[c("Next","bit-integrations"),"  ",a.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),a.jsx(B,{step:n,saveConfig:()=>w(),isLoading:k,dataConf:i,setDataConf:r,formFields:s})]})}export{et as default};
