var $=Object.defineProperty;var w=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var I=(n,e,i)=>e in n?$(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i,A=(n,e)=>{for(var i in e||(e={}))H.call(e,i)&&I(n,i,e[i]);if(w)for(var i of w(e))O.call(e,i)&&I(n,i,e[i]);return n};var T=(n,e,i)=>new Promise((h,b)=>{var l=a=>{try{r(i.next(a))}catch(x){b(x)}},d=a=>{try{r(i.throw(a))}catch(x){b(x)}},r=a=>a.done?h(a.value):Promise.resolve(a.value).then(l,d);r((i=i.apply(n,e)).next())});import{k as U,g as V,b as q,a as F,j as t,_ as s,L as J}from"./main.2.8.1.js";import{d as p}from"./react-router-dom.9mCuUg3q.js";import{B as K}from"./BackIcn._kGL_vVw.js";import{a2 as S,z as E}from"./Note.BeM7sN-p.js";import{c as M,t as Q,r as W}from"./GoogleSheetCommonFunc.RFhGkHnX.js";import{t as X}from"./tutorialLinks.kMkIDzcD.js";import{T as _}from"./TutorialLink.BAFX--T3.js";import"./CopyIcn.3gZpHton.js";function ot({formID:n,sheetConf:e,setSheetConf:i,step:h,setstep:b,isLoading:l,setIsLoading:d,setSnackbar:r,redirectLocation:a,isEdit:x,isInfo:m}){const[g,R]=p.useState(!1),[N,v]=p.useState({clientId:"",clientSecret:""}),j=U(V),{googleSheet:c}=X,[G,L]=p.useState([]),[y,B]=q(F),[u,Y]=p.useState("Custom Authorization"),z=o=>{M(e,o,v,d,j)},D=o=>T(null,null,function*(){yield Q(o,e,i,R,u,G,L,d,r,j),B(void 0)});p.useEffect(()=>{!y||Object.keys(y).length===0||D(y)},[y]);const f=o=>{const k=A({},e),C=A({},N);C[o.target.name]="",k[o.target.name]=o.target.value,v(C),i(k)},P=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),b(2),W(n,e,i,d,r)};return console.log(j),t.jsxs("div",{className:"btcd-stp-page",style:{width:h===1&&900,height:h===1&&"auto"},children:[t.jsx(_,{title:"Google Sheets",youTubeLink:c==null?void 0:c.youTubeLink}),t.jsx(_,{title:"Google Sheets",docLink:c==null?void 0:c.docLink}),u==="Custom Authorization"&&t.jsxs("div",{children:[t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:s("Integration Name:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:f,name:"name",value:e.name,type:"text",placeholder:s("Integration Name...","bit-integrations"),disabled:m}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:s("Homepage URL:","bit-integrations")})}),t.jsx(S,{value:`${window.location.origin}`,className:"field-key-cpy w-6 ml-0",setSnackbar:r}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:s("Authorized Redirect URIs:","bit-integrations")})}),t.jsx(S,{value:a||`${j.api}/redirect`,className:"field-key-cpy w-6 ml-0",setSnackbar:r}),t.jsxs("small",{className:"d-blk mt-5",children:[s("To get Client ID and SECRET , Please Visit","bit-integrations")," ",t.jsx("a",{className:"btcd-link",href:"https://console.developers.google.com/apis/credentials",target:"_blank",rel:"noreferrer",children:s("Google API Console","bit-integrations")})]}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:s("Client id:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:f,name:"clientId",value:e.clientId,type:"text",placeholder:s("Client id...","bit-integrations"),disabled:m}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:N.clientId}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:s("Client secret:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:f,name:"clientSecret",value:e.clientSecret,type:"text",placeholder:s("Client secret...","bit-integrations"),disabled:m}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:N.clientSecret}),t.jsxs("button",{onClick:()=>z(u),className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:l||m,children:[g||m?s("Authorized ✔","bit-integrations"):s("Authorize","bit-integrations"),l&&t.jsx(E,{size:20,clr:"#022217",className:"ml-2"})]}),t.jsx("br",{})]}),l&&u!=="Custom Authorization"&&t.jsx(J,{style:{display:"flex",justifyContent:"center",alignItems:"center",height:100,transform:"scale(0.7)"}}),g&&u==="One Click Authorization"&&t.jsxs("button",{onClick:()=>z(),className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:l,children:[g?s("Authorized ✔","bit-integrations"):s("Authorize","bit-integrations"),l&&t.jsx(E,{size:20,clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>P(),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!g,children:[s("Next","bit-integrations"),t.jsx(K,{className:"ml-1 rev-icn"})]})]})}export{ot as default};
