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