import{j as t,_ as l}from"./main.2.9.0.js";import{u as j,e as C,b as a}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as S}from"./BackIcn._8Wofmn2.js";import{S as M}from"./SnackMsg.DYSD96P4.js";import{S as v}from"./Steps.BYe8zHkm.js";import{I as R,g as H}from"./Integrations.DL8wqGct.js";import I from"./HefflCRMAuthorization.CdHIZ149.js";import{c as k}from"./HefflCRMCommonFunc.CnwvFLUw.js";import{H as _}from"./HefflCRMIntegLayout.CgqjYAba.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./ProUtilHelpers.CHf_DzPf.js";import"./TagifyInput.KPPRQJ1B.js";import"./lodash.DCvQBX3r.js";import"./GlobalIntegrationHelper.B6YI8w_n.js";function U({formFields:m,setFlow:c,flow:d,allIntegURL:g}){const u=j(),{formID:f}=C(),[i,o]=a.useState(!1),[s,p]=a.useState(1),[x,n]=a.useState({show:!1}),[e,r]=a.useState({name:"Heffl CRM",type:"Heffl CRM",api_key:"",field_map:[{formField:"",hefflCRMField:""}],actions:{},mainAction:""}),h=b=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300);{if(!k(e)){n({show:!0,msg:l("Please map all required fields to continue.","bit-integrations")});return}e.name!==""&&e.field_map.length>0&&p(b)}};return t.jsxs("div",{children:[t.jsx(M,{snack:x,setSnackbar:n}),t.jsx("div",{className:"txt-center mt-2",children:t.jsx(v,{step:3,active:s})}),t.jsx(I,{formID:f,hefflCRMConf:e,setHefflCRMConf:r,step:s,setStep:p,isLoading:i,setIsLoading:o,setSnackbar:n}),t.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto",minHeight:s===2&&"500px"},children:[t.jsx(_,{formID:f,formFields:m,hefflCRMConf:e,setHefflCRMConf:r,isLoading:i,setIsLoading:o}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>h(3),disabled:e.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[l("Next","bit-integrations"),t.jsx(S,{className:"ml-1 rev-icn"})]})]}),t.jsx(R,{step:s,saveConfig:()=>H(d,c,g,e,u,"","",o),isLoading:i,dataConf:e,setDataConf:r,formFields:m})]})}export{U as default};
