2025-01-14 06:10:36 +00:00
|
|
|
"use strict";(()=>{var e={};e.id=9419,e.ids=[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}}})},50665:(e,t,a)=>{a.r(t),a.d(t,{config:()=>D,default:()=>q,getServerSideProps:()=>F,getStaticPaths:()=>E,getStaticProps:()=>T,reportWebVitals:()=>z,routeModule:()=>L,unstable_getServerProps:()=>H,unstable_getServerSideProps:()=>R,unstable_getStaticParams:()=>G,unstable_getStaticPaths:()=>I,unstable_getStaticProps:()=>O});var s,l={};a.r(l),a.d(l,{ApiKeysContext:()=>M,default:()=>C,getServerSideProps:()=>K});var i=a(63865),r=a(9455),n=a(30671),c=a(5583),d=a(19796),p=a(8732),o=a(82015),u=a.n(o),x=a(25562),h=a(92702),m=a(53926),y=a(66485),f=a(91140),g=a(46169),j=a(16757),A=a(55904);function v({apiKeyObject:e,setTargetApiKey:t}){let[a,s]=u().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)(j.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,g.A)("/api/deleteApiKey",{method:"post",body:e},!0).then(e=>{}).finally(()=>{window.location.reload()}):s(!1)},children:"Delete Api Key"})]})]})}function b({user:e,apiKeys:t,setTargetApiKey:a}){return(0,p.jsx)(u().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&&a&&t[0]&&t.map((e,t)=>(0,p.jsx)(v,{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)("span",{className:"",children:"Add Api Key"})]})]})})}function k(){let{user:e,apiKeys:t,setApiKeys:a,setTargetApiKey:s}=u().useContext(M);return(0,p.jsxs)(u().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)(m.A,{user:e})]}),e?.verification_status?.toString().match(/1/)?(0,p.jsx)(b,{apiKeys:t,setTargetApiKey:s,user:e}):(0,p.jsx)(y.A,{})]})}function _({targetApiKey:e}){let[t,a]=u().useState(!1);return(0,p.jsxs)(f.Ay,{title:"target-api-key-preview-popup",noContainer:!0,fullPage:!0,children:[t&&(0,p.jsx)(j.A,{}),e&&(0,p.jsx)(u().Fragment,{children:(0,p.jsx)("span",{children:"Target Api Key"})})]})}var w=a(24872);function N(){async function e(e){return await (0,w.A)({tableName:"api_keys",columnName:"slug",value:e})}let[t,a]=u().useState(!1),[l,i]=u().useState(null);return(0,p.jsxs)(f.Ay,{title:"add-new-a
|