@snagset/server 0.1.32 → 0.1.34
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/db/migrations/0013_drop_derived_counts.sql +54 -0
- package/dist/projects.js +2 -6
- package/dist/projects.js.map +1 -1
- package/dist/routes/activity.js +8 -6
- package/dist/routes/activity.js.map +1 -1
- package/dist/routes/assignees.js +2 -2
- package/dist/routes/sites.js +1 -1
- package/dist/routes/threads.js +47 -26
- package/dist/routes/threads.js.map +1 -1
- package/dist/routes/widget.js +94 -21
- package/dist/routes/widget.js.map +1 -1
- package/package.json +1 -1
- package/static/dashboard/assets/{CompositeItem-H1Z2RNQW.js → CompositeItem-DOjAZOIw.js} +1 -1
- package/static/dashboard/assets/{ConfirmDialog-B_HO7qAV.js → ConfirmDialog-YHdRCMuk.js} +1 -1
- package/static/dashboard/assets/{CopyButton-BcFPdquT.js → CopyButton-BPFFhzYZ.js} +1 -1
- package/static/dashboard/assets/{FieldItemContext-D0Q4rB94.js → FieldItemContext-CvuTIqbu.js} +1 -1
- package/static/dashboard/assets/{InstallTag-wMa_lFPt.js → InstallTag-Dyle6Z7u.js} +1 -1
- package/static/dashboard/assets/{SaveState-DbiBWPbj.js → SaveState-zx4IRIWV.js} +1 -1
- package/static/dashboard/assets/{_app-CFqEeTw9.js → _app-BT2PvVrr.js} +1 -1
- package/static/dashboard/assets/{_app-CwVAgS6y.js → _app-CATs1X1F.js} +1 -1
- package/static/dashboard/assets/{activity-CRFVOJcj.js → activity-Ja8jqvTl.js} +1 -1
- package/static/dashboard/assets/{arrow-left-SbuaKLN8.js → arrow-left-D-J1WDaF.js} +1 -1
- package/static/dashboard/assets/{avatar-CyWjapbD.js → avatar-JYCiU767.js} +1 -1
- package/static/dashboard/assets/{badge-DZ45gt2t.js → badge-NV2UvVlq.js} +1 -1
- package/static/dashboard/assets/{card-rZNT8AAn.js → card-PWIpee1m.js} +1 -1
- package/static/dashboard/assets/{check-DFzW0E5F.js → check-fUN7a3GX.js} +1 -1
- package/static/dashboard/assets/{chevron-right-DNlmYM1H.js → chevron-right-D_gtsnlu.js} +1 -1
- package/static/dashboard/assets/{copy-CkgrfFiF.js → copy-ZBdagSqO.js} +1 -1
- package/static/dashboard/assets/{dialog-cAVg5CWG.js → dialog-B_kwIiUp.js} +1 -1
- package/static/dashboard/assets/{dropdown-menu-CROz9CD7.js → dropdown-menu-D5UGpMWY.js} +1 -1
- package/static/dashboard/assets/{image-off-dbox0Nj9.js → image-off-kQWiBpm4.js} +1 -1
- package/static/dashboard/assets/{index-NqrbvfSo.js → index-BCjjK9dr.js} +3 -3
- package/static/dashboard/assets/index-D6Jv0m8R.css +1 -0
- package/static/dashboard/assets/{invite-D3vU1POj.js → invite-Cn7ntzp8.js} +1 -1
- package/static/dashboard/assets/{label-CZtxPKnA.js → label-CU7jvj5k.js} +1 -1
- package/static/dashboard/assets/{layout-grid-CpSrFghR.js → layout-grid-DgutVVEL.js} +1 -1
- package/static/dashboard/assets/me-ttfbX4Cb.js +1 -0
- package/static/dashboard/assets/{parts-CMVHppEZ.js → parts-Oxy1krsw.js} +1 -1
- package/static/dashboard/assets/{plus-DvNJzVbr.js → plus-Cl722ZH_.js} +1 -1
- package/static/dashboard/assets/s._site-DI7lRsnw.js +1 -0
- package/static/dashboard/assets/s._site.comments-BLiaZNHo.js +54 -0
- package/static/dashboard/assets/{s._site.reviewers-sTkqblNS.js → s._site.reviewers-BuxVEObS.js} +1 -1
- package/static/dashboard/assets/{s._site.settings-BSKudlWC.js → s._site.settings-BLyC2Ix8.js} +1 -1
- package/static/dashboard/assets/{setup-ByemjiPq.js → setup-BUjOodJm.js} +1 -1
- package/static/dashboard/assets/{sign-in-C79cXPom.js → sign-in-CppGynIo.js} +1 -1
- package/static/dashboard/assets/{sign-up-Dg-EW0Ud.js → sign-up-BGy3UTxi.js} +1 -1
- package/static/dashboard/assets/{sites-DhF1WGvp.js → sites-CzRwDpMY.js} +1 -1
- package/static/dashboard/assets/studio-BJa7hKy2.js +1 -0
- package/static/dashboard/assets/{studio-oojSa61E.js → studio-DepK2GJ4.js} +1 -1
- package/static/dashboard/assets/{studio.index-CfkqMX5I.js → studio.index-C4hVZYkE.js} +1 -1
- package/static/dashboard/assets/{studio.integrations-C8ze7wcK.js → studio.integrations-2-WJQjiK.js} +1 -1
- package/static/dashboard/assets/{studio.members-BIR4VTee.js → studio.members-CMxEJYg1.js} +1 -1
- package/static/dashboard/assets/{sun-CCV5_Xwg.js → sun-DDSRise2.js} +1 -1
- package/static/dashboard/assets/{switch-pKWkWBSh.js → switch-L2_Pf-6w.js} +1 -1
- package/static/dashboard/assets/{table-BSlgpUtG.js → table-fR4tWQ4-.js} +1 -1
- package/static/dashboard/assets/{useAriaLabelledBy-BSt0Y1vn.js → useAriaLabelledBy-Bk7BENOF.js} +1 -1
- package/static/dashboard/assets/{useBaseQuery-BQZrcHmw.js → useBaseQuery-CoqlgX-x.js} +1 -1
- package/static/dashboard/assets/useQuery-6QR_MT4t.js +1 -0
- package/static/dashboard/assets/useRender-BybHPfHo.js +1 -0
- package/static/dashboard/assets/{useValueChanged-DKD8Vs7J.js → useValueChanged-BhvEiD3-.js} +1 -1
- package/static/dashboard/assets/{users-BH5_IfoG.js → users-STxJg0L8.js} +1 -1
- package/static/dashboard/assets/{welcome-BJqfqWXr.js → welcome-D7-mGhDy.js} +1 -1
- package/static/dashboard/assets/{widget-signin-D6LOaizs.js → widget-signin-jj3P3IbD.js} +1 -1
- package/static/dashboard/assets/{you-Bf2lJYxa.js → you-BMCOM6zE.js} +1 -1
- package/static/dashboard/assets/{zod-B-woswyx.js → zod-DbWDuTiO.js} +1 -1
- package/static/dashboard/index.html +2 -2
- package/static/widget/build.json +4 -0
- package/static/widget/snag.dock.js +4 -4
- package/static/widget/snag.js +1 -1
- package/static/widget/snag.runtime.js +2 -2
- package/static/dashboard/assets/index-BzWDSuyB.css +0 -1
- package/static/dashboard/assets/me-DuZzYTr0.js +0 -1
- package/static/dashboard/assets/s._site-1B1JBClP.js +0 -1
- package/static/dashboard/assets/s._site.comments-Pt7LgqE2.js +0 -54
- package/static/dashboard/assets/studio-D2RgHnii.js +0 -1
- package/static/dashboard/assets/useQuery-Ce8K2e88.js +0 -1
- package/static/dashboard/assets/useRender-CLH8yHqZ.js +0 -1
package/static/dashboard/assets/{s._site.settings-BSKudlWC.js → s._site.settings-BLyC2Ix8.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,h as Me,a6 as de,a7 as Oe,d as ue,a5 as _e,E as me,i as he,j as e,a8 as Ye,e as Q,aG as ve,aM as Ue,f as pe,aN as Qe,aO as Je,B as V,y as Ae,aP as Xe,aQ as Ze,o as et,aR as tt}from"./index-NqrbvfSo.js";import{u as Fe}from"./useQuery-Ce8K2e88.js";import{f as Te,h as Le,j as Ve,u as Ke,A as st,c as nt,n as at,g as ye,e as it,k as ot,l as rt,a as dt,I as ae,L as q}from"./label-CZtxPKnA.js";import{O as lt,L as ct,M as ut,N as mt,A as ft,aL as je,ak as Re,ad as le,a9 as ce,aM as Ce,aN as Ie,ao as ht,aO as we,aa as pt,ab as gt,aP as ke,aQ as Ne,aR as Se,aS as Ee,aT as xt,aU as bt,X as vt}from"./dialog-cAVg5CWG.js";import{b as yt,u as jt,C as Rt}from"./CompositeItem-H1Z2RNQW.js";import{u as Ct}from"./useValueChanged-DKD8Vs7J.js";import{u as It}from"./FieldItemContext-D0Q4rB94.js";import{u as wt}from"./useAriaLabelledBy-BSt0Y1vn.js";import{C as He}from"./ConfirmDialog-B_HO7qAV.js";import{C as kt}from"./CopyButton-BcFPdquT.js";import{I as Nt}from"./InstallTag-wMa_lFPt.js";import{B as St}from"./badge-DZ45gt2t.js";import{a as ne,P as Et}from"./parts-CMVHppEZ.js";import{u as Be}from"./me-DuZzYTr0.js";import{S as Pe}from"./switch-pKWkWBSh.js";import{S as Pt}from"./SaveState-DbiBWPbj.js";import{P as Dt}from"./plus-DvNJzVbr.js";import"./useBaseQuery-BQZrcHmw.js";import"./check-DFzW0E5F.js";import"./copy-CkgrfFiF.js";import"./useRender-CLH8yHqZ.js";import"./card-rZNT8AAn.js";import"./labels--UUyt9uB.js";const Mt=l.createContext(void 0);function Ot(s=!1){const t=l.useContext(Mt);if(!t&&!s)throw new Error(Me(86));return t}function At(s,t){return s.matches(":disabled")?!1:!t||s.form===t?!0:s.form===null&&!s.hasAttribute("form")}function Ft(s){return s==null||s.hasAttribute("disabled")||s.getAttribute("aria-disabled")==="true"}const fe={checked(s){return s?{"data-checked":""}:{"data-unchecked":""}},...lt,...Te},Ge="data-composite-item-active",ze=l.createContext(void 0);function Tt(){return l.useContext(ze)}function Lt(s){if(s==null)return"";if(typeof s=="string")return s;try{return JSON.stringify(s)}catch{return String(s)}}const We=l.createContext(void 0);function Vt(){const s=l.useContext(We);if(s===void 0)throw new Error(Me(52));return s}const Kt=l.forwardRef(function(t,n){const{render:d,className:o,disabled:c=!1,readOnly:r=!1,required:p=!1,"aria-labelledby":x,value:i,inputRef:T,nativeButton:h=!1,id:O,style:y,...j}=t,I=Tt(),{disabled:E,readOnly:_,required:b,form:B,checkedValue:R,touched:A=!1,validation:G,name:w,setCheckedValue:$=de,setTouched:Y=de,registerInputRef:a=de}=I??{},{setTouched:g,setFilled:v,state:k,disabled:P}=Le(),D=It(),{labelId:K,getDescriptionProps:J}=Ve(),m=P||D.disabled||E||c,f=_||r,L=b||p,H=B,N=I?R===i:i==="",F=l.useRef(null),S=l.useRef(null),z=G?.registerInput,W=l.useCallback(C=>z?.(C,{controlRef:F,value:void 0}),[z]),X=Oe(T,S,a,W);ue(()=>{S.current?.checked&&v(!0)},[v]),ue(()=>{if(S.current){if(m&&N){a(null);return}a(S.current)}},[N,m,a]);const ee=Ke(),te=st({id:O,implicit:!1,controlRef:F}),se=h?void 0:te,ie=wt(x,K,S,!h,se),oe={role:"radio","aria-checked":N,"aria-labelledby":ie,[Ge]:N?"":void 0,id:h?te:ee,onKeyDown(C){C.key==="Enter"&&C.preventDefault()},onClick(C){if(C.defaultPrevented||m||f)return;C.preventDefault();const Z=S.current;Z&&Ye(Z,C)},onFocus(C){C.defaultPrevented||m||f||!A||(S.current?.click(),Y(!1))}},{getButtonProps:re,buttonRef:u}=_e({disabled:m,native:h,composite:!1}),M={type:"radio",ref:X,form:H,id:se,name:w,tabIndex:-1,style:w?ct:ut,"aria-hidden":!0,...i!==void 0?{value:Lt(i)}:me,disabled:m,checked:N,required:L,readOnly:f,onChange(C){if(C.nativeEvent.defaultPrevented||m||f||i===void 0)return;const Z=nt(at,C.nativeEvent);$(i,Z),!Z.isCanceled&&g(!0)},onClick(C){C.stopPropagation()},onFocus(){F.current?.focus()}},U=l.useMemo(()=>({...k,required:L,disabled:m,readOnly:f,checked:N}),[k,m,f,N,L]),$e=U,ge=I!==void 0,xe=[n,F,u],be=[oe,j,re,J,G?C=>G.getValidationProps(m,C):me],qe=he("span",t,{enabled:!ge,state:U,ref:xe,props:be,stateAttributesMapping:fe});return e.jsxs(We.Provider,{value:$e,children:[ge?e.jsx(yt,{tag:"span",render:d,className:o,style:y,state:U,refs:xe,props:be,stateAttributesMapping:fe}):qe,e.jsx("input",{...M,suppressHydrationWarning:!0})]})}),Ht=l.forwardRef(function(t,n){const{render:d,className:o,style:c,keepMounted:r=!1,...p}=t,x=Vt(),i=x.checked,{mounted:T,transitionStatus:h,setMounted:O}=mt(i),y={...x,transitionStatus:h},j=l.useRef(null),I=r||T,E=he("span",t,{ref:[n,j],state:y,props:p,stateAttributesMapping:fe});return ft({open:i,ref:j,onComplete(){i||O(!1)}}),I?E:null}),Bt=[];function Gt(s){const{loopFocus:t=!0,orientation:n="both",grid:d,onLoop:o,direction:c,highlightedIndex:r,onHighlightedIndexChange:p,rootRef:x,enableHomeAndEndKeys:i=!1,stopEventPropagation:T,disabledIndices:h,modifierKeys:O=Bt}=s,[y,j]=l.useState(0),I=d!=null,E=l.useRef(null),_=Oe(E,x),b=l.useRef([]),B=l.useRef(!1),R=r??y,A=Q((a,g=!1)=>{if((p??j)(a),g){const v=b.current[a];je(E.current,v,c,n)}}),G=Q(a=>{if(a.size===0||B.current)return;B.current=!0;const g=Array.from(a.keys()),v=g.find(P=>P?.hasAttribute(Ge))??null,k=v?a.get(v)?.index??-1:-1;if(k!==-1)A(k);else if(Re(g,R,h)){const P=le(g,{disabledIndices:h});ce(g,P)||A(P)}je(E.current,v,c,n)});ue(()=>{if(h==null||r!=null||!B.current)return;const a=b.current;if(Re(a,R,h)){const g=le(a,{disabledIndices:h});ce(a,g)||A(g)}},[h,r,R,b,A]);const w=Q((a,g,v)=>o?o(a,g,v,b):v),$=Q(a=>{const g=a.key===Ce||a.key===Ie;if(!ht.has(a.key)||!i&&g||zt(a,O)||!E.current)return;const k=c==="rtl",P=k?Se:Ee,D=k?Ee:Se,K=n==="vertical"?ke:P,J=n==="vertical"?Ne:D,m=ye(a.nativeEvent);if(m!=null&&we(m)&&!Ft(m)){const S=m.selectionStart,z=m.selectionEnd,W=m.value;if(S==null||a.shiftKey||S!==z||a.key!==J&&S<W.length||a.key!==K&&S>0)return}let f=R;const L=pt(b,h),H=gt(b,h);d!=null&&(f=d({disabledIndices:h,elementsRef:b,event:a,highlightedIndex:R,loopFocus:t,maxIndex:H,minIndex:L,onLoop:w,orientation:n,rtl:k}));const N=n!=="vertical"&&a.key===P||n!=="horizontal"&&a.key===ke,F=n!=="vertical"&&a.key===D||n!=="horizontal"&&a.key===Ne;i&&(a.key===Ce?f=L:a.key===Ie&&(f=H)),f===R&&(N||F)&&(t&&f===H&&N?(f=L,o&&(f=o(a,R,f,b))):t&&f===L&&F?(f=H,o&&(f=o(a,R,f,b))):f=le(b.current,{startingIndex:f,decrement:F,disabledIndices:h})),f!==R&&!ce(b.current,f)&&(T&&a.stopPropagation(),(I||g||N||F)&&a.preventDefault(),A(f,!0),queueMicrotask(()=>{b.current[f]?.focus()}))});return{props:{ref:_,onFocus(a){const g=E.current,v=ye(a.nativeEvent);!g||v==null||!we(v)||v.setSelectionRange(0,v.value.length)},onKeyDown:$},highlightedIndex:R,onHighlightedIndexChange:A,elementsRef:b,onMapChange:G,relayKeyboardEvent:$}}function zt(s,t){for(const n of xt)if(!t.includes(n)&&s.getModifierState(n))return!0;return!1}function Wt(s){const{render:t,className:n,style:d,refs:o=ve,props:c=ve,state:r=me,stateAttributesMapping:p,highlightedIndex:x,onHighlightedIndexChange:i,orientation:T,grid:h,loopFocus:O,onLoop:y,enableHomeAndEndKeys:j,onMapChange:I,stopEventPropagation:E=!0,rootRef:_,disabledIndices:b,modifierKeys:B,highlightItemOnHover:R=!1,tag:A="div",...G}=s,w=jt(),{props:$,highlightedIndex:Y,onHighlightedIndexChange:a,elementsRef:g,onMapChange:v,relayKeyboardEvent:k}=Gt({grid:h,loopFocus:O,onLoop:y,orientation:T,highlightedIndex:x,onHighlightedIndexChange:i,rootRef:_,stopEventPropagation:E,enableHomeAndEndKeys:j,direction:w,disabledIndices:b,modifierKeys:B}),P=he(A,s,{state:r,ref:o,props:[$,...c,G],stateAttributesMapping:p}),D=l.useMemo(()=>({highlightedIndex:Y,onHighlightedIndexChange:a,highlightItemOnHover:R,relayKeyboardEvent:k}),[Y,a,R,k]);return e.jsx(Ue.Provider,{value:D,children:e.jsx(Rt,{elementsRef:g,onMapChange:K=>{I?.(K),v(K)},children:P})})}const $t=[bt],qt=l.forwardRef(function(t,n){const{render:d,className:o,disabled:c,readOnly:r,required:p,onValueChange:x,value:i,defaultValue:T,form:h,name:O,inputRef:y,id:j,style:I,...E}=t,{setTouched:_,setFocused:b,validationMode:B,name:R,disabled:A,state:G,validation:w,setDirty:$,setFilled:Y,validityData:a}=Le(),{labelId:g}=Ve(),{clearErrors:v,elementRef:k}=it(),P=Ot(!0),D=A||c,K=R??O,J=Ke(j),[m,f]=ot({controlled:i,default:T,name:"RadioGroup",state:"value"}),[L,H]=l.useState(!1),N=Q((u,M)=>{x?.(u,M),!M.isCanceled&&f(u)}),F=w.getInputControl,S=l.useMemo(()=>({get current(){return F()}}),[F]),z=l.useRef(null),W=l.useRef(null);function X(u){let M;return y&&(typeof y=="function"?M=y(u):y.current=u),z.current=u,M}const ee=Q(u=>{if(!u||u.disabled)return;W.current||(W.current=u);const M=z.current,U=u.checked||M==null||M.disabled?X(u):void 0;return()=>{W.current===u&&(W.current=null),z.current===u?U?(U(),z.current=null):X(null):U?.()}}),te=Q(()=>{const u=k.current;if(!u)return m??null;for(const M of w.registeredInputs.keys())if(M.checked&&At(M,u))return m??null;return null});rt(S,J,m??null,te,!D,O),Ct(m,()=>{v(K),$(m!==a.initialValue),Y(m!=null),w.change(m);const u=W.current;m==null&&u&&!u.disabled&&X(u)});const se=g??P?.legendId,ie={...G,disabled:D??!1,required:p??!1,readOnly:r??!1},oe=l.useMemo(()=>({checkedValue:m,disabled:D,form:h,validation:w,name:K,readOnly:r,registerInputRef:ee,required:p,setCheckedValue:N,setTouched:H,touched:L}),[m,D,h,w,K,r,ee,p,N,H,L]),re={id:j,role:"radiogroup","aria-required":p||void 0,"aria-disabled":D||void 0,"aria-readonly":r||void 0,"aria-labelledby":se,onFocus(){b(!0)},onBlur(u){dt(u.currentTarget,u.relatedTarget)||(_(!0),b(!1),B==="onBlur"&&w.commit(m))},onKeyDownCapture(u){u.key.startsWith("Arrow")&&(H(!0),b(!0))}};return e.jsx(ze.Provider,{value:oe,children:e.jsx(Wt,{render:d,className:o,style:I,state:ie,props:[re,E,u=>w.getValidationProps(D??!1,u)],refs:[n],stateAttributesMapping:Te,enableHomeAndEndKeys:!1,modifierKeys:$t})})});function _t({className:s,...t}){return e.jsx(qt,{"data-slot":"radio-group",className:pe("grid w-full gap-2",s),...t})}function Yt({className:s,...t}){return e.jsx(Kt,{"data-slot":"radio-group-item",className:pe("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",s),...t,children:e.jsx(Ht,{"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"})})})}function Ut({uid:s}){const t=Be(),n=Fe(Ae.rounds(s)),d=t.user.role==="owner"||t.user.role==="admin",o=n.data?.data??[],c=o.filter(r=>!r.closed&&!r.archived).length;return e.jsxs(ne,{title:"Rounds",description:e.jsx(e.Fragment,{children:"One pass of feedback each, and several can run at once — your own QA beside the client's. A new comment goes to the round its reviewer is looking at. Archive a finished round to put it away; delete removes its comments too."}),children:[!d&&e.jsx("p",{className:"m-0 text-[12.5px] text-muted-foreground",children:"Only an owner or an admin can change rounds."}),e.jsxs("ul",{className:"m-0 flex list-none flex-col divide-y divide-border p-0","aria-label":"Rounds",children:[o.map(r=>e.jsx(Qt,{uid:s,round:r,manager:d,last:!r.closed&&!r.archived&&c===1},r.id)),n.isSuccess&&o.length===0&&e.jsx("li",{className:"text-[12.5px] text-muted-foreground",children:"No rounds yet."})]})]})}const De="Open another round first — new comments need somewhere to go.";function Qt({uid:s,round:t,manager:n,last:d}){const o=Qe(s),c=Je(s),[r,p]=l.useState(!1),[x,i]=l.useState(t.name),[T,h]=l.useState(!1),O=t.archived?"archived":t.closed?"closed":"open",y=o.isPending||c.isPending;return e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 py-2.5 first:pt-0 last:pb-0",children:[r?e.jsxs("form",{className:"flex min-w-0 flex-1 items-center gap-2",onSubmit:j=>{j.preventDefault();const I=x.trim();if(!I||I===t.name)return p(!1);o.mutate({id:t.id,name:I},{onSuccess:()=>p(!1)})},children:[e.jsx(ae,{"aria-label":`New name for ${t.name}`,value:x,maxLength:80,autoFocus:!0,onChange:j=>i(j.target.value),onKeyDown:j=>j.key==="Escape"&&p(!1)}),e.jsx(V,{type:"submit",size:"sm",disabled:!x.trim()||o.isPending,children:"Save"}),e.jsx(V,{type:"button",size:"sm",variant:"ghost",onClick:()=>p(!1),children:"Cancel"})]}):e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-[13.5px] font-medium",children:t.name}),e.jsx(St,{variant:"outline",className:"text-[11px]",children:O})]}),e.jsxs("p",{className:"m-0 mt-0.5 text-[12px] text-muted-foreground",children:["Round ",t.number," · ",t.threads," ",t.threads===1?"comment":"comments",t.unresolved>0?` · ${t.unresolved} unresolved`:""]})]}),n&&!r&&e.jsxs("div",{className:"flex flex-wrap items-center gap-1",title:d?De:void 0,children:[e.jsx(V,{size:"sm",variant:"ghost","aria-label":`Rename ${t.name}`,disabled:y,onClick:()=>{i(t.name),p(!0)},children:"Rename"}),!t.archived&&e.jsx(V,{size:"sm",variant:"ghost","aria-label":`${t.closed?"Reopen":"Close"} ${t.name}`,disabled:y||d,onClick:()=>o.mutate({id:t.id,closed:!t.closed}),children:t.closed?"Reopen":"Close"}),e.jsx(V,{size:"sm",variant:"ghost","aria-label":`${t.archived?"Restore":"Archive"} ${t.name}`,disabled:y||d,onClick:()=>o.mutate({id:t.id,archived:!t.archived}),children:t.archived?"Restore":"Archive"}),e.jsx(V,{size:"sm",variant:"ghost",className:"text-destructive","aria-label":`Delete ${t.name}`,disabled:y||d,onClick:()=>h(!0),children:"Delete…"})]}),n&&d&&!r&&e.jsx("p",{className:"m-0 w-full text-[12px] text-muted-foreground",children:De}),e.jsx(He,{open:T,onOpenChange:h,title:`Delete ${t.name}?`,description:t.threads>0?e.jsxs(e.Fragment,{children:["This deletes the round and"," ",e.jsxs("b",{className:"font-semibold text-foreground",children:[t.threads," ",t.threads===1?"comment":"comments"," and their screenshots"]}),". Reviewers stop seeing them straight away. To keep them out of sight instead, archive the round."]}):e.jsxs(e.Fragment,{children:["This round has no comments. Its number, Round ",t.number,", is not used again."]}),confirmLabel:"Delete round",confirmWord:t.name,busy:c.isPending,onConfirm:()=>c.mutate({id:t.id,confirm:t.name},{onSuccess:()=>h(!1)})})]})}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 ws(){const{site:s}=Xe.useParams(),t=Be(),n=t.projects.find(i=>i.uid===s),d=t.user.role==="owner"||t.user.role==="admin",o=Fe(Ae.origins(s)),c=Ze(s),[r,p]=l.useState(null),x=i=>c.mutate(i,{onSuccess:()=>p(Date.now())});return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(Et,{title:"Settings",sub:n.name,actions:e.jsx(Pt,{saving:c.isPending,savedAt:r})}),e.jsxs(ne,{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:n.uid}),e.jsx(kt,{text:n.uid,label:"Copy the site ID"})]})]}),e.jsx(Xt,{name:n.name,onSave:i=>x({name:i})}),e.jsx(Zt,{domain:o.data?.domain??null,loaded:o.isSuccess,onSave:i=>x({domain:i})}),e.jsx(es,{list:o.data?.origins??[],loaded:o.isSuccess,hasDomain:!!o.data?.domain,onChange:i=>x({origins:i})})]}),e.jsxs(ne,{title:"Widget",description:"Whether it runs, who the toolbar appears for, what guests may do, 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(Pe,{id:"widget-on","aria-label":"Widget on this site",checked:n.status!=="paused",onCheckedChange:i=>x({status:i?"active":"paused"})})]}),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:"guests-status",className:"text-[13px] font-medium",children:"Guests can change status"}),e.jsxs("p",{className:"m-0 mt-0.5 text-[12px] leading-normal text-muted-foreground",children:["People who comment without an account or a review link can move a comment between Open, In progress, In review and Resolved.",!d&&" Only an owner or an admin can change this."]})]}),e.jsx(Pe,{id:"guests-status","aria-label":"Guests can change status",checked:n.guestsCanChangeStatus!==!1,disabled:!d,onCheckedChange:i=>x({guestsCanChangeStatus:i})})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(q,{children:"Who can comment"}),e.jsx(_t,{value:n.writeMode,onValueChange:i=>x({writeMode:String(i)}),className:"gap-2",children:Jt.map(i=>e.jsxs("label",{className:pe("flex cursor-pointer items-start gap-2.5 rounded-md border border-border px-3 py-2.5",n.writeMode===i.id&&"border-brand bg-brand-soft"),children:[e.jsx(Yt,{value:i.id,className:"mt-0.5","aria-label":i.title}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-[13px] font-medium",children:i.title}),e.jsx("span",{className:"block text-[12px] leading-normal text-muted-foreground",children:i.note})]})]},i.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(q,{children:"The tag"}),e.jsx(Nt,{uid:n.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(Ut,{uid:s}),e.jsx(ts,{uid:s,name:n.name})]})}function Xt({name:s,onSave:t}){const[n,d]=l.useState(s);l.useEffect(()=>d(s),[s]);const o=n.trim().length>0&&n.trim()!==s;return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:c=>{c.preventDefault(),o&&t(n.trim())},children:[e.jsx(q,{htmlFor:"site-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{id:"site-name",value:n,onChange:c=>d(c.target.value)}),o&&e.jsx(V,{type:"submit",variant:"outline",children:"Save"})]})]})}function Zt({domain:s,loaded:t,onSave:n}){const[d,o]=l.useState(s??"");l.useEffect(()=>o(s??""),[s]);const c=d.trim()!==(s??"");return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:r=>{r.preventDefault(),c&&n(d.trim()||null)},children:[e.jsx(q,{htmlFor:"site-domain",children:"Domain"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{id:"site-domain",placeholder:"kilnwork.studio",value:d,onChange:r=>o(r.target.value),disabled:!t}),c&&e.jsx(V,{type:"submit",variant:"outline",children:d.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 es({list:s,loaded:t,hasDomain:n,onChange:d}){const[o,c]=l.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:[s.map(r=>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:r}),e.jsx(V,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`Remove ${r}`,disabled:s.length<=1&&!n,onClick:()=>d(s.filter(p=>p!==r)),children:e.jsx(vt,{})})]},r)),t&&s.length===0&&e.jsx("li",{className:"text-[12.5px] text-muted-foreground",children:n?"None besides the domain.":"No address yet."})]}),e.jsxs("form",{className:"flex gap-2",onSubmit:r=>{r.preventDefault();const p=o.trim();p&&(d([...s,p]),c(""))},children:[e.jsx(ae,{id:"site-origin-add",placeholder:"https://staging.example.com",value:o,onChange:r=>c(r.target.value)}),e.jsxs(V,{type:"submit",variant:"outline",disabled:!o.trim(),children:[e.jsx(Dt,{}),"Add"]})]})]})}function ts({uid:s,name:t}){const[n,d]=l.useState(!1),o=et(),c=tt(s);return e.jsxs(ne,{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(V,{type:"button",variant:"outline",className:"border-destructive text-destructive",onClick:()=>d(!0),children:["Delete ",t,"…"]})]}),e.jsx(He,{open:n,onOpenChange:d,title:`Delete ${t}?`,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:t,busy:c.isPending,onConfirm:()=>c.mutate(void 0,{onSuccess:()=>{d(!1),o({to:"/sites"})}})})]})}export{ws as component};
|
|
1
|
+
import{r as l,h as Me,a6 as de,a7 as Oe,d as ue,a5 as _e,E as me,i as he,j as e,a8 as Ye,e as Q,aG as ve,aM as Ue,f as pe,aN as Qe,aO as Je,B as V,y as Ae,aP as Xe,aQ as Ze,o as et,aR as tt}from"./index-BCjjK9dr.js";import{u as Fe}from"./useQuery-6QR_MT4t.js";import{f as Te,h as Le,j as Ve,u as Ke,A as st,c as nt,n as at,g as ye,e as it,k as ot,l as rt,a as dt,I as ae,L as q}from"./label-CU7jvj5k.js";import{O as lt,L as ct,M as ut,N as mt,A as ft,aL as je,ak as Re,ad as le,a9 as ce,aM as Ce,aN as Ie,ao as ht,aO as we,aa as pt,ab as gt,aP as ke,aQ as Ne,aR as Se,aS as Ee,aT as xt,aU as bt,X as vt}from"./dialog-B_kwIiUp.js";import{b as yt,u as jt,C as Rt}from"./CompositeItem-DOjAZOIw.js";import{u as Ct}from"./useValueChanged-BhvEiD3-.js";import{u as It}from"./FieldItemContext-CvuTIqbu.js";import{u as wt}from"./useAriaLabelledBy-Bk7BENOF.js";import{C as He}from"./ConfirmDialog-YHdRCMuk.js";import{C as kt}from"./CopyButton-BPFFhzYZ.js";import{I as Nt}from"./InstallTag-Dyle6Z7u.js";import{B as St}from"./badge-NV2UvVlq.js";import{a as ne,P as Et}from"./parts-Oxy1krsw.js";import{u as Be}from"./me-ttfbX4Cb.js";import{S as Pe}from"./switch-L2_Pf-6w.js";import{S as Pt}from"./SaveState-zx4IRIWV.js";import{P as Dt}from"./plus-Cl722ZH_.js";import"./useBaseQuery-CoqlgX-x.js";import"./check-fUN7a3GX.js";import"./copy-ZBdagSqO.js";import"./useRender-BybHPfHo.js";import"./card-PWIpee1m.js";import"./labels--UUyt9uB.js";const Mt=l.createContext(void 0);function Ot(s=!1){const t=l.useContext(Mt);if(!t&&!s)throw new Error(Me(86));return t}function At(s,t){return s.matches(":disabled")?!1:!t||s.form===t?!0:s.form===null&&!s.hasAttribute("form")}function Ft(s){return s==null||s.hasAttribute("disabled")||s.getAttribute("aria-disabled")==="true"}const fe={checked(s){return s?{"data-checked":""}:{"data-unchecked":""}},...lt,...Te},Ge="data-composite-item-active",ze=l.createContext(void 0);function Tt(){return l.useContext(ze)}function Lt(s){if(s==null)return"";if(typeof s=="string")return s;try{return JSON.stringify(s)}catch{return String(s)}}const We=l.createContext(void 0);function Vt(){const s=l.useContext(We);if(s===void 0)throw new Error(Me(52));return s}const Kt=l.forwardRef(function(t,n){const{render:d,className:o,disabled:c=!1,readOnly:r=!1,required:p=!1,"aria-labelledby":x,value:i,inputRef:T,nativeButton:h=!1,id:O,style:y,...j}=t,I=Tt(),{disabled:E,readOnly:_,required:b,form:B,checkedValue:R,touched:A=!1,validation:G,name:w,setCheckedValue:$=de,setTouched:Y=de,registerInputRef:a=de}=I??{},{setTouched:g,setFilled:v,state:k,disabled:P}=Le(),D=It(),{labelId:K,getDescriptionProps:J}=Ve(),m=P||D.disabled||E||c,f=_||r,L=b||p,H=B,N=I?R===i:i==="",F=l.useRef(null),S=l.useRef(null),z=G?.registerInput,W=l.useCallback(C=>z?.(C,{controlRef:F,value:void 0}),[z]),X=Oe(T,S,a,W);ue(()=>{S.current?.checked&&v(!0)},[v]),ue(()=>{if(S.current){if(m&&N){a(null);return}a(S.current)}},[N,m,a]);const ee=Ke(),te=st({id:O,implicit:!1,controlRef:F}),se=h?void 0:te,ie=wt(x,K,S,!h,se),oe={role:"radio","aria-checked":N,"aria-labelledby":ie,[Ge]:N?"":void 0,id:h?te:ee,onKeyDown(C){C.key==="Enter"&&C.preventDefault()},onClick(C){if(C.defaultPrevented||m||f)return;C.preventDefault();const Z=S.current;Z&&Ye(Z,C)},onFocus(C){C.defaultPrevented||m||f||!A||(S.current?.click(),Y(!1))}},{getButtonProps:re,buttonRef:u}=_e({disabled:m,native:h,composite:!1}),M={type:"radio",ref:X,form:H,id:se,name:w,tabIndex:-1,style:w?ct:ut,"aria-hidden":!0,...i!==void 0?{value:Lt(i)}:me,disabled:m,checked:N,required:L,readOnly:f,onChange(C){if(C.nativeEvent.defaultPrevented||m||f||i===void 0)return;const Z=nt(at,C.nativeEvent);$(i,Z),!Z.isCanceled&&g(!0)},onClick(C){C.stopPropagation()},onFocus(){F.current?.focus()}},U=l.useMemo(()=>({...k,required:L,disabled:m,readOnly:f,checked:N}),[k,m,f,N,L]),$e=U,ge=I!==void 0,xe=[n,F,u],be=[oe,j,re,J,G?C=>G.getValidationProps(m,C):me],qe=he("span",t,{enabled:!ge,state:U,ref:xe,props:be,stateAttributesMapping:fe});return e.jsxs(We.Provider,{value:$e,children:[ge?e.jsx(yt,{tag:"span",render:d,className:o,style:y,state:U,refs:xe,props:be,stateAttributesMapping:fe}):qe,e.jsx("input",{...M,suppressHydrationWarning:!0})]})}),Ht=l.forwardRef(function(t,n){const{render:d,className:o,style:c,keepMounted:r=!1,...p}=t,x=Vt(),i=x.checked,{mounted:T,transitionStatus:h,setMounted:O}=mt(i),y={...x,transitionStatus:h},j=l.useRef(null),I=r||T,E=he("span",t,{ref:[n,j],state:y,props:p,stateAttributesMapping:fe});return ft({open:i,ref:j,onComplete(){i||O(!1)}}),I?E:null}),Bt=[];function Gt(s){const{loopFocus:t=!0,orientation:n="both",grid:d,onLoop:o,direction:c,highlightedIndex:r,onHighlightedIndexChange:p,rootRef:x,enableHomeAndEndKeys:i=!1,stopEventPropagation:T,disabledIndices:h,modifierKeys:O=Bt}=s,[y,j]=l.useState(0),I=d!=null,E=l.useRef(null),_=Oe(E,x),b=l.useRef([]),B=l.useRef(!1),R=r??y,A=Q((a,g=!1)=>{if((p??j)(a),g){const v=b.current[a];je(E.current,v,c,n)}}),G=Q(a=>{if(a.size===0||B.current)return;B.current=!0;const g=Array.from(a.keys()),v=g.find(P=>P?.hasAttribute(Ge))??null,k=v?a.get(v)?.index??-1:-1;if(k!==-1)A(k);else if(Re(g,R,h)){const P=le(g,{disabledIndices:h});ce(g,P)||A(P)}je(E.current,v,c,n)});ue(()=>{if(h==null||r!=null||!B.current)return;const a=b.current;if(Re(a,R,h)){const g=le(a,{disabledIndices:h});ce(a,g)||A(g)}},[h,r,R,b,A]);const w=Q((a,g,v)=>o?o(a,g,v,b):v),$=Q(a=>{const g=a.key===Ce||a.key===Ie;if(!ht.has(a.key)||!i&&g||zt(a,O)||!E.current)return;const k=c==="rtl",P=k?Se:Ee,D=k?Ee:Se,K=n==="vertical"?ke:P,J=n==="vertical"?Ne:D,m=ye(a.nativeEvent);if(m!=null&&we(m)&&!Ft(m)){const S=m.selectionStart,z=m.selectionEnd,W=m.value;if(S==null||a.shiftKey||S!==z||a.key!==J&&S<W.length||a.key!==K&&S>0)return}let f=R;const L=pt(b,h),H=gt(b,h);d!=null&&(f=d({disabledIndices:h,elementsRef:b,event:a,highlightedIndex:R,loopFocus:t,maxIndex:H,minIndex:L,onLoop:w,orientation:n,rtl:k}));const N=n!=="vertical"&&a.key===P||n!=="horizontal"&&a.key===ke,F=n!=="vertical"&&a.key===D||n!=="horizontal"&&a.key===Ne;i&&(a.key===Ce?f=L:a.key===Ie&&(f=H)),f===R&&(N||F)&&(t&&f===H&&N?(f=L,o&&(f=o(a,R,f,b))):t&&f===L&&F?(f=H,o&&(f=o(a,R,f,b))):f=le(b.current,{startingIndex:f,decrement:F,disabledIndices:h})),f!==R&&!ce(b.current,f)&&(T&&a.stopPropagation(),(I||g||N||F)&&a.preventDefault(),A(f,!0),queueMicrotask(()=>{b.current[f]?.focus()}))});return{props:{ref:_,onFocus(a){const g=E.current,v=ye(a.nativeEvent);!g||v==null||!we(v)||v.setSelectionRange(0,v.value.length)},onKeyDown:$},highlightedIndex:R,onHighlightedIndexChange:A,elementsRef:b,onMapChange:G,relayKeyboardEvent:$}}function zt(s,t){for(const n of xt)if(!t.includes(n)&&s.getModifierState(n))return!0;return!1}function Wt(s){const{render:t,className:n,style:d,refs:o=ve,props:c=ve,state:r=me,stateAttributesMapping:p,highlightedIndex:x,onHighlightedIndexChange:i,orientation:T,grid:h,loopFocus:O,onLoop:y,enableHomeAndEndKeys:j,onMapChange:I,stopEventPropagation:E=!0,rootRef:_,disabledIndices:b,modifierKeys:B,highlightItemOnHover:R=!1,tag:A="div",...G}=s,w=jt(),{props:$,highlightedIndex:Y,onHighlightedIndexChange:a,elementsRef:g,onMapChange:v,relayKeyboardEvent:k}=Gt({grid:h,loopFocus:O,onLoop:y,orientation:T,highlightedIndex:x,onHighlightedIndexChange:i,rootRef:_,stopEventPropagation:E,enableHomeAndEndKeys:j,direction:w,disabledIndices:b,modifierKeys:B}),P=he(A,s,{state:r,ref:o,props:[$,...c,G],stateAttributesMapping:p}),D=l.useMemo(()=>({highlightedIndex:Y,onHighlightedIndexChange:a,highlightItemOnHover:R,relayKeyboardEvent:k}),[Y,a,R,k]);return e.jsx(Ue.Provider,{value:D,children:e.jsx(Rt,{elementsRef:g,onMapChange:K=>{I?.(K),v(K)},children:P})})}const $t=[bt],qt=l.forwardRef(function(t,n){const{render:d,className:o,disabled:c,readOnly:r,required:p,onValueChange:x,value:i,defaultValue:T,form:h,name:O,inputRef:y,id:j,style:I,...E}=t,{setTouched:_,setFocused:b,validationMode:B,name:R,disabled:A,state:G,validation:w,setDirty:$,setFilled:Y,validityData:a}=Le(),{labelId:g}=Ve(),{clearErrors:v,elementRef:k}=it(),P=Ot(!0),D=A||c,K=R??O,J=Ke(j),[m,f]=ot({controlled:i,default:T,name:"RadioGroup",state:"value"}),[L,H]=l.useState(!1),N=Q((u,M)=>{x?.(u,M),!M.isCanceled&&f(u)}),F=w.getInputControl,S=l.useMemo(()=>({get current(){return F()}}),[F]),z=l.useRef(null),W=l.useRef(null);function X(u){let M;return y&&(typeof y=="function"?M=y(u):y.current=u),z.current=u,M}const ee=Q(u=>{if(!u||u.disabled)return;W.current||(W.current=u);const M=z.current,U=u.checked||M==null||M.disabled?X(u):void 0;return()=>{W.current===u&&(W.current=null),z.current===u?U?(U(),z.current=null):X(null):U?.()}}),te=Q(()=>{const u=k.current;if(!u)return m??null;for(const M of w.registeredInputs.keys())if(M.checked&&At(M,u))return m??null;return null});rt(S,J,m??null,te,!D,O),Ct(m,()=>{v(K),$(m!==a.initialValue),Y(m!=null),w.change(m);const u=W.current;m==null&&u&&!u.disabled&&X(u)});const se=g??P?.legendId,ie={...G,disabled:D??!1,required:p??!1,readOnly:r??!1},oe=l.useMemo(()=>({checkedValue:m,disabled:D,form:h,validation:w,name:K,readOnly:r,registerInputRef:ee,required:p,setCheckedValue:N,setTouched:H,touched:L}),[m,D,h,w,K,r,ee,p,N,H,L]),re={id:j,role:"radiogroup","aria-required":p||void 0,"aria-disabled":D||void 0,"aria-readonly":r||void 0,"aria-labelledby":se,onFocus(){b(!0)},onBlur(u){dt(u.currentTarget,u.relatedTarget)||(_(!0),b(!1),B==="onBlur"&&w.commit(m))},onKeyDownCapture(u){u.key.startsWith("Arrow")&&(H(!0),b(!0))}};return e.jsx(ze.Provider,{value:oe,children:e.jsx(Wt,{render:d,className:o,style:I,state:ie,props:[re,E,u=>w.getValidationProps(D??!1,u)],refs:[n],stateAttributesMapping:Te,enableHomeAndEndKeys:!1,modifierKeys:$t})})});function _t({className:s,...t}){return e.jsx(qt,{"data-slot":"radio-group",className:pe("grid w-full gap-2",s),...t})}function Yt({className:s,...t}){return e.jsx(Kt,{"data-slot":"radio-group-item",className:pe("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",s),...t,children:e.jsx(Ht,{"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"})})})}function Ut({uid:s}){const t=Be(),n=Fe(Ae.rounds(s)),d=t.user.role==="owner"||t.user.role==="admin",o=n.data?.data??[],c=o.filter(r=>!r.closed&&!r.archived).length;return e.jsxs(ne,{title:"Rounds",description:e.jsx(e.Fragment,{children:"One pass of feedback each, and several can run at once — your own QA beside the client's. A new comment goes to the round its reviewer is looking at. Archive a finished round to put it away; delete removes its comments too."}),children:[!d&&e.jsx("p",{className:"m-0 text-[12.5px] text-muted-foreground",children:"Only an owner or an admin can change rounds."}),e.jsxs("ul",{className:"m-0 flex list-none flex-col divide-y divide-border p-0","aria-label":"Rounds",children:[o.map(r=>e.jsx(Qt,{uid:s,round:r,manager:d,last:!r.closed&&!r.archived&&c===1},r.id)),n.isSuccess&&o.length===0&&e.jsx("li",{className:"text-[12.5px] text-muted-foreground",children:"No rounds yet."})]})]})}const De="Open another round first — new comments need somewhere to go.";function Qt({uid:s,round:t,manager:n,last:d}){const o=Qe(s),c=Je(s),[r,p]=l.useState(!1),[x,i]=l.useState(t.name),[T,h]=l.useState(!1),O=t.archived?"archived":t.closed?"closed":"open",y=o.isPending||c.isPending;return e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 py-2.5 first:pt-0 last:pb-0",children:[r?e.jsxs("form",{className:"flex min-w-0 flex-1 items-center gap-2",onSubmit:j=>{j.preventDefault();const I=x.trim();if(!I||I===t.name)return p(!1);o.mutate({id:t.id,name:I},{onSuccess:()=>p(!1)})},children:[e.jsx(ae,{"aria-label":`New name for ${t.name}`,value:x,maxLength:80,autoFocus:!0,onChange:j=>i(j.target.value),onKeyDown:j=>j.key==="Escape"&&p(!1)}),e.jsx(V,{type:"submit",size:"sm",disabled:!x.trim()||o.isPending,children:"Save"}),e.jsx(V,{type:"button",size:"sm",variant:"ghost",onClick:()=>p(!1),children:"Cancel"})]}):e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-[13.5px] font-medium",children:t.name}),e.jsx(St,{variant:"outline",className:"text-[11px]",children:O})]}),e.jsxs("p",{className:"m-0 mt-0.5 text-[12px] text-muted-foreground",children:["Round ",t.number," · ",t.threads," ",t.threads===1?"comment":"comments",t.unresolved>0?` · ${t.unresolved} unresolved`:""]})]}),n&&!r&&e.jsxs("div",{className:"flex flex-wrap items-center gap-1",title:d?De:void 0,children:[e.jsx(V,{size:"sm",variant:"ghost","aria-label":`Rename ${t.name}`,disabled:y,onClick:()=>{i(t.name),p(!0)},children:"Rename"}),!t.archived&&e.jsx(V,{size:"sm",variant:"ghost","aria-label":`${t.closed?"Reopen":"Close"} ${t.name}`,disabled:y||d,onClick:()=>o.mutate({id:t.id,closed:!t.closed}),children:t.closed?"Reopen":"Close"}),e.jsx(V,{size:"sm",variant:"ghost","aria-label":`${t.archived?"Restore":"Archive"} ${t.name}`,disabled:y||d,onClick:()=>o.mutate({id:t.id,archived:!t.archived}),children:t.archived?"Restore":"Archive"}),e.jsx(V,{size:"sm",variant:"ghost",className:"text-destructive","aria-label":`Delete ${t.name}`,disabled:y||d,onClick:()=>h(!0),children:"Delete…"})]}),n&&d&&!r&&e.jsx("p",{className:"m-0 w-full text-[12px] text-muted-foreground",children:De}),e.jsx(He,{open:T,onOpenChange:h,title:`Delete ${t.name}?`,description:t.threads>0?e.jsxs(e.Fragment,{children:["This deletes the round and"," ",e.jsxs("b",{className:"font-semibold text-foreground",children:[t.threads," ",t.threads===1?"comment":"comments"," and their screenshots"]}),". Reviewers stop seeing them straight away. To keep them out of sight instead, archive the round."]}):e.jsxs(e.Fragment,{children:["This round has no comments. Its number, Round ",t.number,", is not used again."]}),confirmLabel:"Delete round",confirmWord:t.name,busy:c.isPending,onConfirm:()=>c.mutate({id:t.id,confirm:t.name},{onSuccess:()=>h(!1)})})]})}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 ws(){const{site:s}=Xe.useParams(),t=Be(),n=t.projects.find(i=>i.uid===s),d=t.user.role==="owner"||t.user.role==="admin",o=Fe(Ae.origins(s)),c=Ze(s),[r,p]=l.useState(null),x=i=>c.mutate(i,{onSuccess:()=>p(Date.now())});return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(Et,{title:"Settings",sub:n.name,actions:e.jsx(Pt,{saving:c.isPending,savedAt:r})}),e.jsxs(ne,{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:n.uid}),e.jsx(kt,{text:n.uid,label:"Copy the site ID"})]})]}),e.jsx(Xt,{name:n.name,onSave:i=>x({name:i})}),e.jsx(Zt,{domain:o.data?.domain??null,loaded:o.isSuccess,onSave:i=>x({domain:i})}),e.jsx(es,{list:o.data?.origins??[],loaded:o.isSuccess,hasDomain:!!o.data?.domain,onChange:i=>x({origins:i})})]}),e.jsxs(ne,{title:"Widget",description:"Whether it runs, who the toolbar appears for, what guests may do, 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(Pe,{id:"widget-on","aria-label":"Widget on this site",checked:n.status!=="paused",onCheckedChange:i=>x({status:i?"active":"paused"})})]}),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:"guests-status",className:"text-[13px] font-medium",children:"Guests can change status"}),e.jsxs("p",{className:"m-0 mt-0.5 text-[12px] leading-normal text-muted-foreground",children:["People who comment without an account or a review link can move a comment between Open, In progress, In review and Resolved.",!d&&" Only an owner or an admin can change this."]})]}),e.jsx(Pe,{id:"guests-status","aria-label":"Guests can change status",checked:n.guestsCanChangeStatus!==!1,disabled:!d,onCheckedChange:i=>x({guestsCanChangeStatus:i})})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(q,{children:"Who can comment"}),e.jsx(_t,{value:n.writeMode,onValueChange:i=>x({writeMode:String(i)}),className:"gap-2",children:Jt.map(i=>e.jsxs("label",{className:pe("flex cursor-pointer items-start gap-2.5 rounded-md border border-border px-3 py-2.5",n.writeMode===i.id&&"border-brand bg-brand-soft"),children:[e.jsx(Yt,{value:i.id,className:"mt-0.5","aria-label":i.title}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-[13px] font-medium",children:i.title}),e.jsx("span",{className:"block text-[12px] leading-normal text-muted-foreground",children:i.note})]})]},i.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(q,{children:"The tag"}),e.jsx(Nt,{uid:n.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(Ut,{uid:s}),e.jsx(ts,{uid:s,name:n.name})]})}function Xt({name:s,onSave:t}){const[n,d]=l.useState(s);l.useEffect(()=>d(s),[s]);const o=n.trim().length>0&&n.trim()!==s;return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:c=>{c.preventDefault(),o&&t(n.trim())},children:[e.jsx(q,{htmlFor:"site-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{id:"site-name",value:n,onChange:c=>d(c.target.value)}),o&&e.jsx(V,{type:"submit",variant:"outline",children:"Save"})]})]})}function Zt({domain:s,loaded:t,onSave:n}){const[d,o]=l.useState(s??"");l.useEffect(()=>o(s??""),[s]);const c=d.trim()!==(s??"");return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:r=>{r.preventDefault(),c&&n(d.trim()||null)},children:[e.jsx(q,{htmlFor:"site-domain",children:"Domain"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{id:"site-domain",placeholder:"kilnwork.studio",value:d,onChange:r=>o(r.target.value),disabled:!t}),c&&e.jsx(V,{type:"submit",variant:"outline",children:d.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 es({list:s,loaded:t,hasDomain:n,onChange:d}){const[o,c]=l.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:[s.map(r=>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:r}),e.jsx(V,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`Remove ${r}`,disabled:s.length<=1&&!n,onClick:()=>d(s.filter(p=>p!==r)),children:e.jsx(vt,{})})]},r)),t&&s.length===0&&e.jsx("li",{className:"text-[12.5px] text-muted-foreground",children:n?"None besides the domain.":"No address yet."})]}),e.jsxs("form",{className:"flex gap-2",onSubmit:r=>{r.preventDefault();const p=o.trim();p&&(d([...s,p]),c(""))},children:[e.jsx(ae,{id:"site-origin-add",placeholder:"https://staging.example.com",value:o,onChange:r=>c(r.target.value)}),e.jsxs(V,{type:"submit",variant:"outline",disabled:!o.trim(),children:[e.jsx(Dt,{}),"Add"]})]})]})}function ts({uid:s,name:t}){const[n,d]=l.useState(!1),o=et(),c=tt(s);return e.jsxs(ne,{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(V,{type:"button",variant:"outline",className:"border-destructive text-destructive",onClick:()=>d(!0),children:["Delete ",t,"…"]})]}),e.jsx(He,{open:n,onOpenChange:d,title:`Delete ${t}?`,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:t,busy:c.isPending,onConfirm:()=>c.mutate(void 0,{onSuccess:()=>{d(!1),o({to:"/sites"})}})})]})}export{ws as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as x,o as h,r as g,p as f,x as j,z as N,A as w,j as e,G as b,B as y,F as S,H as r}from"./index-
|
|
1
|
+
import{I as x,o as h,r as g,p as f,x as j,z as N,A as w,j as e,G as b,B as y,F as S,H as r}from"./index-BCjjK9dr.js";import{u as v,a as A}from"./zod-DbWDuTiO.js";import{L as i,I as o}from"./label-CU7jvj5k.js";const F=S({email:r().trim().email("An email address"),password:r().min(12,"At least 12 characters"),orgName:r().trim().max(120).optional()});function E(){const{claim:d}=x.useSearch(),c=h(),[l,n]=g.useState(""),{register:a,handleSubmit:p,formState:s}=v({resolver:A(F)}),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"),N.clear(),c({to:"/welcome",replace:!0})}catch(m){n(m instanceof w?m.message:"Something went wrong. Try again.")}});return e.jsx(b,{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("fieldset",{disabled:s.isSubmitting,className:"m-0 flex min-w-0 flex-col gap-4 border-0 p-0",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(i,{htmlFor:"email",children:"Your email"}),e.jsx(o,{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(i,{htmlFor:"password",children:"Password"}),e.jsx(o,{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(i,{htmlFor:"orgName",children:["Studio name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(o,{id:"orgName",placeholder:"My studio",...a("orgName")})]}),e.jsx(y,{type:"submit",size:"lg",loading:s.isSubmitting,children:s.isSubmitting?"Setting up…":"Create my account"})]})]})})}export{E as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{J as w,o as y,r as l,y as d,p as N,x as S,A as k,j as e,G as C,B as F,f as E,L,F as R,H as m}from"./index-
|
|
1
|
+
import{J as w,o as y,r as l,y as d,p as N,x as S,A as k,j as e,G as C,B as F,f as E,L,F as R,H as m}from"./index-BCjjK9dr.js";import{u as c}from"./useQuery-6QR_MT4t.js";import{u as A,a as I}from"./zod-DbWDuTiO.js";import{L as u,I as p}from"./label-CU7jvj5k.js";import{C as z}from"./chevron-right-D_gtsnlu.js";import"./useBaseQuery-CoqlgX-x.js";const B=R({email:m().trim().min(1,"Your email"),password:m().min(1,"Your password")});function Q(){const{redirect:x}=w.useSearch(),r=y(),[a,o]=l.useState(""),[s,h]=l.useState(!1),{register:i,handleSubmit:f,formState:t}=A({resolver:I(B)});c({...d.claimed(),enabled:!0}).data===!1&&r({to:"/setup",replace:!0});const g=c(d.setupState()),j=f(async({email:b,password:v})=>{o("");try{await N.login(b,v),S("in"),r({to:x??"/sites",replace:!0})}catch(n){o(n instanceof k?n.message:"Could not reach the server.")}});return e.jsx(C,{children:e.jsxs("form",{onSubmit:j,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(u,{htmlFor:"email",children:"Email"}),e.jsx(p,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!t.errors.email,...i("email")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(u,{htmlFor:"password",children:"Password"}),e.jsx(p,{id:"password",type:"password",autoComplete:"current-password","aria-invalid":!!t.errors.password,...i("password")})]}),e.jsx(F,{type:"submit",size:"lg",loading:t.isSubmitting,children:t.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:()=>h(!s),children:[e.jsx(z,{className:E("size-3.5 text-muted-foreground transition-transform",s&&"rotate-90")}),"Forgot your password?"]}),g.data?.signup&&e.jsxs("p",{className:"m-0 text-center text-[13px] text-muted-foreground",children:["New here?"," ",e.jsx(L,{to:"/sign-up",className:"text-foreground underline underline-offset-4",children:"Create a studio"})]}),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{o as p,r as u,p as h,x as g,z as f,A as j,j as e,G as N,B as w,L as v,F as y,H as t}from"./index-
|
|
1
|
+
import{o as p,r as u,p as h,x as g,z as f,A as j,j as e,G as N,B as w,L as v,F as y,H as t}from"./index-BCjjK9dr.js";import{u as b,a as S}from"./zod-DbWDuTiO.js";import{L as o,I as i}from"./label-CU7jvj5k.js";const A=y({email:t().trim().email("An email address"),password:t().min(12,"At least 12 characters"),name:t().trim().max(120).optional(),orgName:t().trim().max(120).optional()});function k(){const d=p(),[n,l]=u.useState(""),{register:r,handleSubmit:c,formState:a}=b({resolver:S(A)}),x=c(async s=>{l("");try{await h.register({email:s.email,password:s.password,...s.name?{name:s.name}:{},orgName:s.orgName||"My studio"}),g("in"),f.clear(),d({to:"/welcome",replace:!0})}catch(m){l(m instanceof j?m.message:"Something went wrong. Try again.")}});return e.jsx(N,{width:400,children:e.jsxs("form",{onSubmit:x,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:"Create a studio"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"Your account, and the studio your sites live in. Reviewers never sign up — they open a link."})]}),n&&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:n}),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":!!a.errors.email,...r("email")}),a.errors.email&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:a.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":!!a.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."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(o,{htmlFor:"name",children:["Your name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(i,{id:"name",autoComplete:"name",...r("name")})]}),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",...r("orgName")})]}),e.jsx(w,{type:"submit",size:"lg",loading:a.isSubmitting,children:a.isSubmitting?"Creating…":"Create my studio"}),e.jsxs("p",{className:"m-0 text-center text-[13px] text-muted-foreground",children:["Already have an account?"," ",e.jsx(v,{to:"/sign-in",className:"text-foreground underline underline-offset-4",children:"Sign in"})]})]})})}export{k as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{X as v,r as x,j as e,B as c,L as N,o as y,t as w,p as A,A as S,F as $,H as p}from"./index-
|
|
1
|
+
import{X as v,r as x,j as e,B as c,L as N,o as y,t as w,p as A,A as S,F as $,H as p}from"./index-BCjjK9dr.js";import{u as k,a as _}from"./zod-DbWDuTiO.js";import{C}from"./card-PWIpee1m.js";import{E,G as D,I as F,H as I,J as L,K as P}from"./dialog-B_kwIiUp.js";import{L as h,I as g}from"./label-CU7jvj5k.js";import{P as z,E as H}from"./parts-Oxy1krsw.js";import{b as K}from"./labels--UUyt9uB.js";import{u as T}from"./me-ttfbX4Cb.js";import{P as f}from"./plus-Cl722ZH_.js";import{L as q}from"./layout-grid-DgutVVEL.js";import{I as B}from"./image-off-kQWiBpm4.js";import"./useBaseQuery-CoqlgX-x.js";function te(){const i=T(),{add:a}=v.useSearch(),[m,r]=x.useState(!!a);x.useEffect(()=>{a&&r(!0)},[a]);const d=i.projects.reduce((s,o)=>s+o.unresolved,0),t=i.limits.projects.limit,n=t!==null&&i.projects.length>=t;return e.jsxs("div",{className:"p-7",children:[e.jsx(z,{title:"Sites",sub:i.projects.length?`${i.projects.length}${t!==null?` of ${t}`:""} site${i.projects.length===1&&t===null?"":"s"} · ${d} open`:t!==null?`0 of ${t} sites`:void 0,actions:e.jsxs(c,{onClick:()=>r(!0),disabled:n,title:n?`This studio's plan allows ${t} sites.`:void 0,children:[e.jsx(f,{}),"Add a site"]})}),i.projects.length===0?e.jsx(C,{className:"max-w-[1100px]",children:e.jsx(H,{icon:e.jsx(q,{className:"size-5"}),title:"No sites yet",action:e.jsxs(c,{onClick:()=>r(!0),children:[e.jsx(f,{}),"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:i.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(B,{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?` · ${K(s.lastActivityAt)}`:""}`})]})]},s.uid))}),e.jsx(Q,{open:m,onOpenChange:r})]})}const G=$({name:p().trim().min(1,"A name"),domain:p().trim().min(1,"Its domain")});function Q({open:i,onOpenChange:a}){const m=y(),r=w(),[d,t]=x.useState(""),{register:n,handleSubmit:s,formState:o,reset:j}=k({resolver:_(G)}),b=s(async u=>{t("");try{const l=await A.createProject(u.name,"",u.domain);await r.invalidateQueries({queryKey:["me"]}),j(),a(!1),m({to:"/s/$site/comments",params:{site:l.uid}})}catch(l){t(l instanceof S?l.message:"Could not add the site.")}});return e.jsx(E,{open:i,onOpenChange:a,children:e.jsx(D,{children:e.jsxs("form",{onSubmit:b,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(F,{children:[e.jsx(I,{children:"Add a site"}),e.jsx(L,{children:"One client website. The tag it needs is shown right after."})]}),d&&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:d}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(h,{htmlFor:"site-name",children:"Name"}),e.jsx(g,{id:"site-name",placeholder:"Kilnwork","aria-invalid":!!o.errors.name,...n("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(h,{htmlFor:"site-domain",children:"Domain"}),e.jsx(g,{id:"site-domain",placeholder:"kilnwork.studio","aria-invalid":!!o.errors.domain,...n("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(P,{children:[e.jsx(c,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(c,{type:"submit",loading:o.isSubmitting,children:o.isSubmitting?"Adding…":"Add site"})]})]})})})}export{te as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,O as o}from"./index-BCjjK9dr.js";const n=()=>t.jsx(o,{});export{n as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as o,y as s,Z as u,p as i,_ as y,Y as c}from"./index-
|
|
1
|
+
import{t as o,y as s,Z as u,p as i,_ as y,Y as c}from"./index-BCjjK9dr.js";function Q(){const e=o(),t=s.me().queryKey;return u({mutationFn:a=>i.renameOrg(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{...r,org:{...r.org,name:a}}),{was:r}},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))},onSettled:()=>e.invalidateQueries({queryKey:t})})}function q(){const e=o(),t=s.me().queryKey;return u({mutationFn:a=>i.renameMe(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{...r,user:{...r.user,name:a}}),{was:r}},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))},onSettled:()=>{e.invalidateQueries({queryKey:t}),e.invalidateQueries({queryKey:s.members().queryKey})}})}function f(){return u({mutationFn:e=>i.changePassword(e.current,e.next)})}function l(){const e=o();return u({mutationFn:t=>i.createInvite(t),onSuccess:()=>void e.invalidateQueries({queryKey:s.invites().queryKey})})}function w(){const e=o(),t=s.invites().queryKey;return u({mutationFn:a=>i.revokeInvite(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{...r,data:r.data.filter(n=>n.id!==a)}),{was:r}},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))},onSettled:()=>e.invalidateQueries({queryKey:t})})}function v(){return u({mutationFn:e=>i.sendInvite(e.id,e.token)})}function K(){const e=o(),t=s.members().queryKey;return u({mutationFn:a=>i.setMemberRole(a.email,a.role),onMutate:async({email:a,role:r})=>{await e.cancelQueries({queryKey:t});const n=e.getQueryData(t);return n&&e.setQueryData(t,{data:n.data.map(m=>m.email===a?{...m,role:r}:m)}),{was:n}},onSuccess:(a,{email:r})=>{e.setQueryData(t,a),a.data.find(n=>n.email===r)?.you&&e.invalidateQueries({queryKey:s.me().queryKey})},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))}})}function D(){const e=o(),t=s.members().queryKey;return u({mutationFn:a=>i.removeMember(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{data:r.data.filter(n=>n.email!==a)}),{was:r}},onSuccess:a=>e.setQueryData(t,a),onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))}})}export{f as a,Q as b,K as c,D as d,w as e,l as f,v as g,q as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as B,r as h,Z as v,p as y,_ as b,Y as C,j as e,B as g,y as S,A as K,S as _}from"./index-NqrbvfSo.js";import{u as w}from"./useQuery-Ce8K2e88.js";import{L as A,I as k}from"./label-CZtxPKnA.js";import{E as M,G as $,I as T,H as I,J as U,K as L}from"./dialog-cAVg5CWG.js";import{C as G}from"./ConfirmDialog-B_HO7qAV.js";import{a as D,P as O}from"./parts-CMVHppEZ.js";import{b as F}from"./labels--UUyt9uB.js";import{u as z}from"./me-DuZzYTr0.js";import{S as q}from"./SaveState-DbiBWPbj.js";import{b as H}from"./studio-oojSa61E.js";import{c as Q}from"./update-duXzIzFS.js";import"./useBaseQuery-BQZrcHmw.js";import"./card-rZNT8AAn.js";function V({owner:n}){const s=w(S.instance()),i=B(),t=()=>i.invalidateQueries({queryKey:S.instance().queryKey}),[c,l]=h.useState(!1),[p,x]=h.useState(!1),[d,u]=h.useState(null),a=v({mutationFn:y.disconnectStorage,onSuccess:()=>void t(),onError:j=>b.error(C(j))}),r=v({mutationFn:y.disconnectMail,onSuccess:()=>void t(),onError:j=>b.error(C(j))}),f=v({mutationFn:y.testMail,onSuccess:j=>b.success(`Sent to ${j.to}`),onError:j=>b.error(C(j))}),N=z(),m=s.data?.storage,o=s.data?.mail;return e.jsxs(e.Fragment,{children:[e.jsxs(D,{title:"Storage",description:"The bucket screenshots and files go to. Without one the widget runs in annotation mode.",children:[!s.data&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:s.isError?"Could not read it.":"Reading…"}),m&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(E,{tone:m.connected?"ok":m.unreadable?"bad":"off",text:m.connected?`Connected · ${m.bucket} at ${(m.endpoint??"").replace(/^https?:\/\//,"")}${m.connectedAt?` · since ${F(m.connectedAt)}`:""}`:m.unreadable?"A bucket is stored but its keys will not decrypt — the secret key changed. Connect it again.":"Not connected — annotation mode. Comments and anchors work; screenshots are not offered."}),N.limits.storage.limit!==null&&e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:[R(N.limits.storage.used)," of ",R(N.limits.storage.limit)," used across the studio's sites."]}),m.source==="env"?e.jsx(P,{what:"SNAGSET_STORAGE_S3_*"}):n?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{variant:"outline",size:"sm",onClick:()=>l(!0),children:m.connected||m.unreadable?"Replace…":"Connect a bucket…"}),(m.connected||m.unreadable)&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>u("storage"),children:"Disconnect"})]}):null]})]}),e.jsx(D,{title:"Mail",description:"How notifications go out. Without a transport they are off, and the instance says so.",children:o&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(E,{tone:o.configured?"ok":o.unreadable?"bad":"off",text:o.configured?`${o.scheme==="resend"?"Resend":`SMTP · ${o.host??""}`} · from ${o.from}${o.updatedAt?` · since ${F(o.updatedAt)}`:""}`:o.unreadable?"A transport is stored but its secret will not decrypt — the secret key changed. Connect it again.":"No transport — notifications are off."}),o.source==="env"?e.jsx(P,{what:"SNAGSET_MAIL_URL"}):n?e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(g,{variant:"outline",size:"sm",onClick:()=>x(!0),children:o.configured||o.unreadable?"Replace…":"Connect a transport…"}),o.configured&&e.jsx(g,{variant:"outline",size:"sm",loading:f.isPending,onClick:()=>f.mutate(),children:f.isPending?"Sending…":"Send a test email"}),(o.configured||o.unreadable)&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>u("mail"),children:"Disconnect"})]}):(o.configured&&n===!1,null)]})}),e.jsx(W,{open:c,onOpenChange:l,onDone:()=>void t()}),e.jsx(J,{open:p,onOpenChange:x,onDone:()=>void t()}),e.jsx(G,{open:d!==null,onOpenChange:j=>!j&&u(null),title:d==="storage"?"Disconnect the bucket?":"Disconnect the mail transport?",description:d==="storage"?"Screenshots stop being offered. Nothing in the bucket is deleted, and reconnecting the same bucket brings the pictures back.":"Notifications stop going out until a transport is connected again.",confirmLabel:"Disconnect",busy:a.isPending||r.isPending,onConfirm:async()=>{d==="storage"?await a.mutateAsync():await r.mutateAsync(),u(null)}})]})}function E({tone:n,text:s}){return e.jsxs("p",{className:"m-0 flex items-center gap-2 text-[13px]",children:[e.jsx("span",{className:`size-2 shrink-0 rounded-full ${n==="ok"?"bg-ok":n==="bad"?"bg-destructive":"bg-line-strong"}`,"aria-hidden":"true"}),e.jsx("span",{children:s})]})}function P({what:n}){return e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["Set by the environment (",e.jsx("code",{className:"font-mono",children:n}),"). Change it there; the dashboard shows it and does not offer to edit it."]})}function W({open:n,onOpenChange:s,onDone:i}){const[t,c]=h.useState({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),[l,p]=h.useState(""),x=v({mutationFn:y.connectStorage}),d=r=>f=>c({...t,[r]:f.target.value}),u=async r=>{r.preventDefault(),p("");try{await x.mutateAsync({endpoint:t.endpoint.trim(),bucket:t.bucket.trim(),accessKeyId:t.accessKeyId.trim(),secretAccessKey:t.secretAccessKey,...t.region.trim()?{region:t.region.trim()}:{},...t.publicBaseUrl.trim()?{publicBaseUrl:t.publicBaseUrl.trim()}:{}}),c({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),s(!1),i(),b.success("Bucket connected — screenshots are on")}catch(f){p(f instanceof K?f.message:"Could not reach the server.")}},a=(r,f,N,m="text",o)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{htmlFor:`st-${r}`,children:f}),e.jsx(k,{id:`st-${r}`,type:m,placeholder:N,value:t[r],onChange:d(r),autoComplete:"off"}),o&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:o})]});return e.jsx(M,{open:n,onOpenChange:s,children:e.jsx($,{children:e.jsxs("form",{onSubmit:r=>void u(r),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(T,{children:[e.jsx(I,{children:"Connect a bucket"}),e.jsx(U,{children:"Any S3-compatible bucket. It is probed — write, read, delete — before anything is saved, and the keys are stored encrypted with this instance's secret key."})]}),l&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:l}),a("endpoint","Endpoint","https://ams3.digitaloceanspaces.com"),a("bucket","Bucket","snagset"),a("region","Region","auto","text","Leave empty for providers that do not use one."),a("accessKeyId","Access key ID",""),a("secretAccessKey","Secret access key","","password"),a("publicBaseUrl","Public base URL","","text","Optional — only if the bucket is served from a CDN address."),e.jsxs(L,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:x.isPending,children:x.isPending?"Probing…":"Connect"})]})]})})})}function J({open:n,onOpenChange:s,onDone:i}){const[t,c]=h.useState(""),[l,p]=h.useState(""),[x,d]=h.useState(""),u=v({mutationFn:y.connectMail}),a=async r=>{r.preventDefault(),d("");try{await u.mutateAsync({url:t.trim(),from:l.trim()}),c(""),p(""),s(!1),i(),b.success("Transport connected — send a test email to be sure")}catch(f){d(f instanceof K?f.message:"Could not reach the server.")}};return e.jsx(M,{open:n,onOpenChange:s,children:e.jsx($,{children:e.jsxs("form",{onSubmit:r=>void a(r),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(T,{children:[e.jsx(I,{children:"Connect a mail transport"}),e.jsx(U,{children:"Resend is the easy one — the provider owns SPF and DKIM. SMTP works with any provider. The URL is stored encrypted with this instance's secret key."})]}),x&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:x}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{htmlFor:"mail-url",children:"Transport"}),e.jsx(k,{id:"mail-url",type:"password",placeholder:"resend://re_… or smtp://user:pass@host:587",value:t,onChange:r=>c(r.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{htmlFor:"mail-from",children:"From"}),e.jsx(k,{id:"mail-from",placeholder:"Snagset <review@kilnwork.studio>",value:l,onChange:r=>p(r.target.value)}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The address every notification is sent from. Resend needs a verified domain for it."})]}),e.jsxs(L,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:u.isPending,disabled:!t.trim()||!l.trim(),children:u.isPending?"Saving…":"Connect"})]})]})})})}function R(n){const s=["B","KB","MB","GB","TB"];let i=n,t=0;for(;i>=1024&&t<s.length-1;)i/=1024,t+=1;return`${t===0?i:i.toFixed(i>=10?0:1)} ${s[t]}`}function me(){const n=z(),s=w(S.meta()),i=w(S.members()),t=H(),c=n.user.role==="owner",[l,p]=h.useState(n.org.name),[x,d]=h.useState(null);h.useEffect(()=>p(n.org.name),[n.org.name]);const u=c&&l.trim().length>0&&l.trim()!==n.org.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(O,{title:"General",sub:n.org.name,actions:e.jsx(q,{saving:t.isPending,savedAt:x})}),e.jsx(D,{title:"Studio",description:"The name at the top of every screen.",children:e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:a=>{a.preventDefault(),u&&t.mutate(l.trim(),{onSuccess:()=>d(Date.now())})},children:[e.jsx(A,{htmlFor:"studio-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(k,{id:"studio-name",value:l,readOnly:!c,onChange:a=>p(a.target.value)}),u&&e.jsx(g,{type:"submit",variant:"outline",children:"Save"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:c?"Shown at the top of the sidebar, above every site.":"Only an owner can change it."})]})}),e.jsx(D,{title:"This instance",description:"What is running, and where.",children:e.jsxs("dl",{className:"m-0 grid grid-cols-[130px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Version"}),e.jsxs("dd",{className:"m-0",children:[s.data?.version??"—"," ",e.jsx(Y,{version:s.data?.version??""})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Address"}),e.jsx("dd",{className:"m-0",children:e.jsx(Z,{owner:c})}),s.data?.commit&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Commit"}),e.jsxs("dd",{className:"m-0 font-mono text-[12px] text-ink-soft",children:[s.data.commit.slice(0,12),s.data.modified?" · modified":""]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Sites · members"}),e.jsxs("dd",{className:"m-0",children:[n.projects.length," · ",i.data?.data.length??"—"]})]})}),e.jsx(V,{owner:c})]})}function Y({version:n}){const[s,i]=h.useState({s:"idle"});return s.s==="idle"?e.jsxs(e.Fragment,{children:["·"," ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>{i({s:"checking"}),Q(n).then(t=>i({s:"done",r:t})).catch(()=>i({s:"failed"}))},children:"Check for updates"})," ",e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"— from your browser, never from the server"})]}):s.s==="checking"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:["· ",e.jsx(_,{className:"size-3"})," checking…"]}):s.s==="failed"?e.jsx("span",{className:"text-muted-foreground",children:"· could not reach npm"}):e.jsx("span",{className:"text-muted-foreground",children:s.r?.newer?`· ${s.r.latest} is out`:"· up to date"})}function Z({owner:n}){const s=B(),i=w(S.instance()),[t,c]=h.useState(null),[l,p]=h.useState(""),x=v({mutationFn:a=>y.setAddress(a),onSuccess:a=>{s.setQueryData(S.instance().queryKey,a),c(null),p(""),b.success("Address saved — every new link is built from it")},onError:a=>p(C(a))}),d=i.data?.address;if(!d)return e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:location.origin});const u=d.source==="env";return t===null||!n||u?e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:d.url}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:u?"· set by the environment (SNAGSET_BASE_URL)":d.source==="stored"?"· set at claim; every link is built from it":"· this machine's default"}),n&&!u&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>c(d.url),children:"Change…"})]}):e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:a=>{a.preventDefault(),x.mutate(t.trim())},children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(k,{"aria-label":"Address",value:t,onChange:a=>c(a.target.value),className:"h-8 max-w-[360px] font-mono text-[12px]",autoFocus:!0}),e.jsx(g,{type:"submit",size:"sm",loading:x.isPending,disabled:!t.trim(),children:x.isPending?"Saving…":"Save"}),e.jsx(g,{type:"button",variant:"ghost",size:"sm",onClick:()=>c(null),children:"Cancel"})]}),l&&e.jsx("span",{className:"text-[12px] text-destructive",children:l}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"https:// unless it is this machine; the origin only. Review links, issues and emails are built from it."})]})}export{me as component};
|
|
1
|
+
import{t as B,r as h,Z as v,p as y,_ as b,Y as C,j as e,B as g,y as S,A as K,S as _}from"./index-BCjjK9dr.js";import{u as w}from"./useQuery-6QR_MT4t.js";import{L as A,I as k}from"./label-CU7jvj5k.js";import{E as M,G as $,I as T,H as I,J as U,K as L}from"./dialog-B_kwIiUp.js";import{C as G}from"./ConfirmDialog-YHdRCMuk.js";import{a as D,P as O}from"./parts-Oxy1krsw.js";import{b as F}from"./labels--UUyt9uB.js";import{u as z}from"./me-ttfbX4Cb.js";import{S as q}from"./SaveState-zx4IRIWV.js";import{b as H}from"./studio-DepK2GJ4.js";import{c as Q}from"./update-duXzIzFS.js";import"./useBaseQuery-CoqlgX-x.js";import"./card-PWIpee1m.js";function V({owner:n}){const s=w(S.instance()),i=B(),t=()=>i.invalidateQueries({queryKey:S.instance().queryKey}),[c,l]=h.useState(!1),[p,x]=h.useState(!1),[d,u]=h.useState(null),a=v({mutationFn:y.disconnectStorage,onSuccess:()=>void t(),onError:j=>b.error(C(j))}),r=v({mutationFn:y.disconnectMail,onSuccess:()=>void t(),onError:j=>b.error(C(j))}),f=v({mutationFn:y.testMail,onSuccess:j=>b.success(`Sent to ${j.to}`),onError:j=>b.error(C(j))}),N=z(),m=s.data?.storage,o=s.data?.mail;return e.jsxs(e.Fragment,{children:[e.jsxs(D,{title:"Storage",description:"The bucket screenshots and files go to. Without one the widget runs in annotation mode.",children:[!s.data&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:s.isError?"Could not read it.":"Reading…"}),m&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(E,{tone:m.connected?"ok":m.unreadable?"bad":"off",text:m.connected?`Connected · ${m.bucket} at ${(m.endpoint??"").replace(/^https?:\/\//,"")}${m.connectedAt?` · since ${F(m.connectedAt)}`:""}`:m.unreadable?"A bucket is stored but its keys will not decrypt — the secret key changed. Connect it again.":"Not connected — annotation mode. Comments and anchors work; screenshots are not offered."}),N.limits.storage.limit!==null&&e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:[R(N.limits.storage.used)," of ",R(N.limits.storage.limit)," used across the studio's sites."]}),m.source==="env"?e.jsx(P,{what:"SNAGSET_STORAGE_S3_*"}):n?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{variant:"outline",size:"sm",onClick:()=>l(!0),children:m.connected||m.unreadable?"Replace…":"Connect a bucket…"}),(m.connected||m.unreadable)&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>u("storage"),children:"Disconnect"})]}):null]})]}),e.jsx(D,{title:"Mail",description:"How notifications go out. Without a transport they are off, and the instance says so.",children:o&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(E,{tone:o.configured?"ok":o.unreadable?"bad":"off",text:o.configured?`${o.scheme==="resend"?"Resend":`SMTP · ${o.host??""}`} · from ${o.from}${o.updatedAt?` · since ${F(o.updatedAt)}`:""}`:o.unreadable?"A transport is stored but its secret will not decrypt — the secret key changed. Connect it again.":"No transport — notifications are off."}),o.source==="env"?e.jsx(P,{what:"SNAGSET_MAIL_URL"}):n?e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(g,{variant:"outline",size:"sm",onClick:()=>x(!0),children:o.configured||o.unreadable?"Replace…":"Connect a transport…"}),o.configured&&e.jsx(g,{variant:"outline",size:"sm",loading:f.isPending,onClick:()=>f.mutate(),children:f.isPending?"Sending…":"Send a test email"}),(o.configured||o.unreadable)&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>u("mail"),children:"Disconnect"})]}):(o.configured&&n===!1,null)]})}),e.jsx(W,{open:c,onOpenChange:l,onDone:()=>void t()}),e.jsx(J,{open:p,onOpenChange:x,onDone:()=>void t()}),e.jsx(G,{open:d!==null,onOpenChange:j=>!j&&u(null),title:d==="storage"?"Disconnect the bucket?":"Disconnect the mail transport?",description:d==="storage"?"Screenshots stop being offered. Nothing in the bucket is deleted, and reconnecting the same bucket brings the pictures back.":"Notifications stop going out until a transport is connected again.",confirmLabel:"Disconnect",busy:a.isPending||r.isPending,onConfirm:async()=>{d==="storage"?await a.mutateAsync():await r.mutateAsync(),u(null)}})]})}function E({tone:n,text:s}){return e.jsxs("p",{className:"m-0 flex items-center gap-2 text-[13px]",children:[e.jsx("span",{className:`size-2 shrink-0 rounded-full ${n==="ok"?"bg-ok":n==="bad"?"bg-destructive":"bg-line-strong"}`,"aria-hidden":"true"}),e.jsx("span",{children:s})]})}function P({what:n}){return e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["Set by the environment (",e.jsx("code",{className:"font-mono",children:n}),"). Change it there; the dashboard shows it and does not offer to edit it."]})}function W({open:n,onOpenChange:s,onDone:i}){const[t,c]=h.useState({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),[l,p]=h.useState(""),x=v({mutationFn:y.connectStorage}),d=r=>f=>c({...t,[r]:f.target.value}),u=async r=>{r.preventDefault(),p("");try{await x.mutateAsync({endpoint:t.endpoint.trim(),bucket:t.bucket.trim(),accessKeyId:t.accessKeyId.trim(),secretAccessKey:t.secretAccessKey,...t.region.trim()?{region:t.region.trim()}:{},...t.publicBaseUrl.trim()?{publicBaseUrl:t.publicBaseUrl.trim()}:{}}),c({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),s(!1),i(),b.success("Bucket connected — screenshots are on")}catch(f){p(f instanceof K?f.message:"Could not reach the server.")}},a=(r,f,N,m="text",o)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{htmlFor:`st-${r}`,children:f}),e.jsx(k,{id:`st-${r}`,type:m,placeholder:N,value:t[r],onChange:d(r),autoComplete:"off"}),o&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:o})]});return e.jsx(M,{open:n,onOpenChange:s,children:e.jsx($,{children:e.jsxs("form",{onSubmit:r=>void u(r),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(T,{children:[e.jsx(I,{children:"Connect a bucket"}),e.jsx(U,{children:"Any S3-compatible bucket. It is probed — write, read, delete — before anything is saved, and the keys are stored encrypted with this instance's secret key."})]}),l&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:l}),a("endpoint","Endpoint","https://ams3.digitaloceanspaces.com"),a("bucket","Bucket","snagset"),a("region","Region","auto","text","Leave empty for providers that do not use one."),a("accessKeyId","Access key ID",""),a("secretAccessKey","Secret access key","","password"),a("publicBaseUrl","Public base URL","","text","Optional — only if the bucket is served from a CDN address."),e.jsxs(L,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:x.isPending,children:x.isPending?"Probing…":"Connect"})]})]})})})}function J({open:n,onOpenChange:s,onDone:i}){const[t,c]=h.useState(""),[l,p]=h.useState(""),[x,d]=h.useState(""),u=v({mutationFn:y.connectMail}),a=async r=>{r.preventDefault(),d("");try{await u.mutateAsync({url:t.trim(),from:l.trim()}),c(""),p(""),s(!1),i(),b.success("Transport connected — send a test email to be sure")}catch(f){d(f instanceof K?f.message:"Could not reach the server.")}};return e.jsx(M,{open:n,onOpenChange:s,children:e.jsx($,{children:e.jsxs("form",{onSubmit:r=>void a(r),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(T,{children:[e.jsx(I,{children:"Connect a mail transport"}),e.jsx(U,{children:"Resend is the easy one — the provider owns SPF and DKIM. SMTP works with any provider. The URL is stored encrypted with this instance's secret key."})]}),x&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:x}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{htmlFor:"mail-url",children:"Transport"}),e.jsx(k,{id:"mail-url",type:"password",placeholder:"resend://re_… or smtp://user:pass@host:587",value:t,onChange:r=>c(r.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{htmlFor:"mail-from",children:"From"}),e.jsx(k,{id:"mail-from",placeholder:"Snagset <review@kilnwork.studio>",value:l,onChange:r=>p(r.target.value)}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The address every notification is sent from. Resend needs a verified domain for it."})]}),e.jsxs(L,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:u.isPending,disabled:!t.trim()||!l.trim(),children:u.isPending?"Saving…":"Connect"})]})]})})})}function R(n){const s=["B","KB","MB","GB","TB"];let i=n,t=0;for(;i>=1024&&t<s.length-1;)i/=1024,t+=1;return`${t===0?i:i.toFixed(i>=10?0:1)} ${s[t]}`}function me(){const n=z(),s=w(S.meta()),i=w(S.members()),t=H(),c=n.user.role==="owner",[l,p]=h.useState(n.org.name),[x,d]=h.useState(null);h.useEffect(()=>p(n.org.name),[n.org.name]);const u=c&&l.trim().length>0&&l.trim()!==n.org.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(O,{title:"General",sub:n.org.name,actions:e.jsx(q,{saving:t.isPending,savedAt:x})}),e.jsx(D,{title:"Studio",description:"The name at the top of every screen.",children:e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:a=>{a.preventDefault(),u&&t.mutate(l.trim(),{onSuccess:()=>d(Date.now())})},children:[e.jsx(A,{htmlFor:"studio-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(k,{id:"studio-name",value:l,readOnly:!c,onChange:a=>p(a.target.value)}),u&&e.jsx(g,{type:"submit",variant:"outline",children:"Save"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:c?"Shown at the top of the sidebar, above every site.":"Only an owner can change it."})]})}),e.jsx(D,{title:"This instance",description:"What is running, and where.",children:e.jsxs("dl",{className:"m-0 grid grid-cols-[130px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Version"}),e.jsxs("dd",{className:"m-0",children:[s.data?.version??"—"," ",e.jsx(Y,{version:s.data?.version??""})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Address"}),e.jsx("dd",{className:"m-0",children:e.jsx(Z,{owner:c})}),s.data?.commit&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Commit"}),e.jsxs("dd",{className:"m-0 font-mono text-[12px] text-ink-soft",children:[s.data.commit.slice(0,12),s.data.modified?" · modified":""]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Sites · members"}),e.jsxs("dd",{className:"m-0",children:[n.projects.length," · ",i.data?.data.length??"—"]})]})}),e.jsx(V,{owner:c})]})}function Y({version:n}){const[s,i]=h.useState({s:"idle"});return s.s==="idle"?e.jsxs(e.Fragment,{children:["·"," ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>{i({s:"checking"}),Q(n).then(t=>i({s:"done",r:t})).catch(()=>i({s:"failed"}))},children:"Check for updates"})," ",e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"— from your browser, never from the server"})]}):s.s==="checking"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:["· ",e.jsx(_,{className:"size-3"})," checking…"]}):s.s==="failed"?e.jsx("span",{className:"text-muted-foreground",children:"· could not reach npm"}):e.jsx("span",{className:"text-muted-foreground",children:s.r?.newer?`· ${s.r.latest} is out`:"· up to date"})}function Z({owner:n}){const s=B(),i=w(S.instance()),[t,c]=h.useState(null),[l,p]=h.useState(""),x=v({mutationFn:a=>y.setAddress(a),onSuccess:a=>{s.setQueryData(S.instance().queryKey,a),c(null),p(""),b.success("Address saved — every new link is built from it")},onError:a=>p(C(a))}),d=i.data?.address;if(!d)return e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:location.origin});const u=d.source==="env";return t===null||!n||u?e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:d.url}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:u?"· set by the environment (SNAGSET_BASE_URL)":d.source==="stored"?"· set at claim; every link is built from it":"· this machine's default"}),n&&!u&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>c(d.url),children:"Change…"})]}):e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:a=>{a.preventDefault(),x.mutate(t.trim())},children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(k,{"aria-label":"Address",value:t,onChange:a=>c(a.target.value),className:"h-8 max-w-[360px] font-mono text-[12px]",autoFocus:!0}),e.jsx(g,{type:"submit",size:"sm",loading:x.isPending,disabled:!t.trim(),children:x.isPending?"Saving…":"Save"}),e.jsx(g,{type:"button",variant:"ghost",size:"sm",onClick:()=>c(null),children:"Cancel"})]}),l&&e.jsx("span",{className:"text-[12px] text-destructive",children:l}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"https:// unless it is this machine; the origin only. Review links, issues and emails are built from it."})]})}export{me as component};
|
package/static/dashboard/assets/{studio.integrations-C8ze7wcK.js → studio.integrations-2-WJQjiK.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as z,r as i,Z as P,_ as A,Y as K,p as T,$ as J,j as e,V as Q,B as N,y as U,a0 as oe,A as H}from"./index-NqrbvfSo.js";import{u as B}from"./useQuery-Ce8K2e88.js";import{B as G}from"./badge-DZ45gt2t.js";import{E,G as O,I as R,H as D,J as L,K as M}from"./dialog-cAVg5CWG.js";import{L as C,I as F}from"./label-CZtxPKnA.js";import{S as ae}from"./switch-pKWkWBSh.js";import{C as V}from"./ConfirmDialog-B_HO7qAV.js";import{P as re,a as Y}from"./parts-CMVHppEZ.js";import{C as W}from"./CopyButton-BcFPdquT.js";import{b as Z}from"./labels--UUyt9uB.js";import{u as ie}from"./me-DuZzYTr0.js";import"./useBaseQuery-BQZrcHmw.js";import"./useRender-CLH8yHqZ.js";import"./useAriaLabelledBy-BSt0Y1vn.js";import"./useValueChanged-DKD8Vs7J.js";import"./card-rZNT8AAn.js";import"./check-DFzW0E5F.js";import"./copy-CkgrfFiF.js";const ce={ok:{label:"Healthy",tone:"ok"},needs_reauth:{label:"Needs a new token",tone:"bad"},error:{label:"Failing",tone:"bad"}};function Re(){const r=ie(),c=r.user.role==="owner"||r.user.role==="admin",k=r.user.role==="owner",f=B(U.integrations()),g=z(),j=()=>g.invalidateQueries({queryKey:["integrations"]}),[d,p]=i.useState(null),[l,m]=i.useState(null),[h,u]=i.useState(null),v=P({mutationFn:t=>T.regenerateGitHubWebhook(t),onSuccess:({webhook:t},s)=>u({site:s,provider:"github",hook:t,fresh:!1}),onError:t=>A.error(K(t))}),w=P({mutationFn:({uid:t,provider:s})=>T.testTracker(t,s).then(a=>({...a,provider:s})),onSuccess:t=>{A[t.ok?"success":"error"](t.ok?`${J[t.provider]} can see ${t.target}`:t.detail??`${J[t.provider]} refused the token`),j()},onError:t=>A.error(K(t))}),x=P({mutationFn:({uid:t,provider:s})=>T.disconnectTracker(t,s),onSuccess:()=>{m(null),j()},onError:t=>A.error(K(t))}),y=f.data?.data??[],b=t=>y.filter(s=>s.provider===t),n=t=>r.projects.filter(s=>!b(t).some(a=>a.site===s.uid));return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(re,{title:"Integrations",sub:"Mirrors converge on the comment's status here; Slack only announces"}),["github","linear","jira","slack"].map(t=>{const s=b(t),a=n(t);return e.jsxs(Y,{title:J[t],description:t==="github"?"A comment becomes an issue in the site's repository, with the brief as its body; resolving it here closes the issue there, and closing it there resolves it here. A fine-grained token per site — no OAuth app to register.":t==="linear"?"A comment becomes an issue in the site's team, with the brief as its body; our status moves it between the team's workflow states by type, and a webhook from Linear moves it back. A personal API key per site — no OAuth app to register.":t==="jira"?"A comment becomes an issue in the site's Jira project, with the brief as its description; our status moves it through the workflow by status category, and a webhook from Jira moves it back. An API token with the account's email — what Atlassian gives a self-hoster.":"One message per comment in a channel, edited in place as the status moves — never a second message, never a reply. A bot token from an app you create in a click from our manifest; Slack sends nothing back.",children:[f.isPending&&e.jsx(Q,{rows:2}),f.isSuccess&&s.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(G,{variant:"outline",children:"Not connected"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:t==="github"?"No site is connected to a repository yet.":t==="linear"?"No site is connected to a team yet.":t==="jira"?"No site is connected to a project yet.":"No site is connected to a channel yet."})]}),s.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:s.map(o=>{const I=ce[o.health]??{label:o.health,tone:"warn"};return e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-border px-3 py-2.5 text-[13px]",children:[e.jsx("span",{className:"font-medium",children:o.siteName??o.site}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("code",{className:"font-mono text-[12.5px]",children:o.provider==="github"?`${o.owner}/${o.repo}`:o.provider==="linear"?`${o.teamKey} · ${o.teamName}`:o.provider==="jira"?`${o.projectKey} · ${o.projectName}`:`#${o.channelName} · ${o.teamName}`}),e.jsx(G,{variant:"outline",className:I.tone==="ok"?"border-ok text-ok":I.tone==="bad"?"border-destructive text-destructive":"",children:I.label}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[o.provider==="slack"?o.createOn==="thread.created"?"A message for every new comment":"Messages when you ask, from the brief":o.createOn==="thread.created"?"An issue for every new comment":"Issues when you ask, from the brief",o.provider==="github"&&o.labels.length?` · labels ${o.labels.join(", ")}`:"",o.provider!=="github"&&o.provider!=="slack"&&!o.hasWebhookSecret?` · no webhook secret yet, so ${J[o.provider]} cannot move comments here`:""," · ",Z(o.updatedAt)]}),o.lastError&&e.jsx("span",{className:"basis-full text-[12px] text-destructive",children:o.lastError}),c&&e.jsxs("span",{className:"ml-auto flex gap-1",children:[o.provider==="github"?e.jsx(N,{variant:"ghost",size:"sm",loading:v.isPending,onClick:()=>v.mutate(o.site),children:"Webhook…"}):o.provider==="slack"?null:e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>u({site:o.site,provider:o.provider,hook:{url:`${location.origin}/api/v1/integrations/${o.provider}/inbound`},fresh:!1}),children:"Webhook…"}),e.jsx(N,{variant:"ghost",size:"sm",loading:w.isPending,onClick:()=>w.mutate({uid:o.site,provider:o.provider}),children:"Test"}),e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>m(o),children:"Disconnect"})]})]},`${o.provider}:${o.site}`)})}),c&&a.length>0&&e.jsx("div",{children:e.jsx(N,{variant:"outline",size:"sm",onClick:()=>p(t),children:"Connect a site…"})})]},t)}),e.jsx(xe,{owner:c,instanceOwner:k,sites:r.projects}),e.jsx(le,{open:d==="github",onOpenChange:t=>!t&&p(null),sites:n("github"),onDone:(t,s)=>{j(),s&&u({site:t,provider:"github",hook:s,fresh:!0})}}),e.jsx(me,{open:d==="linear",onOpenChange:t=>!t&&p(null),sites:n("linear"),onDone:(t,s)=>{j(),u({site:t,provider:"linear",hook:s,fresh:!0})}}),e.jsx(he,{open:d==="jira",onOpenChange:t=>!t&&p(null),sites:n("jira"),onDone:(t,s)=>{j(),u({site:t,provider:"jira",hook:s,fresh:!0})}}),e.jsx(ue,{open:d==="slack",onOpenChange:t=>!t&&p(null),sites:n("slack"),onDone:()=>void j()}),e.jsx(de,{state:h,onClose:()=>u(null),siteName:t=>y.find(s=>s.site===t)?.siteName??"the site"}),e.jsx(V,{open:l!==null,onOpenChange:t=>!t&&m(null),title:`Disconnect ${l?.siteName??"this site"} from ${l?J[l.provider]:"the tracker"}?`,description:l?.provider==="slack"?e.jsx(e.Fragment,{children:"Messages already posted stay in the channel; no new ones are posted and they stop being updated. The token is forgotten."}):e.jsx(e.Fragment,{children:"Issues already made keep their links; no new ones are made and status stops mirroring. The token is forgotten."}),confirmLabel:"Disconnect",busy:x.isPending,onConfirm:async()=>{l&&await x.mutateAsync({uid:l.site,provider:l.provider})}})]})}function le({open:r,onOpenChange:c,sites:k,onDone:f}){const[g,j]=i.useState(""),[d,p]=i.useState(""),[l,m]=i.useState(""),[h,u]=i.useState(""),[v,w]=i.useState(!1),[x,y]=i.useState(""),b=P({mutationFn:s=>T.connectTracker(s,"github",{repository:d.trim(),token:l.trim(),labels:h,createOn:v?"thread.created":"manual"})}),n=g||k[0]?.uid||"",t=async s=>{s.preventDefault(),y("");try{const a=await b.mutateAsync(n);p(""),m(""),u(""),w(!1),c(!1),f(n,a.webhook&&"secret"in a.webhook?a.webhook:void 0),A.success("GitHub connected")}catch(a){y(a instanceof H?a.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"Connect a site to GitHub"}),e.jsxs(L,{children:["A fine-grained personal access token with ",e.jsx("b",{children:"Issues: read and write"})," on that one repository. It is checked against the repository before it is saved, and stored encrypted with this instance's secret key."]})]}),x&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:x}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-site",children:"Site"}),e.jsx("select",{id:"gh-site",value:n,onChange:s=>j(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:k.map(s=>e.jsx("option",{value:s.uid,children:s.name},s.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-repo",children:"Repository"}),e.jsx(F,{id:"gh-repo",placeholder:"kilnwork/site",value:d,onChange:s=>p(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-token",children:"Token"}),e.jsx(F,{id:"gh-token",type:"password",placeholder:"github_pat_…",value:l,onChange:s=>m(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-labels",children:"Labels"}),e.jsx(F,{id:"gh-labels",placeholder:"review, bug",value:h,onChange:s=>u(s.target.value)}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Applied to every issue this makes. Optional."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:s=>w(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:'Off by default: a reviewer walking a site leaves twenty comments and half are "never mind". Make issues from the brief when you mean it.'})]})]}),e.jsxs(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:b.isPending,disabled:!d.trim()||!l.trim()||!n,children:b.isPending?"Checking…":"Connect"})]})]})})})}function de({state:r,onClose:c,siteName:k}){const f=r&&"secret"in r.hook?r.hook.secret:null;return e.jsx(E,{open:r!==null,onOpenChange:g=>!g&&c(),children:e.jsxs(O,{children:[e.jsxs(R,{children:[e.jsx(D,{children:r?.fresh?"Connected — now the webhook":"Webhook for "+(r?k(r.site):"")}),e.jsx(L,{children:r?.provider==="linear"?"Issues moved in Linear move the comment here. In Linear › Settings › API › Webhooks, create one for the team with this URL and Issue events; then paste its signing secret when connecting or replacing the connection.":r?.provider==="jira"?"Issues moved in Jira move the comment here. In Jira › Settings › System › Webhooks, create one with this URL, the events Issue updated and Issue deleted, and a secret; then paste the same secret when connecting or replacing the connection.":`Issues closed or reopened on GitHub move the comment here. Add a webhook to the repository — Settings › Webhooks › Add webhook — with these values. The secret is shown this once${r?.fresh?"":", and the previous one has stopped working"}.`})]}),r&&e.jsxs("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Payload URL"}),e.jsxs("dd",{className:"m-0 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]",children:r.hook.url}),e.jsx(W,{text:r.hook.url,label:"Copy the payload URL"})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Content type"}),e.jsx("dd",{className:"m-0",children:e.jsx("code",{className:"font-mono text-[12px]",children:"application/json"})}),f&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Secret"}),e.jsxs("dd",{className:"m-0 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]","data-testid":"webhook-secret",children:f}),e.jsx(W,{text:f,label:"Copy the secret"})]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Events"}),e.jsx("dd",{className:"m-0",children:r.provider==="linear"?"Issues":r.provider==="jira"?"Issue: updated, deleted":"Let me select individual events → Issues"})]}),e.jsx(M,{children:e.jsx(N,{type:"button",onClick:c,children:"Done"})})]})})}function me({open:r,onOpenChange:c,sites:k,onDone:f}){const[g,j]=i.useState(""),[d,p]=i.useState(""),[l,m]=i.useState(""),[h,u]=i.useState(""),[v,w]=i.useState(!1),[x,y]=i.useState(""),b=P({mutationFn:s=>T.connectTracker(s,"linear",{team:d.trim(),apiKey:l.trim(),...h.trim()?{webhookSecret:h.trim()}:{},createOn:v?"thread.created":"manual"})}),n=g||k[0]?.uid||"",t=async s=>{s.preventDefault(),y("");try{const a=await b.mutateAsync(n);p(""),m(""),u(""),w(!1),c(!1),f(n,a.webhook??{url:`${location.origin}/api/v1/integrations/linear/inbound`}),A.success("Linear connected")}catch(a){y(a instanceof H?a.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"Connect a site to Linear"}),e.jsx(L,{children:"A personal API key from Linear › Settings › API, belonging to a member of the team. It is checked against the team before it is saved, and stored encrypted with this instance's secret key."})]}),x&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:x}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-site",children:"Site"}),e.jsx("select",{id:"ln-site",value:n,onChange:s=>j(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:k.map(s=>e.jsx("option",{value:s.uid,children:s.name},s.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-team",children:"Team key"}),e.jsx(F,{id:"ln-team",placeholder:"ENG",value:d,onChange:s=>p(s.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The prefix of the team's issues, like the ENG in ENG-123."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-key",children:"API key"}),e.jsx(F,{id:"ln-key",type:"password",placeholder:"lin_api_…",value:l,onChange:s=>m(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-secret",children:"Webhook signing secret"}),e.jsx(F,{id:"ln-secret",type:"password",placeholder:"from Linear's webhook, optional",value:h,onChange:s=>u(s.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Lets Linear move comments here when issues move there. The URL to give Linear is shown after connecting."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:s=>w(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:b.isPending,disabled:!d.trim()||!l.trim()||!n,children:b.isPending?"Checking…":"Connect"})]})]})})})}function he({open:r,onOpenChange:c,sites:k,onDone:f}){const[g,j]=i.useState(""),[d,p]=i.useState(""),[l,m]=i.useState(""),[h,u]=i.useState(""),[v,w]=i.useState(""),[x,y]=i.useState(""),[b,n]=i.useState(!1),[t,s]=i.useState(""),a=P({mutationFn:S=>T.connectTracker(S,"jira",{siteUrl:d.trim(),project:l.trim(),email:h.trim(),apiToken:v.trim(),...x.trim()?{webhookSecret:x.trim()}:{},createOn:b?"thread.created":"manual"})}),o=g||k[0]?.uid||"",I=async S=>{S.preventDefault(),s("");try{const _=await a.mutateAsync(o);m(""),w(""),y(""),n(!1),c(!1),f(o,_.webhook??{url:`${location.origin}/api/v1/integrations/jira/inbound`}),A.success("Jira connected")}catch(_){s(_ instanceof H?_.message:"Could not reach the server.")}},$=(S,_,X,ee,te,se="text",q)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:`jr-${S}`,children:_}),e.jsx(F,{id:`jr-${S}`,type:se,placeholder:te,value:X,onChange:ne=>ee(ne.target.value),autoComplete:"off"}),q&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:q})]});return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:S=>void I(S),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"Connect a site to Jira"}),e.jsx(L,{children:"An API token from id.atlassian.com › Security, with the email of the account it belongs to. It is checked against the project before it is saved, and stored encrypted with this instance's secret key."})]}),t&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:t}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"jr-site",children:"Site"}),e.jsx("select",{id:"jr-site",value:o,onChange:S=>j(S.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:k.map(S=>e.jsx("option",{value:S.uid,children:S.name},S.uid))})]}),$("url","Jira site",d,p,"https://kilnwork.atlassian.net"),$("project","Project key",l,m,"KAN","text","The prefix of the project's issues, like the KAN in KAN-12."),$("email","Account email",h,u,"you@kilnwork.studio","email"),$("token","API token",v,w,"","password"),$("secret","Webhook secret",x,y,"the secret you typed into Jira's webhook, optional","password","Lets Jira move comments here when issues move there. The URL to give Jira is shown after connecting."),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:b,onChange:S=>n(S.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:a.isPending,disabled:!d.trim()||!l.trim()||!h.trim()||!v.trim()||!o,children:a.isPending?"Checking…":"Connect"})]})]})})})}function ue({open:r,onOpenChange:c,sites:k,onDone:f}){const[g,j]=i.useState(""),[d,p]=i.useState(""),[l,m]=i.useState(""),[h,u]=i.useState(!0),[v,w]=i.useState(""),x=B({queryKey:["integrations","slack","manifest"],queryFn:()=>T.slackManifest(),enabled:r,staleTime:1/0}),y=P({mutationFn:t=>T.connectTracker(t,"slack",{channel:d.trim(),token:l.trim(),createOn:h?"thread.created":"manual"})}),b=g||k[0]?.uid||"",n=async t=>{t.preventDefault(),w("");try{await y.mutateAsync(b),p(""),m(""),u(!0),c(!1),f(b),A.success("Slack connected")}catch(s){w(s instanceof H?s.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:t=>void n(t),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"Connect a site to Slack"}),e.jsx(L,{children:"Create the app in your workspace from our manifest — one click, the scopes are filled in — install it, and paste its Bot User OAuth Token. The token is checked against the channel before it is saved, and stored encrypted with this instance's secret key."})]}),v&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:v}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-site",children:"Site"}),e.jsx("select",{id:"sl-site",value:b,onChange:t=>j(t.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:k.map(t=>e.jsx("option",{value:t.uid,children:t.name},t.uid))})]}),e.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border px-3 py-2 text-[13px]",children:[e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block font-medium",children:"1. Create the app"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Opens api.slack.com with the manifest pasted; then Install to Workspace."})]}),e.jsx(N,{type:"button",variant:"outline",size:"sm",disabled:!x.data,render:e.jsx("a",{href:x.data?.url??"#",target:"_blank",rel:"noreferrer"}),children:"Create app…"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-token",children:"2. Bot User OAuth Token"}),e.jsx(F,{id:"sl-token",type:"password",placeholder:"xoxb-…",value:l,onChange:t=>m(t.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"On the app's OAuth & Permissions page after installing."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-channel",children:"3. Channel"}),e.jsx(F,{id:"sl-channel",placeholder:"#reviews",value:d,onChange:t=>p(t.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"A public channel by name; a private one needs the app invited first, then its name works too."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:h,onChange:t=>u(t.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"A message for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"On by default: a channel is where people are told. Turn it off to post from the brief when you mean it."})]})]}),e.jsxs(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:y.isPending,disabled:!d.trim()||!l.trim()||!b,children:y.isPending?"Checking…":"Connect"})]})]})})})}function xe({owner:r,instanceOwner:c,sites:k}){const f=z(),g=B(U.mcpTokens()),[j,d]=i.useState(!1),[p,l]=i.useState(null),[m,h]=i.useState(null),u=P({mutationFn:n=>T.revokeMcpToken(n),onSuccess:()=>{h(null),f.invalidateQueries({queryKey:["mcp-tokens"]})},onError:n=>A.error(K(n))}),v=g.data?.data??[],w=v.filter(n=>!n.revokedAt),x=g.data?.http??null,y=P({mutationFn:n=>T.setMcpHttp(n),onSuccess:(n,t)=>{f.setQueryData(U.instance().queryKey,n),f.invalidateQueries({queryKey:["mcp-tokens"]}),A.success(t?"Remote transport on — the token dialog shows its config":"Remote transport off — the endpoint answers 404 again")},onError:n=>A.error(K(n))}),b=n=>{const t=new Set(n),s=t.has("comments:write")||t.has("threads:write");return!s&&!t.has("context:read")?"Read-only":s?`Writes: ${[t.has("comments:write")?"reply":"",t.has("threads:write")?"mark ready":""].filter(Boolean).join(", ")}`:"Read-only, with capture context"};return e.jsxs(Y,{title:"MCP",description:"A coding agent — Claude Code, Cursor, any MCP client — reads the same brief this dashboard copies, maps a comment to the file in its checkout, and can reply or mark a fix ready. It never resolves: whoever reported a snag decides when it is fixed. A token per agent, shown once, revocable here.",children:[g.isPending&&e.jsx(Q,{rows:2}),x&&e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx(C,{htmlFor:"mcp-http-on",className:"text-[13px] font-medium",children:"Remote transport"}),e.jsxs("p",{className:"m-0 mt-0.5 text-[12px] leading-normal text-muted-foreground",children:[x.enabled?e.jsxs(e.Fragment,{children:["On. An agent anywhere talks to this studio at ",e.jsx("code",{className:"font-mono text-[11.5px]",children:x.url})," with a token as a bearer. No source mapping there; a write needs a token minted for it."]}):e.jsxs(e.Fragment,{children:["Off. Agents reach this studio only from a machine with the checkout. On, ",e.jsx("code",{className:"font-mono text-[11.5px]",children:x.url})," serves the same tools to an agent anywhere, with a token as a bearer."]}),x.source==="env"?" Set by the environment (SNAGSET_MCP_HTTP_ENABLED).":""]})]}),e.jsx(ae,{id:"mcp-http-on","aria-label":"Remote transport",checked:x.enabled,disabled:!c||x.source==="env"||y.isPending,onCheckedChange:n=>y.mutate(n)})]}),g.isSuccess&&w.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(G,{variant:"outline",children:"No tokens"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:"No agent can read this studio yet."})]}),v.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0","aria-label":"Agent tokens",children:v.map(n=>e.jsxs("li",{className:`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-border px-3 py-2.5 text-[13px] ${n.revokedAt?"opacity-60":""}`,children:[e.jsx("span",{className:"font-medium",children:n.name}),e.jsxs("code",{className:"font-mono text-[12.5px] text-muted-foreground",children:[n.prefix,"…"]}),e.jsx(G,{variant:"outline",className:n.revokedAt?"":"border-ok text-ok",children:n.revokedAt?"Revoked":b(n.scopes)}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[n.site?n.site.name:"All sites"," · ",n.lastUsedAt?`last used ${Z(n.lastUsedAt)}`:"never used",n.expiresAt&&!n.revokedAt?` · expires ${new Date(n.expiresAt).toLocaleDateString()}`:"",n.createdBy?` · by ${n.createdBy}`:""]}),n.canRevoke&&e.jsx("span",{className:"ml-auto flex gap-1",children:e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>h(n),children:"Revoke"})})]},n.id))}),r&&e.jsx("div",{children:e.jsx(N,{variant:"outline",size:"sm",onClick:()=>d(!0),children:"New token…"})}),e.jsx(pe,{open:j,onOpenChange:d,sites:k,http:g.data?.http??null,onDone:n=>{f.invalidateQueries({queryKey:["mcp-tokens"]}),l(n)}}),e.jsx(fe,{state:p,http:g.data?.http??null,onClose:()=>l(null)}),e.jsx(V,{open:m!==null,onOpenChange:n=>!n&&h(null),title:`Revoke “${m?.name??""}”?`,description:e.jsx(e.Fragment,{children:"The agent holding it loses access on its next request. Its past replies stay, under its name. This cannot be undone — mint a new token instead."}),confirmLabel:"Revoke",busy:u.isPending,onConfirm:async()=>{m&&await u.mutateAsync(m.id)}})]})}function pe({open:r,onOpenChange:c,sites:k,http:f,onDone:g}){const[j,d]=i.useState(""),[p,l]=i.useState(""),[m,h]=i.useState(["threads:read","source:map"]),[u,v]=i.useState(""),[w,x]=i.useState(!1),[y,b]=i.useState(""),n=P({mutationFn:()=>T.mintMcpToken({name:j.trim(),...p?{site:p}:{},scopes:m,...u?{expiresInDays:Number(u)}:{},...w?{allowRemoteWrites:!0}:{}})}),t=(a,o)=>h(I=>o?[...new Set([...I,a])]:I.filter($=>$!==a)),s=async a=>{a.preventDefault(),b("");try{const o=await n.mutateAsync();d(""),l(""),h(["threads:read","source:map"]),v(""),x(!1),c(!1),g(o)}catch(o){b(o instanceof H?o.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:a=>void s(a),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"New agent token"}),e.jsx(L,{children:"Read-only by default, plus mapping a comment to a file in the agent's own checkout. Tick more only for an agent you want writing here — and it still cannot resolve anything."})]}),y&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:y}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-name",children:"Name"}),e.jsx(F,{id:"mcp-name",placeholder:"Claude Code",value:j,onChange:a=>d(a.target.value),autoComplete:"off",maxLength:80}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"What a client sees on the agent's replies, so name the agent, not the person."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-site",children:"Site"}),e.jsxs("select",{id:"mcp-site",value:p,onChange:a=>l(a.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:[e.jsx("option",{value:"",children:"All sites"}),k.map(a=>e.jsx("option",{value:a.uid,children:a.name},a.uid))]})]}),e.jsxs("fieldset",{className:"m-0 flex flex-col gap-2 border-0 p-0",children:[e.jsx("legend",{className:"mb-1 text-[13px] font-medium",children:"Scopes"}),oe.map(a=>e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:m.includes(a.scope),onChange:o=>t(a.scope,o.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:a.label}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:a.hint})]})]},a.scope))]}),f?.enabled&&(m.includes("comments:write")||m.includes("threads:write"))&&e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:w,onChange:a=>x(a.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"May write over the remote transport"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Over POST /mcp the agent is not on a machine you can see; a write there is a decision."})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-expires",children:"Expires"}),e.jsxs("select",{id:"mcp-expires",value:u,onChange:a=>v(a.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:[e.jsx("option",{value:"",children:"Never"}),e.jsx("option",{value:"30",children:"In 30 days"}),e.jsx("option",{value:"90",children:"In 90 days"}),e.jsx("option",{value:"365",children:"In a year"})]})]}),e.jsxs(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:n.isPending,disabled:!j.trim()||m.length===0,children:n.isPending?"Minting…":"Create token"})]})]})})})}function fe({state:r,http:c,onClose:k}){const f=typeof location<"u"?location.origin:"",g={SNAGSET_MCP_TOKEN:r?.secret??"",SNAGSET_MCP_HOST:f,...r?.token.site?{SNAGSET_MCP_PROJECT:r.token.site.uid}:{}},j=JSON.stringify({mcpServers:{snagset:{command:"npx",args:["-y","@snagset/mcp"],env:g}}},null,2),d=["claude mcp add snagset",...Object.entries(g).map(([h,u])=>`-e ${h}=${u}`),"--","npx -y @snagset/mcp"].join(" "),p=`Bearer ${r?.secret??""}`,l=["claude mcp add","--transport http","snagset",c?.url??"",`--header "Authorization: ${p}"`].join(" "),m=JSON.stringify({mcpServers:{snagset:{type:"http",url:c?.url??"",headers:{Authorization:p}}}},null,2);return e.jsx(E,{open:r!==null,onOpenChange:h=>!h&&k(),children:e.jsxs(O,{className:"sm:max-w-xl",children:[e.jsxs(R,{children:[e.jsxs(D,{children:["Token for “",r?.token.name??"","”"]}),e.jsx(L,{children:"Shown this once — only its hash is stored. Put it in the agent's config, then start the agent from the site's checkout so it can map comments to files."})]}),r&&e.jsxs("div",{className:"flex flex-col gap-4 text-[13px]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1.5 font-mono text-[12px]","data-testid":"mcp-token",children:r.secret}),e.jsx(W,{text:r.secret,label:"Copy the token"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Claude Code"}),e.jsx(W,{text:d,label:"Copy the Claude Code command"})]}),e.jsx("pre",{className:"m-0 whitespace-pre-wrap break-all rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:d})]}),c?.enabled&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Remote — an agent that is not on a machine with the checkout"}),e.jsx(W,{text:m,label:"Copy the remote config"})]}),e.jsx("pre",{className:"m-0 whitespace-pre-wrap break-all rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:l}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:m}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"No source mapping there — nothing to search. Writes need the token minted with remote writes allowed."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Cursor, Claude Desktop, any MCP client"}),e.jsx(W,{text:j,label:"Copy the JSON config"})]}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:j}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Cursor reads it from .cursor/mcp.json in the project; Claude Desktop from its claude_desktop_config.json."})]})]}),e.jsx(M,{children:e.jsx(N,{type:"button",onClick:k,children:"Done"})})]})})}export{Re as component};
|
|
1
|
+
import{t as z,r as i,Z as P,_ as A,Y as K,p as T,$ as J,j as e,V as Q,B as N,y as U,a0 as oe,A as H}from"./index-BCjjK9dr.js";import{u as B}from"./useQuery-6QR_MT4t.js";import{B as G}from"./badge-NV2UvVlq.js";import{E,G as O,I as R,H as D,J as L,K as M}from"./dialog-B_kwIiUp.js";import{L as C,I as F}from"./label-CU7jvj5k.js";import{S as ae}from"./switch-L2_Pf-6w.js";import{C as V}from"./ConfirmDialog-YHdRCMuk.js";import{P as re,a as Y}from"./parts-Oxy1krsw.js";import{C as W}from"./CopyButton-BPFFhzYZ.js";import{b as Z}from"./labels--UUyt9uB.js";import{u as ie}from"./me-ttfbX4Cb.js";import"./useBaseQuery-CoqlgX-x.js";import"./useRender-BybHPfHo.js";import"./useAriaLabelledBy-Bk7BENOF.js";import"./useValueChanged-BhvEiD3-.js";import"./card-PWIpee1m.js";import"./check-fUN7a3GX.js";import"./copy-ZBdagSqO.js";const ce={ok:{label:"Healthy",tone:"ok"},needs_reauth:{label:"Needs a new token",tone:"bad"},error:{label:"Failing",tone:"bad"}};function Re(){const r=ie(),c=r.user.role==="owner"||r.user.role==="admin",k=r.user.role==="owner",f=B(U.integrations()),g=z(),j=()=>g.invalidateQueries({queryKey:["integrations"]}),[d,p]=i.useState(null),[l,m]=i.useState(null),[h,u]=i.useState(null),v=P({mutationFn:t=>T.regenerateGitHubWebhook(t),onSuccess:({webhook:t},s)=>u({site:s,provider:"github",hook:t,fresh:!1}),onError:t=>A.error(K(t))}),w=P({mutationFn:({uid:t,provider:s})=>T.testTracker(t,s).then(a=>({...a,provider:s})),onSuccess:t=>{A[t.ok?"success":"error"](t.ok?`${J[t.provider]} can see ${t.target}`:t.detail??`${J[t.provider]} refused the token`),j()},onError:t=>A.error(K(t))}),x=P({mutationFn:({uid:t,provider:s})=>T.disconnectTracker(t,s),onSuccess:()=>{m(null),j()},onError:t=>A.error(K(t))}),y=f.data?.data??[],b=t=>y.filter(s=>s.provider===t),n=t=>r.projects.filter(s=>!b(t).some(a=>a.site===s.uid));return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(re,{title:"Integrations",sub:"Mirrors converge on the comment's status here; Slack only announces"}),["github","linear","jira","slack"].map(t=>{const s=b(t),a=n(t);return e.jsxs(Y,{title:J[t],description:t==="github"?"A comment becomes an issue in the site's repository, with the brief as its body; resolving it here closes the issue there, and closing it there resolves it here. A fine-grained token per site — no OAuth app to register.":t==="linear"?"A comment becomes an issue in the site's team, with the brief as its body; our status moves it between the team's workflow states by type, and a webhook from Linear moves it back. A personal API key per site — no OAuth app to register.":t==="jira"?"A comment becomes an issue in the site's Jira project, with the brief as its description; our status moves it through the workflow by status category, and a webhook from Jira moves it back. An API token with the account's email — what Atlassian gives a self-hoster.":"One message per comment in a channel, edited in place as the status moves — never a second message, never a reply. A bot token from an app you create in a click from our manifest; Slack sends nothing back.",children:[f.isPending&&e.jsx(Q,{rows:2}),f.isSuccess&&s.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(G,{variant:"outline",children:"Not connected"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:t==="github"?"No site is connected to a repository yet.":t==="linear"?"No site is connected to a team yet.":t==="jira"?"No site is connected to a project yet.":"No site is connected to a channel yet."})]}),s.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:s.map(o=>{const I=ce[o.health]??{label:o.health,tone:"warn"};return e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-border px-3 py-2.5 text-[13px]",children:[e.jsx("span",{className:"font-medium",children:o.siteName??o.site}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("code",{className:"font-mono text-[12.5px]",children:o.provider==="github"?`${o.owner}/${o.repo}`:o.provider==="linear"?`${o.teamKey} · ${o.teamName}`:o.provider==="jira"?`${o.projectKey} · ${o.projectName}`:`#${o.channelName} · ${o.teamName}`}),e.jsx(G,{variant:"outline",className:I.tone==="ok"?"border-ok text-ok":I.tone==="bad"?"border-destructive text-destructive":"",children:I.label}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[o.provider==="slack"?o.createOn==="thread.created"?"A message for every new comment":"Messages when you ask, from the brief":o.createOn==="thread.created"?"An issue for every new comment":"Issues when you ask, from the brief",o.provider==="github"&&o.labels.length?` · labels ${o.labels.join(", ")}`:"",o.provider!=="github"&&o.provider!=="slack"&&!o.hasWebhookSecret?` · no webhook secret yet, so ${J[o.provider]} cannot move comments here`:""," · ",Z(o.updatedAt)]}),o.lastError&&e.jsx("span",{className:"basis-full text-[12px] text-destructive",children:o.lastError}),c&&e.jsxs("span",{className:"ml-auto flex gap-1",children:[o.provider==="github"?e.jsx(N,{variant:"ghost",size:"sm",loading:v.isPending,onClick:()=>v.mutate(o.site),children:"Webhook…"}):o.provider==="slack"?null:e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>u({site:o.site,provider:o.provider,hook:{url:`${location.origin}/api/v1/integrations/${o.provider}/inbound`},fresh:!1}),children:"Webhook…"}),e.jsx(N,{variant:"ghost",size:"sm",loading:w.isPending,onClick:()=>w.mutate({uid:o.site,provider:o.provider}),children:"Test"}),e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>m(o),children:"Disconnect"})]})]},`${o.provider}:${o.site}`)})}),c&&a.length>0&&e.jsx("div",{children:e.jsx(N,{variant:"outline",size:"sm",onClick:()=>p(t),children:"Connect a site…"})})]},t)}),e.jsx(xe,{owner:c,instanceOwner:k,sites:r.projects}),e.jsx(le,{open:d==="github",onOpenChange:t=>!t&&p(null),sites:n("github"),onDone:(t,s)=>{j(),s&&u({site:t,provider:"github",hook:s,fresh:!0})}}),e.jsx(me,{open:d==="linear",onOpenChange:t=>!t&&p(null),sites:n("linear"),onDone:(t,s)=>{j(),u({site:t,provider:"linear",hook:s,fresh:!0})}}),e.jsx(he,{open:d==="jira",onOpenChange:t=>!t&&p(null),sites:n("jira"),onDone:(t,s)=>{j(),u({site:t,provider:"jira",hook:s,fresh:!0})}}),e.jsx(ue,{open:d==="slack",onOpenChange:t=>!t&&p(null),sites:n("slack"),onDone:()=>void j()}),e.jsx(de,{state:h,onClose:()=>u(null),siteName:t=>y.find(s=>s.site===t)?.siteName??"the site"}),e.jsx(V,{open:l!==null,onOpenChange:t=>!t&&m(null),title:`Disconnect ${l?.siteName??"this site"} from ${l?J[l.provider]:"the tracker"}?`,description:l?.provider==="slack"?e.jsx(e.Fragment,{children:"Messages already posted stay in the channel; no new ones are posted and they stop being updated. The token is forgotten."}):e.jsx(e.Fragment,{children:"Issues already made keep their links; no new ones are made and status stops mirroring. The token is forgotten."}),confirmLabel:"Disconnect",busy:x.isPending,onConfirm:async()=>{l&&await x.mutateAsync({uid:l.site,provider:l.provider})}})]})}function le({open:r,onOpenChange:c,sites:k,onDone:f}){const[g,j]=i.useState(""),[d,p]=i.useState(""),[l,m]=i.useState(""),[h,u]=i.useState(""),[v,w]=i.useState(!1),[x,y]=i.useState(""),b=P({mutationFn:s=>T.connectTracker(s,"github",{repository:d.trim(),token:l.trim(),labels:h,createOn:v?"thread.created":"manual"})}),n=g||k[0]?.uid||"",t=async s=>{s.preventDefault(),y("");try{const a=await b.mutateAsync(n);p(""),m(""),u(""),w(!1),c(!1),f(n,a.webhook&&"secret"in a.webhook?a.webhook:void 0),A.success("GitHub connected")}catch(a){y(a instanceof H?a.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"Connect a site to GitHub"}),e.jsxs(L,{children:["A fine-grained personal access token with ",e.jsx("b",{children:"Issues: read and write"})," on that one repository. It is checked against the repository before it is saved, and stored encrypted with this instance's secret key."]})]}),x&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:x}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-site",children:"Site"}),e.jsx("select",{id:"gh-site",value:n,onChange:s=>j(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:k.map(s=>e.jsx("option",{value:s.uid,children:s.name},s.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-repo",children:"Repository"}),e.jsx(F,{id:"gh-repo",placeholder:"kilnwork/site",value:d,onChange:s=>p(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-token",children:"Token"}),e.jsx(F,{id:"gh-token",type:"password",placeholder:"github_pat_…",value:l,onChange:s=>m(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-labels",children:"Labels"}),e.jsx(F,{id:"gh-labels",placeholder:"review, bug",value:h,onChange:s=>u(s.target.value)}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Applied to every issue this makes. Optional."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:s=>w(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:'Off by default: a reviewer walking a site leaves twenty comments and half are "never mind". Make issues from the brief when you mean it.'})]})]}),e.jsxs(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:b.isPending,disabled:!d.trim()||!l.trim()||!n,children:b.isPending?"Checking…":"Connect"})]})]})})})}function de({state:r,onClose:c,siteName:k}){const f=r&&"secret"in r.hook?r.hook.secret:null;return e.jsx(E,{open:r!==null,onOpenChange:g=>!g&&c(),children:e.jsxs(O,{children:[e.jsxs(R,{children:[e.jsx(D,{children:r?.fresh?"Connected — now the webhook":"Webhook for "+(r?k(r.site):"")}),e.jsx(L,{children:r?.provider==="linear"?"Issues moved in Linear move the comment here. In Linear › Settings › API › Webhooks, create one for the team with this URL and Issue events; then paste its signing secret when connecting or replacing the connection.":r?.provider==="jira"?"Issues moved in Jira move the comment here. In Jira › Settings › System › Webhooks, create one with this URL, the events Issue updated and Issue deleted, and a secret; then paste the same secret when connecting or replacing the connection.":`Issues closed or reopened on GitHub move the comment here. Add a webhook to the repository — Settings › Webhooks › Add webhook — with these values. The secret is shown this once${r?.fresh?"":", and the previous one has stopped working"}.`})]}),r&&e.jsxs("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Payload URL"}),e.jsxs("dd",{className:"m-0 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]",children:r.hook.url}),e.jsx(W,{text:r.hook.url,label:"Copy the payload URL"})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Content type"}),e.jsx("dd",{className:"m-0",children:e.jsx("code",{className:"font-mono text-[12px]",children:"application/json"})}),f&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Secret"}),e.jsxs("dd",{className:"m-0 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]","data-testid":"webhook-secret",children:f}),e.jsx(W,{text:f,label:"Copy the secret"})]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Events"}),e.jsx("dd",{className:"m-0",children:r.provider==="linear"?"Issues":r.provider==="jira"?"Issue: updated, deleted":"Let me select individual events → Issues"})]}),e.jsx(M,{children:e.jsx(N,{type:"button",onClick:c,children:"Done"})})]})})}function me({open:r,onOpenChange:c,sites:k,onDone:f}){const[g,j]=i.useState(""),[d,p]=i.useState(""),[l,m]=i.useState(""),[h,u]=i.useState(""),[v,w]=i.useState(!1),[x,y]=i.useState(""),b=P({mutationFn:s=>T.connectTracker(s,"linear",{team:d.trim(),apiKey:l.trim(),...h.trim()?{webhookSecret:h.trim()}:{},createOn:v?"thread.created":"manual"})}),n=g||k[0]?.uid||"",t=async s=>{s.preventDefault(),y("");try{const a=await b.mutateAsync(n);p(""),m(""),u(""),w(!1),c(!1),f(n,a.webhook??{url:`${location.origin}/api/v1/integrations/linear/inbound`}),A.success("Linear connected")}catch(a){y(a instanceof H?a.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"Connect a site to Linear"}),e.jsx(L,{children:"A personal API key from Linear › Settings › API, belonging to a member of the team. It is checked against the team before it is saved, and stored encrypted with this instance's secret key."})]}),x&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:x}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-site",children:"Site"}),e.jsx("select",{id:"ln-site",value:n,onChange:s=>j(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:k.map(s=>e.jsx("option",{value:s.uid,children:s.name},s.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-team",children:"Team key"}),e.jsx(F,{id:"ln-team",placeholder:"ENG",value:d,onChange:s=>p(s.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The prefix of the team's issues, like the ENG in ENG-123."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-key",children:"API key"}),e.jsx(F,{id:"ln-key",type:"password",placeholder:"lin_api_…",value:l,onChange:s=>m(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-secret",children:"Webhook signing secret"}),e.jsx(F,{id:"ln-secret",type:"password",placeholder:"from Linear's webhook, optional",value:h,onChange:s=>u(s.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Lets Linear move comments here when issues move there. The URL to give Linear is shown after connecting."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:s=>w(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:b.isPending,disabled:!d.trim()||!l.trim()||!n,children:b.isPending?"Checking…":"Connect"})]})]})})})}function he({open:r,onOpenChange:c,sites:k,onDone:f}){const[g,j]=i.useState(""),[d,p]=i.useState(""),[l,m]=i.useState(""),[h,u]=i.useState(""),[v,w]=i.useState(""),[x,y]=i.useState(""),[b,n]=i.useState(!1),[t,s]=i.useState(""),a=P({mutationFn:S=>T.connectTracker(S,"jira",{siteUrl:d.trim(),project:l.trim(),email:h.trim(),apiToken:v.trim(),...x.trim()?{webhookSecret:x.trim()}:{},createOn:b?"thread.created":"manual"})}),o=g||k[0]?.uid||"",I=async S=>{S.preventDefault(),s("");try{const _=await a.mutateAsync(o);m(""),w(""),y(""),n(!1),c(!1),f(o,_.webhook??{url:`${location.origin}/api/v1/integrations/jira/inbound`}),A.success("Jira connected")}catch(_){s(_ instanceof H?_.message:"Could not reach the server.")}},$=(S,_,X,ee,te,se="text",q)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:`jr-${S}`,children:_}),e.jsx(F,{id:`jr-${S}`,type:se,placeholder:te,value:X,onChange:ne=>ee(ne.target.value),autoComplete:"off"}),q&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:q})]});return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:S=>void I(S),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"Connect a site to Jira"}),e.jsx(L,{children:"An API token from id.atlassian.com › Security, with the email of the account it belongs to. It is checked against the project before it is saved, and stored encrypted with this instance's secret key."})]}),t&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:t}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"jr-site",children:"Site"}),e.jsx("select",{id:"jr-site",value:o,onChange:S=>j(S.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:k.map(S=>e.jsx("option",{value:S.uid,children:S.name},S.uid))})]}),$("url","Jira site",d,p,"https://kilnwork.atlassian.net"),$("project","Project key",l,m,"KAN","text","The prefix of the project's issues, like the KAN in KAN-12."),$("email","Account email",h,u,"you@kilnwork.studio","email"),$("token","API token",v,w,"","password"),$("secret","Webhook secret",x,y,"the secret you typed into Jira's webhook, optional","password","Lets Jira move comments here when issues move there. The URL to give Jira is shown after connecting."),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:b,onChange:S=>n(S.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:a.isPending,disabled:!d.trim()||!l.trim()||!h.trim()||!v.trim()||!o,children:a.isPending?"Checking…":"Connect"})]})]})})})}function ue({open:r,onOpenChange:c,sites:k,onDone:f}){const[g,j]=i.useState(""),[d,p]=i.useState(""),[l,m]=i.useState(""),[h,u]=i.useState(!0),[v,w]=i.useState(""),x=B({queryKey:["integrations","slack","manifest"],queryFn:()=>T.slackManifest(),enabled:r,staleTime:1/0}),y=P({mutationFn:t=>T.connectTracker(t,"slack",{channel:d.trim(),token:l.trim(),createOn:h?"thread.created":"manual"})}),b=g||k[0]?.uid||"",n=async t=>{t.preventDefault(),w("");try{await y.mutateAsync(b),p(""),m(""),u(!0),c(!1),f(b),A.success("Slack connected")}catch(s){w(s instanceof H?s.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:t=>void n(t),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"Connect a site to Slack"}),e.jsx(L,{children:"Create the app in your workspace from our manifest — one click, the scopes are filled in — install it, and paste its Bot User OAuth Token. The token is checked against the channel before it is saved, and stored encrypted with this instance's secret key."})]}),v&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:v}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-site",children:"Site"}),e.jsx("select",{id:"sl-site",value:b,onChange:t=>j(t.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:k.map(t=>e.jsx("option",{value:t.uid,children:t.name},t.uid))})]}),e.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border px-3 py-2 text-[13px]",children:[e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block font-medium",children:"1. Create the app"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Opens api.slack.com with the manifest pasted; then Install to Workspace."})]}),e.jsx(N,{type:"button",variant:"outline",size:"sm",disabled:!x.data,render:e.jsx("a",{href:x.data?.url??"#",target:"_blank",rel:"noreferrer"}),children:"Create app…"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-token",children:"2. Bot User OAuth Token"}),e.jsx(F,{id:"sl-token",type:"password",placeholder:"xoxb-…",value:l,onChange:t=>m(t.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"On the app's OAuth & Permissions page after installing."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-channel",children:"3. Channel"}),e.jsx(F,{id:"sl-channel",placeholder:"#reviews",value:d,onChange:t=>p(t.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"A public channel by name; a private one needs the app invited first, then its name works too."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:h,onChange:t=>u(t.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"A message for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"On by default: a channel is where people are told. Turn it off to post from the brief when you mean it."})]})]}),e.jsxs(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:y.isPending,disabled:!d.trim()||!l.trim()||!b,children:y.isPending?"Checking…":"Connect"})]})]})})})}function xe({owner:r,instanceOwner:c,sites:k}){const f=z(),g=B(U.mcpTokens()),[j,d]=i.useState(!1),[p,l]=i.useState(null),[m,h]=i.useState(null),u=P({mutationFn:n=>T.revokeMcpToken(n),onSuccess:()=>{h(null),f.invalidateQueries({queryKey:["mcp-tokens"]})},onError:n=>A.error(K(n))}),v=g.data?.data??[],w=v.filter(n=>!n.revokedAt),x=g.data?.http??null,y=P({mutationFn:n=>T.setMcpHttp(n),onSuccess:(n,t)=>{f.setQueryData(U.instance().queryKey,n),f.invalidateQueries({queryKey:["mcp-tokens"]}),A.success(t?"Remote transport on — the token dialog shows its config":"Remote transport off — the endpoint answers 404 again")},onError:n=>A.error(K(n))}),b=n=>{const t=new Set(n),s=t.has("comments:write")||t.has("threads:write");return!s&&!t.has("context:read")?"Read-only":s?`Writes: ${[t.has("comments:write")?"reply":"",t.has("threads:write")?"mark ready":""].filter(Boolean).join(", ")}`:"Read-only, with capture context"};return e.jsxs(Y,{title:"MCP",description:"A coding agent — Claude Code, Cursor, any MCP client — reads the same brief this dashboard copies, maps a comment to the file in its checkout, and can reply or mark a fix ready. It never resolves: whoever reported a snag decides when it is fixed. A token per agent, shown once, revocable here.",children:[g.isPending&&e.jsx(Q,{rows:2}),x&&e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx(C,{htmlFor:"mcp-http-on",className:"text-[13px] font-medium",children:"Remote transport"}),e.jsxs("p",{className:"m-0 mt-0.5 text-[12px] leading-normal text-muted-foreground",children:[x.enabled?e.jsxs(e.Fragment,{children:["On. An agent anywhere talks to this studio at ",e.jsx("code",{className:"font-mono text-[11.5px]",children:x.url})," with a token as a bearer. No source mapping there; a write needs a token minted for it."]}):e.jsxs(e.Fragment,{children:["Off. Agents reach this studio only from a machine with the checkout. On, ",e.jsx("code",{className:"font-mono text-[11.5px]",children:x.url})," serves the same tools to an agent anywhere, with a token as a bearer."]}),x.source==="env"?" Set by the environment (SNAGSET_MCP_HTTP_ENABLED).":""]})]}),e.jsx(ae,{id:"mcp-http-on","aria-label":"Remote transport",checked:x.enabled,disabled:!c||x.source==="env"||y.isPending,onCheckedChange:n=>y.mutate(n)})]}),g.isSuccess&&w.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(G,{variant:"outline",children:"No tokens"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:"No agent can read this studio yet."})]}),v.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0","aria-label":"Agent tokens",children:v.map(n=>e.jsxs("li",{className:`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-border px-3 py-2.5 text-[13px] ${n.revokedAt?"opacity-60":""}`,children:[e.jsx("span",{className:"font-medium",children:n.name}),e.jsxs("code",{className:"font-mono text-[12.5px] text-muted-foreground",children:[n.prefix,"…"]}),e.jsx(G,{variant:"outline",className:n.revokedAt?"":"border-ok text-ok",children:n.revokedAt?"Revoked":b(n.scopes)}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[n.site?n.site.name:"All sites"," · ",n.lastUsedAt?`last used ${Z(n.lastUsedAt)}`:"never used",n.expiresAt&&!n.revokedAt?` · expires ${new Date(n.expiresAt).toLocaleDateString()}`:"",n.createdBy?` · by ${n.createdBy}`:""]}),n.canRevoke&&e.jsx("span",{className:"ml-auto flex gap-1",children:e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>h(n),children:"Revoke"})})]},n.id))}),r&&e.jsx("div",{children:e.jsx(N,{variant:"outline",size:"sm",onClick:()=>d(!0),children:"New token…"})}),e.jsx(pe,{open:j,onOpenChange:d,sites:k,http:g.data?.http??null,onDone:n=>{f.invalidateQueries({queryKey:["mcp-tokens"]}),l(n)}}),e.jsx(fe,{state:p,http:g.data?.http??null,onClose:()=>l(null)}),e.jsx(V,{open:m!==null,onOpenChange:n=>!n&&h(null),title:`Revoke “${m?.name??""}”?`,description:e.jsx(e.Fragment,{children:"The agent holding it loses access on its next request. Its past replies stay, under its name. This cannot be undone — mint a new token instead."}),confirmLabel:"Revoke",busy:u.isPending,onConfirm:async()=>{m&&await u.mutateAsync(m.id)}})]})}function pe({open:r,onOpenChange:c,sites:k,http:f,onDone:g}){const[j,d]=i.useState(""),[p,l]=i.useState(""),[m,h]=i.useState(["threads:read","source:map"]),[u,v]=i.useState(""),[w,x]=i.useState(!1),[y,b]=i.useState(""),n=P({mutationFn:()=>T.mintMcpToken({name:j.trim(),...p?{site:p}:{},scopes:m,...u?{expiresInDays:Number(u)}:{},...w?{allowRemoteWrites:!0}:{}})}),t=(a,o)=>h(I=>o?[...new Set([...I,a])]:I.filter($=>$!==a)),s=async a=>{a.preventDefault(),b("");try{const o=await n.mutateAsync();d(""),l(""),h(["threads:read","source:map"]),v(""),x(!1),c(!1),g(o)}catch(o){b(o instanceof H?o.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:a=>void s(a),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"New agent token"}),e.jsx(L,{children:"Read-only by default, plus mapping a comment to a file in the agent's own checkout. Tick more only for an agent you want writing here — and it still cannot resolve anything."})]}),y&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:y}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-name",children:"Name"}),e.jsx(F,{id:"mcp-name",placeholder:"Claude Code",value:j,onChange:a=>d(a.target.value),autoComplete:"off",maxLength:80}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"What a client sees on the agent's replies, so name the agent, not the person."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-site",children:"Site"}),e.jsxs("select",{id:"mcp-site",value:p,onChange:a=>l(a.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:[e.jsx("option",{value:"",children:"All sites"}),k.map(a=>e.jsx("option",{value:a.uid,children:a.name},a.uid))]})]}),e.jsxs("fieldset",{className:"m-0 flex flex-col gap-2 border-0 p-0",children:[e.jsx("legend",{className:"mb-1 text-[13px] font-medium",children:"Scopes"}),oe.map(a=>e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:m.includes(a.scope),onChange:o=>t(a.scope,o.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:a.label}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:a.hint})]})]},a.scope))]}),f?.enabled&&(m.includes("comments:write")||m.includes("threads:write"))&&e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:w,onChange:a=>x(a.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"May write over the remote transport"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Over POST /mcp the agent is not on a machine you can see; a write there is a decision."})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-expires",children:"Expires"}),e.jsxs("select",{id:"mcp-expires",value:u,onChange:a=>v(a.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:[e.jsx("option",{value:"",children:"Never"}),e.jsx("option",{value:"30",children:"In 30 days"}),e.jsx("option",{value:"90",children:"In 90 days"}),e.jsx("option",{value:"365",children:"In a year"})]})]}),e.jsxs(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:n.isPending,disabled:!j.trim()||m.length===0,children:n.isPending?"Minting…":"Create token"})]})]})})})}function fe({state:r,http:c,onClose:k}){const f=typeof location<"u"?location.origin:"",g={SNAGSET_MCP_TOKEN:r?.secret??"",SNAGSET_MCP_HOST:f,...r?.token.site?{SNAGSET_MCP_PROJECT:r.token.site.uid}:{}},j=JSON.stringify({mcpServers:{snagset:{command:"npx",args:["-y","@snagset/mcp"],env:g}}},null,2),d=["claude mcp add snagset",...Object.entries(g).map(([h,u])=>`-e ${h}=${u}`),"--","npx -y @snagset/mcp"].join(" "),p=`Bearer ${r?.secret??""}`,l=["claude mcp add","--transport http","snagset",c?.url??"",`--header "Authorization: ${p}"`].join(" "),m=JSON.stringify({mcpServers:{snagset:{type:"http",url:c?.url??"",headers:{Authorization:p}}}},null,2);return e.jsx(E,{open:r!==null,onOpenChange:h=>!h&&k(),children:e.jsxs(O,{className:"sm:max-w-xl",children:[e.jsxs(R,{children:[e.jsxs(D,{children:["Token for “",r?.token.name??"","”"]}),e.jsx(L,{children:"Shown this once — only its hash is stored. Put it in the agent's config, then start the agent from the site's checkout so it can map comments to files."})]}),r&&e.jsxs("div",{className:"flex flex-col gap-4 text-[13px]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1.5 font-mono text-[12px]","data-testid":"mcp-token",children:r.secret}),e.jsx(W,{text:r.secret,label:"Copy the token"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Claude Code"}),e.jsx(W,{text:d,label:"Copy the Claude Code command"})]}),e.jsx("pre",{className:"m-0 whitespace-pre-wrap break-all rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:d})]}),c?.enabled&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Remote — an agent that is not on a machine with the checkout"}),e.jsx(W,{text:m,label:"Copy the remote config"})]}),e.jsx("pre",{className:"m-0 whitespace-pre-wrap break-all rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:l}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:m}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"No source mapping there — nothing to search. Writes need the token minted with remote writes allowed."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Cursor, Claude Desktop, any MCP client"}),e.jsx(W,{text:j,label:"Copy the JSON config"})]}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:j}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Cursor reads it from .cursor/mcp.json in the project; Claude Desktop from its claude_desktop_config.json."})]})]}),e.jsx(M,{children:e.jsx(N,{type:"button",onClick:k,children:"Done"})})]})})}export{Re as component};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as L,j as e,f as q,r as p,B as x,Y as y,C as G,F as _,a1 as V,a2 as Y,a3 as J,H as K,y as w}from"./index-
|
|
1
|
+
import{c as L,j as e,f as q,r as p,B as x,Y as y,C as G,F as _,a1 as V,a2 as Y,a3 as J,H as K,y as w}from"./index-BCjjK9dr.js";import{u as N}from"./useQuery-6QR_MT4t.js";import{u as Q,a as W}from"./zod-DbWDuTiO.js";import{A as X,a as U}from"./avatar-JYCiU767.js";import{B as Z}from"./badge-NV2UvVlq.js";import{C as A}from"./card-PWIpee1m.js";import{X as ee,E as se,G as ie,I as k,H as C,J as S,K as I}from"./dialog-B_kwIiUp.js";import{L as R,I as te}from"./label-CU7jvj5k.js";import{T as D,a as P,b as j,c as o,d as T,e as d}from"./table-fR4tWQ4-.js";import{C as ne}from"./ConfirmDialog-YHdRCMuk.js";import{C as ae}from"./CopyButton-BPFFhzYZ.js";import{P as re,b as le}from"./parts-Oxy1krsw.js";import{a as oe}from"./labels--UUyt9uB.js";import{u as de}from"./me-ttfbX4Cb.js";import{c as ce,d as me,e as xe,f as he,g as ue}from"./studio-DepK2GJ4.js";import{P as pe}from"./plus-Cl722ZH_.js";import"./useBaseQuery-CoqlgX-x.js";import"./useRender-BybHPfHo.js";import"./check-fUN7a3GX.js";import"./copy-ZBdagSqO.js";/**
|
|
2
2
|
* @license lucide-react v1.39.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,h as ae,a7 as re,d as se,a5 as ie,E as ne,i as M,j as f,a8 as oe,f as de}from"./index-
|
|
1
|
+
import{r as i,h as ae,a7 as re,d as se,a5 as ie,E as ne,i as M,j as f,a8 as oe,f as de}from"./index-BCjjK9dr.js";import{f as ce,e as le,h as ue,j as fe,u as pe,A as he,k as be,l as ge,c as me,n as ve}from"./label-CU7jvj5k.js";import{L as ke,M as xe}from"./dialog-B_kwIiUp.js";import{u as we}from"./useAriaLabelledBy-Bk7BENOF.js";import{u as ye}from"./useValueChanged-BhvEiD3-.js";const j=i.createContext(void 0);function Ce(){const r=i.useContext(j);if(r===void 0)throw new Error(ae(63));return r}const D={...ce,checked(r){return r?{"data-checked":""}:{"data-unchecked":""}}},Re=i.forwardRef(function(s,o){const{checked:k,className:F,defaultChecked:x,"aria-labelledby":m,form:p,id:L,inputRef:T,name:w,nativeButton:h=!1,onCheckedChange:V,readOnly:d=!1,required:b=!1,disabled:N=!1,render:ze,uncheckedValue:y,value:C,style:Ee,...A}=s,{clearErrors:H}=le(),{state:R,setTouched:q,setDirty:O,validityData:W,setFilled:v,setFocused:P,validationMode:J,disabled:U,name:Y,validation:c}=ue(),{labelId:_}=fe(),t=U||N,l=Y??w,n=i.useRef(null),G=re(n,T,c.inputRef),g=i.useRef(null),z=pe(),E=he({id:L,implicit:!1,controlRef:g}),B=h?void 0:E,[a,K]=be({controlled:k,default:!!x,name:"Switch",state:"checked"});ge(g,z,a,void 0,!t,w),se(()=>{n.current&&v(n.current.checked)},[v]),ye(a,()=>{H(l),O(a!==W.initialValue),v(a),c.change(a)});const{getButtonProps:Q,buttonRef:X}=ie({disabled:t,native:h}),Z=we(m,_,n,!h,B),$={id:h?E:z,role:"switch","aria-checked":a,"aria-readonly":d||void 0,"aria-required":b||void 0,"aria-labelledby":Z,onFocus(){t||P(!0)},onBlur(){const e=n.current;!e||t||(q(!0),P(!1),J==="onBlur"&&c.commit(e.checked))},onClick(e){if(d||t)return;e.preventDefault();const u=n.current;u&&oe(u,e)}},ee={...c.getValidationProps(t),checked:a,disabled:t,form:p,id:B,name:l,required:b,style:l?ke:xe,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:G,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(d){e.preventDefault();return}const u=e.currentTarget.checked,S=me(ve,e.nativeEvent);V?.(u,S),!S.isCanceled&&K(u)},onClick(e){e.stopPropagation()},onFocus(){g.current?.focus()},...C!==void 0?{value:C}:ne},I=i.useMemo(()=>({...R,checked:a,disabled:t,readOnly:d,required:b}),[R,a,t,d,b]),te=M("span",s,{state:I,ref:[o,g,X],props:[$,A,Q,e=>c.getValidationProps(t,e)],stateAttributesMapping:D});return f.jsxs(j.Provider,{value:I,children:[te,!a&&l&&y!==void 0&&f.jsx("input",{type:"hidden",form:p,name:l,value:y,disabled:t}),f.jsx("input",{...ee,suppressHydrationWarning:!0})]})}),Pe=i.forwardRef(function(s,o){const{render:k,className:F,style:x,...m}=s,p=Ce();return M("span",s,{state:p,ref:o,stateAttributesMapping:D,props:m})});function De({className:r,size:s="default",...o}){return f.jsx(Re,{"data-slot":"switch","data-size":s,className:de("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",r),...o,children:f.jsx(Pe,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}export{De as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,f as l}from"./index-
|
|
1
|
+
import{j as t,f as l}from"./index-BCjjK9dr.js";function o({className:a,...e}){return t.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:t.jsx("table",{"data-slot":"table",className:l("w-full caption-bottom text-sm",a),...e})})}function r({className:a,...e}){return t.jsx("thead",{"data-slot":"table-header",className:l("[&_tr]:border-b",a),...e})}function d({className:a,...e}){return t.jsx("tbody",{"data-slot":"table-body",className:l("[&_tr:last-child]:border-0",a),...e})}function n({className:a,...e}){return t.jsx("tr",{"data-slot":"table-row",className:l("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",a),...e})}function b({className:a,...e}){return t.jsx("th",{"data-slot":"table-head",className:l("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",a),...e})}function c({className:a,...e}){return t.jsx("td",{"data-slot":"table-cell",className:l("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",a),...e})}export{o as T,r as a,n as b,b as c,d,c as e};
|
package/static/dashboard/assets/{useAriaLabelledBy-BSt0Y1vn.js → useAriaLabelledBy-Bk7BENOF.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as u,d as l}from"./index-
|
|
1
|
+
import{r as u,d as l}from"./index-BCjjK9dr.js";import{u as c}from"./label-CU7jvj5k.js";function y(e,n,t,r=!0,i){const[a,d]=u.useState(),f=c(i?`${i}-label`:void 0),o=e??n??a;return l(()=>{const s=e||n||!r?void 0:L(t.current,f);a!==s&&d(s)}),o}function L(e,n){const t=b(e);if(t)return!t.id&&n&&(t.id=n),t.id||void 0}function b(e){if(!e)return;const n=e.parentElement;if(n&&n.tagName==="LABEL")return n;const t=e.id;if(t){const i=e.nextElementSibling;if(i&&i.htmlFor===t)return i}const r=e.labels;return r&&r[0]}export{y as u};
|