var k=Object.defineProperty;var N=Object.getOwnPropertySymbols;var f=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var w=(r,s,t)=>s in r?k(r,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[s]=t,b=(r,s)=>{for(var t in s||(s={}))f.call(s,t)&&w(r,t,s[t]);if(N)for(var t of N(s))_.call(s,t)&&w(r,t,s[t]);return r};import{r as l,j as e,_ as a,d as D,v as C,w as I,a as K,S as P,B as T,x as z}from"./main-40.js";/* empty css          */import{B as L}from"./bf-586-70.js";import{T as B,S as F}from"./bf-679-136.js";import{b as E}from"./bf-132-75.js";import{I as $}from"./bf-94-335.js";import{t as A}from"./bf-892-199.js";import{A as q}from"./bf-541-403.js";import{N as G}from"./bf-504-404.js";import{a as R,g as V,D as H}from"./bf-588-390.js";import"./bf-141-80.js";import"./bf-860-126.js";function M({formID:r,dropboxConf:s,setDropboxConf:t,step:p,setStep:j,isLoading:m,setIsLoading:h,isInfo:c}){const[o,x]=l.useState(!1),[n,g]=l.useState({apiKey:"",apiSecret:""}),y=()=>{V(r,s,t),j(2),document.querySelector(".btcd-s-wrp").scrollTop=0},i=d=>{const v=b({},s),S=b({},n);S[d.target.name]="",v[d.target.name]=d.target.value,g(S),t(v)},u=()=>{if(!s.apiKey||!s.apiSecret){D.error(a("Please enter API key and API secret"));return}window.open(`https://www.dropbox.com/oauth2/authorize?client_id=${s.apiKey}&token_access_type=offline&response_type=code`,"_blank")};return e.jsxs("div",{className:"btcd-stp-page",style:{width:p===1&&900,height:p===1&&"220%"},children:[e.jsx(B,{title:A.dropbox.title,youTubeLink:A.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:i,name:"name",value:s.name,type:"text",placeholder:a("Integration Name..."),disabled:c}),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:i,name:"apiKey",value:s.apiKey,type:"text",placeholder:a("Api Key..."),disabled:c}),e.jsx("div",{style:{color:"red"},children:n.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:i,name:"apiSecret",value:s.apiSecret,type:"text",placeholder:a("Api Secret..."),disabled:c}),e.jsx("div",{style:{color:"red"},children:n.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:u,"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:i,name:"accessCode",value:s.accessCode,type:"text",placeholder:a("Access Code..."),disabled:c}),e.jsx("div",{style:{color:"red"},children:n.accessCode}),!c&&e.jsxs(e.Fragment,{children:[e.jsx(q,{isAuthorized:o,isLoading:m,handleAuthorize:()=>R(s,t,x,h)}),e.jsx("br",{}),e.jsx(G,{nextPageHandler:()=>y(),disabled:!o})]})]})}function ie({formFields:r,setIntegration:s,integrations:t,allIntegURL:p}){const j=C(),{formID:m}=I(),[h,c]=l.useState(!1),[o,x]=l.useState(1),[n,g]=l.useState({show:!1}),{css:y}=K(),[i,u]=l.useState({name:"Dropbox Integration",type:"Dropbox",apiKey:"",apiSecret:"",accessCode:"",field_map:[{formField:"",dropboxFormField:""}],foldersList:[],actions:{}}),d=()=>{E(t,s,p,i,j)};return document.querySelector(".btcd-s-wrp").scrollTop=0,e.jsxs("div",{children:[e.jsx(P,{snack:n,setSnackbar:g}),e.jsx("div",{className:"txt-center w-9 mt-2 cal-width",children:e.jsx(F,{step:3,active:o})}),e.jsx(M,{formID:m,dropboxConf:i,setDropboxConf:u,step:o,setStep:x,isLoading:h,setIsLoading:c}),e.jsxs("div",{className:"btcd-stp-page",style:b({},o===2&&{width:900,height:"150%",overintegrations:"visible"}),children:[e.jsx(H,{formID:m,formFields:r,dropboxConf:i,setDropboxConf:u,isLoading:h,setIsLoading:c}),e.jsxs(T,{variant:"success",onClick:()=>x(3),disabled:i.field_map.length<1,className:y(z.ftRight),children:[a("Next"),e.jsx(L,{className:"ml-1 rev-icn"})]})]}),e.jsx($,{step:o,saveConfig:()=>d()})]})}export{ie as default};
