2025-01-14 15:27:08 +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:()=>R,default:()=>C,getServerSideProps:()=>T,getStaticPaths:()=>M,getStaticProps:()=>O,reportWebVitals:()=>K,routeModule:()=>H,unstable_getServerProps:()=>F,unstable_getServerSideProps:()=>I,unstable_getStaticParams:()=>Q,unstable_getStaticPaths:()=>q,unstable_getStaticProps:()=>B});var s,r={};a.r(r),a.d(r,{ApiKeysContext:()=>P,default:()=>L,getServerSideProps:()=>E});var l=a(63865),n=a(9455),i=a(30671),c=a(5583),o=a(19796),d=a(8732),p=a(82015),u=a.n(p),h=a(25562),m=a(92702),y=a(53926),x=a(66485),f=a(91140),g=a(46169),_=a(16757),v=a(55904);function A({apiKeyObject:e,setTargetApiKey:t}){let[a,s]=u().useState(!1);return(0,d.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,d.jsx)(_.A,{width:"20px"}),(0,d.jsxs)("div",{className:"text-sm flex-wrap",children:[(0,d.jsx)("div",{children:e.scope.match(/readOnly/)?(0,d.jsx)("span",{className:"notification"}):e.scope.match(/fullAccess/)?(0,d.jsx)("span",{className:"notification success"}):"No Scope"}),(0,d.jsx)("span",{className:"title text-xl",style:{fontSize:"16px"},children:e.name}),(0,d.jsxs)("span",{className:"text-slate-400 ",children:["Created: ",e.date_created.substring(0,24)]})]}),(0,d.jsxs)(v.A,{children:[(0,d.jsx)("button",{className:"outlined light-gray small-text",onClick:t=>{alert(e.apiKeyPayload)},children:"Reveal Api Key"}),(0,d.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,d.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 j({user:e,apiKeys:t,setTargetApiKey:a}){return(0,d.jsx)(u().Fragment,{children:(0,d.jsxs)("section",{className:"p-0 items-start gap-4 overflow-visible bg-transparent border-transparent",children:[(0,d.jsx)("div",{className:"w-full flex-col items-stretch gap-4",children:t&&a&&t[0]&&t.map((e,t)=>(0,d.jsx)(A,{apiKeyObject:e,setTargetApiKey:a},t))}),!t||!t[0]&&(0,d.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,d.jsx)("span",{className:"text-slate-400",children:"No Api Keys Added."}),(0,d.jsx)("span",{className:"",children:"Add Api Key"})]})]})})}function S(){let{user:e,apiKeys:t,setApiKeys:a,setTargetApiKey:s}=u().useContext(P);return(0,d.jsxs)(u().Fragment,{children:[(0,d.jsxs)("div",{className:"flex-col items-start gap-0 w-full",children:[(0,d.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,d.jsx)("h1",{className:"text-3xl m-0",children:"Api Keys"}),(0,d.jsxs)("button",{className:"flex items-center gap-2",onClick:e=>{(0,f.PB)("add-new-api-key-popup")},children:[(0,d.jsx)("span",{className:"symbol",children:"+"}),(0,d.jsx)("span",{children:"Add New Api Key"})]})]}),(0,d.jsx)(y.A,{user:e})]}),e?.verification_status?.toString().match(/1/)?(0,d.jsx)(j,{apiKeys:t,setTargetApiKey:s,user:e}):(0,d.jsx)(x.A,{})]})}function b({targetApiKey:e}){let[t,a]=u().useState(!1);return(0,d.jsxs)(f.Ay,{title:"target-api-key-preview-popup",noContainer:!0,fullPage:!0,children:[t&&(0,d.jsx)(_.A,{}),e&&(0,d.jsx)(u().Fragment,{children:(0,d.jsx)("span",{children:"Target Api Key"})})]})}var N=a(24872);function k(){async function e(e){return await (0,N.A)({tableName:"api_keys",columnName:"slug",value:e})}let[t,a]=u().useState(!1),[r,l]=u().useState(null);return(0,d.jsxs)(f.Ay,{title:"add-new-a
|