import{j as t,_ as l}from"./main.2.8.10.js";import{u as I,e as b,b as r}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as j}from"./BackIcn.BFDZx8No.js";import{S as k}from"./SnackMsg.7BjcJK1j.js";import{S as v}from"./Steps.B84Ui3GU.js";import{I as N,s as w}from"./Integrations.BFhED4ck.js";import C from"./GoogleSheetAuthorization.BcmgTF0z.js";import{h as G,d as _}from"./GoogleSheetCommonFunc.tmVkP4MP.js";import{G as y}from"./GoogleSheetIntegLayout.B37vCjST.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./GoogleIntegrationHelpers.CQstGYRP.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function U({formFields:p,setFlow:d,flow:h,allIntegURL:f}){const g=I(),{formID:n}=b(),[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(j,{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};
