| 1 |
var f=Object.defineProperty;var k=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var v=(r,t,s)=>t in r?f(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s,j=(r,t)=>{for(var s in t||(t={}))N.call(t,s)&&v(r,s,t[s]);if(k)for(var s of k(t))_.call(t,s)&&v(r,s,t[s]);return r};import{r as o,j as e,_ as a,z as D,F as z,g as K,a as C,S as F}from"./main-762.js";/* empty css */import{t as w}from"./bf-281-48.js";import{T as I}from"./bf-525-114.js";import{A as P}from"./bf-704-110.js";import{a as L}from"./bf-660-157.js";import"./bf-142-115.js";import"./bf-145-47.js";import"./bf-685-46.js";import"./bf-213-54.js";import"./bf-249-69.js";function T({formID:r,dropboxConf:t,setDropboxConf:s,step:g,setStep:y,isLoading:p,setIsLoading:d,isInfo:i,authorizedAction:m}){const[l,h]=o.useState(!1),[c,u]=o.useState({apiKey:"",apiSecret:""}),n=b=>{const A=j({},t),S=j({},c);S[b.target.name]="",A[b.target.name]=b.target.value,u(S),s(A)},x=()=>{if(!t.apiKey||!t.apiSecret){D.error(a("Please enter API key and API secret"));return}window.open(`https://www.dropbox.com/oauth2/authorize?client_id=${t.apiKey}&token_access_type=offline&response_type=code`,"_blank")};return o.useEffect(()=>{l&&m()},[l]),e.jsxs("div",{className:"btcd-stp-page",style:{width:900,height:"100%"},children:[e.jsx(I,{title:w.dropbox.title,youTubeLink:w.dropbox.link}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:a("Integration Name:")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:n,name:"name",value:t.name,type:"text",placeholder:a("e.g. Marketing — work account"),disabled:i}),e.jsxs("small",{className:"d-blk mt-3",children:[a("To Get Api Key & Secret, Please Visit")," ",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:a("Dropbox API Console")})]}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:a("Dropbox Api Key:")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:n,name:"apiKey",value:t.apiKey,type:"text",placeholder:a("Api Key..."),disabled:i}),e.jsx("div",{style:{color:"red"},children:c.apiKey}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:a("Dropbox Api Secret:")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:n,name:"apiSecret",value:t.apiSecret,type:"text",placeholder:a("Api Secret..."),disabled:i}),e.jsx("div",{style:{color:"red"},children:c.apiSecret}),e.jsxs("small",{className:"d-blk mt-3",children:[a("To Get Access Code, Please Visit")," ",e.jsx("span",{className:"btcd-link",style:{cursor:"pointer"},onClick:x,"aria-hidden":"true",children:a("Dropbox Access Code")})]}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:a("Dropbox Access Code:")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:n,name:"accessCode",value:t.accessCode,type:"text",placeholder:a("Access Code..."),disabled:i}),e.jsx("div",{style:{color:"red"},children:c.accessCode}),!i&&e.jsxs(e.Fragment,{children:[e.jsx(P,{isAuthorized:l,isLoading:p,handleAuthorize:()=>L(t,s,h,d)}),e.jsx("br",{})]})]})}function U({formFields:r,setIntegration:t,integrations:s,allIntegURL:g}){const y=z(),{formID:p}=K(),[d,i]=o.useState(!1),[m,l]=o.useState(1),[h,c]=o.useState({show:!1});C();const[u,n]=o.useState({name:"Dropbox Integration",type:"Dropbox",apiKey:"",apiSecret:"",accessCode:"",field_map:[{formField:"",dropboxFormField:""}],foldersList:[],actions:{}}),x=()=>{setTimeout(()=>{y(g)},1e3)};return e.jsxs("div",{children:[e.jsx(F,{snack:h,setSnackbar:c}),e.jsx(T,{formID:p,dropboxConf:u,setDropboxConf:n,step:m,setStep:l,isLoading:d,setIsLoading:i,authorizedAction:x})]})}export{U as default}; |