import{j as t,_ as d}from"./main.2.8.10.js";import{u as y,e as j,b as o}from"./react-router.DMwpH23k.js";import{B as C}from"./BackIcn.BFDZx8No.js";import{S as F}from"./SnackMsg.7BjcJK1j.js";import{I,g as S}from"./Integrations.BFhED4ck.js";import _ from"./FormyChatAuthorization.B4Tqjm1_.js";import{F as k,c as v}from"./FormyChatIntegLayout.CqInuEIZ.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./CopyIcn.BnhKHfEP.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./ProUtilHelpers.CtRYkgop.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";import"./GlobalIntegrationHelper.Belqr4OT.js";function G({formFields:f,setFlow:g,flow:h,allIntegURL:u}){const x=y(),{formID:n}=j(),[i,r]=o.useState(!1),[s,p]=o.useState(1),[b,a]=o.useState({show:!1}),[e,l]=o.useState({name:"FormyChat",type:"FormyChat",widgetId:"",mainAction:"",field_map:[{formField:"",formyChatField:""}],actions:{},allWidgets:[],allFields:[],meta_map:[{formField:"",metaKey:""}]}),c=m=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),m===3){if(!v(e)){a({show:!0,msg:d("Please map all required fields to continue.","bit-integrations")});return}e.name!==""&&e.field_map.length>0&&p(m)}else p(m)};return t.jsxs("div",{children:[t.jsx(F,{snack:b,setSnackbar:a}),t.jsx(_,{formID:n,formyChatConf:e,setFormyChatConf:l,step:s,nextPage:c,isLoading:i,setIsLoading:r,setSnackbar:a}),t.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto",minHeight:s===2&&"500px"},children:[t.jsx(k,{formID:n,formFields:f,formyChatConf:e,setFormyChatConf:l,setSnackbar:a,setIsLoading:r,isLoading:i}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>c(3),disabled:e.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[d("Next","bit-integrations"),t.jsx(C,{className:"ml-1 rev-icn"})]})]}),t.jsx(I,{step:s,saveConfig:()=>S(h,g,u,e,x,"","",r),isLoading:i})]})}export{G as default};
