var S=Object.defineProperty;var u=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable;var x=(n,t,s)=>t in n?S(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s,m=(n,t)=>{for(var s in t||(t={}))_.call(t,s)&&x(n,s,t[s]);if(u)for(var s of u(t))A.call(t,s)&&x(n,s,t[s]);return n};import{j as e,_ as i}from"./main.2.8.10.js";import{b as j}from"./react-router.DMwpH23k.js";import{y as I}from"./Note.DalStCGz.js";import{a as C,g as z}from"./DropboxCommonFunc.Cgn_D7pU.js";import{T as D}from"./TutorialLink.D6K_DiHL.js";import"./react-vendor.P7K3d6op.js";import"./CopyIcn.BnhKHfEP.js";function L({flowID:n,dropboxConf:t,setDropboxConf:s,step:p,setStep:N,isLoading:b,setIsLoading:y,isInfo:a}){const[l,v]=j.useState(!1),[c,d]=j.useState({clientId:"",clientSecret:""}),w=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),z(n,t,s),N(2)},r=o=>{const h=m({},t),g=m({},c);g[o.target.name]="",h[o.target.name]=o.target.value,d(g),s(h)},k=()=>{if(!t.clientId||!t.clientSecret){d({clientId:t.clientId?"":i("Client Id can't be empty","bit-integrations"),clientSecret:t.clientSecret?"":i("Client Secret can't be empty","bit-integrations")});return}window.open(`https://www.dropbox.com/oauth2/authorize?client_id=${t.clientId}&token_access_type=offline&response_type=code`,"_blank")};return e.jsxs("div",{className:"btcd-stp-page",style:{width:p===1&&900,height:p===1&&"auto"},children:[e.jsx(D,{linkKey:"dropbox"}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:i("Integration Name:","bit-integrations")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:r,name:"name",value:t.name,type:"text",placeholder:i("Integration Name...","bit-integrations"),disabled:a}),e.jsxs("small",{className:"d-blk mt-3",children:[i("To Get Client Id & Secret, Please Visit","bit-integrations")," ",e.jsx("a",{className:"btcd-link",rel:"noreferrer",target:"_blank",href:"https://www.dropbox.com/developers/apps/create?_tk=pilot_lp&_ad=ctabtn1&_camp=create",children:i("Dropbox API Console","bit-integrations")})]}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:i("Dropbox Client id:","bit-integrations")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:r,name:"clientId",value:t.clientId,type:"text",placeholder:i("client ID...","bit-integrations"),disabled:a}),e.jsx("div",{style:{color:"red"},children:c.clientId}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:i("Dropbox Client Secret:","bit-integrations")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:r,name:"clientSecret",value:t.clientSecret,type:"text",placeholder:i("client Secret...","bit-integrations"),disabled:a}),e.jsx("div",{style:{color:"red"},children:c.clientSecret}),e.jsxs("small",{className:"d-blk mt-3",children:[i("To Get Access Code, Please Visit","bit-integrations")," ",e.jsx("span",{className:"btcd-link",style:{cursor:"pointer"},onClick:k,"aria-hidden":"true",children:i("Dropbox Access Code","bit-integrations")})]}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:i("Dropbox Access Code:","bit-integrations")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:r,name:"accessCode",value:t.accessCode,type:"text",placeholder:i("Access Code...","bit-integrations"),disabled:a}),e.jsx("div",{style:{color:"red"},children:c.accessCode}),!a&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>C(t,s,v,y,d),className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:l||b,children:[l?i("Authorized ✔","bit-integrations"):i("Authorize","bit-integrations"),b&&e.jsx(I,{size:"20",clr:"#022217",className:"ml-2"})]}),e.jsx("br",{}),e.jsxs("button",{onClick:w,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!l,children:[i("Next","bit-integrations"),e.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]})]})}export{L as default};
