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