import{j as t,_ as d}from"./main.2.9.0.js";import{u as b,e as j,b as i}from"./react-router.DMwpH23k.js";import{B as v}from"./BackIcn._8Wofmn2.js";import{S as y}from"./SnackMsg.DYSD96P4.js";import{I as F,g as S}from"./Integrations.DL8wqGct.js";import C from"./IvyFormsAuthorization.BY4SicBr.js";import{I as k,c as _}from"./IvyFormsIntegLayout.B2n4BFVD.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./CopyIcn.CEA_lFLo.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 K({formFields:p,setFlow:g,flow:u,allIntegURL:x}){const h=b(),{formID:l}=j(),[a,r]=i.useState(!1),[e,c]=i.useState(1),[I,o]=i.useState({show:!1}),[s,n]=i.useState({name:"IvyForms",type:"IvyForms",formId:"",mainAction:"",field_map:[{formField:"",ivyFormsField:""}],actions:{},allForms:[],allFields:[]}),f=m=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),m===3){if(!_(s)){o({show:!0,msg:d("Please map all required fields to continue.","bit-integrations")});return}s.name!==""&&s.field_map.length>0&&c(m)}else c(m)};return t.jsxs("div",{children:[t.jsx(y,{snack:I,setSnackbar:o}),t.jsx(C,{formID:l,ivyFormsConf:s,setIvyFormsConf:n,step:e,nextPage:f,isLoading:a,setIsLoading:r,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(k,{formID:l,formFields:p,ivyFormsConf:s,setIvyFormsConf:n,setSnackbar:o,setIsLoading:r,isLoading:a}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>f(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,"","",r),isLoading:a,dataConf:s,setDataConf:n,formFields:p})]})}export{K as default};
