import{j as t,_ as p}from"./main.2.8.10.js";import{u as j,e as C,b as i}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as S}from"./BackIcn.BFDZx8No.js";import{S as M}from"./SnackMsg.7BjcJK1j.js";import{S as v}from"./Steps.B84Ui3GU.js";import{I as R,g as H}from"./Integrations.BFhED4ck.js";import I from"./HefflCRMAuthorization.C6YExqd3.js";import{c as k}from"./HefflCRMCommonFunc.AEI1d-dd.js";import{H as _}from"./HefflCRMIntegLayout.BL7MRrnh.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./ProUtilHelpers.CtRYkgop.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";import"./GlobalIntegrationHelper.Belqr4OT.js";function U({formFields:l,setFlow:c,flow:d,allIntegURL:g}){const u=j(),{formID:n}=C(),[a,o]=i.useState(!1),[s,m]=i.useState(1),[x,r]=i.useState({show:!1}),[e,f]=i.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)){r({show:!0,msg:p("Please map all required fields to continue.","bit-integrations")});return}e.name!==""&&e.field_map.length>0&&m(b)}};return t.jsxs("div",{children:[t.jsx(M,{snack:x,setSnackbar:r}),t.jsx("div",{className:"txt-center mt-2",children:t.jsx(v,{step:3,active:s})}),t.jsx(I,{formID:n,hefflCRMConf:e,setHefflCRMConf:f,step:s,setStep:m,isLoading:a,setIsLoading:o,setSnackbar:r}),t.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto",minHeight:s===2&&"500px"},children:[t.jsx(_,{formID:n,formFields:l,hefflCRMConf:e,setHefflCRMConf:f,isLoading:a,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:[p("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:a})]})}export{U as default};
