@snagset/server 0.1.41 → 0.1.43
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/app.js +35 -2
- package/dist/app.js.map +1 -1
- package/dist/db/migrations/0015_site_archive.sql +15 -0
- package/dist/holds.js +29 -0
- package/dist/holds.js.map +1 -0
- package/dist/mail/smtp.js +17 -7
- package/dist/mail/smtp.js.map +1 -1
- package/dist/plan.js +2 -2
- package/dist/plan.js.map +1 -1
- package/dist/projectCache.js +1 -1
- package/dist/projectCache.js.map +1 -1
- package/dist/routes/bodyLimit.js +13 -11
- package/dist/routes/bodyLimit.js.map +1 -1
- package/dist/routes/comments.js +7 -0
- package/dist/routes/comments.js.map +1 -1
- package/dist/routes/invites.js +19 -7
- package/dist/routes/invites.js.map +1 -1
- package/dist/routes/owner.js +8 -4
- package/dist/routes/owner.js.map +1 -1
- package/dist/routes/sites.js +46 -0
- package/dist/routes/sites.js.map +1 -1
- package/dist/routes/threads.js +6 -3
- package/dist/routes/threads.js.map +1 -1
- package/package.json +1 -1
- package/static/dashboard/assets/{CompositeItem-B_Ebe9qQ.js → CompositeItem-DqkA27tC.js} +1 -1
- package/static/dashboard/assets/{CompositeList-CDAPQTbv.js → CompositeList-DrnyFTB0.js} +1 -1
- package/static/dashboard/assets/{ConfirmDialog-D1II2uNE.js → ConfirmDialog-CLal40kk.js} +1 -1
- package/static/dashboard/assets/{CopyButton-qbA2ZHWn.js → CopyButton-D_EAOrl1.js} +1 -1
- package/static/dashboard/assets/{FieldItemContext-BM_KzVUj.js → FieldItemContext-Dvh77l6C.js} +1 -1
- package/static/dashboard/assets/{InstallTag-DTpNoMn9.js → InstallTag-Cld-E0Bc.js} +1 -1
- package/static/dashboard/assets/InstanceRows-DexbQngM.js +1 -0
- package/static/dashboard/assets/{McpTokens-DE2t0iiS.js → McpTokens-CIjBwfT0.js} +1 -1
- package/static/dashboard/assets/{SaveState-QQHqDSgx.js → SaveState-BiYh2KgZ.js} +1 -1
- package/static/dashboard/assets/_app-BSxQmm69.js +61 -0
- package/static/dashboard/assets/{_app-CaDt6CPJ.js → _app-CrFQJNrf.js} +1 -1
- package/static/dashboard/assets/activity-BUIv_tqh.js +1 -0
- package/static/dashboard/assets/{arrow-left-RqdORgcq.js → arrow-left-B6jSSfnu.js} +1 -1
- package/static/dashboard/assets/{avatar-D8S5EME4.js → avatar-CPcL_-iV.js} +1 -1
- package/static/dashboard/assets/{badge-anHWhPFa.js → badge-DBzqpvfR.js} +1 -1
- package/static/dashboard/assets/{card-C01exIzZ.js → card-B5svGaqA.js} +1 -1
- package/static/dashboard/assets/{check-Gm9Xu4rH.js → check-C21x2mpF.js} +1 -1
- package/static/dashboard/assets/{chevron-down-C-pVPOKU.js → chevron-down-qCyXHfGI.js} +1 -1
- package/static/dashboard/assets/{chevron-right-BQmYcugl.js → chevron-right-ZLZCd12m.js} +1 -1
- package/static/dashboard/assets/{copy-Ckk__4oN.js → copy-Bik19B-3.js} +1 -1
- package/static/dashboard/assets/{dialog-D5G50pSW.js → dialog-qbXy4GE2.js} +1 -1
- package/static/dashboard/assets/{dropdown-menu-Bm_opJ2p.js → dropdown-menu-_DGLxfga.js} +1 -1
- package/static/dashboard/assets/{forgot-R7JqXxs5.js → forgot-BJwCHsE9.js} +1 -1
- package/static/dashboard/assets/{image-off-BtbHLgOM.js → image-off-DkzQHm8a.js} +1 -1
- package/static/dashboard/assets/{index-p-qD6BlY.js → index-CHi2CcHb.js} +20 -20
- package/static/dashboard/assets/index-Ie8QH3El.css +1 -0
- package/static/dashboard/assets/invite-BRZIE9ij.js +1 -0
- package/static/dashboard/assets/{label-CuvYMIVd.js → label-Dff2Zjcb.js} +1 -1
- package/static/dashboard/assets/labels--UUyt9uB.js +1 -0
- package/static/dashboard/assets/{layout-grid-D5ek58h7.js → layout-grid-C3Koxvvp.js} +1 -1
- package/static/dashboard/assets/me-XTwFHhR6.js +1 -0
- package/static/dashboard/assets/{parts-CN1uQywE.js → parts-CK9SS76R.js} +1 -1
- package/static/dashboard/assets/{plus-BsxOLtMA.js → plus-4APMJ4TC.js} +1 -1
- package/static/dashboard/assets/reset-BakGFWJY.js +1 -0
- package/static/dashboard/assets/s._site-z1oyWNQY.js +1 -0
- package/static/dashboard/assets/{s._site.comments-DmrtKLHb.js → s._site.comments-C3V2hEnX.js} +2 -2
- package/static/dashboard/assets/s._site.reviewers-BWO0DRhU.js +1 -0
- package/static/dashboard/assets/s._site.settings-Brm50esb.js +1 -0
- package/static/dashboard/assets/{setup-BDZJmgIB.js → setup-B1bevXbJ.js} +1 -1
- package/static/dashboard/assets/{sign-in-BmweKwDv.js → sign-in-DxO2Kh8j.js} +1 -1
- package/static/dashboard/assets/{sign-up-C06mQl-c.js → sign-up-B8c2f4uf.js} +1 -1
- package/static/dashboard/assets/sites-BzBdEUAz.js +1 -0
- package/static/dashboard/assets/{studio-BHpeuJSq.js → studio-BtXg0XzE.js} +1 -1
- package/static/dashboard/assets/studio-CD5SiuzI.js +1 -0
- package/static/dashboard/assets/studio.index-r91Elth-.js +1 -0
- package/static/dashboard/assets/studio.integrations-Df0aQQaP.js +1 -0
- package/static/dashboard/assets/{studio.members-CEKrbJHp.js → studio.members-BAJ3beQC.js} +2 -2
- package/static/dashboard/assets/studio.plan-CcdSeq5g.js +1 -0
- package/static/dashboard/assets/{sun-DXwtJyi5.js → sun-BwWiB8wj.js} +1 -1
- package/static/dashboard/assets/{switch-cgJL6ATv.js → switch-b0ERMUSk.js} +1 -1
- package/static/dashboard/assets/{table-B8VTYpZO.js → table-HuNaCQBJ.js} +1 -1
- package/static/dashboard/assets/{useAriaLabelledBy-BT5NtL2E.js → useAriaLabelledBy-B3107P7l.js} +1 -1
- package/static/dashboard/assets/{useBaseQuery-DaFWLbWu.js → useBaseQuery-DI4GfUK8.js} +1 -1
- package/static/dashboard/assets/useQuery-U2FOgJPB.js +1 -0
- package/static/dashboard/assets/useRender-B8Yivtih.js +1 -0
- package/static/dashboard/assets/{useValueChanged-cwqHWzY1.js → useValueChanged-RTamjQR3.js} +1 -1
- package/static/dashboard/assets/{users-CGY0g3mg.js → users--4QPa7AS.js} +1 -1
- package/static/dashboard/assets/{welcome-CNtwDQMd.js → welcome-UZyMZNzL.js} +3 -3
- package/static/dashboard/assets/{widget-signin-BOUMPGXt.js → widget-signin-DXyh_-_V.js} +1 -1
- package/static/dashboard/assets/you-DSHNqgeU.js +1 -0
- package/static/dashboard/assets/{zod-DfHlfdUJ.js → zod-dogyqr67.js} +1 -1
- package/static/dashboard/index.html +2 -2
- package/static/widget/build.json +2 -2
- package/static/widget/snag.js +1 -1
- package/static/widget/snag.runtime.js +2 -2
- package/static/dashboard/assets/InstanceRows-B1z-L92-.js +0 -1
- package/static/dashboard/assets/_app-B_DiSFIt.js +0 -61
- package/static/dashboard/assets/activity-CzEy_J8-.js +0 -1
- package/static/dashboard/assets/index-CoiIx5MR.css +0 -1
- package/static/dashboard/assets/invite-9eotNL9V.js +0 -1
- package/static/dashboard/assets/labels-DLMjYGNJ.js +0 -1
- package/static/dashboard/assets/reset-8K76tpdp.js +0 -1
- package/static/dashboard/assets/s._site-egkPDOj9.js +0 -1
- package/static/dashboard/assets/s._site.reviewers-CGKj-NQo.js +0 -1
- package/static/dashboard/assets/s._site.settings-DvWbfMac.js +0 -1
- package/static/dashboard/assets/sites-CkGgns1o.js +0 -1
- package/static/dashboard/assets/studio-CG1QMBSK.js +0 -1
- package/static/dashboard/assets/studio.index-BOkmM7I5.js +0 -1
- package/static/dashboard/assets/studio.integrations-BBik3DdK.js +0 -1
- package/static/dashboard/assets/studio.plan-CkOzUaJM.js +0 -1
- package/static/dashboard/assets/useQuery-D-9vXtOo.js +0 -1
- package/static/dashboard/assets/useRender-BBzDGtxq.js +0 -1
- package/static/dashboard/assets/you-DH4QMiND.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{q as N,j as e,a2 as w,a3 as A,r as d,B as p,S as C,d as F,a4 as E,a1 as R,z as x,a5 as z,s as D}from"./index-p-qD6BlY.js";import{u as h}from"./useQuery-D-9vXtOo.js";import{L as I,I as S}from"./label-CuvYMIVd.js";import{I as O,S as P}from"./InstanceRows-B1z-L92-.js";import{A as q,P as G,a as v}from"./parts-CN1uQywE.js";import{u as b}from"./labels-DLMjYGNJ.js";import{S as L}from"./SaveState-QQHqDSgx.js";import{b as U}from"./studio-BHpeuJSq.js";import{c as B}from"./update-duXzIzFS.js";import"./useBaseQuery-DaFWLbWu.js";import"./dialog-D5G50pSW.js";import"./ConfirmDialog-D1II2uNE.js";import"./card-C01exIzZ.js";function Q(){const s=b(),a=h(x.meta()),i=h(x.members()),r=U(),n=N(s.user.role,"studio"),l=w(s),m=A(s),c=h(x.setupState()),o=l||!c.data?.cloud,u=!c.data?.billingUrl,[t,g]=d.useState(s.org.name),[y,k]=d.useState(null);d.useEffect(()=>g(s.org.name),[s.org.name]);const j=n&&t.trim().length>0&&t.trim()!==s.org.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(G,{title:"General",sub:s.org.name,actions:e.jsx(L,{saving:r.isPending,savedAt:y})}),e.jsx(v,{title:"Studio",description:"The name at the top of every screen.",children:e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:f=>{f.preventDefault(),j&&r.mutate(t.trim(),{onSuccess:()=>k(Date.now())})},children:[e.jsx(I,{htmlFor:"studio-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(S,{id:"studio-name",value:t,readOnly:!n,onChange:f=>g(f.target.value)}),j&&e.jsx(p,{type:"submit",variant:"outline",children:"Save"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:n?"Shown at the top of the sidebar, above every site.":"Only an owner can change it."})]})}),o&&e.jsx(v,{title:"This instance",description:l?"What is running, and where.":"What is running.",children:e.jsxs("dl",{className:"m-0 grid grid-cols-[130px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Version"}),e.jsxs("dd",{className:"m-0",children:[a.data?.version??"—"," ",e.jsx(T,{version:a.data?.version??""})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Address"}),e.jsx("dd",{className:"m-0",children:e.jsx(_,{owner:n})})]}),a.data?.commit&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Commit"}),e.jsxs("dd",{className:"m-0 font-mono text-[12px] text-ink-soft",children:[a.data.commit.slice(0,12),a.data.modified?" · modified":""]})]}),u&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Sites · members"}),e.jsxs("dd",{className:"m-0",children:[s.projects.length," · ",i.data?.data.length??"—"]})]})]})}),m==="instance"?e.jsx(O,{owner:n}):m==="usage"?e.jsx(P,{}):null]})}function T({version:s}){const[a,i]=d.useState({s:"idle"});return a.s==="idle"?e.jsxs(e.Fragment,{children:["·"," ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>{i({s:"checking"}),B(s).then(r=>i({s:"done",r})).catch(()=>i({s:"failed"}))},children:"Check for updates"})," ",e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"— from your browser, never from the server"})]}):a.s==="checking"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:["· ",e.jsx(C,{className:"size-3"})," checking…"]}):a.s==="failed"?e.jsx("span",{className:"text-muted-foreground",children:"· could not reach npm"}):e.jsx("span",{className:"text-muted-foreground",children:a.r?.newer?`· ${a.r.latest} is out`:"· up to date"})}function _({owner:s}){const a=F(),i=h(x.instance()),[r,n]=d.useState(null),[l,m]=d.useState(""),c=E({mutationFn:t=>D.setAddress(t),onSuccess:t=>{a.setQueryData(x.instance().queryKey,t),n(null),m(""),z.success("Address saved — every new link is built from it")},onError:t=>m(R(t))}),o=i.data?.address;if(!o)return e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:location.origin});const u=o.source==="env";return r===null||!s||u?e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:o.url}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:u?"· set by the environment (SNAGSET_BASE_URL)":o.source==="stored"?"· set at claim; every link is built from it":"· this machine's default"}),s&&!u&&e.jsx(p,{variant:"ghost",size:"sm",onClick:()=>n(o.url),children:"Change…"})]}):e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:t=>{t.preventDefault(),c.mutate(r.trim())},children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(S,{"aria-label":"Address",value:r,onChange:t=>n(t.target.value),className:"h-8 max-w-[360px] font-mono text-[12px]",autoFocus:!0}),e.jsx(p,{type:"submit",size:"sm",loading:c.isPending,disabled:!r.trim(),children:c.isPending?"Saving…":"Save"}),e.jsx(p,{type:"button",variant:"ghost",size:"sm",onClick:()=>n(null),children:"Cancel"})]}),l&&e.jsx("span",{className:"text-[12px] text-destructive",children:l}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"https:// unless it is this machine; the origin only. Review links, issues and emails are built from it."})]})}const ae=()=>N(b().user.role,"settings")?e.jsx(Q,{}):e.jsx(q,{title:"General"});export{ae as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{q as U,j as e,L as ee,a2 as te,d as se,r as a,a4 as F,a5 as I,a1 as M,s as T,a6 as D,_ as ne,B as y,A as K,z as oe}from"./index-p-qD6BlY.js";import{u as B}from"./useQuery-D-9vXtOo.js";import{B as _}from"./badge-anHWhPFa.js";import{E,G as O,I as W,H as R,J,K as H}from"./dialog-D5G50pSW.js";import{L as C,I as A}from"./label-CuvYMIVd.js";import{C as ae}from"./ConfirmDialog-D1II2uNE.js";import{A as re,P as ie,a as ce}from"./parts-CN1uQywE.js";import{u as q,b as le}from"./labels-DLMjYGNJ.js";import{C as z}from"./CopyButton-qbA2ZHWn.js";import{M as de}from"./McpTokens-DE2t0iiS.js";import"./useBaseQuery-DaFWLbWu.js";import"./useRender-BBzDGtxq.js";import"./card-C01exIzZ.js";import"./check-Gm9Xu4rH.js";import"./copy-Ckk__4oN.js";import"./switch-cgJL6ATv.js";import"./useAriaLabelledBy-BT5NtL2E.js";import"./useValueChanged-cwqHWzY1.js";const he={ok:{label:"Healthy",tone:"ok"},needs_reauth:{label:"Needs a new token",tone:"bad"},error:{label:"Failing",tone:"bad"}};function me(){const o=q(),i=U(o.user.role,"settings"),x=U(o.user.role,"studio")&&te(o),f=B(oe.integrations()),S=se(),w=()=>S.invalidateQueries({queryKey:["integrations"]}),[l,u]=a.useState(null),[r,g]=a.useState(null),[j,m]=a.useState(null),b=F({mutationFn:t=>T.regenerateGitHubWebhook(t),onSuccess:({webhook:t},s)=>m({site:s,provider:"github",hook:t,fresh:!1}),onError:t=>I.error(M(t))}),N=F({mutationFn:({uid:t,provider:s})=>T.testTracker(t,s).then(c=>({...c,provider:s})),onSuccess:t=>{I[t.ok?"success":"error"](t.ok?`${D[t.provider]} can see ${t.target}`:t.detail??`${D[t.provider]} refused the token`),w()},onError:t=>I.error(M(t))}),k=F({mutationFn:({uid:t,provider:s})=>T.disconnectTracker(t,s),onSuccess:()=>{g(null),w()},onError:t=>I.error(M(t))}),v=f.data?.data??[],h=t=>v.filter(s=>s.provider===t),d=t=>o.projects.filter(s=>!h(t).some(c=>c.site===s.uid));return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(ie,{title:"Integrations",sub:"Mirrors converge on the comment's status here; Slack only announces"}),["github","linear","jira","slack"].map(t=>{const s=h(t),c=d(t);return e.jsxs(ce,{title:D[t],description:t==="github"?"A comment becomes an issue in the site's repository, with the brief as its body; resolving it here closes the issue there, and closing it there resolves it here. A fine-grained token per site — no OAuth app to register.":t==="linear"?"A comment becomes an issue in the site's team, with the brief as its body; our status moves it between the team's workflow states by type, and a webhook from Linear moves it back. A personal API key per site — no OAuth app to register.":t==="jira"?"A comment becomes an issue in the site's Jira project, with the brief as its description; our status moves it through the workflow by status category, and a webhook from Jira moves it back. An API token with the account's email — what Atlassian gives a self-hoster.":"One message per comment in a channel, edited in place as the status moves — never a second message, never a reply. A bot token from an app you create in a click from our manifest; Slack sends nothing back.",children:[f.isPending&&e.jsx(ne,{rows:2}),f.isSuccess&&s.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{variant:"outline",children:"Not connected"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:t==="github"?"No site is connected to a repository yet.":t==="linear"?"No site is connected to a team yet.":t==="jira"?"No site is connected to a project yet.":"No site is connected to a channel yet."})]}),s.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:s.map(n=>{const P=he[n.health]??{label:n.health,tone:"warn"};return e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-border px-3 py-2.5 text-[13px]",children:[e.jsx("span",{className:"font-medium",children:n.siteName??n.site}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("code",{className:"font-mono text-[12.5px]",children:n.provider==="github"?`${n.owner}/${n.repo}`:n.provider==="linear"?`${n.teamKey} · ${n.teamName}`:n.provider==="jira"?`${n.projectKey} · ${n.projectName}`:`#${n.channelName} · ${n.teamName}`}),e.jsx(_,{variant:"outline",className:P.tone==="ok"?"border-ok text-ok":P.tone==="bad"?"border-destructive text-destructive":"",children:P.label}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[n.provider==="slack"?n.createOn==="thread.created"?"A message for every new comment":"Messages when you ask, from the brief":n.createOn==="thread.created"?"An issue for every new comment":"Issues when you ask, from the brief",n.provider==="github"&&n.labels.length?` · labels ${n.labels.join(", ")}`:"",n.provider!=="github"&&n.provider!=="slack"&&!n.hasWebhookSecret?` · no webhook secret yet, so ${D[n.provider]} cannot move comments here`:""," · ",le(n.updatedAt)]}),n.lastError&&e.jsx("span",{className:"basis-full text-[12px] text-destructive",children:n.lastError}),i&&e.jsxs("span",{className:"ml-auto flex gap-1",children:[n.provider==="github"?e.jsx(y,{variant:"ghost",size:"sm",loading:b.isPending,onClick:()=>b.mutate(n.site),children:"Webhook…"}):n.provider==="slack"?null:e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>m({site:n.site,provider:n.provider,hook:{url:`${location.origin}/api/v1/integrations/${n.provider}/inbound`},fresh:!1}),children:"Webhook…"}),e.jsx(y,{variant:"ghost",size:"sm",loading:N.isPending,onClick:()=>N.mutate({uid:n.site,provider:n.provider}),children:"Test"}),e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>g(n),children:"Disconnect"})]})]},`${n.provider}:${n.site}`)})}),i&&c.length>0&&e.jsx("div",{children:e.jsx(y,{variant:"outline",size:"sm",onClick:()=>u(t),children:"Connect a site…"})})]},t)}),e.jsx(de,{owner:i,instanceOwner:x,sites:o.projects}),e.jsx(ue,{open:l==="github",onOpenChange:t=>!t&&u(null),sites:d("github"),onDone:(t,s)=>{w(),s&&m({site:t,provider:"github",hook:s,fresh:!0})}}),e.jsx(xe,{open:l==="linear",onOpenChange:t=>!t&&u(null),sites:d("linear"),onDone:(t,s)=>{w(),m({site:t,provider:"linear",hook:s,fresh:!0})}}),e.jsx(fe,{open:l==="jira",onOpenChange:t=>!t&&u(null),sites:d("jira"),onDone:(t,s)=>{w(),m({site:t,provider:"jira",hook:s,fresh:!0})}}),e.jsx(ge,{open:l==="slack",onOpenChange:t=>!t&&u(null),sites:d("slack"),onDone:()=>void w()}),e.jsx(pe,{state:j,onClose:()=>m(null),siteName:t=>v.find(s=>s.site===t)?.siteName??"the site"}),e.jsx(ae,{open:r!==null,onOpenChange:t=>!t&&g(null),title:`Disconnect ${r?.siteName??"this site"} from ${r?D[r.provider]:"the tracker"}?`,description:r?.provider==="slack"?e.jsx(e.Fragment,{children:"Messages already posted stay in the channel; no new ones are posted and they stop being updated. The token is forgotten."}):e.jsx(e.Fragment,{children:"Issues already made keep their links; no new ones are made and status stops mirroring. The token is forgotten."}),confirmLabel:"Disconnect",busy:k.isPending,onConfirm:async()=>{r&&await k.mutateAsync({uid:r.site,provider:r.provider})}})]})}function ue({open:o,onOpenChange:i,sites:x,onDone:f}){const[S,w]=a.useState(""),[l,u]=a.useState(""),[r,g]=a.useState(""),[j,m]=a.useState(""),[b,N]=a.useState(!1),[k,v]=a.useState(""),h=F({mutationFn:s=>T.connectTracker(s,"github",{repository:l.trim(),token:r.trim(),labels:j,createOn:b?"thread.created":"manual"})}),d=S||x[0]?.uid||"",t=async s=>{s.preventDefault(),v("");try{const c=await h.mutateAsync(d);u(""),g(""),m(""),N(!1),i(!1),f(d,c.webhook&&"secret"in c.webhook?c.webhook:void 0),I.success("GitHub connected")}catch(c){v(c instanceof K?c.message:"Could not reach the server.")}};return e.jsx(E,{open:o,onOpenChange:i,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(W,{children:[e.jsx(R,{children:"Connect a site to GitHub"}),e.jsxs(J,{children:["A fine-grained personal access token with ",e.jsx("b",{children:"Issues: read and write"})," on that one repository. It is checked against the repository before it is saved, and stored encrypted with this instance's secret key."]})]}),k&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:k}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-site",children:"Site"}),e.jsx("select",{id:"gh-site",value:d,onChange:s=>w(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:x.map(s=>e.jsx("option",{value:s.uid,children:s.name},s.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-repo",children:"Repository"}),e.jsx(A,{id:"gh-repo",placeholder:"kilnwork/site",value:l,onChange:s=>u(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-token",children:"Token"}),e.jsx(A,{id:"gh-token",type:"password",placeholder:"github_pat_…",value:r,onChange:s=>g(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-labels",children:"Labels"}),e.jsx(A,{id:"gh-labels",placeholder:"review, bug",value:j,onChange:s=>m(s.target.value)}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Applied to every issue this makes. Optional."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:b,onChange:s=>N(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:'Off by default: a reviewer walking a site leaves twenty comments and half are "never mind". Make issues from the brief when you mean it.'})]})]}),e.jsxs(H,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(y,{type:"submit",loading:h.isPending,disabled:!l.trim()||!r.trim()||!d,children:h.isPending?"Checking…":"Connect"})]})]})})})}function pe({state:o,onClose:i,siteName:x}){const f=o&&"secret"in o.hook?o.hook.secret:null;return e.jsx(E,{open:o!==null,onOpenChange:S=>!S&&i(),children:e.jsxs(O,{children:[e.jsxs(W,{children:[e.jsx(R,{children:o?.fresh?"Connected — now the webhook":"Webhook for "+(o?x(o.site):"")}),e.jsx(J,{children:o?.provider==="linear"?"Issues moved in Linear move the comment here. In Linear › Settings › API › Webhooks, create one for the team with this URL and Issue events; then paste its signing secret when connecting or replacing the connection.":o?.provider==="jira"?"Issues moved in Jira move the comment here. In Jira › Settings › System › Webhooks, create one with this URL, the events Issue updated and Issue deleted, and a secret; then paste the same secret when connecting or replacing the connection.":`Issues closed or reopened on GitHub move the comment here. Add a webhook to the repository — Settings › Webhooks › Add webhook — with these values. The secret is shown this once${o?.fresh?"":", and the previous one has stopped working"}.`})]}),o&&e.jsxs("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Payload URL"}),e.jsxs("dd",{className:"m-0 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]",children:o.hook.url}),e.jsx(z,{text:o.hook.url,label:"Copy the payload URL"})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Content type"}),e.jsx("dd",{className:"m-0",children:e.jsx("code",{className:"font-mono text-[12px]",children:"application/json"})}),f&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Secret"}),e.jsxs("dd",{className:"m-0 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]","data-testid":"webhook-secret",children:f}),e.jsx(z,{text:f,label:"Copy the secret"})]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Events"}),e.jsx("dd",{className:"m-0",children:o.provider==="linear"?"Issues":o.provider==="jira"?"Issue: updated, deleted":"Let me select individual events → Issues"})]}),e.jsx(H,{children:e.jsx(y,{type:"button",onClick:i,children:"Done"})})]})})}function xe({open:o,onOpenChange:i,sites:x,onDone:f}){const[S,w]=a.useState(""),[l,u]=a.useState(""),[r,g]=a.useState(""),[j,m]=a.useState(""),[b,N]=a.useState(!1),[k,v]=a.useState(""),h=F({mutationFn:s=>T.connectTracker(s,"linear",{team:l.trim(),apiKey:r.trim(),...j.trim()?{webhookSecret:j.trim()}:{},createOn:b?"thread.created":"manual"})}),d=S||x[0]?.uid||"",t=async s=>{s.preventDefault(),v("");try{const c=await h.mutateAsync(d);u(""),g(""),m(""),N(!1),i(!1),f(d,c.webhook??{url:`${location.origin}/api/v1/integrations/linear/inbound`}),I.success("Linear connected")}catch(c){v(c instanceof K?c.message:"Could not reach the server.")}};return e.jsx(E,{open:o,onOpenChange:i,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(W,{children:[e.jsx(R,{children:"Connect a site to Linear"}),e.jsx(J,{children:"A personal API key from Linear › Settings › API, belonging to a member of the team. It is checked against the team before it is saved, and stored encrypted with this instance's secret key."})]}),k&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:k}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-site",children:"Site"}),e.jsx("select",{id:"ln-site",value:d,onChange:s=>w(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:x.map(s=>e.jsx("option",{value:s.uid,children:s.name},s.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-team",children:"Team key"}),e.jsx(A,{id:"ln-team",placeholder:"ENG",value:l,onChange:s=>u(s.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The prefix of the team's issues, like the ENG in ENG-123."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-key",children:"API key"}),e.jsx(A,{id:"ln-key",type:"password",placeholder:"lin_api_…",value:r,onChange:s=>g(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-secret",children:"Webhook signing secret"}),e.jsx(A,{id:"ln-secret",type:"password",placeholder:"from Linear's webhook, optional",value:j,onChange:s=>m(s.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Lets Linear move comments here when issues move there. The URL to give Linear is shown after connecting."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:b,onChange:s=>N(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(H,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(y,{type:"submit",loading:h.isPending,disabled:!l.trim()||!r.trim()||!d,children:h.isPending?"Checking…":"Connect"})]})]})})})}function fe({open:o,onOpenChange:i,sites:x,onDone:f}){const[S,w]=a.useState(""),[l,u]=a.useState(""),[r,g]=a.useState(""),[j,m]=a.useState(""),[b,N]=a.useState(""),[k,v]=a.useState(""),[h,d]=a.useState(!1),[t,s]=a.useState(""),c=F({mutationFn:p=>T.connectTracker(p,"jira",{siteUrl:l.trim(),project:r.trim(),email:j.trim(),apiToken:b.trim(),...k.trim()?{webhookSecret:k.trim()}:{},createOn:h?"thread.created":"manual"})}),n=S||x[0]?.uid||"",P=async p=>{p.preventDefault(),s("");try{const L=await c.mutateAsync(n);g(""),N(""),v(""),d(!1),i(!1),f(n,L.webhook??{url:`${location.origin}/api/v1/integrations/jira/inbound`}),I.success("Jira connected")}catch(L){s(L instanceof K?L.message:"Could not reach the server.")}},$=(p,L,V,Q,Y,X="text",G)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:`jr-${p}`,children:L}),e.jsx(A,{id:`jr-${p}`,type:X,placeholder:Y,value:V,onChange:Z=>Q(Z.target.value),autoComplete:"off"}),G&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:G})]});return e.jsx(E,{open:o,onOpenChange:i,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:p=>void P(p),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(W,{children:[e.jsx(R,{children:"Connect a site to Jira"}),e.jsx(J,{children:"An API token from id.atlassian.com › Security, with the email of the account it belongs to. It is checked against the project before it is saved, and stored encrypted with this instance's secret key."})]}),t&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:t}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"jr-site",children:"Site"}),e.jsx("select",{id:"jr-site",value:n,onChange:p=>w(p.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:x.map(p=>e.jsx("option",{value:p.uid,children:p.name},p.uid))})]}),$("url","Jira site",l,u,"https://kilnwork.atlassian.net"),$("project","Project key",r,g,"KAN","text","The prefix of the project's issues, like the KAN in KAN-12."),$("email","Account email",j,m,"you@kilnwork.studio","email"),$("token","API token",b,N,"","password"),$("secret","Webhook secret",k,v,"the secret you typed into Jira's webhook, optional","password","Lets Jira move comments here when issues move there. The URL to give Jira is shown after connecting."),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:h,onChange:p=>d(p.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(H,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(y,{type:"submit",loading:c.isPending,disabled:!l.trim()||!r.trim()||!j.trim()||!b.trim()||!n,children:c.isPending?"Checking…":"Connect"})]})]})})})}function ge({open:o,onOpenChange:i,sites:x,onDone:f}){const[S,w]=a.useState(""),[l,u]=a.useState(""),[r,g]=a.useState(""),[j,m]=a.useState(!0),[b,N]=a.useState(""),k=B({queryKey:["integrations","slack","manifest"],queryFn:()=>T.slackManifest(),enabled:o,staleTime:1/0}),v=F({mutationFn:t=>T.connectTracker(t,"slack",{channel:l.trim(),token:r.trim(),createOn:j?"thread.created":"manual"})}),h=S||x[0]?.uid||"",d=async t=>{t.preventDefault(),N("");try{await v.mutateAsync(h),u(""),g(""),m(!0),i(!1),f(h),I.success("Slack connected")}catch(s){N(s instanceof K?s.message:"Could not reach the server.")}};return e.jsx(E,{open:o,onOpenChange:i,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:t=>void d(t),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(W,{children:[e.jsx(R,{children:"Connect a site to Slack"}),e.jsx(J,{children:"Create the app in your workspace from our manifest — one click, the scopes are filled in — install it, and paste its Bot User OAuth Token. The token is checked against the channel before it is saved, and stored encrypted with this instance's secret key."})]}),b&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:b}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-site",children:"Site"}),e.jsx("select",{id:"sl-site",value:h,onChange:t=>w(t.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:x.map(t=>e.jsx("option",{value:t.uid,children:t.name},t.uid))})]}),e.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border px-3 py-2 text-[13px]",children:[e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block font-medium",children:"1. Create the app"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Opens api.slack.com with the manifest pasted; then Install to Workspace."})]}),e.jsx(y,{type:"button",variant:"outline",size:"sm",disabled:!k.data,render:e.jsx("a",{href:k.data?.url??"#",target:"_blank",rel:"noreferrer"}),children:"Create app…"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-token",children:"2. Bot User OAuth Token"}),e.jsx(A,{id:"sl-token",type:"password",placeholder:"xoxb-…",value:r,onChange:t=>g(t.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"On the app's OAuth & Permissions page after installing."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-channel",children:"3. Channel"}),e.jsx(A,{id:"sl-channel",placeholder:"#reviews",value:l,onChange:t=>u(t.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"A public channel by name; a private one needs the app invited first, then its name works too."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:j,onChange:t=>m(t.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"A message for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"On by default: a channel is where people are told. Turn it off to post from the brief when you mean it."})]})]}),e.jsxs(H,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(y,{type:"submit",loading:v.isPending,disabled:!l.trim()||!r.trim()||!h,children:v.isPending?"Checking…":"Connect"})]})]})})})}const Oe=()=>U(q().user.role,"settings")?e.jsx(me,{}):e.jsx(re,{title:"Integrations",children:e.jsxs("p",{className:"m-0",children:["Connecting a site to GitHub, Linear, Jira or Slack is done by an owner or an admin. Your own agent tokens are on"," ",e.jsx(ee,{to:"/you",className:"text-brand hover:underline",children:"You"}),"."]})});export{Oe as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,ai as x,S as u,h as p,B as g,z as h}from"./index-p-qD6BlY.js";import{u as c}from"./useQuery-D-9vXtOo.js";import{b as d}from"./InstanceRows-B1z-L92-.js";import{A as j,P as f,a as b}from"./parts-CN1uQywE.js";import{u as o}from"./labels-DLMjYGNJ.js";import"./useBaseQuery-DaFWLbWu.js";import"./dialog-D5G50pSW.js";import"./label-CuvYMIVd.js";import"./ConfirmDialog-D1II2uNE.js";import"./card-C01exIzZ.js";function N(){const t=o(),{said:r}=x.useSearch(),i=c(h.setupState()),a=i.data?.billingUrl??null,n=c({queryKey:["plan-state",a],enabled:!!a,queryFn:async()=>{const s=await fetch(`${a.replace(/\/+$/,"")}/state`,{credentials:"include",headers:{accept:"application/json"}});if(!s.ok)throw new Error(String(s.status));return await s.json()}});return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(f,{title:"Plan & billing",sub:t.org.name}),r&&e.jsx("p",{role:"status",className:"m-0 max-w-[1040px] rounded-md border border-border bg-card px-3 py-2 text-[13px]",children:r}),e.jsx(b,{title:"Usage",description:"What this studio uses, against its plan.",children:e.jsx(y,{})}),i.isSuccess&&!a?e.jsx("p",{className:"m-0 text-muted-foreground",children:"This instance has no plans: everything is included."}):n.isError?e.jsx("p",{className:"m-0 text-muted-foreground",children:"The plans could not be loaded. Reload to try again."}):n.data?e.jsxs("section",{className:"flex max-w-[1040px] flex-col gap-4",children:[n.data.intro&&e.jsx("p",{className:"m-0 text-muted-foreground",children:n.data.intro}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-3",children:n.data.plans.map(s=>e.jsxs("div",{className:p("flex min-w-0 flex-col gap-2 rounded-lg border bg-card px-4 py-3.5",s.current?"border-brand ring-1 ring-brand":"border-border"),children:[e.jsxs("h2",{className:"m-0 flex items-center gap-2 text-[14px] font-semibold",children:[s.name,s.current&&e.jsx("span",{className:"rounded-full bg-brand-soft px-2 py-px text-[11.5px] font-medium text-brand",children:"Current"})]}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:s.price}),e.jsx("ul",{className:"m-0 flex-1 list-disc pl-4 text-[12.5px] text-muted-foreground",children:s.features.map(l=>e.jsx("li",{children:l},l))}),s.actions.map(l=>e.jsx(m,{base:a,form:l},l.label))]},s.id))}),n.data.manage&&e.jsx("div",{children:e.jsx(m,{base:a,form:n.data.manage})}),n.data.notes.map(s=>e.jsx("p",{className:"m-0 text-[12.5px] text-muted-foreground",children:s},s))]}):e.jsx(u,{})]})}function m({base:t,form:r}){return e.jsxs("form",{method:"post",action:new URL(r.action,t).toString(),className:"m-0",children:[Object.entries(r.fields).map(([i,a])=>e.jsx("input",{type:"hidden",name:i,value:a},i)),e.jsx(g,{type:"submit",variant:r.primary?"default":"outline",className:r.primary?"w-full":void 0,children:r.label})]})}function y(){const{limits:t}=o(),r=(i,a,n,s)=>a===null?`${i} ${i===1?n:s}, unlimited`:`${i} of ${a} ${a===1?n:s}`;return e.jsxs("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Sites"}),e.jsx("dd",{className:"m-0",children:r(t.projects.used,t.projects.limit,"site","sites")}),e.jsx("dt",{className:"text-muted-foreground",children:"Members"}),e.jsx("dd",{className:"m-0",children:r(t.members.used,t.members.limit,"member","members")}),e.jsx("dt",{className:"text-muted-foreground",children:"Screenshots"}),e.jsx("dd",{className:"m-0",children:t.screenshots?t.storage.limit===null?`${d(t.storage.used)} used`:`${d(t.storage.used)} of ${d(t.storage.limit)}`:"Not on this plan"})]})}const A=()=>o().user.role==="owner"?e.jsx(N,{}):e.jsx(j,{title:"Plan & billing"});export{A as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as r,Q as u}from"./useBaseQuery-DaFWLbWu.js";function a(e,s){return r(e,u)}export{a as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{k as n}from"./index-p-qD6BlY.js";function u(e){return n(e.defaultTagName??"div",e,e)}export{u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r,w as b,j as e,h as y,x as N,B as j,q as f,a1 as S}from"./index-p-qD6BlY.js";import{L as c,I as d}from"./label-CuvYMIVd.js";import{P as C,a as h}from"./parts-CN1uQywE.js";import{S as P}from"./SaveState-QQHqDSgx.js";import{M as A}from"./McpTokens-DE2t0iiS.js";import{u as k}from"./labels-DLMjYGNJ.js";import{u as M,a as F}from"./studio-BHpeuJSq.js";import{M as E,S as T,a as D}from"./sun-DXwtJyi5.js";import"./card-C01exIzZ.js";import"./useQuery-D-9vXtOo.js";import"./useBaseQuery-DaFWLbWu.js";import"./badge-anHWhPFa.js";import"./useRender-BBzDGtxq.js";import"./dialog-D5G50pSW.js";import"./switch-cgJL6ATv.js";import"./useAriaLabelledBy-BT5NtL2E.js";import"./useValueChanged-cwqHWzY1.js";import"./ConfirmDialog-D1II2uNE.js";import"./CopyButton-qbA2ZHWn.js";import"./check-Gm9Xu4rH.js";import"./copy-Ckk__4oN.js";function z({items:t}){const[a,n]=r.useState(b);return e.jsx("div",{className:"flex gap-2",role:"radiogroup","aria-label":"Theme",children:t.map(s=>e.jsxs("button",{type:"button",role:"radio","aria-checked":a===s.value,onClick:()=>{N(s.value),n(s.value)},className:y("inline-flex h-7 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-[12.5px] font-medium text-ink-soft",a===s.value&&"border-line-strong bg-muted text-foreground"),children:[s.icon,s.label]},s.value))})}function ae(){const t=k(),a=M(),[n,s]=r.useState(t.user.name),[u,i]=r.useState(null);r.useEffect(()=>s(t.user.name),[t.user.name]);const m=n.trim()!==t.user.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(C,{title:"You",sub:"Your own account on this studio",actions:e.jsx(P,{saving:a.isPending,savedAt:u})}),e.jsxs(h,{title:"Profile",description:"How you appear on replies and in the members list.",children:[e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:l=>{l.preventDefault(),m&&a.mutate(n.trim(),{onSuccess:()=>i(Date.now())})},children:[e.jsx(c,{htmlFor:"your-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(d,{id:"your-name",value:n,onChange:l=>s(l.target.value)}),m&&e.jsx(j,{type:"submit",variant:"outline",children:"Save"})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"your-email",children:"Email"}),e.jsx(d,{id:"your-email",value:t.user.email,readOnly:!0,className:"bg-muted text-ink-soft"}),e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["How you sign in, and how the server finds you. An owner changes it with"," ",e.jsx("code",{className:"font-mono",children:"snagset passwd"}),"."]})]})]}),e.jsx(h,{title:"Password",description:"Changing it keeps this session and ends every other one.",children:e.jsx(H,{})}),!f(t.user.role,"settings")&&f(t.user.role,"review")&&e.jsx(A,{owner:!0,mine:!0,instanceOwner:!1,sites:t.projects}),e.jsx(h,{title:"Appearance",description:"Also in your menu at the bottom of the sidebar.",children:e.jsx(z,{items:[{value:"system",label:"System",icon:e.jsx(E,{className:"size-3.5"})},{value:"light",label:"Light",icon:e.jsx(T,{className:"size-3.5"})},{value:"dark",label:"Dark",icon:e.jsx(D,{className:"size-3.5"})}]})})]})}function H(){const t=F(),[a,n]=r.useState(""),[s,u]=r.useState(""),[i,m]=r.useState(""),[l,g]=r.useState(""),[w,p]=r.useState(!1),x=a.length>0&&s.length>=12&&s===i;return e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:async o=>{if(o.preventDefault(),!(!x||t.isPending)){g("");try{await t.mutateAsync({current:a,next:s}),n(""),u(""),m(""),p(!0)}catch(v){g(S(v))}}},children:[l&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:l}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"pw-current",children:"Current password"}),e.jsx(d,{id:"pw-current",type:"password",autoComplete:"current-password",value:a,onChange:o=>{n(o.target.value),p(!1)}})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"pw-next",children:"New password"}),e.jsx(d,{id:"pw-next",type:"password",autoComplete:"new-password",value:s,onChange:o=>{u(o.target.value),p(!1)}}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. No composition rules — length is what matters."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"pw-again",children:"Confirm new password"}),e.jsx(d,{id:"pw-again",type:"password",autoComplete:"new-password",value:i,onChange:o=>{m(o.target.value),p(!1)}}),i.length>0&&s!==i&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Those do not match yet."})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(j,{type:"submit",loading:t.isPending,disabled:!x,children:t.isPending?"Changing…":w&&!x?"Changed":"Change password"})})]})}export{ae as component};
|