@snagset/server 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +14 -3
- package/dist/app.js.map +1 -1
- package/dist/bin.js +3 -2
- package/dist/bin.js.map +1 -1
- package/dist/instance/address.js +74 -0
- package/dist/instance/address.js.map +1 -0
- package/dist/integrations/outbox.js +15 -14
- package/dist/integrations/outbox.js.map +1 -1
- package/dist/mail/notify.js +3 -1
- package/dist/mail/notify.js.map +1 -1
- package/dist/routes/instance.js +29 -0
- package/dist/routes/instance.js.map +1 -1
- package/dist/routes/integrations.js +5 -5
- package/dist/routes/integrations.js.map +1 -1
- package/dist/routes/jobs.js +3 -2
- package/dist/routes/jobs.js.map +1 -1
- package/dist/routes/threads.js +2 -2
- package/dist/routes/threads.js.map +1 -1
- package/package.json +1 -1
- package/static/dashboard/assets/{CompositeItem-DnLNS57f.js → CompositeItem-CrOf38Oz.js} +1 -1
- package/static/dashboard/assets/{ConfirmDialog-CCAJDc_P.js → ConfirmDialog-CfUnmf4e.js} +1 -1
- package/static/dashboard/assets/{CopyButton-exuJDdXj.js → CopyButton-0ANrU8mS.js} +1 -1
- package/static/dashboard/assets/{FieldItemContext-jf0Is3j7.js → FieldItemContext-CFDZff0c.js} +1 -1
- package/static/dashboard/assets/{InstallTag-CkeGLk1a.js → InstallTag-CFvRuiwX.js} +1 -1
- package/static/dashboard/assets/{SaveState-BsrfwjoH.js → SaveState-RDbpfaEm.js} +1 -1
- package/static/dashboard/assets/{_app-xxJ7UG34.js → _app-CyFpAeiD.js} +1 -1
- package/static/dashboard/assets/{_app-CiDKmy_a.js → _app-DpPrYyh8.js} +1 -1
- package/static/dashboard/assets/{activity-mwHb7ir7.js → activity-DwTWlcUi.js} +1 -1
- package/static/dashboard/assets/{arrow-left-D08BSlJU.js → arrow-left-2PKG3ITQ.js} +1 -1
- package/static/dashboard/assets/{avatar-BITl2vTh.js → avatar-AfucjvZ4.js} +1 -1
- package/static/dashboard/assets/{badge-CGEswzew.js → badge-CErha5Qd.js} +1 -1
- package/static/dashboard/assets/{card-8T0wnIiU.js → card-DxFqxFQf.js} +1 -1
- package/static/dashboard/assets/{check-CiLHTeII.js → check-Yc6VFTfm.js} +1 -1
- package/static/dashboard/assets/{chevron-right-BokKbPOn.js → chevron-right-Go23FN_b.js} +1 -1
- package/static/dashboard/assets/{copy-CKgsZbj1.js → copy-BjvQHEe0.js} +1 -1
- package/static/dashboard/assets/{createBaseUIEventDetails-CEmaecLi.js → createBaseUIEventDetails-BWJgXhnd.js} +1 -1
- package/static/dashboard/assets/{createLucideIcon-llnWWh0E.js → createLucideIcon-DwbZIZsa.js} +1 -1
- package/static/dashboard/assets/{dialog-DrrnCoT5.js → dialog-CgkCHO0g.js} +1 -1
- package/static/dashboard/assets/{dropdown-menu-DIE2xmL5.js → dropdown-menu-DRa3ikv4.js} +1 -1
- package/static/dashboard/assets/{image-off-CgUC8krg.js → image-off-ByN_ZOK_.js} +1 -1
- package/static/dashboard/assets/{index-C87aqO18.js → index-DG2IWFx-.js} +3 -3
- package/static/dashboard/assets/{label-BfMHjFA7.js → label-Bombrpc6.js} +1 -1
- package/static/dashboard/assets/{layout-grid-B7mn7n3K.js → layout-grid-Dj0cm_PO.js} +1 -1
- package/static/dashboard/assets/me-Bno2H07j.js +1 -0
- package/static/dashboard/assets/{parts-B-HQayFH.js → parts-B3hL1LIW.js} +1 -1
- package/static/dashboard/assets/{plus-CuMhvZUZ.js → plus-CRLkl9fr.js} +1 -1
- package/static/dashboard/assets/s._site-CP12hsxz.js +1 -0
- package/static/dashboard/assets/{s._site.comments-nJZLYDQh.js → s._site.comments-DCpM8f18.js} +1 -1
- package/static/dashboard/assets/{s._site.reviewers-BmRPiC0a.js → s._site.reviewers-WT9D4fr3.js} +1 -1
- package/static/dashboard/assets/{s._site.settings-DNv5ovrJ.js → s._site.settings-DaxVWDmT.js} +1 -1
- package/static/dashboard/assets/setup-Ch-Vt7_T.js +1 -0
- package/static/dashboard/assets/{sign-in-sWUNd3Lp.js → sign-in-CdGjL0Ha.js} +1 -1
- package/static/dashboard/assets/{sites-CSzUAHV6.js → sites-8S1PAUfv.js} +1 -1
- package/static/dashboard/assets/{studio-DVFn025O.js → studio-BIDpGywS.js} +1 -1
- package/static/dashboard/assets/studio-DREMbrco.js +1 -0
- package/static/dashboard/assets/studio.index-B4-MAfEP.js +1 -0
- package/static/dashboard/assets/{studio.integrations-DD2EWaL-.js → studio.integrations-D1bP5fqp.js} +1 -1
- package/static/dashboard/assets/{studio.members-CVu-eP6p.js → studio.members-DKl8oRd9.js} +1 -1
- package/static/dashboard/assets/{sun-DTI4O-GM.js → sun-CyU37by7.js} +1 -1
- package/static/dashboard/assets/{table-DkqScFZb.js → table-DEYsEr1D.js} +1 -1
- package/static/dashboard/assets/{useBaseQuery-0OqUJMfc.js → useBaseQuery-Cyp8ADaN.js} +1 -1
- package/static/dashboard/assets/useQuery-DuAHuwx9.js +1 -0
- package/static/dashboard/assets/useRender-BCvsiXRL.js +1 -0
- package/static/dashboard/assets/{users-O11swHBQ.js → users-CcRaZGiI.js} +1 -1
- package/static/dashboard/assets/{welcome-CT6oH0I8.js → welcome-DFcmcB5m.js} +1 -1
- package/static/dashboard/assets/{you-_yIPqa_9.js → you-ClBoja9X.js} +1 -1
- package/static/dashboard/assets/{zod-iC-UhR5u.js → zod-qEjeM9Eg.js} +1 -1
- package/static/dashboard/index.html +1 -1
- package/static/dashboard/assets/me-D1prnPpY.js +0 -1
- package/static/dashboard/assets/s._site-Ccc7pzT-.js +0 -1
- package/static/dashboard/assets/setup-B_VsIyK2.js +0 -1
- package/static/dashboard/assets/studio-DzBapfQK.js +0 -1
- package/static/dashboard/assets/studio.index-Cp7lBb8S.js +0 -1
- package/static/dashboard/assets/useQuery-COJ09EkU.js +0 -1
- package/static/dashboard/assets/useRender-dtgBGlgC.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,W as n,f as X,E as $,U as M,d as V,c as v,i as q,h as z,j as F,e as _}from"./index-
|
|
1
|
+
import{r as i,W as n,f as X,E as $,U as M,d as V,c as v,i as q,h as z,j as F,e as _}from"./index-DG2IWFx-.js";import{u as G,f as H,o as Q,e as Z,c as ee,n as te}from"./createBaseUIEventDetails-BWJgXhnd.js";const ne={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},re={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},ae={disabled:!1,...re},se={valid(t){return t===null?null:t?{"data-valid":""}:{"data-invalid":""}}},le={invalid:void 0,name:void 0,validityData:{state:ne,errors:[],error:"",value:"",initialValue:null},setValidityData:n,disabled:void 0,setTouched:n,setDirty:n,setFilled:n,setFocused:n,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:ae,registerFieldControl:n,validation:{getValidationProps:(t,e=$)=>e,inputRef:{current:null},registeredInputs:new Map,registerInput:n,getInputControl:()=>null,commit:async()=>{},change:n}},ie=i.createContext(le);function S(t=!0){const e=i.useContext(ie);if(e.setValidityData===n&&!t)throw new Error(X(28));return e}const oe=i.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:n,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function ue(){return i.useContext(oe)}const de=i.createContext({controlId:void 0,registerControlId:n,labelId:void 0,setLabelId:n,messageIds:[],setMessageIds:n,getDescriptionProps:t=>t});function A(){return i.useContext(de)}function ce(t={}){const{id:e,implicit:l=!1,controlRef:p}=t,{controlId:b,registerControlId:o}=A(),s=G(e),r=l?b:void 0,u=M(()=>Symbol()),m=i.useRef(!1),g=i.useRef(e!=null),d=V(()=>{!m.current||o===n||(m.current=!1,o(u.current,void 0))});return v(()=>{if(o===n)return;let f;if(l){const E=p?.current;q(E)&&E.closest("label")!=null?f=e??null:f=r??s}else if(e!=null)g.current=!0,f=e;else if(g.current)f=s;else{d();return}if(f===void 0){d();return}m.current=!0,o(u.current,f)},[e,p,r,o,l,s,u,d]),i.useEffect(()=>d,[d]),b??s}function fe(t,e,l,p,b=!0,o){const{registerFieldControl:s}=S(),r=M(()=>Symbol());v(()=>{const u=r.current;if(!b){s(u,void 0);return}s(u,{controlRef:t,getValue:p,id:e,name:o,value:l})},[t,b,p,e,o,s,r,l]),v(()=>{const u=r.current;return()=>{s(u,void 0)}},[s,r])}const pe=i.forwardRef(function(e,l){const{render:p,className:b,id:o,name:s,value:r,disabled:u=!1,onValueChange:m,defaultValue:g,autoFocus:d=!1,style:f,...E}=e,{state:P,name:U,disabled:O,setTouched:h,setDirty:N,validityData:k,setFocused:I,setFilled:x,validationMode:j,validation:c}=S(),{clearErrors:B}=ue(),C=O||u,y=U??s,W={...P,disabled:C},{labelId:Y}=A(),D=ce({id:o});v(()=>{const a=r!=null;c.inputRef.current?.value||a&&r!==""?x(!0):a&&r===""&&x(!1)},[c.inputRef,x,r]);const T=i.useRef(null);v(()=>{d&&T.current===H(Q(T.current))&&I(!0)},[d,I]);const[J]=Z({controlled:r,default:g,name:"FieldControl",state:"value"}),L=r!==void 0,w=L?J:void 0,K=V(()=>c.inputRef.current?.value);return fe(c.inputRef,D,w,K,!C,s),z("input",e,{ref:[l,T],state:W,props:[{id:D,disabled:C,name:y,ref:c.inputRef,"aria-labelledby":Y,autoFocus:d,...L?{value:w}:{defaultValue:g},onChange(a){const R=a.currentTarget.value;m?.(R,ee(te,a.nativeEvent)),N(R!==(k.initialValue??"")),x(R!==""),a.nativeEvent.defaultPrevented||(B(y),c.change(R))},onFocus(){I(!0)},onBlur(a){h(!0),I(!1),j==="onBlur"&&c.commit(a.currentTarget.value)},onKeyDown(a){a.currentTarget.tagName==="INPUT"&&a.key==="Enter"&&(h(!0),c.commit(a.currentTarget.value))}},E,a=>c.getValidationProps(C,a)],stateAttributesMapping:se})}),be=i.forwardRef(function(e,l){return F.jsx(pe,{ref:l,...e})});function Ee({className:t,type:e,...l}){return F.jsx(be,{type:e,"data-slot":"input",className:_("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...l})}function Ie({className:t,...e}){return F.jsx("label",{"data-slot":"label",className:_("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...e})}export{Ee as I,Ie as L,S as a,A as b,fe as c,ce as d,se as f,ue as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as r,Q as u,d as s}from"./useBaseQuery-Cyp8ADaN.js";import{x as t}from"./index-DG2IWFx-.js";function a(e,o){return r({...e,enabled:!0,suspense:!0,throwOnError:s,placeholderData:void 0},u)}function i(){return a(t.me()).data}export{i as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,e as r}from"./index-
|
|
1
|
+
import{j as e,e as r}from"./index-DG2IWFx-.js";import{C as x}from"./card-DxFqxFQf.js";import{S as m,d as l,i as d}from"./labels--UUyt9uB.js";function p({title:t,sub:s,actions:a}){return e.jsxs("div",{className:"mb-5 flex items-center gap-3",children:[e.jsx("h1",{className:"m-0 text-xl font-semibold tracking-tight",children:t}),s&&e.jsx("p",{className:"m-0 text-muted-foreground",children:s}),e.jsx("div",{className:"flex-1"}),a]})}function u({title:t,description:s,children:a,danger:n,cardClassName:i}){return e.jsxs("section",{className:"grid max-w-[1040px] grid-cols-1 gap-4 lg:grid-cols-[minmax(220px,1fr)_2fr] lg:gap-8",children:[e.jsxs("div",{children:[e.jsx("h2",{className:r("m-0 mb-1.5 text-[15.5px] font-semibold tracking-tight",n&&"text-destructive"),children:t}),s&&e.jsx("p",{className:"m-0 text-[13px] leading-normal text-muted-foreground",children:s})]}),e.jsx(x,{className:r("flex max-w-[640px] flex-col gap-4 p-5",n&&"border-destructive",i),children:a})]})}function g({icon:t,title:s,children:a,action:n,className:i}){return e.jsxs("div",{className:r("flex flex-col items-center gap-2 px-6 py-16 text-center",i),children:[t&&e.jsx("div",{className:"mb-1.5 flex size-11 items-center justify-center rounded-[10px] bg-muted text-ink-soft",children:t}),e.jsx("h3",{className:"m-0 text-[15px] font-semibold",children:s}),a&&e.jsx("div",{className:"m-0 max-w-[360px] text-muted-foreground",children:a}),n&&e.jsx("div",{className:"mt-2",children:n})]})}function j({status:t,className:s}){const a=d(t);return e.jsx("span",{className:r("inline-flex h-5 items-center whitespace-nowrap rounded-full px-2 text-[11.5px] font-medium leading-none",a?l[t]:"bg-muted text-muted-foreground",s),children:a?m[t]:t})}function h({children:t}){return e.jsx("div",{className:"text-[11.5px] font-medium uppercase tracking-wide text-muted-foreground",children:t})}export{g as E,p as P,j as S,u as a,h as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,O as o}from"./index-DG2IWFx-.js";const n=()=>t.jsx(o,{});export{n as component};
|
package/static/dashboard/assets/{s._site.comments-nJZLYDQh.js → s._site.comments-DCpM8f18.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,e as C,r as g,f as As,U as Ms,V as Rs,c as Ke,W as Ge,X as Ds,m as zs,E as Is,h as es,Y as Es,g as Ps,Z as ss,$ as Ts,T as He,B as R,Q as ts,A as Bs,a0 as Je,n as _s,a1 as Qe,a2 as Fs,a3 as Os,a4 as Ls,a5 as Vs,a6 as qs,a7 as Us,L as ns,z as Ws,_ as Xe,C as ie,a8 as Ks,x as he}from"./index-
|
|
1
|
+
import{j as e,e as C,r as g,f as As,U as Ms,V as Rs,c as Ke,W as Ge,X as Ds,m as zs,E as Is,h as es,Y as Es,g as Ps,Z as ss,$ as Ts,T as He,B as R,Q as ts,A as Bs,a0 as Je,n as _s,a1 as Qe,a2 as Fs,a3 as Os,a4 as Ls,a5 as Vs,a6 as qs,a7 as Us,L as ns,z as Ws,_ as Xe,C as ie,a8 as Ks,x as he}from"./index-DG2IWFx-.js";import{u as le}from"./useQuery-DuAHuwx9.js";import{C as as}from"./check-Yc6VFTfm.js";import{u as Ze,e as Gs,c as Hs,n as Js}from"./createBaseUIEventDetails-BWJgXhnd.js";import{L as Qs,M as Xs,N as Zs,A as Ys,O as et,X as st,E as rs,G as os,I as is,H as ls,J as ds,K as cs}from"./dialog-CgkCHO0g.js";import{f as tt,u as nt,a as at,b as rt,c as ot,L as Te,I as je}from"./label-Bombrpc6.js";import{u as it,a as lt}from"./FieldItemContext-CFDZff0c.js";import{u as dt}from"./CompositeItem-CrOf38Oz.js";import{E as Ye,D as Y,i as ee,j as se,o as Be,p as X,k as ce,m as G,l as _e,n as us,S as ct}from"./dropdown-menu-DRa3ikv4.js";import{A as te,a as ne}from"./avatar-AfucjvZ4.js";import{b as Fe,S as ms,E as Ee}from"./parts-B3hL1LIW.js";import{S as ae,i as ut,a as ue,b as ve,c as fe}from"./labels--UUyt9uB.js";import{C as mt}from"./copy-BjvQHEe0.js";import{I as xt}from"./image-off-ByN_ZOK_.js";import{c as Z}from"./createLucideIcon-DwbZIZsa.js";import{C as pt}from"./chevron-right-Go23FN_b.js";import{I as ht}from"./InstallTag-CFvRuiwX.js";import{u as ft}from"./me-Bno2H07j.js";import{A as gt}from"./arrow-left-2PKG3ITQ.js";import"./useBaseQuery-Cyp8ADaN.js";import"./card-DxFqxFQf.js";/**
|
|
2
2
|
* @license lucide-react v1.39.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
package/static/dashboard/assets/{s._site.reviewers-BmRPiC0a.js → s._site.reviewers-WT9D4fr3.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aq as A,r as f,j as e,B as g,ar as S,e as E,as as I,x as k,N as L,z as P,C as y}from"./index-
|
|
1
|
+
import{aq as A,r as f,j as e,B as g,ar as S,e as E,as as I,x as k,N as L,z as P,C as y}from"./index-DG2IWFx-.js";import{u as C}from"./useQuery-DuAHuwx9.js";import{u as F,a as M}from"./zod-qEjeM9Eg.js";import{C as R}from"./card-DxFqxFQf.js";import{X as U,E as $,G as z,I as B,H,J as q,K}from"./dialog-CgkCHO0g.js";import{L as N,I as V}from"./label-Bombrpc6.js";import{T as Y,a as G,b as D,c as p,d as J,e as j}from"./table-DEYsEr1D.js";import{C as O}from"./ConfirmDialog-CfUnmf4e.js";import{C as Q}from"./CopyButton-0ANrU8mS.js";import{P as X,E as W}from"./parts-B3hL1LIW.js";import{b as T}from"./labels--UUyt9uB.js";import{C as Z}from"./check-Yc6VFTfm.js";import{U as _}from"./users-CcRaZGiI.js";import{P as ee}from"./plus-CRLkl9fr.js";import"./useBaseQuery-Cyp8ADaN.js";import"./createLucideIcon-DwbZIZsa.js";import"./createBaseUIEventDetails-BWJgXhnd.js";import"./copy-BjvQHEe0.js";function ye(){const{site:s}=A.useParams(),{site:d}=A.useRouteContext(),a=C(k.links(s)),l=C(k.origins(s)),[x,n]=f.useState(!1),[t,r]=f.useState(null);f.useEffect(()=>r(null),[s]);const i=a.data?.data??[],c=l.data?.origins[0]?.replace(/\/+$/,"")??"",m=t?`${c}/${t.fragment}`:"",v=e.jsxs(g,{onClick:()=>n(!0),children:[e.jsx(ee,{}),"Add reviewer"]});return e.jsxs("div",{className:"p-7",children:[e.jsx(X,{title:"Reviewers",sub:`Each reviewer gets their own link to ${d.name}`,actions:v}),t&&e.jsxs("div",{className:"mb-4 flex max-w-[1040px] items-center gap-3 rounded-lg border border-ok bg-ok-soft px-3.5 py-3",role:"status",children:[e.jsx(Z,{className:"size-4 shrink-0 text-ok"}),e.jsxs("div",{className:"shrink-0",children:[e.jsxs("b",{className:"font-semibold",children:[t.name," added."]})," ",e.jsx("span",{className:"text-ink-soft",children:"Share this link — it is shown once."})]}),e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[12.5px]",children:m}),e.jsx(Q,{text:m,label:"Copy link",withText:!0}),e.jsx(g,{variant:"ghost",size:"icon-sm","aria-label":"Dismiss",onClick:()=>r(null),children:e.jsx(U,{})})]}),a.isSuccess&&i.length===0?e.jsx(R,{className:"max-w-[1040px]",children:e.jsx(W,{icon:e.jsx(_,{className:"size-5"}),title:"No reviewers yet",action:v,children:"Add your client and send them their link. They never need an account."})}):e.jsx(R,{className:"max-w-[1040px] overflow-hidden py-0",children:e.jsxs(Y,{children:[e.jsx(G,{children:e.jsxs(D,{children:[e.jsx(p,{children:"Name"}),e.jsx(p,{children:"Status"}),e.jsx(p,{children:"Uses"}),e.jsx(p,{children:"Last seen"}),e.jsx(p,{className:"w-0"})]})}),e.jsx(J,{children:i.map(u=>e.jsx(se,{link:u,uid:s,onRevoked:()=>r(h=>h?.id===u.id?null:h)},u.id))})]})}),e.jsx("p",{className:"m-0 mt-3 max-w-[1040px] text-[12.5px] text-muted-foreground",children:"Revoking ends every session minted from the link within 10 seconds. The comments a reviewer left stay."}),e.jsx(ne,{uid:s,open:x,onOpenChange:n,onMinted:r})]})}function se({link:s,uid:d,onRevoked:a}){const l=S(d),[x,n]=f.useState(!1),t=!!s.revokedAt,r=!t&&new Date(s.expiresAt).getTime()<=Date.now(),i=t||r,c=Math.max(0,Math.ceil((new Date(s.expiresAt).getTime()-Date.now())/864e5));return e.jsxs(D,{className:E(i&&"text-muted-foreground"),children:[e.jsx(j,{className:"font-medium",children:s.name}),e.jsx(j,{children:t?e.jsxs("span",{children:["Revoked ",T(s.revokedAt)]}):r?e.jsx("span",{children:"Expired"}):e.jsxs("span",{children:[e.jsx("span",{className:"rounded-full bg-ok-soft px-2 py-0.5 text-[11.5px] font-medium text-ok",children:"Active"}),e.jsxs("span",{className:"ml-2 text-[12px] text-muted-foreground",children:["expires in ",c," day",c===1?"":"s"]})]})}),e.jsx(j,{children:s.useCount}),e.jsx(j,{className:"text-muted-foreground",children:s.lastUsedAt?T(s.lastUsedAt):"never"}),e.jsxs(j,{className:"text-right",children:[!t&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>n(!0),children:"Revoke"}),e.jsx(O,{open:x,onOpenChange:n,title:`Revoke ${s.name}'s link?`,description:`Every session minted from it ends within 10 seconds. The comments ${s.name} left stay. This cannot be undone — adding them again makes a new link.`,confirmLabel:"Revoke",busy:l.isPending,onConfirm:()=>{n(!1),a(),l.mutate(s.id)}})]})]})}const te=P({name:y().trim().min(1,"Their name"),days:y(),roundId:y().optional()});function ne({uid:s,open:d,onOpenChange:a,onMinted:l}){const x=I(s),n=C({...k.rounds(s),enabled:d}),[t,r]=f.useState(""),{register:i,handleSubmit:c,formState:m,reset:v}=F({resolver:M(te),defaultValues:{days:"14",roundId:""}}),u=c(async o=>{r("");const b=Number(o.days);try{const w=await x.mutateAsync({name:o.name,...Number.isFinite(b)&&b>0?{expiresAt:new Date(Date.now()+b*864e5).toISOString()}:{},...o.roundId?{roundId:o.roundId}:{}});l(w),v(),a(!1)}catch(w){r(L(w))}}),h="h-8 w-full rounded-md border border-input bg-card px-2.5 text-[13.5px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50";return e.jsx($,{open:d,onOpenChange:a,children:e.jsx(z,{children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(B,{children:[e.jsx(H,{children:"New reviewer"}),e.jsx(q,{children:"Your client's name, as you will see it on their comments. A link is generated once and shown to you once."})]}),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(N,{htmlFor:"reviewer-name",children:"Name"}),e.jsx(V,{id:"reviewer-name",placeholder:"Marta, Kilnwork","aria-invalid":!!m.errors.name,...i("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(N,{htmlFor:"reviewer-days",children:"Link expires in"}),e.jsxs("select",{id:"reviewer-days",className:h,...i("days"),children:[e.jsx("option",{value:"7",children:"7 days"}),e.jsx("option",{value:"14",children:"14 days"}),e.jsx("option",{value:"30",children:"30 days"}),e.jsx("option",{value:"90",children:"90 days"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"You can revoke it at any time before that."})]}),n.data&&n.data.data.length>0&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(N,{htmlFor:"reviewer-round",children:"Pin to a round"}),e.jsxs("select",{id:"reviewer-round",className:h,...i("roundId"),children:[e.jsx("option",{value:"",children:"Any round"}),n.data.data.map(o=>e.jsx("option",{value:o.id,children:o.name},o.id))]})]}),e.jsxs(K,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(g,{type:"submit",disabled:m.isSubmitting,children:m.isSubmitting?"Adding…":"Add reviewer"})]})]})})})}export{ye as component};
|
package/static/dashboard/assets/{s._site.settings-DNv5ovrJ.js → s._site.settings-DaxVWDmT.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,f as me,W as ce,X as ge,c as oe,V as Te,E as de,h as ie,j as e,Y as Ve,d as J,ao as we,au as tt,e as le,av as nt,aw as st,B as ae,n as rt,ax as at,x as it}from"./index-C87aqO18.js";import{u as ot}from"./useQuery-COJ09EkU.js";import{f as xe,a as be,b as ve,d as Le,u as ze,c as Be,L as Q,I as ye}from"./label-BfMHjFA7.js";import{u as ke,c as He,n as Ke,g as je,e as We,a as dt}from"./createBaseUIEventDetails-CEmaecLi.js";import{O as lt,L as qe,M as Ge,N as ct,A as ut,aL as Se,ak as Ne,ad as ue,a9 as fe,aM as Pe,aN as Ee,ao as ft,aO as Me,aa as pt,ab as ht,aP as De,aQ as Fe,aR as Ae,aS as Oe,aT as mt,aU as gt,X as xt}from"./dialog-DrrnCoT5.js";import{c as bt,a as vt,C as yt,u as _e}from"./CompositeItem-DnLNS57f.js";import{u as kt,a as Ye}from"./FieldItemContext-jf0Is3j7.js";import{C as Rt}from"./ConfirmDialog-CCAJDc_P.js";import{C as Ct}from"./CopyButton-exuJDdXj.js";import{I as It}from"./InstallTag-CkeGLk1a.js";import{P as wt,a as pe}from"./parts-B-HQayFH.js";import{S as jt}from"./SaveState-BsrfwjoH.js";import{u as St}from"./me-D1prnPpY.js";import{P as Nt}from"./plus-CuMhvZUZ.js";import"./useBaseQuery-0OqUJMfc.js";import"./createLucideIcon-llnWWh0E.js";import"./check-CiLHTeII.js";import"./copy-CKgsZbj1.js";import"./card-8T0wnIiU.js";import"./labels--UUyt9uB.js";const Pt=i.createContext(void 0);function Et(t=!1){const a=i.useContext(Pt);if(!a&&!t)throw new Error(me(86));return a}function Mt(t,a){return t.matches(":disabled")?!1:!a||t.form===a?!0:t.form===null&&!t.hasAttribute("form")}function Dt(t){return t==null||t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true"}const he={checked(t){return t?{"data-checked":""}:{"data-unchecked":""}},...lt,...xe},Ue="data-composite-item-active",$e=i.createContext(void 0);function Ft(){return i.useContext($e)}function At(t){if(t==null)return"";if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}const Je=i.createContext(void 0);function Ot(){const t=i.useContext(Je);if(t===void 0)throw new Error(me(52));return t}const Tt=i.forwardRef(function(a,s){const{render:l,className:f,disabled:p=!1,readOnly:c=!1,required:h=!1,"aria-labelledby":u,value:y,inputRef:z,nativeButton:m=!1,id:B,style:I,...P}=a,V=Ft(),{disabled:O,readOnly:q,required:x,form:G,checkedValue:k,touched:T=!1,validation:H,name:E,setCheckedValue:_=ce,setTouched:U=ce,registerInputRef:n=ce}=V??{},{setTouched:g,setFilled:b,state:M,disabled:D}=be(),R=kt(),{labelId:K,getDescriptionProps:w}=ve(),o=D||R.disabled||O||p,d=q||c,L=x||h,F=G,j=V?k===y:y==="",A=i.useRef(null),S=i.useRef(null),v=H?.registerInput,W=i.useCallback(N=>v?.(N,{controlRef:A,value:void 0}),[v]),$=ge(z,S,n,W);oe(()=>{S.current?.checked&&b(!0)},[b]),oe(()=>{if(S.current){if(o&&j){n(null);return}n(S.current)}},[j,o,n]);const X=ke(),Z=Le({id:B,implicit:!1,controlRef:A}),ee=m?void 0:Z,ne=Ye(u,K,S,!m,ee),te={role:"radio","aria-checked":j,"aria-labelledby":ne,[Ue]:j?"":void 0,id:m?Z:X,onKeyDown(N){N.key==="Enter"&&N.preventDefault()},onClick(N){if(N.defaultPrevented||o||d)return;N.preventDefault();const re=S.current;re&&Ve(re,N)},onFocus(N){N.defaultPrevented||o||d||!T||(S.current?.click(),U(!1))}},{getButtonProps:se,buttonRef:r}=Te({disabled:o,native:m,composite:!1}),C={type:"radio",ref:$,form:F,id:ee,name:E,tabIndex:-1,style:E?qe:Ge,"aria-hidden":!0,...y!==void 0?{value:At(y)}:de,disabled:o,checked:j,required:L,readOnly:d,onChange(N){if(N.nativeEvent.defaultPrevented||o||d||y===void 0)return;const re=He(Ke,N.nativeEvent);_(y,re),!re.isCanceled&&g(!0)},onClick(N){N.stopPropagation()},onFocus(){A.current?.focus()}},Y=i.useMemo(()=>({...M,required:L,disabled:o,readOnly:d,checked:j}),[M,o,d,j,L]),Ze=Y,Re=V!==void 0,Ce=[s,A,r],Ie=[te,P,se,w,H?N=>H.getValidationProps(o,N):de],et=ie("span",a,{enabled:!Re,state:Y,ref:Ce,props:Ie,stateAttributesMapping:he});return e.jsxs(Je.Provider,{value:Ze,children:[Re?e.jsx(bt,{tag:"span",render:l,className:f,style:I,state:Y,refs:Ce,props:Ie,stateAttributesMapping:he}):et,e.jsx("input",{...C,suppressHydrationWarning:!0})]})}),Vt=i.forwardRef(function(a,s){const{render:l,className:f,style:p,keepMounted:c=!1,...h}=a,u=Ot(),y=u.checked,{mounted:z,transitionStatus:m,setMounted:B}=ct(y),I={...u,transitionStatus:m},P=i.useRef(null),V=c||z,O=ie("span",a,{ref:[s,P],state:I,props:h,stateAttributesMapping:he});return ut({open:y,ref:P,onComplete(){y||B(!1)}}),V?O:null}),Lt=[];function zt(t){const{loopFocus:a=!0,orientation:s="both",grid:l,onLoop:f,direction:p,highlightedIndex:c,onHighlightedIndexChange:h,rootRef:u,enableHomeAndEndKeys:y=!1,stopEventPropagation:z,disabledIndices:m,modifierKeys:B=Lt}=t,[I,P]=i.useState(0),V=l!=null,O=i.useRef(null),q=ge(O,u),x=i.useRef([]),G=i.useRef(!1),k=c??I,T=J((n,g=!1)=>{if((h??P)(n),g){const b=x.current[n];Se(O.current,b,p,s)}}),H=J(n=>{if(n.size===0||G.current)return;G.current=!0;const g=Array.from(n.keys()),b=g.find(D=>D?.hasAttribute(Ue))??null,M=b?n.get(b)?.index??-1:-1;if(M!==-1)T(M);else if(Ne(g,k,m)){const D=ue(g,{disabledIndices:m});fe(g,D)||T(D)}Se(O.current,b,p,s)});oe(()=>{if(m==null||c!=null||!G.current)return;const n=x.current;if(Ne(n,k,m)){const g=ue(n,{disabledIndices:m});fe(n,g)||T(g)}},[m,c,k,x,T]);const E=J((n,g,b)=>f?f(n,g,b,x):b),_=J(n=>{const g=n.key===Pe||n.key===Ee;if(!ft.has(n.key)||!y&&g||Bt(n,B)||!O.current)return;const M=p==="rtl",D=M?Ae:Oe,R=M?Oe:Ae,K=s==="vertical"?De:D,w=s==="vertical"?Fe:R,o=je(n.nativeEvent);if(o!=null&&Me(o)&&!Dt(o)){const S=o.selectionStart,v=o.selectionEnd,W=o.value;if(S==null||n.shiftKey||S!==v||n.key!==w&&S<W.length||n.key!==K&&S>0)return}let d=k;const L=pt(x,m),F=ht(x,m);l!=null&&(d=l({disabledIndices:m,elementsRef:x,event:n,highlightedIndex:k,loopFocus:a,maxIndex:F,minIndex:L,onLoop:E,orientation:s,rtl:M}));const j=s!=="vertical"&&n.key===D||s!=="horizontal"&&n.key===De,A=s!=="vertical"&&n.key===R||s!=="horizontal"&&n.key===Fe;y&&(n.key===Pe?d=L:n.key===Ee&&(d=F)),d===k&&(j||A)&&(a&&d===F&&j?(d=L,f&&(d=f(n,k,d,x))):a&&d===L&&A?(d=F,f&&(d=f(n,k,d,x))):d=ue(x.current,{startingIndex:d,decrement:A,disabledIndices:m})),d!==k&&!fe(x.current,d)&&(z&&n.stopPropagation(),(V||g||j||A)&&n.preventDefault(),T(d,!0),queueMicrotask(()=>{x.current[d]?.focus()}))});return{props:{ref:q,onFocus(n){const g=O.current,b=je(n.nativeEvent);!g||b==null||!Me(b)||b.setSelectionRange(0,b.value.length)},onKeyDown:_},highlightedIndex:k,onHighlightedIndexChange:T,elementsRef:x,onMapChange:H,relayKeyboardEvent:_}}function Bt(t,a){for(const s of mt)if(!a.includes(s)&&t.getModifierState(s))return!0;return!1}function Ht(t){const{render:a,className:s,style:l,refs:f=we,props:p=we,state:c=de,stateAttributesMapping:h,highlightedIndex:u,onHighlightedIndexChange:y,orientation:z,grid:m,loopFocus:B,onLoop:I,enableHomeAndEndKeys:P,onMapChange:V,stopEventPropagation:O=!0,rootRef:q,disabledIndices:x,modifierKeys:G,highlightItemOnHover:k=!1,tag:T="div",...H}=t,E=vt(),{props:_,highlightedIndex:U,onHighlightedIndexChange:n,elementsRef:g,onMapChange:b,relayKeyboardEvent:M}=zt({grid:m,loopFocus:B,onLoop:I,orientation:z,highlightedIndex:u,onHighlightedIndexChange:y,rootRef:q,stopEventPropagation:O,enableHomeAndEndKeys:P,direction:E,disabledIndices:x,modifierKeys:G}),D=ie(T,t,{state:c,ref:f,props:[_,...p,H],stateAttributesMapping:h}),R=i.useMemo(()=>({highlightedIndex:U,onHighlightedIndexChange:n,highlightItemOnHover:k,relayKeyboardEvent:M}),[U,n,k,M]);return e.jsx(tt.Provider,{value:R,children:e.jsx(yt,{elementsRef:g,onMapChange:K=>{V?.(K),b(K)},children:D})})}const Kt=[gt],Wt=i.forwardRef(function(a,s){const{render:l,className:f,disabled:p,readOnly:c,required:h,onValueChange:u,value:y,defaultValue:z,form:m,name:B,inputRef:I,id:P,style:V,...O}=a,{setTouched:q,setFocused:x,validationMode:G,name:k,disabled:T,state:H,validation:E,setDirty:_,setFilled:U,validityData:n}=be(),{labelId:g}=ve(),{clearErrors:b,elementRef:M}=ze(),D=Et(!0),R=T||p,K=k??B,w=ke(P),[o,d]=We({controlled:y,default:z,name:"RadioGroup",state:"value"}),[L,F]=i.useState(!1),j=J((r,C)=>{u?.(r,C),!C.isCanceled&&d(r)}),A=E.getInputControl,S=i.useMemo(()=>({get current(){return A()}}),[A]),v=i.useRef(null),W=i.useRef(null);function $(r){let C;return I&&(typeof I=="function"?C=I(r):I.current=r),v.current=r,C}const X=J(r=>{if(!r||r.disabled)return;W.current||(W.current=r);const C=v.current,Y=r.checked||C==null||C.disabled?$(r):void 0;return()=>{W.current===r&&(W.current=null),v.current===r?Y?(Y(),v.current=null):$(null):Y?.()}}),Z=J(()=>{const r=M.current;if(!r)return o??null;for(const C of E.registeredInputs.keys())if(C.checked&&Mt(C,r))return o??null;return null});Be(S,w,o??null,Z,!R,B),_e(o,()=>{b(K),_(o!==n.initialValue),U(o!=null),E.change(o);const r=W.current;o==null&&r&&!r.disabled&&$(r)});const ee=g??D?.legendId,ne={...H,disabled:R??!1,required:h??!1,readOnly:c??!1},te=i.useMemo(()=>({checkedValue:o,disabled:R,form:m,validation:E,name:K,readOnly:c,registerInputRef:X,required:h,setCheckedValue:j,setTouched:F,touched:L}),[o,R,m,E,K,c,X,h,j,F,L]),se={id:P,role:"radiogroup","aria-required":h||void 0,"aria-disabled":R||void 0,"aria-readonly":c||void 0,"aria-labelledby":ee,onFocus(){x(!0)},onBlur(r){dt(r.currentTarget,r.relatedTarget)||(q(!0),x(!1),G==="onBlur"&&E.commit(o))},onKeyDownCapture(r){r.key.startsWith("Arrow")&&(F(!0),x(!0))}};return e.jsx($e.Provider,{value:te,children:e.jsx(Ht,{render:l,className:f,style:V,state:ne,props:[se,O,r=>E.getValidationProps(R??!1,r)],refs:[s],stateAttributesMapping:xe,enableHomeAndEndKeys:!1,modifierKeys:Kt})})});function qt({className:t,...a}){return e.jsx(Wt,{"data-slot":"radio-group",className:le("grid w-full gap-2",t),...a})}function Gt({className:t,...a}){return e.jsx(Tt,{"data-slot":"radio-group-item",className:le("group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary",t),...a,children:e.jsx(Vt,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:e.jsx("span",{className:"absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground"})})})}const Qe=i.createContext(void 0);function _t(){const t=i.useContext(Qe);if(t===void 0)throw new Error(me(63));return t}const Xe={...xe,checked(t){return t?{"data-checked":""}:{"data-unchecked":""}}},Yt=i.forwardRef(function(a,s){const{checked:l,className:f,defaultChecked:p,"aria-labelledby":c,form:h,id:u,inputRef:y,name:z,nativeButton:m=!1,onCheckedChange:B,readOnly:I=!1,required:P=!1,disabled:V=!1,render:O,uncheckedValue:q,value:x,style:G,...k}=a,{clearErrors:T}=ze(),{state:H,setTouched:E,setDirty:_,validityData:U,setFilled:n,setFocused:g,validationMode:b,disabled:M,name:D,validation:R}=be(),{labelId:K}=ve(),w=M||V,o=D??z,d=i.useRef(null),L=ge(d,y,R.inputRef),F=i.useRef(null),j=ke(),A=Le({id:u,implicit:!1,controlRef:F}),S=m?void 0:A,[v,W]=We({controlled:l,default:!!p,name:"Switch",state:"checked"});Be(F,j,v,void 0,!w,z),oe(()=>{d.current&&n(d.current.checked)},[n]),_e(v,()=>{T(o),_(v!==U.initialValue),n(v),R.change(v)});const{getButtonProps:$,buttonRef:X}=Te({disabled:w,native:m}),Z=Ye(c,K,d,!m,S),ee={id:m?A:j,role:"switch","aria-checked":v,"aria-readonly":I||void 0,"aria-required":P||void 0,"aria-labelledby":Z,onFocus(){w||g(!0)},onBlur(){const r=d.current;!r||w||(E(!0),g(!1),b==="onBlur"&&R.commit(r.checked))},onClick(r){if(I||w)return;r.preventDefault();const C=d.current;C&&Ve(C,r)}},ne={...R.getValidationProps(w),checked:v,disabled:w,form:h,id:S,name:o,required:P,style:o?qe:Ge,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:L,onChange(r){if(r.nativeEvent.defaultPrevented)return;if(I){r.preventDefault();return}const C=r.currentTarget.checked,Y=He(Ke,r.nativeEvent);B?.(C,Y),!Y.isCanceled&&W(C)},onClick(r){r.stopPropagation()},onFocus(){F.current?.focus()},...x!==void 0?{value:x}:de},te=i.useMemo(()=>({...H,checked:v,disabled:w,readOnly:I,required:P}),[H,v,w,I,P]),se=ie("span",a,{state:te,ref:[s,F,X],props:[ee,k,$,r=>R.getValidationProps(w,r)],stateAttributesMapping:Xe});return e.jsxs(Qe.Provider,{value:te,children:[se,!v&&o&&q!==void 0&&e.jsx("input",{type:"hidden",form:h,name:o,value:q,disabled:w}),e.jsx("input",{...ne,suppressHydrationWarning:!0})]})}),Ut=i.forwardRef(function(a,s){const{render:l,className:f,style:p,...c}=a,h=_t();return ie("span",a,{state:h,ref:s,stateAttributesMapping:Xe,props:c})});function $t({className:t,size:a="default",...s}){return e.jsx(Yt,{"data-slot":"switch","data-size":a,className:le("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",t),...s,children:e.jsx(Ut,{"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"})})}const Jt=[{id:"open",title:"Everyone on the site",note:"The toolbar appears for every visitor on the addresses above. Simplest for a staging URL nobody else knows."},{id:"link-required",title:"Only reviewers with a link",note:"You add a reviewer and send them their link. Use this when staging is publicly reachable, or when one reviewer needs revoking without shutting the whole site."}];function Rn(){const{site:t}=nt.useParams(),s=St().projects.find(u=>u.uid===t),l=ot(it.origins(t)),f=st(t),[p,c]=i.useState(null),h=u=>f.mutate(u,{onSuccess:()=>c(Date.now())});return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(wt,{title:"Settings",sub:s.name,actions:e.jsx(jt,{saving:f.isPending,savedAt:p})}),e.jsxs(pe,{title:"Site",description:"Its name, its ID for the tag, and where the widget may run.",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Q,{children:"Site ID"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"rounded-md bg-muted px-2.5 py-1.5 font-mono text-[12.5px] text-ink-soft",children:s.uid}),e.jsx(Ct,{text:s.uid,label:"Copy the site ID"})]})]}),e.jsx(Qt,{name:s.name,onSave:u=>h({name:u})}),e.jsx(Xt,{domain:l.data?.domain??null,loaded:l.isSuccess,onSave:u=>h({domain:u})}),e.jsx(Zt,{list:l.data?.origins??[],loaded:l.isSuccess,hasDomain:!!l.data?.domain,onChange:u=>h({origins:u})})]}),e.jsxs(pe,{title:"Widget",description:"Whether it runs, who the toolbar appears for, and the tag itself.",children:[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(Q,{htmlFor:"widget-on",className:"text-[13px] font-medium",children:"Widget on this site"}),e.jsx("p",{className:"m-0 mt-0.5 text-[12px] leading-normal text-muted-foreground",children:"Off hides the toolbar for everyone and refuses new comments. The tag can stay in the site's code."})]}),e.jsx($t,{id:"widget-on","aria-label":"Widget on this site",checked:s.status!=="paused",onCheckedChange:u=>h({status:u?"active":"paused"})})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(Q,{children:"Who can comment"}),e.jsx(qt,{value:s.writeMode,onValueChange:u=>h({writeMode:String(u)}),className:"gap-2",children:Jt.map(u=>e.jsxs("label",{className:le("flex cursor-pointer items-start gap-2.5 rounded-md border border-border px-3 py-2.5",s.writeMode===u.id&&"border-brand bg-brand-soft"),children:[e.jsx(Gt,{value:u.id,className:"mt-0.5","aria-label":u.title}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-[13px] font-medium",children:u.title}),e.jsx("span",{className:"block text-[12px] leading-normal text-muted-foreground",children:u.note})]})]},u.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Q,{children:"The tag"}),e.jsx(It,{uid:s.uid}),e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["Paste it before ",e.jsx("code",{className:"font-mono",children:"</body>"})," on every page you want reviewed."]})]})]}),e.jsx(en,{uid:t,name:s.name})]})}function Qt({name:t,onSave:a}){const[s,l]=i.useState(t);i.useEffect(()=>l(t),[t]);const f=s.trim().length>0&&s.trim()!==t;return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:p=>{p.preventDefault(),f&&a(s.trim())},children:[e.jsx(Q,{htmlFor:"site-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ye,{id:"site-name",value:s,onChange:p=>l(p.target.value)}),f&&e.jsx(ae,{type:"submit",variant:"outline",children:"Save"})]})]})}function Xt({domain:t,loaded:a,onSave:s}){const[l,f]=i.useState(t??"");i.useEffect(()=>f(t??""),[t]);const p=l.trim()!==(t??"");return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:c=>{c.preventDefault(),p&&s(l.trim()||null)},children:[e.jsx(Q,{htmlFor:"site-domain",children:"Domain"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ye,{id:"site-domain",placeholder:"kilnwork.studio",value:l,onChange:c=>f(c.target.value),disabled:!a}),p&&e.jsx(ae,{type:"submit",variant:"outline",children:l.trim()?"Save domain":"Clear domain"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Every subdomain, scheme and port of it may run the widget — staging, previews, and localhost while you build."})]})}function Zt({list:t,loaded:a,hasDomain:s,onChange:l}){const[f,p]=i.useState("");return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Q,{htmlFor:"site-origin-add",children:"Also allowed"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Exact addresses the domain does not cover — a client's other host, a preview on somebody else's suffix."}),e.jsxs("ul",{className:"m-0 flex list-none flex-col gap-1.5 p-0",children:[t.map(c=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"rounded-md border border-border px-2 py-1 font-mono text-[12px]",children:c}),e.jsx(ae,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`Remove ${c}`,disabled:t.length<=1&&!s,onClick:()=>l(t.filter(h=>h!==c)),children:e.jsx(xt,{})})]},c)),a&&t.length===0&&e.jsx("li",{className:"text-[12.5px] text-muted-foreground",children:s?"None besides the domain.":"No address yet."})]}),e.jsxs("form",{className:"flex gap-2",onSubmit:c=>{c.preventDefault();const h=f.trim();h&&(l([...t,h]),p(""))},children:[e.jsx(ye,{id:"site-origin-add",placeholder:"https://staging.example.com",value:f,onChange:c=>p(c.target.value)}),e.jsxs(ae,{type:"submit",variant:"outline",disabled:!f.trim(),children:[e.jsx(Nt,{}),"Add"]})]})]})}function en({uid:t,name:a}){const[s,l]=i.useState(!1),f=rt(),p=at(t);return e.jsxs(pe,{danger:!0,title:"Delete this site",description:e.jsxs(e.Fragment,{children:["The site stops appearing and its widget stops being served."," ",e.jsx("b",{className:"font-semibold text-foreground",children:"Nothing your client wrote is destroyed"})," — the comments stay in the database, so a mistake here is recoverable."]}),children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("p",{className:"m-0 flex-1 text-[13px] text-ink-soft",children:"You will be asked to type the site's name."}),e.jsxs(ae,{type:"button",variant:"outline",className:"border-destructive text-destructive",onClick:()=>l(!0),children:["Delete ",a,"…"]})]}),e.jsx(Rt,{open:s,onOpenChange:l,title:`Delete ${a}?`,description:"The site stops appearing and its widget stops being served. Nothing your client wrote is destroyed — the comments stay in the database.",confirmLabel:"Delete",confirmWord:a,busy:p.isPending,onConfirm:()=>p.mutate(void 0,{onSuccess:()=>{l(!1),f({to:"/sites"})}})})]})}export{Rn as component};
|
|
1
|
+
import{r as i,f as me,W as ce,X as ge,c as oe,V as Te,E as de,h as ie,j as e,Y as Ve,d as J,ao as we,au as tt,e as le,av as nt,aw as st,B as ae,n as rt,ax as at,x as it}from"./index-DG2IWFx-.js";import{u as ot}from"./useQuery-DuAHuwx9.js";import{f as xe,a as be,b as ve,d as Le,u as ze,c as Be,L as Q,I as ye}from"./label-Bombrpc6.js";import{u as ke,c as He,n as Ke,g as je,e as We,a as dt}from"./createBaseUIEventDetails-BWJgXhnd.js";import{O as lt,L as qe,M as Ge,N as ct,A as ut,aL as Se,ak as Ne,ad as ue,a9 as fe,aM as Pe,aN as Ee,ao as ft,aO as Me,aa as pt,ab as ht,aP as De,aQ as Fe,aR as Ae,aS as Oe,aT as mt,aU as gt,X as xt}from"./dialog-CgkCHO0g.js";import{c as bt,a as vt,C as yt,u as _e}from"./CompositeItem-CrOf38Oz.js";import{u as kt,a as Ye}from"./FieldItemContext-CFDZff0c.js";import{C as Rt}from"./ConfirmDialog-CfUnmf4e.js";import{C as Ct}from"./CopyButton-0ANrU8mS.js";import{I as It}from"./InstallTag-CFvRuiwX.js";import{P as wt,a as pe}from"./parts-B3hL1LIW.js";import{S as jt}from"./SaveState-RDbpfaEm.js";import{u as St}from"./me-Bno2H07j.js";import{P as Nt}from"./plus-CRLkl9fr.js";import"./useBaseQuery-Cyp8ADaN.js";import"./createLucideIcon-DwbZIZsa.js";import"./check-Yc6VFTfm.js";import"./copy-BjvQHEe0.js";import"./card-DxFqxFQf.js";import"./labels--UUyt9uB.js";const Pt=i.createContext(void 0);function Et(t=!1){const a=i.useContext(Pt);if(!a&&!t)throw new Error(me(86));return a}function Mt(t,a){return t.matches(":disabled")?!1:!a||t.form===a?!0:t.form===null&&!t.hasAttribute("form")}function Dt(t){return t==null||t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true"}const he={checked(t){return t?{"data-checked":""}:{"data-unchecked":""}},...lt,...xe},Ue="data-composite-item-active",$e=i.createContext(void 0);function Ft(){return i.useContext($e)}function At(t){if(t==null)return"";if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}const Je=i.createContext(void 0);function Ot(){const t=i.useContext(Je);if(t===void 0)throw new Error(me(52));return t}const Tt=i.forwardRef(function(a,s){const{render:l,className:f,disabled:p=!1,readOnly:c=!1,required:h=!1,"aria-labelledby":u,value:y,inputRef:z,nativeButton:m=!1,id:B,style:I,...P}=a,V=Ft(),{disabled:O,readOnly:q,required:x,form:G,checkedValue:k,touched:T=!1,validation:H,name:E,setCheckedValue:_=ce,setTouched:U=ce,registerInputRef:n=ce}=V??{},{setTouched:g,setFilled:b,state:M,disabled:D}=be(),R=kt(),{labelId:K,getDescriptionProps:w}=ve(),o=D||R.disabled||O||p,d=q||c,L=x||h,F=G,j=V?k===y:y==="",A=i.useRef(null),S=i.useRef(null),v=H?.registerInput,W=i.useCallback(N=>v?.(N,{controlRef:A,value:void 0}),[v]),$=ge(z,S,n,W);oe(()=>{S.current?.checked&&b(!0)},[b]),oe(()=>{if(S.current){if(o&&j){n(null);return}n(S.current)}},[j,o,n]);const X=ke(),Z=Le({id:B,implicit:!1,controlRef:A}),ee=m?void 0:Z,ne=Ye(u,K,S,!m,ee),te={role:"radio","aria-checked":j,"aria-labelledby":ne,[Ue]:j?"":void 0,id:m?Z:X,onKeyDown(N){N.key==="Enter"&&N.preventDefault()},onClick(N){if(N.defaultPrevented||o||d)return;N.preventDefault();const re=S.current;re&&Ve(re,N)},onFocus(N){N.defaultPrevented||o||d||!T||(S.current?.click(),U(!1))}},{getButtonProps:se,buttonRef:r}=Te({disabled:o,native:m,composite:!1}),C={type:"radio",ref:$,form:F,id:ee,name:E,tabIndex:-1,style:E?qe:Ge,"aria-hidden":!0,...y!==void 0?{value:At(y)}:de,disabled:o,checked:j,required:L,readOnly:d,onChange(N){if(N.nativeEvent.defaultPrevented||o||d||y===void 0)return;const re=He(Ke,N.nativeEvent);_(y,re),!re.isCanceled&&g(!0)},onClick(N){N.stopPropagation()},onFocus(){A.current?.focus()}},Y=i.useMemo(()=>({...M,required:L,disabled:o,readOnly:d,checked:j}),[M,o,d,j,L]),Ze=Y,Re=V!==void 0,Ce=[s,A,r],Ie=[te,P,se,w,H?N=>H.getValidationProps(o,N):de],et=ie("span",a,{enabled:!Re,state:Y,ref:Ce,props:Ie,stateAttributesMapping:he});return e.jsxs(Je.Provider,{value:Ze,children:[Re?e.jsx(bt,{tag:"span",render:l,className:f,style:I,state:Y,refs:Ce,props:Ie,stateAttributesMapping:he}):et,e.jsx("input",{...C,suppressHydrationWarning:!0})]})}),Vt=i.forwardRef(function(a,s){const{render:l,className:f,style:p,keepMounted:c=!1,...h}=a,u=Ot(),y=u.checked,{mounted:z,transitionStatus:m,setMounted:B}=ct(y),I={...u,transitionStatus:m},P=i.useRef(null),V=c||z,O=ie("span",a,{ref:[s,P],state:I,props:h,stateAttributesMapping:he});return ut({open:y,ref:P,onComplete(){y||B(!1)}}),V?O:null}),Lt=[];function zt(t){const{loopFocus:a=!0,orientation:s="both",grid:l,onLoop:f,direction:p,highlightedIndex:c,onHighlightedIndexChange:h,rootRef:u,enableHomeAndEndKeys:y=!1,stopEventPropagation:z,disabledIndices:m,modifierKeys:B=Lt}=t,[I,P]=i.useState(0),V=l!=null,O=i.useRef(null),q=ge(O,u),x=i.useRef([]),G=i.useRef(!1),k=c??I,T=J((n,g=!1)=>{if((h??P)(n),g){const b=x.current[n];Se(O.current,b,p,s)}}),H=J(n=>{if(n.size===0||G.current)return;G.current=!0;const g=Array.from(n.keys()),b=g.find(D=>D?.hasAttribute(Ue))??null,M=b?n.get(b)?.index??-1:-1;if(M!==-1)T(M);else if(Ne(g,k,m)){const D=ue(g,{disabledIndices:m});fe(g,D)||T(D)}Se(O.current,b,p,s)});oe(()=>{if(m==null||c!=null||!G.current)return;const n=x.current;if(Ne(n,k,m)){const g=ue(n,{disabledIndices:m});fe(n,g)||T(g)}},[m,c,k,x,T]);const E=J((n,g,b)=>f?f(n,g,b,x):b),_=J(n=>{const g=n.key===Pe||n.key===Ee;if(!ft.has(n.key)||!y&&g||Bt(n,B)||!O.current)return;const M=p==="rtl",D=M?Ae:Oe,R=M?Oe:Ae,K=s==="vertical"?De:D,w=s==="vertical"?Fe:R,o=je(n.nativeEvent);if(o!=null&&Me(o)&&!Dt(o)){const S=o.selectionStart,v=o.selectionEnd,W=o.value;if(S==null||n.shiftKey||S!==v||n.key!==w&&S<W.length||n.key!==K&&S>0)return}let d=k;const L=pt(x,m),F=ht(x,m);l!=null&&(d=l({disabledIndices:m,elementsRef:x,event:n,highlightedIndex:k,loopFocus:a,maxIndex:F,minIndex:L,onLoop:E,orientation:s,rtl:M}));const j=s!=="vertical"&&n.key===D||s!=="horizontal"&&n.key===De,A=s!=="vertical"&&n.key===R||s!=="horizontal"&&n.key===Fe;y&&(n.key===Pe?d=L:n.key===Ee&&(d=F)),d===k&&(j||A)&&(a&&d===F&&j?(d=L,f&&(d=f(n,k,d,x))):a&&d===L&&A?(d=F,f&&(d=f(n,k,d,x))):d=ue(x.current,{startingIndex:d,decrement:A,disabledIndices:m})),d!==k&&!fe(x.current,d)&&(z&&n.stopPropagation(),(V||g||j||A)&&n.preventDefault(),T(d,!0),queueMicrotask(()=>{x.current[d]?.focus()}))});return{props:{ref:q,onFocus(n){const g=O.current,b=je(n.nativeEvent);!g||b==null||!Me(b)||b.setSelectionRange(0,b.value.length)},onKeyDown:_},highlightedIndex:k,onHighlightedIndexChange:T,elementsRef:x,onMapChange:H,relayKeyboardEvent:_}}function Bt(t,a){for(const s of mt)if(!a.includes(s)&&t.getModifierState(s))return!0;return!1}function Ht(t){const{render:a,className:s,style:l,refs:f=we,props:p=we,state:c=de,stateAttributesMapping:h,highlightedIndex:u,onHighlightedIndexChange:y,orientation:z,grid:m,loopFocus:B,onLoop:I,enableHomeAndEndKeys:P,onMapChange:V,stopEventPropagation:O=!0,rootRef:q,disabledIndices:x,modifierKeys:G,highlightItemOnHover:k=!1,tag:T="div",...H}=t,E=vt(),{props:_,highlightedIndex:U,onHighlightedIndexChange:n,elementsRef:g,onMapChange:b,relayKeyboardEvent:M}=zt({grid:m,loopFocus:B,onLoop:I,orientation:z,highlightedIndex:u,onHighlightedIndexChange:y,rootRef:q,stopEventPropagation:O,enableHomeAndEndKeys:P,direction:E,disabledIndices:x,modifierKeys:G}),D=ie(T,t,{state:c,ref:f,props:[_,...p,H],stateAttributesMapping:h}),R=i.useMemo(()=>({highlightedIndex:U,onHighlightedIndexChange:n,highlightItemOnHover:k,relayKeyboardEvent:M}),[U,n,k,M]);return e.jsx(tt.Provider,{value:R,children:e.jsx(yt,{elementsRef:g,onMapChange:K=>{V?.(K),b(K)},children:D})})}const Kt=[gt],Wt=i.forwardRef(function(a,s){const{render:l,className:f,disabled:p,readOnly:c,required:h,onValueChange:u,value:y,defaultValue:z,form:m,name:B,inputRef:I,id:P,style:V,...O}=a,{setTouched:q,setFocused:x,validationMode:G,name:k,disabled:T,state:H,validation:E,setDirty:_,setFilled:U,validityData:n}=be(),{labelId:g}=ve(),{clearErrors:b,elementRef:M}=ze(),D=Et(!0),R=T||p,K=k??B,w=ke(P),[o,d]=We({controlled:y,default:z,name:"RadioGroup",state:"value"}),[L,F]=i.useState(!1),j=J((r,C)=>{u?.(r,C),!C.isCanceled&&d(r)}),A=E.getInputControl,S=i.useMemo(()=>({get current(){return A()}}),[A]),v=i.useRef(null),W=i.useRef(null);function $(r){let C;return I&&(typeof I=="function"?C=I(r):I.current=r),v.current=r,C}const X=J(r=>{if(!r||r.disabled)return;W.current||(W.current=r);const C=v.current,Y=r.checked||C==null||C.disabled?$(r):void 0;return()=>{W.current===r&&(W.current=null),v.current===r?Y?(Y(),v.current=null):$(null):Y?.()}}),Z=J(()=>{const r=M.current;if(!r)return o??null;for(const C of E.registeredInputs.keys())if(C.checked&&Mt(C,r))return o??null;return null});Be(S,w,o??null,Z,!R,B),_e(o,()=>{b(K),_(o!==n.initialValue),U(o!=null),E.change(o);const r=W.current;o==null&&r&&!r.disabled&&$(r)});const ee=g??D?.legendId,ne={...H,disabled:R??!1,required:h??!1,readOnly:c??!1},te=i.useMemo(()=>({checkedValue:o,disabled:R,form:m,validation:E,name:K,readOnly:c,registerInputRef:X,required:h,setCheckedValue:j,setTouched:F,touched:L}),[o,R,m,E,K,c,X,h,j,F,L]),se={id:P,role:"radiogroup","aria-required":h||void 0,"aria-disabled":R||void 0,"aria-readonly":c||void 0,"aria-labelledby":ee,onFocus(){x(!0)},onBlur(r){dt(r.currentTarget,r.relatedTarget)||(q(!0),x(!1),G==="onBlur"&&E.commit(o))},onKeyDownCapture(r){r.key.startsWith("Arrow")&&(F(!0),x(!0))}};return e.jsx($e.Provider,{value:te,children:e.jsx(Ht,{render:l,className:f,style:V,state:ne,props:[se,O,r=>E.getValidationProps(R??!1,r)],refs:[s],stateAttributesMapping:xe,enableHomeAndEndKeys:!1,modifierKeys:Kt})})});function qt({className:t,...a}){return e.jsx(Wt,{"data-slot":"radio-group",className:le("grid w-full gap-2",t),...a})}function Gt({className:t,...a}){return e.jsx(Tt,{"data-slot":"radio-group-item",className:le("group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary",t),...a,children:e.jsx(Vt,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:e.jsx("span",{className:"absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground"})})})}const Qe=i.createContext(void 0);function _t(){const t=i.useContext(Qe);if(t===void 0)throw new Error(me(63));return t}const Xe={...xe,checked(t){return t?{"data-checked":""}:{"data-unchecked":""}}},Yt=i.forwardRef(function(a,s){const{checked:l,className:f,defaultChecked:p,"aria-labelledby":c,form:h,id:u,inputRef:y,name:z,nativeButton:m=!1,onCheckedChange:B,readOnly:I=!1,required:P=!1,disabled:V=!1,render:O,uncheckedValue:q,value:x,style:G,...k}=a,{clearErrors:T}=ze(),{state:H,setTouched:E,setDirty:_,validityData:U,setFilled:n,setFocused:g,validationMode:b,disabled:M,name:D,validation:R}=be(),{labelId:K}=ve(),w=M||V,o=D??z,d=i.useRef(null),L=ge(d,y,R.inputRef),F=i.useRef(null),j=ke(),A=Le({id:u,implicit:!1,controlRef:F}),S=m?void 0:A,[v,W]=We({controlled:l,default:!!p,name:"Switch",state:"checked"});Be(F,j,v,void 0,!w,z),oe(()=>{d.current&&n(d.current.checked)},[n]),_e(v,()=>{T(o),_(v!==U.initialValue),n(v),R.change(v)});const{getButtonProps:$,buttonRef:X}=Te({disabled:w,native:m}),Z=Ye(c,K,d,!m,S),ee={id:m?A:j,role:"switch","aria-checked":v,"aria-readonly":I||void 0,"aria-required":P||void 0,"aria-labelledby":Z,onFocus(){w||g(!0)},onBlur(){const r=d.current;!r||w||(E(!0),g(!1),b==="onBlur"&&R.commit(r.checked))},onClick(r){if(I||w)return;r.preventDefault();const C=d.current;C&&Ve(C,r)}},ne={...R.getValidationProps(w),checked:v,disabled:w,form:h,id:S,name:o,required:P,style:o?qe:Ge,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:L,onChange(r){if(r.nativeEvent.defaultPrevented)return;if(I){r.preventDefault();return}const C=r.currentTarget.checked,Y=He(Ke,r.nativeEvent);B?.(C,Y),!Y.isCanceled&&W(C)},onClick(r){r.stopPropagation()},onFocus(){F.current?.focus()},...x!==void 0?{value:x}:de},te=i.useMemo(()=>({...H,checked:v,disabled:w,readOnly:I,required:P}),[H,v,w,I,P]),se=ie("span",a,{state:te,ref:[s,F,X],props:[ee,k,$,r=>R.getValidationProps(w,r)],stateAttributesMapping:Xe});return e.jsxs(Qe.Provider,{value:te,children:[se,!v&&o&&q!==void 0&&e.jsx("input",{type:"hidden",form:h,name:o,value:q,disabled:w}),e.jsx("input",{...ne,suppressHydrationWarning:!0})]})}),Ut=i.forwardRef(function(a,s){const{render:l,className:f,style:p,...c}=a,h=_t();return ie("span",a,{state:h,ref:s,stateAttributesMapping:Xe,props:c})});function $t({className:t,size:a="default",...s}){return e.jsx(Yt,{"data-slot":"switch","data-size":a,className:le("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",t),...s,children:e.jsx(Ut,{"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"})})}const Jt=[{id:"open",title:"Everyone on the site",note:"The toolbar appears for every visitor on the addresses above. Simplest for a staging URL nobody else knows."},{id:"link-required",title:"Only reviewers with a link",note:"You add a reviewer and send them their link. Use this when staging is publicly reachable, or when one reviewer needs revoking without shutting the whole site."}];function Rn(){const{site:t}=nt.useParams(),s=St().projects.find(u=>u.uid===t),l=ot(it.origins(t)),f=st(t),[p,c]=i.useState(null),h=u=>f.mutate(u,{onSuccess:()=>c(Date.now())});return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(wt,{title:"Settings",sub:s.name,actions:e.jsx(jt,{saving:f.isPending,savedAt:p})}),e.jsxs(pe,{title:"Site",description:"Its name, its ID for the tag, and where the widget may run.",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Q,{children:"Site ID"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"rounded-md bg-muted px-2.5 py-1.5 font-mono text-[12.5px] text-ink-soft",children:s.uid}),e.jsx(Ct,{text:s.uid,label:"Copy the site ID"})]})]}),e.jsx(Qt,{name:s.name,onSave:u=>h({name:u})}),e.jsx(Xt,{domain:l.data?.domain??null,loaded:l.isSuccess,onSave:u=>h({domain:u})}),e.jsx(Zt,{list:l.data?.origins??[],loaded:l.isSuccess,hasDomain:!!l.data?.domain,onChange:u=>h({origins:u})})]}),e.jsxs(pe,{title:"Widget",description:"Whether it runs, who the toolbar appears for, and the tag itself.",children:[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(Q,{htmlFor:"widget-on",className:"text-[13px] font-medium",children:"Widget on this site"}),e.jsx("p",{className:"m-0 mt-0.5 text-[12px] leading-normal text-muted-foreground",children:"Off hides the toolbar for everyone and refuses new comments. The tag can stay in the site's code."})]}),e.jsx($t,{id:"widget-on","aria-label":"Widget on this site",checked:s.status!=="paused",onCheckedChange:u=>h({status:u?"active":"paused"})})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(Q,{children:"Who can comment"}),e.jsx(qt,{value:s.writeMode,onValueChange:u=>h({writeMode:String(u)}),className:"gap-2",children:Jt.map(u=>e.jsxs("label",{className:le("flex cursor-pointer items-start gap-2.5 rounded-md border border-border px-3 py-2.5",s.writeMode===u.id&&"border-brand bg-brand-soft"),children:[e.jsx(Gt,{value:u.id,className:"mt-0.5","aria-label":u.title}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-[13px] font-medium",children:u.title}),e.jsx("span",{className:"block text-[12px] leading-normal text-muted-foreground",children:u.note})]})]},u.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Q,{children:"The tag"}),e.jsx(It,{uid:s.uid}),e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["Paste it before ",e.jsx("code",{className:"font-mono",children:"</body>"})," on every page you want reviewed."]})]})]}),e.jsx(en,{uid:t,name:s.name})]})}function Qt({name:t,onSave:a}){const[s,l]=i.useState(t);i.useEffect(()=>l(t),[t]);const f=s.trim().length>0&&s.trim()!==t;return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:p=>{p.preventDefault(),f&&a(s.trim())},children:[e.jsx(Q,{htmlFor:"site-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ye,{id:"site-name",value:s,onChange:p=>l(p.target.value)}),f&&e.jsx(ae,{type:"submit",variant:"outline",children:"Save"})]})]})}function Xt({domain:t,loaded:a,onSave:s}){const[l,f]=i.useState(t??"");i.useEffect(()=>f(t??""),[t]);const p=l.trim()!==(t??"");return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:c=>{c.preventDefault(),p&&s(l.trim()||null)},children:[e.jsx(Q,{htmlFor:"site-domain",children:"Domain"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ye,{id:"site-domain",placeholder:"kilnwork.studio",value:l,onChange:c=>f(c.target.value),disabled:!a}),p&&e.jsx(ae,{type:"submit",variant:"outline",children:l.trim()?"Save domain":"Clear domain"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Every subdomain, scheme and port of it may run the widget — staging, previews, and localhost while you build."})]})}function Zt({list:t,loaded:a,hasDomain:s,onChange:l}){const[f,p]=i.useState("");return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Q,{htmlFor:"site-origin-add",children:"Also allowed"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Exact addresses the domain does not cover — a client's other host, a preview on somebody else's suffix."}),e.jsxs("ul",{className:"m-0 flex list-none flex-col gap-1.5 p-0",children:[t.map(c=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"rounded-md border border-border px-2 py-1 font-mono text-[12px]",children:c}),e.jsx(ae,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`Remove ${c}`,disabled:t.length<=1&&!s,onClick:()=>l(t.filter(h=>h!==c)),children:e.jsx(xt,{})})]},c)),a&&t.length===0&&e.jsx("li",{className:"text-[12.5px] text-muted-foreground",children:s?"None besides the domain.":"No address yet."})]}),e.jsxs("form",{className:"flex gap-2",onSubmit:c=>{c.preventDefault();const h=f.trim();h&&(l([...t,h]),p(""))},children:[e.jsx(ye,{id:"site-origin-add",placeholder:"https://staging.example.com",value:f,onChange:c=>p(c.target.value)}),e.jsxs(ae,{type:"submit",variant:"outline",disabled:!f.trim(),children:[e.jsx(Nt,{}),"Add"]})]})]})}function en({uid:t,name:a}){const[s,l]=i.useState(!1),f=rt(),p=at(t);return e.jsxs(pe,{danger:!0,title:"Delete this site",description:e.jsxs(e.Fragment,{children:["The site stops appearing and its widget stops being served."," ",e.jsx("b",{className:"font-semibold text-foreground",children:"Nothing your client wrote is destroyed"})," — the comments stay in the database, so a mistake here is recoverable."]}),children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("p",{className:"m-0 flex-1 text-[13px] text-ink-soft",children:"You will be asked to type the site's name."}),e.jsxs(ae,{type:"button",variant:"outline",className:"border-destructive text-destructive",onClick:()=>l(!0),children:["Delete ",a,"…"]})]}),e.jsx(Rt,{open:s,onOpenChange:l,title:`Delete ${a}?`,description:"The site stops appearing and its widget stops being served. Nothing your client wrote is destroyed — the comments stay in the database.",confirmLabel:"Delete",confirmWord:a,busy:p.isPending,onConfirm:()=>p.mutate(void 0,{onSuccess:()=>{l(!1),f({to:"/sites"})}})})]})}export{Rn as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{R as x,n as h,r as g,o as f,w as j,y as w,A as N,j as e,G as y,B as b,z as S,C as r}from"./index-DG2IWFx-.js";import{u as v,a as A}from"./zod-qEjeM9Eg.js";import{L as o,I as i}from"./label-Bombrpc6.js";import"./createBaseUIEventDetails-BWJgXhnd.js";const C=S({email:r().trim().email("An email address"),password:r().min(12,"At least 12 characters"),orgName:r().trim().max(120).optional()});function R(){const{claim:d}=x.useSearch(),c=h(),[l,n]=g.useState(""),{register:a,handleSubmit:p,formState:s}=v({resolver:A(C)}),u=p(async t=>{n("");try{await f.setup({token:d??"",orgName:t.orgName||"My studio",projectName:"",email:t.email,password:t.password,address:location.origin}),j("in"),w.clear(),c({to:"/welcome",replace:!0})}catch(m){n(m instanceof N?m.message:"Something went wrong. Try again.")}});return e.jsx(y,{width:400,children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Set up Snagset"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"This instance has not been claimed yet. The account you make here is the only one, until you add another."})]}),l&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:l}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(o,{htmlFor:"email",children:"Your email"}),e.jsx(i,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!s.errors.email,...a("email")}),s.errors.email&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:s.errors.email.message})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(o,{htmlFor:"password",children:"Password"}),e.jsx(i,{id:"password",type:"password",autoComplete:"new-password","aria-invalid":!!s.errors.password,...a("password")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. There is no reset email on a fresh install — keep it."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(o,{htmlFor:"orgName",children:["Studio name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(i,{id:"orgName",placeholder:"My studio",...a("orgName")})]}),e.jsx(b,{type:"submit",size:"lg",disabled:s.isSubmitting,children:s.isSubmitting?"Setting up…":"Create my account"})]})})}export{R as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as b,n as j,r as l,x as v,o as w,w as y,A as N,j as e,G as S,B as C,e as k,z as E,C as d}from"./index-
|
|
1
|
+
import{D as b,n as j,r as l,x as v,o as w,w as y,A as N,j as e,G as S,B as C,e as k,z as E,C as d}from"./index-DG2IWFx-.js";import{u as F}from"./useQuery-DuAHuwx9.js";import{u as R,a as z}from"./zod-qEjeM9Eg.js";import{L as m,I as c}from"./label-Bombrpc6.js";import{C as A}from"./chevron-right-Go23FN_b.js";import"./useBaseQuery-Cyp8ADaN.js";import"./createBaseUIEventDetails-BWJgXhnd.js";import"./createLucideIcon-DwbZIZsa.js";const I=E({email:d().trim().min(1,"Your email"),password:d().min(1,"Your password")});function Q(){const{redirect:p}=b.useSearch(),t=j(),[a,o]=l.useState(""),[s,u]=l.useState(!1),{register:i,handleSubmit:x,formState:r}=R({resolver:z(I)});F({...v.claimed(),enabled:!0}).data===!1&&t({to:"/setup",replace:!0});const h=x(async({email:f,password:g})=>{o("");try{await w.login(f,g),y("in"),t({to:p??"/sites",replace:!0})}catch(n){o(n instanceof N?n.message:"Could not reach the server.")}});return e.jsx(S,{children:e.jsxs("form",{onSubmit:h,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Sign in"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"The studio side. Reviewers don't sign in — they open a link."})]}),a&&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:a}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(m,{htmlFor:"email",children:"Email"}),e.jsx(c,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!r.errors.email,...i("email")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(m,{htmlFor:"password",children:"Password"}),e.jsx(c,{id:"password",type:"password",autoComplete:"current-password","aria-invalid":!!r.errors.password,...i("password")})]}),e.jsx(C,{type:"submit",size:"lg",disabled:r.isSubmitting,children:r.isSubmitting?"Signing in…":"Sign in"}),e.jsxs("button",{type:"button",className:"flex items-center gap-2 rounded-md border border-border px-3 py-2 text-left text-[13px] text-ink-soft","aria-expanded":s,onClick:()=>u(!s),children:[e.jsx(A,{className:k("size-3.5 text-muted-foreground transition-transform",s&&"rotate-90")}),"Forgot your password?"]}),s&&e.jsxs("div",{className:"flex flex-col gap-2 text-[12.5px] leading-relaxed text-muted-foreground",children:[e.jsx("p",{className:"m-0",children:"There's no reset email — a fresh install has no mail set up, and whoever has a shell on the server already holds more authority than a reset link would grant. From that machine:"}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md border border-border bg-card px-3 py-2 font-mono text-[12px] text-foreground",children:e.jsx("code",{children:`printf '%s' "$NEW" | snagset passwd you@example.com`})}),e.jsx("p",{className:"m-0",children:"Every existing session for that account is signed out when it runs."})]})]})})}export{Q as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{K as v,r as m,j as e,B as l,L as N,n as y,s as w,o as A,A as S,z as k,C as u}from"./index-
|
|
1
|
+
import{K as v,r as m,j as e,B as l,L as N,n as y,s as w,o as A,A as S,z as k,C as u}from"./index-DG2IWFx-.js";import{u as C,a as _}from"./zod-qEjeM9Eg.js";import{C as E}from"./card-DxFqxFQf.js";import{E as $,G as D,I,H as L,J as P,K as z}from"./dialog-CgkCHO0g.js";import{L as p,I as h}from"./label-Bombrpc6.js";import{P as F,E as K}from"./parts-B3hL1LIW.js";import{b as H}from"./labels--UUyt9uB.js";import{u as q}from"./me-Bno2H07j.js";import{P as g}from"./plus-CRLkl9fr.js";import{L as B}from"./layout-grid-Dj0cm_PO.js";import{I as G}from"./image-off-ByN_ZOK_.js";import"./createLucideIcon-DwbZIZsa.js";import"./createBaseUIEventDetails-BWJgXhnd.js";import"./useBaseQuery-Cyp8ADaN.js";function re(){const t=q(),{add:i}=v.useSearch(),[c,r]=m.useState(!!i);m.useEffect(()=>{i&&r(!0)},[i]);const a=t.projects.reduce((s,o)=>s+o.unresolved,0);return e.jsxs("div",{className:"p-7",children:[e.jsx(F,{title:"Sites",sub:t.projects.length?`${t.projects.length} site${t.projects.length===1?"":"s"} · ${a} open`:void 0,actions:e.jsxs(l,{onClick:()=>r(!0),children:[e.jsx(g,{}),"Add a site"]})}),t.projects.length===0?e.jsx(E,{className:"max-w-[1100px]",children:e.jsx(K,{icon:e.jsx(B,{className:"size-5"}),title:"No sites yet",action:e.jsxs(l,{onClick:()=>r(!0),children:[e.jsx(g,{}),"Add a site"]}),children:"A site is one client website. Add it, paste the tag, and comments start arriving here."})}):e.jsx("div",{className:"grid max-w-[1100px] grid-cols-1 gap-5 md:grid-cols-2 xl:grid-cols-3",children:t.projects.map(s=>e.jsxs(N,{to:"/s/$site/comments",params:{site:s.uid},className:"block overflow-hidden rounded-lg border border-border bg-card text-foreground transition-shadow hover:shadow-[0_1px_2px_rgb(24_23_22/.06),0_8px_24px_rgb(24_23_22/.08)]",children:[e.jsx("div",{className:"flex h-[150px] items-center justify-center border-b border-border bg-background",children:s.previewUrl?e.jsx("img",{src:s.previewUrl,alt:"",className:"size-full object-cover object-top"}):e.jsxs("div",{className:"flex flex-col items-center gap-1 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"flex size-8 items-center justify-center rounded-md bg-muted",children:e.jsx(G,{className:"size-4"})}),"No screenshot yet"]})}),e.jsxs("div",{className:"px-3.5 pb-3.5 pt-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[14px] font-semibold",children:[e.jsx("span",{className:"truncate",children:s.name}),s.status==="paused"&&e.jsx("span",{className:"rounded-sm bg-muted px-1.5 py-px text-[10.5px] font-medium uppercase tracking-wide text-muted-foreground",children:"Paused"})]}),s.domain&&e.jsx("div",{className:"mt-0.5 truncate font-mono text-[12px] text-muted-foreground",children:s.domain}),e.jsx("div",{className:"mt-2 text-[12.5px] text-ink-soft",children:s.threads===0?"Nothing filed yet":`${s.unresolved} open of ${s.threads}${s.lastActivityAt?` · ${H(s.lastActivityAt)}`:""}`})]})]},s.uid))}),e.jsx(R,{open:c,onOpenChange:r})]})}const Q=k({name:u().trim().min(1,"A name"),domain:u().trim().min(1,"Its domain")});function R({open:t,onOpenChange:i}){const c=y(),r=w(),[a,s]=m.useState(""),{register:o,handleSubmit:j,formState:n,reset:f}=C({resolver:_(Q)}),b=j(async x=>{s("");try{const d=await A.createProject(x.name,"",x.domain);await r.invalidateQueries({queryKey:["me"]}),f(),i(!1),c({to:"/s/$site/comments",params:{site:d.uid}})}catch(d){s(d instanceof S?d.message:"Could not add the site.")}});return e.jsx($,{open:t,onOpenChange:i,children:e.jsx(D,{children:e.jsxs("form",{onSubmit:b,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(I,{children:[e.jsx(L,{children:"Add a site"}),e.jsx(P,{children:"One client website. The tag it needs is shown right after."})]}),a&&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:a}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(p,{htmlFor:"site-name",children:"Name"}),e.jsx(h,{id:"site-name",placeholder:"Kilnwork","aria-invalid":!!n.errors.name,...o("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(p,{htmlFor:"site-domain",children:"Domain"}),e.jsx(h,{id:"site-domain",placeholder:"kilnwork.studio","aria-invalid":!!n.errors.domain,...o("domain")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Every subdomain, scheme and port of it may run the widget — staging, previews, and localhost while you build. Exact addresses elsewhere can be added in Settings."})]}),e.jsxs(z,{children:[e.jsx(l,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(l,{type:"submit",disabled:n.isSubmitting,children:n.isSubmitting?"Adding…":"Add site"})]})]})})})}export{re as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as y,x as n,P as u,o,Q as i,N as c}from"./index-
|
|
1
|
+
import{s as y,x as n,P as u,o,Q as i,N as c}from"./index-DG2IWFx-.js";function d(){const e=y(),r=n.me().queryKey;return u({mutationFn:a=>o.renameOrg(a),onMutate:async a=>{await e.cancelQueries({queryKey:r});const t=e.getQueryData(r);return t&&e.setQueryData(r,{...t,org:{...t.org,name:a}}),{was:t}},onError:(a,t,s)=>{s?.was&&e.setQueryData(r,s.was),i.error(c(a))},onSettled:()=>e.invalidateQueries({queryKey:r})})}function q(){const e=y(),r=n.me().queryKey;return u({mutationFn:a=>o.renameMe(a),onMutate:async a=>{await e.cancelQueries({queryKey:r});const t=e.getQueryData(r);return t&&e.setQueryData(r,{...t,user:{...t.user,name:a}}),{was:t}},onError:(a,t,s)=>{s?.was&&e.setQueryData(r,s.was),i.error(c(a))},onSettled:()=>{e.invalidateQueries({queryKey:r}),e.invalidateQueries({queryKey:n.members().queryKey})}})}function f(){return u({mutationFn:e=>o.changePassword(e.current,e.next)})}function l(){const e=y();return u({mutationFn:r=>o.addMember(r),onSuccess:r=>e.setQueryData(n.members().queryKey,r)})}function w(){const e=y(),r=n.members().queryKey;return u({mutationFn:a=>o.setMemberRole(a.email,a.role),onMutate:async({email:a,role:t})=>{await e.cancelQueries({queryKey:r});const s=e.getQueryData(r);return s&&e.setQueryData(r,{data:s.data.map(m=>m.email===a?{...m,role:t}:m)}),{was:s}},onSuccess:(a,{email:t})=>{e.setQueryData(r,a),a.data.find(s=>s.email===t)?.you&&e.invalidateQueries({queryKey:n.me().queryKey})},onError:(a,t,s)=>{s?.was&&e.setQueryData(r,s.was),i.error(c(a))}})}function D(){const e=y(),r=n.members().queryKey;return u({mutationFn:a=>o.removeMember(a),onMutate:async a=>{await e.cancelQueries({queryKey:r});const t=e.getQueryData(r);return t&&e.setQueryData(r,{data:t.data.filter(s=>s.email!==a)}),{was:t}},onSuccess:a=>e.setQueryData(r,a),onError:(a,t,s)=>{s?.was&&e.setQueryData(r,s.was),i.error(c(a))}})}export{f as a,d as b,w as c,D as d,l as e,q as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,O as o}from"./index-DG2IWFx-.js";const n=()=>t.jsx(o,{});export{n as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as E,r as x,P as v,o as y,Q as b,N,j as e,B as g,x as S,A as R}from"./index-DG2IWFx-.js";import{u as C}from"./useQuery-DuAHuwx9.js";import{L as w,I as k}from"./label-Bombrpc6.js";import{E as K,G as M,I as T,H as $,J as I,K as U}from"./dialog-CgkCHO0g.js";import{C as B}from"./ConfirmDialog-CfUnmf4e.js";import{a as A,P as L}from"./parts-B3hL1LIW.js";import{b as D}from"./labels--UUyt9uB.js";import{S as z}from"./SaveState-RDbpfaEm.js";import{u as _}from"./me-Bno2H07j.js";import{b as O}from"./studio-BIDpGywS.js";import{c as G}from"./update-duXzIzFS.js";import"./useBaseQuery-Cyp8ADaN.js";import"./createBaseUIEventDetails-BWJgXhnd.js";import"./createLucideIcon-DwbZIZsa.js";import"./card-DxFqxFQf.js";function q({owner:n}){const s=C(S.instance()),h=E(),t=()=>h.invalidateQueries({queryKey:S.instance().queryKey}),[i,c]=x.useState(!1),[p,m]=x.useState(!1),[l,d]=x.useState(null),a=v({mutationFn:y.disconnectStorage,onSuccess:()=>void t(),onError:j=>b.error(N(j))}),r=v({mutationFn:y.disconnectMail,onSuccess:()=>void t(),onError:j=>b.error(N(j))}),f=v({mutationFn:y.testMail,onSuccess:j=>b.success(`Sent to ${j.to}`),onError:j=>b.error(N(j))}),u=s.data?.storage,o=s.data?.mail;return e.jsxs(e.Fragment,{children:[e.jsxs(A,{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…"}),u&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(F,{tone:u.connected?"ok":u.unreadable?"bad":"off",text:u.connected?`Connected · ${u.bucket} at ${(u.endpoint??"").replace(/^https?:\/\//,"")}${u.connectedAt?` · since ${D(u.connectedAt)}`:""}`:u.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."}),u.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:()=>c(!0),children:u.connected||u.unreadable?"Replace…":"Connect a bucket…"}),(u.connected||u.unreadable)&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>d("storage"),children:"Disconnect"})]}):null]})]}),e.jsx(A,{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(F,{tone:o.configured?"ok":o.unreadable?"bad":"off",text:o.configured?`${o.scheme==="resend"?"Resend":`SMTP · ${o.host??""}`} · from ${o.from}${o.updatedAt?` · since ${D(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:()=>m(!0),children:o.configured||o.unreadable?"Replace…":"Connect a transport…"}),o.configured&&e.jsx(g,{variant:"outline",size:"sm",disabled: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:()=>d("mail"),children:"Disconnect"})]}):(o.configured&&n===!1,null)]})}),e.jsx(Q,{open:i,onOpenChange:c,onDone:()=>void t()}),e.jsx(H,{open:p,onOpenChange:m,onDone:()=>void t()}),e.jsx(B,{open:l!==null,onOpenChange:j=>!j&&d(null),title:l==="storage"?"Disconnect the bucket?":"Disconnect the mail transport?",description:l==="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()=>{l==="storage"?await a.mutateAsync():await r.mutateAsync(),d(null)}})]})}function F({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 Q({open:n,onOpenChange:s,onDone:h}){const[t,i]=x.useState({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),[c,p]=x.useState(""),m=v({mutationFn:y.connectStorage}),l=r=>f=>i({...t,[r]:f.target.value}),d=async r=>{r.preventDefault(),p("");try{await m.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()}:{}}),i({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),s(!1),h(),b.success("Bucket connected — screenshots are on")}catch(f){p(f instanceof R?f.message:"Could not reach the server.")}},a=(r,f,u,o="text",j)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(w,{htmlFor:`st-${r}`,children:f}),e.jsx(k,{id:`st-${r}`,type:o,placeholder:u,value:t[r],onChange:l(r),autoComplete:"off"}),j&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:j})]});return e.jsx(K,{open:n,onOpenChange:s,children:e.jsx(M,{children:e.jsxs("form",{onSubmit:r=>void d(r),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(T,{children:[e.jsx($,{children:"Connect a bucket"}),e.jsx(I,{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."})]}),c&&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:c}),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(U,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(g,{type:"submit",disabled:m.isPending,children:m.isPending?"Probing…":"Connect"})]})]})})})}function H({open:n,onOpenChange:s,onDone:h}){const[t,i]=x.useState(""),[c,p]=x.useState(""),[m,l]=x.useState(""),d=v({mutationFn:y.connectMail}),a=async r=>{r.preventDefault(),l("");try{await d.mutateAsync({url:t.trim(),from:c.trim()}),i(""),p(""),s(!1),h(),b.success("Transport connected — send a test email to be sure")}catch(f){l(f instanceof R?f.message:"Could not reach the server.")}};return e.jsx(K,{open:n,onOpenChange:s,children:e.jsx(M,{children:e.jsxs("form",{onSubmit:r=>void a(r),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(T,{children:[e.jsx($,{children:"Connect a mail transport"}),e.jsx(I,{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."})]}),m&&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:m}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(w,{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=>i(r.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(w,{htmlFor:"mail-from",children:"From"}),e.jsx(k,{id:"mail-from",placeholder:"Snagset <review@kilnwork.studio>",value:c,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(U,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(g,{type:"submit",disabled:d.isPending||!t.trim()||!c.trim(),children:d.isPending?"Saving…":"Connect"})]})]})})})}function ue(){const n=_(),s=C(S.meta()),h=C(S.members()),t=O(),i=n.user.role==="owner",[c,p]=x.useState(n.org.name),[m,l]=x.useState(null);x.useEffect(()=>p(n.org.name),[n.org.name]);const d=i&&c.trim().length>0&&c.trim()!==n.org.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(L,{title:"General",sub:n.org.name,actions:e.jsx(z,{saving:t.isPending,savedAt:m})}),e.jsx(A,{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(),d&&t.mutate(c.trim(),{onSuccess:()=>l(Date.now())})},children:[e.jsx(w,{htmlFor:"studio-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(k,{id:"studio-name",value:c,readOnly:!i,onChange:a=>p(a.target.value)}),d&&e.jsx(g,{type:"submit",variant:"outline",children:"Save"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:i?"Shown at the top of the sidebar, above every site.":"Only an owner can change it."})]})}),e.jsx(A,{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(V,{version:s.data?.version??""})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Address"}),e.jsx("dd",{className:"m-0",children:e.jsx(W,{owner:i})}),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," · ",h.data?.data.length??"—"]})]})}),e.jsx(q,{owner:i})]})}function V({version:n}){const[s,h]=x.useState({s:"idle"});return s.s==="idle"?e.jsxs(e.Fragment,{children:["·"," ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>{h({s:"checking"}),G(n).then(t=>h({s:"done",r:t})).catch(()=>h({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.jsx("span",{className:"text-muted-foreground",children:"· 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 W({owner:n}){const s=E(),h=C(S.instance()),[t,i]=x.useState(null),[c,p]=x.useState(""),m=v({mutationFn:a=>y.setAddress(a),onSuccess:a=>{s.setQueryData(S.instance().queryKey,a),i(null),p(""),b.success("Address saved — every new link is built from it")},onError:a=>p(N(a))}),l=h.data?.address;if(!l)return e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:location.origin});const d=l.source==="env";return t===null||!n||d?e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:l.url}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:d?"· set by the environment (SNAGSET_BASE_URL)":l.source==="stored"?"· set at claim; every link is built from it":"· this machine's default"}),n&&!d&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>i(l.url),children:"Change…"})]}):e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:a=>{a.preventDefault(),m.mutate(t.trim())},children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(k,{"aria-label":"Address",value:t,onChange:a=>i(a.target.value),className:"h-8 max-w-[360px] font-mono text-[12px]",autoFocus:!0}),e.jsx(g,{type:"submit",size:"sm",disabled:m.isPending||!t.trim(),children:m.isPending?"Saving…":"Save"}),e.jsx(g,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(null),children:"Cancel"})]}),c&&e.jsx("span",{className:"text-[12px] text-destructive",children:c}),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{ue as component};
|
package/static/dashboard/assets/{studio.integrations-DD2EWaL-.js → studio.integrations-D1bP5fqp.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as B,r as i,P,Q as T,N as K,o as S,T as W,j as e,B as y,S as ne,A as J,x as q}from"./index-C87aqO18.js";import{u as G}from"./useQuery-COJ09EkU.js";import{B as U}from"./badge-CGEswzew.js";import{E as F,G as $,I as E,H as L,J as D,K as O}from"./dialog-DrrnCoT5.js";import{L as C,I as A}from"./label-BfMHjFA7.js";import{C as z}from"./ConfirmDialog-CCAJDc_P.js";import{P as oe,a as Q}from"./parts-B-HQayFH.js";import{C as _}from"./CopyButton-exuJDdXj.js";import{b as V}from"./labels--UUyt9uB.js";import{u as ae}from"./me-D1prnPpY.js";import"./useBaseQuery-0OqUJMfc.js";import"./useRender-dtgBGlgC.js";import"./createLucideIcon-llnWWh0E.js";import"./createBaseUIEventDetails-CEmaecLi.js";import"./card-8T0wnIiU.js";import"./check-CiLHTeII.js";import"./copy-CKgsZbj1.js";const re={ok:{label:"Healthy",tone:"ok"},needs_reauth:{label:"Needs a new token",tone:"bad"},error:{label:"Failing",tone:"bad"}};function $e(){const r=ae(),c=r.user.role==="owner",p=G(q.integrations()),g=B(),x=()=>g.invalidateQueries({queryKey:["integrations"]}),[j,l]=i.useState(null),[m,d]=i.useState(null),[b,h]=i.useState(null),k=P({mutationFn:t=>S.regenerateGitHubWebhook(t),onSuccess:({webhook:t},s)=>h({site:s,provider:"github",hook:t,fresh:!1}),onError:t=>T.error(K(t))}),v=P({mutationFn:({uid:t,provider:s})=>S.testTracker(t,s).then(o=>({...o,provider:s})),onSuccess:t=>{T[t.ok?"success":"error"](t.ok?`${W[t.provider]} can see ${t.target}`:t.detail??`${W[t.provider]} refused the token`),x()},onError:t=>T.error(K(t))}),N=P({mutationFn:({uid:t,provider:s})=>S.disconnectTracker(t,s),onSuccess:()=>{d(null),x()},onError:t=>T.error(K(t))}),a=p.data?.data??[],f=t=>a.filter(s=>s.provider===t),u=t=>r.projects.filter(s=>!f(t).some(o=>o.site===s.uid));return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(oe,{title:"Integrations",sub:"Mirrors converge on the comment's status here; Slack only announces"}),["github","linear","jira","slack"].map(t=>{const s=f(t),o=u(t);return e.jsxs(Q,{title:W[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:[p.isPending&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:"Reading…"}),p.isSuccess&&s.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(U,{variant:"outline",children:"Not connected"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:t==="github"?"No site is connected to a repository yet.":t==="linear"?"No site is connected to a team yet.":t==="jira"?"No site is connected to a project yet.":"No site is connected to a channel yet."})]}),s.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:s.map(n=>{const I=re[n.health]??{label:n.health,tone:"warn"};return e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-border px-3 py-2.5 text-[13px]",children:[e.jsx("span",{className:"font-medium",children:n.siteName??n.site}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("code",{className:"font-mono text-[12.5px]",children:n.provider==="github"?`${n.owner}/${n.repo}`:n.provider==="linear"?`${n.teamKey} · ${n.teamName}`:n.provider==="jira"?`${n.projectKey} · ${n.projectName}`:`#${n.channelName} · ${n.teamName}`}),e.jsx(U,{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:[n.provider==="slack"?n.createOn==="thread.created"?"A message for every new comment":"Messages when you ask, from the brief":n.createOn==="thread.created"?"An issue for every new comment":"Issues when you ask, from the brief",n.provider==="github"&&n.labels.length?` · labels ${n.labels.join(", ")}`:"",n.provider!=="github"&&n.provider!=="slack"&&!n.hasWebhookSecret?` · no webhook secret yet, so ${W[n.provider]} cannot move comments here`:""," · ",V(n.updatedAt)]}),n.lastError&&e.jsx("span",{className:"basis-full text-[12px] text-destructive",children:n.lastError}),c&&e.jsxs("span",{className:"ml-auto flex gap-1",children:[n.provider==="github"?e.jsx(y,{variant:"ghost",size:"sm",disabled:k.isPending,onClick:()=>k.mutate(n.site),children:"Webhook…"}):n.provider==="slack"?null:e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>h({site:n.site,provider:n.provider,hook:{url:`${location.origin}/api/v1/integrations/${n.provider}/inbound`},fresh:!1}),children:"Webhook…"}),e.jsx(y,{variant:"ghost",size:"sm",disabled:v.isPending,onClick:()=>v.mutate({uid:n.site,provider:n.provider}),children:"Test"}),e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>d(n),children:"Disconnect"})]})]},`${n.provider}:${n.site}`)})}),c&&o.length>0&&e.jsx("div",{children:e.jsx(y,{variant:"outline",size:"sm",onClick:()=>l(t),children:"Connect a site…"})})]},t)}),e.jsx(he,{owner:c,sites:r.projects}),e.jsx(ie,{open:j==="github",onOpenChange:t=>!t&&l(null),sites:u("github"),onDone:(t,s)=>{x(),s&&h({site:t,provider:"github",hook:s,fresh:!0})}}),e.jsx(le,{open:j==="linear",onOpenChange:t=>!t&&l(null),sites:u("linear"),onDone:(t,s)=>{x(),h({site:t,provider:"linear",hook:s,fresh:!0})}}),e.jsx(de,{open:j==="jira",onOpenChange:t=>!t&&l(null),sites:u("jira"),onDone:(t,s)=>{x(),h({site:t,provider:"jira",hook:s,fresh:!0})}}),e.jsx(me,{open:j==="slack",onOpenChange:t=>!t&&l(null),sites:u("slack"),onDone:()=>void x()}),e.jsx(ce,{state:b,onClose:()=>h(null),siteName:t=>a.find(s=>s.site===t)?.siteName??"the site"}),e.jsx(z,{open:m!==null,onOpenChange:t=>!t&&d(null),title:`Disconnect ${m?.siteName??"this site"} from ${m?W[m.provider]:"the tracker"}?`,description:m?.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:N.isPending,onConfirm:async()=>{m&&await N.mutateAsync({uid:m.site,provider:m.provider})}})]})}function ie({open:r,onOpenChange:c,sites:p,onDone:g}){const[x,j]=i.useState(""),[l,m]=i.useState(""),[d,b]=i.useState(""),[h,k]=i.useState(""),[v,N]=i.useState(!1),[a,f]=i.useState(""),u=P({mutationFn:o=>S.connectTracker(o,"github",{repository:l.trim(),token:d.trim(),labels:h,createOn:v?"thread.created":"manual"})}),t=x||p[0]?.uid||"",s=async o=>{o.preventDefault(),f("");try{const n=await u.mutateAsync(t);m(""),b(""),k(""),N(!1),c(!1),g(t,n.webhook&&"secret"in n.webhook?n.webhook:void 0),T.success("GitHub connected")}catch(n){f(n instanceof J?n.message:"Could not reach the server.")}};return e.jsx(F,{open:r,onOpenChange:c,children:e.jsx($,{children:e.jsxs("form",{onSubmit:o=>void s(o),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(E,{children:[e.jsx(L,{children:"Connect a site to GitHub"}),e.jsxs(D,{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."]})]}),a&&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:a}),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:t,onChange:o=>j(o.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:p.map(o=>e.jsx("option",{value:o.uid,children:o.name},o.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-repo",children:"Repository"}),e.jsx(A,{id:"gh-repo",placeholder:"kilnwork/site",value:l,onChange:o=>m(o.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-token",children:"Token"}),e.jsx(A,{id:"gh-token",type:"password",placeholder:"github_pat_…",value:d,onChange:o=>b(o.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-labels",children:"Labels"}),e.jsx(A,{id:"gh-labels",placeholder:"review, bug",value:h,onChange:o=>k(o.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:o=>N(o.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(O,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(y,{type:"submit",disabled:u.isPending||!l.trim()||!d.trim()||!t,children:u.isPending?"Checking…":"Connect"})]})]})})})}function ce({state:r,onClose:c,siteName:p}){const g=r&&"secret"in r.hook?r.hook.secret:null;return e.jsx(F,{open:r!==null,onOpenChange:x=>!x&&c(),children:e.jsxs($,{children:[e.jsxs(E,{children:[e.jsx(L,{children:r?.fresh?"Connected — now the webhook":"Webhook for "+(r?p(r.site):"")}),e.jsx(D,{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(_,{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"})}),g&&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:g}),e.jsx(_,{text:g,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(O,{children:e.jsx(y,{type:"button",onClick:c,children:"Done"})})]})})}function le({open:r,onOpenChange:c,sites:p,onDone:g}){const[x,j]=i.useState(""),[l,m]=i.useState(""),[d,b]=i.useState(""),[h,k]=i.useState(""),[v,N]=i.useState(!1),[a,f]=i.useState(""),u=P({mutationFn:o=>S.connectTracker(o,"linear",{team:l.trim(),apiKey:d.trim(),...h.trim()?{webhookSecret:h.trim()}:{},createOn:v?"thread.created":"manual"})}),t=x||p[0]?.uid||"",s=async o=>{o.preventDefault(),f("");try{const n=await u.mutateAsync(t);m(""),b(""),k(""),N(!1),c(!1),g(t,n.webhook??{url:`${location.origin}/api/v1/integrations/linear/inbound`}),T.success("Linear connected")}catch(n){f(n instanceof J?n.message:"Could not reach the server.")}};return e.jsx(F,{open:r,onOpenChange:c,children:e.jsx($,{children:e.jsxs("form",{onSubmit:o=>void s(o),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(E,{children:[e.jsx(L,{children:"Connect a site to Linear"}),e.jsx(D,{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."})]}),a&&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:a}),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:t,onChange:o=>j(o.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:p.map(o=>e.jsx("option",{value:o.uid,children:o.name},o.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-team",children:"Team key"}),e.jsx(A,{id:"ln-team",placeholder:"ENG",value:l,onChange:o=>m(o.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The prefix of the team's issues, like the ENG in ENG-123."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-key",children:"API key"}),e.jsx(A,{id:"ln-key",type:"password",placeholder:"lin_api_…",value:d,onChange:o=>b(o.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-secret",children:"Webhook signing secret"}),e.jsx(A,{id:"ln-secret",type:"password",placeholder:"from Linear's webhook, optional",value:h,onChange:o=>k(o.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:o=>N(o.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(O,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(y,{type:"submit",disabled:u.isPending||!l.trim()||!d.trim()||!t,children:u.isPending?"Checking…":"Connect"})]})]})})})}function de({open:r,onOpenChange:c,sites:p,onDone:g}){const[x,j]=i.useState(""),[l,m]=i.useState(""),[d,b]=i.useState(""),[h,k]=i.useState(""),[v,N]=i.useState(""),[a,f]=i.useState(""),[u,t]=i.useState(!1),[s,o]=i.useState(""),n=P({mutationFn:w=>S.connectTracker(w,"jira",{siteUrl:l.trim(),project:d.trim(),email:h.trim(),apiToken:v.trim(),...a.trim()?{webhookSecret:a.trim()}:{},createOn:u?"thread.created":"manual"})}),I=x||p[0]?.uid||"",X=async w=>{w.preventDefault(),o("");try{const R=await n.mutateAsync(I);b(""),N(""),f(""),t(!1),c(!1),g(I,R.webhook??{url:`${location.origin}/api/v1/integrations/jira/inbound`}),T.success("Jira connected")}catch(R){o(R instanceof J?R.message:"Could not reach the server.")}},M=(w,R,Y,Z,ee,te="text",H)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:`jr-${w}`,children:R}),e.jsx(A,{id:`jr-${w}`,type:te,placeholder:ee,value:Y,onChange:se=>Z(se.target.value),autoComplete:"off"}),H&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:H})]});return e.jsx(F,{open:r,onOpenChange:c,children:e.jsx($,{children:e.jsxs("form",{onSubmit:w=>void X(w),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(E,{children:[e.jsx(L,{children:"Connect a site to Jira"}),e.jsx(D,{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."})]}),s&&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:s}),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:I,onChange:w=>j(w.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:p.map(w=>e.jsx("option",{value:w.uid,children:w.name},w.uid))})]}),M("url","Jira site",l,m,"https://kilnwork.atlassian.net"),M("project","Project key",d,b,"KAN","text","The prefix of the project's issues, like the KAN in KAN-12."),M("email","Account email",h,k,"you@kilnwork.studio","email"),M("token","API token",v,N,"","password"),M("secret","Webhook secret",a,f,"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:u,onChange:w=>t(w.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(O,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(y,{type:"submit",disabled:n.isPending||!l.trim()||!d.trim()||!h.trim()||!v.trim()||!I,children:n.isPending?"Checking…":"Connect"})]})]})})})}function me({open:r,onOpenChange:c,sites:p,onDone:g}){const[x,j]=i.useState(""),[l,m]=i.useState(""),[d,b]=i.useState(""),[h,k]=i.useState(!0),[v,N]=i.useState(""),a=G({queryKey:["integrations","slack","manifest"],queryFn:()=>S.slackManifest(),enabled:r,staleTime:1/0}),f=P({mutationFn:s=>S.connectTracker(s,"slack",{channel:l.trim(),token:d.trim(),createOn:h?"thread.created":"manual"})}),u=x||p[0]?.uid||"",t=async s=>{s.preventDefault(),N("");try{await f.mutateAsync(u),m(""),b(""),k(!0),c(!1),g(u),T.success("Slack connected")}catch(o){N(o instanceof J?o.message:"Could not reach the server.")}};return e.jsx(F,{open:r,onOpenChange:c,children:e.jsx($,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(E,{children:[e.jsx(L,{children:"Connect a site to Slack"}),e.jsx(D,{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:u,onChange:s=>j(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:p.map(s=>e.jsx("option",{value:s.uid,children:s.name},s.uid))})]}),e.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border px-3 py-2 text-[13px]",children:[e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block font-medium",children:"1. Create the app"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Opens api.slack.com with the manifest pasted; then Install to Workspace."})]}),e.jsx(y,{type:"button",variant:"outline",size:"sm",disabled:!a.data,render:e.jsx("a",{href:a.data?.url??"#",target:"_blank",rel:"noreferrer"}),children:"Create app…"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-token",children:"2. Bot User OAuth Token"}),e.jsx(A,{id:"sl-token",type:"password",placeholder:"xoxb-…",value:d,onChange:s=>b(s.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"On the app's OAuth & Permissions page after installing."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-channel",children:"3. Channel"}),e.jsx(A,{id:"sl-channel",placeholder:"#reviews",value:l,onChange:s=>m(s.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:s=>k(s.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(O,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(y,{type:"submit",disabled:f.isPending||!l.trim()||!d.trim()||!u,children:f.isPending?"Checking…":"Connect"})]})]})})})}function he({owner:r,sites:c}){const p=B(),g=G(q.mcpTokens()),[x,j]=i.useState(!1),[l,m]=i.useState(null),[d,b]=i.useState(null),h=P({mutationFn:a=>S.revokeMcpToken(a),onSuccess:()=>{b(null),p.invalidateQueries({queryKey:["mcp-tokens"]})},onError:a=>T.error(K(a))}),k=g.data?.data??[],v=k.filter(a=>!a.revokedAt),N=a=>{const f=new Set(a),u=f.has("comments:write")||f.has("threads:write");return!u&&!f.has("context:read")?"Read-only":u?`Writes: ${[f.has("comments:write")?"reply":"",f.has("threads:write")?"mark ready":""].filter(Boolean).join(", ")}`:"Read-only, with capture context"};return e.jsxs(Q,{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("p",{className:"m-0 text-[13px] text-muted-foreground",children:"Reading…"}),g.isSuccess&&v.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(U,{variant:"outline",children:"No tokens"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:"No agent can read this studio yet."})]}),k.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0","aria-label":"Agent tokens",children:k.map(a=>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] ${a.revokedAt?"opacity-60":""}`,children:[e.jsx("span",{className:"font-medium",children:a.name}),e.jsxs("code",{className:"font-mono text-[12.5px] text-muted-foreground",children:[a.prefix,"…"]}),e.jsx(U,{variant:"outline",className:a.revokedAt?"":"border-ok text-ok",children:a.revokedAt?"Revoked":N(a.scopes)}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[a.site?a.site.name:"All sites"," · ",a.lastUsedAt?`last used ${V(a.lastUsedAt)}`:"never used",a.expiresAt&&!a.revokedAt?` · expires ${new Date(a.expiresAt).toLocaleDateString()}`:"",a.createdBy?` · by ${a.createdBy}`:""]}),r&&!a.revokedAt&&e.jsx("span",{className:"ml-auto flex gap-1",children:e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>b(a),children:"Revoke"})})]},a.id))}),r&&e.jsx("div",{children:e.jsx(y,{variant:"outline",size:"sm",onClick:()=>j(!0),children:"New token…"})}),e.jsx(ue,{open:x,onOpenChange:j,sites:c,onDone:a=>{p.invalidateQueries({queryKey:["mcp-tokens"]}),m(a)}}),e.jsx(xe,{state:l,onClose:()=>m(null)}),e.jsx(z,{open:d!==null,onOpenChange:a=>!a&&b(null),title:`Revoke “${d?.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:h.isPending,onConfirm:async()=>{d&&await h.mutateAsync(d.id)}})]})}function ue({open:r,onOpenChange:c,sites:p,onDone:g}){const[x,j]=i.useState(""),[l,m]=i.useState(""),[d,b]=i.useState(["threads:read","source:map"]),[h,k]=i.useState(""),[v,N]=i.useState(""),a=P({mutationFn:()=>S.mintMcpToken({name:x.trim(),...l?{site:l}:{},scopes:d,...h?{expiresInDays:Number(h)}:{}})}),f=(t,s)=>b(o=>s?[...new Set([...o,t])]:o.filter(n=>n!==t)),u=async t=>{t.preventDefault(),N("");try{const s=await a.mutateAsync();j(""),m(""),b(["threads:read","source:map"]),k(""),c(!1),g(s)}catch(s){N(s instanceof J?s.message:"Could not reach the server.")}};return e.jsx(F,{open:r,onOpenChange:c,children:e.jsx($,{children:e.jsxs("form",{onSubmit:t=>void u(t),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(E,{children:[e.jsx(L,{children:"New agent token"}),e.jsx(D,{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."})]}),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:"mcp-name",children:"Name"}),e.jsx(A,{id:"mcp-name",placeholder:"Claude Code",value:x,onChange:t=>j(t.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:l,onChange:t=>m(t.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"}),p.map(t=>e.jsx("option",{value:t.uid,children:t.name},t.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"}),ne.map(t=>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:d.includes(t.scope),onChange:s=>f(t.scope,s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:t.label}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:t.hint})]})]},t.scope))]}),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:h,onChange:t=>k(t.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(O,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(y,{type:"submit",disabled:a.isPending||!x.trim()||d.length===0,children:a.isPending?"Minting…":"Create token"})]})]})})})}function xe({state:r,onClose:c}){const p=typeof location<"u"?location.origin:"",g={SNAGSET_MCP_TOKEN:r?.secret??"",SNAGSET_MCP_HOST:p,...r?.token.site?{SNAGSET_MCP_PROJECT:r.token.site.uid}:{}},x=JSON.stringify({mcpServers:{snagset:{command:"npx",args:["-y","@snagset/mcp"],env:g}}},null,2),j=["claude mcp add snagset",...Object.entries(g).map(([l,m])=>`-e ${l}=${m}`),"--","npx -y @snagset/mcp"].join(" ");return e.jsx(F,{open:r!==null,onOpenChange:l=>!l&&c(),children:e.jsxs($,{className:"max-w-xl",children:[e.jsxs(E,{children:[e.jsxs(L,{children:["Token for “",r?.token.name??"","”"]}),e.jsx(D,{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(_,{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(_,{text:j,label:"Copy the Claude Code command"})]}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:j})]}),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(_,{text:x,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:x}),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(O,{children:e.jsx(y,{type:"button",onClick:c,children:"Done"})})]})})}export{$e as component};
|
|
1
|
+
import{s as B,r as i,P,Q as T,N as K,o as S,T as W,j as e,B as y,S as ne,A as J,x as q}from"./index-DG2IWFx-.js";import{u as G}from"./useQuery-DuAHuwx9.js";import{B as U}from"./badge-CErha5Qd.js";import{E as F,G as $,I as E,H as L,J as D,K as O}from"./dialog-CgkCHO0g.js";import{L as C,I as A}from"./label-Bombrpc6.js";import{C as z}from"./ConfirmDialog-CfUnmf4e.js";import{P as oe,a as Q}from"./parts-B3hL1LIW.js";import{C as _}from"./CopyButton-0ANrU8mS.js";import{b as V}from"./labels--UUyt9uB.js";import{u as ae}from"./me-Bno2H07j.js";import"./useBaseQuery-Cyp8ADaN.js";import"./useRender-BCvsiXRL.js";import"./createLucideIcon-DwbZIZsa.js";import"./createBaseUIEventDetails-BWJgXhnd.js";import"./card-DxFqxFQf.js";import"./check-Yc6VFTfm.js";import"./copy-BjvQHEe0.js";const re={ok:{label:"Healthy",tone:"ok"},needs_reauth:{label:"Needs a new token",tone:"bad"},error:{label:"Failing",tone:"bad"}};function $e(){const r=ae(),c=r.user.role==="owner",p=G(q.integrations()),g=B(),x=()=>g.invalidateQueries({queryKey:["integrations"]}),[j,l]=i.useState(null),[m,d]=i.useState(null),[b,h]=i.useState(null),k=P({mutationFn:t=>S.regenerateGitHubWebhook(t),onSuccess:({webhook:t},s)=>h({site:s,provider:"github",hook:t,fresh:!1}),onError:t=>T.error(K(t))}),v=P({mutationFn:({uid:t,provider:s})=>S.testTracker(t,s).then(o=>({...o,provider:s})),onSuccess:t=>{T[t.ok?"success":"error"](t.ok?`${W[t.provider]} can see ${t.target}`:t.detail??`${W[t.provider]} refused the token`),x()},onError:t=>T.error(K(t))}),N=P({mutationFn:({uid:t,provider:s})=>S.disconnectTracker(t,s),onSuccess:()=>{d(null),x()},onError:t=>T.error(K(t))}),a=p.data?.data??[],f=t=>a.filter(s=>s.provider===t),u=t=>r.projects.filter(s=>!f(t).some(o=>o.site===s.uid));return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(oe,{title:"Integrations",sub:"Mirrors converge on the comment's status here; Slack only announces"}),["github","linear","jira","slack"].map(t=>{const s=f(t),o=u(t);return e.jsxs(Q,{title:W[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:[p.isPending&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:"Reading…"}),p.isSuccess&&s.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(U,{variant:"outline",children:"Not connected"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:t==="github"?"No site is connected to a repository yet.":t==="linear"?"No site is connected to a team yet.":t==="jira"?"No site is connected to a project yet.":"No site is connected to a channel yet."})]}),s.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:s.map(n=>{const I=re[n.health]??{label:n.health,tone:"warn"};return e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-border px-3 py-2.5 text-[13px]",children:[e.jsx("span",{className:"font-medium",children:n.siteName??n.site}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("code",{className:"font-mono text-[12.5px]",children:n.provider==="github"?`${n.owner}/${n.repo}`:n.provider==="linear"?`${n.teamKey} · ${n.teamName}`:n.provider==="jira"?`${n.projectKey} · ${n.projectName}`:`#${n.channelName} · ${n.teamName}`}),e.jsx(U,{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:[n.provider==="slack"?n.createOn==="thread.created"?"A message for every new comment":"Messages when you ask, from the brief":n.createOn==="thread.created"?"An issue for every new comment":"Issues when you ask, from the brief",n.provider==="github"&&n.labels.length?` · labels ${n.labels.join(", ")}`:"",n.provider!=="github"&&n.provider!=="slack"&&!n.hasWebhookSecret?` · no webhook secret yet, so ${W[n.provider]} cannot move comments here`:""," · ",V(n.updatedAt)]}),n.lastError&&e.jsx("span",{className:"basis-full text-[12px] text-destructive",children:n.lastError}),c&&e.jsxs("span",{className:"ml-auto flex gap-1",children:[n.provider==="github"?e.jsx(y,{variant:"ghost",size:"sm",disabled:k.isPending,onClick:()=>k.mutate(n.site),children:"Webhook…"}):n.provider==="slack"?null:e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>h({site:n.site,provider:n.provider,hook:{url:`${location.origin}/api/v1/integrations/${n.provider}/inbound`},fresh:!1}),children:"Webhook…"}),e.jsx(y,{variant:"ghost",size:"sm",disabled:v.isPending,onClick:()=>v.mutate({uid:n.site,provider:n.provider}),children:"Test"}),e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>d(n),children:"Disconnect"})]})]},`${n.provider}:${n.site}`)})}),c&&o.length>0&&e.jsx("div",{children:e.jsx(y,{variant:"outline",size:"sm",onClick:()=>l(t),children:"Connect a site…"})})]},t)}),e.jsx(he,{owner:c,sites:r.projects}),e.jsx(ie,{open:j==="github",onOpenChange:t=>!t&&l(null),sites:u("github"),onDone:(t,s)=>{x(),s&&h({site:t,provider:"github",hook:s,fresh:!0})}}),e.jsx(le,{open:j==="linear",onOpenChange:t=>!t&&l(null),sites:u("linear"),onDone:(t,s)=>{x(),h({site:t,provider:"linear",hook:s,fresh:!0})}}),e.jsx(de,{open:j==="jira",onOpenChange:t=>!t&&l(null),sites:u("jira"),onDone:(t,s)=>{x(),h({site:t,provider:"jira",hook:s,fresh:!0})}}),e.jsx(me,{open:j==="slack",onOpenChange:t=>!t&&l(null),sites:u("slack"),onDone:()=>void x()}),e.jsx(ce,{state:b,onClose:()=>h(null),siteName:t=>a.find(s=>s.site===t)?.siteName??"the site"}),e.jsx(z,{open:m!==null,onOpenChange:t=>!t&&d(null),title:`Disconnect ${m?.siteName??"this site"} from ${m?W[m.provider]:"the tracker"}?`,description:m?.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:N.isPending,onConfirm:async()=>{m&&await N.mutateAsync({uid:m.site,provider:m.provider})}})]})}function ie({open:r,onOpenChange:c,sites:p,onDone:g}){const[x,j]=i.useState(""),[l,m]=i.useState(""),[d,b]=i.useState(""),[h,k]=i.useState(""),[v,N]=i.useState(!1),[a,f]=i.useState(""),u=P({mutationFn:o=>S.connectTracker(o,"github",{repository:l.trim(),token:d.trim(),labels:h,createOn:v?"thread.created":"manual"})}),t=x||p[0]?.uid||"",s=async o=>{o.preventDefault(),f("");try{const n=await u.mutateAsync(t);m(""),b(""),k(""),N(!1),c(!1),g(t,n.webhook&&"secret"in n.webhook?n.webhook:void 0),T.success("GitHub connected")}catch(n){f(n instanceof J?n.message:"Could not reach the server.")}};return e.jsx(F,{open:r,onOpenChange:c,children:e.jsx($,{children:e.jsxs("form",{onSubmit:o=>void s(o),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(E,{children:[e.jsx(L,{children:"Connect a site to GitHub"}),e.jsxs(D,{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."]})]}),a&&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:a}),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:t,onChange:o=>j(o.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:p.map(o=>e.jsx("option",{value:o.uid,children:o.name},o.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-repo",children:"Repository"}),e.jsx(A,{id:"gh-repo",placeholder:"kilnwork/site",value:l,onChange:o=>m(o.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-token",children:"Token"}),e.jsx(A,{id:"gh-token",type:"password",placeholder:"github_pat_…",value:d,onChange:o=>b(o.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-labels",children:"Labels"}),e.jsx(A,{id:"gh-labels",placeholder:"review, bug",value:h,onChange:o=>k(o.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:o=>N(o.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(O,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(y,{type:"submit",disabled:u.isPending||!l.trim()||!d.trim()||!t,children:u.isPending?"Checking…":"Connect"})]})]})})})}function ce({state:r,onClose:c,siteName:p}){const g=r&&"secret"in r.hook?r.hook.secret:null;return e.jsx(F,{open:r!==null,onOpenChange:x=>!x&&c(),children:e.jsxs($,{children:[e.jsxs(E,{children:[e.jsx(L,{children:r?.fresh?"Connected — now the webhook":"Webhook for "+(r?p(r.site):"")}),e.jsx(D,{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(_,{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"})}),g&&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:g}),e.jsx(_,{text:g,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(O,{children:e.jsx(y,{type:"button",onClick:c,children:"Done"})})]})})}function le({open:r,onOpenChange:c,sites:p,onDone:g}){const[x,j]=i.useState(""),[l,m]=i.useState(""),[d,b]=i.useState(""),[h,k]=i.useState(""),[v,N]=i.useState(!1),[a,f]=i.useState(""),u=P({mutationFn:o=>S.connectTracker(o,"linear",{team:l.trim(),apiKey:d.trim(),...h.trim()?{webhookSecret:h.trim()}:{},createOn:v?"thread.created":"manual"})}),t=x||p[0]?.uid||"",s=async o=>{o.preventDefault(),f("");try{const n=await u.mutateAsync(t);m(""),b(""),k(""),N(!1),c(!1),g(t,n.webhook??{url:`${location.origin}/api/v1/integrations/linear/inbound`}),T.success("Linear connected")}catch(n){f(n instanceof J?n.message:"Could not reach the server.")}};return e.jsx(F,{open:r,onOpenChange:c,children:e.jsx($,{children:e.jsxs("form",{onSubmit:o=>void s(o),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(E,{children:[e.jsx(L,{children:"Connect a site to Linear"}),e.jsx(D,{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."})]}),a&&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:a}),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:t,onChange:o=>j(o.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:p.map(o=>e.jsx("option",{value:o.uid,children:o.name},o.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-team",children:"Team key"}),e.jsx(A,{id:"ln-team",placeholder:"ENG",value:l,onChange:o=>m(o.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The prefix of the team's issues, like the ENG in ENG-123."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-key",children:"API key"}),e.jsx(A,{id:"ln-key",type:"password",placeholder:"lin_api_…",value:d,onChange:o=>b(o.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-secret",children:"Webhook signing secret"}),e.jsx(A,{id:"ln-secret",type:"password",placeholder:"from Linear's webhook, optional",value:h,onChange:o=>k(o.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:o=>N(o.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(O,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(y,{type:"submit",disabled:u.isPending||!l.trim()||!d.trim()||!t,children:u.isPending?"Checking…":"Connect"})]})]})})})}function de({open:r,onOpenChange:c,sites:p,onDone:g}){const[x,j]=i.useState(""),[l,m]=i.useState(""),[d,b]=i.useState(""),[h,k]=i.useState(""),[v,N]=i.useState(""),[a,f]=i.useState(""),[u,t]=i.useState(!1),[s,o]=i.useState(""),n=P({mutationFn:w=>S.connectTracker(w,"jira",{siteUrl:l.trim(),project:d.trim(),email:h.trim(),apiToken:v.trim(),...a.trim()?{webhookSecret:a.trim()}:{},createOn:u?"thread.created":"manual"})}),I=x||p[0]?.uid||"",X=async w=>{w.preventDefault(),o("");try{const R=await n.mutateAsync(I);b(""),N(""),f(""),t(!1),c(!1),g(I,R.webhook??{url:`${location.origin}/api/v1/integrations/jira/inbound`}),T.success("Jira connected")}catch(R){o(R instanceof J?R.message:"Could not reach the server.")}},M=(w,R,Y,Z,ee,te="text",H)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:`jr-${w}`,children:R}),e.jsx(A,{id:`jr-${w}`,type:te,placeholder:ee,value:Y,onChange:se=>Z(se.target.value),autoComplete:"off"}),H&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:H})]});return e.jsx(F,{open:r,onOpenChange:c,children:e.jsx($,{children:e.jsxs("form",{onSubmit:w=>void X(w),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(E,{children:[e.jsx(L,{children:"Connect a site to Jira"}),e.jsx(D,{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."})]}),s&&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:s}),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:I,onChange:w=>j(w.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:p.map(w=>e.jsx("option",{value:w.uid,children:w.name},w.uid))})]}),M("url","Jira site",l,m,"https://kilnwork.atlassian.net"),M("project","Project key",d,b,"KAN","text","The prefix of the project's issues, like the KAN in KAN-12."),M("email","Account email",h,k,"you@kilnwork.studio","email"),M("token","API token",v,N,"","password"),M("secret","Webhook secret",a,f,"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:u,onChange:w=>t(w.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(O,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(y,{type:"submit",disabled:n.isPending||!l.trim()||!d.trim()||!h.trim()||!v.trim()||!I,children:n.isPending?"Checking…":"Connect"})]})]})})})}function me({open:r,onOpenChange:c,sites:p,onDone:g}){const[x,j]=i.useState(""),[l,m]=i.useState(""),[d,b]=i.useState(""),[h,k]=i.useState(!0),[v,N]=i.useState(""),a=G({queryKey:["integrations","slack","manifest"],queryFn:()=>S.slackManifest(),enabled:r,staleTime:1/0}),f=P({mutationFn:s=>S.connectTracker(s,"slack",{channel:l.trim(),token:d.trim(),createOn:h?"thread.created":"manual"})}),u=x||p[0]?.uid||"",t=async s=>{s.preventDefault(),N("");try{await f.mutateAsync(u),m(""),b(""),k(!0),c(!1),g(u),T.success("Slack connected")}catch(o){N(o instanceof J?o.message:"Could not reach the server.")}};return e.jsx(F,{open:r,onOpenChange:c,children:e.jsx($,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(E,{children:[e.jsx(L,{children:"Connect a site to Slack"}),e.jsx(D,{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:u,onChange:s=>j(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:p.map(s=>e.jsx("option",{value:s.uid,children:s.name},s.uid))})]}),e.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border px-3 py-2 text-[13px]",children:[e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block font-medium",children:"1. Create the app"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Opens api.slack.com with the manifest pasted; then Install to Workspace."})]}),e.jsx(y,{type:"button",variant:"outline",size:"sm",disabled:!a.data,render:e.jsx("a",{href:a.data?.url??"#",target:"_blank",rel:"noreferrer"}),children:"Create app…"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-token",children:"2. Bot User OAuth Token"}),e.jsx(A,{id:"sl-token",type:"password",placeholder:"xoxb-…",value:d,onChange:s=>b(s.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"On the app's OAuth & Permissions page after installing."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-channel",children:"3. Channel"}),e.jsx(A,{id:"sl-channel",placeholder:"#reviews",value:l,onChange:s=>m(s.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:s=>k(s.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(O,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(y,{type:"submit",disabled:f.isPending||!l.trim()||!d.trim()||!u,children:f.isPending?"Checking…":"Connect"})]})]})})})}function he({owner:r,sites:c}){const p=B(),g=G(q.mcpTokens()),[x,j]=i.useState(!1),[l,m]=i.useState(null),[d,b]=i.useState(null),h=P({mutationFn:a=>S.revokeMcpToken(a),onSuccess:()=>{b(null),p.invalidateQueries({queryKey:["mcp-tokens"]})},onError:a=>T.error(K(a))}),k=g.data?.data??[],v=k.filter(a=>!a.revokedAt),N=a=>{const f=new Set(a),u=f.has("comments:write")||f.has("threads:write");return!u&&!f.has("context:read")?"Read-only":u?`Writes: ${[f.has("comments:write")?"reply":"",f.has("threads:write")?"mark ready":""].filter(Boolean).join(", ")}`:"Read-only, with capture context"};return e.jsxs(Q,{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("p",{className:"m-0 text-[13px] text-muted-foreground",children:"Reading…"}),g.isSuccess&&v.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(U,{variant:"outline",children:"No tokens"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:"No agent can read this studio yet."})]}),k.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0","aria-label":"Agent tokens",children:k.map(a=>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] ${a.revokedAt?"opacity-60":""}`,children:[e.jsx("span",{className:"font-medium",children:a.name}),e.jsxs("code",{className:"font-mono text-[12.5px] text-muted-foreground",children:[a.prefix,"…"]}),e.jsx(U,{variant:"outline",className:a.revokedAt?"":"border-ok text-ok",children:a.revokedAt?"Revoked":N(a.scopes)}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[a.site?a.site.name:"All sites"," · ",a.lastUsedAt?`last used ${V(a.lastUsedAt)}`:"never used",a.expiresAt&&!a.revokedAt?` · expires ${new Date(a.expiresAt).toLocaleDateString()}`:"",a.createdBy?` · by ${a.createdBy}`:""]}),r&&!a.revokedAt&&e.jsx("span",{className:"ml-auto flex gap-1",children:e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>b(a),children:"Revoke"})})]},a.id))}),r&&e.jsx("div",{children:e.jsx(y,{variant:"outline",size:"sm",onClick:()=>j(!0),children:"New token…"})}),e.jsx(ue,{open:x,onOpenChange:j,sites:c,onDone:a=>{p.invalidateQueries({queryKey:["mcp-tokens"]}),m(a)}}),e.jsx(xe,{state:l,onClose:()=>m(null)}),e.jsx(z,{open:d!==null,onOpenChange:a=>!a&&b(null),title:`Revoke “${d?.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:h.isPending,onConfirm:async()=>{d&&await h.mutateAsync(d.id)}})]})}function ue({open:r,onOpenChange:c,sites:p,onDone:g}){const[x,j]=i.useState(""),[l,m]=i.useState(""),[d,b]=i.useState(["threads:read","source:map"]),[h,k]=i.useState(""),[v,N]=i.useState(""),a=P({mutationFn:()=>S.mintMcpToken({name:x.trim(),...l?{site:l}:{},scopes:d,...h?{expiresInDays:Number(h)}:{}})}),f=(t,s)=>b(o=>s?[...new Set([...o,t])]:o.filter(n=>n!==t)),u=async t=>{t.preventDefault(),N("");try{const s=await a.mutateAsync();j(""),m(""),b(["threads:read","source:map"]),k(""),c(!1),g(s)}catch(s){N(s instanceof J?s.message:"Could not reach the server.")}};return e.jsx(F,{open:r,onOpenChange:c,children:e.jsx($,{children:e.jsxs("form",{onSubmit:t=>void u(t),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(E,{children:[e.jsx(L,{children:"New agent token"}),e.jsx(D,{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."})]}),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:"mcp-name",children:"Name"}),e.jsx(A,{id:"mcp-name",placeholder:"Claude Code",value:x,onChange:t=>j(t.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:l,onChange:t=>m(t.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"}),p.map(t=>e.jsx("option",{value:t.uid,children:t.name},t.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"}),ne.map(t=>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:d.includes(t.scope),onChange:s=>f(t.scope,s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:t.label}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:t.hint})]})]},t.scope))]}),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:h,onChange:t=>k(t.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(O,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(y,{type:"submit",disabled:a.isPending||!x.trim()||d.length===0,children:a.isPending?"Minting…":"Create token"})]})]})})})}function xe({state:r,onClose:c}){const p=typeof location<"u"?location.origin:"",g={SNAGSET_MCP_TOKEN:r?.secret??"",SNAGSET_MCP_HOST:p,...r?.token.site?{SNAGSET_MCP_PROJECT:r.token.site.uid}:{}},x=JSON.stringify({mcpServers:{snagset:{command:"npx",args:["-y","@snagset/mcp"],env:g}}},null,2),j=["claude mcp add snagset",...Object.entries(g).map(([l,m])=>`-e ${l}=${m}`),"--","npx -y @snagset/mcp"].join(" ");return e.jsx(F,{open:r!==null,onOpenChange:l=>!l&&c(),children:e.jsxs($,{className:"max-w-xl",children:[e.jsxs(E,{children:[e.jsxs(L,{children:["Token for “",r?.token.name??"","”"]}),e.jsx(D,{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(_,{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(_,{text:j,label:"Copy the Claude Code command"})]}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:j})]}),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(_,{text:x,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:x}),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(O,{children:e.jsx(y,{type:"button",onClick:c,children:"Done"})})]})})}export{$e as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,e as y,r as f,B as x,N,z as A,C as p,_ as C,x as R}from"./index-
|
|
1
|
+
import{j as e,e as y,r as f,B as x,N,z as A,C as p,_ as C,x as R}from"./index-DG2IWFx-.js";import{u as T}from"./useQuery-DuAHuwx9.js";import{u as S,a as D}from"./zod-qEjeM9Eg.js";import{A as M,a as E}from"./avatar-AfucjvZ4.js";import{B as F}from"./badge-CErha5Qd.js";import{C as k}from"./card-DxFqxFQf.js";import{X as B,E as H,G as P,I as z,H as I,J as O,K as L}from"./dialog-CgkCHO0g.js";import{L as m,I as u}from"./label-Bombrpc6.js";import{T as $,a as V,b as j,c as d,d as _,e as c}from"./table-DEYsEr1D.js";import{C as q}from"./ConfirmDialog-CfUnmf4e.js";import{P as G}from"./parts-B3hL1LIW.js";import{a as J}from"./labels--UUyt9uB.js";import{u as K}from"./me-Bno2H07j.js";import{c as Q,d as X,e as Y}from"./studio-BIDpGywS.js";import{P as U}from"./plus-CRLkl9fr.js";import"./useBaseQuery-Cyp8ADaN.js";import"./useRender-BCvsiXRL.js";import"./createLucideIcon-DwbZIZsa.js";import"./createBaseUIEventDetails-BWJgXhnd.js";function b({className:s,...a}){return e.jsx("select",{className:y("h-8 rounded-md border border-input bg-card px-2.5 text-[13.5px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50",s),...a})}function we(){const a=K().user.role==="owner",t=T(R.members()),[i,o]=f.useState(!1);return e.jsxs("div",{className:"p-7",children:[e.jsx(G,{title:"Members",sub:a?"Owners and admins can do everything; only owners change this list.":"Owners and admins can do everything. Ask an owner to change this list.",actions:a?e.jsxs(x,{onClick:()=>o(!0),children:[e.jsx(U,{}),"Add member"]}):void 0}),e.jsx(k,{className:"max-w-[1040px] overflow-hidden py-0",children:e.jsxs($,{children:[e.jsx(V,{children:e.jsxs(j,{children:[e.jsx(d,{children:"Name"}),e.jsx(d,{children:"Email"}),e.jsx(d,{children:"Role"}),a&&e.jsx(d,{className:"w-0"})]})}),e.jsx(_,{children:(t.data?.data??[]).map(r=>e.jsx(W,{m:r,owner:a},r.email))})]})}),e.jsx("p",{className:"m-0 mt-3 max-w-[1040px] text-[12.5px] text-muted-foreground",children:"There is no invitation mail: an owner sets an initial password and hands it over, and the person changes it under You."}),a&&e.jsx(ee,{open:i,onOpenChange:o})]})}function W({m:s,owner:a}){const t=Q(),i=X(),[o,r]=f.useState(!1);return e.jsxs(j,{children:[e.jsx(c,{children:e.jsxs("span",{className:"flex items-center gap-2.5",children:[e.jsx(M,{className:"size-6",children:e.jsx(E,{className:"bg-brand-soft text-[10px] font-semibold text-brand",children:J(s.name,s.email)})}),e.jsx("span",{className:"font-medium",children:s.name||s.email}),s.you&&e.jsx(F,{variant:"outline",className:"text-[11px]",children:"you"})]})}),e.jsx(c,{className:"text-muted-foreground",children:s.email}),e.jsx(c,{children:a?e.jsxs(b,{"aria-label":`Role for ${s.email}`,value:s.role,onChange:h=>t.mutate({email:s.email,role:h.target.value}),children:[e.jsx("option",{value:"owner",children:"Owner"}),e.jsx("option",{value:"admin",children:"Admin"})]}):e.jsx("span",{className:"capitalize",children:s.role})}),a&&e.jsxs(c,{className:"text-right",children:[!s.you&&e.jsx(x,{variant:"ghost",size:"icon-sm","aria-label":`Remove ${s.email}`,onClick:()=>r(!0),children:e.jsx(B,{})}),e.jsx(q,{open:o,onOpenChange:r,title:`Remove ${s.name||s.email}?`,description:"Every session of theirs ends now. Nothing they wrote is destroyed.",confirmLabel:"Remove",busy:i.isPending,onConfirm:()=>{r(!1),i.mutate(s.email)}})]})]})}const Z=A({email:p().trim().email("An email address"),name:p().trim().max(120).optional(),role:C(["owner","admin"]),password:p().min(12,"At least 12 characters")});function ee({open:s,onOpenChange:a}){const t=Y(),[i,o]=f.useState(""),{register:r,handleSubmit:h,formState:n,reset:g}=S({resolver:D(Z),defaultValues:{role:"admin"}}),w=h(async l=>{o("");try{await t.mutateAsync({email:l.email,name:l.name??"",role:l.role,password:l.password}),g(),a(!1)}catch(v){o(N(v))}});return e.jsx(H,{open:s,onOpenChange:a,children:e.jsx(P,{children:e.jsxs("form",{onSubmit:w,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(z,{children:[e.jsx(I,{children:"Add a member"}),e.jsx(O,{children:"They sign in with this email and the password you set; there is no invitation mail, so you tell them the password yourself."})]}),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(m,{htmlFor:"member-email",children:"Email"}),e.jsx(u,{id:"member-email",type:"email",autoComplete:"off","aria-invalid":!!n.errors.email,...r("email")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(m,{htmlFor:"member-name",children:"Name"}),e.jsx(u,{id:"member-name",autoComplete:"off",...r("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(m,{htmlFor:"member-role",children:"Role"}),e.jsxs(b,{id:"member-role",className:"w-full",...r("role"),children:[e.jsx("option",{value:"admin",children:"Admin"}),e.jsx("option",{value:"owner",children:"Owner"})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(m,{htmlFor:"member-password",children:"Initial password"}),e.jsx(u,{id:"member-password",type:"text",autoComplete:"off","aria-invalid":!!n.errors.password,...r("password")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters — a short phrase of real words is fine. They can change it afterwards."})]}),e.jsxs(L,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(x,{type:"submit",disabled:n.isSubmitting,children:n.isSubmitting?"Adding…":"Add"})]})]})})})}export{we as component};
|