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