import{j as t,_ as l}from"./main.2.9.0.js";import{u as h,b as i}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 B,g as P}from"./Integrations.DL8wqGct.js";import S from"./BookingPressAuthorization.l6r9nhFv.js";import{B as C,c as I}from"./BookingPressIntegLayout.DARE9jYM.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TutorialLink.CFG7bS5c.js";import"./ProUtilHelpers.CHf_DzPf.js";import"./TagifyInput.KPPRQJ1B.js";import"./lodash.DCvQBX3r.js";import"./GlobalIntegrationHelper.B6YI8w_n.js";function J({formFields:p,setFlow:d,flow:f,allIntegURL:u}){const x=h(),[n,a]=i.useState(!1),[e,c]=i.useState(1),[b,o]=i.useState({show:!1}),[s,r]=i.useState({name:"BookingPress",type:"BookingPress",field_map:[{formField:"",bookingPressField:""}],mainAction:""}),g=m=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),m===3){if(!I(s)){o({show:!0,msg:l("Please map all required fields to continue.","bit-integrations")});return}s.name!==""&&s.field_map.length>0&&c(m)}else c(m)};return t.jsxs("div",{children:[t.jsx(k,{snack:b,setSnackbar:o}),t.jsx("div",{className:"txt-center mt-2"}),t.jsx(S,{bookingPressConf:s,setBookingPressConf:r,step:e,nextPage:g,isLoading:n,setIsLoading:a,setSnackbar:o}),t.jsxs("div",{className:"btcd-stp-page",style:{width:e===2&&900,height:e===2&&"auto",minHeight:e===2&&"500px"},children:[t.jsx(C,{formFields:p,bookingPressConf:s,setBookingPressConf:r,setSnackbar:o,setIsLoading:a,isLoading:n}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>g(3),disabled:s.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(B,{step:e,saveConfig:()=>P(f,d,u,s,x,"","",a),isLoading:n,dataConf:s,setDataConf:r,formFields:p})]})}export{J as default};
