var N=Object.defineProperty;var h=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var v=(t,e,s)=>e in t?N(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,j=(t,e)=>{for(var s in e||(e={}))w.call(e,s)&&v(t,s,e[s]);if(h)for(var s of h(e))I.call(e,s)&&v(t,s,e[s]);return t};import{u as T,r as o,j as a}from"./main-406.js";import{d as P,_ as E,I as F,G,c as i}from"./bi.394.85.js";import{S as L}from"./bi.68.941.js";import{a as z,c as M}from"./bi.787.936.js";import{S as A}from"./bi.231.937.js";import B from"./bi.115.341.js";import"./bi.704.707.js";import"./bi.701.708.js";import"./bi.150.760.js";function X({formFields:t,setFlow:e,flow:s,allIntegURL:d}){const u=T(),[k,p]=o.useState(!1),[f,g]=o.useState({auth:!1,groups:!1}),[n,b]=o.useState(1),[C,l]=o.useState({show:!1}),[r,m]=o.useState({name:"SureMembers",type:"SureMembers",field_map:[{formField:"",sureMembersField:"email"}],staticFields:z,selectedTask:"",groups:[],selectedGroup:""}),_=()=>{p(!0),G(s,e,d,r,u,"","",p).then(c=>{var S;c.success?(i.success((S=c.data)==null?void 0:S.msg),u(d)):i.error(c.data||c)})},y=x=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!r.selectedTask){i.error("Please select a task!");return}if(!M(r)){i.error("Please map mandatory fields!");return}if(!r.selectedGroup){i.error("Please select a group!");return}r.field_map.length>0&&b(x)};return a.jsxs("div",{children:[a.jsx(P,{snack:C,setSnackbar:l}),a.jsx("div",{className:"txt-center mt-2",children:a.jsx(L,{step:3,active:n})}),a.jsx(B,{sureMembersConf:r,setSureMembersConf:m,step:n,setStep:b,loading:f,setLoading:g,setSnackbar:l}),a.jsxs("div",{className:"btcd-stp-page",style:j({},n===2&&{width:900,height:"auto",overflow:"visible"}),children:[a.jsx(A,{formFields:t,sureMembersConf:r,setSureMembersConf:m,loading:f,setLoading:g,setSnackbar:l}),a.jsxs("button",{onClick:()=>y(3),disabled:!M(r),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[E("Next","bit-integrations")," "," ",a.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),a.jsx(F,{step:n,saveConfig:()=>_(),isLoading:k,dataConf:r,setDataConf:m,formFields:t})]})}export{X as default};
