PageSourceSearch

https://app.roomlift.ai/assets/ApiKeys-BaLFM_jp.js

js roomlift.ai collected 2026-10-05 12:33:16 UTC 6,134 bytes, 14 lines download raw bytes

1import{k as A,u as E,b as P,r as n,e as l,j as e,B as i,m as K,n as v,o as N,p as C,q as w,v as k,C as U,w as o,a as d}from"./index-wEf7CNwx.js";import{u as B}from"./useQuery-7eNXufmd.js";import{u as p,A as H,K as I}from"./AppLayout-CY6tk7gY.js";import{C as m,c as x,a as D,b,d as M}from"./card-BpVMxKnC.js";import{I as Q}from"./input-Bk6apN8e.js";import{L as R}from"./label-BtwW4Rce.js";import{P as X}from"./plus-BBxs9khZ.js";import{E as Y}from"./external-link-CSOHpDx9.js";import{T as $}from"./trash-2-BXc8_gzD.js";import{C as F}from"./copy-Cc8kjLmO.js";import"./separator-C45GX3TU.js";import"./sun-CRo_k_Vt.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const W=A("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),oe=()=>{const{t:s}=E("account"),{user:T}=P(),[S,t]=n.useState(!1),[c,u]=n.useState(""),[r,h]=n.useState(null),[_,j]=n.useState(!1),{data:y=[],isLoading:q}=B(l.apiKeys.list.queryOptions(void 0,{enabled:!!T})),g=p({...l.apiKeys.create.mutationOptions(),onSuccess:a=>{h(a.key),u(""),o.invalidateQueries({queryKey:[["apiKeys","list"]]})},onError:a=>{d.error(a.message)}}),L=p({...l.apiKeys.revoke.mutationOptions(),onSuccess:()=>{o.invalidateQueries({queryKey:[["apiKeys","list"]]}),d.success(s("apiKeys.revoked"))}}),O=p({...l.apiKeys.delete.mutationOptions(),onSuccess:()=>{o.invalidateQueries({queryKey:[["apiKeys","list"]]}),d.success(s("apiKeys.deleted"))}}),z=async a=>{await navigator.clipboard.writeText(a),j(!0),setTimeout(()=>j(!1),2e3)},f=()=>{h(null),t(!1)};return e.jsx(H,{children:e.jsx("main",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"max-w-3xl mx-auto px-4 sm:px-6 py-8 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:s("apiKeys.title")}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s("apiKeys.description")})]}),e.jsxs(i,{onClick:()=>t(!0),children:[e.jsx(X,{className:"h-4 w-4 mr-2"}),s("apiKeys.create")]})]}),e.jsx(m,{className:"bg-muted/50",children:e.jsxs(x,{className:"flex items-center justify-between py-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:s("apiKeys.docsTitle")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("apiKeys.docsDescription")})]}),e.jsx(i,{variant:"outline",asChild:!0,children:e.jsxs("a",{href:"https://api.roomlift.ai/trpc/api/v1/docs",target:"_blank",rel:"noopener noreferrer",children:[e.jsx(Y,{className:"h-4 w-4"}),s("apiKeys.viewDocs")]})})]})}),e.jsxs(m,{children:[e.jsx(D,{children:e.jsx(b,{className:"text-base",children:s("apiKeys.quickStart")})}),e.jsx(x,{children:e.jsx("pre",{className:"bg-muted p-4 rounded-lg text-sm overflow-x-auto",children:e.jsx("code",{children:`curl -X POST https://api.roomlift.ai/trpc/api/v1/generations \\
7  -H "Authorization: Bearer YOUR_API_KEY" \\
8  -H "Content-Type: application/json" \\
9  -d '{
10    "imageUrl": "https://example.com/room.jpg",
11    "mode": "interior",
12    "style": "scandi",
13    "roomType": "living-room"
14  }'`})})})]}),e.jsxs(m,{children:[e.jsxs(D,{children:[e.jsxs(b,{className:"flex items-center gap-2",children:[e.jsx(I,{className:"h-5 w-5"}),s("apiKeys.keysTitle")]}),e.jsx(M,{children:s("apiKeys.keysDescription")})]}),e.jsx(x,{children:q?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("apiKeys.loading")}):y.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("apiKeys.noKeys")}):e.jsx("div",{className:"space-y-3",children:y.map(a=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:a.name}),a.is_revoked&&e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-destructive/10 text-destructive",children:s("apiKeys.statusRevoked")})]}),e.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[e.jsxs("code",{className:"bg-muted px-2 py-0.5 rounded",children:[a.key_prefix,"..."]}),e.jsxs("span",{children:[s("apiKeys.created")," ",new Date(a.created_at).toLocaleDateString()]}),a.last_used_at&&e.jsxs("span",{children:[s("apiKeys.lastUsed")," ",new Date(a.last_used_at).toLocaleDateString()]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!a.is_revoked&&e.jsx(i,{variant:"ghost",size:"sm",onClick:()=>L.mutate({id:a.id}),children:e.jsx(W,{className:"h-4 w-4"})}),e.jsx(i,{variant:"ghost",size:"sm",onClick:()=>O.mutate({id:a.id}),children:e.jsx($,{className:"h-4 w-4"})})]})]},a.id))})})]}),e.jsx(K,{open:S&&!r,onOpenChange:t,children:e.jsxs(v,{children:[e.jsxs(N,{children:[e.jsx(C,{children:s("apiKeys.createTitle")}),e.jsx(w,{children:s("apiKeys.createDescription")})]}),e.jsx("div",{className:"space-y-4 py-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(R,{children:s("apiKeys.keyName")}),e.jsx(Q,{placeholder:s("apiKeys.keyNamePlaceholder"),value:c,onChange:a=>u(a.target.value)})]})}),e.jsxs(k,{children:[e.jsx(i,{variant:"outline",onClick:()=>t(!1),children:s("apiKeys.cancel")}),e.jsx(i,{onClick:()=>g.mutate({name:c}
14),disabled:!c.trim()||g.isPending,children:s("apiKeys.createButton")})]})]})}),e.jsx(K,{open:!!r,onOpenChange:f,children:e.jsxs(v,{children:[e.jsxs(N,{children:[e.jsx(C,{children:s("apiKeys.keyCreated")}),e.jsx(w,{children:s("apiKeys.keyCreatedWarning")})]}),e.jsx("div",{className:"space-y-4 py-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 bg-muted p-3 rounded-lg text-sm break-all",children:r}),e.jsx(i,{variant:"outline",size:"icon",onClick:()=>z(r),children:_?e.jsx(U,{className:"h-4 w-4 text-green-500"}):e.jsx(F,{className:"h-4 w-4"})})]})}),e.jsx(k,{children:e.jsx(i,{onClick:f,children:s("apiKeys.done")})})]})})]})})})};export{oe as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.