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.1.js";import{u as P,d as i}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{S as z}from"./SnackMsg.S8DrwLlT.js";import{S as E}from"./Steps.1hz7v9Vj.js";import{I as F,g as L}from"./Integrations.D2bgBas2.js";import{a as G,c as k}from"./SureMembersCommonFunc.DBuWtYQU.js";import{S as A}from"./SureMembersIntegLayout.XcJb5zSk.js";import B from"./SureMembersAuthorization.njTgvoHL.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";import"./tutorialLinks.kMkIDzcD.js";import"./TutorialLink.BAFX--T3.js";function se({formFields:s,setFlow:e,flow:t,allIntegURL:d}){const u=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,d,a,u,"","",f).then(c=>{var h;c.success?(o.success((h=c.data)==null?void 0:h.msg),u(d)):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};
