Bloc A - Code mort: - Suppression Studio (components, views, features) - Suppression gamification + services mock (projectService, storageService, gamificationService) - Mise à jour Sidebar, Navbar, locales Bloc B - Frontend: - Suppression modal.tsx deprecated, Modal.stories (doublon Dialog) - Feature flags: PLAYLIST_SEARCH, PLAYLIST_RECOMMENDATIONS, ROLE_MANAGEMENT = true - Suppression 19 tests orphelins, retrait exclusions vitest.config Bloc C - Backend: - Extraction routes_auth.go depuis router.go Bloc D - Rust: - Suppression security_legacy.rs (code mort, patterns déjà dans security/)
76 lines
22 KiB
JavaScript
76 lines
22 KiB
JavaScript
import{a as c,c as W,j as e}from"./vendor-react-yWUy5XPk.js";import{c as D,B as p,n as X,l as j,x as k,S as y,u as q,i as Q,C as L,b as Z,d as ee,f as te,E as re}from"./index-CYK_b1Uz.js";import{S as R}from"./StatCard-D6gRz6p3.js";import{I as se}from"./input-CGdBHtsQ.js";import{u as V}from"./useCopyToClipboard-B0J_nZ9-.js";import{a2 as P,X as ae,C as E,a3 as B,g as oe,e as ne,R as ie,a4 as le,P as ce,h as $,a5 as de,G as ue,a as ge,i as M}from"./vendor-icons-DJFb1Tiw.js";import{w as me}from"./webhookService-Bf4_1ebI.js";import{T as xe,a as pe,b as O,c as F}from"./Tabs-jry2MOtG.js";import{ae as he}from"./vendor-CveO81sn.js";import"./vendor-router-BNNHboN9.js";import"./vendor-tanstack-kPY9uK0s.js";import"./vendor-http-Cz8wfb0q.js";import"./vendor-utils-DtoSyhX2.js";import"./vendor-motion-B3XPS3Jc.js";import"./vendor-i18n-CMcqpBLz.js";import"./AnimatedNumber-e5YD_LEJ.js";import"./vendor-security-DsrNJhpn.js";const fe=[{id:"user.read",label:"Read User Data"},{id:"user.write",label:"Update User Profile"},{id:"tracks.read",label:"Read Tracks"},{id:"tracks.upload",label:"Upload Tracks"},{id:"sales.read",label:"Read Sales Data"}],be=({onClose:t,onCreate:n})=>{const s=X(),[a,d]=c.useState(1),[u,m]=c.useState(""),[l,b]=c.useState(["user.read"]),[h,v]=c.useState(""),[i,x]=c.useState(!1),[f,I]=c.useState(!1),N=c.useRef(null),{copied:U,copy:_}=V(),A=c.useCallback(()=>{if(typeof window>"u"||!N.current)return;const o=document.createRange();o.selectNodeContents(N.current),window.getSelection()?.removeAllRanges(),window.getSelection()?.addRange(o)},[]);c.useEffect(()=>(I(!0),()=>I(!1)),[]);const r=o=>{b(w=>w.includes(o)?w.filter(K=>K!==o):[...w,o])},g=async o=>{if(o?.preventDefault(),o?.stopPropagation(),!u.trim()){s.error("Please enter a name for your API key");return}if(l.length===0){s.error("Please select at least one permission scope");return}x(!0);try{const w=await n({name:u.trim(),scopes:l}),K=w?.key??w?.api_key;if(K)v(K);else{const Y=`vz_${Math.random().toString(36).substr(2,8)}_${Math.random().toString(36).substr(2,16)}`;v(Y)}d(2),x(!1)}catch(w){throw x(!1),w}},J=async o=>{if(o?.preventDefault(),o?.stopPropagation(),!h)return;await _(h)?s.success("API Key copied to clipboard"):s.error("Copy failed. Select the key above and copy manually (Ctrl+C).")};return f?W.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[var(--sumi-z-max)] flex items-center justify-center p-4",children:[e.jsx("div",{className:"absolute inset-0 bg-background/90 backdrop-blur-md",onClick:a===1?t:void 0}),e.jsxs("div",{className:"relative w-full max-w-2xl bg-card border border-border rounded-xl shadow-2xl animate-scaleIn overflow-hidden glass-hud flex flex-col max-h-layout-modal",children:[e.jsxs("div",{className:"p-6 border-b border-border/50 flex justify-between items-center bg-foreground/5 flex-none z-10",children:[e.jsxs("h3",{className:"text-xl font-bold text-foreground flex items-center gap-3 font-heading",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-warning/20 flex items-center justify-center border border-warning/30",children:e.jsx(P,{className:"w-5 h-5 text-warning"})}),a===1?"Create API Key":"API Key Generated"]}),e.jsx("button",{onClick:t,className:"p-2 hover:bg-foreground/10 rounded-lg transition-colors",children:e.jsx(ae,{className:"w-5 h-5 text-muted-foreground hover:text-foreground"})})]}),e.jsx("div",{className:"p-8 overflow-y-auto custom-scrollbar flex-1 relative",children:a===1?e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-muted-foreground uppercase tracking-wider mb-3",children:"Key Name"}),e.jsx(se,{placeholder:"e.g. Production Server, Mobile App",value:u,onChange:o=>m(o.target.value),autoFocus:!0,disabled:i,className:"bg-background/50 border-border focus:border-primary h-12 text-lg w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-muted-foreground uppercase tracking-wider mb-4",children:"Permissions (Scopes)"}),e.jsx("div",{className:"grid grid-cols-1 gap-3",children:fe.map(o=>e.jsxs("label",{className:D("flex items-center justify-between p-4 rounded-xl border cursor-pointer transition-all duration-[var(--duration-fast)] group relative overflow-hidden",l.includes(o.id)?"bg-primary/10 border-primary/50":"bg-background/30 border-border/50 hover:border-border hover:bg-foreground/5"),children:[e.jsxs("div",{className:"flex items-center gap-4 z-10 relative",children:[e.jsx("div",{className:D("w-5 h-5 rounded border flex items-center justify-center transition-colors flex-none",l.includes(o.id)?"bg-primary border-primary":"border-border group-hover:border-border"),children:l.includes(o.id)&&e.jsx(E,{className:"w-3 h-3 text-black"})}),e.jsx("span",{className:D("text-sm font-medium transition-colors",l.includes(o.id)?"text-foreground":"text-muted-foreground group-hover:text-foreground"),children:o.label})]}),e.jsx("div",{className:"text-xs font-mono text-muted-foreground z-10 hidden sm:block opacity-60 relative",children:o.id}),e.jsx("input",{type:"checkbox",className:"hidden",checked:l.includes(o.id),onChange:()=>r(o.id)})]},o.id))})]})]}):e.jsxs("div",{className:"text-center space-y-8 py-4",children:[e.jsxs("div",{className:"relative w-20 h-20 mx-auto",children:[e.jsx("div",{className:"absolute inset-0 bg-success/20 rounded-full animate-ping opacity-50"}),e.jsx("div",{className:"relative w-full h-full bg-gradient-to-br from-success/20 to-primary/20 rounded-full flex items-center justify-center border border-success/30",children:e.jsx(E,{className:"w-10 h-10 text-success drop-shadow-lg"})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-2xl font-bold text-foreground font-heading",children:"Key Created Successfully"}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-xs mx-auto leading-relaxed",children:"Please copy your API key now. For security reasons, it cannot be displayed again properly."})]}),e.jsxs("div",{className:"bg-background/40 border border-border/50 rounded-xl p-1 flex items-center gap-2 relative group overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/5 to-transparent skew-x-12 translate-x-[-200%] group-hover:animate-shimmer"}),e.jsx("div",{ref:N,role:"textbox",tabIndex:0,className:"flex-1 px-4 py-3 font-mono text-sm text-warning overflow-x-auto no-scrollbar whitespace-nowrap text-left select-text cursor-text focus:outline-none focus:ring-2 focus:ring-primary/50 rounded",title:"Click to select all, then Ctrl+C to copy",onClick:A,onFocus:A,children:h}),e.jsx(p,{type:"button",variant:"ghost",size:"icon",onClick:o=>J(o),className:"h-10 w-10 text-muted-foreground hover:text-foreground hover:bg-foreground/10 rounded-lg transition-all flex-none",title:"Copy to clipboard",children:U?e.jsx(E,{className:"w-5 h-5 text-success"}):e.jsx(B,{className:"w-5 h-5"})})]})]})}),e.jsx("div",{className:"p-6 border-t border-border/50 bg-foreground/5 flex justify-end gap-3 backdrop-blur-sm flex-none z-10 transition-colors",children:a===1?e.jsxs(e.Fragment,{children:[e.jsx(p,{variant:"ghost",onClick:t,disabled:i,className:"hover:bg-foreground/10 text-muted-foreground hover:text-foreground",children:"Cancel"}),e.jsx(p,{variant:"default",onClick:o=>{o.preventDefault(),o.stopPropagation(),g(o)},disabled:i||!u.trim()||l.length===0,type:"button",className:"bg-primary hover:bg-primary/80 text-black font-semibold shadow-sm transition-all duration-[var(--sumi-duration-normal)]",children:i?e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating..."]}):"Generate Key"})]}):e.jsx(p,{onClick:t,className:"bg-primary hover:bg-primary/80 text-black font-semibold min-w-24 shadow-sm transition-all duration-[var(--sumi-duration-normal)]",children:"Done"})})]})]}),document.body):null},z="veza_dev_api_keys",G="veza_dev_enc_key";async function H(){const t=sessionStorage.getItem(G);if(t){const a=Uint8Array.from(atob(t),d=>d.charCodeAt(0));return crypto.subtle.importKey("raw",a,"AES-GCM",!0,["encrypt","decrypt"])}const n=await crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),s=await crypto.subtle.exportKey("raw",n);return sessionStorage.setItem(G,btoa(String.fromCharCode(...new Uint8Array(s)))),n}async function we(t){const n=await H(),s=crypto.getRandomValues(new Uint8Array(12)),a=new TextEncoder().encode(t),d=await crypto.subtle.encrypt({name:"AES-GCM",iv:s},n,a),u=new Uint8Array(s.length+new Uint8Array(d).length);return u.set(s),u.set(new Uint8Array(d),s.length),btoa(String.fromCharCode(...u))}async function ye(t){const n=await H(),s=Uint8Array.from(atob(t),m=>m.charCodeAt(0)),a=s.slice(0,12),d=s.slice(12),u=await crypto.subtle.decrypt({name:"AES-GCM",iv:a},n,d);return new TextDecoder().decode(u)}const C=async()=>{const t=localStorage.getItem(z);if(!t)return[];try{const n=await ye(t);return JSON.parse(n)}catch{return localStorage.removeItem(z),[]}},T=async t=>{const n=await we(JSON.stringify(t));localStorage.setItem(z,n)},S={listKeys:async()=>(await new Promise(t=>setTimeout(t,300)),await C()),createKey:async t=>{await new Promise(h=>setTimeout(h,600));const n=Math.random().toString(36).substr(2,8),s=Math.random().toString(36).substr(2,16),a=`vz_${n}_${s}`,d=`vz_${n}...`,m=new Date().toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),l={id:`k-${Date.now()}`,name:t.name,prefix:d,created:m,lastUsed:"Never",status:"active",scopes:t.scopes,key:a},b=await C();return await T([l,...b]),l},revokeKey:async t=>{await new Promise(a=>setTimeout(a,300));const s=(await C()).map(a=>a.id===t?{...a,status:"revoked"}:a);return await T(s),{success:!0}},deleteKey:async t=>{const n=await C();await T(n.filter(s=>s.id!==t))},getStats:async()=>{const n=(await C()).filter(a=>a.status==="active").length;let s=0;try{s=(await me.list()).length}catch(a){j.error("Failed to fetch webhook stats",{error:a})}return{requests_24h:145200+s*1240,avg_latency:45,active_keys:n,active_webhooks:s}}};function ve({specUrl:t,spec:n,useIframe:s=!1}){const a=c.useRef(null),d=c.useRef(null),[u,m]=c.useState(null),l=()=>{if(t)return t;const x=(k.API_URL.startsWith("http")?k.API_URL:`${window.location.origin}${k.API_URL}`).replace(/\/api\/v1$/,"");return s?`${x}/swagger/index.html`:`${x}/swagger/doc.json`},b=()=>`${(k.API_URL.startsWith("http")?k.API_URL:`${window.location.origin}${k.API_URL}`).replace(/\/api\/v1$/,"")}/swagger/index.html`;c.useEffect(()=>{a.current&&j.debug("Swagger UI initialized",{specUrl:t||l(),hasSpec:!!n,useIframe:s})},[t,n,s]);const h={url:n?void 0:l(),spec:n,deepLinking:!0,displayOperationId:!1,defaultModelsExpandDepth:1,defaultModelExpandDepth:1,docExpansion:"list",filter:!0,showExtensions:!0,showCommonExtensions:!0,tryItOutEnabled:!0,supportedSubmitMethods:["get","post","put","delete","patch"],requestInterceptor:i=>{const x=localStorage.getItem("access_token");x&&i.headers&&(i.headers.Authorization=`Bearer ${x}`);const f=localStorage.getItem("csrf_token");return f&&i.headers&&(i.headers["X-CSRF-Token"]=f),i},onComplete:()=>{m(null),j.debug("Swagger UI loaded successfully",{url:l()})},onFailure:i=>{m(i.message||"Failed to load Swagger documentation");const f=i.message?.includes("end of the stream")&&/<(!DOCTYPE|!--|html)/i.test(i.message)?"debug":"error";j[f]("Failed to load Swagger UI",{error:i.message,stack:i.stack,url:l()})}},v=()=>{m(null),window.location.reload()};if(s)return e.jsx("div",{ref:a,className:"swagger-ui-container",style:{height:"100%",minHeight:"600px"},children:e.jsx("iframe",{ref:d,src:b(),className:"w-full h-full border-0 rounded-lg",style:{minHeight:"600px"},title:"Swagger UI Documentation",onLoad:()=>{j.debug("Swagger UI iframe loaded successfully"),m(null)},onError:()=>{m("Failed to load Swagger UI in iframe"),j.error("Failed to load Swagger UI iframe")}})});if(u){const i=b();return e.jsxs("div",{className:"flex flex-col items-center justify-center p-12 min-h-layout-page",children:[e.jsx(ne,{className:"w-16 h-16 text-destructive mb-4"}),e.jsx("h3",{className:"text-xl font-bold text-foreground mb-2",children:"Failed to Load API Documentation"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4 text-center max-w-md",children:u}),e.jsxs("p",{className:"text-xs text-muted-foreground mb-6 text-center max-w-md",children:["Trying to load from: ",l(),e.jsx("br",{}),e.jsx("span",{className:"text-muted-foreground",children:"The Swagger JSON endpoint may not be available. Try opening Swagger UI directly."})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs(p,{onClick:v,variant:"default",children:[e.jsx(ie,{className:"w-4 h-4 mr-2"}),"Retry"]}),e.jsx(p,{onClick:()=>window.open(i,"_blank"),variant:"outline",children:"Open Swagger UI"}),e.jsx(p,{onClick:()=>{window.location.reload()},variant:"outline",children:"Use Iframe Mode"})]})]})}return e.jsxs("div",{ref:a,className:"swagger-ui-container",style:{height:"100%",minHeight:"600px"},children:[e.jsx("style",{children:`
|
|
.swagger-ui-container .swagger-ui {
|
|
background: transparent;
|
|
}
|
|
.swagger-ui-container .swagger-ui .topbar {
|
|
display: none;
|
|
}
|
|
.swagger-ui-container .swagger-ui .info {
|
|
margin: 20px 0;
|
|
}
|
|
.swagger-ui-container .swagger-ui .info .title {
|
|
color: #fff;
|
|
}
|
|
.swagger-ui-container .swagger-ui .scheme-container {
|
|
background: rgba(255, 255, 255, 0.05);
|
|
padding: 10px;
|
|
border-radius: 8px;
|
|
margin: 20px 0;
|
|
}
|
|
.swagger-ui-container .swagger-ui .opblock {
|
|
background: rgba(255, 255, 255, 0.03);
|
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
border-radius: 8px;
|
|
margin: 10px 0;
|
|
}
|
|
.swagger-ui-container .swagger-ui .opblock.opblock-post {
|
|
border-color: rgba(102, 252, 241, 0.3);
|
|
}
|
|
.swagger-ui-container .swagger-ui .opblock.opblock-get {
|
|
border-color: rgba(102, 252, 241, 0.3);
|
|
}
|
|
.swagger-ui-container .swagger-ui .opblock.opblock-put {
|
|
border-color: rgba(255, 193, 7, 0.3);
|
|
}
|
|
.swagger-ui-container .swagger-ui .opblock.opblock-delete {
|
|
border-color: rgba(244, 67, 54, 0.3);
|
|
}
|
|
.swagger-ui-container .swagger-ui .opblock .opblock-summary {
|
|
color: #fff;
|
|
}
|
|
.swagger-ui-container .swagger-ui .opblock .opblock-description-wrapper {
|
|
color: rgba(255, 255, 255, 0.8);
|
|
}
|
|
.swagger-ui-container .swagger-ui .parameter__name {
|
|
color: #7c9dd6;
|
|
}
|
|
.swagger-ui-container .swagger-ui .response-col_status {
|
|
color: #fff;
|
|
}
|
|
.swagger-ui-container .swagger-ui .response-col_description {
|
|
color: rgba(255, 255, 255, 0.8);
|
|
}
|
|
.swagger-ui-container .swagger-ui input,
|
|
.swagger-ui-container .swagger-ui select,
|
|
.swagger-ui-container .swagger-ui textarea {
|
|
background: rgba(255, 255, 255, 0.1);
|
|
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
color: #fff;
|
|
}
|
|
.swagger-ui-container .swagger-ui .btn {
|
|
background: #7c9dd6;
|
|
color: #000;
|
|
border: none;
|
|
}
|
|
.swagger-ui-container .swagger-ui .btn:hover {
|
|
background: #93afe0;
|
|
}
|
|
.swagger-ui-container .swagger-ui .btn.execute {
|
|
background: #7c9dd6;
|
|
color: #000;
|
|
}
|
|
.swagger-ui-container .swagger-ui .btn.cancel {
|
|
background: rgba(255, 255, 255, 0.1);
|
|
color: #fff;
|
|
}
|
|
`}),e.jsx(he,{...h})]})}function je(){return e.jsxs("div",{className:"space-y-8 pb-20 max-w-layout-content mx-auto",children:[e.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-end gap-4 border-b border-border/50 pb-6",children:[e.jsxs("div",{children:[e.jsx(y,{className:"h-9 w-56 mb-2"}),e.jsx(y,{className:"h-4 w-48"})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(y,{className:"h-10 w-36 rounded-full"}),e.jsx(y,{className:"h-10 w-32 rounded-full"})]})]}),e.jsxs("div",{className:"flex gap-2 mb-8",children:[e.jsx(y,{className:"h-10 flex-1 rounded-lg"}),e.jsx(y,{className:"h-10 flex-1 rounded-lg"})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-8",children:[1,2,3].map(t=>e.jsx(y,{className:"h-28 rounded-xl"},t))}),e.jsx(y,{className:"h-64 w-full rounded-xl"}),e.jsx("span",{className:"sr-only",children:"Chargement du portail développeur..."})]})}const Me=()=>{const{addToast:t}=q(),{copy:n}=V(),[s,a]=c.useState(null),[d,u]=c.useState([]),[m,l]=c.useState(!0),[b,h]=c.useState(null),[v,i]=c.useState({}),[x,f]=c.useState(!1),I=async r=>{await n(r.prefix),a(r.id),t("Key prefix copied to clipboard","success"),setTimeout(()=>a(null),2e3)},N=async()=>{l(!0),h(null);try{const[r,g]=await Promise.all([S.listKeys(),S.getStats()]);u(r),i(g)}catch(r){const g=r instanceof Error?r:new Error(String(r));h(g),j.error("Error loading developer dashboard data",{error:g.message,stack:g.stack})}finally{l(!1)}};c.useEffect(()=>{N()},[]);const U=async r=>{try{const g=await S.createKey(r);return u([g,...d]),t("API Key created successfully","success"),g}catch(g){throw t("Failed to create API key","error"),g}},_=async r=>{if(confirm("Are you sure you want to revoke this key?")){await S.revokeKey(r);const g=await S.listKeys();u(g),t("API Key revoked","info")}},A=async r=>{confirm("Are you sure you want to delete this key permanently?")&&(await S.deleteKey(r),u(d.filter(g=>g.id!==r)),t("API Key deleted","info"))};return m?e.jsx(je,{}):b?e.jsx("div",{className:"py-12",children:e.jsx(Q,{error:b,variant:"card",onRetry:N})}):e.jsxs("div",{className:"space-y-8 animate-fadeIn pb-20",children:[e.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-end gap-4 border-b border-border/50 pb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-heading font-bold text-foreground mb-2",children:"DEVELOPER PORTAL"}),e.jsx("p",{className:"text-muted-foreground font-mono text-sm",children:"Build on top of the Veza Platform."})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(p,{variant:"secondary",icon:e.jsx(le,{className:"w-4 h-4"}),onClick:()=>window.open("https://docs.veza.io","_blank"),children:"Documentation"}),e.jsx(p,{variant:"primary",icon:e.jsx(ce,{className:"w-4 h-4"}),onClick:()=>f(!0),children:"Create API Key"})]})]}),e.jsxs(xe,{defaultValue:"overview",className:"w-full",children:[e.jsxs(pe,{className:"grid w-full grid-cols-2 mb-8",children:[e.jsxs(O,{value:"overview",className:"flex items-center gap-2",children:[e.jsx($,{className:"w-4 h-4"}),"Overview & Keys"]}),e.jsxs(O,{value:"docs",className:"flex items-center gap-2",children:[e.jsx(de,{className:"w-4 h-4"}),"API Documentation"]})]}),e.jsxs(F,{value:"overview",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-8",children:[e.jsx(R,{label:"API Requests (24h)",value:v.requests_24h?.toLocaleString()||0,icon:e.jsx($,{className:"w-5 h-5"}),trend:5.2,color:"cyan"}),e.jsx(R,{label:"Avg Latency",value:`${v.avg_latency||0}ms`,icon:e.jsx(ue,{className:"w-5 h-5"}),trend:-12,color:"lime"}),e.jsx(R,{label:"Active Keys",value:d.length,icon:e.jsx(P,{className:"w-5 h-5"}),color:"gold"})]}),e.jsxs(L,{variant:"default",children:[e.jsxs(Z,{className:"flex flex-row items-center justify-between space-y-0 pb-4 border-b border-border/30",children:[e.jsxs(ee,{className:"flex items-center gap-2",children:[e.jsx(P,{className:"w-4 h-4 text-warning"})," Active API Keys"]}),e.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:[d.filter(r=>r.status==="active").length," active"]})]}),e.jsx(te,{className:"pt-4",children:d.length===0?e.jsx(re,{icon:e.jsx(P,{className:"w-12 h-12 text-muted-foreground"}),title:"No API keys yet",description:"Create your first API key to start building on the Veza Platform.",action:{label:"Create API Key",onClick:()=>f(!0),variant:"default"},variant:"card"}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-xs text-muted-foreground uppercase border-b border-border/50 tracking-wider",children:[e.jsx("th",{className:"pb-3 pl-4",children:"Name"}),e.jsx("th",{className:"pb-3",children:"Key Prefix"}),e.jsx("th",{className:"pb-3",children:"Status"}),e.jsx("th",{className:"pb-3",children:"Created"}),e.jsx("th",{className:"pb-3",children:"Last Used"}),e.jsx("th",{className:"pb-3 text-right pr-4",children:"Actions"})]})}),e.jsx("tbody",{className:"text-sm",children:d.map(r=>e.jsxs("tr",{className:"border-b border-border/20 hover:bg-foreground/5 transition-colors duration-[var(--duration-fast)] group",children:[e.jsx("td",{className:"py-4 pl-4 font-bold text-foreground",children:r.name}),e.jsx("td",{className:"py-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"font-mono text-warning bg-warning/10 px-2 py-0.5 rounded text-xs",children:r.prefix}),e.jsx("button",{type:"button",onClick:()=>I(r),className:"opacity-0 group-hover:opacity-100 transition-opacity duration-[var(--duration-fast)] text-muted-foreground hover:text-foreground",title:"Copy key prefix",children:s===r.id?e.jsx(E,{className:"w-3.5 h-3.5 text-success"}):e.jsx(B,{className:"w-3.5 h-3.5"})})]})}),e.jsx("td",{className:"py-4",children:e.jsxs("span",{className:`inline-flex items-center gap-1.5 text-xs font-bold uppercase px-2 py-0.5 rounded ${r.status==="active"?"bg-success/15 text-success":"bg-destructive/15 text-destructive"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${r.status==="active"?"bg-success animate-pulse":"bg-destructive"}`}),r.status]})}),e.jsx("td",{className:"py-4 text-muted-foreground",children:r.created}),e.jsx("td",{className:"py-4 text-foreground",children:r.lastUsed}),e.jsxs("td",{className:"py-4 text-right pr-4 flex justify-end gap-2",children:[e.jsx(p,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>t("Full key hidden for security"),title:"View Key",children:e.jsx(ge,{className:"w-4 h-4"})}),r.status==="active"?e.jsx(p,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:bg-destructive/10",onClick:()=>_(r.id),title:"Revoke Key",children:e.jsx(M,{className:"w-4 h-4"})}):e.jsx(p,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground hover:bg-foreground/10",onClick:()=>A(r.id),title:"Delete Permanently",children:e.jsx(M,{className:"w-4 h-4"})})]})]},r.id))})]})})})]})]}),e.jsx(F,{value:"docs",children:e.jsx(L,{variant:"default",className:"p-0 overflow-hidden bg-background/80",children:e.jsx(ve,{useIframe:!1})})})]}),x&&e.jsx(be,{onClose:()=>f(!1),onCreate:U})]})};export{Me as DeveloperDashboardView};
|