import{j as t,_ as f}from"./main.2.9.0.js";import{u as j,e as S,b as r}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as A}from"./BackIcn._8Wofmn2.js";import{S as C}from"./SnackMsg.DYSD96P4.js";import{S as I}from"./Steps.BYe8zHkm.js";import{I as k,s as v}from"./Integrations.DL8wqGct.js";import N from"./AutonamiAuthorization.BJ_D8L1_.js";import{A as _,g as y,c as w}from"./AutonamiIntegLayout.I93tResP.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TutorialLink.CFG7bS5c.js";import"./TagifyInput.KPPRQJ1B.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};
