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.9.0.js";import{u as L,b as o}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{S as T}from"./SnackMsg.DYSD96P4.js";import{S as q}from"./Steps.BYe8zHkm.js";import{I as B,g as M}from"./Integrations.DL8wqGct.js";import P from"./SmailyAuthorization.E8zzv_Mh.js";import{h as A,c as _}from"./SmailyCommonFunc.yvxZWI_v.js";import{S as D}from"./SmailyIntegLayout.DoH9X8JV.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TutorialLink.CFG7bS5c.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};
