import{j as t,_ as l}from"./main.2.9.0.js";import{u as I,e as b,b as r}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as j}from"./BackIcn._8Wofmn2.js";import{S as k}from"./SnackMsg.DYSD96P4.js";import{S as v}from"./Steps.BYe8zHkm.js";import{I as N,s as w}from"./Integrations.DL8wqGct.js";import C from"./GoogleSheetAuthorization.HWoBgFvk.js";import{h as G,d as _}from"./GoogleSheetCommonFunc.CYTaCOIe.js";import{G as y}from"./GoogleSheetIntegLayout.CSAwzv1g.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TutorialLink.CFG7bS5c.js";import"./GoogleIntegrationHelpers.C5BmN2Z3.js";import"./TagifyInput.KPPRQJ1B.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};
