import{j as t,_ as l}from"./main.2.8.1.js";import{u as I,h as j,d as r}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{B as b}from"./BackIcn._kGL_vVw.js";import{S as k}from"./SnackMsg.S8DrwLlT.js";import{S as v}from"./Steps.1hz7v9Vj.js";import{I as N,s as w}from"./Integrations.D2bgBas2.js";import C from"./GoogleSheetAuthorization.Bxu6RdFU.js";import{h as G,d as _}from"./GoogleSheetCommonFunc.RFhGkHnX.js";import{G as y}from"./GoogleSheetIntegLayout.fMoxTzIV.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./tutorialLinks.kMkIDzcD.js";import"./TutorialLink.BAFX--T3.js";import"./GoogleIntegrationHelpers.BGadhjz3.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";function U({formFields:p,setFlow:d,flow:h,allIntegURL:f}){const g=I(),{formID:n}=j(),[m,a]=r.useState(!1),[o,c]=r.useState(1),[u,s]=r.useState({show:!1}),[e,i]=r.useState({name:"Google Sheet",type:"Google Sheet",clientId:"",clientSecret:"",spreadsheetId:"",worksheetName:"",field_map:[{formField:"",googleSheetField:""}],header:"ROWS",headerRow:"A1",actions:{}}),S=()=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!_(e)){s({show:!0,msg:l("Please map fields to continue.","bit-integrations")});return}e.spreadsheetId!==""&&e.worksheetName!==""&&e.field_map.length>0&&c(3)};return t.jsxs("div",{children:[t.jsx(k,{snack:u,setSnackbar:s}),t.jsx("div",{className:"txt-center mt-2",children:t.jsx(v,{step:3,active:o})}),t.jsx(C,{formID:n,sheetConf:e,setSheetConf:i,step:o,setstep:c,setSnackbar:s,isLoading:m,setIsLoading:a}),t.jsxs("div",{className:"btcd-stp-page",style:{width:o===2&&900,height:o===2&&"auto"},children:[t.jsx(y,{formID:n,formFields:p,handleInput:x=>G(x,e,i,n,a,s),sheetConf:e,setSheetConf:i,isLoading:m,setIsLoading:a,setSnackbar:s}),t.jsxs("button",{onClick:()=>S(),disabled:!e.spreadsheetId||!e.worksheetName||e.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[l("Next","bit-integrations"),t.jsx(b,{className:"ml-1 rev-icn"})]})]}),t.jsx(N,{step:o,saveConfig:()=>w({flow:h,setFlow:d,allIntegURL:f,conf:e,navigate:g,setIsLoading:a,setSnackbar:s}),isLoading:m,dataConf:e,setDataConf:i,formFields:p})]})}export{U as default};
