import{j as t,_ as f}from"./main.2.9.0.js";import{u as C,e as y,b as o}from"./react-router.DMwpH23k.js";import{B as j}from"./BackIcn._8Wofmn2.js";import{S as F}from"./SnackMsg.DYSD96P4.js";import{I,g as S}from"./Integrations.DL8wqGct.js";import _ from"./FormyChatAuthorization.BgGVZ8xo.js";import{F as k,c as v}from"./FormyChatIntegLayout.BE81CPAn.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./CopyIcn.CEA_lFLo.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./ProUtilHelpers.CHf_DzPf.js";import"./TagifyInput.KPPRQJ1B.js";import"./lodash.DCvQBX3r.js";import"./GlobalIntegrationHelper.B6YI8w_n.js";function G({formFields:p,setFlow:g,flow:h,allIntegURL:u}){const x=C(),{formID:l}=y(),[i,r]=o.useState(!1),[s,c]=o.useState(1),[b,a]=o.useState({show:!1}),[e,n]=o.useState({name:"FormyChat",type:"FormyChat",widgetId:"",mainAction:"",field_map:[{formField:"",formyChatField:""}],actions:{},allWidgets:[],allFields:[],meta_map:[{formField:"",metaKey:""}]}),d=m=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),m===3){if(!v(e)){a({show:!0,msg:f("Please map all required fields to continue.","bit-integrations")});return}e.name!==""&&e.field_map.length>0&&c(m)}else c(m)};return t.jsxs("div",{children:[t.jsx(F,{snack:b,setSnackbar:a}),t.jsx(_,{formID:l,formyChatConf:e,setFormyChatConf:n,step:s,nextPage:d,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:l,formFields:p,formyChatConf:e,setFormyChatConf:n,setSnackbar:a,setIsLoading:r,isLoading:i}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>d(3),disabled:e.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[f("Next","bit-integrations"),t.jsx(j,{className:"ml-1 rev-icn"})]})]}),t.jsx(I,{step:s,saveConfig:()=>S(h,g,u,e,x,"","",r),isLoading:i,dataConf:e,setDataConf:n,formFields:p})]})}export{G as default};
