1 line
18 KiB
JavaScript
1 line
18 KiB
JavaScript
|
"use strict";(()=>{var e={};e.id=9419,e.ids=[636,9419],e.modules={30671:(e,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){return function e(t,a){return a in t?t[a]:"then"in t&&"function"==typeof t.then?t.then(t=>e(t,a)):"function"==typeof t&&"default"===a?t:void 0}}})},30284:(e,t,a)=>{a.r(t),a.d(t,{config:()=>O,default:()=>z,getServerSideProps:()=>I,getStaticPaths:()=>D,getStaticProps:()=>H,reportWebVitals:()=>V,routeModule:()=>B,unstable_getServerProps:()=>$,unstable_getServerSideProps:()=>W,unstable_getStaticParams:()=>L,unstable_getStaticPaths:()=>G,unstable_getStaticProps:()=>R});var s,r={};a.r(r),a.d(r,{ApiKeysContext:()=>T,default:()=>E,getServerSideProps:()=>F});var l=a(63865),i=a(9455),n=a(30671),c=a(49407),o=a(68268),p=a(8732),u=a(82015),d=a.n(u),m=a(95222),x=a(20048),h=a.n(x),y=a(58548),f=a(55158),g=a(24671),j=a(63715),v=a(32415),A=a(62506);function b({apiKeyObject:e,setTargetApiKey:t}){let[a,s]=d().useState(!1);return(0,p.jsxs)("div",{className:"card no-hover justify-between items-center"+(e.scope.match(/fullAccess/)?" green":""),onClick:a=>{a.target?.closest("button")||(t(e),(0,f.PB)("target-media-popup"))},children:[a&&(0,p.jsx)(v.A,{width:"20px"}),(0,p.jsxs)("div",{className:"text-sm flex-wrap",children:[(0,p.jsx)("div",{children:e.scope.match(/readOnly/)?(0,p.jsx)("span",{className:"notification"}):e.scope.match(/fullAccess/)?(0,p.jsx)("span",{className:"notification success"}):"No Scope"}),(0,p.jsx)("span",{className:"title text-xl",style:{fontSize:"16px"},children:e.name}),(0,p.jsxs)("span",{className:"text-slate-400 ",children:["Created: ",e.date_created.substring(0,24)]})]}),(0,p.jsxs)(A.A,{children:[(0,p.jsx)("button",{className:"outlined light-gray small-text",onClick:t=>{alert(e.apiKeyPayload)},children:"Reveal Api Key"}),(0,p.jsx)("button",{className:"outlined light-gray small-text",onClick:t=>{navigator.clipboard.writeText(e.apiKeyPayload).then(()=>{alert("Api Key Copied To Clipboard")})},children:"Copy Api Key"}),(0,p.jsx)("button",{className:"outlined light-gray small-text"+(a?" pointer-events-none opacity-40":""),onClick:t=>{s(!0),window.confirm("Delete this Api Key?")?(0,j.A)("/api/deleteApiKey",{method:"post",body:e},!0).then(e=>{}).finally(()=>{window.location.reload()}):s(!1)},children:"Delete Api Key"})]})]})}var k=a(68733);function _({user:e,apiKeys:t,setTargetApiKey:a}){return(0,p.jsx)(d().Fragment,{children:(0,p.jsxs)("section",{className:"p-0 items-start gap-4 overflow-visible bg-transparent border-transparent",children:[(0,p.jsx)("div",{className:"w-full flex-col items-stretch gap-4",children:t&&t[0]&&t.map((e,t)=>(0,p.jsx)(b,{apiKeyObject:e,setTargetApiKey:a},t))}),!t||!t[0]&&(0,p.jsxs)("div",{className:"button outlined gray dashed w-full p-10 flex-col",onClick:e=>{(0,f.PB)("add-new-api-key-popup")},children:[(0,p.jsx)("span",{className:"text-slate-400",children:"No Api Keys Added."}),(0,p.jsx)(k.A,{color:"action",sx:{fontSize:80},className:"opacity-40"}),(0,p.jsx)("span",{className:"",children:"Add Api Key"})]})]})})}function w(e){let{user:t,apiKeys:a,setApiKeys:s,setTargetApiKey:r}=d().useContext(T);return(0,p.jsxs)(d().Fragment,{children:[(0,p.jsxs)("div",{className:"flex-col items-start gap-0 w-full",children:[(0,p.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,p.jsx)("h1",{className:"text-3xl m-0",children:"Api Keys"}),(0,p.jsxs)("button",{className:"flex items-center gap-2",onClick:e=>{(0,f.PB)("add-new-api-key-popup")},children:[(0,p.jsx)("span",{className:"symbol",children:"+"}),(0,p.jsx)("span",{children:"Add New Api Key"})]})]}),(0,p.jsx)(y.A,{user:t})]}),t?.verification_status?.toString().match(/1/)?(0,p.jsx)(_,{apiKeys:a,setTargetApiKey:r,user:t}):(0,p.jsx)(g.A,{})]})}function N({targetApiKey:e}){let[t,a]=d().useState(!1);return(0,p.jsxs)(f.Ay,{title:"target-api-key-preview-popup",noContainer:!0,fullPage:!0,children:[t&&(0,p.jsx)(v.A,{}),e&&(0,p.jsx)(d().Fragment,{children:(0,p.jsx)("span",{children:"Target Api Key"})})]})}var q=a(27462);function S({targetApiKey:e}){async function t(e){return await (0,q.A)({tableName:"api_keys",col
|