@tapflowio/relay 0.26.0 → 0.27.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.
Files changed (155) hide show
  1. package/dist/RelayServer.d.ts +81 -3
  2. package/dist/RelayServer.d.ts.map +1 -1
  3. package/dist/RelayServer.js +278 -17
  4. package/dist/RelayServer.js.map +1 -1
  5. package/dist/SessionManager.d.ts +5 -3
  6. package/dist/SessionManager.d.ts.map +1 -1
  7. package/dist/SessionManager.js +3 -1
  8. package/dist/SessionManager.js.map +1 -1
  9. package/dist/api/auth.d.ts +2 -1
  10. package/dist/api/auth.d.ts.map +1 -1
  11. package/dist/api/auth.js +1 -1
  12. package/dist/api/auth.js.map +1 -1
  13. package/dist/api/passwordReset.d.ts +2 -1
  14. package/dist/api/passwordReset.d.ts.map +1 -1
  15. package/dist/api/passwordReset.js +1 -1
  16. package/dist/api/passwordReset.js.map +1 -1
  17. package/dist/api/team.d.ts +3 -2
  18. package/dist/api/team.d.ts.map +1 -1
  19. package/dist/api/team.js +2 -2
  20. package/dist/api/team.js.map +1 -1
  21. package/dist/api/tokens.d.ts +2 -1
  22. package/dist/api/tokens.d.ts.map +1 -1
  23. package/dist/api/tokens.js +1 -1
  24. package/dist/api/tokens.js.map +1 -1
  25. package/dist/lib/connectionAuth.d.ts +29 -0
  26. package/dist/lib/connectionAuth.d.ts.map +1 -1
  27. package/dist/lib/connectionAuth.js +15 -0
  28. package/dist/lib/connectionAuth.js.map +1 -1
  29. package/dist/lib/webhookTransport.d.ts +29 -0
  30. package/dist/lib/webhookTransport.d.ts.map +1 -0
  31. package/dist/lib/webhookTransport.js +86 -0
  32. package/dist/lib/webhookTransport.js.map +1 -0
  33. package/dist/lib/webhookUrl.d.ts +6 -0
  34. package/dist/lib/webhookUrl.d.ts.map +1 -1
  35. package/dist/lib/webhookUrl.js +50 -14
  36. package/dist/lib/webhookUrl.js.map +1 -1
  37. package/dist/lib/webhooks.d.ts +2 -10
  38. package/dist/lib/webhooks.d.ts.map +1 -1
  39. package/dist/lib/webhooks.js +8 -3
  40. package/dist/lib/webhooks.js.map +1 -1
  41. package/package.json +6 -6
  42. package/public/assets/{AppCenter-DZCsC2wa.js → AppCenter-BMdYtQbV.js} +7 -7
  43. package/public/assets/AppCenter-BMdYtQbV.js.br +0 -0
  44. package/public/assets/AppCenter-BMdYtQbV.js.gz +0 -0
  45. package/public/assets/Default-0DHHVGaN.js +1 -0
  46. package/public/assets/Default-0DHHVGaN.js.br +0 -0
  47. package/public/assets/Default-0DHHVGaN.js.gz +0 -0
  48. package/public/assets/Invite-C0ZB_HiU.js +1 -0
  49. package/public/assets/Invite-C0ZB_HiU.js.br +0 -0
  50. package/public/assets/Invite-C0ZB_HiU.js.gz +0 -0
  51. package/public/assets/{MacResources-B0DQ9ISE.js → MacResources-DmY5pRV2.js} +1 -1
  52. package/public/assets/MacResources-DmY5pRV2.js.br +0 -0
  53. package/public/assets/MacResources-DmY5pRV2.js.gz +0 -0
  54. package/public/assets/QASession-2QogWEX7.js +150 -0
  55. package/public/assets/QASession-2QogWEX7.js.br +0 -0
  56. package/public/assets/QASession-2QogWEX7.js.gz +0 -0
  57. package/public/assets/ResetPassword-jNRuertx.js +1 -0
  58. package/public/assets/ResetPassword-jNRuertx.js.br +0 -0
  59. package/public/assets/ResetPassword-jNRuertx.js.gz +0 -0
  60. package/public/assets/Setup-CF_FN9Dt.js +1 -0
  61. package/public/assets/Setup-CF_FN9Dt.js.br +0 -0
  62. package/public/assets/Setup-CF_FN9Dt.js.gz +0 -0
  63. package/public/assets/Team-BbiyOGau.js +6 -0
  64. package/public/assets/Team-BbiyOGau.js.br +0 -0
  65. package/public/assets/Team-BbiyOGau.js.gz +0 -0
  66. package/public/assets/Tokens-CZo4sPTx.js +1 -0
  67. package/public/assets/Tokens-CZo4sPTx.js.br +0 -0
  68. package/public/assets/Tokens-CZo4sPTx.js.gz +0 -0
  69. package/public/assets/alert-dialog-DFz8G_zu.js +1 -0
  70. package/public/assets/alert-dialog-DFz8G_zu.js.br +0 -0
  71. package/public/assets/alert-dialog-DFz8G_zu.js.gz +0 -0
  72. package/public/assets/badge-B3vaBVIQ.js +1 -0
  73. package/public/assets/badge-B3vaBVIQ.js.br +0 -0
  74. package/public/assets/badge-B3vaBVIQ.js.gz +0 -0
  75. package/public/assets/{build-format-fzt-JrUX.js → build-format-dbQPU3A4.js} +3 -3
  76. package/public/assets/build-format-dbQPU3A4.js.br +0 -0
  77. package/public/assets/build-format-dbQPU3A4.js.gz +0 -0
  78. package/public/assets/{dialog-DQkbaw8h.js → dialog-DeBPk-I3.js} +5 -5
  79. package/public/assets/dialog-DeBPk-I3.js.br +0 -0
  80. package/public/assets/dialog-DeBPk-I3.js.gz +0 -0
  81. package/public/assets/field-hint-CMKmbVpy.js +1 -0
  82. package/public/assets/field-hint-CMKmbVpy.js.br +0 -0
  83. package/public/assets/field-hint-CMKmbVpy.js.gz +0 -0
  84. package/public/assets/index-B4w4Lh3e.js +218 -0
  85. package/public/assets/index-B4w4Lh3e.js.br +0 -0
  86. package/public/assets/index-B4w4Lh3e.js.gz +0 -0
  87. package/public/assets/index-CDWu0GQL.css +1 -0
  88. package/public/assets/index-CDWu0GQL.css.br +0 -0
  89. package/public/assets/index-CDWu0GQL.css.gz +0 -0
  90. package/public/assets/list-view-BvINA5t4.js +1 -0
  91. package/public/assets/list-view-BvINA5t4.js.br +0 -0
  92. package/public/assets/list-view-BvINA5t4.js.gz +0 -0
  93. package/public/assets/{pencil-BJcOp3oN.js → pencil-CycAOoC_.js} +2 -2
  94. package/public/assets/pencil-CycAOoC_.js.br +0 -0
  95. package/public/assets/pencil-CycAOoC_.js.gz +0 -0
  96. package/public/assets/resource-health-C1qSG3MK.js +1 -0
  97. package/public/assets/resource-health-C1qSG3MK.js.br +0 -0
  98. package/public/assets/resource-health-C1qSG3MK.js.gz +0 -0
  99. package/public/assets/{trash-DhBxh6H7.js → trash-BXQnOI5U.js} +3 -3
  100. package/public/assets/trash-BXQnOI5U.js.br +0 -0
  101. package/public/assets/trash-BXQnOI5U.js.gz +0 -0
  102. package/public/index.html +2 -2
  103. package/public/index.html.br +0 -0
  104. package/public/index.html.gz +0 -0
  105. package/public/assets/AppCenter-DZCsC2wa.js.br +0 -0
  106. package/public/assets/AppCenter-DZCsC2wa.js.gz +0 -0
  107. package/public/assets/Default-xD9Fmd5X.js +0 -1
  108. package/public/assets/Default-xD9Fmd5X.js.br +0 -0
  109. package/public/assets/Default-xD9Fmd5X.js.gz +0 -0
  110. package/public/assets/Invite-29Erwv8j.js +0 -1
  111. package/public/assets/Invite-29Erwv8j.js.br +0 -0
  112. package/public/assets/Invite-29Erwv8j.js.gz +0 -0
  113. package/public/assets/MacResources-B0DQ9ISE.js.br +0 -0
  114. package/public/assets/MacResources-B0DQ9ISE.js.gz +0 -0
  115. package/public/assets/QASession-D-n6PXuD.js +0 -150
  116. package/public/assets/QASession-D-n6PXuD.js.br +0 -0
  117. package/public/assets/QASession-D-n6PXuD.js.gz +0 -0
  118. package/public/assets/ResetPassword-BnPIwTYH.js +0 -1
  119. package/public/assets/ResetPassword-BnPIwTYH.js.br +0 -0
  120. package/public/assets/ResetPassword-BnPIwTYH.js.gz +0 -0
  121. package/public/assets/Setup-DmUGFblg.js +0 -1
  122. package/public/assets/Setup-DmUGFblg.js.br +0 -0
  123. package/public/assets/Setup-DmUGFblg.js.gz +0 -0
  124. package/public/assets/Team-BpvRgFfZ.js +0 -6
  125. package/public/assets/Team-BpvRgFfZ.js.br +0 -0
  126. package/public/assets/Team-BpvRgFfZ.js.gz +0 -0
  127. package/public/assets/Tokens-x6BtCcL7.js +0 -1
  128. package/public/assets/Tokens-x6BtCcL7.js.br +0 -0
  129. package/public/assets/Tokens-x6BtCcL7.js.gz +0 -0
  130. package/public/assets/alert-dialog-C8wDimW-.js +0 -1
  131. package/public/assets/alert-dialog-C8wDimW-.js.br +0 -0
  132. package/public/assets/alert-dialog-C8wDimW-.js.gz +0 -0
  133. package/public/assets/badge-CWVbeuH3.js +0 -1
  134. package/public/assets/badge-CWVbeuH3.js.br +0 -0
  135. package/public/assets/badge-CWVbeuH3.js.gz +0 -0
  136. package/public/assets/build-format-fzt-JrUX.js.br +0 -0
  137. package/public/assets/build-format-fzt-JrUX.js.gz +0 -0
  138. package/public/assets/dialog-DQkbaw8h.js.br +0 -0
  139. package/public/assets/dialog-DQkbaw8h.js.gz +0 -0
  140. package/public/assets/index-C1Fo8g_c.js +0 -218
  141. package/public/assets/index-C1Fo8g_c.js.br +0 -0
  142. package/public/assets/index-C1Fo8g_c.js.gz +0 -0
  143. package/public/assets/index-C2F1AgwB.css +0 -1
  144. package/public/assets/index-C2F1AgwB.css.br +0 -0
  145. package/public/assets/index-C2F1AgwB.css.gz +0 -0
  146. package/public/assets/list-view-DxI397-H.js +0 -1
  147. package/public/assets/list-view-DxI397-H.js.br +0 -0
  148. package/public/assets/list-view-DxI397-H.js.gz +0 -0
  149. package/public/assets/pencil-BJcOp3oN.js.br +0 -0
  150. package/public/assets/pencil-BJcOp3oN.js.gz +0 -0
  151. package/public/assets/resource-health-Cq3gqqVd.js +0 -1
  152. package/public/assets/resource-health-Cq3gqqVd.js.br +0 -0
  153. package/public/assets/resource-health-Cq3gqqVd.js.gz +0 -0
  154. package/public/assets/trash-DhBxh6H7.js.br +0 -0
  155. package/public/assets/trash-DhBxh6H7.js.gz +0 -0
@@ -1,6 +0,0 @@
1
- import{k as a,j as e,f as he}from"./vendor-react-BlPSzrEe.js";import{a2 as xe,aJ as pe,aI as je,aF as ve,aw as fe,B as k,L as _,I as Z,F as O,h as ge,C as be,c as ye,d as ke,a as we,av as x,ap as I,au as w,aq as Q,N as ee,ah as Ce}from"./index-C1Fo8g_c.js";import{D as V,a as q,d as M,e as B,b as Se,f as De,S as H,i as U,j as z,g as J,h as p}from"./dialog-DQkbaw8h.js";import{A as Te,c as Ne,f as Ae,g as Re,d as Ie,e as Ee,b as $e,a as Fe}from"./alert-dialog-C8wDimW-.js";import{l as Le,T as Pe,d as _e,e as K,c as S,a as Oe,L as Qe,b as D}from"./list-view-DxI397-H.js";import{j as G,l as W}from"./publicLink-D6zKS_wu.js";import{u as Ve}from"./useFocusAfterSwap-BY3N9f9v.js";import"./vendor-router-B_lVHrKl.js";/**
2
- * @license lucide-react v1.47.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 se={name:"user-plus",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]};se.node;const qe=xe(se),Me=I({email:w().email("Enter a valid email"),role:w().min(1,"Pick a role")}),Be=I({token:w(),emailSent:ee(),inviteUrl:w().nullable()}),He=I({token:w(),emailSent:ee(),resetUrl:w().nullable()});function X(j){return(navigator.clipboard?navigator.clipboard.writeText(j):Promise.reject(new Error("no clipboard"))).then(()=>!0,()=>!1)}function Y(j){const s=he.c(15),{link:l,copied:g,noun:d}=j,m=a.useId(),t=a.useRef(null);let u;s[0]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{var T;(T=t.current)==null||T.focus()},s[0]=u):u=s[0];let v;s[1]!==l?(v=[l],s[1]=l,s[2]=v):v=s[2],a.useEffect(u,v);let r;s[3]!==g||s[4]!==d?(r=g?`${d[0].toUpperCase()}${d.slice(1)} copied to clipboard:`:`Copy this ${d}:`,s[3]=g,s[4]=d,s[5]=r):r=s[5];let o;s[6]!==m||s[7]!==r?(o=e.jsx("p",{id:m,className:"text-sm text-muted-foreground",children:r}),s[6]=m,s[7]=r,s[8]=o):o=s[8];let h;s[9]!==m||s[10]!==l?(h=e.jsx(Z,{ref:t,readOnly:!0,value:l,"aria-labelledby":m,onFocus:Ue,className:"font-mono text-xs"}),s[9]=m,s[10]=l,s[11]=h):h=s[11];let f;return s[12]!==o||s[13]!==h?(f=e.jsxs(e.Fragment,{children:[o,h]}),s[12]=o,s[13]=h,s[14]=f):f=s[14],f}function Ue(j){return j.currentTarget.select()}function es(){var L,P;const j=pe(),s=je({queryKey:Q.teamMembers,queryFn:Ce}),l=s.data??[],g=Le(s),d=a.useRef(null),m=Ve(g,d),[t,u]=a.useState(null),v=a.useRef(null),[r,o]=a.useState(""),[h,f]=a.useState(!1),[T,N]=a.useState(""),[ie,ne]=a.useState(!1),[A,R]=a.useState(null),{register:te,handleSubmit:ae,control:le,reset:re,setError:oe,formState:{errors:b,isSubmitting:E}}=ve({resolver:fe(Me),defaultValues:{email:"",role:"QA"}}),$=()=>{j.invalidateQueries({queryKey:Q.teamMembers})};async function ce(i){N("");try{const n=await fetch("/api/v1/team/invite",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:i.email,role:i.role})});if(n.status===409){oe("email",{message:"Already a member. Change their role in the list instead."},{shouldFocus:!0});return}if(!n.ok)throw new Error(`Server error: ${n.status}`);const c=Be.parse(await n.json()),C=c.inviteUrl??G((await W()).linkBase,`/invite?token=${c.token}`),y=await X(C);o(C),f(y),N(`${c.emailSent?`Invite email sent to ${i.email}.`:"Email could not be sent."} ${y?"Invite link copied to clipboard.":"Copy the invite link."}`),c.emailSent?x.success(`Invite email sent to ${i.email}`):y?x.warning("Invite link copied — email could not be sent. Check your SMTP settings."):x.warning("Email could not be sent. Copy the invite link from the dialog, and check your SMTP settings.")}catch{x.error("Failed to create invite link"),N("Failed to create invite link.")}}function F(i){ne(i),i||(o(""),f(!1),N(""),re())}async function de(i,n){await fetch(`/api/v1/team/members/${i}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({role:n})}),$()}async function me(i){try{const n=await fetch(`/api/v1/team/members/${i.id}/send-reset`,{method:"POST",credentials:"include"});if(!n.ok)throw new Error(`Server error: ${n.status}`);const c=He.parse(await n.json()),C=c.resetUrl??G((await W()).linkBase,`/reset-password?token=${c.token}`),y=await X(C);u({email:i.email,link:C,copied:y,emailSent:c.emailSent}),c.emailSent?x.success(`Reset email sent to ${i.email}`):y?x.warning("Reset link copied — email could not be sent. Send the link to the member yourself."):x.warning("Email could not be sent. Copy the reset link from the dialog and send it to the member.")}catch{x.error("Failed to create reset link")}}async function ue(i){await fetch(`/api/v1/team/members/${i}`,{method:"DELETE",credentials:"include"}),R(null),$()}return e.jsxs("div",{className:"flex flex-col gap-6 max-w-[900px] mx-auto w-full p-6",children:[e.jsx(Te,{open:A!==null,onOpenChange:i=>{i||R(null)},children:e.jsxs(Ne,{children:[e.jsxs(Ae,{children:[e.jsx(Re,{children:"Remove this member?"}),e.jsx(Ie,{children:"This member will lose access to the team immediately."})]}),e.jsxs(Ee,{children:[e.jsx($e,{children:"Cancel"}),e.jsx(Fe,{className:"bg-destructive/10 text-destructive hover:bg-destructive/20 border-0",onClick:()=>A!==null&&ue(A),children:"Remove"})]})]})}),e.jsx(V,{open:t!==null,onOpenChange:i=>{i||u(null)},children:e.jsxs(q,{className:"sm:max-w-md",onCloseAutoFocus:i=>{var n;i.preventDefault(),(n=v.current)==null||n.focus()},children:[e.jsxs(M,{children:[e.jsx(B,{children:"Password reset link"}),e.jsxs(Se,{children:[t!=null&&t.emailSent?`Reset email sent to ${t.email}.`:`Email could not be sent to ${(t==null?void 0:t.email)??""}.`," ","The link works once, for 2 hours. Making a new one turns this one off. Completing the reset signs the member out everywhere and revokes their personal access tokens, so agents using those tokens disconnect until new ones are issued."]})]}),t&&e.jsxs("div",{className:"flex flex-col gap-3 pt-2",children:[e.jsx(Y,{link:t.link,copied:t.copied,noun:"reset link"}),e.jsx(k,{onClick:()=>u(null),children:"Done"})]})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"text-xl font-semibold",children:"Team"}),e.jsxs(V,{open:ie,onOpenChange:F,children:[e.jsx(De,{asChild:!0,children:e.jsxs(k,{ref:d,size:"sm",children:[e.jsx(qe,{className:"mr-2 h-4 w-4"}),"Invite member"]})}),e.jsxs(q,{className:"sm:max-w-md",children:[e.jsx(M,{children:e.jsx(B,{children:"Invite team member"})}),e.jsx("p",{role:"status",className:"sr-only",children:T}),r?e.jsxs("div",{className:"flex flex-col gap-3 pt-2",children:[e.jsx(Y,{link:r,copied:h,noun:"invite link"}),e.jsx(k,{onClick:()=>F(!1),children:"Done"})]}):e.jsxs("form",{onSubmit:ae(ce),className:"flex flex-col gap-4 pt-2",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(_,{htmlFor:"invite-email",children:"Email"}),e.jsx(Z,{id:"invite-email",type:"email","aria-required":"true","aria-invalid":!!b.email,"aria-describedby":b.email?"email-error":void 0,...te("email")}),e.jsx(O,{id:"email-error",message:(L=b.email)==null?void 0:L.message})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(_,{htmlFor:"invite-role",children:"Role"}),e.jsx(ge,{name:"role",control:le,render:({field:i})=>e.jsxs(H,{value:i.value,onValueChange:i.onChange,children:[e.jsx(U,{id:"invite-role","aria-invalid":!!b.role,"aria-describedby":b.role?"role-error":void 0,children:e.jsx(z,{})}),e.jsxs(J,{children:[e.jsx(p,{value:"Admin",children:"Admin"}),e.jsx(p,{value:"Developer",children:"Developer"}),e.jsx(p,{value:"QA",children:"QA"}),e.jsx(p,{value:"Viewer",children:"Viewer"})]})]})}),e.jsx(O,{id:"role-error",message:(P=b.role)==null?void 0:P.message})]}),e.jsx(k,{type:"submit",disabled:E,children:E?"Creating link…":"Generate invite link"})]})]})]})]}),e.jsxs(be,{children:[e.jsx(ye,{children:e.jsxs(ke,{children:["Members",s.data?` (${l.length})`:""]})}),e.jsx(we,{className:"px-4 pt-0 pb-2",children:e.jsxs(Pe,{children:[e.jsx(_e,{children:e.jsxs(K,{children:[e.jsx(S,{children:"Nickname"}),e.jsx(S,{children:"Email"}),e.jsx(S,{children:"Role"}),e.jsx(S,{children:"Joined"}),e.jsx(S,{className:"w-10"})]})}),e.jsxs(Oe,{...m,children:[e.jsx(Qe,{view:g,colSpan:5,noun:"team members",emptyText:"No members yet.",onRetry:()=>{s.refetch()}}),l.map(i=>e.jsxs(K,{className:"hover:bg-transparent",children:[e.jsx(D,{className:"font-medium",children:i.display_name||"—"}),e.jsx(D,{className:"text-muted-foreground text-sm",children:i.email}),e.jsx(D,{children:e.jsxs(H,{value:i.role,onValueChange:n=>de(i.id,n),children:[e.jsx(U,{className:"h-7 w-28",children:e.jsx(z,{})}),e.jsxs(J,{children:[e.jsx(p,{value:"Admin",children:"Admin"}),e.jsx(p,{value:"Developer",children:"Developer"}),e.jsx(p,{value:"QA",children:"QA"}),e.jsx(p,{value:"Viewer",children:"Viewer"})]})]})}),e.jsx(D,{className:"text-muted-foreground text-sm",children:new Date(i.joined_at).toLocaleDateString()}),e.jsx(D,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{variant:"secondary",size:"nav",onClick:n=>{v.current=n.currentTarget,me(i)},children:"Reset pwd"}),e.jsx(k,{variant:"destructive",size:"nav",onClick:()=>R(i.id),children:"Remove"})]})})]},i.id))]})]})})]})]})}export{es as TeamSettings};
Binary file
Binary file
@@ -1 +0,0 @@
1
- import{k as a,j as e}from"./vendor-react-BlPSzrEe.js";import{aJ as le,ay as ce,aI as de,aF as xe,aw as ue,aL as me,B as u,I as j,av as n,L as y,F as Q,h as pe,C as he,c as je,d as ye,b as ge,a as fe,ap as ve,au as z,_ as ke,aq as K,ai as be}from"./index-C1Fo8g_c.js";import{B as w}from"./badge-CWVbeuH3.js";import{A as we,c as Ne,f as Ce,g as Te,d as De,e as Se,b as Ae}from"./alert-dialog-C8wDimW-.js";import{D as Ie,f as Fe,a as Re,d as Ee,e as Be,S as $,i as J,j as M,g as G,h as m}from"./dialog-DQkbaw8h.js";import{l as Le,T as Pe,d as qe,e as U,c as p,a as Oe,L as _e,b as h}from"./list-view-DxI397-H.js";import{l as He}from"./publicLink-D6zKS_wu.js";import{u as Ve}from"./useFocusAfterSwap-BY3N9f9v.js";import{P as We,T as Qe}from"./trash-DhBxh6H7.js";import"./vendor-router-B_lVHrKl.js";const X=["7","30","60","90"],ze=ve({name:z().min(1,"Give the token a name"),expiry:ke([...X,"custom","never"]),expiresDays:z()}).superRefine((t,g)=>{if(t.expiry!=="custom")return;const i=Number(t.expiresDays);(!Number.isInteger(i)||i<1||i>365)&&g.addIssue({code:"custom",path:["expiresDays"],message:"Must be between 1 and 365"})});function Ke(t){if(t.expiry!=="never")return Number(t.expiry==="custom"?t.expiresDays:t.expiry)}function as(){var H,V,W;const t=le(),g=((H=ce().user)==null?void 0:H.role)==="Admin",i=de({queryKey:K.tokens,queryFn:be}),Y=i.data??[],N=Le(i),C=a.useRef(null),Z=Ve(N,C),[ee,se]=a.useState(!1),[o,T]=a.useState(""),[x,D]=a.useState("api"),[S,A]=a.useState(""),[f,v]=a.useState(null),I=a.useId(),F=a.useId(),k=a.useRef(null),[ae,l]=a.useState(""),R=a.useId(),{register:E,control:B,handleSubmit:te,reset:re,formState:{errors:c,isSubmitting:L}}=xe({resolver:ue(ze),defaultValues:{name:"",expiry:"30",expiresDays:"30"}}),P=me({control:B,name:"expiry"}),q=()=>{t.invalidateQueries({queryKey:K.tokens})};a.useEffect(()=>{var s;o&&((s=k.current)==null||s.focus())},[o]);async function ne(s){l("");try{const r=Ke(s),b=await fetch("/api/v1/tokens",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s.name,...r!==void 0?{expires_in_days:r}:{},...x==="agent"?{scope:"agent"}:{}})});if(!b.ok){const d=await b.json().catch(()=>null);n.error((d==null?void 0:d.error)??"Failed to create token"),l((d==null?void 0:d.error)??"Failed to create token");return}const oe=await b.json();x==="agent"&&A((await He()).agentWsBase),n.success("Token created"),T(oe.token),q()}catch{n.error("Network error"),l("Network error")}}function O(s){se(s),s||(T(""),D("api"),A(""),l(""),re())}async function ie(s){try{return(await fetch(`/api/v1/tokens/${s}`,{method:"DELETE",credentials:"include"})).ok?(n.success("Token revoked"),q(),!0):(n.error("Failed to revoke token"),!1)}catch{return n.error("Network error"),!1}}function _(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(Ie,{open:ee,onOpenChange:O,children:[e.jsx(Fe,{asChild:!0,children:e.jsxs(u,{ref:C,size:"sm",children:[e.jsx(We,{className:"mr-2 h-4 w-4"}),"New token"]})}),e.jsxs(Re,{className:"sm:max-w-md",children:[e.jsx(Ee,{children:e.jsx(Be,{children:"Create token"})}),e.jsx("p",{role:"status",className:"sr-only",children:ae}),o?e.jsxs("div",{className:"flex flex-col gap-3 pt-2",children:[e.jsx("p",{id:I,className:"text-sm text-muted-foreground",children:"Copy this token now — it won't be shown again."}),e.jsx(j,{ref:k,readOnly:!0,value:o,"aria-labelledby":I,onFocus:s=>s.currentTarget.select(),className:"font-mono text-xs"}),x==="agent"&&S&&e.jsxs(e.Fragment,{children:[e.jsx("p",{id:F,className:"text-sm text-muted-foreground",children:"Run this on the agent Mac to connect it to this relay:"}),e.jsx(j,{readOnly:!0,value:`tapflow agent start --relay ${S} --token ${o}`,"aria-labelledby":F,onFocus:s=>s.currentTarget.select(),className:"font-mono text-xs"})]}),e.jsx(u,{onClick:()=>{l(""),(navigator.clipboard?navigator.clipboard.writeText(o):Promise.reject(new Error("no clipboard"))).then(()=>{n.success("Token copied to clipboard"),O(!1)}).catch(()=>{var s;n.error("Failed to copy — copy manually"),l("Could not copy the token. Select it and copy it by hand."),(s=k.current)==null||s.focus()})},children:"Copy & close"})]}):e.jsxs("form",{onSubmit:te(ne),className:"flex flex-col gap-4 pt-2",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(y,{htmlFor:"token-name",children:"Name"}),e.jsx(j,{id:"token-name",placeholder:"e.g. ci-deploy","aria-required":"true","aria-invalid":!!c.name,"aria-describedby":c.name?"name-error":void 0,...E("name")}),e.jsx(Q,{id:"name-error",message:(V=c.name)==null?void 0:V.message})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(y,{htmlFor:"token-expiry",children:"Expiration"}),e.jsx(pe,{control:B,name:"expiry",render:({field:s})=>e.jsxs($,{value:s.value,onValueChange:r=>s.onChange(r),children:[e.jsx(J,{id:"token-expiry",ref:s.ref,onBlur:s.onBlur,"aria-describedby":s.value==="never"?R:void 0,children:e.jsx(M,{})}),e.jsxs(G,{children:[X.map(r=>e.jsxs(m,{value:r,children:[r," days"]},r)),e.jsx(m,{value:"custom",children:"Custom…"}),e.jsx(m,{value:"never",children:"No expiration"})]})]})}),P==="never"&&e.jsx("p",{id:R,className:"text-sm text-amber-700 dark:text-amber-300",children:"A token without an expiry stays valid until you revoke it. For CI, 90 days or less is recommended."})]}),P==="custom"&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx(y,{htmlFor:"expires",children:"Expires in (days)"}),e.jsx(j,{id:"expires",type:"number","aria-required":"true","aria-invalid":!!c.expiresDays,"aria-describedby":c.expiresDays?"expiresDays-error":void 0,...E("expiresDays")}),e.jsx(Q,{id:"expiresDays-error",message:(W=c.expiresDays)==null?void 0:W.message})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(y,{htmlFor:"token-type",children:"Type"}),e.jsxs($,{value:x,onValueChange:s=>D(s),children:[e.jsx(J,{id:"token-type",children:e.jsx(M,{})}),e.jsxs(G,{children:[e.jsx(m,{value:"api",children:"API — CI uploads & API access"}),g&&e.jsx(m,{value:"agent",children:"Agent — connect remote device agents (Admin only)"})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Scope: ",e.jsx(w,{variant:"secondary",children:x==="agent"?"agent":"view, builds:write"})]}),e.jsx(u,{type:"submit",disabled:L,children:L?"Creating…":"Create token"})]})]})]})]}),e.jsxs(he,{children:[e.jsxs(je,{children:[e.jsx(ye,{children:"Active tokens"}),e.jsxs(ge,{children:["Use these tokens with ",e.jsx("code",{className:"text-xs",children:"Authorization: Bearer <token>"})," for API deployments."]})]}),e.jsx(fe,{className:"px-4 pt-0 pb-2",children:e.jsxs(Pe,{children:[e.jsx(qe,{children:e.jsxs(U,{children:[e.jsx(p,{children:"Name"}),e.jsx(p,{children:"Scope"}),e.jsx(p,{children:"Last used"}),e.jsx(p,{children:"Expires"}),e.jsx(p,{className:"w-10"})]})}),e.jsxs(Oe,{...Z,children:[e.jsx(_e,{view:N,colSpan:5,noun:"tokens",emptyText:"No tokens yet.",onRetry:()=>{i.refetch()}}),Y.map(s=>e.jsxs(U,{className:"hover:bg-transparent",children:[e.jsx(h,{className:"font-medium",children:s.name}),e.jsx(h,{children:e.jsx(w,{variant:"secondary",children:s.scope})}),e.jsx(h,{className:"text-muted-foreground text-sm",children:s.last_used_at?new Date(s.last_used_at).toLocaleDateString():"Never"}),e.jsx(h,{children:s.expires_at?e.jsx("span",{className:_(s)?"text-destructive text-sm":"text-muted-foreground text-sm",children:_(s)?"Expired":new Date(s.expires_at).toLocaleDateString()}):e.jsx(w,{variant:"outline",children:"No expiration"})}),e.jsx(h,{children:e.jsx(u,{variant:"destructive",size:"icon",className:"h-7 w-7","aria-label":"Revoke token",onClick:()=>v(s.id),children:e.jsx(Qe,{className:"h-4 w-4"})})})]},s.id))]})]})})]}),e.jsx(we,{open:f!==null,onOpenChange:s=>{s||v(null)},children:e.jsxs(Ne,{children:[e.jsxs(Ce,{children:[e.jsx(Te,{children:"Revoke token?"}),e.jsx(De,{children:"Any active API calls using this token will immediately fail."})]}),e.jsxs(Se,{children:[e.jsx(Ae,{children:"Cancel"}),e.jsx(u,{variant:"destructive",onClick:async()=>{if(f===null)return;await ie(f)&&v(null)},children:"Revoke"})]})]})})]})}export{as as TokenSettings};
Binary file
Binary file
@@ -1 +0,0 @@
1
- import{k as n,j as i,f as d}from"./vendor-react-BlPSzrEe.js";import{m as O,aB as u,j as S,Y as T,n as b,k as E,i as v,a1 as x,a0 as h,D as k,o as z,l as F,W as f,O as N}from"./index-C1Fo8g_c.js";var H=Object.defineProperty,c=(s,t)=>H(s,"name",{value:t,configurable:!0}),M="AlertDialog",[B,fe]=h(M,[x]),p=x(),I=c(s=>{const{__scopeAlertDialog:t,...e}=s,a=p(t);return i.jsx(k,{...a,...e,modal:!0})},"AlertDialog"),L=n.forwardRef(c(function(t,e){const{__scopeAlertDialog:a,...l}=t,o=p(a);return i.jsx(z,{...o,...l,ref:e})},"AlertDialogTrigger")),V=c(s=>{const{__scopeAlertDialog:t,...e}=s,a=p(t);return i.jsx(O,{...a,...e})},"AlertDialogPortal"),W=n.forwardRef(c(function(t,e){const{__scopeAlertDialog:a,...l}=t,o=p(a);return i.jsx(F,{...o,...l,ref:e})},"AlertDialogOverlay")),Y="AlertDialogContent",[q,G]=B(Y),J=n.forwardRef(c(function(t,e){const{__scopeAlertDialog:a,children:l,...o}=t,r=p(a),g=n.useRef(null),$=u(e,g),m=n.useRef(null);return i.jsx(q,{scope:a,cancelRef:m,children:i.jsx(S,{role:"alertdialog",...r,...o,ref:$,onOpenAutoFocus:T(o.onOpenAutoFocus,D=>{var A;D.preventDefault(),(A=m.current)==null||A.focus({preventScroll:!0})}),onPointerDownOutside:D=>D.preventDefault(),onInteractOutside:D=>D.preventDefault(),children:l})})},"AlertDialogContent")),K=n.forwardRef(c(function(t,e){const{__scopeAlertDialog:a,...l}=t,o=p(a);return i.jsx(b,{...o,...l,ref:e})},"AlertDialogTitle")),Q=n.forwardRef(c(function(t,e){const{__scopeAlertDialog:a,...l}=t,o=p(a);return i.jsx(E,{...o,...l,ref:e})},"AlertDialogDescription")),U=n.forwardRef(c(function(t,e){const{__scopeAlertDialog:a,...l}=t,o=p(a);return i.jsx(v,{...o,...l,ref:e})},"AlertDialogAction")),X="AlertDialogCancel",Z=n.forwardRef(c(function(t,e){const{__scopeAlertDialog:a,...l}=t,{cancelRef:o}=G(X,a),r=p(a),g=u(e,o);return i.jsx(v,{...r,...l,ref:g})},"AlertDialogCancel")),ee=I,te=L,ae=V,_=W,y=J,j=U,R=Z,C=K,w=Q;const De=ee,me=te,le=ae,P=n.forwardRef((s,t)=>{const e=d.c(9);let a,l;e[0]!==s?({className:a,...l}=s,e[0]=s,e[1]=a,e[2]=l):(a=e[1],l=e[2]);let o;e[3]!==a?(o=f("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),e[3]=a,e[4]=o):o=e[4];let r;return e[5]!==l||e[6]!==t||e[7]!==o?(r=i.jsx(_,{className:o,...l,ref:t}),e[5]=l,e[6]=t,e[7]=o,e[8]=r):r=e[8],r});P.displayName=_.displayName;const oe=n.forwardRef((s,t)=>{const e=d.c(10);let a,l;e[0]!==s?({className:a,...l}=s,e[0]=s,e[1]=a,e[2]=l):(a=e[1],l=e[2]);let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx(P,{}),e[3]=o):o=e[3];let r;e[4]!==a?(r=f("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),e[4]=a,e[5]=r):r=e[5];let g;return e[6]!==l||e[7]!==t||e[8]!==r?(g=i.jsxs(le,{children:[o,i.jsx(y,{ref:t,className:r,...l})]}),e[6]=l,e[7]=t,e[8]=r,e[9]=g):g=e[9],g});oe.displayName=y.displayName;const se=s=>{const t=d.c(8);let e,a;t[0]!==s?({className:e,...a}=s,t[0]=s,t[1]=e,t[2]=a):(e=t[1],a=t[2]);let l;t[3]!==e?(l=f("flex flex-col space-y-2 text-center sm:text-left",e),t[3]=e,t[4]=l):l=t[4];let o;return t[5]!==a||t[6]!==l?(o=i.jsx("div",{className:l,...a}),t[5]=a,t[6]=l,t[7]=o):o=t[7],o};se.displayName="AlertDialogHeader";const re=s=>{const t=d.c(8);let e,a;t[0]!==s?({className:e,...a}=s,t[0]=s,t[1]=e,t[2]=a):(e=t[1],a=t[2]);let l;t[3]!==e?(l=f("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),t[3]=e,t[4]=l):l=t[4];let o;return t[5]!==a||t[6]!==l?(o=i.jsx("div",{className:l,...a}),t[5]=a,t[6]=l,t[7]=o):o=t[7],o};re.displayName="AlertDialogFooter";const ie=n.forwardRef((s,t)=>{const e=d.c(9);let a,l;e[0]!==s?({className:a,...l}=s,e[0]=s,e[1]=a,e[2]=l):(a=e[1],l=e[2]);let o;e[3]!==a?(o=f("text-lg font-semibold",a),e[3]=a,e[4]=o):o=e[4];let r;return e[5]!==l||e[6]!==t||e[7]!==o?(r=i.jsx(C,{ref:t,className:o,...l}),e[5]=l,e[6]=t,e[7]=o,e[8]=r):r=e[8],r});ie.displayName=C.displayName;const ne=n.forwardRef((s,t)=>{const e=d.c(9);let a,l;e[0]!==s?({className:a,...l}=s,e[0]=s,e[1]=a,e[2]=l):(a=e[1],l=e[2]);let o;e[3]!==a?(o=f("text-sm text-muted-foreground",a),e[3]=a,e[4]=o):o=e[4];let r;return e[5]!==l||e[6]!==t||e[7]!==o?(r=i.jsx(w,{ref:t,className:o,...l}),e[5]=l,e[6]=t,e[7]=o,e[8]=r):r=e[8],r});ne.displayName=w.displayName;const ce=n.forwardRef((s,t)=>{const e=d.c(9);let a,l;e[0]!==s?({className:a,...l}=s,e[0]=s,e[1]=a,e[2]=l):(a=e[1],l=e[2]);let o;e[3]!==a?(o=f(N(),a),e[3]=a,e[4]=o):o=e[4];let r;return e[5]!==l||e[6]!==t||e[7]!==o?(r=i.jsx(j,{ref:t,className:o,...l}),e[5]=l,e[6]=t,e[7]=o,e[8]=r):r=e[8],r});ce.displayName=j.displayName;const pe=n.forwardRef((s,t)=>{const e=d.c(9);let a,l;e[0]!==s?({className:a,...l}=s,e[0]=s,e[1]=a,e[2]=l):(a=e[1],l=e[2]);let o;e[3]!==a?(o=f(N({variant:"outline"}),"mt-2 sm:mt-0",a),e[3]=a,e[4]=o):o=e[4];let r;return e[5]!==l||e[6]!==t||e[7]!==o?(r=i.jsx(R,{ref:t,className:o,...l}),e[5]=l,e[6]=t,e[7]=o,e[8]=r):r=e[8],r});pe.displayName=R.displayName;export{De as A,ce as a,pe as b,oe as c,ne as d,re as e,se as f,ie as g,me as h};
@@ -1 +0,0 @@
1
- import{f as i,j as b}from"./vendor-react-BlPSzrEe.js";import{W as l,a6 as g}from"./index-C1Fo8g_c.js";const x=g("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground",outline:"text-foreground"},tone:{backlog:"border-transparent bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400",progress:"border-transparent bg-blue-50 text-blue-700 dark:bg-blue-950 dark:text-blue-300",done:"border-transparent bg-green-50 text-green-700 dark:bg-green-950 dark:text-green-300",rejected:"border-transparent bg-red-50 text-red-700 dark:bg-red-950 dark:text-red-300",ios:"border-transparent bg-sky-50 text-sky-700 dark:bg-sky-950 dark:text-sky-300",android:"border-transparent bg-emerald-50 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300"}},defaultVariants:{variant:"default"}});function u(o){const e=i.c(12);let r,t,a,n;e[0]!==o?({className:r,variant:n,tone:a,...t}=o,e[0]=o,e[1]=r,e[2]=t,e[3]=a,e[4]=n):(r=e[1],t=e[2],a=e[3],n=e[4]);let d;e[5]!==r||e[6]!==a||e[7]!==n?(d=l(x({variant:n,tone:a}),r),e[5]=r,e[6]=a,e[7]=n,e[8]=d):d=e[8];let s;return e[9]!==t||e[10]!==d?(s=b.jsx("div",{className:d,...t}),e[9]=t,e[10]=d,e[11]=s):s=e[11],s}export{u as B};
Binary file
Binary file
Binary file
Binary file