File: /var/www/html/wordpress/wp-content/plugins/bit-integrations/assets/bi.383.310.js
var N=Object.defineProperty,w=Object.defineProperties;var G=Object.getOwnPropertyDescriptors;var f=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable;var u=(s,e,o)=>e in s?N(s,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):s[e]=o,g=(s,e)=>{for(var o in e||(e={}))_.call(e,o)&&u(s,o,e[o]);if(f)for(var o of f(e))y.call(e,o)&&u(s,o,e[o]);return s},S=(s,e)=>w(s,G(e));import{u as A,o as P,r as m,j as a}from"./main-685.js";import"./bi.451.455.js";import{B as E}from"./bi.788.791.js";import{c as B,_ as x}from"./bi.878.0.js";import{S as F}from"./bi.674.13.js";import{S as L}from"./bi.347.1012.js";import{I as R,s as T}from"./bi.776.3.js";import q from"./bi.440.184.js";import{h as D,d as M}from"./bi.110.773.js";import{G as z}from"./bi.812.774.js";import"./bi.327.9.js";import"./bi.601.11.js";import"./bi.825.14.js";import"./bi.703.796.js";import"./bi.766.775.js";import"./bi.768.751.js";import"./bi.666.752.js";function ne({formFields:s,setFlow:e,flow:o,allIntegURL:I}){const b=A(),{formID:l}=P(),[p,c]=m.useState(!1),[n,d]=m.useState(1),[j,i]=m.useState({show:!1}),[t,r]=m.useState({name:"Google Sheet",type:"Google Sheet",clientId:"",clientSecret:"",spreadsheetId:"",worksheetName:"",field_map:[{formField:"",googleSheetField:""}],header:"ROWS",headerRow:"A1",actions:{}});m.useEffect(()=>{t.oneClickAuthCredentials===void 0&&B(null,"get/credentials",{actionName:"googleSheet"},"Get").then(C=>{r(v=>S(g({},v),{oneClickAuthCredentials:C.data}))})},[]);const k=()=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!M(t)){i({show:!0,msg:x("Please map fields to continue.","bit-integrations")});return}t.spreadsheetId!==""&&t.worksheetName!==""&&t.field_map.length>0&&d(3)};return a.jsxs("div",{children:[a.jsx(F,{snack:j,setSnackbar:i}),a.jsx("div",{className:"txt-center mt-2",children:a.jsx(L,{step:3,active:n})}),a.jsx(q,{formID:l,sheetConf:t,setSheetConf:r,step:n,setstep:d,setSnackbar:i,isLoading:p,setIsLoading:c}),a.jsxs("div",{className:"btcd-stp-page",style:{width:n===2&&900,height:n===2&&"auto"},children:[a.jsx(z,{formID:l,formFields:s,handleInput:h=>D(h,t,r,l,c,i),sheetConf:t,setSheetConf:r,isLoading:p,setIsLoading:c,setSnackbar:i}),a.jsxs("button",{onClick:()=>k(),disabled:!t.spreadsheetId||!t.worksheetName||t.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[x("Next","bit-integrations"),a.jsx(E,{className:"ml-1 rev-icn"})]})]}),a.jsx(R,{step:n,saveConfig:()=>T({flow:o,setFlow:e,allIntegURL:I,conf:t,navigate:b,setIsLoading:c,setSnackbar:i}),isLoading:p,dataConf:t,setDataConf:r,formFields:s})]})}export{ne as default};