import{j as t,_ as g}from"./main.2.8.10.js";import{u as h,e as B,b as n}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as j}from"./BackIcn.BFDZx8No.js";import{S as K}from"./SnackMsg.7BjcJK1j.js";import{I as S,g as I}from"./Integrations.BFhED4ck.js";import k from"./B2BKingAuthorization.DVRABxNX.js";import{B as _,c as v}from"./B2BKingIntegLayout.FQmWFf8e.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 J({formFields:l,setFlow:d,flow:f,allIntegURL:u}){const b=h(),{formID:y}=B(),[o,a]=n.useState(!1),[s,m]=n.useState(1),[x,i]=n.useState({show:!1}),[e,p]=n.useState({name:"B2BKing",type:"B2BKing",field_map:[{formField:"",b2bKingField:""}],b2bKingFields:[],mainAction:"",utilities:{}}),c=r=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),r===3){if(!v(e)){i({show:!0,msg:g("Please map all required fields to continue.","bit-integrations")});return}e.mainAction!==""&&e.field_map.length>0&&m(r)}else m(r)};return t.jsxs("div",{children:[t.jsx(K,{snack:x,setSnackbar:i}),t.jsx(k,{b2bKingConf:e,setB2BKingConf:p,step:s,nextPage:c,isLoading:o,setIsLoading:a,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(_,{formFields:l,b2bKingConf:e,setB2BKingConf:p,setSnackbar:i,setIsLoading:a,isLoading:o}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>c(3),disabled:e.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[g("Next","bit-integrations"),t.jsx(j,{className:"ml-1 rev-icn"})]})]}),t.jsx(S,{step:s,saveConfig:()=>I(f,d,u,e,b,"","",a),isLoading:o})]})}export{J as default};
