import{u as I,k as S,d as p,r as a,h as v,j as e}from"./main-406.js";import{$ as _,g as k,h as y,Z as F,d as Z,_ as l,I as N,s as C}from"./bi.394.85.js";import{S as E}from"./bi.68.941.js";import{h as L,c as P}from"./bi.679.710.js";import{Z as R}from"./bi.298.711.js";import T from"./bi.128.238.js";import{B as $}from"./bi.46.744.js";import"./bi.499.712.js";import"./bi.704.707.js";import"./bi.701.708.js";import"./bi.150.760.js";function U({allIntegURL:u}){const f=I(),{formID:r}=S(),[h,g]=p(_),[c,i]=a.useState(!1),[o,m]=a.useState(1),[x,s]=a.useState({show:!1}),[d,j]=a.useState(0),[t,n]=p(k),w=v(y);a.useEffect(()=>{window.opener&&F("zohoBigin"),n({name:"Zoho Bigin",type:"Zoho Bigin",clientId:"",clientSecret:"",module:"",field_map:[{formField:"",zohoFormField:""}],relatedlists:[],actions:{}})},[]);const b=()=>{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&&m(3)};return e.jsxs("div",{children:[e.jsx(Z,{snack:x,setSnackbar:s}),e.jsx("div",{className:"txt-center mt-2",children:e.jsx(E,{step:3,active:o})}),e.jsx(T,{formID:r,biginConf:t,setBiginConf:n,step:o,setstep:m,isLoading:c,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:d,settab:j,formID:r,handleInput:B=>L(B,d,t,n,r,i,s),isLoading:c,setIsLoading:i,setSnackbar:s}),e.jsxs("button",{onClick:()=>b(),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(N,{step:o,saveConfig:()=>C({flow:h,setFlow:g,allIntegURL:u,conf:t,navigate:f,setIsLoading:i,setSnackbar:s}),isLoading:c,dataConf:t,setDataConf:n,formFields:w})]})}export{U as default};
