var y=Object.defineProperty;var x=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var b=(s,e,t)=>e in s?y(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,w=(s,e)=>{for(var t in e||(e={}))I.call(e,t)&&b(s,t,e[t]);if(x)for(var t of x(e))N.call(e,t)&&b(s,t,e[t]);return s};import{u as H,r,j as o}from"./main-406.js";import{d as z,_ as E,I as T,G as W,c as h}from"./bi.394.85.js";import{S as F}from"./bi.68.941.js";import L from"./bi.100.304.js";import{s as G,c as v}from"./bi.132.866.js";import{Z as M}from"./bi.177.867.js";import"./bi.150.760.js";import"./bi.704.707.js";import"./bi.701.708.js";function V({formFields:s,setFlow:e,flow:t,allIntegURL:l}){const p=H(),[j,m]=r.useState(!1),[n,f]=r.useState({auth:!1,header:!1,workbooks:!1,worksheets:!1,workSheetHeaders:!1}),[i,S]=r.useState(1),[C,u]=r.useState({show:!1}),[a,d]=r.useState({name:"Zoho Sheet",type:"Zoho Sheet",dataCenter:"",clientId:"",clientSecret:"",field_map:[{formField:"",zohoSheetFormField:""}],workbooks:[],worksheets:[],workSheetHeaders:[],selectedWorkbook:"",selectedWorksheet:"",headerRow:1,actions:{}});r.useEffect(()=>{window.opener&&G("zohoSheet")},[]);const Z=()=>{m(!0),W(t,e,l,a,p,"","",m).then(c=>{var g;c.success?(h.success((g=c.data)==null?void 0:g.msg),p(l)):h.error(c.data||c)})},_=k=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!v(a)){h.error("Please map mandatory workSheetHeaders");return}a.field_map.length>0&&S(k)};return o.jsxs("div",{children:[o.jsx(z,{snack:C,setSnackbar:u}),o.jsx("div",{className:"txt-center mt-2",children:o.jsx(F,{step:3,active:i})}),o.jsx(L,{zohoSheetConf:a,setZohoSheetConf:d,step:i,setStep:S,loading:n,setLoading:f,setSnackbar:u}),o.jsxs("div",{className:"btcd-stp-page",style:w({},i===2&&{width:900,height:"auto",overflow:"visible"}),children:[o.jsx(M,{formFields:s,zohoSheetConf:a,setZohoSheetConf:d,loading:n,setLoading:f}),n.workSheetHeaders&&a.selectedWorksheet&&o.jsxs("button",{onClick:()=>_(3),disabled:!v(a),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[E("Next","bit-integrations")," "," ",o.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),n.workSheetHeaders&&a.selectedWorksheet&&o.jsx(T,{step:i,saveConfig:()=>Z(),isLoading:j,dataConf:a,setDataConf:d,formFields:s})]})}export{V as default};
