import{j as t,_ as f}from"./main.2.8.10.js";import{u as j,e as S,b as r}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as A}from"./BackIcn.BFDZx8No.js";import{S as C}from"./SnackMsg.7BjcJK1j.js";import{S as I}from"./Steps.B84Ui3GU.js";import{I as k,s as v}from"./Integrations.BFhED4ck.js";import N from"./AutonamiAuthorization.BnXfe7FE.js";import{A as _,g as y,c as w}from"./AutonamiIntegLayout.B5V210nR.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function Q({formFields:m,setFlow:d,flow:g,allIntegURL:x}){const h=j(),{formID:p}=S(),[c,i]=r.useState(!1),[e,l]=r.useState(1),[b,a]=r.useState({show:!1}),[s,o]=r.useState({name:"Autonami",type:"Autonami",field_map:[{formField:"",autonamiField:""}],actions:{}}),u=n=>{if(n==2&&s.name!=="")y(s,o,i,a),l(n);else if(n==3){if(!w(s)){a({show:!0,msg:f("Please map all required fields to continue.","bit-integrations")});return}s.field_map.length>0&&l(n)}document.getElementById("btcd-settings-wrp").scrollTop=0};return t.jsxs("div",{children:[t.jsx(C,{snack:b,setSnackbar:a}),t.jsx("div",{className:"txt-center mt-2",children:t.jsx(I,{step:3,active:e})}),t.jsx(N,{formID:p,autonamiConf:s,setAutonamiConf:o,step:e,nextPage:u,isLoading:c,setIsLoading:i,setSnackbar:a}),t.jsxs("div",{className:"btcd-stp-page",style:{width:e===2&&900,height:e===2&&"auto",minHeight:e===2&&"500px"},children:[t.jsx(_,{formID:p,formFields:m,autonamiConf:s,setAutonamiConf:o,setIsLoading:i,setSnackbar:a}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>u(3),disabled:s.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[f("Next","bit-integrations"),t.jsx(A,{className:"ml-1 rev-icn"})]})]}),t.jsx(k,{step:e,saveConfig:()=>v({flow:g,setFlow:d,allIntegURL:x,conf:s,navigate:h,setIsLoading:i,setSnackbar:a}),isLoading:c,dataConf:s,setDataConf:o,formFields:m})]})}export{Q as default};
