import{h as d,$ as B,g as I,k as v,i as _,j as e,_ as l}from"./main.2.8.10.js";import{u as k,e as y,b as a}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as F}from"./SnackMsg.7BjcJK1j.js";import{S as N}from"./Steps.B84Ui3GU.js";import{l as Z,I as C,s as E}from"./Integrations.BFhED4ck.js";import{h as L,c as P}from"./ZohoBiginCommonFunc.wTR0pbLu.js";import{Z as R}from"./ZohoBiginIntegLayout.BsQHFqTw.js";import T from"./ZohoBiginAuthorization.CkFE2UVq.js";import{B as $}from"./BackIcn.BFDZx8No.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TabPanel.B3Zpgnvr.js";import"./ActionProFeatureLabels.BzMNdAoD.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";import"./TutorialLink.D6K_DiHL.js";function ot({allIntegURL:f}){const u=k(),{formID:r}=y(),[h,g]=d(B),[m,i]=a.useState(!1),[o,c]=a.useState(1),[x,s]=a.useState({show:!1}),[p,j]=a.useState(0),[t,n]=d(I),b=v(_);a.useEffect(()=>{window.opener&&Z("zohoBigin"),n({name:"Zoho Bigin",type:"Zoho Bigin",clientId:"",clientSecret:"",module:"",field_map:[{formField:"",zohoFormField:""}],relatedlists:[],actions:{}})},[]);const w=()=>{if(!P(t)){s({show:!0,msg:l("Please map mandatory fields","bit-integrations")});return}if((t==null?void 0:t.module)==="Deals"&&!(t!=null&&t.pLayout)){s({show:!0,msg:l("Please select a layout","bit-integrations")});return}setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),t.module!==""&&t.field_map.length>0&&c(3)};return e.jsxs("div",{children:[e.jsx(F,{snack:x,setSnackbar:s}),e.jsx("div",{className:"txt-center mt-2",children:e.jsx(N,{step:3,active:o})}),e.jsx(T,{formID:r,biginConf:t,setBiginConf:n,step:o,setstep:c,isLoading:m,setIsLoading:i,setSnackbar:s}),e.jsxs("div",{className:"btcd-stp-page",style:{width:o===2&&900,height:o===2&&"auto"},children:[e.jsx(R,{tab:p,settab:j,formID:r,handleInput:S=>L(S,p,t,n,r,i,s),isLoading:m,setIsLoading:i,setSnackbar:s}),e.jsxs("button",{onClick:()=>w(),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[l("Next","bit-integrations"),e.jsx($,{className:"ml-1 rev-icn"})]})]}),e.jsx(C,{step:o,saveConfig:()=>E({flow:h,setFlow:g,allIntegURL:f,conf:t,navigate:u,setIsLoading:i,setSnackbar:s}),isLoading:m,dataConf:t,setDataConf:n,formFields:b})]})}export{ot as default};
