var I=Object.defineProperty;var b=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var x=(s,e,t)=>e in s?I(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,w=(s,e)=>{for(var t in e||(e={}))N.call(e,t)&&x(s,t,e[t]);if(b)for(var t of b(e))_.call(e,t)&&x(s,t,e[t]);return s};import{j as o,_ as v,z as h}from"./main.2.8.10.js";import{u as H,b as r}from"./react-router.DMwpH23k.js";import{S as E}from"./SnackMsg.7BjcJK1j.js";import{S as T}from"./Steps.B84Ui3GU.js";import{I as W,g as F}from"./Integrations.BFhED4ck.js";import L from"./ZohoSheetAuthorization.DrOjV6ok.js";import{s as M,c as j}from"./ZohoSheetCommonFunc.Cp5yEu7U.js";import{Z as P}from"./ZohoSheetIntegLayout.BrBWybSS.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./CopyIcn.BnhKHfEP.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function se({formFields:s,setFlow:e,flow:t,allIntegURL:m}){const p=H(),[C,l]=r.useState(!1),[i,f]=r.useState({auth:!1,header:!1,workbooks:!1,worksheets:!1,workSheetHeaders:!1}),[n,S]=r.useState(1),[Z,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&&M("zohoSheet")},[]);const y=()=>{l(!0),F(t,e,m,a,p,"","",l).then(c=>{var k;c.success?(h.success((k=c.data)==null?void 0:k.msg),p(m)):h.error(c.data||c)})},z=g=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!j(a)){h.error(v("Please map mandatory workSheetHeaders","bit-integrations"));return}a.field_map.length>0&&S(g)};return o.jsxs("div",{children:[o.jsx(E,{snack:Z,setSnackbar:u}),o.jsx("div",{className:"txt-center mt-2",children:o.jsx(T,{step:3,active:n})}),o.jsx(L,{zohoSheetConf:a,setZohoSheetConf:d,step:n,setStep:S,loading:i,setLoading:f,setSnackbar:u}),o.jsxs("div",{className:"btcd-stp-page",style:w({},n===2&&{width:900,height:"auto",overflow:"visible"}),children:[o.jsx(P,{formFields:s,zohoSheetConf:a,setZohoSheetConf:d,loading:i,setLoading:f}),i.workSheetHeaders&&a.selectedWorksheet&&o.jsxs("button",{onClick:()=>z(3),disabled:!j(a),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[v("Next","bit-integrations"),"  ",o.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),i.workSheetHeaders&&a.selectedWorksheet&&o.jsx(W,{step:n,saveConfig:()=>y(),isLoading:C,dataConf:a,setDataConf:d,formFields:s})]})}export{se as default};
