import{j as t,_ as d}from"./main.2.8.10.js";import{u as b,e as j,b as i}from"./react-router.DMwpH23k.js";import{B as v}from"./BackIcn.BFDZx8No.js";import{S as y}from"./SnackMsg.7BjcJK1j.js";import{I as F,g as S}from"./Integrations.BFhED4ck.js";import k from"./IvyFormsAuthorization.YZznYMjW.js";import{I as _,c as C}from"./IvyFormsIntegLayout.B_DCywao.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./CopyIcn.BnhKHfEP.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 K({formFields:f,setFlow:g,flow:u,allIntegURL:x}){const h=b(),{formID:m}=j(),[r,a]=i.useState(!1),[e,p]=i.useState(1),[I,o]=i.useState({show:!1}),[s,l]=i.useState({name:"IvyForms",type:"IvyForms",formId:"",mainAction:"",field_map:[{formField:"",ivyFormsField:""}],actions:{},allForms:[],allFields:[]}),c=n=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),n===3){if(!C(s)){o({show:!0,msg:d("Please map all required fields to continue.","bit-integrations")});return}s.name!==""&&s.field_map.length>0&&p(n)}else p(n)};return t.jsxs("div",{children:[t.jsx(y,{snack:I,setSnackbar:o}),t.jsx(k,{formID:m,ivyFormsConf:s,setIvyFormsConf:l,step:e,nextPage:c,isLoading:r,setIsLoading:a,setSnackbar:o}),t.jsxs("div",{className:"btcd-stp-page",style:{width:e===2&&900,height:e===2&&"auto",minHeight:e===2&&"500px"},children:[t.jsx(_,{formID:m,formFields:f,ivyFormsConf:s,setIvyFormsConf:l,setSnackbar:o,setIsLoading:a,isLoading:r}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>c(3),disabled:s.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[d("Next","bit-integrations"),t.jsx(v,{className:"ml-1 rev-icn"})]})]}),t.jsx(F,{step:e,saveConfig:()=>S(u,g,x,s,h,"","",a),isLoading:r})]})}export{K as default};
