import{j as t,_ as f}from"./main.2.8.1.js";import{u as b,h as S,d as r}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{B as A}from"./BackIcn._kGL_vVw.js";import{S as C}from"./SnackMsg.S8DrwLlT.js";import{S as I}from"./Steps.1hz7v9Vj.js";import{I as k,s as v}from"./Integrations.D2bgBas2.js";import N from"./AutonamiAuthorization.UFN6bW0f.js";import{A as _,g as y,c as w}from"./AutonamiIntegLayout.ffjezF7I.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./TutorialLink.BAFX--T3.js";import"./tutorialLinks.kMkIDzcD.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";function O({formFields:m,setFlow:d,flow:g,allIntegURL:x}){const h=b(),{formID:p}=S(),[c,i]=r.useState(!1),[e,l]=r.useState(1),[j,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:j,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&&"200px"},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{O as default};
