@tapflowio/relay 0.9.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RelayServer.d.ts +3 -0
- package/dist/RelayServer.d.ts.map +1 -1
- package/dist/RelayServer.js +29 -1
- package/dist/RelayServer.js.map +1 -1
- package/dist/api/builds.d.ts +2 -0
- package/dist/api/builds.d.ts.map +1 -1
- package/dist/api/builds.js +34 -7
- package/dist/api/builds.js.map +1 -1
- package/dist/migrations/012_build_delete_after.sql +14 -0
- package/package.json +2 -2
- package/public/assets/AppCenter-BkK502r-.js +21 -0
- package/public/assets/AppCenter-BkK502r-.js.br +0 -0
- package/public/assets/{Default-CNIOwJix.js → Default-DJ3O2SsV.js} +1 -1
- package/public/assets/Default-DJ3O2SsV.js.br +0 -0
- package/public/assets/{Invite-CxAak0QY.js → Invite-CvXlN2kS.js} +1 -1
- package/public/assets/Invite-CvXlN2kS.js.br +0 -0
- package/public/assets/{MacResources-BkDhO6IY.js → MacResources-5y1xvEIy.js} +1 -1
- package/public/assets/MacResources-5y1xvEIy.js.br +0 -0
- package/public/assets/{NotFound-C_RPjQyM.js → NotFound-FsRS9tXW.js} +1 -1
- package/public/assets/NotFound-FsRS9tXW.js.br +0 -0
- package/public/assets/{QASession-BI0UoxxZ.js → QASession-DaXI2EbF.js} +1 -1
- package/public/assets/QASession-DaXI2EbF.js.br +0 -0
- package/public/assets/{ResetPassword-B3B1vO7t.js → ResetPassword-BmOUZhvy.js} +1 -1
- package/public/assets/ResetPassword-BmOUZhvy.js.br +0 -0
- package/public/assets/{Setup-DAK5iAZn.js → Setup-DIjEK62E.js} +1 -1
- package/public/assets/Setup-DIjEK62E.js.br +0 -0
- package/public/assets/{Team-DwGH3nTh.js → Team-BF_Sypz1.js} +1 -1
- package/public/assets/Team-BF_Sypz1.js.br +0 -0
- package/public/assets/Tokens-CeT9D1an.js +1 -0
- package/public/assets/Tokens-CeT9D1an.js.br +0 -0
- package/public/assets/{alert-dialog-C9JkZxpw.js → alert-dialog-DdKN_y9-.js} +1 -1
- package/public/assets/alert-dialog-DdKN_y9-.js.br +0 -0
- package/public/assets/{badge-C4QfN3hf.js → badge-BWfJJL5y.js} +1 -1
- package/public/assets/badge-BWfJJL5y.js.br +0 -0
- package/public/assets/build-format-B_GKS7x0.js +11 -0
- package/public/assets/build-format-B_GKS7x0.js.br +0 -0
- package/public/assets/{dialog-BDl6uCtr.js → dialog-C4OyiMxc.js} +1 -1
- package/public/assets/dialog-C4OyiMxc.js.br +0 -0
- package/public/assets/{index-BgHk9cIy.js → index-C1qD3uWi.js} +3 -3
- package/public/assets/index-C1qD3uWi.js.br +0 -0
- package/public/assets/{pencil-Fy1ryeVj.js → pencil-CKHOeGOo.js} +1 -1
- package/public/assets/pencil-CKHOeGOo.js.br +0 -0
- package/public/assets/{table-DAingeQp.js → table-CRKLjzLC.js} +1 -1
- package/public/assets/table-CRKLjzLC.js.br +0 -0
- package/public/assets/{tabs-BCSJZGsw.js → tabs-LFfwE6UX.js} +1 -1
- package/public/assets/tabs-LFfwE6UX.js.br +0 -0
- package/public/assets/trash-2-DswjRF4T.js +11 -0
- package/public/assets/trash-2-DswjRF4T.js.br +0 -0
- package/public/index.html +1 -1
- package/public/index.html.br +0 -0
- package/public/assets/AppCenter-DMBOeAOk.js +0 -16
- package/public/assets/AppCenter-DMBOeAOk.js.br +0 -0
- package/public/assets/Default-CNIOwJix.js.br +0 -0
- package/public/assets/Invite-CxAak0QY.js.br +0 -0
- package/public/assets/MacResources-BkDhO6IY.js.br +0 -0
- package/public/assets/NotFound-C_RPjQyM.js.br +0 -0
- package/public/assets/QASession-BI0UoxxZ.js.br +0 -0
- package/public/assets/ResetPassword-B3B1vO7t.js.br +0 -0
- package/public/assets/Setup-DAK5iAZn.js.br +0 -0
- package/public/assets/Team-DwGH3nTh.js.br +0 -0
- package/public/assets/Tokens-DHSzYss8.js +0 -6
- package/public/assets/Tokens-DHSzYss8.js.br +0 -0
- package/public/assets/alert-dialog-C9JkZxpw.js.br +0 -0
- package/public/assets/badge-C4QfN3hf.js.br +0 -0
- package/public/assets/build-format-Dgn-J3If.js +0 -11
- package/public/assets/build-format-Dgn-J3If.js.br +0 -0
- package/public/assets/dialog-BDl6uCtr.js.br +0 -0
- package/public/assets/index-BgHk9cIy.js.br +0 -0
- package/public/assets/pencil-Fy1ryeVj.js.br +0 -0
- package/public/assets/plus-Ni9nU3x4.js +0 -6
- package/public/assets/plus-Ni9nU3x4.js.br +0 -0
- package/public/assets/table-DAingeQp.js.br +0 -0
- package/public/assets/tabs-BCSJZGsw.js.br +0 -0
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import{Y as T,a7 as n,a4 as e,B as b,L as y,a9 as P,K as G,I as L,S as E,g as K,al as Q,am as J}from"./index-BgHk9cIy.js";import{d as W,S as X,P as Z,g as ee,f as se,h as ae,b as te,u as le}from"./build-format-Dgn-J3If.js";import{D as z,f as M,a as U,d as V,e as q,S as k,i as D,j as A,g as C,h as c,C as ne}from"./dialog-BDl6uCtr.js";import{P as re}from"./plus-Ni9nU3x4.js";import{B as O}from"./badge-C4QfN3hf.js";import{A as ie,c as ce,f as oe,g as de,d as xe,e as ue,b as pe,a as he}from"./alert-dialog-C9JkZxpw.js";/**
|
|
2
|
-
* @license lucide-react v0.577.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 me=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],fe=T("layers",me);/**
|
|
7
|
-
* @license lucide-react v0.577.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const ge=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],je=T("package",ge);/**
|
|
12
|
-
* @license lucide-react v0.577.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const ve=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Ne=T("upload",ve);function Se({onSuccess:s,appId:l}){const[u,r]=n.useState(!1),[a,h]=n.useState(null),[o,p]=n.useState("none"),g=n.useRef(null);function f(i){if(i.preventDefault(),!a)return;const d=new FormData;d.append("file",a),o!=="none"&&d.append("status",o),l&&d.append("app_id",String(l));const N=fetch("/api/v1/builds",{method:"POST",credentials:"include",body:d}).then(async x=>{if(!x.ok){const m=await x.json().catch(()=>({}));throw new Error(m.error??"Upload failed. Check the file format.")}s()});P.promise(N,{loading:"Uploading build…",success:"Build uploaded",error:x=>x instanceof Error?x.message:"Failed to upload build"}),r(!1),h(null),p("none")}function v(i){r(i),i||(h(null),p("none"))}return e.jsxs(z,{open:u,onOpenChange:v,children:[e.jsx(M,{asChild:!0,children:e.jsxs(b,{size:"sm",children:[e.jsx(Ne,{className:"mr-2 h-4 w-4"}),"Upload build"]})}),e.jsxs(U,{className:"sm:max-w-md",children:[e.jsx(V,{children:e.jsx(q,{children:"Upload build"})}),e.jsxs("form",{onSubmit:f,className:"flex flex-col gap-4 pt-2",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(y,{children:"File"}),e.jsx("div",{className:"flex h-24 cursor-pointer items-center justify-center rounded-md border-2 border-dashed text-sm text-muted-foreground hover:border-primary",onClick:()=>{var i;return(i=g.current)==null?void 0:i.click()},onDragOver:i=>i.preventDefault(),onDrop:i=>{i.preventDefault();const d=i.dataTransfer.files[0];d&&h(d)},children:a?a.name:"Click or drag to upload"}),e.jsx("input",{ref:g,type:"file",accept:".zip,.apk",className:"hidden",onChange:i=>{var d;return h(((d=i.target.files)==null?void 0:d[0])??null)}}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["iOS: ",e.jsx("code",{children:".app.zip"})," (zip the ",e.jsx("code",{children:".app"})," folder after ",e.jsx("code",{children:"xcodebuild -sdk iphonesimulator"}),") · Android: ",e.jsx("code",{children:".apk"})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(y,{children:["Status ",e.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e.jsxs(k,{value:o,onValueChange:p,children:[e.jsx(D,{children:e.jsx(A,{})}),e.jsxs(C,{children:[e.jsx(c,{value:"none",children:"None"}),e.jsx(c,{value:"Backlog",children:"Backlog"}),e.jsx(c,{value:"In Progress",children:"In Progress"}),e.jsx(c,{value:"Done",children:"Done"}),e.jsx(c,{value:"Rejected",children:"Rejected"})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(b,{type:"button",variant:"outline",className:"w-24",onClick:()=>r(!1),children:"Cancel"}),e.jsx(b,{type:"submit",className:"w-24",disabled:!a,children:"Upload"})]})]})]})]})}function w({className:s,...l}){return e.jsx("span",{className:G("font-mono text-xs tabular-nums tracking-tight",s),...l})}function be({onSuccess:s}){const[l,u]=n.useState(!1),[r,a]=n.useState(""),[h,o]=n.useState(""),[p,g]=n.useState("ios"),[f,v]=n.useState(""),[i,d]=n.useState(!1);async function N(x){x.preventDefault(),v(""),d(!0);try{const m=await W({name:r.trim(),bundle_id_key:h.trim(),platform:p});if(!m){v("Failed to create app");return}if("error"in m){v(m.error);return}u(!1),a(""),o(""),g("ios"),P.success("App created"),s()}catch{P.error("Failed to create app — check your network")}finally{d(!1)}}return e.jsxs(z,{open:l,onOpenChange:u,children:[e.jsx(M,{asChild:!0,children:e.jsxs("button",{className:"flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-left text-sm text-muted-foreground hover:bg-accent hover:text-foreground transition-colors",children:[e.jsx(re,{className:"size-3.5 shrink-0"}),e.jsx("span",{children:"Add App"})]})}),e.jsxs(U,{className:"sm:max-w-sm",children:[e.jsx(V,{children:e.jsx(q,{children:"Add App"})}),e.jsxs("form",{onSubmit:N,className:"flex flex-col gap-4 pt-2",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(y,{htmlFor:"app-name",children:"Name"}),e.jsx(L,{id:"app-name",value:r,onChange:x=>a(x.target.value),placeholder:"My App",required:!0})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(y,{htmlFor:"bundle-id",children:"Bundle ID"}),e.jsx(L,{id:"bundle-id",value:h,onChange:x=>o(x.target.value),placeholder:"com.example.myapp",required:!0})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(y,{htmlFor:"platform",children:"Platform"}),e.jsxs(k,{value:p,onValueChange:x=>g(x),children:[e.jsx(D,{id:"platform",children:e.jsx(A,{})}),e.jsxs(C,{children:[e.jsx(c,{value:"ios",children:"iOS"}),e.jsx(c,{value:"android",children:"Android"}),e.jsx(c,{value:"both",children:"Both"})]})]})]}),f&&e.jsx("p",{className:"text-sm text-destructive",children:f}),e.jsx(b,{type:"submit",disabled:i,className:"w-full",children:i?"Creating…":"Create App"})]})]})]})}function ye({apps:s,selectedAppId:l,onSelect:u,onAdd:r}){return e.jsxs("aside",{className:"w-64 shrink-0 border-r flex flex-col gap-1 p-3 overflow-y-auto",children:[e.jsx("span",{className:"px-2 pb-1 font-mono text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Apps"}),s.length===0&&e.jsx("span",{className:"px-2 text-sm text-muted-foreground",children:"No apps yet"}),s.map(a=>e.jsxs("button",{onClick:()=>u(a.id),className:["flex flex-col gap-0.5 rounded-md px-2 py-2 text-left text-sm hover:bg-accent overflow-hidden",a.id===l?"bg-accent font-medium":""].join(" "),children:[e.jsx("span",{className:"truncate",children:a.name}),e.jsx(w,{className:"text-muted-foreground truncate",children:a.bundle_id_key})]},a.id)),e.jsx("div",{className:"mt-1 border-t pt-1",children:e.jsx(be,{onSuccess:r})})]})}function we(s){const r=new Date(s).getTime()+6048e5-Date.now();if(r<=0)return{label:"Expired",urgent:!0};const a=Math.floor(r/36e5);return a<1?{label:"< 1 hour left",urgent:!0}:a<24?{label:`Expires in ${a}h`,urgent:a<6}:{label:`Expires in ${Math.floor(a/24)}d`,urgent:!1}}function ke({build:s,isLast:l,onNavigate:u,onStatusChange:r}){const[a,h]=n.useState(!1),o=s.status_label==="Done",p=o&&s.completed_at?we(s.completed_at):null;function g(f){if(f==="Done"){h(!0);return}r(s.id,f==="none"?null:f)}return e.jsxs(e.Fragment,{children:[e.jsx(ie,{open:a,onOpenChange:h,children:e.jsxs(ce,{children:[e.jsxs(oe,{children:[e.jsx(de,{children:"Mark as Done?"}),e.jsx(xe,{children:"Build files will be automatically deleted after 7 days. Reverting the status will cancel the scheduled deletion."})]}),e.jsxs(ue,{children:[e.jsx(pe,{children:"Cancel"}),e.jsx(he,{onClick:()=>{r(s.id,"Done"),h(!1)},children:"Confirm"})]})]})}),e.jsxs("div",{className:["flex items-center gap-3 px-4 py-3",l?"":"border-b"].join(" "),children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("span",{className:"text-sm font-medium",children:["build ",e.jsx(w,{children:s.build_number??"—"})]}),e.jsx(O,{tone:s.platform==="ios"?"ios":"android",className:"text-xs capitalize",children:s.platform}),s.status_label&&e.jsx(O,{tone:X[s.status_label],className:"text-xs",children:s.status_label})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:"14px",marginTop:"0.7rem",alignItems:"center"},className:"text-xs text-muted-foreground",children:[s.uploader&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:s.uploader}),e.jsx(E,{orientation:"vertical",className:"h-3"})]}),e.jsx(w,{children:new Date(s.uploaded_at).toLocaleDateString()}),p&&e.jsxs(e.Fragment,{children:[e.jsx(E,{orientation:"vertical",className:"h-3"}),e.jsx("span",{className:p.urgent?"text-destructive":"",children:p.label})]})]})]}),e.jsxs(k,{value:s.status_label??"none",onValueChange:g,children:[e.jsx(D,{className:"h-9 w-32 text-xs",children:e.jsx(A,{})}),e.jsxs(C,{children:[e.jsx(c,{value:"none",children:e.jsx("span",{className:"text-muted-foreground",children:"—"})}),e.jsx(c,{value:"Backlog",children:"Backlog"}),e.jsx(c,{value:"In Progress",children:"In Progress"}),e.jsx(c,{value:"Done",children:"Done"}),e.jsx(c,{value:"Rejected",children:"Rejected"})]})]}),e.jsxs(b,{size:"sm",onClick:()=>u(s.id),disabled:o,children:[e.jsx(Z,{className:"mr-1.5 h-3.5 w-3.5"}),"Start QA"]})]})]})}function De({versionName:s,builds:l,isOpen:u,onToggle:r,onNavigate:a,onStatusChange:h}){return e.jsxs("div",{className:"rounded-lg shadow-card-2 overflow-hidden",children:[e.jsxs("button",{className:"flex w-full items-center gap-2 px-4 py-3 text-left hover:bg-accent/50 bg-card",onClick:r,children:[u?e.jsx(ne,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):e.jsx(K,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx(w,{className:"font-medium text-sm text-foreground",children:s}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",l.length," build",l.length>1?"s":"",")"]})]}),u&&e.jsx("div",{className:"border-t bg-card",children:l.map((o,p)=>e.jsx(ke,{build:o,isLast:p===l.length-1,onNavigate:a,onStatusChange:h},o.id))})]})}function Te(){const s=Q(),[l,u]=J(),[r,a]=n.useState([]),[h,o]=n.useState([]),[p,g]=n.useState(""),[f,v]=n.useState("all"),[i,d]=n.useState(!0),[N,x]=n.useState(new Set),m=l.get("appId")?Number(l.get("appId")):null,R=r.find(t=>t.id===m)??null,_=n.useCallback(async()=>{const t=await ee();a(t),!l.get("appId")&&t.length>0&&u({appId:String(t[0].id)},{replace:!0})},[l,u]),B=n.useCallback(async()=>{if(!m){o([]),d(!1);return}d(!0);try{const t=await se({appId:m,search:p,statusFilter:f});o(t),t.length>0&&N.size===0&&x(new Set([t[0].version_name??"Unversioned"]))}finally{d(!1)}},[m,p,f]);n.useEffect(()=>{_()},[]),n.useEffect(()=>{B()},[B]);function $(t){t!==m&&(o([]),x(new Set)),u({appId:String(t)})}function H(t){x(S=>{const j=new Set(S);return j.has(t)?j.delete(t):j.add(t),j})}async function Y(t,S){await le(t,S),o(j=>j.map(I=>I.id===t?{...I,status_label:S}:I))}const F=ae(h);return e.jsxs("div",{className:"flex h-full gap-0",children:[e.jsx(ye,{apps:r,selectedAppId:m,onSelect:$,onAdd:_}),e.jsxs("main",{className:"flex-1 flex flex-col gap-4 p-4 overflow-y-auto min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[e.jsx("h1",{className:"text-xl font-semibold tracking-display-sm",children:R?R.name:"App Center"}),e.jsx(Se,{onSuccess:()=>{_(),B()},appId:m})]}),m?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(te,{placeholder:"Search version…",value:p,onChange:g}),e.jsxs(k,{value:f,onValueChange:v,children:[e.jsx(D,{className:"h-8 w-36",children:e.jsx(A,{placeholder:"Status"})}),e.jsxs(C,{children:[e.jsx(c,{value:"all",children:"All statuses"}),e.jsx(c,{value:"Backlog",children:"Backlog"}),e.jsx(c,{value:"In Progress",children:"In Progress"}),e.jsx(c,{value:"Done",children:"Done"}),e.jsx(c,{value:"Rejected",children:"Rejected"})]})]})]}),i?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading…"}):F.length===0?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center",children:[e.jsx(je,{className:"w-8 h-8 text-muted-foreground/40"}),e.jsx("p",{className:"text-sm font-medium",children:"No builds yet"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Upload the first build to get started."})]}):e.jsx("div",{className:"flex flex-col gap-2",children:F.map(({versionName:t,builds:S})=>e.jsx(De,{versionName:t,builds:S,isOpen:N.has(t),onToggle:()=>H(t),onNavigate:j=>s(`/app-center/build?id=${j}`),onStatusChange:Y},t))})]}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center",children:[e.jsx(fe,{className:"w-8 h-8 text-muted-foreground/40"}),e.jsx("p",{className:"text-sm font-medium",children:"No app selected"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose an app from the sidebar to view its builds."})]})]})]})}export{Te as AppCenter};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{Y as $,a7 as n,ai as H,aa as M,a4 as e,B as d,a9 as a,L as k,I as S,C as O,d as V,e as z,c as W,b as J,a5 as U,a8 as A}from"./index-BgHk9cIy.js";import{B as I}from"./badge-C4QfN3hf.js";import{A as Y,c as q,f as G,g as K,d as Q,e as X,b as Z}from"./alert-dialog-C9JkZxpw.js";import{D as ee,f as se,a as ae,d as te,e as ne,S as re,i as oe,j as ie,g as le,h as _}from"./dialog-BDl6uCtr.js";import{T as ce,d as de,e as y,c as x,a as xe,b as i}from"./table-DAingeQp.js";import{P as he}from"./plus-Ni9nU3x4.js";/**
|
|
2
|
-
* @license lucide-react v0.577.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 me=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],pe=$("trash-2",me);async function ue(){const t=window.location.protocol==="https:"?"wss":"ws";if(["localhost","127.0.0.1","[::1]"].includes(window.location.hostname))try{const h=await fetch("/api/v1/relay/host",{credentials:"include"});if(h.ok){const{lanHost:l,port:o}=await h.json();if(l)return`${t}://${l}:${o}`}}catch{}return`${t}://${window.location.host}`}const je=U({name:A().min(1),expiresDays:A().refine(t=>{const r=parseInt(t,10);return!isNaN(r)&&r>=1&&r<=365},{message:"Must be between 1 and 365"})});function Ne(){const[t,r]=n.useState([]),[h,l]=n.useState(!1),[o,v]=n.useState(""),[c,w]=n.useState("api"),[N,b]=n.useState(""),[u,j]=n.useState(null),{register:T,handleSubmit:B,reset:E,formState:{errors:m,isSubmitting:C}}=H({resolver:M(je),mode:"onBlur",defaultValues:{name:"",expiresDays:"30"}});function g(){fetch("/api/v1/tokens",{credentials:"include"}).then(s=>s.json()).then(r)}n.useEffect(()=>{g()},[]);async function L(s){try{const p=await fetch("/api/v1/tokens",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s.name,expires_in_days:parseInt(s.expiresDays,10),...c==="agent"?{scope:"agent"}:{}})});if(!p.ok){const f=await p.json().catch(()=>null);a.error((f==null?void 0:f.error)??"Failed to create token");return}const P=await p.json();c==="agent"&&b(await ue()),a.success("Token created"),v(P.token),g()}catch{a.error("Network error")}}function R(s){l(s),s||(v(""),w("api"),b(""),E())}async function F(s){try{return(await fetch(`/api/v1/tokens/${s}`,{method:"DELETE",credentials:"include"})).ok?(a.success("Token revoked"),g(),!0):(a.error("Failed to revoke token"),!1)}catch{return a.error("Network error"),!1}}function D(s){return s.expires_at&&new Date(s.expires_at)<new Date}return e.jsxs("div",{className:"flex flex-col gap-6 max-w-[900px] mx-auto w-full p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"text-xl font-semibold",children:"Personal Access Tokens"}),e.jsxs(ee,{open:h,onOpenChange:R,children:[e.jsx(se,{asChild:!0,children:e.jsxs(d,{size:"sm",children:[e.jsx(he,{className:"mr-2 h-4 w-4"}),"New token"]})}),e.jsxs(ae,{className:"sm:max-w-md",children:[e.jsx(te,{children:e.jsx(ne,{children:"Create token"})}),o?e.jsxs("div",{className:"flex flex-col gap-3 pt-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Copy this token now — it won't be shown again."}),e.jsx("code",{className:"rounded bg-muted px-3 py-2 text-xs break-all font-mono",children:o}),c==="agent"&&N&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Run this on the agent Mac to connect it to this relay:"}),e.jsx("code",{className:"rounded bg-muted px-3 py-2 text-xs break-all font-mono",children:`tapflow agent start --relay ${N} --token ${o}`})]}),e.jsx(d,{onClick:()=>{navigator.clipboard.writeText(o).then(()=>{a.success("Token copied to clipboard"),l(!1)}).catch(()=>a.error("Failed to copy — copy manually"))},children:"Copy & close"})]}):e.jsxs("form",{onSubmit:B(L),className:"flex flex-col gap-4 pt-2",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"token-name",children:"Name"}),e.jsx(S,{id:"token-name",placeholder:"e.g. ci-deploy",...T("name")}),m.name&&e.jsx("p",{className:"text-sm text-destructive",children:m.name.message})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{htmlFor:"expires",children:"Expires in (days)"}),e.jsx(S,{id:"expires",type:"number",...T("expiresDays")}),m.expiresDays&&e.jsx("p",{className:"text-sm text-destructive",children:m.expiresDays.message})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(k,{children:"Type"}),e.jsxs(re,{value:c,onValueChange:s=>w(s),children:[e.jsx(oe,{children:e.jsx(ie,{})}),e.jsxs(le,{children:[e.jsx(_,{value:"api",children:"API — CI uploads & API access"}),e.jsx(_,{value:"agent",children:"Agent — connect remote device agents (Admin only)"})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Scope: ",e.jsx(I,{variant:"secondary",children:c==="agent"?"agent":"view, builds:write"})]}),e.jsx(d,{type:"submit",disabled:C,children:C?"Creating…":"Create token"})]})]})]})]}),e.jsxs(O,{children:[e.jsxs(V,{children:[e.jsx(z,{children:"Active tokens"}),e.jsxs(W,{children:["Use these tokens with ",e.jsx("code",{className:"text-xs",children:"Authorization: Bearer <token>"})," for API deployments."]})]}),e.jsx(J,{className:"px-4 pt-0 pb-2",children:e.jsxs(ce,{children:[e.jsx(de,{children:e.jsxs(y,{children:[e.jsx(x,{children:"Name"}),e.jsx(x,{children:"Scope"}),e.jsx(x,{children:"Last used"}),e.jsx(x,{children:"Expires"}),e.jsx(x,{className:"w-10"})]})}),e.jsx(xe,{children:t.length===0?e.jsx(y,{children:e.jsx(i,{colSpan:5,className:"h-20 text-center text-muted-foreground",children:"No tokens yet."})}):t.map(s=>e.jsxs(y,{className:"hover:bg-transparent",children:[e.jsx(i,{className:"font-medium",children:s.name}),e.jsx(i,{children:e.jsx(I,{variant:"secondary",children:s.scope})}),e.jsx(i,{className:"text-muted-foreground text-sm",children:s.last_used_at?new Date(s.last_used_at).toLocaleDateString():"Never"}),e.jsx(i,{children:s.expires_at?e.jsx("span",{className:D(s)?"text-destructive text-sm":"text-muted-foreground text-sm",children:D(s)?"Expired":new Date(s.expires_at).toLocaleDateString()}):e.jsx("span",{className:"text-muted-foreground text-sm",children:"Never"})}),e.jsx(i,{children:e.jsx(d,{variant:"destructive",size:"icon",className:"h-7 w-7","aria-label":"Revoke token",onClick:()=>j(s.id),children:e.jsx(pe,{className:"h-4 w-4"})})})]},s.id))})]})})]}),e.jsx(Y,{open:u!==null,onOpenChange:s=>{s||j(null)},children:e.jsxs(q,{children:[e.jsxs(G,{children:[e.jsx(K,{children:"Revoke token?"}),e.jsx(Q,{children:"Any active API calls using this token will immediately fail."})]}),e.jsxs(X,{children:[e.jsx(Z,{children:"Cancel"}),e.jsx(d,{variant:"destructive",onClick:async()=>{if(u===null)return;await F(u)&&j(null)},children:"Revoke"})]})]})})]})}export{Ne as TokenSettings};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{Y as i,a4 as r,I as o}from"./index-BgHk9cIy.js";/**
|
|
2
|
-
* @license lucide-react v0.577.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 c=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],f=i("play",c);/**
|
|
7
|
-
* @license lucide-react v0.577.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const u=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],l=i("search",u);function m({value:e,onChange:a,placeholder:t,className:n}){return r.jsxs("div",{className:"relative",children:[r.jsx(l,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),r.jsx(o,{placeholder:t,value:e,onChange:s=>a(s.target.value),className:`h-8 pl-8 ${n??"w-48"}`})]})}async function h(){const e=await fetch("/api/v1/apps",{credentials:"include"});return e.ok?(await e.json()).items:[]}async function y({appId:e,search:a,statusFilter:t}){const n=new URLSearchParams({app_id:String(e),limit:"100",sort:"uploaded_at",dir:"desc"});a&&n.set("q",a),t&&t!=="all"&&n.set("status",t);const s=await fetch(`/api/v1/builds?${n}`,{credentials:"include"});return s.ok?(await s.json()).items:[]}async function b(e){const a=await fetch("/api/v1/apps",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return a.status===409?{error:"App with this bundle ID and platform already exists"}:a.ok?a.json():null}async function _(e,a){await fetch(`/api/v1/builds/${e}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({status_label:a})})}async function g(e){const a=await fetch(`/api/v1/builds/${e}`,{credentials:"include"});return a.ok?a.json():null}function j(e){const a=new Map;for(const t of e){const n=t.version_name??"Unversioned";a.has(n)||a.set(n,[]),a.get(n).push(t)}return Array.from(a.entries()).map(([t,n])=>({versionName:t,builds:n}))}const v={Backlog:"backlog","In Progress":"progress",Done:"done",Rejected:"rejected"};function w(e){return e.version_name&&e.build_number?`${e.version_name} · build ${e.build_number}`:e.version_name??e.version_label??(e.build_number?`build ${e.build_number}`:"Build")}export{f as P,v as S,l as a,m as b,w as c,b as d,g as e,y as f,h as g,j as h,_ as u};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{Y as e}from"./index-BgHk9cIy.js";/**
|
|
2
|
-
* @license lucide-react v0.577.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 o=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],t=e("plus",o);export{t as P};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|