var w=Object.defineProperty;var v=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var j=(s,e,t)=>e in s?w(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,M=(s,e)=>{for(var t in e||(e={}))I.call(e,t)&&j(s,t,e[t]);if(v)for(var t of v(e))T.call(e,t)&&j(s,t,e[t]);return s};import{j as r,_ as m,z as o}from"./main.2.8.10.js";import{u as P,b as i}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as z}from"./SnackMsg.7BjcJK1j.js";import{S as E}from"./Steps.B84Ui3GU.js";import{I as F,g as L}from"./Integrations.BFhED4ck.js";import{a as G,c as k}from"./SureMembersCommonFunc.5YJXeI2l.js";import{S as A}from"./SureMembersIntegLayout.P7YPiQyL.js";import B from"./SureMembersAuthorization.BRQYNj5C.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";import"./TutorialLink.D6K_DiHL.js";function se({formFields:s,setFlow:e,flow:t,allIntegURL:u}){const d=P(),[C,f]=i.useState(!1),[g,b]=i.useState({auth:!1,groups:!1}),[n,S]=i.useState(1),[y,p]=i.useState({show:!1}),[a,l]=i.useState({name:"SureMembers",type:"SureMembers",field_map:[{formField:"",sureMembersField:"email"}],staticFields:G,selectedTask:"",groups:[],selectedGroup:""}),N=()=>{f(!0),L(t,e,u,a,d,"","",f).then(c=>{var h;c.success?(o.success((h=c.data)==null?void 0:h.msg),d(u)):o.error(c.data||c)})},_=x=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!a.selectedTask){o.error(m("Please select a task!","bit-integrations"));return}if(!k(a)){o.error(m("Please map mandatory fields!","bit-integrations"));return}if(!a.selectedGroup){o.error(m("Please select a group!","bit-integrations"));return}a.field_map.length>0&&S(x)};return r.jsxs("div",{children:[r.jsx(z,{snack:y,setSnackbar:p}),r.jsx("div",{className:"txt-center mt-2",children:r.jsx(E,{step:3,active:n})}),r.jsx(B,{sureMembersConf:a,setSureMembersConf:l,step:n,setStep:S,loading:g,setLoading:b,setSnackbar:p}),r.jsxs("div",{className:"btcd-stp-page",style:M({},n===2&&{width:900,height:"auto",overflow:"visible"}),children:[r.jsx(A,{formFields:s,sureMembersConf:a,setSureMembersConf:l,loading:g,setLoading:b,setSnackbar:p}),r.jsxs("button",{onClick:()=>_(3),disabled:!k(a),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[m("Next","bit-integrations"),"  ",r.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),r.jsx(F,{step:n,saveConfig:()=>N(),isLoading:C,dataConf:a,setDataConf:l,formFields:s})]})}export{se as default};
