@snagset/server 0.1.30 → 0.1.31
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/routes/comments.js +8 -1
- package/dist/routes/comments.js.map +1 -1
- package/package.json +1 -1
- package/static/dashboard/assets/{CompositeItem-DYE4B5ie.js → CompositeItem-H1Z2RNQW.js} +1 -1
- package/static/dashboard/assets/{ConfirmDialog-DPSRr1Tb.js → ConfirmDialog-B_HO7qAV.js} +1 -1
- package/static/dashboard/assets/{CopyButton-Dq8Se8Kg.js → CopyButton-BcFPdquT.js} +1 -1
- package/static/dashboard/assets/{FieldItemContext-Cycc3Rw9.js → FieldItemContext-D0Q4rB94.js} +1 -1
- package/static/dashboard/assets/{InstallTag-CaP_CQOx.js → InstallTag-wMa_lFPt.js} +1 -1
- package/static/dashboard/assets/{SaveState-DXTIcqJC.js → SaveState-DbiBWPbj.js} +1 -1
- package/static/dashboard/assets/{_app-JGBrws2g.js → _app-CFqEeTw9.js} +1 -1
- package/static/dashboard/assets/{_app-mxIRCNh9.js → _app-CwVAgS6y.js} +1 -1
- package/static/dashboard/assets/{activity-_UjZ67D7.js → activity-CRFVOJcj.js} +1 -1
- package/static/dashboard/assets/{arrow-left-D4fa3GwW.js → arrow-left-SbuaKLN8.js} +1 -1
- package/static/dashboard/assets/{avatar-Cat2daxa.js → avatar-CyWjapbD.js} +1 -1
- package/static/dashboard/assets/{badge-BZyZu9Jq.js → badge-DZ45gt2t.js} +1 -1
- package/static/dashboard/assets/{card-CP8kl9Er.js → card-rZNT8AAn.js} +1 -1
- package/static/dashboard/assets/{check-c3QcseGY.js → check-DFzW0E5F.js} +1 -1
- package/static/dashboard/assets/{chevron-right-QCzavn7R.js → chevron-right-DNlmYM1H.js} +1 -1
- package/static/dashboard/assets/{copy-Cz7bbj9i.js → copy-CkgrfFiF.js} +1 -1
- package/static/dashboard/assets/{dialog-Co13w87g.js → dialog-cAVg5CWG.js} +1 -1
- package/static/dashboard/assets/{dropdown-menu-DZF40OGy.js → dropdown-menu-CROz9CD7.js} +1 -1
- package/static/dashboard/assets/{image-off-DQRteqKJ.js → image-off-dbox0Nj9.js} +1 -1
- package/static/dashboard/assets/{index-C7DSx6Sq.js → index-NqrbvfSo.js} +3 -3
- package/static/dashboard/assets/{invite-DK8BFo_c.js → invite-D3vU1POj.js} +1 -1
- package/static/dashboard/assets/{label-DIqFFeu7.js → label-CZtxPKnA.js} +1 -1
- package/static/dashboard/assets/{layout-grid-DQkpZWXb.js → layout-grid-CpSrFghR.js} +1 -1
- package/static/dashboard/assets/me-DuZzYTr0.js +1 -0
- package/static/dashboard/assets/{parts-D6YhZQkR.js → parts-CMVHppEZ.js} +1 -1
- package/static/dashboard/assets/{plus-B53oe0mC.js → plus-DvNJzVbr.js} +1 -1
- package/static/dashboard/assets/s._site-1B1JBClP.js +1 -0
- package/static/dashboard/assets/s._site.comments-Pt7LgqE2.js +54 -0
- package/static/dashboard/assets/{s._site.reviewers-iNi9zWp4.js → s._site.reviewers-sTkqblNS.js} +1 -1
- package/static/dashboard/assets/{s._site.settings-BjkdQsXe.js → s._site.settings-BSKudlWC.js} +1 -1
- package/static/dashboard/assets/{setup-CQ5WdHwH.js → setup-ByemjiPq.js} +1 -1
- package/static/dashboard/assets/{sign-in-DjePsY6S.js → sign-in-C79cXPom.js} +1 -1
- package/static/dashboard/assets/{sign-up-CLeZIFgM.js → sign-up-Dg-EW0Ud.js} +1 -1
- package/static/dashboard/assets/{sites-7b8V0YiH.js → sites-DhF1WGvp.js} +1 -1
- package/static/dashboard/assets/studio-D2RgHnii.js +1 -0
- package/static/dashboard/assets/{studio-CLhtJ_jG.js → studio-oojSa61E.js} +1 -1
- package/static/dashboard/assets/{studio.index-DLKZ77jA.js → studio.index-CfkqMX5I.js} +1 -1
- package/static/dashboard/assets/{studio.integrations-gZFE71OD.js → studio.integrations-C8ze7wcK.js} +1 -1
- package/static/dashboard/assets/{studio.members-Cq7DLLom.js → studio.members-BIR4VTee.js} +1 -1
- package/static/dashboard/assets/{sun-Ozkb0b11.js → sun-CCV5_Xwg.js} +1 -1
- package/static/dashboard/assets/{switch-CeFR9G4m.js → switch-pKWkWBSh.js} +1 -1
- package/static/dashboard/assets/{table-BTQlEmr9.js → table-BSlgpUtG.js} +1 -1
- package/static/dashboard/assets/{useAriaLabelledBy-B3Uz7OxG.js → useAriaLabelledBy-BSt0Y1vn.js} +1 -1
- package/static/dashboard/assets/{useBaseQuery-BOxBxtrs.js → useBaseQuery-BQZrcHmw.js} +1 -1
- package/static/dashboard/assets/useQuery-Ce8K2e88.js +1 -0
- package/static/dashboard/assets/useRender-CLH8yHqZ.js +1 -0
- package/static/dashboard/assets/{useValueChanged-DuDldoH9.js → useValueChanged-DKD8Vs7J.js} +1 -1
- package/static/dashboard/assets/{users-BQitcseY.js → users-BH5_IfoG.js} +1 -1
- package/static/dashboard/assets/{welcome-BMb9diyE.js → welcome-BJqfqWXr.js} +1 -1
- package/static/dashboard/assets/{widget-signin-Bu_gkSNQ.js → widget-signin-D6LOaizs.js} +1 -1
- package/static/dashboard/assets/{you-DjZsBSqu.js → you-Bf2lJYxa.js} +1 -1
- package/static/dashboard/assets/{zod-DB58sa1C.js → zod-B-woswyx.js} +1 -1
- package/static/dashboard/index.html +1 -1
- package/static/widget/snag.dock.js +5 -5
- package/static/dashboard/assets/me-O_b4NSqM.js +0 -1
- package/static/dashboard/assets/s._site-CBXNZf6x.js +0 -1
- package/static/dashboard/assets/s._site.comments-BifYLuF1.js +0 -54
- package/static/dashboard/assets/studio-CC2IHhpE.js +0 -1
- package/static/dashboard/assets/useQuery-C4DAYIse.js +0 -1
- package/static/dashboard/assets/useRender-BSEN3cz1.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as B,r as h,Z as v,p as y,_ as b,Y as C,j as e,B as g,y as S,A as K,S as _}from"./index-C7DSx6Sq.js";import{u as w}from"./useQuery-C4DAYIse.js";import{L as A,I as k}from"./label-DIqFFeu7.js";import{E as M,G as $,I as T,H as I,J as U,K as L}from"./dialog-Co13w87g.js";import{C as G}from"./ConfirmDialog-DPSRr1Tb.js";import{a as D,P as O}from"./parts-D6YhZQkR.js";import{b as F}from"./labels--UUyt9uB.js";import{u as z}from"./me-O_b4NSqM.js";import{S as q}from"./SaveState-DXTIcqJC.js";import{b as H}from"./studio-CLhtJ_jG.js";import{c as Q}from"./update-duXzIzFS.js";import"./useBaseQuery-BOxBxtrs.js";import"./card-CP8kl9Er.js";function V({owner:n}){const s=w(S.instance()),i=B(),t=()=>i.invalidateQueries({queryKey:S.instance().queryKey}),[c,l]=h.useState(!1),[p,x]=h.useState(!1),[d,u]=h.useState(null),a=v({mutationFn:y.disconnectStorage,onSuccess:()=>void t(),onError:j=>b.error(C(j))}),r=v({mutationFn:y.disconnectMail,onSuccess:()=>void t(),onError:j=>b.error(C(j))}),f=v({mutationFn:y.testMail,onSuccess:j=>b.success(`Sent to ${j.to}`),onError:j=>b.error(C(j))}),N=z(),m=s.data?.storage,o=s.data?.mail;return e.jsxs(e.Fragment,{children:[e.jsxs(D,{title:"Storage",description:"The bucket screenshots and files go to. Without one the widget runs in annotation mode.",children:[!s.data&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:s.isError?"Could not read it.":"Reading…"}),m&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(E,{tone:m.connected?"ok":m.unreadable?"bad":"off",text:m.connected?`Connected · ${m.bucket} at ${(m.endpoint??"").replace(/^https?:\/\//,"")}${m.connectedAt?` · since ${F(m.connectedAt)}`:""}`:m.unreadable?"A bucket is stored but its keys will not decrypt — the secret key changed. Connect it again.":"Not connected — annotation mode. Comments and anchors work; screenshots are not offered."}),N.limits.storage.limit!==null&&e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:[R(N.limits.storage.used)," of ",R(N.limits.storage.limit)," used across the studio's sites."]}),m.source==="env"?e.jsx(P,{what:"SNAGSET_STORAGE_S3_*"}):n?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{variant:"outline",size:"sm",onClick:()=>l(!0),children:m.connected||m.unreadable?"Replace…":"Connect a bucket…"}),(m.connected||m.unreadable)&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>u("storage"),children:"Disconnect"})]}):null]})]}),e.jsx(D,{title:"Mail",description:"How notifications go out. Without a transport they are off, and the instance says so.",children:o&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(E,{tone:o.configured?"ok":o.unreadable?"bad":"off",text:o.configured?`${o.scheme==="resend"?"Resend":`SMTP · ${o.host??""}`} · from ${o.from}${o.updatedAt?` · since ${F(o.updatedAt)}`:""}`:o.unreadable?"A transport is stored but its secret will not decrypt — the secret key changed. Connect it again.":"No transport — notifications are off."}),o.source==="env"?e.jsx(P,{what:"SNAGSET_MAIL_URL"}):n?e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(g,{variant:"outline",size:"sm",onClick:()=>x(!0),children:o.configured||o.unreadable?"Replace…":"Connect a transport…"}),o.configured&&e.jsx(g,{variant:"outline",size:"sm",loading:f.isPending,onClick:()=>f.mutate(),children:f.isPending?"Sending…":"Send a test email"}),(o.configured||o.unreadable)&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>u("mail"),children:"Disconnect"})]}):(o.configured&&n===!1,null)]})}),e.jsx(W,{open:c,onOpenChange:l,onDone:()=>void t()}),e.jsx(J,{open:p,onOpenChange:x,onDone:()=>void t()}),e.jsx(G,{open:d!==null,onOpenChange:j=>!j&&u(null),title:d==="storage"?"Disconnect the bucket?":"Disconnect the mail transport?",description:d==="storage"?"Screenshots stop being offered. Nothing in the bucket is deleted, and reconnecting the same bucket brings the pictures back.":"Notifications stop going out until a transport is connected again.",confirmLabel:"Disconnect",busy:a.isPending||r.isPending,onConfirm:async()=>{d==="storage"?await a.mutateAsync():await r.mutateAsync(),u(null)}})]})}function E({tone:n,text:s}){return e.jsxs("p",{className:"m-0 flex items-center gap-2 text-[13px]",children:[e.jsx("span",{className:`size-2 shrink-0 rounded-full ${n==="ok"?"bg-ok":n==="bad"?"bg-destructive":"bg-line-strong"}`,"aria-hidden":"true"}),e.jsx("span",{children:s})]})}function P({what:n}){return e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["Set by the environment (",e.jsx("code",{className:"font-mono",children:n}),"). Change it there; the dashboard shows it and does not offer to edit it."]})}function W({open:n,onOpenChange:s,onDone:i}){const[t,c]=h.useState({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),[l,p]=h.useState(""),x=v({mutationFn:y.connectStorage}),d=r=>f=>c({...t,[r]:f.target.value}),u=async r=>{r.preventDefault(),p("");try{await x.mutateAsync({endpoint:t.endpoint.trim(),bucket:t.bucket.trim(),accessKeyId:t.accessKeyId.trim(),secretAccessKey:t.secretAccessKey,...t.region.trim()?{region:t.region.trim()}:{},...t.publicBaseUrl.trim()?{publicBaseUrl:t.publicBaseUrl.trim()}:{}}),c({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),s(!1),i(),b.success("Bucket connected — screenshots are on")}catch(f){p(f instanceof K?f.message:"Could not reach the server.")}},a=(r,f,N,m="text",o)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{htmlFor:`st-${r}`,children:f}),e.jsx(k,{id:`st-${r}`,type:m,placeholder:N,value:t[r],onChange:d(r),autoComplete:"off"}),o&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:o})]});return e.jsx(M,{open:n,onOpenChange:s,children:e.jsx($,{children:e.jsxs("form",{onSubmit:r=>void u(r),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(T,{children:[e.jsx(I,{children:"Connect a bucket"}),e.jsx(U,{children:"Any S3-compatible bucket. It is probed — write, read, delete — before anything is saved, and the keys are stored encrypted with this instance's secret key."})]}),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}),a("endpoint","Endpoint","https://ams3.digitaloceanspaces.com"),a("bucket","Bucket","snagset"),a("region","Region","auto","text","Leave empty for providers that do not use one."),a("accessKeyId","Access key ID",""),a("secretAccessKey","Secret access key","","password"),a("publicBaseUrl","Public base URL","","text","Optional — only if the bucket is served from a CDN address."),e.jsxs(L,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:x.isPending,children:x.isPending?"Probing…":"Connect"})]})]})})})}function J({open:n,onOpenChange:s,onDone:i}){const[t,c]=h.useState(""),[l,p]=h.useState(""),[x,d]=h.useState(""),u=v({mutationFn:y.connectMail}),a=async r=>{r.preventDefault(),d("");try{await u.mutateAsync({url:t.trim(),from:l.trim()}),c(""),p(""),s(!1),i(),b.success("Transport connected — send a test email to be sure")}catch(f){d(f instanceof K?f.message:"Could not reach the server.")}};return e.jsx(M,{open:n,onOpenChange:s,children:e.jsx($,{children:e.jsxs("form",{onSubmit:r=>void a(r),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(T,{children:[e.jsx(I,{children:"Connect a mail transport"}),e.jsx(U,{children:"Resend is the easy one — the provider owns SPF and DKIM. SMTP works with any provider. The URL is stored encrypted with this instance's secret key."})]}),x&&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:x}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{htmlFor:"mail-url",children:"Transport"}),e.jsx(k,{id:"mail-url",type:"password",placeholder:"resend://re_… or smtp://user:pass@host:587",value:t,onChange:r=>c(r.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{htmlFor:"mail-from",children:"From"}),e.jsx(k,{id:"mail-from",placeholder:"Snagset <review@kilnwork.studio>",value:l,onChange:r=>p(r.target.value)}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The address every notification is sent from. Resend needs a verified domain for it."})]}),e.jsxs(L,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:u.isPending,disabled:!t.trim()||!l.trim(),children:u.isPending?"Saving…":"Connect"})]})]})})})}function R(n){const s=["B","KB","MB","GB","TB"];let i=n,t=0;for(;i>=1024&&t<s.length-1;)i/=1024,t+=1;return`${t===0?i:i.toFixed(i>=10?0:1)} ${s[t]}`}function me(){const n=z(),s=w(S.meta()),i=w(S.members()),t=H(),c=n.user.role==="owner",[l,p]=h.useState(n.org.name),[x,d]=h.useState(null);h.useEffect(()=>p(n.org.name),[n.org.name]);const u=c&&l.trim().length>0&&l.trim()!==n.org.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(O,{title:"General",sub:n.org.name,actions:e.jsx(q,{saving:t.isPending,savedAt:x})}),e.jsx(D,{title:"Studio",description:"The name at the top of every screen.",children:e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:a=>{a.preventDefault(),u&&t.mutate(l.trim(),{onSuccess:()=>d(Date.now())})},children:[e.jsx(A,{htmlFor:"studio-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(k,{id:"studio-name",value:l,readOnly:!c,onChange:a=>p(a.target.value)}),u&&e.jsx(g,{type:"submit",variant:"outline",children:"Save"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:c?"Shown at the top of the sidebar, above every site.":"Only an owner can change it."})]})}),e.jsx(D,{title:"This instance",description:"What is running, and where.",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:[s.data?.version??"—"," ",e.jsx(Y,{version:s.data?.version??""})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Address"}),e.jsx("dd",{className:"m-0",children:e.jsx(Z,{owner:c})}),s.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:[s.data.commit.slice(0,12),s.data.modified?" · modified":""]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Sites · members"}),e.jsxs("dd",{className:"m-0",children:[n.projects.length," · ",i.data?.data.length??"—"]})]})}),e.jsx(V,{owner:c})]})}function Y({version:n}){const[s,i]=h.useState({s:"idle"});return s.s==="idle"?e.jsxs(e.Fragment,{children:["·"," ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>{i({s:"checking"}),Q(n).then(t=>i({s:"done",r:t})).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"})]}):s.s==="checking"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:["· ",e.jsx(_,{className:"size-3"})," checking…"]}):s.s==="failed"?e.jsx("span",{className:"text-muted-foreground",children:"· could not reach npm"}):e.jsx("span",{className:"text-muted-foreground",children:s.r?.newer?`· ${s.r.latest} is out`:"· up to date"})}function Z({owner:n}){const s=B(),i=w(S.instance()),[t,c]=h.useState(null),[l,p]=h.useState(""),x=v({mutationFn:a=>y.setAddress(a),onSuccess:a=>{s.setQueryData(S.instance().queryKey,a),c(null),p(""),b.success("Address saved — every new link is built from it")},onError:a=>p(C(a))}),d=i.data?.address;if(!d)return e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:location.origin});const u=d.source==="env";return t===null||!n||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:d.url}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:u?"· set by the environment (SNAGSET_BASE_URL)":d.source==="stored"?"· set at claim; every link is built from it":"· this machine's default"}),n&&!u&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>c(d.url),children:"Change…"})]}):e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:a=>{a.preventDefault(),x.mutate(t.trim())},children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(k,{"aria-label":"Address",value:t,onChange:a=>c(a.target.value),className:"h-8 max-w-[360px] font-mono text-[12px]",autoFocus:!0}),e.jsx(g,{type:"submit",size:"sm",loading:x.isPending,disabled:!t.trim(),children:x.isPending?"Saving…":"Save"}),e.jsx(g,{type:"button",variant:"ghost",size:"sm",onClick:()=>c(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."})]})}export{me as component};
|
|
1
|
+
import{t as B,r as h,Z as v,p as y,_ as b,Y as C,j as e,B as g,y as S,A as K,S as _}from"./index-NqrbvfSo.js";import{u as w}from"./useQuery-Ce8K2e88.js";import{L as A,I as k}from"./label-CZtxPKnA.js";import{E as M,G as $,I as T,H as I,J as U,K as L}from"./dialog-cAVg5CWG.js";import{C as G}from"./ConfirmDialog-B_HO7qAV.js";import{a as D,P as O}from"./parts-CMVHppEZ.js";import{b as F}from"./labels--UUyt9uB.js";import{u as z}from"./me-DuZzYTr0.js";import{S as q}from"./SaveState-DbiBWPbj.js";import{b as H}from"./studio-oojSa61E.js";import{c as Q}from"./update-duXzIzFS.js";import"./useBaseQuery-BQZrcHmw.js";import"./card-rZNT8AAn.js";function V({owner:n}){const s=w(S.instance()),i=B(),t=()=>i.invalidateQueries({queryKey:S.instance().queryKey}),[c,l]=h.useState(!1),[p,x]=h.useState(!1),[d,u]=h.useState(null),a=v({mutationFn:y.disconnectStorage,onSuccess:()=>void t(),onError:j=>b.error(C(j))}),r=v({mutationFn:y.disconnectMail,onSuccess:()=>void t(),onError:j=>b.error(C(j))}),f=v({mutationFn:y.testMail,onSuccess:j=>b.success(`Sent to ${j.to}`),onError:j=>b.error(C(j))}),N=z(),m=s.data?.storage,o=s.data?.mail;return e.jsxs(e.Fragment,{children:[e.jsxs(D,{title:"Storage",description:"The bucket screenshots and files go to. Without one the widget runs in annotation mode.",children:[!s.data&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:s.isError?"Could not read it.":"Reading…"}),m&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(E,{tone:m.connected?"ok":m.unreadable?"bad":"off",text:m.connected?`Connected · ${m.bucket} at ${(m.endpoint??"").replace(/^https?:\/\//,"")}${m.connectedAt?` · since ${F(m.connectedAt)}`:""}`:m.unreadable?"A bucket is stored but its keys will not decrypt — the secret key changed. Connect it again.":"Not connected — annotation mode. Comments and anchors work; screenshots are not offered."}),N.limits.storage.limit!==null&&e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:[R(N.limits.storage.used)," of ",R(N.limits.storage.limit)," used across the studio's sites."]}),m.source==="env"?e.jsx(P,{what:"SNAGSET_STORAGE_S3_*"}):n?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{variant:"outline",size:"sm",onClick:()=>l(!0),children:m.connected||m.unreadable?"Replace…":"Connect a bucket…"}),(m.connected||m.unreadable)&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>u("storage"),children:"Disconnect"})]}):null]})]}),e.jsx(D,{title:"Mail",description:"How notifications go out. Without a transport they are off, and the instance says so.",children:o&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(E,{tone:o.configured?"ok":o.unreadable?"bad":"off",text:o.configured?`${o.scheme==="resend"?"Resend":`SMTP · ${o.host??""}`} · from ${o.from}${o.updatedAt?` · since ${F(o.updatedAt)}`:""}`:o.unreadable?"A transport is stored but its secret will not decrypt — the secret key changed. Connect it again.":"No transport — notifications are off."}),o.source==="env"?e.jsx(P,{what:"SNAGSET_MAIL_URL"}):n?e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(g,{variant:"outline",size:"sm",onClick:()=>x(!0),children:o.configured||o.unreadable?"Replace…":"Connect a transport…"}),o.configured&&e.jsx(g,{variant:"outline",size:"sm",loading:f.isPending,onClick:()=>f.mutate(),children:f.isPending?"Sending…":"Send a test email"}),(o.configured||o.unreadable)&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>u("mail"),children:"Disconnect"})]}):(o.configured&&n===!1,null)]})}),e.jsx(W,{open:c,onOpenChange:l,onDone:()=>void t()}),e.jsx(J,{open:p,onOpenChange:x,onDone:()=>void t()}),e.jsx(G,{open:d!==null,onOpenChange:j=>!j&&u(null),title:d==="storage"?"Disconnect the bucket?":"Disconnect the mail transport?",description:d==="storage"?"Screenshots stop being offered. Nothing in the bucket is deleted, and reconnecting the same bucket brings the pictures back.":"Notifications stop going out until a transport is connected again.",confirmLabel:"Disconnect",busy:a.isPending||r.isPending,onConfirm:async()=>{d==="storage"?await a.mutateAsync():await r.mutateAsync(),u(null)}})]})}function E({tone:n,text:s}){return e.jsxs("p",{className:"m-0 flex items-center gap-2 text-[13px]",children:[e.jsx("span",{className:`size-2 shrink-0 rounded-full ${n==="ok"?"bg-ok":n==="bad"?"bg-destructive":"bg-line-strong"}`,"aria-hidden":"true"}),e.jsx("span",{children:s})]})}function P({what:n}){return e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["Set by the environment (",e.jsx("code",{className:"font-mono",children:n}),"). Change it there; the dashboard shows it and does not offer to edit it."]})}function W({open:n,onOpenChange:s,onDone:i}){const[t,c]=h.useState({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),[l,p]=h.useState(""),x=v({mutationFn:y.connectStorage}),d=r=>f=>c({...t,[r]:f.target.value}),u=async r=>{r.preventDefault(),p("");try{await x.mutateAsync({endpoint:t.endpoint.trim(),bucket:t.bucket.trim(),accessKeyId:t.accessKeyId.trim(),secretAccessKey:t.secretAccessKey,...t.region.trim()?{region:t.region.trim()}:{},...t.publicBaseUrl.trim()?{publicBaseUrl:t.publicBaseUrl.trim()}:{}}),c({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),s(!1),i(),b.success("Bucket connected — screenshots are on")}catch(f){p(f instanceof K?f.message:"Could not reach the server.")}},a=(r,f,N,m="text",o)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{htmlFor:`st-${r}`,children:f}),e.jsx(k,{id:`st-${r}`,type:m,placeholder:N,value:t[r],onChange:d(r),autoComplete:"off"}),o&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:o})]});return e.jsx(M,{open:n,onOpenChange:s,children:e.jsx($,{children:e.jsxs("form",{onSubmit:r=>void u(r),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(T,{children:[e.jsx(I,{children:"Connect a bucket"}),e.jsx(U,{children:"Any S3-compatible bucket. It is probed — write, read, delete — before anything is saved, and the keys are stored encrypted with this instance's secret key."})]}),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}),a("endpoint","Endpoint","https://ams3.digitaloceanspaces.com"),a("bucket","Bucket","snagset"),a("region","Region","auto","text","Leave empty for providers that do not use one."),a("accessKeyId","Access key ID",""),a("secretAccessKey","Secret access key","","password"),a("publicBaseUrl","Public base URL","","text","Optional — only if the bucket is served from a CDN address."),e.jsxs(L,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:x.isPending,children:x.isPending?"Probing…":"Connect"})]})]})})})}function J({open:n,onOpenChange:s,onDone:i}){const[t,c]=h.useState(""),[l,p]=h.useState(""),[x,d]=h.useState(""),u=v({mutationFn:y.connectMail}),a=async r=>{r.preventDefault(),d("");try{await u.mutateAsync({url:t.trim(),from:l.trim()}),c(""),p(""),s(!1),i(),b.success("Transport connected — send a test email to be sure")}catch(f){d(f instanceof K?f.message:"Could not reach the server.")}};return e.jsx(M,{open:n,onOpenChange:s,children:e.jsx($,{children:e.jsxs("form",{onSubmit:r=>void a(r),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(T,{children:[e.jsx(I,{children:"Connect a mail transport"}),e.jsx(U,{children:"Resend is the easy one — the provider owns SPF and DKIM. SMTP works with any provider. The URL is stored encrypted with this instance's secret key."})]}),x&&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:x}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{htmlFor:"mail-url",children:"Transport"}),e.jsx(k,{id:"mail-url",type:"password",placeholder:"resend://re_… or smtp://user:pass@host:587",value:t,onChange:r=>c(r.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{htmlFor:"mail-from",children:"From"}),e.jsx(k,{id:"mail-from",placeholder:"Snagset <review@kilnwork.studio>",value:l,onChange:r=>p(r.target.value)}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The address every notification is sent from. Resend needs a verified domain for it."})]}),e.jsxs(L,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:u.isPending,disabled:!t.trim()||!l.trim(),children:u.isPending?"Saving…":"Connect"})]})]})})})}function R(n){const s=["B","KB","MB","GB","TB"];let i=n,t=0;for(;i>=1024&&t<s.length-1;)i/=1024,t+=1;return`${t===0?i:i.toFixed(i>=10?0:1)} ${s[t]}`}function me(){const n=z(),s=w(S.meta()),i=w(S.members()),t=H(),c=n.user.role==="owner",[l,p]=h.useState(n.org.name),[x,d]=h.useState(null);h.useEffect(()=>p(n.org.name),[n.org.name]);const u=c&&l.trim().length>0&&l.trim()!==n.org.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(O,{title:"General",sub:n.org.name,actions:e.jsx(q,{saving:t.isPending,savedAt:x})}),e.jsx(D,{title:"Studio",description:"The name at the top of every screen.",children:e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:a=>{a.preventDefault(),u&&t.mutate(l.trim(),{onSuccess:()=>d(Date.now())})},children:[e.jsx(A,{htmlFor:"studio-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(k,{id:"studio-name",value:l,readOnly:!c,onChange:a=>p(a.target.value)}),u&&e.jsx(g,{type:"submit",variant:"outline",children:"Save"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:c?"Shown at the top of the sidebar, above every site.":"Only an owner can change it."})]})}),e.jsx(D,{title:"This instance",description:"What is running, and where.",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:[s.data?.version??"—"," ",e.jsx(Y,{version:s.data?.version??""})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Address"}),e.jsx("dd",{className:"m-0",children:e.jsx(Z,{owner:c})}),s.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:[s.data.commit.slice(0,12),s.data.modified?" · modified":""]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Sites · members"}),e.jsxs("dd",{className:"m-0",children:[n.projects.length," · ",i.data?.data.length??"—"]})]})}),e.jsx(V,{owner:c})]})}function Y({version:n}){const[s,i]=h.useState({s:"idle"});return s.s==="idle"?e.jsxs(e.Fragment,{children:["·"," ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>{i({s:"checking"}),Q(n).then(t=>i({s:"done",r:t})).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"})]}):s.s==="checking"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:["· ",e.jsx(_,{className:"size-3"})," checking…"]}):s.s==="failed"?e.jsx("span",{className:"text-muted-foreground",children:"· could not reach npm"}):e.jsx("span",{className:"text-muted-foreground",children:s.r?.newer?`· ${s.r.latest} is out`:"· up to date"})}function Z({owner:n}){const s=B(),i=w(S.instance()),[t,c]=h.useState(null),[l,p]=h.useState(""),x=v({mutationFn:a=>y.setAddress(a),onSuccess:a=>{s.setQueryData(S.instance().queryKey,a),c(null),p(""),b.success("Address saved — every new link is built from it")},onError:a=>p(C(a))}),d=i.data?.address;if(!d)return e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:location.origin});const u=d.source==="env";return t===null||!n||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:d.url}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:u?"· set by the environment (SNAGSET_BASE_URL)":d.source==="stored"?"· set at claim; every link is built from it":"· this machine's default"}),n&&!u&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>c(d.url),children:"Change…"})]}):e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:a=>{a.preventDefault(),x.mutate(t.trim())},children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(k,{"aria-label":"Address",value:t,onChange:a=>c(a.target.value),className:"h-8 max-w-[360px] font-mono text-[12px]",autoFocus:!0}),e.jsx(g,{type:"submit",size:"sm",loading:x.isPending,disabled:!t.trim(),children:x.isPending?"Saving…":"Save"}),e.jsx(g,{type:"button",variant:"ghost",size:"sm",onClick:()=>c(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."})]})}export{me as component};
|
package/static/dashboard/assets/{studio.integrations-gZFE71OD.js → studio.integrations-C8ze7wcK.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as z,r as i,Z as P,_ as A,Y as K,p as T,$ as J,j as e,V as Q,B as N,y as U,a0 as oe,A as H}from"./index-C7DSx6Sq.js";import{u as B}from"./useQuery-C4DAYIse.js";import{B as G}from"./badge-BZyZu9Jq.js";import{E,G as O,I as R,H as D,J as L,K as M}from"./dialog-Co13w87g.js";import{L as C,I as F}from"./label-DIqFFeu7.js";import{S as ae}from"./switch-CeFR9G4m.js";import{C as V}from"./ConfirmDialog-DPSRr1Tb.js";import{P as re,a as Y}from"./parts-D6YhZQkR.js";import{C as W}from"./CopyButton-Dq8Se8Kg.js";import{b as Z}from"./labels--UUyt9uB.js";import{u as ie}from"./me-O_b4NSqM.js";import"./useBaseQuery-BOxBxtrs.js";import"./useRender-BSEN3cz1.js";import"./useAriaLabelledBy-B3Uz7OxG.js";import"./useValueChanged-DuDldoH9.js";import"./card-CP8kl9Er.js";import"./check-c3QcseGY.js";import"./copy-Cz7bbj9i.js";const ce={ok:{label:"Healthy",tone:"ok"},needs_reauth:{label:"Needs a new token",tone:"bad"},error:{label:"Failing",tone:"bad"}};function Re(){const r=ie(),c=r.user.role==="owner"||r.user.role==="admin",k=r.user.role==="owner",f=B(U.integrations()),g=z(),j=()=>g.invalidateQueries({queryKey:["integrations"]}),[d,p]=i.useState(null),[l,m]=i.useState(null),[h,u]=i.useState(null),v=P({mutationFn:t=>T.regenerateGitHubWebhook(t),onSuccess:({webhook:t},s)=>u({site:s,provider:"github",hook:t,fresh:!1}),onError:t=>A.error(K(t))}),w=P({mutationFn:({uid:t,provider:s})=>T.testTracker(t,s).then(a=>({...a,provider:s})),onSuccess:t=>{A[t.ok?"success":"error"](t.ok?`${J[t.provider]} can see ${t.target}`:t.detail??`${J[t.provider]} refused the token`),j()},onError:t=>A.error(K(t))}),x=P({mutationFn:({uid:t,provider:s})=>T.disconnectTracker(t,s),onSuccess:()=>{m(null),j()},onError:t=>A.error(K(t))}),y=f.data?.data??[],b=t=>y.filter(s=>s.provider===t),n=t=>r.projects.filter(s=>!b(t).some(a=>a.site===s.uid));return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(re,{title:"Integrations",sub:"Mirrors converge on the comment's status here; Slack only announces"}),["github","linear","jira","slack"].map(t=>{const s=b(t),a=n(t);return e.jsxs(Y,{title:J[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(Q,{rows:2}),f.isSuccess&&s.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(G,{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(o=>{const I=ce[o.health]??{label:o.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:o.siteName??o.site}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("code",{className:"font-mono text-[12.5px]",children:o.provider==="github"?`${o.owner}/${o.repo}`:o.provider==="linear"?`${o.teamKey} · ${o.teamName}`:o.provider==="jira"?`${o.projectKey} · ${o.projectName}`:`#${o.channelName} · ${o.teamName}`}),e.jsx(G,{variant:"outline",className:I.tone==="ok"?"border-ok text-ok":I.tone==="bad"?"border-destructive text-destructive":"",children:I.label}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[o.provider==="slack"?o.createOn==="thread.created"?"A message for every new comment":"Messages when you ask, from the brief":o.createOn==="thread.created"?"An issue for every new comment":"Issues when you ask, from the brief",o.provider==="github"&&o.labels.length?` · labels ${o.labels.join(", ")}`:"",o.provider!=="github"&&o.provider!=="slack"&&!o.hasWebhookSecret?` · no webhook secret yet, so ${J[o.provider]} cannot move comments here`:""," · ",Z(o.updatedAt)]}),o.lastError&&e.jsx("span",{className:"basis-full text-[12px] text-destructive",children:o.lastError}),c&&e.jsxs("span",{className:"ml-auto flex gap-1",children:[o.provider==="github"?e.jsx(N,{variant:"ghost",size:"sm",loading:v.isPending,onClick:()=>v.mutate(o.site),children:"Webhook…"}):o.provider==="slack"?null:e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>u({site:o.site,provider:o.provider,hook:{url:`${location.origin}/api/v1/integrations/${o.provider}/inbound`},fresh:!1}),children:"Webhook…"}),e.jsx(N,{variant:"ghost",size:"sm",loading:w.isPending,onClick:()=>w.mutate({uid:o.site,provider:o.provider}),children:"Test"}),e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>m(o),children:"Disconnect"})]})]},`${o.provider}:${o.site}`)})}),c&&a.length>0&&e.jsx("div",{children:e.jsx(N,{variant:"outline",size:"sm",onClick:()=>p(t),children:"Connect a site…"})})]},t)}),e.jsx(xe,{owner:c,instanceOwner:k,sites:r.projects}),e.jsx(le,{open:d==="github",onOpenChange:t=>!t&&p(null),sites:n("github"),onDone:(t,s)=>{j(),s&&u({site:t,provider:"github",hook:s,fresh:!0})}}),e.jsx(me,{open:d==="linear",onOpenChange:t=>!t&&p(null),sites:n("linear"),onDone:(t,s)=>{j(),u({site:t,provider:"linear",hook:s,fresh:!0})}}),e.jsx(he,{open:d==="jira",onOpenChange:t=>!t&&p(null),sites:n("jira"),onDone:(t,s)=>{j(),u({site:t,provider:"jira",hook:s,fresh:!0})}}),e.jsx(ue,{open:d==="slack",onOpenChange:t=>!t&&p(null),sites:n("slack"),onDone:()=>void j()}),e.jsx(de,{state:h,onClose:()=>u(null),siteName:t=>y.find(s=>s.site===t)?.siteName??"the site"}),e.jsx(V,{open:l!==null,onOpenChange:t=>!t&&m(null),title:`Disconnect ${l?.siteName??"this site"} from ${l?J[l.provider]:"the tracker"}?`,description:l?.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:x.isPending,onConfirm:async()=>{l&&await x.mutateAsync({uid:l.site,provider:l.provider})}})]})}function le({open:r,onOpenChange:c,sites:k,onDone:f}){const[g,j]=i.useState(""),[d,p]=i.useState(""),[l,m]=i.useState(""),[h,u]=i.useState(""),[v,w]=i.useState(!1),[x,y]=i.useState(""),b=P({mutationFn:s=>T.connectTracker(s,"github",{repository:d.trim(),token:l.trim(),labels:h,createOn:v?"thread.created":"manual"})}),n=g||k[0]?.uid||"",t=async s=>{s.preventDefault(),y("");try{const a=await b.mutateAsync(n);p(""),m(""),u(""),w(!1),c(!1),f(n,a.webhook&&"secret"in a.webhook?a.webhook:void 0),A.success("GitHub connected")}catch(a){y(a instanceof H?a.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"Connect a site to GitHub"}),e.jsxs(L,{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."]})]}),x&&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:x}),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:n,onChange:s=>j(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:k.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(F,{id:"gh-repo",placeholder:"kilnwork/site",value:d,onChange:s=>p(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(F,{id:"gh-token",type:"password",placeholder:"github_pat_…",value:l,onChange:s=>m(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(F,{id:"gh-labels",placeholder:"review, bug",value:h,onChange:s=>u(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:v,onChange:s=>w(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(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:b.isPending,disabled:!d.trim()||!l.trim()||!n,children:b.isPending?"Checking…":"Connect"})]})]})})})}function de({state:r,onClose:c,siteName:k}){const f=r&&"secret"in r.hook?r.hook.secret:null;return e.jsx(E,{open:r!==null,onOpenChange:g=>!g&&c(),children:e.jsxs(O,{children:[e.jsxs(R,{children:[e.jsx(D,{children:r?.fresh?"Connected — now the webhook":"Webhook for "+(r?k(r.site):"")}),e.jsx(L,{children:r?.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.":r?.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${r?.fresh?"":", and the previous one has stopped working"}.`})]}),r&&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:r.hook.url}),e.jsx(W,{text:r.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(W,{text:f,label:"Copy the secret"})]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Events"}),e.jsx("dd",{className:"m-0",children:r.provider==="linear"?"Issues":r.provider==="jira"?"Issue: updated, deleted":"Let me select individual events → Issues"})]}),e.jsx(M,{children:e.jsx(N,{type:"button",onClick:c,children:"Done"})})]})})}function me({open:r,onOpenChange:c,sites:k,onDone:f}){const[g,j]=i.useState(""),[d,p]=i.useState(""),[l,m]=i.useState(""),[h,u]=i.useState(""),[v,w]=i.useState(!1),[x,y]=i.useState(""),b=P({mutationFn:s=>T.connectTracker(s,"linear",{team:d.trim(),apiKey:l.trim(),...h.trim()?{webhookSecret:h.trim()}:{},createOn:v?"thread.created":"manual"})}),n=g||k[0]?.uid||"",t=async s=>{s.preventDefault(),y("");try{const a=await b.mutateAsync(n);p(""),m(""),u(""),w(!1),c(!1),f(n,a.webhook??{url:`${location.origin}/api/v1/integrations/linear/inbound`}),A.success("Linear connected")}catch(a){y(a instanceof H?a.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"Connect a site to Linear"}),e.jsx(L,{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."})]}),x&&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:x}),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:n,onChange:s=>j(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:k.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(F,{id:"ln-team",placeholder:"ENG",value:d,onChange:s=>p(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(F,{id:"ln-key",type:"password",placeholder:"lin_api_…",value:l,onChange:s=>m(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(F,{id:"ln-secret",type:"password",placeholder:"from Linear's webhook, optional",value:h,onChange:s=>u(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:v,onChange:s=>w(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(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:b.isPending,disabled:!d.trim()||!l.trim()||!n,children:b.isPending?"Checking…":"Connect"})]})]})})})}function he({open:r,onOpenChange:c,sites:k,onDone:f}){const[g,j]=i.useState(""),[d,p]=i.useState(""),[l,m]=i.useState(""),[h,u]=i.useState(""),[v,w]=i.useState(""),[x,y]=i.useState(""),[b,n]=i.useState(!1),[t,s]=i.useState(""),a=P({mutationFn:S=>T.connectTracker(S,"jira",{siteUrl:d.trim(),project:l.trim(),email:h.trim(),apiToken:v.trim(),...x.trim()?{webhookSecret:x.trim()}:{},createOn:b?"thread.created":"manual"})}),o=g||k[0]?.uid||"",I=async S=>{S.preventDefault(),s("");try{const _=await a.mutateAsync(o);m(""),w(""),y(""),n(!1),c(!1),f(o,_.webhook??{url:`${location.origin}/api/v1/integrations/jira/inbound`}),A.success("Jira connected")}catch(_){s(_ instanceof H?_.message:"Could not reach the server.")}},$=(S,_,X,ee,te,se="text",q)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:`jr-${S}`,children:_}),e.jsx(F,{id:`jr-${S}`,type:se,placeholder:te,value:X,onChange:ne=>ee(ne.target.value),autoComplete:"off"}),q&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:q})]});return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:S=>void I(S),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"Connect a site to Jira"}),e.jsx(L,{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:o,onChange:S=>j(S.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:k.map(S=>e.jsx("option",{value:S.uid,children:S.name},S.uid))})]}),$("url","Jira site",d,p,"https://kilnwork.atlassian.net"),$("project","Project key",l,m,"KAN","text","The prefix of the project's issues, like the KAN in KAN-12."),$("email","Account email",h,u,"you@kilnwork.studio","email"),$("token","API token",v,w,"","password"),$("secret","Webhook secret",x,y,"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: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(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:a.isPending,disabled:!d.trim()||!l.trim()||!h.trim()||!v.trim()||!o,children:a.isPending?"Checking…":"Connect"})]})]})})})}function ue({open:r,onOpenChange:c,sites:k,onDone:f}){const[g,j]=i.useState(""),[d,p]=i.useState(""),[l,m]=i.useState(""),[h,u]=i.useState(!0),[v,w]=i.useState(""),x=B({queryKey:["integrations","slack","manifest"],queryFn:()=>T.slackManifest(),enabled:r,staleTime:1/0}),y=P({mutationFn:t=>T.connectTracker(t,"slack",{channel:d.trim(),token:l.trim(),createOn:h?"thread.created":"manual"})}),b=g||k[0]?.uid||"",n=async t=>{t.preventDefault(),w("");try{await y.mutateAsync(b),p(""),m(""),u(!0),c(!1),f(b),A.success("Slack connected")}catch(s){w(s instanceof H?s.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:t=>void n(t),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"Connect a site to Slack"}),e.jsx(L,{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."})]}),v&&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:v}),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:b,onChange:t=>j(t.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:k.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(N,{type:"button",variant:"outline",size:"sm",disabled:!x.data,render:e.jsx("a",{href:x.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(F,{id:"sl-token",type:"password",placeholder:"xoxb-…",value:l,onChange:t=>m(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(F,{id:"sl-channel",placeholder:"#reviews",value:d,onChange:t=>p(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:h,onChange:t=>u(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(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:y.isPending,disabled:!d.trim()||!l.trim()||!b,children:y.isPending?"Checking…":"Connect"})]})]})})})}function xe({owner:r,instanceOwner:c,sites:k}){const f=z(),g=B(U.mcpTokens()),[j,d]=i.useState(!1),[p,l]=i.useState(null),[m,h]=i.useState(null),u=P({mutationFn:n=>T.revokeMcpToken(n),onSuccess:()=>{h(null),f.invalidateQueries({queryKey:["mcp-tokens"]})},onError:n=>A.error(K(n))}),v=g.data?.data??[],w=v.filter(n=>!n.revokedAt),x=g.data?.http??null,y=P({mutationFn:n=>T.setMcpHttp(n),onSuccess:(n,t)=>{f.setQueryData(U.instance().queryKey,n),f.invalidateQueries({queryKey:["mcp-tokens"]}),A.success(t?"Remote transport on — the token dialog shows its config":"Remote transport off — the endpoint answers 404 again")},onError:n=>A.error(K(n))}),b=n=>{const t=new Set(n),s=t.has("comments:write")||t.has("threads:write");return!s&&!t.has("context:read")?"Read-only":s?`Writes: ${[t.has("comments:write")?"reply":"",t.has("threads:write")?"mark ready":""].filter(Boolean).join(", ")}`:"Read-only, with capture context"};return e.jsxs(Y,{title:"MCP",description:"A coding agent — Claude Code, Cursor, any MCP client — reads the same brief this dashboard copies, maps a comment to the file in its checkout, and can reply or mark a fix ready. It never resolves: whoever reported a snag decides when it is fixed. A token per agent, shown once, revocable here.",children:[g.isPending&&e.jsx(Q,{rows:2}),x&&e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx(C,{htmlFor:"mcp-http-on",className:"text-[13px] font-medium",children:"Remote transport"}),e.jsxs("p",{className:"m-0 mt-0.5 text-[12px] leading-normal text-muted-foreground",children:[x.enabled?e.jsxs(e.Fragment,{children:["On. An agent anywhere talks to this studio at ",e.jsx("code",{className:"font-mono text-[11.5px]",children:x.url})," with a token as a bearer. No source mapping there; a write needs a token minted for it."]}):e.jsxs(e.Fragment,{children:["Off. Agents reach this studio only from a machine with the checkout. On, ",e.jsx("code",{className:"font-mono text-[11.5px]",children:x.url})," serves the same tools to an agent anywhere, with a token as a bearer."]}),x.source==="env"?" Set by the environment (SNAGSET_MCP_HTTP_ENABLED).":""]})]}),e.jsx(ae,{id:"mcp-http-on","aria-label":"Remote transport",checked:x.enabled,disabled:!c||x.source==="env"||y.isPending,onCheckedChange:n=>y.mutate(n)})]}),g.isSuccess&&w.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(G,{variant:"outline",children:"No tokens"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:"No agent can read this studio yet."})]}),v.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0","aria-label":"Agent tokens",children:v.map(n=>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] ${n.revokedAt?"opacity-60":""}`,children:[e.jsx("span",{className:"font-medium",children:n.name}),e.jsxs("code",{className:"font-mono text-[12.5px] text-muted-foreground",children:[n.prefix,"…"]}),e.jsx(G,{variant:"outline",className:n.revokedAt?"":"border-ok text-ok",children:n.revokedAt?"Revoked":b(n.scopes)}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[n.site?n.site.name:"All sites"," · ",n.lastUsedAt?`last used ${Z(n.lastUsedAt)}`:"never used",n.expiresAt&&!n.revokedAt?` · expires ${new Date(n.expiresAt).toLocaleDateString()}`:"",n.createdBy?` · by ${n.createdBy}`:""]}),n.canRevoke&&e.jsx("span",{className:"ml-auto flex gap-1",children:e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>h(n),children:"Revoke"})})]},n.id))}),r&&e.jsx("div",{children:e.jsx(N,{variant:"outline",size:"sm",onClick:()=>d(!0),children:"New token…"})}),e.jsx(pe,{open:j,onOpenChange:d,sites:k,http:g.data?.http??null,onDone:n=>{f.invalidateQueries({queryKey:["mcp-tokens"]}),l(n)}}),e.jsx(fe,{state:p,http:g.data?.http??null,onClose:()=>l(null)}),e.jsx(V,{open:m!==null,onOpenChange:n=>!n&&h(null),title:`Revoke “${m?.name??""}”?`,description:e.jsx(e.Fragment,{children:"The agent holding it loses access on its next request. Its past replies stay, under its name. This cannot be undone — mint a new token instead."}),confirmLabel:"Revoke",busy:u.isPending,onConfirm:async()=>{m&&await u.mutateAsync(m.id)}})]})}function pe({open:r,onOpenChange:c,sites:k,http:f,onDone:g}){const[j,d]=i.useState(""),[p,l]=i.useState(""),[m,h]=i.useState(["threads:read","source:map"]),[u,v]=i.useState(""),[w,x]=i.useState(!1),[y,b]=i.useState(""),n=P({mutationFn:()=>T.mintMcpToken({name:j.trim(),...p?{site:p}:{},scopes:m,...u?{expiresInDays:Number(u)}:{},...w?{allowRemoteWrites:!0}:{}})}),t=(a,o)=>h(I=>o?[...new Set([...I,a])]:I.filter($=>$!==a)),s=async a=>{a.preventDefault(),b("");try{const o=await n.mutateAsync();d(""),l(""),h(["threads:read","source:map"]),v(""),x(!1),c(!1),g(o)}catch(o){b(o instanceof H?o.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:a=>void s(a),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"New agent token"}),e.jsx(L,{children:"Read-only by default, plus mapping a comment to a file in the agent's own checkout. Tick more only for an agent you want writing here — and it still cannot resolve anything."})]}),y&&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:y}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-name",children:"Name"}),e.jsx(F,{id:"mcp-name",placeholder:"Claude Code",value:j,onChange:a=>d(a.target.value),autoComplete:"off",maxLength:80}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"What a client sees on the agent's replies, so name the agent, not the person."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-site",children:"Site"}),e.jsxs("select",{id:"mcp-site",value:p,onChange:a=>l(a.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:[e.jsx("option",{value:"",children:"All sites"}),k.map(a=>e.jsx("option",{value:a.uid,children:a.name},a.uid))]})]}),e.jsxs("fieldset",{className:"m-0 flex flex-col gap-2 border-0 p-0",children:[e.jsx("legend",{className:"mb-1 text-[13px] font-medium",children:"Scopes"}),oe.map(a=>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:m.includes(a.scope),onChange:o=>t(a.scope,o.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:a.label}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:a.hint})]})]},a.scope))]}),f?.enabled&&(m.includes("comments:write")||m.includes("threads:write"))&&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:w,onChange:a=>x(a.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"May write over the remote transport"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Over POST /mcp the agent is not on a machine you can see; a write there is a decision."})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-expires",children:"Expires"}),e.jsxs("select",{id:"mcp-expires",value:u,onChange:a=>v(a.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:[e.jsx("option",{value:"",children:"Never"}),e.jsx("option",{value:"30",children:"In 30 days"}),e.jsx("option",{value:"90",children:"In 90 days"}),e.jsx("option",{value:"365",children:"In a year"})]})]}),e.jsxs(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:n.isPending,disabled:!j.trim()||m.length===0,children:n.isPending?"Minting…":"Create token"})]})]})})})}function fe({state:r,http:c,onClose:k}){const f=typeof location<"u"?location.origin:"",g={SNAGSET_MCP_TOKEN:r?.secret??"",SNAGSET_MCP_HOST:f,...r?.token.site?{SNAGSET_MCP_PROJECT:r.token.site.uid}:{}},j=JSON.stringify({mcpServers:{snagset:{command:"npx",args:["-y","@snagset/mcp"],env:g}}},null,2),d=["claude mcp add snagset",...Object.entries(g).map(([h,u])=>`-e ${h}=${u}`),"--","npx -y @snagset/mcp"].join(" "),p=`Bearer ${r?.secret??""}`,l=["claude mcp add","--transport http","snagset",c?.url??"",`--header "Authorization: ${p}"`].join(" "),m=JSON.stringify({mcpServers:{snagset:{type:"http",url:c?.url??"",headers:{Authorization:p}}}},null,2);return e.jsx(E,{open:r!==null,onOpenChange:h=>!h&&k(),children:e.jsxs(O,{className:"sm:max-w-xl",children:[e.jsxs(R,{children:[e.jsxs(D,{children:["Token for “",r?.token.name??"","”"]}),e.jsx(L,{children:"Shown this once — only its hash is stored. Put it in the agent's config, then start the agent from the site's checkout so it can map comments to files."})]}),r&&e.jsxs("div",{className:"flex flex-col gap-4 text-[13px]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1.5 font-mono text-[12px]","data-testid":"mcp-token",children:r.secret}),e.jsx(W,{text:r.secret,label:"Copy the token"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Claude Code"}),e.jsx(W,{text:d,label:"Copy the Claude Code command"})]}),e.jsx("pre",{className:"m-0 whitespace-pre-wrap break-all rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:d})]}),c?.enabled&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Remote — an agent that is not on a machine with the checkout"}),e.jsx(W,{text:m,label:"Copy the remote config"})]}),e.jsx("pre",{className:"m-0 whitespace-pre-wrap break-all rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:l}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:m}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"No source mapping there — nothing to search. Writes need the token minted with remote writes allowed."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Cursor, Claude Desktop, any MCP client"}),e.jsx(W,{text:j,label:"Copy the JSON config"})]}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:j}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Cursor reads it from .cursor/mcp.json in the project; Claude Desktop from its claude_desktop_config.json."})]})]}),e.jsx(M,{children:e.jsx(N,{type:"button",onClick:k,children:"Done"})})]})})}export{Re as component};
|
|
1
|
+
import{t as z,r as i,Z as P,_ as A,Y as K,p as T,$ as J,j as e,V as Q,B as N,y as U,a0 as oe,A as H}from"./index-NqrbvfSo.js";import{u as B}from"./useQuery-Ce8K2e88.js";import{B as G}from"./badge-DZ45gt2t.js";import{E,G as O,I as R,H as D,J as L,K as M}from"./dialog-cAVg5CWG.js";import{L as C,I as F}from"./label-CZtxPKnA.js";import{S as ae}from"./switch-pKWkWBSh.js";import{C as V}from"./ConfirmDialog-B_HO7qAV.js";import{P as re,a as Y}from"./parts-CMVHppEZ.js";import{C as W}from"./CopyButton-BcFPdquT.js";import{b as Z}from"./labels--UUyt9uB.js";import{u as ie}from"./me-DuZzYTr0.js";import"./useBaseQuery-BQZrcHmw.js";import"./useRender-CLH8yHqZ.js";import"./useAriaLabelledBy-BSt0Y1vn.js";import"./useValueChanged-DKD8Vs7J.js";import"./card-rZNT8AAn.js";import"./check-DFzW0E5F.js";import"./copy-CkgrfFiF.js";const ce={ok:{label:"Healthy",tone:"ok"},needs_reauth:{label:"Needs a new token",tone:"bad"},error:{label:"Failing",tone:"bad"}};function Re(){const r=ie(),c=r.user.role==="owner"||r.user.role==="admin",k=r.user.role==="owner",f=B(U.integrations()),g=z(),j=()=>g.invalidateQueries({queryKey:["integrations"]}),[d,p]=i.useState(null),[l,m]=i.useState(null),[h,u]=i.useState(null),v=P({mutationFn:t=>T.regenerateGitHubWebhook(t),onSuccess:({webhook:t},s)=>u({site:s,provider:"github",hook:t,fresh:!1}),onError:t=>A.error(K(t))}),w=P({mutationFn:({uid:t,provider:s})=>T.testTracker(t,s).then(a=>({...a,provider:s})),onSuccess:t=>{A[t.ok?"success":"error"](t.ok?`${J[t.provider]} can see ${t.target}`:t.detail??`${J[t.provider]} refused the token`),j()},onError:t=>A.error(K(t))}),x=P({mutationFn:({uid:t,provider:s})=>T.disconnectTracker(t,s),onSuccess:()=>{m(null),j()},onError:t=>A.error(K(t))}),y=f.data?.data??[],b=t=>y.filter(s=>s.provider===t),n=t=>r.projects.filter(s=>!b(t).some(a=>a.site===s.uid));return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(re,{title:"Integrations",sub:"Mirrors converge on the comment's status here; Slack only announces"}),["github","linear","jira","slack"].map(t=>{const s=b(t),a=n(t);return e.jsxs(Y,{title:J[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(Q,{rows:2}),f.isSuccess&&s.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(G,{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(o=>{const I=ce[o.health]??{label:o.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:o.siteName??o.site}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("code",{className:"font-mono text-[12.5px]",children:o.provider==="github"?`${o.owner}/${o.repo}`:o.provider==="linear"?`${o.teamKey} · ${o.teamName}`:o.provider==="jira"?`${o.projectKey} · ${o.projectName}`:`#${o.channelName} · ${o.teamName}`}),e.jsx(G,{variant:"outline",className:I.tone==="ok"?"border-ok text-ok":I.tone==="bad"?"border-destructive text-destructive":"",children:I.label}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[o.provider==="slack"?o.createOn==="thread.created"?"A message for every new comment":"Messages when you ask, from the brief":o.createOn==="thread.created"?"An issue for every new comment":"Issues when you ask, from the brief",o.provider==="github"&&o.labels.length?` · labels ${o.labels.join(", ")}`:"",o.provider!=="github"&&o.provider!=="slack"&&!o.hasWebhookSecret?` · no webhook secret yet, so ${J[o.provider]} cannot move comments here`:""," · ",Z(o.updatedAt)]}),o.lastError&&e.jsx("span",{className:"basis-full text-[12px] text-destructive",children:o.lastError}),c&&e.jsxs("span",{className:"ml-auto flex gap-1",children:[o.provider==="github"?e.jsx(N,{variant:"ghost",size:"sm",loading:v.isPending,onClick:()=>v.mutate(o.site),children:"Webhook…"}):o.provider==="slack"?null:e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>u({site:o.site,provider:o.provider,hook:{url:`${location.origin}/api/v1/integrations/${o.provider}/inbound`},fresh:!1}),children:"Webhook…"}),e.jsx(N,{variant:"ghost",size:"sm",loading:w.isPending,onClick:()=>w.mutate({uid:o.site,provider:o.provider}),children:"Test"}),e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>m(o),children:"Disconnect"})]})]},`${o.provider}:${o.site}`)})}),c&&a.length>0&&e.jsx("div",{children:e.jsx(N,{variant:"outline",size:"sm",onClick:()=>p(t),children:"Connect a site…"})})]},t)}),e.jsx(xe,{owner:c,instanceOwner:k,sites:r.projects}),e.jsx(le,{open:d==="github",onOpenChange:t=>!t&&p(null),sites:n("github"),onDone:(t,s)=>{j(),s&&u({site:t,provider:"github",hook:s,fresh:!0})}}),e.jsx(me,{open:d==="linear",onOpenChange:t=>!t&&p(null),sites:n("linear"),onDone:(t,s)=>{j(),u({site:t,provider:"linear",hook:s,fresh:!0})}}),e.jsx(he,{open:d==="jira",onOpenChange:t=>!t&&p(null),sites:n("jira"),onDone:(t,s)=>{j(),u({site:t,provider:"jira",hook:s,fresh:!0})}}),e.jsx(ue,{open:d==="slack",onOpenChange:t=>!t&&p(null),sites:n("slack"),onDone:()=>void j()}),e.jsx(de,{state:h,onClose:()=>u(null),siteName:t=>y.find(s=>s.site===t)?.siteName??"the site"}),e.jsx(V,{open:l!==null,onOpenChange:t=>!t&&m(null),title:`Disconnect ${l?.siteName??"this site"} from ${l?J[l.provider]:"the tracker"}?`,description:l?.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:x.isPending,onConfirm:async()=>{l&&await x.mutateAsync({uid:l.site,provider:l.provider})}})]})}function le({open:r,onOpenChange:c,sites:k,onDone:f}){const[g,j]=i.useState(""),[d,p]=i.useState(""),[l,m]=i.useState(""),[h,u]=i.useState(""),[v,w]=i.useState(!1),[x,y]=i.useState(""),b=P({mutationFn:s=>T.connectTracker(s,"github",{repository:d.trim(),token:l.trim(),labels:h,createOn:v?"thread.created":"manual"})}),n=g||k[0]?.uid||"",t=async s=>{s.preventDefault(),y("");try{const a=await b.mutateAsync(n);p(""),m(""),u(""),w(!1),c(!1),f(n,a.webhook&&"secret"in a.webhook?a.webhook:void 0),A.success("GitHub connected")}catch(a){y(a instanceof H?a.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"Connect a site to GitHub"}),e.jsxs(L,{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."]})]}),x&&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:x}),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:n,onChange:s=>j(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:k.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(F,{id:"gh-repo",placeholder:"kilnwork/site",value:d,onChange:s=>p(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(F,{id:"gh-token",type:"password",placeholder:"github_pat_…",value:l,onChange:s=>m(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(F,{id:"gh-labels",placeholder:"review, bug",value:h,onChange:s=>u(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:v,onChange:s=>w(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(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:b.isPending,disabled:!d.trim()||!l.trim()||!n,children:b.isPending?"Checking…":"Connect"})]})]})})})}function de({state:r,onClose:c,siteName:k}){const f=r&&"secret"in r.hook?r.hook.secret:null;return e.jsx(E,{open:r!==null,onOpenChange:g=>!g&&c(),children:e.jsxs(O,{children:[e.jsxs(R,{children:[e.jsx(D,{children:r?.fresh?"Connected — now the webhook":"Webhook for "+(r?k(r.site):"")}),e.jsx(L,{children:r?.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.":r?.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${r?.fresh?"":", and the previous one has stopped working"}.`})]}),r&&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:r.hook.url}),e.jsx(W,{text:r.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(W,{text:f,label:"Copy the secret"})]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Events"}),e.jsx("dd",{className:"m-0",children:r.provider==="linear"?"Issues":r.provider==="jira"?"Issue: updated, deleted":"Let me select individual events → Issues"})]}),e.jsx(M,{children:e.jsx(N,{type:"button",onClick:c,children:"Done"})})]})})}function me({open:r,onOpenChange:c,sites:k,onDone:f}){const[g,j]=i.useState(""),[d,p]=i.useState(""),[l,m]=i.useState(""),[h,u]=i.useState(""),[v,w]=i.useState(!1),[x,y]=i.useState(""),b=P({mutationFn:s=>T.connectTracker(s,"linear",{team:d.trim(),apiKey:l.trim(),...h.trim()?{webhookSecret:h.trim()}:{},createOn:v?"thread.created":"manual"})}),n=g||k[0]?.uid||"",t=async s=>{s.preventDefault(),y("");try{const a=await b.mutateAsync(n);p(""),m(""),u(""),w(!1),c(!1),f(n,a.webhook??{url:`${location.origin}/api/v1/integrations/linear/inbound`}),A.success("Linear connected")}catch(a){y(a instanceof H?a.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"Connect a site to Linear"}),e.jsx(L,{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."})]}),x&&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:x}),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:n,onChange:s=>j(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:k.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(F,{id:"ln-team",placeholder:"ENG",value:d,onChange:s=>p(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(F,{id:"ln-key",type:"password",placeholder:"lin_api_…",value:l,onChange:s=>m(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(F,{id:"ln-secret",type:"password",placeholder:"from Linear's webhook, optional",value:h,onChange:s=>u(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:v,onChange:s=>w(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(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:b.isPending,disabled:!d.trim()||!l.trim()||!n,children:b.isPending?"Checking…":"Connect"})]})]})})})}function he({open:r,onOpenChange:c,sites:k,onDone:f}){const[g,j]=i.useState(""),[d,p]=i.useState(""),[l,m]=i.useState(""),[h,u]=i.useState(""),[v,w]=i.useState(""),[x,y]=i.useState(""),[b,n]=i.useState(!1),[t,s]=i.useState(""),a=P({mutationFn:S=>T.connectTracker(S,"jira",{siteUrl:d.trim(),project:l.trim(),email:h.trim(),apiToken:v.trim(),...x.trim()?{webhookSecret:x.trim()}:{},createOn:b?"thread.created":"manual"})}),o=g||k[0]?.uid||"",I=async S=>{S.preventDefault(),s("");try{const _=await a.mutateAsync(o);m(""),w(""),y(""),n(!1),c(!1),f(o,_.webhook??{url:`${location.origin}/api/v1/integrations/jira/inbound`}),A.success("Jira connected")}catch(_){s(_ instanceof H?_.message:"Could not reach the server.")}},$=(S,_,X,ee,te,se="text",q)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:`jr-${S}`,children:_}),e.jsx(F,{id:`jr-${S}`,type:se,placeholder:te,value:X,onChange:ne=>ee(ne.target.value),autoComplete:"off"}),q&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:q})]});return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:S=>void I(S),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"Connect a site to Jira"}),e.jsx(L,{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:o,onChange:S=>j(S.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:k.map(S=>e.jsx("option",{value:S.uid,children:S.name},S.uid))})]}),$("url","Jira site",d,p,"https://kilnwork.atlassian.net"),$("project","Project key",l,m,"KAN","text","The prefix of the project's issues, like the KAN in KAN-12."),$("email","Account email",h,u,"you@kilnwork.studio","email"),$("token","API token",v,w,"","password"),$("secret","Webhook secret",x,y,"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: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(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:a.isPending,disabled:!d.trim()||!l.trim()||!h.trim()||!v.trim()||!o,children:a.isPending?"Checking…":"Connect"})]})]})})})}function ue({open:r,onOpenChange:c,sites:k,onDone:f}){const[g,j]=i.useState(""),[d,p]=i.useState(""),[l,m]=i.useState(""),[h,u]=i.useState(!0),[v,w]=i.useState(""),x=B({queryKey:["integrations","slack","manifest"],queryFn:()=>T.slackManifest(),enabled:r,staleTime:1/0}),y=P({mutationFn:t=>T.connectTracker(t,"slack",{channel:d.trim(),token:l.trim(),createOn:h?"thread.created":"manual"})}),b=g||k[0]?.uid||"",n=async t=>{t.preventDefault(),w("");try{await y.mutateAsync(b),p(""),m(""),u(!0),c(!1),f(b),A.success("Slack connected")}catch(s){w(s instanceof H?s.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:t=>void n(t),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"Connect a site to Slack"}),e.jsx(L,{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."})]}),v&&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:v}),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:b,onChange:t=>j(t.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:k.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(N,{type:"button",variant:"outline",size:"sm",disabled:!x.data,render:e.jsx("a",{href:x.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(F,{id:"sl-token",type:"password",placeholder:"xoxb-…",value:l,onChange:t=>m(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(F,{id:"sl-channel",placeholder:"#reviews",value:d,onChange:t=>p(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:h,onChange:t=>u(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(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:y.isPending,disabled:!d.trim()||!l.trim()||!b,children:y.isPending?"Checking…":"Connect"})]})]})})})}function xe({owner:r,instanceOwner:c,sites:k}){const f=z(),g=B(U.mcpTokens()),[j,d]=i.useState(!1),[p,l]=i.useState(null),[m,h]=i.useState(null),u=P({mutationFn:n=>T.revokeMcpToken(n),onSuccess:()=>{h(null),f.invalidateQueries({queryKey:["mcp-tokens"]})},onError:n=>A.error(K(n))}),v=g.data?.data??[],w=v.filter(n=>!n.revokedAt),x=g.data?.http??null,y=P({mutationFn:n=>T.setMcpHttp(n),onSuccess:(n,t)=>{f.setQueryData(U.instance().queryKey,n),f.invalidateQueries({queryKey:["mcp-tokens"]}),A.success(t?"Remote transport on — the token dialog shows its config":"Remote transport off — the endpoint answers 404 again")},onError:n=>A.error(K(n))}),b=n=>{const t=new Set(n),s=t.has("comments:write")||t.has("threads:write");return!s&&!t.has("context:read")?"Read-only":s?`Writes: ${[t.has("comments:write")?"reply":"",t.has("threads:write")?"mark ready":""].filter(Boolean).join(", ")}`:"Read-only, with capture context"};return e.jsxs(Y,{title:"MCP",description:"A coding agent — Claude Code, Cursor, any MCP client — reads the same brief this dashboard copies, maps a comment to the file in its checkout, and can reply or mark a fix ready. It never resolves: whoever reported a snag decides when it is fixed. A token per agent, shown once, revocable here.",children:[g.isPending&&e.jsx(Q,{rows:2}),x&&e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx(C,{htmlFor:"mcp-http-on",className:"text-[13px] font-medium",children:"Remote transport"}),e.jsxs("p",{className:"m-0 mt-0.5 text-[12px] leading-normal text-muted-foreground",children:[x.enabled?e.jsxs(e.Fragment,{children:["On. An agent anywhere talks to this studio at ",e.jsx("code",{className:"font-mono text-[11.5px]",children:x.url})," with a token as a bearer. No source mapping there; a write needs a token minted for it."]}):e.jsxs(e.Fragment,{children:["Off. Agents reach this studio only from a machine with the checkout. On, ",e.jsx("code",{className:"font-mono text-[11.5px]",children:x.url})," serves the same tools to an agent anywhere, with a token as a bearer."]}),x.source==="env"?" Set by the environment (SNAGSET_MCP_HTTP_ENABLED).":""]})]}),e.jsx(ae,{id:"mcp-http-on","aria-label":"Remote transport",checked:x.enabled,disabled:!c||x.source==="env"||y.isPending,onCheckedChange:n=>y.mutate(n)})]}),g.isSuccess&&w.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(G,{variant:"outline",children:"No tokens"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:"No agent can read this studio yet."})]}),v.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0","aria-label":"Agent tokens",children:v.map(n=>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] ${n.revokedAt?"opacity-60":""}`,children:[e.jsx("span",{className:"font-medium",children:n.name}),e.jsxs("code",{className:"font-mono text-[12.5px] text-muted-foreground",children:[n.prefix,"…"]}),e.jsx(G,{variant:"outline",className:n.revokedAt?"":"border-ok text-ok",children:n.revokedAt?"Revoked":b(n.scopes)}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[n.site?n.site.name:"All sites"," · ",n.lastUsedAt?`last used ${Z(n.lastUsedAt)}`:"never used",n.expiresAt&&!n.revokedAt?` · expires ${new Date(n.expiresAt).toLocaleDateString()}`:"",n.createdBy?` · by ${n.createdBy}`:""]}),n.canRevoke&&e.jsx("span",{className:"ml-auto flex gap-1",children:e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>h(n),children:"Revoke"})})]},n.id))}),r&&e.jsx("div",{children:e.jsx(N,{variant:"outline",size:"sm",onClick:()=>d(!0),children:"New token…"})}),e.jsx(pe,{open:j,onOpenChange:d,sites:k,http:g.data?.http??null,onDone:n=>{f.invalidateQueries({queryKey:["mcp-tokens"]}),l(n)}}),e.jsx(fe,{state:p,http:g.data?.http??null,onClose:()=>l(null)}),e.jsx(V,{open:m!==null,onOpenChange:n=>!n&&h(null),title:`Revoke “${m?.name??""}”?`,description:e.jsx(e.Fragment,{children:"The agent holding it loses access on its next request. Its past replies stay, under its name. This cannot be undone — mint a new token instead."}),confirmLabel:"Revoke",busy:u.isPending,onConfirm:async()=>{m&&await u.mutateAsync(m.id)}})]})}function pe({open:r,onOpenChange:c,sites:k,http:f,onDone:g}){const[j,d]=i.useState(""),[p,l]=i.useState(""),[m,h]=i.useState(["threads:read","source:map"]),[u,v]=i.useState(""),[w,x]=i.useState(!1),[y,b]=i.useState(""),n=P({mutationFn:()=>T.mintMcpToken({name:j.trim(),...p?{site:p}:{},scopes:m,...u?{expiresInDays:Number(u)}:{},...w?{allowRemoteWrites:!0}:{}})}),t=(a,o)=>h(I=>o?[...new Set([...I,a])]:I.filter($=>$!==a)),s=async a=>{a.preventDefault(),b("");try{const o=await n.mutateAsync();d(""),l(""),h(["threads:read","source:map"]),v(""),x(!1),c(!1),g(o)}catch(o){b(o instanceof H?o.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:a=>void s(a),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"New agent token"}),e.jsx(L,{children:"Read-only by default, plus mapping a comment to a file in the agent's own checkout. Tick more only for an agent you want writing here — and it still cannot resolve anything."})]}),y&&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:y}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-name",children:"Name"}),e.jsx(F,{id:"mcp-name",placeholder:"Claude Code",value:j,onChange:a=>d(a.target.value),autoComplete:"off",maxLength:80}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"What a client sees on the agent's replies, so name the agent, not the person."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-site",children:"Site"}),e.jsxs("select",{id:"mcp-site",value:p,onChange:a=>l(a.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:[e.jsx("option",{value:"",children:"All sites"}),k.map(a=>e.jsx("option",{value:a.uid,children:a.name},a.uid))]})]}),e.jsxs("fieldset",{className:"m-0 flex flex-col gap-2 border-0 p-0",children:[e.jsx("legend",{className:"mb-1 text-[13px] font-medium",children:"Scopes"}),oe.map(a=>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:m.includes(a.scope),onChange:o=>t(a.scope,o.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:a.label}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:a.hint})]})]},a.scope))]}),f?.enabled&&(m.includes("comments:write")||m.includes("threads:write"))&&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:w,onChange:a=>x(a.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"May write over the remote transport"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Over POST /mcp the agent is not on a machine you can see; a write there is a decision."})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-expires",children:"Expires"}),e.jsxs("select",{id:"mcp-expires",value:u,onChange:a=>v(a.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:[e.jsx("option",{value:"",children:"Never"}),e.jsx("option",{value:"30",children:"In 30 days"}),e.jsx("option",{value:"90",children:"In 90 days"}),e.jsx("option",{value:"365",children:"In a year"})]})]}),e.jsxs(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:n.isPending,disabled:!j.trim()||m.length===0,children:n.isPending?"Minting…":"Create token"})]})]})})})}function fe({state:r,http:c,onClose:k}){const f=typeof location<"u"?location.origin:"",g={SNAGSET_MCP_TOKEN:r?.secret??"",SNAGSET_MCP_HOST:f,...r?.token.site?{SNAGSET_MCP_PROJECT:r.token.site.uid}:{}},j=JSON.stringify({mcpServers:{snagset:{command:"npx",args:["-y","@snagset/mcp"],env:g}}},null,2),d=["claude mcp add snagset",...Object.entries(g).map(([h,u])=>`-e ${h}=${u}`),"--","npx -y @snagset/mcp"].join(" "),p=`Bearer ${r?.secret??""}`,l=["claude mcp add","--transport http","snagset",c?.url??"",`--header "Authorization: ${p}"`].join(" "),m=JSON.stringify({mcpServers:{snagset:{type:"http",url:c?.url??"",headers:{Authorization:p}}}},null,2);return e.jsx(E,{open:r!==null,onOpenChange:h=>!h&&k(),children:e.jsxs(O,{className:"sm:max-w-xl",children:[e.jsxs(R,{children:[e.jsxs(D,{children:["Token for “",r?.token.name??"","”"]}),e.jsx(L,{children:"Shown this once — only its hash is stored. Put it in the agent's config, then start the agent from the site's checkout so it can map comments to files."})]}),r&&e.jsxs("div",{className:"flex flex-col gap-4 text-[13px]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1.5 font-mono text-[12px]","data-testid":"mcp-token",children:r.secret}),e.jsx(W,{text:r.secret,label:"Copy the token"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Claude Code"}),e.jsx(W,{text:d,label:"Copy the Claude Code command"})]}),e.jsx("pre",{className:"m-0 whitespace-pre-wrap break-all rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:d})]}),c?.enabled&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Remote — an agent that is not on a machine with the checkout"}),e.jsx(W,{text:m,label:"Copy the remote config"})]}),e.jsx("pre",{className:"m-0 whitespace-pre-wrap break-all rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:l}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:m}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"No source mapping there — nothing to search. Writes need the token minted with remote writes allowed."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Cursor, Claude Desktop, any MCP client"}),e.jsx(W,{text:j,label:"Copy the JSON config"})]}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:j}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Cursor reads it from .cursor/mcp.json in the project; Claude Desktop from its claude_desktop_config.json."})]})]}),e.jsx(M,{children:e.jsx(N,{type:"button",onClick:k,children:"Done"})})]})})}export{Re as component};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as L,j as e,f as q,r as p,B as x,Y as y,C as G,F as _,a1 as V,a2 as Y,a3 as J,H as K,y as w}from"./index-
|
|
1
|
+
import{c as L,j as e,f as q,r as p,B as x,Y as y,C as G,F as _,a1 as V,a2 as Y,a3 as J,H as K,y as w}from"./index-NqrbvfSo.js";import{u as N}from"./useQuery-Ce8K2e88.js";import{u as Q,a as W}from"./zod-B-woswyx.js";import{A as X,a as U}from"./avatar-CyWjapbD.js";import{B as Z}from"./badge-DZ45gt2t.js";import{C as A}from"./card-rZNT8AAn.js";import{X as ee,E as se,G as ie,I as k,H as C,J as S,K as I}from"./dialog-cAVg5CWG.js";import{L as R,I as te}from"./label-CZtxPKnA.js";import{T as D,a as P,b as j,c as o,d as T,e as d}from"./table-BSlgpUtG.js";import{C as ne}from"./ConfirmDialog-B_HO7qAV.js";import{C as ae}from"./CopyButton-BcFPdquT.js";import{P as re,b as le}from"./parts-CMVHppEZ.js";import{a as oe}from"./labels--UUyt9uB.js";import{u as de}from"./me-DuZzYTr0.js";import{c as ce,d as me,e as xe,f as he,g as ue}from"./studio-oojSa61E.js";import{P as pe}from"./plus-DvNJzVbr.js";import"./useBaseQuery-BQZrcHmw.js";import"./useRender-CLH8yHqZ.js";import"./check-DFzW0E5F.js";import"./copy-CkgrfFiF.js";/**
|
|
2
2
|
* @license lucide-react v1.39.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,h as ae,a7 as re,d as se,a5 as ie,E as ne,i as M,j as f,a8 as oe,f as de}from"./index-
|
|
1
|
+
import{r as i,h as ae,a7 as re,d as se,a5 as ie,E as ne,i as M,j as f,a8 as oe,f as de}from"./index-NqrbvfSo.js";import{f as ce,e as le,h as ue,j as fe,u as pe,A as he,k as be,l as ge,c as me,n as ve}from"./label-CZtxPKnA.js";import{L as ke,M as xe}from"./dialog-cAVg5CWG.js";import{u as we}from"./useAriaLabelledBy-BSt0Y1vn.js";import{u as ye}from"./useValueChanged-DKD8Vs7J.js";const j=i.createContext(void 0);function Ce(){const r=i.useContext(j);if(r===void 0)throw new Error(ae(63));return r}const D={...ce,checked(r){return r?{"data-checked":""}:{"data-unchecked":""}}},Re=i.forwardRef(function(s,o){const{checked:k,className:F,defaultChecked:x,"aria-labelledby":m,form:p,id:L,inputRef:T,name:w,nativeButton:h=!1,onCheckedChange:V,readOnly:d=!1,required:b=!1,disabled:N=!1,render:ze,uncheckedValue:y,value:C,style:Ee,...A}=s,{clearErrors:H}=le(),{state:R,setTouched:q,setDirty:O,validityData:W,setFilled:v,setFocused:P,validationMode:J,disabled:U,name:Y,validation:c}=ue(),{labelId:_}=fe(),t=U||N,l=Y??w,n=i.useRef(null),G=re(n,T,c.inputRef),g=i.useRef(null),z=pe(),E=he({id:L,implicit:!1,controlRef:g}),B=h?void 0:E,[a,K]=be({controlled:k,default:!!x,name:"Switch",state:"checked"});ge(g,z,a,void 0,!t,w),se(()=>{n.current&&v(n.current.checked)},[v]),ye(a,()=>{H(l),O(a!==W.initialValue),v(a),c.change(a)});const{getButtonProps:Q,buttonRef:X}=ie({disabled:t,native:h}),Z=we(m,_,n,!h,B),$={id:h?E:z,role:"switch","aria-checked":a,"aria-readonly":d||void 0,"aria-required":b||void 0,"aria-labelledby":Z,onFocus(){t||P(!0)},onBlur(){const e=n.current;!e||t||(q(!0),P(!1),J==="onBlur"&&c.commit(e.checked))},onClick(e){if(d||t)return;e.preventDefault();const u=n.current;u&&oe(u,e)}},ee={...c.getValidationProps(t),checked:a,disabled:t,form:p,id:B,name:l,required:b,style:l?ke:xe,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:G,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(d){e.preventDefault();return}const u=e.currentTarget.checked,S=me(ve,e.nativeEvent);V?.(u,S),!S.isCanceled&&K(u)},onClick(e){e.stopPropagation()},onFocus(){g.current?.focus()},...C!==void 0?{value:C}:ne},I=i.useMemo(()=>({...R,checked:a,disabled:t,readOnly:d,required:b}),[R,a,t,d,b]),te=M("span",s,{state:I,ref:[o,g,X],props:[$,A,Q,e=>c.getValidationProps(t,e)],stateAttributesMapping:D});return f.jsxs(j.Provider,{value:I,children:[te,!a&&l&&y!==void 0&&f.jsx("input",{type:"hidden",form:p,name:l,value:y,disabled:t}),f.jsx("input",{...ee,suppressHydrationWarning:!0})]})}),Pe=i.forwardRef(function(s,o){const{render:k,className:F,style:x,...m}=s,p=Ce();return M("span",s,{state:p,ref:o,stateAttributesMapping:D,props:m})});function De({className:r,size:s="default",...o}){return f.jsx(Re,{"data-slot":"switch","data-size":s,className:de("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",r),...o,children:f.jsx(Pe,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}export{De as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,f as l}from"./index-
|
|
1
|
+
import{j as t,f as l}from"./index-NqrbvfSo.js";function o({className:a,...e}){return t.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:t.jsx("table",{"data-slot":"table",className:l("w-full caption-bottom text-sm",a),...e})})}function r({className:a,...e}){return t.jsx("thead",{"data-slot":"table-header",className:l("[&_tr]:border-b",a),...e})}function d({className:a,...e}){return t.jsx("tbody",{"data-slot":"table-body",className:l("[&_tr:last-child]:border-0",a),...e})}function n({className:a,...e}){return t.jsx("tr",{"data-slot":"table-row",className:l("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",a),...e})}function b({className:a,...e}){return t.jsx("th",{"data-slot":"table-head",className:l("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",a),...e})}function c({className:a,...e}){return t.jsx("td",{"data-slot":"table-cell",className:l("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",a),...e})}export{o as T,r as a,n as b,b as c,d,c as e};
|
package/static/dashboard/assets/{useAriaLabelledBy-B3Uz7OxG.js → useAriaLabelledBy-BSt0Y1vn.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as u,d as l}from"./index-
|
|
1
|
+
import{r as u,d as l}from"./index-NqrbvfSo.js";import{u as c}from"./label-CZtxPKnA.js";function y(e,n,t,r=!0,i){const[a,d]=u.useState(),f=c(i?`${i}-label`:void 0),o=e??n??a;return l(()=>{const s=e||n||!r?void 0:L(t.current,f);a!==s&&d(s)}),o}function L(e,n){const t=b(e);if(t)return!t.id&&n&&(t.id=n),t.id||void 0}function b(e){if(!e)return;const n=e.parentElement;if(n&&n.tagName==="LABEL")return n;const t=e.id;if(t){const i=e.nextElementSibling;if(i&&i.htmlFor===t)return i}const r=e.labels;return r&&r[0]}export{y as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a_ as N,a$ as h,b0 as O,b1 as U,b2 as k,b3 as B,b4 as A,b5 as y,b6 as H,b7 as V,b8 as M,b9 as _,r as p,ba as x,t as W}from"./index-
|
|
1
|
+
import{a_ as N,a$ as h,b0 as O,b1 as U,b2 as k,b3 as B,b4 as A,b5 as y,b6 as H,b7 as V,b8 as M,b9 as _,r as p,ba as x,t as W}from"./index-NqrbvfSo.js";var st=class extends N{#e;#t=void 0;#f=void 0;#s=void 0;#n;#c;#i;#p;#u;#l;#a;#o;#r;#d=new Set;constructor(t,e){super(),this.options=e,this.#e=t,this.#i=null,this.bindMethods(),this.setOptions(e)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Q(this.#t,this.options)?this.#h():this.updateResult(),this.#S())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return E(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return E(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#m(),this.#g(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,s=this.#t;if(this.options=this.#e.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof h(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#O(),this.#t.setOptions(this.options),e._defaulted&&!O(this.options,e)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const i=this.hasListeners();i&&P(this.#t,s,this.options,e)&&this.#h(),this.updateResult(),i&&(this.#t!==s||h(this.options.enabled,this.#t)!==h(e.enabled,this.#t)||h(this.options.staleTime,this.#t)!==h(e.staleTime,this.#t))&&this.#R();const r=this.#v();i&&(this.#t!==s||h(this.options.enabled,this.#t)!==h(e.enabled,this.#t)||r!==this.#r)&&this.#y(r)}getOptimisticResult(t){const e=this.#e.getQueryCache().build(this.#e,t),s=this.createResult(e,t);return O(this.getCurrentResult(),s)||(this.#s=s,this.#c=this.options,this.#n=this.#t.state),s}getCurrentResult(){return this.#s}trackResult(t,e){return new Proxy(t,{get:(s,i)=>(this.trackProp(i),e?.(i),Reflect.get(s,i))})}trackProp(t){this.#d.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#e.defaultQueryOptions(t),s=this.#e.getQueryCache().build(this.#e,e);let i=()=>{},r;const c=new Promise(a=>{r=a,i=this.#e.getQueryCache().subscribe(u=>{u.type==="updated"&&u.query.queryHash===s.queryHash&&s.state.data!==void 0&&(i(),a(this.createResult(s,e)))})});return Promise.race([s.fetch().then(()=>{const a=this.createResult(s,e);return r?.(a),a}).finally(()=>{i()}),c])}fetch(t){return this.#h({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#s))}#h(t){this.#O();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(U)),e}#b(t){return!k()&&h(this.options.enabled,this.#t)!==!1&&B(t)}#R(){this.#m();const t=h(this.options.staleTime,this.#t);if(this.#s.isStale||!this.#b(t))return;const e=A(this.#s.dataUpdatedAt,t)+1;this.#a=y.setTimeout(()=>{this.#s.isStale||this.updateResult()},e)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(t){this.#g(),this.#r=t,!(this.#r===0||!this.#b(this.#r))&&(this.#o=y.setInterval(()=>{(this.options.refetchIntervalInBackground||H.isFocused())&&this.#h()},this.#r))}#S(){this.#R(),this.#y(this.#v())}#m(){this.#a!==void 0&&(y.clearTimeout(this.#a),this.#a=void 0)}#g(){this.#o!==void 0&&(y.clearInterval(this.#o),this.#o=void 0)}createResult(t,e){const s=this.#t,i=this.options,r=this.#s,c=this.#n,a=this.#c,u=t!==s?t.state:this.#f,{state:l}=t;let n={...l},d=!1,o;if(e._optimisticResults){const f=this.hasListeners(),D=!f&&Q(t,e),L=f&&P(t,s,e,i);(D||L)&&(n={...n,...V(l.data,t.options)}),e._optimisticResults==="isRestoring"&&(n.fetchStatus="idle")}let{error:R,errorUpdatedAt:v,status:b}=n;o=n.data;let I=!1;if(e.placeholderData!==void 0&&o===void 0&&b==="pending"){let f;r?.isPlaceholderData&&e.placeholderData===a?.placeholderData?(f=r.data,I=!0):f=typeof e.placeholderData=="function"?e.placeholderData(this.#l?.state.data,this.#l):e.placeholderData,f!==void 0&&(b="success",o=M(r?.data,f,e),d=!0)}if(e.select&&o!==void 0&&!I)if(r&&o===c?.data&&e.select===this.#p)o=this.#u;else try{this.#p=e.select,o=e.select(o),o=M(r?.data,o,e),this.#u=o,this.#i=null}catch(f){this.#i=f}else o===void 0&&(this.#i=null);this.#i&&(R=this.#i,o=this.#u,v=Date.now(),b="error",d=!1);const S=n.fetchStatus==="fetching",m=b==="pending",g=b==="error",T=m&&S,w=o!==void 0;return{status:b,fetchStatus:n.fetchStatus,isPending:m,isSuccess:b==="success",isError:g,isInitialLoading:T,isLoading:T,data:o,dataUpdatedAt:n.dataUpdatedAt,error:R,errorUpdatedAt:v,failureCount:n.fetchFailureCount,failureReason:n.fetchFailureReason,errorUpdateCount:n.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:n.dataUpdateCount>u.dataUpdateCount||n.errorUpdateCount>u.errorUpdateCount,isFetching:S,isRefetching:S&&!m,isLoadingError:g&&!w,isPaused:n.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:g&&w,isStale:C(t,e),refetch:this.refetch,isEnabled:h(e.enabled,t)!==!1}}updateResult(){const t=this.#s,e=this.createResult(this.#t,this.options);if(this.#n=this.#t.state,this.#c=this.options,this.#n.data!==void 0&&(this.#l=this.#t),O(e,t))return;this.#s=e;const i=(()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,c=typeof r=="function"?r():r;if(c==="all"||!c&&!this.#d.size)return!0;const a=new Set(c??this.#d);return this.options.throwOnError&&a.add("error"),Object.keys(this.#s).some(u=>{const l=u;return this.#s[l]!==t[l]&&a.has(l)})})();_.batch(()=>{i&&this.listeners.forEach(r=>{r(this.#s)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}#O(){const t=this.#e.getQueryCache().build(this.#e,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#f=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#S()}};function j(t,e){return h(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&h(e.retryOnMount,t)===!1)}function Q(t,e){return j(t,e)||t.state.data!==void 0&&E(t,e,e.refetchOnMount)}function E(t,e,s){if(h(e.enabled,t)!==!1&&h(e.staleTime,t)!=="static"){const i=typeof s=="function"?s(t):s;return i==="always"||i!==!1&&C(t,e)}return!1}function P(t,e,s,i){return(t!==e||h(i.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&C(t,s)}function C(t,e){return h(e.enabled,t)!==!1&&t.isStaleByTime(h(e.staleTime,t))}const F=p.createContext(!1),z=()=>p.useContext(F);F.Provider;function K(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}const $=p.createContext(K()),G=()=>p.useContext($),J=(t,e,s)=>{const i=s?.state.error&&typeof t.throwOnError=="function"?x(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||i)&&(e.isReset()||(t.retryOnMount=!1))},X=t=>{p.useEffect(()=>{t.clearReset()},[t])},Y=({result:t,errorResetBoundary:e,throwOnError:s,query:i,suspense:r})=>t.isError&&!e.isReset()&&!t.isFetching&&i&&(r&&t.data===void 0||x(s,[t.error,i])),it=(t,e)=>e.state.data===void 0,Z=t=>{if(t.suspense){const s=r=>r==="static"?r:Math.max(r??1e3,1e3),i=t.staleTime;t.staleTime=typeof i=="function"?(...r)=>s(i(...r)):s(i),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},q=(t,e)=>t?.suspense&&e.isPending,tt=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function rt(t,e,s){const i=z(),r=G(),c=W(),a=c.defaultQueryOptions(t),u=c.getQueryCache().get(a.queryHash),l=t.subscribed!==!1;a._optimisticResults=i?"isRestoring":l?"optimistic":void 0,Z(a),J(a,r,u),X(r);const[n]=p.useState(()=>new e(c,a)),d=n.getOptimisticResult(a),o=!i&&l;if(p.useSyncExternalStore(p.useCallback(R=>{const v=o?n.subscribe(_.batchCalls(R)):U;return n.updateResult(),v},[n,o]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),p.useEffect(()=>{n.setOptions(a)},[a,n]),q(a,d))throw tt(a,n,r);if(Y({result:d,errorResetBoundary:r,throwOnError:a.throwOnError,query:u,suspense:a.suspense}))throw d.error;return a.notifyOnChangeProps?d:n.trackResult(d)}export{st as Q,it as d,rt as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as r,Q as u}from"./useBaseQuery-BQZrcHmw.js";function a(e,s){return r(e,u)}export{a as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as n}from"./index-NqrbvfSo.js";function u(e){return n(e.defaultTagName??"div",e,e)}export{u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,e as c,d as n}from"./index-
|
|
1
|
+
import{r as s,e as c,d as n}from"./index-NqrbvfSo.js";function u(e,r){const t=s.useRef(e),a=c(r);n(()=>{t.current!==e&&a(t.current),t.current=e},[e,a])}export{u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as K,K as E,o as F,t as B,r as l,j as e,G as L,f as k,B as n,p as w,y as x,A as S}from"./index-
|
|
1
|
+
import{c as K,K as E,o as F,t as B,r as l,j as e,G as L,f as k,B as n,p as w,y as x,A as S}from"./index-NqrbvfSo.js";import{C as f}from"./card-rZNT8AAn.js";import{L as C,I as q}from"./label-CZtxPKnA.js";import{I as P}from"./InstallTag-wMa_lFPt.js";import{C as R}from"./check-DFzW0E5F.js";import{A}from"./arrow-left-SbuaKLN8.js";import"./copy-CkgrfFiF.js";/**
|
|
2
2
|
* @license lucide-react v1.39.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{N as h,r as x,j as e,B as a,G as N,p as y,P as b}from"./index-
|
|
1
|
+
import{N as h,r as x,j as e,B as a,G as N,p as y,P as b}from"./index-NqrbvfSo.js";const S=`${b}session`;function E(){const{project:o,origin:t,env:g}=h.useSearch(),{me:n}=h.useRouteContext(),[l,d]=x.useState(""),[f,u]=x.useState(!1),i=n.projects.find(s=>s.uid===o),m=typeof window<"u"?window.opener:null,r=()=>window.close();if(!o||!t||!m)return e.jsx(c,{title:"Nothing to sign in to",children:e.jsxs("p",{className:"m-0 text-muted-foreground",children:["This window is opened by the comment box on a site you are reviewing. Open it from there — choose"," ",e.jsx("em",{children:"Studio member? Sign in"})," — and it will ask you here."]})});if(!i)return e.jsxs(c,{title:"Not one of this studio's sites",children:[e.jsxs("p",{className:"m-0 text-muted-foreground",children:["You are signed in to ",n.org.name,", and that site is not one of its sites. If it belongs to another studio you are in, switch to it in the dashboard and try again."]}),e.jsx(a,{variant:"outline",onClick:r,children:"Close"})]});const p=async()=>{d(""),u(!0);try{const s=await y.memberSession(i.uid,t,g);if(s.origin!==t)throw new Error("The address changed while signing in. Try again from the site.");const{origin:j,...w}=s;m.postMessage({type:S,session:w},j),r()}catch(s){d(s instanceof Error?s.message:"Could not reach the server."),u(!1)}};return e.jsxs(c,{title:`Sign in to ${i.name}`,children:[e.jsxs("p",{className:"m-0 text-muted-foreground",children:["Comment on ",e.jsx("span",{className:"font-medium text-foreground",children:t})," as"," ",e.jsx("span",{className:"font-medium text-foreground",children:n.user.name||n.user.email}),", from ",n.org.name,". Your comments there and your replies here will be one author."]}),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 gap-2",children:[e.jsx(a,{size:"lg",className:"flex-1",loading:f,onClick:()=>void p(),children:"Continue"}),e.jsx(a,{size:"lg",variant:"outline",onClick:r,children:"Cancel"})]})]})}function c({title:o,children:t}){return e.jsx(N,{children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:o}),t]})})}export{E as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,v as w,j as e,f as b,w as y,B as f,Y as N}from"./index-
|
|
1
|
+
import{r,v as w,j as e,f as b,w as y,B as f,Y as N}from"./index-NqrbvfSo.js";import{L as c,I as m}from"./label-CZtxPKnA.js";import{P as S,a as h}from"./parts-CMVHppEZ.js";import{S as C}from"./SaveState-DbiBWPbj.js";import{u as P}from"./me-DuZzYTr0.js";import{u as A,a as k}from"./studio-oojSa61E.js";import{M as F,S as E,a as M}from"./sun-CCV5_Xwg.js";import"./card-rZNT8AAn.js";import"./labels--UUyt9uB.js";import"./useBaseQuery-BQZrcHmw.js";function T({items:t}){const[a,n]=r.useState(w);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:()=>{y(s.value),n(s.value)},className:b("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 J(){const t=P(),a=A(),[n,s]=r.useState(t.user.name),[u,l]=r.useState(null);r.useEffect(()=>s(t.user.name),[t.user.name]);const d=n.trim()!==t.user.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(S,{title:"You",sub:"Your own account on this studio",actions:e.jsx(C,{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:i=>{i.preventDefault(),d&&a.mutate(n.trim(),{onSuccess:()=>l(Date.now())})},children:[e.jsx(c,{htmlFor:"your-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(m,{id:"your-name",value:n,onChange:i=>s(i.target.value)}),d&&e.jsx(f,{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(m,{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(D,{})}),e.jsx(h,{title:"Appearance",description:"Also in your menu at the bottom of the sidebar.",children:e.jsx(T,{items:[{value:"system",label:"System",icon:e.jsx(F,{className:"size-3.5"})},{value:"light",label:"Light",icon:e.jsx(E,{className:"size-3.5"})},{value:"dark",label:"Dark",icon:e.jsx(M,{className:"size-3.5"})}]})})]})}function D(){const t=k(),[a,n]=r.useState(""),[s,u]=r.useState(""),[l,d]=r.useState(""),[i,g]=r.useState(""),[j,x]=r.useState(!1),p=a.length>0&&s.length>=12&&s===l;return e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:async o=>{if(o.preventDefault(),!(!p||t.isPending)){g("");try{await t.mutateAsync({current:a,next:s}),n(""),u(""),d(""),x(!0)}catch(v){g(N(v))}}},children:[i&&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:i}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"pw-current",children:"Current password"}),e.jsx(m,{id:"pw-current",type:"password",autoComplete:"current-password",value:a,onChange:o=>{n(o.target.value),x(!1)}})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"pw-next",children:"New password"}),e.jsx(m,{id:"pw-next",type:"password",autoComplete:"new-password",value:s,onChange:o=>{u(o.target.value),x(!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(m,{id:"pw-again",type:"password",autoComplete:"new-password",value:l,onChange:o=>{d(o.target.value),x(!1)}}),l.length>0&&s!==l&&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(f,{type:"submit",loading:t.isPending,disabled:!p,children:t.isPending?"Changing…":j&&!p?"Changed":"Change password"})})]})}export{J as component};
|