@snagset/server 0.0.4 → 0.1.1
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/README.md +4 -3
- package/dist/app.js +82 -9
- package/dist/app.js.map +1 -1
- package/dist/bin.js +85 -11
- package/dist/bin.js.map +1 -1
- package/dist/boot.js +67 -51
- package/dist/boot.js.map +1 -1
- package/dist/config.generated.js +5 -2
- package/dist/config.generated.js.map +1 -1
- package/dist/db/connect.js +7 -0
- package/dist/db/connect.js.map +1 -1
- package/dist/db/migrations/0005_studio_reviewers.sql +45 -0
- package/dist/db/migrations/0006_instance_settings.sql +69 -0
- package/dist/db/migrations/0007_jira_provider.no-txn.sql +13 -0
- package/dist/domain.js +129 -0
- package/dist/domain.js.map +1 -0
- package/dist/instance/settings.js +54 -0
- package/dist/instance/settings.js.map +1 -0
- package/dist/integrations/github.js +112 -0
- package/dist/integrations/github.js.map +1 -0
- package/dist/integrations/inbound.js +88 -0
- package/dist/integrations/inbound.js.map +1 -0
- package/dist/integrations/jira.js +129 -0
- package/dist/integrations/jira.js.map +1 -0
- package/dist/integrations/linear.js +111 -0
- package/dist/integrations/linear.js.map +1 -0
- package/dist/integrations/outbox.js +305 -0
- package/dist/integrations/outbox.js.map +1 -0
- package/dist/integrations/slack.js +135 -0
- package/dist/integrations/slack.js.map +1 -0
- package/dist/integrations/store.js +101 -0
- package/dist/integrations/store.js.map +1 -0
- package/dist/listen.js +58 -0
- package/dist/listen.js.map +1 -0
- package/dist/mail/index.js +21 -11
- package/dist/mail/index.js.map +1 -1
- package/dist/mail/resolve.js +80 -0
- package/dist/mail/resolve.js.map +1 -0
- package/dist/platform.js +27 -0
- package/dist/platform.js.map +1 -0
- package/dist/projectCache.js +3 -2
- package/dist/projectCache.js.map +1 -1
- package/dist/projects.js +8 -2
- package/dist/projects.js.map +1 -1
- package/dist/routes/account.js +59 -0
- package/dist/routes/account.js.map +1 -0
- package/dist/routes/activity.js +111 -0
- package/dist/routes/activity.js.map +1 -0
- package/dist/routes/assignees.js +139 -0
- package/dist/routes/assignees.js.map +1 -0
- package/dist/routes/attachments.js +2 -2
- package/dist/routes/attachments.js.map +1 -1
- package/dist/routes/comments.js +27 -17
- package/dist/routes/comments.js.map +1 -1
- package/dist/routes/cors.js +10 -1
- package/dist/routes/cors.js.map +1 -1
- package/dist/routes/instance.js +164 -0
- package/dist/routes/instance.js.map +1 -0
- package/dist/routes/integrations.js +610 -0
- package/dist/routes/integrations.js.map +1 -0
- package/dist/routes/jobs.js +15 -3
- package/dist/routes/jobs.js.map +1 -1
- package/dist/routes/mcpTokens.js +119 -0
- package/dist/routes/mcpTokens.js.map +1 -0
- package/dist/routes/members.js +177 -0
- package/dist/routes/members.js.map +1 -0
- package/dist/routes/owner.js +64 -7
- package/dist/routes/owner.js.map +1 -1
- package/dist/routes/sites.js +181 -8
- package/dist/routes/sites.js.map +1 -1
- package/dist/routes/threads.js +276 -9
- package/dist/routes/threads.js.map +1 -1
- package/dist/serverless.js +41 -6
- package/dist/serverless.js.map +1 -1
- package/dist/studioReviewers.js +67 -0
- package/dist/studioReviewers.js.map +1 -0
- package/dist/vendor/adapters/outbound/sanitise.js +18 -3
- package/dist/vendor/types/brief.js +121 -0
- package/package.json +1 -1
- package/static/dashboard/assets/CompositeItem-DnLNS57f.js +1 -0
- package/static/dashboard/assets/ConfirmDialog-CCAJDc_P.js +1 -0
- package/static/dashboard/assets/CopyButton-exuJDdXj.js +1 -0
- package/static/dashboard/assets/FieldItemContext-jf0Is3j7.js +1 -0
- package/static/dashboard/assets/InstallTag-CkeGLk1a.js +1 -0
- package/static/dashboard/assets/SaveState-BsrfwjoH.js +6 -0
- package/static/dashboard/assets/_app-CiDKmy_a.js +1 -0
- package/static/dashboard/assets/_app-xxJ7UG34.js +56 -0
- package/static/dashboard/assets/activity-mwHb7ir7.js +1 -0
- package/static/dashboard/assets/arrow-left-D08BSlJU.js +6 -0
- package/static/dashboard/assets/avatar-BITl2vTh.js +1 -0
- package/static/dashboard/assets/badge-CGEswzew.js +1 -0
- package/static/dashboard/assets/card-8T0wnIiU.js +1 -0
- package/static/dashboard/assets/check-CiLHTeII.js +6 -0
- package/static/dashboard/assets/chevron-right-BokKbPOn.js +6 -0
- package/static/dashboard/assets/copy-CKgsZbj1.js +6 -0
- package/static/dashboard/assets/createBaseUIEventDetails-CEmaecLi.js +1 -0
- package/static/dashboard/assets/createLucideIcon-llnWWh0E.js +36 -0
- package/static/dashboard/assets/dialog-DrrnCoT5.js +6 -0
- package/static/dashboard/assets/dropdown-menu-DIE2xmL5.js +11 -0
- package/static/dashboard/assets/image-off-CgUC8krg.js +6 -0
- package/static/dashboard/assets/index-BRTBtV91.css +1 -0
- package/static/dashboard/assets/index-C87aqO18.js +129 -0
- package/static/dashboard/assets/label-BfMHjFA7.js +1 -0
- package/static/dashboard/assets/labels--UUyt9uB.js +1 -0
- package/static/dashboard/assets/layout-grid-B7mn7n3K.js +6 -0
- package/static/dashboard/assets/me-D1prnPpY.js +1 -0
- package/static/dashboard/assets/parts-B-HQayFH.js +1 -0
- package/static/dashboard/assets/plus-CuMhvZUZ.js +6 -0
- package/static/dashboard/assets/s._site-Ccc7pzT-.js +1 -0
- package/static/dashboard/assets/s._site.comments-nJZLYDQh.js +39 -0
- package/static/dashboard/assets/s._site.reviewers-BmRPiC0a.js +1 -0
- package/static/dashboard/assets/s._site.settings-DNv5ovrJ.js +1 -0
- package/static/dashboard/assets/setup-B_VsIyK2.js +1 -0
- package/static/dashboard/assets/sign-in-sWUNd3Lp.js +1 -0
- package/static/dashboard/assets/sites-CSzUAHV6.js +1 -0
- package/static/dashboard/assets/studio-DVFn025O.js +1 -0
- package/static/dashboard/assets/studio-DzBapfQK.js +1 -0
- package/static/dashboard/assets/studio.index-Cp7lBb8S.js +1 -0
- package/static/dashboard/assets/studio.integrations-DD2EWaL-.js +1 -0
- package/static/dashboard/assets/studio.members-CVu-eP6p.js +1 -0
- package/static/dashboard/assets/sun-DTI4O-GM.js +16 -0
- package/static/dashboard/assets/table-DkqScFZb.js +1 -0
- package/static/dashboard/assets/update-duXzIzFS.js +1 -0
- package/static/dashboard/assets/useBaseQuery-0OqUJMfc.js +1 -0
- package/static/dashboard/assets/useQuery-COJ09EkU.js +1 -0
- package/static/dashboard/assets/useRender-dtgBGlgC.js +1 -0
- package/static/dashboard/assets/users-O11swHBQ.js +6 -0
- package/static/dashboard/assets/welcome-CT6oH0I8.js +11 -0
- package/static/dashboard/assets/you-_yIPqa_9.js +1 -0
- package/static/dashboard/assets/zod-iC-UhR5u.js +1 -0
- package/static/dashboard/index.html +17 -2
- package/static/widget/snag.capture.js +1 -1
- package/static/widget/snag.dock.js +1 -1
- package/static/widget/snag.panels.js +1 -1
- package/static/widget/snag.runtime.js +2 -2
- package/static/widget/snag.text.js +1 -1
- package/vercel.json +4 -0
- package/static/dashboard/assets/index-CATItBzT.js +0 -1
- package/static/dashboard/assets/index-DsUJ96yc.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as i,W as n,f as X,E as $,U as M,d as V,c as v,i as q,h as z,j as F,e as _}from"./index-C87aqO18.js";import{u as G,f as H,o as Q,e as Z,c as ee,n as te}from"./createBaseUIEventDetails-CEmaecLi.js";const ne={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},re={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},ae={disabled:!1,...re},se={valid(t){return t===null?null:t?{"data-valid":""}:{"data-invalid":""}}},le={invalid:void 0,name:void 0,validityData:{state:ne,errors:[],error:"",value:"",initialValue:null},setValidityData:n,disabled:void 0,setTouched:n,setDirty:n,setFilled:n,setFocused:n,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:ae,registerFieldControl:n,validation:{getValidationProps:(t,e=$)=>e,inputRef:{current:null},registeredInputs:new Map,registerInput:n,getInputControl:()=>null,commit:async()=>{},change:n}},ie=i.createContext(le);function S(t=!0){const e=i.useContext(ie);if(e.setValidityData===n&&!t)throw new Error(X(28));return e}const oe=i.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:n,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function ue(){return i.useContext(oe)}const de=i.createContext({controlId:void 0,registerControlId:n,labelId:void 0,setLabelId:n,messageIds:[],setMessageIds:n,getDescriptionProps:t=>t});function A(){return i.useContext(de)}function ce(t={}){const{id:e,implicit:l=!1,controlRef:p}=t,{controlId:b,registerControlId:o}=A(),s=G(e),r=l?b:void 0,u=M(()=>Symbol()),m=i.useRef(!1),g=i.useRef(e!=null),d=V(()=>{!m.current||o===n||(m.current=!1,o(u.current,void 0))});return v(()=>{if(o===n)return;let f;if(l){const E=p?.current;q(E)&&E.closest("label")!=null?f=e??null:f=r??s}else if(e!=null)g.current=!0,f=e;else if(g.current)f=s;else{d();return}if(f===void 0){d();return}m.current=!0,o(u.current,f)},[e,p,r,o,l,s,u,d]),i.useEffect(()=>d,[d]),b??s}function fe(t,e,l,p,b=!0,o){const{registerFieldControl:s}=S(),r=M(()=>Symbol());v(()=>{const u=r.current;if(!b){s(u,void 0);return}s(u,{controlRef:t,getValue:p,id:e,name:o,value:l})},[t,b,p,e,o,s,r,l]),v(()=>{const u=r.current;return()=>{s(u,void 0)}},[s,r])}const pe=i.forwardRef(function(e,l){const{render:p,className:b,id:o,name:s,value:r,disabled:u=!1,onValueChange:m,defaultValue:g,autoFocus:d=!1,style:f,...E}=e,{state:P,name:U,disabled:O,setTouched:h,setDirty:N,validityData:k,setFocused:I,setFilled:x,validationMode:j,validation:c}=S(),{clearErrors:B}=ue(),C=O||u,y=U??s,W={...P,disabled:C},{labelId:Y}=A(),D=ce({id:o});v(()=>{const a=r!=null;c.inputRef.current?.value||a&&r!==""?x(!0):a&&r===""&&x(!1)},[c.inputRef,x,r]);const T=i.useRef(null);v(()=>{d&&T.current===H(Q(T.current))&&I(!0)},[d,I]);const[J]=Z({controlled:r,default:g,name:"FieldControl",state:"value"}),L=r!==void 0,w=L?J:void 0,K=V(()=>c.inputRef.current?.value);return fe(c.inputRef,D,w,K,!C,s),z("input",e,{ref:[l,T],state:W,props:[{id:D,disabled:C,name:y,ref:c.inputRef,"aria-labelledby":Y,autoFocus:d,...L?{value:w}:{defaultValue:g},onChange(a){const R=a.currentTarget.value;m?.(R,ee(te,a.nativeEvent)),N(R!==(k.initialValue??"")),x(R!==""),a.nativeEvent.defaultPrevented||(B(y),c.change(R))},onFocus(){I(!0)},onBlur(a){h(!0),I(!1),j==="onBlur"&&c.commit(a.currentTarget.value)},onKeyDown(a){a.currentTarget.tagName==="INPUT"&&a.key==="Enter"&&(h(!0),c.commit(a.currentTarget.value))}},E,a=>c.getValidationProps(C,a)],stateAttributesMapping:se})}),be=i.forwardRef(function(e,l){return F.jsx(pe,{ref:l,...e})});function Ee({className:t,type:e,...l}){return F.jsx(be,{type:e,"data-slot":"input",className:_("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...l})}function Ie({className:t,...e}){return F.jsx("label",{"data-slot":"label",className:_("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...e})}export{Ee as I,Ie as L,S as a,A as b,fe as c,ce as d,se as f,ue as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const s=["open","progress","review","resolved"],n={open:"Open",progress:"In progress",review:"In review",resolved:"Resolved"},o={open:"bg-status-open text-white",progress:"bg-status-progress text-[#16161a]",review:"bg-status-review text-white",resolved:"bg-status-resolved text-[#16161a]"};function a(t){return s.includes(t)}function i(t,r=Date.now()){if(!t)return"";const e=Math.max(0,(r-new Date(t).getTime())/1e3);return e<60?"now":e<3600?`${Math.floor(e/60)} min`:e<86400?`${Math.floor(e/3600)} h`:e<86400*30?`${Math.floor(e/86400)} d`:new Date(t).toLocaleDateString(void 0,{day:"numeric",month:"short"})}function u(t,r=""){const e=t.trim().split(/\s+/).filter(Boolean);return e.length>=2?(e[0][0]+e[e.length-1][0]).toUpperCase():e.length===1&&e[0].length>0?e[0].slice(0,2).toUpperCase():(r[0]??"?").toUpperCase()}export{n as S,u as a,i as b,s as c,o as d,a as i};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as t}from"./createLucideIcon-llnWWh0E.js";/**
|
|
2
|
+
* @license lucide-react v1.39.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const e=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],i=t("layout-grid",e);export{i as L};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as r,Q as u,d as s}from"./useBaseQuery-0OqUJMfc.js";import{x as t}from"./index-C87aqO18.js";function a(e,o){return r({...e,enabled:!0,suspense:!0,throwOnError:s,placeholderData:void 0},u)}function i(){return a(t.me()).data}export{i as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,e as r}from"./index-C87aqO18.js";import{C as x}from"./card-8T0wnIiU.js";import{S as m,d as l,i as d}from"./labels--UUyt9uB.js";function p({title:t,sub:s,actions:a}){return e.jsxs("div",{className:"mb-5 flex items-center gap-3",children:[e.jsx("h1",{className:"m-0 text-xl font-semibold tracking-tight",children:t}),s&&e.jsx("p",{className:"m-0 text-muted-foreground",children:s}),e.jsx("div",{className:"flex-1"}),a]})}function u({title:t,description:s,children:a,danger:n,cardClassName:i}){return e.jsxs("section",{className:"grid max-w-[1040px] grid-cols-1 gap-4 lg:grid-cols-[minmax(220px,1fr)_2fr] lg:gap-8",children:[e.jsxs("div",{children:[e.jsx("h2",{className:r("m-0 mb-1.5 text-[15.5px] font-semibold tracking-tight",n&&"text-destructive"),children:t}),s&&e.jsx("p",{className:"m-0 text-[13px] leading-normal text-muted-foreground",children:s})]}),e.jsx(x,{className:r("flex max-w-[640px] flex-col gap-4 p-5",n&&"border-destructive",i),children:a})]})}function g({icon:t,title:s,children:a,action:n,className:i}){return e.jsxs("div",{className:r("flex flex-col items-center gap-2 px-6 py-16 text-center",i),children:[t&&e.jsx("div",{className:"mb-1.5 flex size-11 items-center justify-center rounded-[10px] bg-muted text-ink-soft",children:t}),e.jsx("h3",{className:"m-0 text-[15px] font-semibold",children:s}),a&&e.jsx("div",{className:"m-0 max-w-[360px] text-muted-foreground",children:a}),n&&e.jsx("div",{className:"mt-2",children:n})]})}function j({status:t,className:s}){const a=d(t);return e.jsx("span",{className:r("inline-flex h-5 items-center whitespace-nowrap rounded-full px-2 text-[11.5px] font-medium leading-none",a?l[t]:"bg-muted text-muted-foreground",s),children:a?m[t]:t})}function h({children:t}){return e.jsx("div",{className:"text-[11.5px] font-medium uppercase tracking-wide text-muted-foreground",children:t})}export{g as E,p as P,j as S,u as a,h as b};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as e}from"./createLucideIcon-llnWWh0E.js";/**
|
|
2
|
+
* @license lucide-react v1.39.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const o=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],c=e("plus",o);export{c as P};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,O as o}from"./index-C87aqO18.js";const n=()=>t.jsx(o,{});export{n as component};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import{j as e,e as C,r as g,f as As,U as Ms,V as Rs,c as Ke,W as Ge,X as Ds,m as zs,E as Is,h as es,Y as Es,g as Ps,Z as ss,$ as Ts,T as He,B as R,Q as ts,A as Bs,a0 as Je,n as _s,a1 as Qe,a2 as Fs,a3 as Os,a4 as Ls,a5 as Vs,a6 as qs,a7 as Us,L as ns,z as Ws,_ as Xe,C as ie,a8 as Ks,x as he}from"./index-C87aqO18.js";import{u as le}from"./useQuery-COJ09EkU.js";import{C as as}from"./check-CiLHTeII.js";import{u as Ze,e as Gs,c as Hs,n as Js}from"./createBaseUIEventDetails-CEmaecLi.js";import{L as Qs,M as Xs,N as Zs,A as Ys,O as et,X as st,E as rs,G as os,I as is,H as ls,J as ds,K as cs}from"./dialog-DrrnCoT5.js";import{f as tt,u as nt,a as at,b as rt,c as ot,L as Te,I as je}from"./label-BfMHjFA7.js";import{u as it,a as lt}from"./FieldItemContext-jf0Is3j7.js";import{u as dt}from"./CompositeItem-DnLNS57f.js";import{E as Ye,D as Y,i as ee,j as se,o as Be,p as X,k as ce,m as G,l as _e,n as us,S as ct}from"./dropdown-menu-DIE2xmL5.js";import{A as te,a as ne}from"./avatar-BITl2vTh.js";import{b as Fe,S as ms,E as Ee}from"./parts-B-HQayFH.js";import{S as ae,i as ut,a as ue,b as ve,c as fe}from"./labels--UUyt9uB.js";import{C as mt}from"./copy-CKgsZbj1.js";import{I as xt}from"./image-off-CgUC8krg.js";import{c as Z}from"./createLucideIcon-llnWWh0E.js";import{C as pt}from"./chevron-right-BokKbPOn.js";import{I as ht}from"./InstallTag-CkeGLk1a.js";import{u as ft}from"./me-D1prnPpY.js";import{A as gt}from"./arrow-left-D08BSlJU.js";import"./useBaseQuery-0OqUJMfc.js";import"./card-8T0wnIiU.js";/**
|
|
2
|
+
* @license lucide-react v1.39.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const bt=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ge=Z("chevron-down",bt);/**
|
|
7
|
+
* @license lucide-react v1.39.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const jt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],vt=Z("columns-2",jt);/**
|
|
12
|
+
* @license lucide-react v1.39.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const kt=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],yt=Z("inbox",kt);/**
|
|
17
|
+
* @license lucide-react v1.39.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const Nt=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],wt=Z("list",Nt);/**
|
|
22
|
+
* @license lucide-react v1.39.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const Ct=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],St=Z("rotate-cw",Ct);/**
|
|
27
|
+
* @license lucide-react v1.39.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const $t=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],At=Z("user-plus",$t);/**
|
|
32
|
+
* @license lucide-react v1.39.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const Mt=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],Rt=Z("user-round",Mt);function de({className:s,...t}){return e.jsx("div",{"data-slot":"skeleton",className:C("animate-pulse rounded-md bg-muted",s),...t})}function Dt(s){if(!s)return null;for(const t of s.elements){const a=t.tagName;if(a==="BUTTON"||a==="INPUT"){const c=t;if(c.type==="submit")return c}}return null}function xs(s){return{checked(t){return s.indeterminate?{}:t?{"data-checked":""}:{"data-unchecked":""}},...tt}}const zt=g.createContext(void 0);function It(){return g.useContext(zt)}const ps=g.createContext(void 0);function Et(){const s=g.useContext(ps);if(s===void 0)throw new Error(As(14));return s}const Pt="data-parent",Tt=g.forwardRef(function(t,a){const{checked:c,className:x,defaultChecked:o=!1,"aria-labelledby":l,disabled:k=!1,form:d,id:h,indeterminate:y=!1,inputRef:i,name:f,onCheckedChange:v,parent:r=!1,readOnly:S=!1,render:F,required:$=!1,uncheckedValue:I,value:N,nativeButton:E=!1,style:B,...D}=t,{clearErrors:u}=nt(),{disabled:w,name:p,setDirty:O,setFilled:P,setFocused:_,setTouched:ke,state:A,validationMode:ye,validityData:Ne,validation:we}=at(),Ce=it(),{labelId:W,controlId:Se,registerControlId:n,getDescriptionProps:m}=rt(),j=It(),T=j?.allValues===void 0?void 0:j.parent,L=T!==void 0,M=w||Ce.disabled||j?.disabled||k,q=p??f,z=N??q,Le=Ze(),Ve=Ze();let K=h||Se;L&&(r?K=Ve:z!==void 0?K=`${T.id}-${z}`:K||=Ve);let $e={};L&&(r?$e=T.getParentProps():z!==void 0&&($e=T.getChildProps(z)));const{checked:qe=c,indeterminate:fs=y,onCheckedChange:gs,...bs}=$e,Ae=j?.value,me=g.useRef(null),xe=Ms(()=>Symbol()),Me=g.useRef(!1),{getButtonProps:js,buttonRef:vs}=Rs({disabled:M,native:E}),re=j?.validation??we,[V,ks]=Gs({controlled:z!==void 0&&Ae!==void 0&&!r?Ae.includes(z):qe,default:o,name:"Checkbox",state:"checked"}),Re=L?!!qe:V,oe=L&&fs||y;Ke(()=>{n!==Ge&&(Me.current=!0,n(xe.current,K))},[K,n,xe]),g.useEffect(()=>{const b=xe.current;return()=>{!Me.current||n===Ge||(Me.current=!1,n(b,void 0))}},[n,xe]),ot(me,Le,V,void 0,!j&&!M,f);const H=g.useRef(null),Ue=re.registerInput,We=j?z:void 0,ys=g.useCallback(b=>Ue(b,{controlRef:me,value:We}),[Ue,We]),Ns=Ds(i,H,r?void 0:ys),ws=lt(l,W,H,!E,K??void 0);Ke(()=>{H.current&&(H.current.indeterminate=oe,V&&P(!0))},[V,oe,P]),dt(V,()=>{j||(u(q),P(V),O(V!==Ne.initialValue),re.change(V))});const Cs=zs({checked:V,disabled:M,form:d,name:r?void 0:q,id:E?void 0:K??void 0,required:$,ref:Ns,style:q?Qs:Xs,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(b){if(b.nativeEvent.defaultPrevented)return;if(S){b.preventDefault();return}const U=b.currentTarget.checked,J=Hs(Js,b.nativeEvent);if(v?.(U,J),!J.isCanceled&&(gs?.(U,J),!J.isCanceled&&(ks(U),z!==void 0&&j!==void 0&&!r&&!L))){const Q=U?[...j.value,z]:j.value.filter(pe=>pe!==z);j.setValue(Q,J)}},onClick(b){b.stopPropagation()},onFocus(){me.current?.focus()}},N!==void 0?{value:(j?V&&N:N)||""}:Is,m,b=>re.getValidationProps(M,b));g.useEffect(()=>{if(!T||z===void 0)return;const b=T.disabledStatesRef.current;return b.set(z,M),()=>{b.delete(z)}},[T,M,z]);const De=g.useMemo(()=>({...A,checked:Re,disabled:M,readOnly:S,required:$,indeterminate:oe}),[A,Re,M,S,$,oe]),Ss=xs(De),$s=es("span",t,{state:De,ref:[vs,me,a],props:[{id:E?K??void 0:Le,role:"checkbox","aria-checked":oe?"mixed":Re,"aria-readonly":S||void 0,"aria-required":$||void 0,"aria-labelledby":ws,[Pt]:r?"":void 0,onFocus(){M||_(!0)},onBlur(){const b=H.current;b&&(ke(!0),_(!1),ye==="onBlur"&&re.commit(j?Ae:b.checked))},onKeyDown(b){if(b.key!=="Enter"||(b.preventBaseUIHandler(),b.defaultPrevented))return;const U=H.current?.form??null,J=b.currentTarget,Q=b.nativeEvent,pe=b.preventDefault,ze=Q.preventDefault;let Ie=!1;b.preventDefault=()=>{Ie=!0,pe.call(b)},Q.preventDefault=()=>{Ie=!0,ze.call(Q)},ze.call(Q),Ps(J).queueMicrotask(()=>{b.preventDefault=pe,Q.preventDefault=ze,Ie||Dt(U)?.click()})},onClick(b){if(S||M)return;b.preventDefault();const U=H.current;U&&Es(U,b)}},D,bs,js,m,b=>re.getValidationProps(M,b)],stateAttributesMapping:Ss});return e.jsxs(ps.Provider,{value:De,children:[$s,!V&&!j&&q&&!r&&I!==void 0&&e.jsx("input",{type:"hidden",form:d,name:q,value:I,disabled:M}),e.jsx("input",{...Cs,suppressHydrationWarning:!0})]})}),Bt=g.forwardRef(function(t,a){const{render:c,className:x,style:o,keepMounted:l=!1,...k}=t,d=Et(),h=d.checked||d.indeterminate,{mounted:y,transitionStatus:i,setMounted:f}=Zs(h),v=g.useRef(null),r={...d,transitionStatus:i};Ys({open:h,ref:v,onComplete(){h||f(!1)}});const F={...xs(d),...et},$=l||y,I=es("span",t,{ref:[a,v],state:r,stateAttributesMapping:F,props:k});return $?I:null});function _t({className:s,...t}){return e.jsx(Tt,{"data-slot":"checkbox",className:C("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 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(Bt,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:e.jsx(as,{})})})}function Ft({className:s,...t}){return e.jsx("textarea",{"data-slot":"textarea",className:C("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",s),...t})}const Ot={open:"Open",progress:"In progress",review:"In review",resolved:"Resolved"};function Lt(s,t,a={}){const c=a.fence??((u,w)=>w),x=a.statusLabel??(u=>Ot[u]??u),o=s.anchor??{},l=s.context??{},k=o.page,d=k?.route??s.route??"/",h=k?.origin??t.origin??"",y=k?.pathname??d,i=h?`${h}${y}`:y,f=typeof o.label=="string"?c("label",o.label):"",v=o.element??o,r=[];r.push(`# ${s.key}${f?` — ${f}`:""}`),r.push(""),r.push(`${t.name} · ${x(s.status)} · left by ${s.createdBy?.name?c("name",s.createdBy.name):"someone"} on ${s.createdAt.slice(0,10)}`+(s.assignee?` · assigned to ${c("name",s.assignee.name)}`:"")),r.push(""),r.push("## Where to look"),r.push(""),r.push(`- Page: ${i}`),h&&r.push(`- Open on the page: ${h}${y}?${ss("t")}=${encodeURIComponent(s.key)}`),f&&r.push(`- Element: ${f}`);const S=typeof o.css=="string"?o.css:typeof v.selector=="string"?v.selector:"";if(S&&r.push(`- Selector: \`${c("selector",S)}\``),typeof o.domid=="string"&&r.push(`- DOM id: \`#${c("selector",o.domid)}\``),typeof v.role=="string"){const u=typeof v.accessibleName=="string"?` “${c("label",v.accessibleName)}”`:"";r.push(`- Role: ${c("label",v.role)}${u}`)}typeof v.testId=="string"&&r.push(`- Test id: ${c("label",v.testId)}`);const F=o.text;F?.exact&&r.push(`- Text: “${c("label",F.exact)}”`),r.push(`- Anchor: ${s.anchorState??"unknown"}`),r.push(""),r.push("## What's wrong"),r.push("");const $=(s.comments??[]).filter(u=>u.body!==null);$.length===0&&r.push("> (no comment — a pin with no words)");for(const u of $){const w=u.author?.name?c("name",u.author.name):"Anonymous";r.push(`> **${w}${u.author?.kind==="agent"?" (agent)":""}** — ${u.createdAt.slice(0,16).replace("T"," ")}`);for(const p of c("body",String(u.body)).split(`
|
|
37
|
+
`))r.push(`> ${p}`);r.push(">")}r[r.length-1]===">"&&r.pop(),r.push(""),r.push("## Environment"),r.push("");const I=l.derived,N=l.viewport;(I?.browser||I?.os)&&r.push(`- Browser: ${[I.browser,I.os,I.device].filter(Boolean).join(" · ")}`),N?.w&&r.push(`- Viewport: ${N.w} × ${N.h}${N.dpr?` @${Math.round(N.dpr*10)/10}x`:""}`),l.prefersColorScheme&&r.push(`- Colour scheme: ${l.prefersColorScheme}`),l.language&&r.push(`- Language: ${l.language}`),l.ua&&r.push(`- User agent: ${c("label",String(l.ua))}`);const E=l.build;E&&Object.keys(E).length&&r.push(`- Build: ${Object.entries(E).map(([u,w])=>`${u}=${c("label",String(w))}`).join(", ")}`),r.push("");const B=l.breadcrumbs;if(B?.length){r.push(`## Breadcrumbs (${B.length}, oldest first)`),r.push("");for(const u of B)r.push(`- \`${String(u.t).slice(11,19)}\` ${u.type}${u.level?`/${u.level}`:""}: ${c("breadcrumb",String(u.message))}`);r.push("")}const D=s.attachments?.find(u=>u.kind==="screenshot")??s.attachments?.[0];if(D){r.push("## Screenshot"),r.push(""),r.push("Examine this screenshot for visual context — it is the viewport at the moment of the click."),r.push("");const u=D.url.startsWith("http")?D.url:`${t.dashboardOrigin??""}${D.url}`;r.push(``),r.push("")}return r.join(`
|
|
38
|
+
`).trimEnd()+`
|
|
39
|
+
`}function Vt(s,t){return Lt(s,t,{statusLabel:a=>ut(a)?ae[a]:a})}function qt({thread:s,site:t,onStatus:a,onReply:c,replying:x,onClose:o,pool:l,onAssign:k,onAddPerson:d,trackers:h,onCreateIssue:y,creatingIssue:i}){const f=s.anchor??{},v=s.context??{},r=typeof f.label=="string"?f.label:"",S=f.page,F=S?.route??s.route??"/",$=S?.origin??t.origin,I=$?`${$}${S?.pathname??F}?${ss("t")}=${encodeURIComponent(s.key)}`:"",N=s.attachments?.find(p=>p.kind==="screenshot")??s.attachments?.[0],[E,B]=g.useState(""),[D,u]=g.useState(""),w=()=>{navigator.clipboard?.writeText(Vt(s,{name:t.name,...$?{origin:$}:{},dashboardOrigin:location.origin})),ts.success("Copied as a brief")};return e.jsxs("article",{className:"flex min-h-0 flex-col","aria-label":`${s.key} — ${r||"a comment"}`,children:[e.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border/60 px-4 py-2.5",children:[e.jsx("span",{className:"font-mono text-[12px] text-muted-foreground",children:s.key}),e.jsx(Ut,{status:s.status,onStatus:a}),e.jsx(Jt,{assignee:s.assignee??null,pool:l,onAssign:k,onAddPerson:d}),(h??[]).map(p=>{const O=s.refs?.find(P=>P.provider===p&&P.kind===Ts[p]&&P.status!=="detached");if(O){const P=p==="github"?`Issue #${O.externalId}`:p==="jira"?O.externalId:p==="slack"?"Slack message":/\/issue\/([A-Z][A-Z0-9]*-\d+)/.exec(O.url)?.[1]??`${He[p]} issue`;return e.jsxs(R,{variant:"ghost",size:"sm",render:e.jsx("a",{href:O.url,target:"_blank",rel:"noreferrer"}),children:[e.jsx(Ye,{}),P]},p)}return y?e.jsx(R,{variant:"ghost",size:"sm",disabled:!!i,onClick:()=>y(p),children:i===p?p==="slack"?"Posting…":"Creating…":p==="slack"?"Post to Slack":`Create ${He[p]} issue`},p):null}),e.jsx("div",{className:"flex-1"}),e.jsxs(R,{variant:"ghost",size:"sm",onClick:w,children:[e.jsx(mt,{}),"Copy as brief"]}),e.jsx(R,{variant:"ghost",size:"icon-sm","aria-label":"Close",onClick:o,children:e.jsx(st,{})})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-5 overflow-auto px-4 py-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[16px] font-semibold leading-snug tracking-tight",children:r||"A comment on this page"}),e.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-[12.5px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:F}),$&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("a",{href:`${$}${S?.pathname??F}`,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-brand hover:underline",children:[$.replace(/^https?:\/\//,""),e.jsx(Ye,{className:"size-3"})]})]}),I&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("a",{href:I,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:"Open on the page"})]})]})]}),e.jsxs("section",{className:"flex flex-col gap-3",children:[s.comments.length===0&&e.jsx("p",{className:"m-0 text-muted-foreground",children:"A pin with no words — the element says what it is about."}),s.comments.map(p=>e.jsxs("div",{className:"flex gap-2.5",children:[e.jsx(te,{className:"size-6 shrink-0",children:e.jsx(ne,{className:C("text-[10px] font-semibold",p.author.kind==="agent"?"bg-muted text-ink-soft":"bg-brand-soft text-brand"),children:ue(p.author.name,"?")})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-baseline gap-2 text-[12px] text-muted-foreground",children:[e.jsx("b",{className:"text-[13px] font-semibold text-foreground",children:p.author.name||"Anonymous"}),p.author.kind==="agent"&&e.jsx("span",{className:"rounded-sm bg-muted px-1 text-[10.5px] font-medium uppercase tracking-wide",children:"agent"}),e.jsx("span",{children:ve(p.createdAt)})]}),e.jsx("p",{className:"m-0 whitespace-pre-wrap text-[13.5px] leading-normal",children:p.body??e.jsx("i",{className:"text-muted-foreground",children:"deleted"})})]})]},p.id)),e.jsxs("form",{className:"flex gap-2.5",onSubmit:async p=>{p.preventDefault();const O=E.trim();if(!(!O||x)){u("");try{await c(O),B("")}catch(P){u(P instanceof Error?P.message:"Could not send that reply.")}}},children:[e.jsx(te,{className:"size-6 shrink-0",children:e.jsx(ne,{className:"bg-primary text-[10px] font-semibold text-primary-foreground",children:"you"})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2 rounded-md border border-input bg-card p-2",children:[e.jsx(Ft,{"aria-label":"Reply",placeholder:`Reply to ${s.createdBy.name||"the reviewer"}…`,value:E,onChange:p=>B(p.target.value),rows:2,className:"min-h-0 resize-none border-0 bg-transparent p-1 shadow-none focus-visible:ring-0"}),D&&e.jsx("p",{role:"alert",className:"m-0 text-[12px] text-destructive",children:D}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.status==="resolved"?e.jsx(R,{type:"button",variant:"ghost",size:"sm",onClick:()=>a("open"),children:"Reopen"}):e.jsxs(e.Fragment,{children:[s.status!=="review"&&e.jsx(R,{type:"button",variant:"ghost",size:"sm",onClick:()=>a("review"),children:"Mark in review"}),e.jsx(R,{type:"button",variant:"ghost",size:"sm",onClick:()=>a("resolved"),children:"Mark resolved"})]}),e.jsx(R,{type:"submit",size:"sm",disabled:!E.trim()||x,children:x?"Sending…":"Reply"})]})]})]})]}),e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx(Fe,{children:"Screenshot"}),N?e.jsxs(e.Fragment,{children:[e.jsx("a",{href:N.url,target:"_blank",rel:"noreferrer",className:"block overflow-hidden rounded-lg border border-border bg-background",children:e.jsx("img",{src:N.url,alt:`The page when ${s.key} was left`,width:N.width,height:N.height,loading:"lazy",className:"block h-auto w-full"})}),e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:[N.width??"?"," × ",N.height??"?",v.prefersColorScheme?` · ${v.prefersColorScheme}`:""," · taken at the click, ",ve(s.createdAt)," ·"," ",e.jsx("a",{href:N.url,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:"open full size"})]})]}):e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-dashed border-border px-3 py-3 text-[12.5px] text-muted-foreground",children:[e.jsx(xt,{className:"size-4 shrink-0"}),e.jsx("span",{children:"No screenshot for this one — either no bucket was connected when it was left, or the reviewer turned the picture off. The element and the environment below are unaffected."})]}),e.jsx(Kt,{ctx:v})]}),e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx(Fe,{children:"Element"}),e.jsxs("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:[r&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Label"}),e.jsx("dd",{className:"m-0",children:r})]}),typeof f.css=="string"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Selector"}),e.jsx("dd",{className:"m-0 break-all font-mono text-[12px] text-ink-soft",children:f.css})]}),typeof f.domid=="string"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"DOM id"}),e.jsxs("dd",{className:"m-0 font-mono text-[12px] text-ink-soft",children:["#",f.domid]})]}),typeof f.role=="string"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Role"}),e.jsxs("dd",{className:"m-0",children:[f.role,typeof f.accessibleName=="string"?` “${f.accessibleName}”`:""]})]}),f.text?.exact&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Text"}),e.jsxs("dd",{className:"m-0",children:["“",String(f.text.exact),"”"]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Anchor"}),e.jsx("dd",{className:"m-0",children:e.jsx(Wt,{state:s.anchorState})})]})]}),e.jsx(Gt,{ctx:v}),e.jsx(Ht,{ctx:v})]})]})}function Ut({status:s,onStatus:t}){return e.jsxs(Y,{children:[e.jsx(ee,{render:e.jsx("button",{type:"button",className:"inline-flex items-center rounded-full","aria-label":"Status"}),children:e.jsx(ms,{status:s})}),e.jsx(se,{align:"start",className:"w-[180px]",children:e.jsx(Be,{value:s,onValueChange:a=>t(a),children:fe.map(a=>e.jsx(X,{value:a,children:ae[a]},a))})})]})}function Wt({state:s}){const t=s==="anchored"?"bg-ok-soft text-ok":s==="approximate"?"bg-muted text-ink-soft":"bg-warn-soft text-destructive",a=s==="anchored"?"Anchored":s==="approximate"?"Approximate":s==="orphaned"?"Orphaned":s;return e.jsx("span",{className:C("rounded-full px-2 py-0.5 text-[11.5px] font-medium",t),children:a})}function Kt({ctx:s}){const t=s.capture;if(!t)return null;const a=[];return t.screenshot&&t.screenshot!=="ok"&&a.push(`Screenshot ${t.screenshot}${t.reasons?.length?` — ${t.reasons.join("; ")}`:""}`),t.breadcrumbs&&t.breadcrumbs!=="ok"&&a.push(`Breadcrumbs ${t.breadcrumbs}`),t.blindSpots?.length&&a.push(`${t.blindSpots.length} blind spot${t.blindSpots.length===1?"":"s"}: ${t.blindSpots.join("; ")}`),t.droppedCategories?.length&&a.push(`Dropped: ${t.droppedCategories.join(", ")}`),a.length?e.jsx("ul",{className:"m-0 list-none p-0 text-[12px] text-caution",children:a.map(c=>e.jsx("li",{children:c},c))}):null}function Gt({ctx:s}){const t=s.derived,a=s.viewport,c=s.build,x=[];return t?.browser||t?.os?x.push(["Browser",[t.browser,t.os,t.device].filter(Boolean).join(" · ")]):s.ua&&x.push(["User agent",String(s.ua)]),a?.w&&x.push(["Viewport",`${a.w} × ${a.h}${a.dpr?` @${Math.round(a.dpr*10)/10}x`:""}`]),s.language&&x.push(["Language",String(s.language)]),c&&Object.keys(c).length&&x.push(["Build",Object.entries(c).map(([o,l])=>`${o} ${String(l)}`).join(" · ")]),x.length?e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fe,{children:"Environment"}),e.jsx("button",{type:"button",className:"text-[11.5px] text-brand hover:underline",onClick:()=>{navigator.clipboard?.writeText(JSON.stringify(s,null,2)),ts.success("Copied the environment")},children:"copy as JSON"})]}),e.jsx("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:x.map(([o,l])=>e.jsxs("span",{className:"contents",children:[e.jsx("dt",{className:"text-muted-foreground",children:o}),e.jsx("dd",{className:C("m-0",o==="Build"&&"font-mono text-[12px] text-ink-soft"),children:l})]},o))})]}):null}function Ht({ctx:s}){const t=s.breadcrumbs,[a,c]=g.useState(!1);if(!t?.length)return null;const x=t.filter(o=>o.level==="error"||o.type==="error").length;return e.jsxs("section",{className:"flex flex-col gap-2",children:[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":a,onClick:()=>c(!a),children:[e.jsx(pt,{className:C("size-3.5 text-muted-foreground transition-transform",a&&"rotate-90")}),t.length," breadcrumb",t.length===1?"":"s",x>0?` · ${x} error${x===1?"":"s"} before the click`:"",e.jsx("span",{className:"ml-auto text-[12px] text-muted-foreground",children:a?"hide":"show"})]}),a&&e.jsx("ol",{className:"m-0 flex list-none flex-col gap-1 p-0 font-mono text-[11.5px]",children:t.map((o,l)=>e.jsxs("li",{className:C("flex gap-2",(o.level==="error"||o.type==="error")&&"text-destructive"),children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:o.t.slice(11,19)}),e.jsxs("span",{className:"shrink-0 w-14 text-muted-foreground",children:[o.type,o.level?`/${o.level}`:""]}),e.jsx("span",{className:"min-w-0 break-words",children:o.message})]},l))})]})}function Jt({assignee:s,pool:t,onAssign:a,onAddPerson:c}){const[x,o]=g.useState(!1),l=t.find(i=>i.isMe),k=t.filter(i=>i.isTeam),d=t.filter(i=>!i.isTeam),h=i=>a({id:i.id,name:i.name,kind:i.kind,isTeam:i.isTeam}),y=i=>e.jsxs(G,{onClick:()=>h(i),children:[e.jsx(te,{className:"size-4",children:e.jsx(ne,{className:C("text-[8px] font-semibold",i.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ue(i.name,i.email)})}),e.jsx("span",{className:"truncate",children:i.isMe?`${i.name} (you)`:i.name}),s?.id===i.id&&e.jsx(as,{className:"ml-auto size-3.5"})]},i.id);return e.jsxs(e.Fragment,{children:[e.jsxs(Y,{children:[e.jsx(ee,{render:e.jsx(R,{variant:"ghost",size:"sm","aria-label":s?`Assignee: ${s.name}`:"Assignee"}),children:s?e.jsxs(e.Fragment,{children:[e.jsx(te,{className:"size-4",children:e.jsx(ne,{className:C("text-[8px] font-semibold",s.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ue(s.name)})}),e.jsx("span",{className:"max-w-[150px] truncate",children:s.name})]}):e.jsxs(e.Fragment,{children:[e.jsx(Rt,{}),"Assign"]})}),e.jsxs(se,{align:"start",className:"min-w-56",children:[l&&s?.id!==l.id||s?e.jsxs(ce,{children:[l&&s?.id!==l.id&&e.jsx(G,{onClick:()=>h(l),children:"Assign to me"}),s&&e.jsx(G,{onClick:()=>a(null),children:"Unassign"})]}):null,k.length>0&&e.jsxs(ce,{children:[e.jsx(_e,{children:"The studio"}),k.map(y)]}),d.length>0&&e.jsxs(ce,{children:[e.jsx(_e,{children:"People who commented"}),d.map(y)]}),e.jsx(us,{}),e.jsx(ce,{children:e.jsxs(G,{onClick:()=>o(!0),children:[e.jsx(At,{}),"Add a person…"]})})]})]}),e.jsx(Qt,{open:x,onOpenChange:o,onAdd:async i=>{const f=await c(i);h(f)}})]})}function Qt({open:s,onOpenChange:t,onAdd:a}){const[c,x]=g.useState(""),[o,l]=g.useState(""),[k,d]=g.useState(!1),[h,y]=g.useState(""),i=async f=>{if(f.preventDefault(),!(!c.trim()||k)){d(!0),y("");try{await a({name:c.trim(),...o.trim()?{email:o.trim()}:{}}),x(""),l(""),t(!1)}catch(v){y(v instanceof Bs?v.message:"Could not add the person.")}finally{d(!1)}}};return e.jsx(rs,{open:s,onOpenChange:t,children:e.jsx(os,{children:e.jsxs("form",{onSubmit:f=>void i(f),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(is,{children:[e.jsx(ls,{children:"Add a person"}),e.jsx(ds,{children:"Somebody to assign comments to who has not commented yet — your client, before they have said anything. If they later open a review link with this email, their comments join up."})]}),h&&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:h}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Te,{htmlFor:"person-name",children:"Name"}),e.jsx(je,{id:"person-name",placeholder:"Sofia",value:c,onChange:f=>x(f.target.value),autoFocus:!0})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Te,{htmlFor:"person-email",children:"Email (optional)"}),e.jsx(je,{id:"person-email",type:"email",placeholder:"sofia@acme.com",value:o,onChange:f=>l(f.target.value)})]}),e.jsxs(cs,{children:[e.jsx(R,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),e.jsx(R,{type:"submit",disabled:!c.trim()||k,children:k?"Adding…":"Add and assign"})]})]})})})}function Xt({rounds:s,active:t,onPick:a,onStart:c,starting:x}){const o=s.find(i=>i.number===t),l=(s[0]?.number??0)+1,[k,d]=g.useState(!1),[h,y]=g.useState("");return e.jsxs(e.Fragment,{children:[e.jsxs(Y,{children:[e.jsxs(ee,{render:e.jsx("button",{type:"button",className:"inline-flex h-7 items-center gap-1.5 rounded-md border border-line-strong bg-muted px-2.5 text-[12.5px] font-semibold text-foreground","aria-label":"Round"}),children:[e.jsx(St,{className:"size-3.5"}),o?.name??`Round ${t}`,e.jsx(ge,{className:"size-3 text-muted-foreground"})]}),e.jsxs(se,{align:"start",className:"w-[260px]",children:[e.jsxs(ce,{children:[e.jsx(_e,{children:"Rounds"}),s.map(i=>e.jsxs(G,{onClick:()=>a(i.number),children:[e.jsx("span",{className:"truncate",children:i.name}),e.jsxs("span",{className:"ml-auto text-[11.5px] text-muted-foreground",children:[i.closed?"closed":"open",i.unresolved>0?` · ${i.unresolved} to go`:""]})]},i.id))]}),e.jsx(us,{}),e.jsxs(G,{onClick:()=>{y(`Round ${l}`),d(!0)},children:["Start a new round…",e.jsx("span",{className:"ml-auto text-[11.5px] text-muted-foreground",children:"closes this one"})]})]})]}),o&&e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[o.closed?"closed":"open",o.unresolved>0?` · ${o.unresolved} to go`:o.closed?"":" · all clear"]}),e.jsx(rs,{open:k,onOpenChange:d,children:e.jsx(os,{children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:i=>{i.preventDefault(),!(!h.trim()||x)&&(c(h.trim()),d(!1))},children:[e.jsxs(is,{children:[e.jsx(ls,{children:"Start a new round"}),e.jsxs(ds,{children:["A round is one pass of feedback. Starting the next one closes ",o?.name??"the current one","; what is still open there stays counted, not carried over."]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Te,{htmlFor:"round-name",children:"Name"}),e.jsx(je,{id:"round-name",value:h,onChange:i=>y(i.target.value),autoFocus:!0})]}),e.jsxs(cs,{children:[e.jsx(R,{type:"button",variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e.jsx(R,{type:"submit",disabled:!h.trim()||x,children:x?"Starting…":"Start the round"})]})]})})})]})}Ws({thread:ie().optional(),status:ie().optional(),page:ie().optional(),q:ie().optional(),sort:Xe(["newest","oldest"]).optional(),round:Ks().int().positive().optional(),assignee:ie().optional(),view:Xe(["board"]).optional()});const hs={open:"bg-status-open",progress:"bg-status-progress",review:"bg-status-review",resolved:"bg-status-resolved"};function Cn(){const{site:s}=Je.useParams(),t=Je.useSearch(),a=_s(),x=ft().projects.find(n=>n.uid===s),o=le(he.origins(s)),l=le(he.rounds(s)),k=le(he.assignees(s)),d=le(he.siteIntegrations(s)),h=k.data?.data??[],y=h.find(n=>n.isMe)?.id,i=t.round??l.data?.data[0]?.number,f=g.useMemo(()=>({...i!==void 0?{round:i}:{},...t.page?{route:t.page}:{},...t.q?{q:t.q}:{}}),[i,t.page,t.q]),v=le({...Qe(s,f),enabled:l.isSuccess}),r=Qe(s,f).queryKey,S=Fs(s,r),F=Os(r),$=Ls(s,r),I=Vs(s),N=qs(s,r),E=Us(s),[B,D]=g.useState(new Set),u=n=>void a({to:"/s/$site/comments",params:{site:s},search:m=>({...m,...n}),replace:!0}),w=v.data?.data??[],p=g.useMemo(()=>new Set((t.status??"").split(",").filter(Boolean)),[t.status]),O=g.useMemo(()=>{const n=new Map;for(const m of w)n.set(m.status,(n.get(m.status)??0)+1);return n},[w]),P=g.useMemo(()=>[...new Set(w.map(n=>Oe(n)))].sort(),[w]),_=g.useMemo(()=>{let n=p.size?w.filter(m=>p.has(m.status)):w;return t.assignee==="unassigned"?n=n.filter(m=>!m.assignee):t.assignee==="me"?n=n.filter(m=>!!y&&m.assignee?.id===y):t.assignee&&(n=n.filter(m=>m.assignee?.id===t.assignee)),t.sort==="oldest"&&(n=[...n].reverse()),n},[w,p,t.sort,t.assignee,y]),ke=g.useMemo(()=>{const n=new Map;for(const m of _){const j=Oe(m);n.has(j)||n.set(j,[]),n.get(j).push(m)}return[...n.entries()]},[_]),A=t.thread?w.find(n=>n.key===t.thread)??null:null,ye=p.size>0||!!t.page||!!t.q||!!t.assignee,Ne=(l.data?.data??[]).filter(n=>n.number!==i&&n.unresolved>0),we=n=>{const m=new Set(p);m.has(n)?m.delete(n):m.add(n),u({status:[...m].join(",")||void 0})},Ce=async n=>{const m=[...B];D(new Set);for(const j of m)await S.mutateAsync({id:j,status:n}).catch(()=>{})};g.useEffect(()=>{const n=m=>{if(m.metaKey||m.ctrlKey||m.altKey)return;const j=m.target;if(j&&(j.closest("input,textarea,select,[contenteditable]")||j.isContentEditable))return;const T=m.key.toLowerCase();if(T!=="j"&&T!=="k"&&T!=="e"||_.length===0)return;if(m.preventDefault(),T==="e"){if(!A)return;S.mutate({id:A.id,status:A.status==="resolved"?"open":"resolved"});return}const L=A?_.findIndex(z=>z.id===A.id):-1,M=T==="j"?Math.min(L+1,_.length-1):Math.max(L-1,0),q=_[L===-1?0:M];q&&u({thread:q.key})};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)});const W=t.view==="board",Se=g.useMemo(()=>fe.map(n=>({status:n,items:_.filter(m=>m.status===n)})),[_]);return e.jsxs("div",{className:"flex h-[calc(100dvh-3rem)] min-h-0 flex-col",children:[e.jsx("div",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-border/60 px-4 py-2",children:B.size>0?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-[13px] font-medium",children:[B.size," selected"]}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"Move to"}),fe.map(n=>e.jsx(R,{variant:"outline",size:"sm",onClick:()=>void Ce(n),children:ae[n]},n)),e.jsx(R,{variant:"ghost",size:"sm",onClick:()=>D(new Set),children:"Clear"})]}):e.jsxs(e.Fragment,{children:[l.data&&l.data.data.length>0&&i!==void 0&&e.jsx(Xt,{rounds:l.data.data,active:i,onPick:n=>u({round:n,thread:void 0}),onStart:n=>E.mutate(n,{onSuccess:m=>u({round:m.number,thread:void 0,status:void 0})}),starting:E.isPending}),e.jsx("span",{className:"mx-1 h-[18px] w-px bg-border"}),e.jsxs(Pe,{on:p.size===0,onClick:()=>u({status:void 0}),children:["All ",e.jsx("span",{className:"text-muted-foreground",children:w.length})]}),fe.map(n=>e.jsxs(Pe,{on:p.has(n),onClick:()=>we(n),children:[e.jsx("span",{className:C("size-[7px] rounded-full",hs[n])}),ae[n]," ",e.jsx("span",{className:"text-muted-foreground",children:O.get(n)??0})]},n)),e.jsx("div",{className:"flex-1"}),e.jsxs(Pe,{on:W,onClick:()=>u({view:W?void 0:"board"}),children:[W?e.jsx(wt,{className:"size-3.5"}):e.jsx(vt,{className:"size-3.5"}),W?"List":"Board"]}),e.jsx(Yt,{value:t.q??"",onChange:n=>u({q:n||void 0})}),P.length>1&&e.jsxs(Y,{children:[e.jsxs(ee,{render:e.jsx("button",{type:"button",className:be(!!t.page)}),children:[t.page??"All pages",e.jsx(ge,{className:"size-3 text-muted-foreground"})]}),e.jsxs(se,{align:"end",children:[e.jsx(G,{onClick:()=>u({page:void 0}),children:"All pages"}),P.map(n=>e.jsx(G,{onClick:()=>u({page:n}),children:e.jsx("span",{className:"font-mono text-[12px]",children:n})},n))]})]}),e.jsxs(Y,{children:[e.jsxs(ee,{render:e.jsx("button",{type:"button",className:be(!!t.assignee),"aria-label":"Filter by assignee"}),children:[Zt(t.assignee,h),e.jsx(ge,{className:"size-3 text-muted-foreground"})]}),e.jsx(se,{align:"end",children:e.jsxs(Be,{value:t.assignee??"any",onValueChange:n=>u({assignee:n==="any"?void 0:n}),children:[e.jsx(X,{value:"any",children:"Anyone"}),e.jsx(X,{value:"unassigned",children:"Unassigned"}),y&&e.jsx(X,{value:"me",children:"Me"}),h.filter(n=>!n.isMe).map(n=>e.jsx(X,{value:n.id,children:n.name},n.id))]})})]}),e.jsxs(Y,{children:[e.jsxs(ee,{render:e.jsx("button",{type:"button",className:be(!1)}),children:[t.sort==="oldest"?"Oldest":"Newest",e.jsx(ge,{className:"size-3 text-muted-foreground"})]}),e.jsx(se,{align:"end",children:e.jsxs(Be,{value:t.sort??"newest",onValueChange:n=>u({sort:n==="oldest"?"oldest":void 0}),children:[e.jsx(X,{value:"newest",children:"Newest first"}),e.jsx(X,{value:"oldest",children:"Oldest first"})]})})]})]})}),Ne.map(n=>e.jsxs("button",{type:"button",className:"shrink-0 border-b border-border/60 bg-brand-soft px-4 py-1.5 text-left text-[12.5px] text-foreground",onClick:()=>u({round:n.number,thread:void 0}),children:[e.jsxs("b",{className:"font-semibold",children:[n.unresolved," unresolved"]})," in ",n.name," — still open, not carried over."," ",e.jsx("span",{className:"text-brand",children:"Go there"})]},n.id)),e.jsxs("div",{className:C("grid min-h-0 flex-1",A?"grid-cols-1 lg:grid-cols-[minmax(0,1fr)_520px]":"grid-cols-1"),children:[e.jsxs("div",{className:C("min-h-0 overflow-auto lg:border-r lg:border-border",A&&"hidden lg:block"),children:[v.isPending&&e.jsx(sn,{}),v.isError&&e.jsx(Ee,{title:"Could not load the comments",children:v.error.message}),v.isSuccess&&w.length===0&&!ye&&e.jsx("div",{className:"mx-auto max-w-[560px] py-8",children:e.jsxs(Ee,{icon:e.jsx(yt,{className:"size-5"}),title:"No comments yet",children:[e.jsxs("p",{className:"m-0",children:["When someone leaves a comment on ",x.name," it appears here, grouped by page."]}),e.jsx("div",{className:"mt-4 text-left",children:e.jsx(ht,{uid:s})})]})}),v.isSuccess&&w.length>0&&_.length===0&&e.jsx(Ee,{title:"Nothing matches",action:e.jsx(R,{variant:"outline",size:"sm",onClick:()=>u({status:void 0,page:void 0,q:void 0,assignee:void 0}),children:"Show all"}),children:"No comment matches that filter."}),W&&v.isSuccess&&_.length>0&&e.jsx(tn,{columns:Se,uid:s,selectedId:A?.id??null,onMove:(n,m)=>S.mutate({id:n,status:m})}),!W&&ke.map(([n,m])=>e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-0 z-10 flex items-center gap-2 border-b border-border/60 bg-background px-4 py-2 font-mono text-[12px] text-ink-soft",children:[n," ",e.jsxs("span",{className:"font-sans text-muted-foreground",children:["· ",m.length]})]}),m.map(j=>e.jsx(en,{t:j,uid:s,on:A?.id===j.id,picked:B.has(j.id),picking:B.size>0,onPick:T=>D(L=>{const M=new Set(L);return T?M.add(j.id):M.delete(j.id),M})},j.id))]},n))]}),A&&e.jsxs("div",{className:"min-h-0 overflow-hidden bg-card",children:[e.jsx("div",{className:"lg:hidden",children:e.jsxs(R,{variant:"ghost",size:"sm",className:"m-2",onClick:()=>u({thread:void 0}),children:[e.jsx(gt,{}),"Back to the list"]})}),e.jsx(qt,{thread:A,site:{name:x.name,...o.data?.origins[0]?{origin:o.data.origins[0]}:{}},onStatus:n=>S.mutate({id:A.id,status:n}),onReply:n=>F.mutateAsync({id:A.id,body:n}),replying:F.isPending,pool:h,onAssign:n=>$.mutate({id:A.id,assignee:n}),onAddPerson:n=>I.mutateAsync(n),trackers:(d.data?.data??[]).map(n=>n.provider),onCreateIssue:n=>N.mutate({id:A.id,provider:n}),creatingIssue:N.isPending?N.variables?.provider:void 0,onClose:()=>u({thread:void 0})})]})]})]})}function Zt(s,t){return s?s==="unassigned"?"Unassigned":s==="me"?"Me":t.find(a=>a.id===s)?.name??"Assignee":"Assignee"}function Oe(s){return s.anchor?.page?.route??s.route??"/"}function be(s){return C("inline-flex h-7 items-center gap-1.5 whitespace-nowrap rounded-md border border-border bg-card px-2.5 text-[12.5px] font-medium text-ink-soft",s&&"border-line-strong bg-muted text-foreground")}function Pe({on:s,onClick:t,children:a}){return e.jsx("button",{type:"button",className:be(s),"aria-pressed":s,onClick:t,children:a})}function Yt({value:s,onChange:t}){const[a,c]=g.useState(s);return e.jsxs("form",{className:"relative",onSubmit:x=>{x.preventDefault(),t(a.trim())},children:[e.jsx(ct,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),e.jsx(je,{type:"search","aria-label":"Search comments",placeholder:"Search",value:a,onChange:x=>c(x.target.value),onBlur:()=>a.trim()!==s&&t(a.trim()),className:"h-7 w-[170px] pl-7 text-[12.5px]"})]})}function en({t:s,uid:t,on:a,picked:c,picking:x,onPick:o}){const l=s.comments[0]?.body??(typeof s.anchor?.label=="string"?s.anchor.label:"(no comment)"),k=s.comments[0]?.body&&typeof s.anchor?.label=="string"?s.anchor.label:"";return e.jsxs("div",{className:C("group grid h-12 grid-cols-[22px_56px_minmax(0,1fr)_auto] items-center gap-2.5 border-b border-border/60 bg-card px-4 hover:bg-accent/60",a&&"bg-brand-soft hover:bg-brand-soft"),children:[e.jsx("span",{className:C("flex items-center",!x&&"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),children:e.jsx(_t,{checked:c,onCheckedChange:d=>o(!!d),"aria-label":`Select ${s.key}`})}),e.jsxs(ns,{to:"/s/$site/comments",params:{site:t},search:d=>({...d,thread:s.key}),className:"contents text-foreground",children:[e.jsx("span",{className:"font-mono text-[11.5px] text-muted-foreground",children:s.key}),e.jsxs("span",{className:"truncate text-[13.5px]",children:[l,k&&e.jsx("small",{className:"ml-2 text-[12px] text-muted-foreground",children:k})]}),e.jsxs("span",{className:"flex items-center gap-2.5 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"hidden sm:inline",children:s.createdBy.name||"someone"}),s.assignee&&e.jsx(te,{className:"size-5",title:`Assigned to ${s.assignee.name}`,children:e.jsx(ne,{className:C("text-[9px] font-semibold",s.assignee.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ue(s.assignee.name)})}),e.jsx(ms,{status:s.status}),e.jsx("span",{className:"w-11 whitespace-nowrap text-right",children:ve(s.updatedAt)})]})]})]})}function sn(){return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"flex items-center border-b border-border/60 bg-background px-4 py-2",children:e.jsx(de,{className:"h-3 w-16"})}),[70,55,80,62].map((s,t)=>e.jsxs("div",{className:"grid h-12 grid-cols-[22px_56px_minmax(0,1fr)_auto] items-center gap-2.5 border-b border-border/60 px-4",children:[e.jsx("span",{}),e.jsx(de,{className:"h-3 w-10"}),e.jsx(de,{className:"h-3",style:{width:`${s}%`}}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(de,{className:"h-3 w-11"}),e.jsx(de,{className:"h-[18px] w-16 rounded-full"})]})]},t))]})}function tn({columns:s,uid:t,selectedId:a,onMove:c}){const[x,o]=g.useState(null);return e.jsx("div",{className:"flex h-full min-h-0 gap-3 overflow-x-auto p-3",children:s.map(({status:l,items:k})=>e.jsxs("section",{"aria-label":ae[l],onDragOver:d=>{d.preventDefault(),o(l)},onDragLeave:()=>o(d=>d===l?null:d),onDrop:d=>{d.preventDefault(),o(null);const h=d.dataTransfer.getData("text/plain");h&&c(h,l)},className:C("flex w-[280px] shrink-0 flex-col rounded-lg border border-border bg-muted/40",x===l&&"border-brand bg-brand-soft"),children:[e.jsxs("h3",{className:"m-0 flex items-center gap-2 px-3 py-2 text-[12px] font-medium",children:[e.jsx("span",{className:C("size-[7px] rounded-full",hs[l])}),ae[l],e.jsx("span",{className:"text-muted-foreground",children:k.length})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-auto p-2 pt-0",children:[k.length===0&&e.jsx("p",{className:"m-0 px-1 py-3 text-[12px] text-muted-foreground",children:"Nothing here."}),k.map(d=>e.jsxs(ns,{to:"/s/$site/comments",params:{site:t},search:h=>({...h,thread:d.key}),draggable:!0,onDragStart:h=>{h.dataTransfer.setData("text/plain",d.id),h.dataTransfer.effectAllowed="move"},className:C("flex cursor-grab flex-col gap-1.5 rounded-md border border-border bg-card p-2.5 text-foreground no-underline active:cursor-grabbing",a===d.id&&"border-brand ring-1 ring-brand"),children:[e.jsx("span",{className:"line-clamp-3 text-[13px]",children:d.comments[0]?.body??(typeof d.anchor?.label=="string"?d.anchor.label:"(no comment)")}),e.jsxs("span",{className:"flex items-center gap-2 text-[11.5px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:d.key}),e.jsx("span",{className:"truncate",children:Oe(d)}),e.jsx("span",{className:"flex-1"}),d.assignee&&e.jsx(te,{className:"size-4",title:`Assigned to ${d.assignee.name}`,children:e.jsx(ne,{className:C("text-[8px] font-semibold",d.assignee.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ue(d.assignee.name)})}),e.jsx("span",{children:ve(d.updatedAt)})]})]},d.id))]})]},l))})}export{Cn as component,ut as isStatus};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aq as A,r as f,j as e,B as g,ar as S,e as E,as as I,x as k,N as L,z as P,C as y}from"./index-C87aqO18.js";import{u as C}from"./useQuery-COJ09EkU.js";import{u as F,a as M}from"./zod-iC-UhR5u.js";import{C as R}from"./card-8T0wnIiU.js";import{X as U,E as $,G as z,I as B,H,J as q,K}from"./dialog-DrrnCoT5.js";import{L as N,I as V}from"./label-BfMHjFA7.js";import{T as Y,a as G,b as D,c as p,d as J,e as j}from"./table-DkqScFZb.js";import{C as O}from"./ConfirmDialog-CCAJDc_P.js";import{C as Q}from"./CopyButton-exuJDdXj.js";import{P as X,E as W}from"./parts-B-HQayFH.js";import{b as T}from"./labels--UUyt9uB.js";import{C as Z}from"./check-CiLHTeII.js";import{U as _}from"./users-O11swHBQ.js";import{P as ee}from"./plus-CuMhvZUZ.js";import"./useBaseQuery-0OqUJMfc.js";import"./createLucideIcon-llnWWh0E.js";import"./createBaseUIEventDetails-CEmaecLi.js";import"./copy-CKgsZbj1.js";function ye(){const{site:s}=A.useParams(),{site:d}=A.useRouteContext(),a=C(k.links(s)),l=C(k.origins(s)),[x,n]=f.useState(!1),[t,r]=f.useState(null);f.useEffect(()=>r(null),[s]);const i=a.data?.data??[],c=l.data?.origins[0]?.replace(/\/+$/,"")??"",m=t?`${c}/${t.fragment}`:"",v=e.jsxs(g,{onClick:()=>n(!0),children:[e.jsx(ee,{}),"Add reviewer"]});return e.jsxs("div",{className:"p-7",children:[e.jsx(X,{title:"Reviewers",sub:`Each reviewer gets their own link to ${d.name}`,actions:v}),t&&e.jsxs("div",{className:"mb-4 flex max-w-[1040px] items-center gap-3 rounded-lg border border-ok bg-ok-soft px-3.5 py-3",role:"status",children:[e.jsx(Z,{className:"size-4 shrink-0 text-ok"}),e.jsxs("div",{className:"shrink-0",children:[e.jsxs("b",{className:"font-semibold",children:[t.name," added."]})," ",e.jsx("span",{className:"text-ink-soft",children:"Share this link — it is shown once."})]}),e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[12.5px]",children:m}),e.jsx(Q,{text:m,label:"Copy link",withText:!0}),e.jsx(g,{variant:"ghost",size:"icon-sm","aria-label":"Dismiss",onClick:()=>r(null),children:e.jsx(U,{})})]}),a.isSuccess&&i.length===0?e.jsx(R,{className:"max-w-[1040px]",children:e.jsx(W,{icon:e.jsx(_,{className:"size-5"}),title:"No reviewers yet",action:v,children:"Add your client and send them their link. They never need an account."})}):e.jsx(R,{className:"max-w-[1040px] overflow-hidden py-0",children:e.jsxs(Y,{children:[e.jsx(G,{children:e.jsxs(D,{children:[e.jsx(p,{children:"Name"}),e.jsx(p,{children:"Status"}),e.jsx(p,{children:"Uses"}),e.jsx(p,{children:"Last seen"}),e.jsx(p,{className:"w-0"})]})}),e.jsx(J,{children:i.map(u=>e.jsx(se,{link:u,uid:s,onRevoked:()=>r(h=>h?.id===u.id?null:h)},u.id))})]})}),e.jsx("p",{className:"m-0 mt-3 max-w-[1040px] text-[12.5px] text-muted-foreground",children:"Revoking ends every session minted from the link within 10 seconds. The comments a reviewer left stay."}),e.jsx(ne,{uid:s,open:x,onOpenChange:n,onMinted:r})]})}function se({link:s,uid:d,onRevoked:a}){const l=S(d),[x,n]=f.useState(!1),t=!!s.revokedAt,r=!t&&new Date(s.expiresAt).getTime()<=Date.now(),i=t||r,c=Math.max(0,Math.ceil((new Date(s.expiresAt).getTime()-Date.now())/864e5));return e.jsxs(D,{className:E(i&&"text-muted-foreground"),children:[e.jsx(j,{className:"font-medium",children:s.name}),e.jsx(j,{children:t?e.jsxs("span",{children:["Revoked ",T(s.revokedAt)]}):r?e.jsx("span",{children:"Expired"}):e.jsxs("span",{children:[e.jsx("span",{className:"rounded-full bg-ok-soft px-2 py-0.5 text-[11.5px] font-medium text-ok",children:"Active"}),e.jsxs("span",{className:"ml-2 text-[12px] text-muted-foreground",children:["expires in ",c," day",c===1?"":"s"]})]})}),e.jsx(j,{children:s.useCount}),e.jsx(j,{className:"text-muted-foreground",children:s.lastUsedAt?T(s.lastUsedAt):"never"}),e.jsxs(j,{className:"text-right",children:[!t&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>n(!0),children:"Revoke"}),e.jsx(O,{open:x,onOpenChange:n,title:`Revoke ${s.name}'s link?`,description:`Every session minted from it ends within 10 seconds. The comments ${s.name} left stay. This cannot be undone — adding them again makes a new link.`,confirmLabel:"Revoke",busy:l.isPending,onConfirm:()=>{n(!1),a(),l.mutate(s.id)}})]})]})}const te=P({name:y().trim().min(1,"Their name"),days:y(),roundId:y().optional()});function ne({uid:s,open:d,onOpenChange:a,onMinted:l}){const x=I(s),n=C({...k.rounds(s),enabled:d}),[t,r]=f.useState(""),{register:i,handleSubmit:c,formState:m,reset:v}=F({resolver:M(te),defaultValues:{days:"14",roundId:""}}),u=c(async o=>{r("");const b=Number(o.days);try{const w=await x.mutateAsync({name:o.name,...Number.isFinite(b)&&b>0?{expiresAt:new Date(Date.now()+b*864e5).toISOString()}:{},...o.roundId?{roundId:o.roundId}:{}});l(w),v(),a(!1)}catch(w){r(L(w))}}),h="h-8 w-full rounded-md border border-input bg-card px-2.5 text-[13.5px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50";return e.jsx($,{open:d,onOpenChange:a,children:e.jsx(z,{children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(B,{children:[e.jsx(H,{children:"New reviewer"}),e.jsx(q,{children:"Your client's name, as you will see it on their comments. A link is generated once and shown to you once."})]}),t&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:t}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(N,{htmlFor:"reviewer-name",children:"Name"}),e.jsx(V,{id:"reviewer-name",placeholder:"Marta, Kilnwork","aria-invalid":!!m.errors.name,...i("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(N,{htmlFor:"reviewer-days",children:"Link expires in"}),e.jsxs("select",{id:"reviewer-days",className:h,...i("days"),children:[e.jsx("option",{value:"7",children:"7 days"}),e.jsx("option",{value:"14",children:"14 days"}),e.jsx("option",{value:"30",children:"30 days"}),e.jsx("option",{value:"90",children:"90 days"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"You can revoke it at any time before that."})]}),n.data&&n.data.data.length>0&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(N,{htmlFor:"reviewer-round",children:"Pin to a round"}),e.jsxs("select",{id:"reviewer-round",className:h,...i("roundId"),children:[e.jsx("option",{value:"",children:"Any round"}),n.data.data.map(o=>e.jsx("option",{value:o.id,children:o.name},o.id))]})]}),e.jsxs(K,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(g,{type:"submit",disabled:m.isSubmitting,children:m.isSubmitting?"Adding…":"Add reviewer"})]})]})})})}export{ye as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as i,f as me,W as ce,X as ge,c as oe,V as Te,E as de,h as ie,j as e,Y as Ve,d as J,ao as we,au as tt,e as le,av as nt,aw as st,B as ae,n as rt,ax as at,x as it}from"./index-C87aqO18.js";import{u as ot}from"./useQuery-COJ09EkU.js";import{f as xe,a as be,b as ve,d as Le,u as ze,c as Be,L as Q,I as ye}from"./label-BfMHjFA7.js";import{u as ke,c as He,n as Ke,g as je,e as We,a as dt}from"./createBaseUIEventDetails-CEmaecLi.js";import{O as lt,L as qe,M as Ge,N as ct,A as ut,aL as Se,ak as Ne,ad as ue,a9 as fe,aM as Pe,aN as Ee,ao as ft,aO as Me,aa as pt,ab as ht,aP as De,aQ as Fe,aR as Ae,aS as Oe,aT as mt,aU as gt,X as xt}from"./dialog-DrrnCoT5.js";import{c as bt,a as vt,C as yt,u as _e}from"./CompositeItem-DnLNS57f.js";import{u as kt,a as Ye}from"./FieldItemContext-jf0Is3j7.js";import{C as Rt}from"./ConfirmDialog-CCAJDc_P.js";import{C as Ct}from"./CopyButton-exuJDdXj.js";import{I as It}from"./InstallTag-CkeGLk1a.js";import{P as wt,a as pe}from"./parts-B-HQayFH.js";import{S as jt}from"./SaveState-BsrfwjoH.js";import{u as St}from"./me-D1prnPpY.js";import{P as Nt}from"./plus-CuMhvZUZ.js";import"./useBaseQuery-0OqUJMfc.js";import"./createLucideIcon-llnWWh0E.js";import"./check-CiLHTeII.js";import"./copy-CKgsZbj1.js";import"./card-8T0wnIiU.js";import"./labels--UUyt9uB.js";const Pt=i.createContext(void 0);function Et(t=!1){const a=i.useContext(Pt);if(!a&&!t)throw new Error(me(86));return a}function Mt(t,a){return t.matches(":disabled")?!1:!a||t.form===a?!0:t.form===null&&!t.hasAttribute("form")}function Dt(t){return t==null||t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true"}const he={checked(t){return t?{"data-checked":""}:{"data-unchecked":""}},...lt,...xe},Ue="data-composite-item-active",$e=i.createContext(void 0);function Ft(){return i.useContext($e)}function At(t){if(t==null)return"";if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}const Je=i.createContext(void 0);function Ot(){const t=i.useContext(Je);if(t===void 0)throw new Error(me(52));return t}const Tt=i.forwardRef(function(a,s){const{render:l,className:f,disabled:p=!1,readOnly:c=!1,required:h=!1,"aria-labelledby":u,value:y,inputRef:z,nativeButton:m=!1,id:B,style:I,...P}=a,V=Ft(),{disabled:O,readOnly:q,required:x,form:G,checkedValue:k,touched:T=!1,validation:H,name:E,setCheckedValue:_=ce,setTouched:U=ce,registerInputRef:n=ce}=V??{},{setTouched:g,setFilled:b,state:M,disabled:D}=be(),R=kt(),{labelId:K,getDescriptionProps:w}=ve(),o=D||R.disabled||O||p,d=q||c,L=x||h,F=G,j=V?k===y:y==="",A=i.useRef(null),S=i.useRef(null),v=H?.registerInput,W=i.useCallback(N=>v?.(N,{controlRef:A,value:void 0}),[v]),$=ge(z,S,n,W);oe(()=>{S.current?.checked&&b(!0)},[b]),oe(()=>{if(S.current){if(o&&j){n(null);return}n(S.current)}},[j,o,n]);const X=ke(),Z=Le({id:B,implicit:!1,controlRef:A}),ee=m?void 0:Z,ne=Ye(u,K,S,!m,ee),te={role:"radio","aria-checked":j,"aria-labelledby":ne,[Ue]:j?"":void 0,id:m?Z:X,onKeyDown(N){N.key==="Enter"&&N.preventDefault()},onClick(N){if(N.defaultPrevented||o||d)return;N.preventDefault();const re=S.current;re&&Ve(re,N)},onFocus(N){N.defaultPrevented||o||d||!T||(S.current?.click(),U(!1))}},{getButtonProps:se,buttonRef:r}=Te({disabled:o,native:m,composite:!1}),C={type:"radio",ref:$,form:F,id:ee,name:E,tabIndex:-1,style:E?qe:Ge,"aria-hidden":!0,...y!==void 0?{value:At(y)}:de,disabled:o,checked:j,required:L,readOnly:d,onChange(N){if(N.nativeEvent.defaultPrevented||o||d||y===void 0)return;const re=He(Ke,N.nativeEvent);_(y,re),!re.isCanceled&&g(!0)},onClick(N){N.stopPropagation()},onFocus(){A.current?.focus()}},Y=i.useMemo(()=>({...M,required:L,disabled:o,readOnly:d,checked:j}),[M,o,d,j,L]),Ze=Y,Re=V!==void 0,Ce=[s,A,r],Ie=[te,P,se,w,H?N=>H.getValidationProps(o,N):de],et=ie("span",a,{enabled:!Re,state:Y,ref:Ce,props:Ie,stateAttributesMapping:he});return e.jsxs(Je.Provider,{value:Ze,children:[Re?e.jsx(bt,{tag:"span",render:l,className:f,style:I,state:Y,refs:Ce,props:Ie,stateAttributesMapping:he}):et,e.jsx("input",{...C,suppressHydrationWarning:!0})]})}),Vt=i.forwardRef(function(a,s){const{render:l,className:f,style:p,keepMounted:c=!1,...h}=a,u=Ot(),y=u.checked,{mounted:z,transitionStatus:m,setMounted:B}=ct(y),I={...u,transitionStatus:m},P=i.useRef(null),V=c||z,O=ie("span",a,{ref:[s,P],state:I,props:h,stateAttributesMapping:he});return ut({open:y,ref:P,onComplete(){y||B(!1)}}),V?O:null}),Lt=[];function zt(t){const{loopFocus:a=!0,orientation:s="both",grid:l,onLoop:f,direction:p,highlightedIndex:c,onHighlightedIndexChange:h,rootRef:u,enableHomeAndEndKeys:y=!1,stopEventPropagation:z,disabledIndices:m,modifierKeys:B=Lt}=t,[I,P]=i.useState(0),V=l!=null,O=i.useRef(null),q=ge(O,u),x=i.useRef([]),G=i.useRef(!1),k=c??I,T=J((n,g=!1)=>{if((h??P)(n),g){const b=x.current[n];Se(O.current,b,p,s)}}),H=J(n=>{if(n.size===0||G.current)return;G.current=!0;const g=Array.from(n.keys()),b=g.find(D=>D?.hasAttribute(Ue))??null,M=b?n.get(b)?.index??-1:-1;if(M!==-1)T(M);else if(Ne(g,k,m)){const D=ue(g,{disabledIndices:m});fe(g,D)||T(D)}Se(O.current,b,p,s)});oe(()=>{if(m==null||c!=null||!G.current)return;const n=x.current;if(Ne(n,k,m)){const g=ue(n,{disabledIndices:m});fe(n,g)||T(g)}},[m,c,k,x,T]);const E=J((n,g,b)=>f?f(n,g,b,x):b),_=J(n=>{const g=n.key===Pe||n.key===Ee;if(!ft.has(n.key)||!y&&g||Bt(n,B)||!O.current)return;const M=p==="rtl",D=M?Ae:Oe,R=M?Oe:Ae,K=s==="vertical"?De:D,w=s==="vertical"?Fe:R,o=je(n.nativeEvent);if(o!=null&&Me(o)&&!Dt(o)){const S=o.selectionStart,v=o.selectionEnd,W=o.value;if(S==null||n.shiftKey||S!==v||n.key!==w&&S<W.length||n.key!==K&&S>0)return}let d=k;const L=pt(x,m),F=ht(x,m);l!=null&&(d=l({disabledIndices:m,elementsRef:x,event:n,highlightedIndex:k,loopFocus:a,maxIndex:F,minIndex:L,onLoop:E,orientation:s,rtl:M}));const j=s!=="vertical"&&n.key===D||s!=="horizontal"&&n.key===De,A=s!=="vertical"&&n.key===R||s!=="horizontal"&&n.key===Fe;y&&(n.key===Pe?d=L:n.key===Ee&&(d=F)),d===k&&(j||A)&&(a&&d===F&&j?(d=L,f&&(d=f(n,k,d,x))):a&&d===L&&A?(d=F,f&&(d=f(n,k,d,x))):d=ue(x.current,{startingIndex:d,decrement:A,disabledIndices:m})),d!==k&&!fe(x.current,d)&&(z&&n.stopPropagation(),(V||g||j||A)&&n.preventDefault(),T(d,!0),queueMicrotask(()=>{x.current[d]?.focus()}))});return{props:{ref:q,onFocus(n){const g=O.current,b=je(n.nativeEvent);!g||b==null||!Me(b)||b.setSelectionRange(0,b.value.length)},onKeyDown:_},highlightedIndex:k,onHighlightedIndexChange:T,elementsRef:x,onMapChange:H,relayKeyboardEvent:_}}function Bt(t,a){for(const s of mt)if(!a.includes(s)&&t.getModifierState(s))return!0;return!1}function Ht(t){const{render:a,className:s,style:l,refs:f=we,props:p=we,state:c=de,stateAttributesMapping:h,highlightedIndex:u,onHighlightedIndexChange:y,orientation:z,grid:m,loopFocus:B,onLoop:I,enableHomeAndEndKeys:P,onMapChange:V,stopEventPropagation:O=!0,rootRef:q,disabledIndices:x,modifierKeys:G,highlightItemOnHover:k=!1,tag:T="div",...H}=t,E=vt(),{props:_,highlightedIndex:U,onHighlightedIndexChange:n,elementsRef:g,onMapChange:b,relayKeyboardEvent:M}=zt({grid:m,loopFocus:B,onLoop:I,orientation:z,highlightedIndex:u,onHighlightedIndexChange:y,rootRef:q,stopEventPropagation:O,enableHomeAndEndKeys:P,direction:E,disabledIndices:x,modifierKeys:G}),D=ie(T,t,{state:c,ref:f,props:[_,...p,H],stateAttributesMapping:h}),R=i.useMemo(()=>({highlightedIndex:U,onHighlightedIndexChange:n,highlightItemOnHover:k,relayKeyboardEvent:M}),[U,n,k,M]);return e.jsx(tt.Provider,{value:R,children:e.jsx(yt,{elementsRef:g,onMapChange:K=>{V?.(K),b(K)},children:D})})}const Kt=[gt],Wt=i.forwardRef(function(a,s){const{render:l,className:f,disabled:p,readOnly:c,required:h,onValueChange:u,value:y,defaultValue:z,form:m,name:B,inputRef:I,id:P,style:V,...O}=a,{setTouched:q,setFocused:x,validationMode:G,name:k,disabled:T,state:H,validation:E,setDirty:_,setFilled:U,validityData:n}=be(),{labelId:g}=ve(),{clearErrors:b,elementRef:M}=ze(),D=Et(!0),R=T||p,K=k??B,w=ke(P),[o,d]=We({controlled:y,default:z,name:"RadioGroup",state:"value"}),[L,F]=i.useState(!1),j=J((r,C)=>{u?.(r,C),!C.isCanceled&&d(r)}),A=E.getInputControl,S=i.useMemo(()=>({get current(){return A()}}),[A]),v=i.useRef(null),W=i.useRef(null);function $(r){let C;return I&&(typeof I=="function"?C=I(r):I.current=r),v.current=r,C}const X=J(r=>{if(!r||r.disabled)return;W.current||(W.current=r);const C=v.current,Y=r.checked||C==null||C.disabled?$(r):void 0;return()=>{W.current===r&&(W.current=null),v.current===r?Y?(Y(),v.current=null):$(null):Y?.()}}),Z=J(()=>{const r=M.current;if(!r)return o??null;for(const C of E.registeredInputs.keys())if(C.checked&&Mt(C,r))return o??null;return null});Be(S,w,o??null,Z,!R,B),_e(o,()=>{b(K),_(o!==n.initialValue),U(o!=null),E.change(o);const r=W.current;o==null&&r&&!r.disabled&&$(r)});const ee=g??D?.legendId,ne={...H,disabled:R??!1,required:h??!1,readOnly:c??!1},te=i.useMemo(()=>({checkedValue:o,disabled:R,form:m,validation:E,name:K,readOnly:c,registerInputRef:X,required:h,setCheckedValue:j,setTouched:F,touched:L}),[o,R,m,E,K,c,X,h,j,F,L]),se={id:P,role:"radiogroup","aria-required":h||void 0,"aria-disabled":R||void 0,"aria-readonly":c||void 0,"aria-labelledby":ee,onFocus(){x(!0)},onBlur(r){dt(r.currentTarget,r.relatedTarget)||(q(!0),x(!1),G==="onBlur"&&E.commit(o))},onKeyDownCapture(r){r.key.startsWith("Arrow")&&(F(!0),x(!0))}};return e.jsx($e.Provider,{value:te,children:e.jsx(Ht,{render:l,className:f,style:V,state:ne,props:[se,O,r=>E.getValidationProps(R??!1,r)],refs:[s],stateAttributesMapping:xe,enableHomeAndEndKeys:!1,modifierKeys:Kt})})});function qt({className:t,...a}){return e.jsx(Wt,{"data-slot":"radio-group",className:le("grid w-full gap-2",t),...a})}function Gt({className:t,...a}){return e.jsx(Tt,{"data-slot":"radio-group-item",className:le("group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary",t),...a,children:e.jsx(Vt,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:e.jsx("span",{className:"absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground"})})})}const Qe=i.createContext(void 0);function _t(){const t=i.useContext(Qe);if(t===void 0)throw new Error(me(63));return t}const Xe={...xe,checked(t){return t?{"data-checked":""}:{"data-unchecked":""}}},Yt=i.forwardRef(function(a,s){const{checked:l,className:f,defaultChecked:p,"aria-labelledby":c,form:h,id:u,inputRef:y,name:z,nativeButton:m=!1,onCheckedChange:B,readOnly:I=!1,required:P=!1,disabled:V=!1,render:O,uncheckedValue:q,value:x,style:G,...k}=a,{clearErrors:T}=ze(),{state:H,setTouched:E,setDirty:_,validityData:U,setFilled:n,setFocused:g,validationMode:b,disabled:M,name:D,validation:R}=be(),{labelId:K}=ve(),w=M||V,o=D??z,d=i.useRef(null),L=ge(d,y,R.inputRef),F=i.useRef(null),j=ke(),A=Le({id:u,implicit:!1,controlRef:F}),S=m?void 0:A,[v,W]=We({controlled:l,default:!!p,name:"Switch",state:"checked"});Be(F,j,v,void 0,!w,z),oe(()=>{d.current&&n(d.current.checked)},[n]),_e(v,()=>{T(o),_(v!==U.initialValue),n(v),R.change(v)});const{getButtonProps:$,buttonRef:X}=Te({disabled:w,native:m}),Z=Ye(c,K,d,!m,S),ee={id:m?A:j,role:"switch","aria-checked":v,"aria-readonly":I||void 0,"aria-required":P||void 0,"aria-labelledby":Z,onFocus(){w||g(!0)},onBlur(){const r=d.current;!r||w||(E(!0),g(!1),b==="onBlur"&&R.commit(r.checked))},onClick(r){if(I||w)return;r.preventDefault();const C=d.current;C&&Ve(C,r)}},ne={...R.getValidationProps(w),checked:v,disabled:w,form:h,id:S,name:o,required:P,style:o?qe:Ge,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:L,onChange(r){if(r.nativeEvent.defaultPrevented)return;if(I){r.preventDefault();return}const C=r.currentTarget.checked,Y=He(Ke,r.nativeEvent);B?.(C,Y),!Y.isCanceled&&W(C)},onClick(r){r.stopPropagation()},onFocus(){F.current?.focus()},...x!==void 0?{value:x}:de},te=i.useMemo(()=>({...H,checked:v,disabled:w,readOnly:I,required:P}),[H,v,w,I,P]),se=ie("span",a,{state:te,ref:[s,F,X],props:[ee,k,$,r=>R.getValidationProps(w,r)],stateAttributesMapping:Xe});return e.jsxs(Qe.Provider,{value:te,children:[se,!v&&o&&q!==void 0&&e.jsx("input",{type:"hidden",form:h,name:o,value:q,disabled:w}),e.jsx("input",{...ne,suppressHydrationWarning:!0})]})}),Ut=i.forwardRef(function(a,s){const{render:l,className:f,style:p,...c}=a,h=_t();return ie("span",a,{state:h,ref:s,stateAttributesMapping:Xe,props:c})});function $t({className:t,size:a="default",...s}){return e.jsx(Yt,{"data-slot":"switch","data-size":a,className:le("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",t),...s,children:e.jsx(Ut,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}const Jt=[{id:"open",title:"Everyone on the site",note:"The toolbar appears for every visitor on the addresses above. Simplest for a staging URL nobody else knows."},{id:"link-required",title:"Only reviewers with a link",note:"You add a reviewer and send them their link. Use this when staging is publicly reachable, or when one reviewer needs revoking without shutting the whole site."}];function Rn(){const{site:t}=nt.useParams(),s=St().projects.find(u=>u.uid===t),l=ot(it.origins(t)),f=st(t),[p,c]=i.useState(null),h=u=>f.mutate(u,{onSuccess:()=>c(Date.now())});return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(wt,{title:"Settings",sub:s.name,actions:e.jsx(jt,{saving:f.isPending,savedAt:p})}),e.jsxs(pe,{title:"Site",description:"Its name, its ID for the tag, and where the widget may run.",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Q,{children:"Site ID"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"rounded-md bg-muted px-2.5 py-1.5 font-mono text-[12.5px] text-ink-soft",children:s.uid}),e.jsx(Ct,{text:s.uid,label:"Copy the site ID"})]})]}),e.jsx(Qt,{name:s.name,onSave:u=>h({name:u})}),e.jsx(Xt,{domain:l.data?.domain??null,loaded:l.isSuccess,onSave:u=>h({domain:u})}),e.jsx(Zt,{list:l.data?.origins??[],loaded:l.isSuccess,hasDomain:!!l.data?.domain,onChange:u=>h({origins:u})})]}),e.jsxs(pe,{title:"Widget",description:"Whether it runs, who the toolbar appears for, and the tag itself.",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx(Q,{htmlFor:"widget-on",className:"text-[13px] font-medium",children:"Widget on this site"}),e.jsx("p",{className:"m-0 mt-0.5 text-[12px] leading-normal text-muted-foreground",children:"Off hides the toolbar for everyone and refuses new comments. The tag can stay in the site's code."})]}),e.jsx($t,{id:"widget-on","aria-label":"Widget on this site",checked:s.status!=="paused",onCheckedChange:u=>h({status:u?"active":"paused"})})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(Q,{children:"Who can comment"}),e.jsx(qt,{value:s.writeMode,onValueChange:u=>h({writeMode:String(u)}),className:"gap-2",children:Jt.map(u=>e.jsxs("label",{className:le("flex cursor-pointer items-start gap-2.5 rounded-md border border-border px-3 py-2.5",s.writeMode===u.id&&"border-brand bg-brand-soft"),children:[e.jsx(Gt,{value:u.id,className:"mt-0.5","aria-label":u.title}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-[13px] font-medium",children:u.title}),e.jsx("span",{className:"block text-[12px] leading-normal text-muted-foreground",children:u.note})]})]},u.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Q,{children:"The tag"}),e.jsx(It,{uid:s.uid}),e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["Paste it before ",e.jsx("code",{className:"font-mono",children:"</body>"})," on every page you want reviewed."]})]})]}),e.jsx(en,{uid:t,name:s.name})]})}function Qt({name:t,onSave:a}){const[s,l]=i.useState(t);i.useEffect(()=>l(t),[t]);const f=s.trim().length>0&&s.trim()!==t;return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:p=>{p.preventDefault(),f&&a(s.trim())},children:[e.jsx(Q,{htmlFor:"site-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ye,{id:"site-name",value:s,onChange:p=>l(p.target.value)}),f&&e.jsx(ae,{type:"submit",variant:"outline",children:"Save"})]})]})}function Xt({domain:t,loaded:a,onSave:s}){const[l,f]=i.useState(t??"");i.useEffect(()=>f(t??""),[t]);const p=l.trim()!==(t??"");return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:c=>{c.preventDefault(),p&&s(l.trim()||null)},children:[e.jsx(Q,{htmlFor:"site-domain",children:"Domain"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ye,{id:"site-domain",placeholder:"kilnwork.studio",value:l,onChange:c=>f(c.target.value),disabled:!a}),p&&e.jsx(ae,{type:"submit",variant:"outline",children:l.trim()?"Save domain":"Clear domain"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Every subdomain, scheme and port of it may run the widget — staging, previews, and localhost while you build."})]})}function Zt({list:t,loaded:a,hasDomain:s,onChange:l}){const[f,p]=i.useState("");return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Q,{htmlFor:"site-origin-add",children:"Also allowed"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Exact addresses the domain does not cover — a client's other host, a preview on somebody else's suffix."}),e.jsxs("ul",{className:"m-0 flex list-none flex-col gap-1.5 p-0",children:[t.map(c=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"rounded-md border border-border px-2 py-1 font-mono text-[12px]",children:c}),e.jsx(ae,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`Remove ${c}`,disabled:t.length<=1&&!s,onClick:()=>l(t.filter(h=>h!==c)),children:e.jsx(xt,{})})]},c)),a&&t.length===0&&e.jsx("li",{className:"text-[12.5px] text-muted-foreground",children:s?"None besides the domain.":"No address yet."})]}),e.jsxs("form",{className:"flex gap-2",onSubmit:c=>{c.preventDefault();const h=f.trim();h&&(l([...t,h]),p(""))},children:[e.jsx(ye,{id:"site-origin-add",placeholder:"https://staging.example.com",value:f,onChange:c=>p(c.target.value)}),e.jsxs(ae,{type:"submit",variant:"outline",disabled:!f.trim(),children:[e.jsx(Nt,{}),"Add"]})]})]})}function en({uid:t,name:a}){const[s,l]=i.useState(!1),f=rt(),p=at(t);return e.jsxs(pe,{danger:!0,title:"Delete this site",description:e.jsxs(e.Fragment,{children:["The site stops appearing and its widget stops being served."," ",e.jsx("b",{className:"font-semibold text-foreground",children:"Nothing your client wrote is destroyed"})," — the comments stay in the database, so a mistake here is recoverable."]}),children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("p",{className:"m-0 flex-1 text-[13px] text-ink-soft",children:"You will be asked to type the site's name."}),e.jsxs(ae,{type:"button",variant:"outline",className:"border-destructive text-destructive",onClick:()=>l(!0),children:["Delete ",a,"…"]})]}),e.jsx(Rt,{open:s,onOpenChange:l,title:`Delete ${a}?`,description:"The site stops appearing and its widget stops being served. Nothing your client wrote is destroyed — the comments stay in the database.",confirmLabel:"Delete",confirmWord:a,busy:p.isPending,onConfirm:()=>p.mutate(void 0,{onSuccess:()=>{l(!1),f({to:"/sites"})}})})]})}export{Rn as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{R as x,n as h,r as g,o as f,w as j,y as w,A as N,j as e,G as y,B as b,z as S,C as r}from"./index-C87aqO18.js";import{u as v,a as A}from"./zod-iC-UhR5u.js";import{L as o,I as i}from"./label-BfMHjFA7.js";import"./createBaseUIEventDetails-CEmaecLi.js";const C=S({email:r().trim().email("An email address"),password:r().min(12,"At least 12 characters"),orgName:r().trim().max(120).optional()});function R(){const{claim:c}=x.useSearch(),d=h(),[l,m]=g.useState(""),{register:a,handleSubmit:p,formState:s}=v({resolver:A(C)}),u=p(async t=>{m("");try{await f.setup({token:c??"",orgName:t.orgName||"My studio",projectName:"",email:t.email,password:t.password}),j("in"),w.clear(),d({to:"/welcome",replace:!0})}catch(n){m(n instanceof N?n.message:"Something went wrong. Try again.")}});return e.jsx(y,{width:400,children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Set up Snagset"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"This instance has not been claimed yet. The account you make here is the only one, until you add another."})]}),l&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:l}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(o,{htmlFor:"email",children:"Your email"}),e.jsx(i,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!s.errors.email,...a("email")}),s.errors.email&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:s.errors.email.message})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(o,{htmlFor:"password",children:"Password"}),e.jsx(i,{id:"password",type:"password",autoComplete:"new-password","aria-invalid":!!s.errors.password,...a("password")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. There is no reset email on a fresh install — keep it."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(o,{htmlFor:"orgName",children:["Studio name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(i,{id:"orgName",placeholder:"My studio",...a("orgName")})]}),e.jsx(b,{type:"submit",size:"lg",disabled:s.isSubmitting,children:s.isSubmitting?"Setting up…":"Create my account"})]})})}export{R as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{D as b,n as j,r as l,x as v,o as w,w as y,A as N,j as e,G as S,B as C,e as k,z as E,C as d}from"./index-C87aqO18.js";import{u as F}from"./useQuery-COJ09EkU.js";import{u as R,a as z}from"./zod-iC-UhR5u.js";import{L as m,I as c}from"./label-BfMHjFA7.js";import{C as A}from"./chevron-right-BokKbPOn.js";import"./useBaseQuery-0OqUJMfc.js";import"./createBaseUIEventDetails-CEmaecLi.js";import"./createLucideIcon-llnWWh0E.js";const I=E({email:d().trim().min(1,"Your email"),password:d().min(1,"Your password")});function Q(){const{redirect:p}=b.useSearch(),t=j(),[a,o]=l.useState(""),[s,u]=l.useState(!1),{register:i,handleSubmit:x,formState:r}=R({resolver:z(I)});F({...v.claimed(),enabled:!0}).data===!1&&t({to:"/setup",replace:!0});const h=x(async({email:f,password:g})=>{o("");try{await w.login(f,g),y("in"),t({to:p??"/sites",replace:!0})}catch(n){o(n instanceof N?n.message:"Could not reach the server.")}});return e.jsx(S,{children:e.jsxs("form",{onSubmit:h,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Sign in"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"The studio side. Reviewers don't sign in — they open a link."})]}),a&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:a}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(m,{htmlFor:"email",children:"Email"}),e.jsx(c,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!r.errors.email,...i("email")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(m,{htmlFor:"password",children:"Password"}),e.jsx(c,{id:"password",type:"password",autoComplete:"current-password","aria-invalid":!!r.errors.password,...i("password")})]}),e.jsx(C,{type:"submit",size:"lg",disabled:r.isSubmitting,children:r.isSubmitting?"Signing in…":"Sign in"}),e.jsxs("button",{type:"button",className:"flex items-center gap-2 rounded-md border border-border px-3 py-2 text-left text-[13px] text-ink-soft","aria-expanded":s,onClick:()=>u(!s),children:[e.jsx(A,{className:k("size-3.5 text-muted-foreground transition-transform",s&&"rotate-90")}),"Forgot your password?"]}),s&&e.jsxs("div",{className:"flex flex-col gap-2 text-[12.5px] leading-relaxed text-muted-foreground",children:[e.jsx("p",{className:"m-0",children:"There's no reset email — a fresh install has no mail set up, and whoever has a shell on the server already holds more authority than a reset link would grant. From that machine:"}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md border border-border bg-card px-3 py-2 font-mono text-[12px] text-foreground",children:e.jsx("code",{children:`printf '%s' "$NEW" | snagset passwd you@example.com`})}),e.jsx("p",{className:"m-0",children:"Every existing session for that account is signed out when it runs."})]})]})})}export{Q as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{K as v,r as m,j as e,B as l,L as N,n as y,s as w,o as A,A as S,z as k,C as u}from"./index-C87aqO18.js";import{u as C,a as _}from"./zod-iC-UhR5u.js";import{C as E}from"./card-8T0wnIiU.js";import{E as $,G as D,I,H as L,J as P,K as z}from"./dialog-DrrnCoT5.js";import{L as p,I as h}from"./label-BfMHjFA7.js";import{P as F,E as K}from"./parts-B-HQayFH.js";import{b as H}from"./labels--UUyt9uB.js";import{u as q}from"./me-D1prnPpY.js";import{P as g}from"./plus-CuMhvZUZ.js";import{L as B}from"./layout-grid-B7mn7n3K.js";import{I as G}from"./image-off-CgUC8krg.js";import"./createLucideIcon-llnWWh0E.js";import"./createBaseUIEventDetails-CEmaecLi.js";import"./useBaseQuery-0OqUJMfc.js";function re(){const t=q(),{add:i}=v.useSearch(),[c,r]=m.useState(!!i);m.useEffect(()=>{i&&r(!0)},[i]);const a=t.projects.reduce((s,o)=>s+o.unresolved,0);return e.jsxs("div",{className:"p-7",children:[e.jsx(F,{title:"Sites",sub:t.projects.length?`${t.projects.length} site${t.projects.length===1?"":"s"} · ${a} open`:void 0,actions:e.jsxs(l,{onClick:()=>r(!0),children:[e.jsx(g,{}),"Add a site"]})}),t.projects.length===0?e.jsx(E,{className:"max-w-[1100px]",children:e.jsx(K,{icon:e.jsx(B,{className:"size-5"}),title:"No sites yet",action:e.jsxs(l,{onClick:()=>r(!0),children:[e.jsx(g,{}),"Add a site"]}),children:"A site is one client website. Add it, paste the tag, and comments start arriving here."})}):e.jsx("div",{className:"grid max-w-[1100px] grid-cols-1 gap-5 md:grid-cols-2 xl:grid-cols-3",children:t.projects.map(s=>e.jsxs(N,{to:"/s/$site/comments",params:{site:s.uid},className:"block overflow-hidden rounded-lg border border-border bg-card text-foreground transition-shadow hover:shadow-[0_1px_2px_rgb(24_23_22/.06),0_8px_24px_rgb(24_23_22/.08)]",children:[e.jsx("div",{className:"flex h-[150px] items-center justify-center border-b border-border bg-background",children:s.previewUrl?e.jsx("img",{src:s.previewUrl,alt:"",className:"size-full object-cover object-top"}):e.jsxs("div",{className:"flex flex-col items-center gap-1 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"flex size-8 items-center justify-center rounded-md bg-muted",children:e.jsx(G,{className:"size-4"})}),"No screenshot yet"]})}),e.jsxs("div",{className:"px-3.5 pb-3.5 pt-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[14px] font-semibold",children:[e.jsx("span",{className:"truncate",children:s.name}),s.status==="paused"&&e.jsx("span",{className:"rounded-sm bg-muted px-1.5 py-px text-[10.5px] font-medium uppercase tracking-wide text-muted-foreground",children:"Paused"})]}),s.domain&&e.jsx("div",{className:"mt-0.5 truncate font-mono text-[12px] text-muted-foreground",children:s.domain}),e.jsx("div",{className:"mt-2 text-[12.5px] text-ink-soft",children:s.threads===0?"Nothing filed yet":`${s.unresolved} open of ${s.threads}${s.lastActivityAt?` · ${H(s.lastActivityAt)}`:""}`})]})]},s.uid))}),e.jsx(R,{open:c,onOpenChange:r})]})}const Q=k({name:u().trim().min(1,"A name"),domain:u().trim().min(1,"Its domain")});function R({open:t,onOpenChange:i}){const c=y(),r=w(),[a,s]=m.useState(""),{register:o,handleSubmit:j,formState:n,reset:f}=C({resolver:_(Q)}),b=j(async x=>{s("");try{const d=await A.createProject(x.name,"",x.domain);await r.invalidateQueries({queryKey:["me"]}),f(),i(!1),c({to:"/s/$site/comments",params:{site:d.uid}})}catch(d){s(d instanceof S?d.message:"Could not add the site.")}});return e.jsx($,{open:t,onOpenChange:i,children:e.jsx(D,{children:e.jsxs("form",{onSubmit:b,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(I,{children:[e.jsx(L,{children:"Add a site"}),e.jsx(P,{children:"One client website. The tag it needs is shown right after."})]}),a&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:a}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(p,{htmlFor:"site-name",children:"Name"}),e.jsx(h,{id:"site-name",placeholder:"Kilnwork","aria-invalid":!!n.errors.name,...o("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(p,{htmlFor:"site-domain",children:"Domain"}),e.jsx(h,{id:"site-domain",placeholder:"kilnwork.studio","aria-invalid":!!n.errors.domain,...o("domain")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Every subdomain, scheme and port of it may run the widget — staging, previews, and localhost while you build. Exact addresses elsewhere can be added in Settings."})]}),e.jsxs(z,{children:[e.jsx(l,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(l,{type:"submit",disabled:n.isSubmitting,children:n.isSubmitting?"Adding…":"Add site"})]})]})})})}export{re as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as y,x as n,P as u,o,Q as i,N as c}from"./index-C87aqO18.js";function d(){const e=y(),r=n.me().queryKey;return u({mutationFn:a=>o.renameOrg(a),onMutate:async a=>{await e.cancelQueries({queryKey:r});const t=e.getQueryData(r);return t&&e.setQueryData(r,{...t,org:{...t.org,name:a}}),{was:t}},onError:(a,t,s)=>{s?.was&&e.setQueryData(r,s.was),i.error(c(a))},onSettled:()=>e.invalidateQueries({queryKey:r})})}function q(){const e=y(),r=n.me().queryKey;return u({mutationFn:a=>o.renameMe(a),onMutate:async a=>{await e.cancelQueries({queryKey:r});const t=e.getQueryData(r);return t&&e.setQueryData(r,{...t,user:{...t.user,name:a}}),{was:t}},onError:(a,t,s)=>{s?.was&&e.setQueryData(r,s.was),i.error(c(a))},onSettled:()=>{e.invalidateQueries({queryKey:r}),e.invalidateQueries({queryKey:n.members().queryKey})}})}function f(){return u({mutationFn:e=>o.changePassword(e.current,e.next)})}function l(){const e=y();return u({mutationFn:r=>o.addMember(r),onSuccess:r=>e.setQueryData(n.members().queryKey,r)})}function w(){const e=y(),r=n.members().queryKey;return u({mutationFn:a=>o.setMemberRole(a.email,a.role),onMutate:async({email:a,role:t})=>{await e.cancelQueries({queryKey:r});const s=e.getQueryData(r);return s&&e.setQueryData(r,{data:s.data.map(m=>m.email===a?{...m,role:t}:m)}),{was:s}},onSuccess:(a,{email:t})=>{e.setQueryData(r,a),a.data.find(s=>s.email===t)?.you&&e.invalidateQueries({queryKey:n.me().queryKey})},onError:(a,t,s)=>{s?.was&&e.setQueryData(r,s.was),i.error(c(a))}})}function D(){const e=y(),r=n.members().queryKey;return u({mutationFn:a=>o.removeMember(a),onMutate:async a=>{await e.cancelQueries({queryKey:r});const t=e.getQueryData(r);return t&&e.setQueryData(r,{data:t.data.filter(s=>s.email!==a)}),{was:t}},onSuccess:a=>e.setQueryData(r,a),onError:(a,t,s)=>{s?.was&&e.setQueryData(r,s.was),i.error(c(a))}})}export{f as a,d as b,w as c,D as d,l as e,q as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,O as o}from"./index-C87aqO18.js";const n=()=>t.jsx(o,{});export{n as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as U,r as x,P as v,o as y,Q as b,N as w,j as e,B as j,x as S,A as M}from"./index-C87aqO18.js";import{u as A}from"./useQuery-COJ09EkU.js";import{L as k,I as N}from"./label-BfMHjFA7.js";import{E as R,G as E,I as K,H as $,J as I,K as T}from"./dialog-DrrnCoT5.js";import{C as B}from"./ConfirmDialog-CCAJDc_P.js";import{a as C,P as L}from"./parts-B-HQayFH.js";import{b as D}from"./labels--UUyt9uB.js";import{S as O}from"./SaveState-BsrfwjoH.js";import{u as _}from"./me-D1prnPpY.js";import{b as z}from"./studio-DVFn025O.js";import{c as G}from"./update-duXzIzFS.js";import"./useBaseQuery-0OqUJMfc.js";import"./createBaseUIEventDetails-CEmaecLi.js";import"./createLucideIcon-llnWWh0E.js";import"./card-8T0wnIiU.js";function q({owner:n}){const t=A(S.instance()),h=U(),s=()=>h.invalidateQueries({queryKey:S.instance().queryKey}),[u,c]=x.useState(!1),[g,p]=x.useState(!1),[f,d]=x.useState(null),i=v({mutationFn:y.disconnectStorage,onSuccess:()=>void s(),onError:m=>b.error(w(m))}),r=v({mutationFn:y.disconnectMail,onSuccess:()=>void s(),onError:m=>b.error(w(m))}),l=v({mutationFn:y.testMail,onSuccess:m=>b.success(`Sent to ${m.to}`),onError:m=>b.error(w(m))}),o=t.data?.storage,a=t.data?.mail;return e.jsxs(e.Fragment,{children:[e.jsxs(C,{title:"Storage",description:"The bucket screenshots and files go to. Without one the widget runs in annotation mode.",children:[!t.data&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:t.isError?"Could not read it.":"Reading…"}),o&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(F,{tone:o.connected?"ok":o.unreadable?"bad":"off",text:o.connected?`Connected · ${o.bucket} at ${(o.endpoint??"").replace(/^https?:\/\//,"")}${o.connectedAt?` · since ${D(o.connectedAt)}`:""}`:o.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."}),o.source==="env"?e.jsx(P,{what:"SNAGSET_STORAGE_S3_*"}):n?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j,{variant:"outline",size:"sm",onClick:()=>c(!0),children:o.connected||o.unreadable?"Replace…":"Connect a bucket…"}),(o.connected||o.unreadable)&&e.jsx(j,{variant:"ghost",size:"sm",onClick:()=>d("storage"),children:"Disconnect"})]}):null]})]}),e.jsx(C,{title:"Mail",description:"How notifications go out. Without a transport they are off, and the instance says so.",children:a&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(F,{tone:a.configured?"ok":a.unreadable?"bad":"off",text:a.configured?`${a.scheme==="resend"?"Resend":`SMTP · ${a.host??""}`} · from ${a.from}${a.updatedAt?` · since ${D(a.updatedAt)}`:""}`:a.unreadable?"A transport is stored but its secret will not decrypt — the secret key changed. Connect it again.":"No transport — notifications are off."}),a.source==="env"?e.jsx(P,{what:"SNAGSET_MAIL_URL"}):n?e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(j,{variant:"outline",size:"sm",onClick:()=>p(!0),children:a.configured||a.unreadable?"Replace…":"Connect a transport…"}),a.configured&&e.jsx(j,{variant:"outline",size:"sm",disabled:l.isPending,onClick:()=>l.mutate(),children:l.isPending?"Sending…":"Send a test email"}),(a.configured||a.unreadable)&&e.jsx(j,{variant:"ghost",size:"sm",onClick:()=>d("mail"),children:"Disconnect"})]}):(a.configured&&n===!1,null)]})}),e.jsx(H,{open:u,onOpenChange:c,onDone:()=>void s()}),e.jsx(Q,{open:g,onOpenChange:p,onDone:()=>void s()}),e.jsx(B,{open:f!==null,onOpenChange:m=>!m&&d(null),title:f==="storage"?"Disconnect the bucket?":"Disconnect the mail transport?",description:f==="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:i.isPending||r.isPending,onConfirm:async()=>{f==="storage"?await i.mutateAsync():await r.mutateAsync(),d(null)}})]})}function F({tone:n,text:t}){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:t})]})}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 H({open:n,onOpenChange:t,onDone:h}){const[s,u]=x.useState({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),[c,g]=x.useState(""),p=v({mutationFn:y.connectStorage}),f=r=>l=>u({...s,[r]:l.target.value}),d=async r=>{r.preventDefault(),g("");try{await p.mutateAsync({endpoint:s.endpoint.trim(),bucket:s.bucket.trim(),accessKeyId:s.accessKeyId.trim(),secretAccessKey:s.secretAccessKey,...s.region.trim()?{region:s.region.trim()}:{},...s.publicBaseUrl.trim()?{publicBaseUrl:s.publicBaseUrl.trim()}:{}}),u({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),t(!1),h(),b.success("Bucket connected — screenshots are on")}catch(l){g(l instanceof M?l.message:"Could not reach the server.")}},i=(r,l,o,a="text",m)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:`st-${r}`,children:l}),e.jsx(N,{id:`st-${r}`,type:a,placeholder:o,value:s[r],onChange:f(r),autoComplete:"off"}),m&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:m})]});return e.jsx(R,{open:n,onOpenChange:t,children:e.jsx(E,{children:e.jsxs("form",{onSubmit:r=>void d(r),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(K,{children:[e.jsx($,{children:"Connect a bucket"}),e.jsx(I,{children:"Any S3-compatible bucket. It is probed — write, read, delete — before anything is saved, and the keys are stored encrypted with this instance's secret key."})]}),c&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:c}),i("endpoint","Endpoint","https://ams3.digitaloceanspaces.com"),i("bucket","Bucket","snagset"),i("region","Region","auto","text","Leave empty for providers that do not use one."),i("accessKeyId","Access key ID",""),i("secretAccessKey","Secret access key","","password"),i("publicBaseUrl","Public base URL","","text","Optional — only if the bucket is served from a CDN address."),e.jsxs(T,{children:[e.jsx(j,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),e.jsx(j,{type:"submit",disabled:p.isPending,children:p.isPending?"Probing…":"Connect"})]})]})})})}function Q({open:n,onOpenChange:t,onDone:h}){const[s,u]=x.useState(""),[c,g]=x.useState(""),[p,f]=x.useState(""),d=v({mutationFn:y.connectMail}),i=async r=>{r.preventDefault(),f("");try{await d.mutateAsync({url:s.trim(),from:c.trim()}),u(""),g(""),t(!1),h(),b.success("Transport connected — send a test email to be sure")}catch(l){f(l instanceof M?l.message:"Could not reach the server.")}};return e.jsx(R,{open:n,onOpenChange:t,children:e.jsx(E,{children:e.jsxs("form",{onSubmit:r=>void i(r),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(K,{children:[e.jsx($,{children:"Connect a mail transport"}),e.jsx(I,{children:"Resend is the easy one — the provider owns SPF and DKIM. SMTP works with any provider. The URL is stored encrypted with this instance's secret key."})]}),p&&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:p}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:"mail-url",children:"Transport"}),e.jsx(N,{id:"mail-url",type:"password",placeholder:"resend://re_… or smtp://user:pass@host:587",value:s,onChange:r=>u(r.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:"mail-from",children:"From"}),e.jsx(N,{id:"mail-from",placeholder:"Snagset <review@kilnwork.studio>",value:c,onChange:r=>g(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(T,{children:[e.jsx(j,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),e.jsx(j,{type:"submit",disabled:d.isPending||!s.trim()||!c.trim(),children:d.isPending?"Saving…":"Connect"})]})]})})})}function le(){const n=_(),t=A(S.meta()),h=A(S.members()),s=z(),u=n.user.role==="owner",[c,g]=x.useState(n.org.name),[p,f]=x.useState(null);x.useEffect(()=>g(n.org.name),[n.org.name]);const d=u&&c.trim().length>0&&c.trim()!==n.org.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(L,{title:"General",sub:n.org.name,actions:e.jsx(O,{saving:s.isPending,savedAt:p})}),e.jsx(C,{title:"Studio",description:"The name at the top of every screen.",children:e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:i=>{i.preventDefault(),d&&s.mutate(c.trim(),{onSuccess:()=>f(Date.now())})},children:[e.jsx(k,{htmlFor:"studio-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(N,{id:"studio-name",value:c,readOnly:!u,onChange:i=>g(i.target.value)}),d&&e.jsx(j,{type:"submit",variant:"outline",children:"Save"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:u?"Shown at the top of the sidebar, above every site.":"Only an owner can change it."})]})}),e.jsx(C,{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:[t.data?.version??"—"," ",e.jsx(V,{version:t.data?.version??""})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Address"}),e.jsx("dd",{className:"m-0 font-mono text-[12px] text-ink-soft",children:location.origin}),t.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:[t.data.commit.slice(0,12),t.data.modified?" · modified":""]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Sites · members"}),e.jsxs("dd",{className:"m-0",children:[n.projects.length," · ",h.data?.data.length??"—"]})]})}),e.jsx(q,{owner:u})]})}function V({version:n}){const[t,h]=x.useState({s:"idle"});return t.s==="idle"?e.jsxs(e.Fragment,{children:["·"," ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>{h({s:"checking"}),G(n).then(s=>h({s:"done",r:s})).catch(()=>h({s:"failed"}))},children:"Check for updates"})," ",e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"— from your browser, never from the server"})]}):t.s==="checking"?e.jsx("span",{className:"text-muted-foreground",children:"· checking…"}):t.s==="failed"?e.jsx("span",{className:"text-muted-foreground",children:"· could not reach npm"}):e.jsx("span",{className:"text-muted-foreground",children:t.r?.newer?`· ${t.r.latest} is out`:"· up to date"})}export{le as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as B,r as i,P,Q as T,N as K,o as S,T as W,j as e,B as y,S as ne,A as J,x as q}from"./index-C87aqO18.js";import{u as G}from"./useQuery-COJ09EkU.js";import{B as U}from"./badge-CGEswzew.js";import{E as F,G as $,I as E,H as L,J as D,K as O}from"./dialog-DrrnCoT5.js";import{L as C,I as A}from"./label-BfMHjFA7.js";import{C as z}from"./ConfirmDialog-CCAJDc_P.js";import{P as oe,a as Q}from"./parts-B-HQayFH.js";import{C as _}from"./CopyButton-exuJDdXj.js";import{b as V}from"./labels--UUyt9uB.js";import{u as ae}from"./me-D1prnPpY.js";import"./useBaseQuery-0OqUJMfc.js";import"./useRender-dtgBGlgC.js";import"./createLucideIcon-llnWWh0E.js";import"./createBaseUIEventDetails-CEmaecLi.js";import"./card-8T0wnIiU.js";import"./check-CiLHTeII.js";import"./copy-CKgsZbj1.js";const re={ok:{label:"Healthy",tone:"ok"},needs_reauth:{label:"Needs a new token",tone:"bad"},error:{label:"Failing",tone:"bad"}};function $e(){const r=ae(),c=r.user.role==="owner",p=G(q.integrations()),g=B(),x=()=>g.invalidateQueries({queryKey:["integrations"]}),[j,l]=i.useState(null),[m,d]=i.useState(null),[b,h]=i.useState(null),k=P({mutationFn:t=>S.regenerateGitHubWebhook(t),onSuccess:({webhook:t},s)=>h({site:s,provider:"github",hook:t,fresh:!1}),onError:t=>T.error(K(t))}),v=P({mutationFn:({uid:t,provider:s})=>S.testTracker(t,s).then(o=>({...o,provider:s})),onSuccess:t=>{T[t.ok?"success":"error"](t.ok?`${W[t.provider]} can see ${t.target}`:t.detail??`${W[t.provider]} refused the token`),x()},onError:t=>T.error(K(t))}),N=P({mutationFn:({uid:t,provider:s})=>S.disconnectTracker(t,s),onSuccess:()=>{d(null),x()},onError:t=>T.error(K(t))}),a=p.data?.data??[],f=t=>a.filter(s=>s.provider===t),u=t=>r.projects.filter(s=>!f(t).some(o=>o.site===s.uid));return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(oe,{title:"Integrations",sub:"Mirrors converge on the comment's status here; Slack only announces"}),["github","linear","jira","slack"].map(t=>{const s=f(t),o=u(t);return e.jsxs(Q,{title:W[t],description:t==="github"?"A comment becomes an issue in the site's repository, with the brief as its body; resolving it here closes the issue there, and closing it there resolves it here. A fine-grained token per site — no OAuth app to register.":t==="linear"?"A comment becomes an issue in the site's team, with the brief as its body; our status moves it between the team's workflow states by type, and a webhook from Linear moves it back. A personal API key per site — no OAuth app to register.":t==="jira"?"A comment becomes an issue in the site's Jira project, with the brief as its description; our status moves it through the workflow by status category, and a webhook from Jira moves it back. An API token with the account's email — what Atlassian gives a self-hoster.":"One message per comment in a channel, edited in place as the status moves — never a second message, never a reply. A bot token from an app you create in a click from our manifest; Slack sends nothing back.",children:[p.isPending&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:"Reading…"}),p.isSuccess&&s.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(U,{variant:"outline",children:"Not connected"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:t==="github"?"No site is connected to a repository yet.":t==="linear"?"No site is connected to a team yet.":t==="jira"?"No site is connected to a project yet.":"No site is connected to a channel yet."})]}),s.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:s.map(n=>{const I=re[n.health]??{label:n.health,tone:"warn"};return e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-border px-3 py-2.5 text-[13px]",children:[e.jsx("span",{className:"font-medium",children:n.siteName??n.site}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("code",{className:"font-mono text-[12.5px]",children:n.provider==="github"?`${n.owner}/${n.repo}`:n.provider==="linear"?`${n.teamKey} · ${n.teamName}`:n.provider==="jira"?`${n.projectKey} · ${n.projectName}`:`#${n.channelName} · ${n.teamName}`}),e.jsx(U,{variant:"outline",className:I.tone==="ok"?"border-ok text-ok":I.tone==="bad"?"border-destructive text-destructive":"",children:I.label}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[n.provider==="slack"?n.createOn==="thread.created"?"A message for every new comment":"Messages when you ask, from the brief":n.createOn==="thread.created"?"An issue for every new comment":"Issues when you ask, from the brief",n.provider==="github"&&n.labels.length?` · labels ${n.labels.join(", ")}`:"",n.provider!=="github"&&n.provider!=="slack"&&!n.hasWebhookSecret?` · no webhook secret yet, so ${W[n.provider]} cannot move comments here`:""," · ",V(n.updatedAt)]}),n.lastError&&e.jsx("span",{className:"basis-full text-[12px] text-destructive",children:n.lastError}),c&&e.jsxs("span",{className:"ml-auto flex gap-1",children:[n.provider==="github"?e.jsx(y,{variant:"ghost",size:"sm",disabled:k.isPending,onClick:()=>k.mutate(n.site),children:"Webhook…"}):n.provider==="slack"?null:e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>h({site:n.site,provider:n.provider,hook:{url:`${location.origin}/api/v1/integrations/${n.provider}/inbound`},fresh:!1}),children:"Webhook…"}),e.jsx(y,{variant:"ghost",size:"sm",disabled:v.isPending,onClick:()=>v.mutate({uid:n.site,provider:n.provider}),children:"Test"}),e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>d(n),children:"Disconnect"})]})]},`${n.provider}:${n.site}`)})}),c&&o.length>0&&e.jsx("div",{children:e.jsx(y,{variant:"outline",size:"sm",onClick:()=>l(t),children:"Connect a site…"})})]},t)}),e.jsx(he,{owner:c,sites:r.projects}),e.jsx(ie,{open:j==="github",onOpenChange:t=>!t&&l(null),sites:u("github"),onDone:(t,s)=>{x(),s&&h({site:t,provider:"github",hook:s,fresh:!0})}}),e.jsx(le,{open:j==="linear",onOpenChange:t=>!t&&l(null),sites:u("linear"),onDone:(t,s)=>{x(),h({site:t,provider:"linear",hook:s,fresh:!0})}}),e.jsx(de,{open:j==="jira",onOpenChange:t=>!t&&l(null),sites:u("jira"),onDone:(t,s)=>{x(),h({site:t,provider:"jira",hook:s,fresh:!0})}}),e.jsx(me,{open:j==="slack",onOpenChange:t=>!t&&l(null),sites:u("slack"),onDone:()=>void x()}),e.jsx(ce,{state:b,onClose:()=>h(null),siteName:t=>a.find(s=>s.site===t)?.siteName??"the site"}),e.jsx(z,{open:m!==null,onOpenChange:t=>!t&&d(null),title:`Disconnect ${m?.siteName??"this site"} from ${m?W[m.provider]:"the tracker"}?`,description:m?.provider==="slack"?e.jsx(e.Fragment,{children:"Messages already posted stay in the channel; no new ones are posted and they stop being updated. The token is forgotten."}):e.jsx(e.Fragment,{children:"Issues already made keep their links; no new ones are made and status stops mirroring. The token is forgotten."}),confirmLabel:"Disconnect",busy:N.isPending,onConfirm:async()=>{m&&await N.mutateAsync({uid:m.site,provider:m.provider})}})]})}function ie({open:r,onOpenChange:c,sites:p,onDone:g}){const[x,j]=i.useState(""),[l,m]=i.useState(""),[d,b]=i.useState(""),[h,k]=i.useState(""),[v,N]=i.useState(!1),[a,f]=i.useState(""),u=P({mutationFn:o=>S.connectTracker(o,"github",{repository:l.trim(),token:d.trim(),labels:h,createOn:v?"thread.created":"manual"})}),t=x||p[0]?.uid||"",s=async o=>{o.preventDefault(),f("");try{const n=await u.mutateAsync(t);m(""),b(""),k(""),N(!1),c(!1),g(t,n.webhook&&"secret"in n.webhook?n.webhook:void 0),T.success("GitHub connected")}catch(n){f(n instanceof J?n.message:"Could not reach the server.")}};return e.jsx(F,{open:r,onOpenChange:c,children:e.jsx($,{children:e.jsxs("form",{onSubmit:o=>void s(o),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(E,{children:[e.jsx(L,{children:"Connect a site to GitHub"}),e.jsxs(D,{children:["A fine-grained personal access token with ",e.jsx("b",{children:"Issues: read and write"})," on that one repository. It is checked against the repository before it is saved, and stored encrypted with this instance's secret key."]})]}),a&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:a}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-site",children:"Site"}),e.jsx("select",{id:"gh-site",value:t,onChange:o=>j(o.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:p.map(o=>e.jsx("option",{value:o.uid,children:o.name},o.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-repo",children:"Repository"}),e.jsx(A,{id:"gh-repo",placeholder:"kilnwork/site",value:l,onChange:o=>m(o.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-token",children:"Token"}),e.jsx(A,{id:"gh-token",type:"password",placeholder:"github_pat_…",value:d,onChange:o=>b(o.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-labels",children:"Labels"}),e.jsx(A,{id:"gh-labels",placeholder:"review, bug",value:h,onChange:o=>k(o.target.value)}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Applied to every issue this makes. Optional."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:o=>N(o.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:'Off by default: a reviewer walking a site leaves twenty comments and half are "never mind". Make issues from the brief when you mean it.'})]})]}),e.jsxs(O,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(y,{type:"submit",disabled:u.isPending||!l.trim()||!d.trim()||!t,children:u.isPending?"Checking…":"Connect"})]})]})})})}function ce({state:r,onClose:c,siteName:p}){const g=r&&"secret"in r.hook?r.hook.secret:null;return e.jsx(F,{open:r!==null,onOpenChange:x=>!x&&c(),children:e.jsxs($,{children:[e.jsxs(E,{children:[e.jsx(L,{children:r?.fresh?"Connected — now the webhook":"Webhook for "+(r?p(r.site):"")}),e.jsx(D,{children:r?.provider==="linear"?"Issues moved in Linear move the comment here. In Linear › Settings › API › Webhooks, create one for the team with this URL and Issue events; then paste its signing secret when connecting or replacing the connection.":r?.provider==="jira"?"Issues moved in Jira move the comment here. In Jira › Settings › System › Webhooks, create one with this URL, the events Issue updated and Issue deleted, and a secret; then paste the same secret when connecting or replacing the connection.":`Issues closed or reopened on GitHub move the comment here. Add a webhook to the repository — Settings › Webhooks › Add webhook — with these values. The secret is shown this once${r?.fresh?"":", and the previous one has stopped working"}.`})]}),r&&e.jsxs("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Payload URL"}),e.jsxs("dd",{className:"m-0 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]",children:r.hook.url}),e.jsx(_,{text:r.hook.url,label:"Copy the payload URL"})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Content type"}),e.jsx("dd",{className:"m-0",children:e.jsx("code",{className:"font-mono text-[12px]",children:"application/json"})}),g&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Secret"}),e.jsxs("dd",{className:"m-0 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]","data-testid":"webhook-secret",children:g}),e.jsx(_,{text:g,label:"Copy the secret"})]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Events"}),e.jsx("dd",{className:"m-0",children:r.provider==="linear"?"Issues":r.provider==="jira"?"Issue: updated, deleted":"Let me select individual events → Issues"})]}),e.jsx(O,{children:e.jsx(y,{type:"button",onClick:c,children:"Done"})})]})})}function le({open:r,onOpenChange:c,sites:p,onDone:g}){const[x,j]=i.useState(""),[l,m]=i.useState(""),[d,b]=i.useState(""),[h,k]=i.useState(""),[v,N]=i.useState(!1),[a,f]=i.useState(""),u=P({mutationFn:o=>S.connectTracker(o,"linear",{team:l.trim(),apiKey:d.trim(),...h.trim()?{webhookSecret:h.trim()}:{},createOn:v?"thread.created":"manual"})}),t=x||p[0]?.uid||"",s=async o=>{o.preventDefault(),f("");try{const n=await u.mutateAsync(t);m(""),b(""),k(""),N(!1),c(!1),g(t,n.webhook??{url:`${location.origin}/api/v1/integrations/linear/inbound`}),T.success("Linear connected")}catch(n){f(n instanceof J?n.message:"Could not reach the server.")}};return e.jsx(F,{open:r,onOpenChange:c,children:e.jsx($,{children:e.jsxs("form",{onSubmit:o=>void s(o),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(E,{children:[e.jsx(L,{children:"Connect a site to Linear"}),e.jsx(D,{children:"A personal API key from Linear › Settings › API, belonging to a member of the team. It is checked against the team before it is saved, and stored encrypted with this instance's secret key."})]}),a&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:a}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-site",children:"Site"}),e.jsx("select",{id:"ln-site",value:t,onChange:o=>j(o.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:p.map(o=>e.jsx("option",{value:o.uid,children:o.name},o.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-team",children:"Team key"}),e.jsx(A,{id:"ln-team",placeholder:"ENG",value:l,onChange:o=>m(o.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The prefix of the team's issues, like the ENG in ENG-123."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-key",children:"API key"}),e.jsx(A,{id:"ln-key",type:"password",placeholder:"lin_api_…",value:d,onChange:o=>b(o.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-secret",children:"Webhook signing secret"}),e.jsx(A,{id:"ln-secret",type:"password",placeholder:"from Linear's webhook, optional",value:h,onChange:o=>k(o.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Lets Linear move comments here when issues move there. The URL to give Linear is shown after connecting."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:o=>N(o.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(O,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(y,{type:"submit",disabled:u.isPending||!l.trim()||!d.trim()||!t,children:u.isPending?"Checking…":"Connect"})]})]})})})}function de({open:r,onOpenChange:c,sites:p,onDone:g}){const[x,j]=i.useState(""),[l,m]=i.useState(""),[d,b]=i.useState(""),[h,k]=i.useState(""),[v,N]=i.useState(""),[a,f]=i.useState(""),[u,t]=i.useState(!1),[s,o]=i.useState(""),n=P({mutationFn:w=>S.connectTracker(w,"jira",{siteUrl:l.trim(),project:d.trim(),email:h.trim(),apiToken:v.trim(),...a.trim()?{webhookSecret:a.trim()}:{},createOn:u?"thread.created":"manual"})}),I=x||p[0]?.uid||"",X=async w=>{w.preventDefault(),o("");try{const R=await n.mutateAsync(I);b(""),N(""),f(""),t(!1),c(!1),g(I,R.webhook??{url:`${location.origin}/api/v1/integrations/jira/inbound`}),T.success("Jira connected")}catch(R){o(R instanceof J?R.message:"Could not reach the server.")}},M=(w,R,Y,Z,ee,te="text",H)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:`jr-${w}`,children:R}),e.jsx(A,{id:`jr-${w}`,type:te,placeholder:ee,value:Y,onChange:se=>Z(se.target.value),autoComplete:"off"}),H&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:H})]});return e.jsx(F,{open:r,onOpenChange:c,children:e.jsx($,{children:e.jsxs("form",{onSubmit:w=>void X(w),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(E,{children:[e.jsx(L,{children:"Connect a site to Jira"}),e.jsx(D,{children:"An API token from id.atlassian.com › Security, with the email of the account it belongs to. It is checked against the project before it is saved, and stored encrypted with this instance's secret key."})]}),s&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:s}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"jr-site",children:"Site"}),e.jsx("select",{id:"jr-site",value:I,onChange:w=>j(w.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:p.map(w=>e.jsx("option",{value:w.uid,children:w.name},w.uid))})]}),M("url","Jira site",l,m,"https://kilnwork.atlassian.net"),M("project","Project key",d,b,"KAN","text","The prefix of the project's issues, like the KAN in KAN-12."),M("email","Account email",h,k,"you@kilnwork.studio","email"),M("token","API token",v,N,"","password"),M("secret","Webhook secret",a,f,"the secret you typed into Jira's webhook, optional","password","Lets Jira move comments here when issues move there. The URL to give Jira is shown after connecting."),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:u,onChange:w=>t(w.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(O,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(y,{type:"submit",disabled:n.isPending||!l.trim()||!d.trim()||!h.trim()||!v.trim()||!I,children:n.isPending?"Checking…":"Connect"})]})]})})})}function me({open:r,onOpenChange:c,sites:p,onDone:g}){const[x,j]=i.useState(""),[l,m]=i.useState(""),[d,b]=i.useState(""),[h,k]=i.useState(!0),[v,N]=i.useState(""),a=G({queryKey:["integrations","slack","manifest"],queryFn:()=>S.slackManifest(),enabled:r,staleTime:1/0}),f=P({mutationFn:s=>S.connectTracker(s,"slack",{channel:l.trim(),token:d.trim(),createOn:h?"thread.created":"manual"})}),u=x||p[0]?.uid||"",t=async s=>{s.preventDefault(),N("");try{await f.mutateAsync(u),m(""),b(""),k(!0),c(!1),g(u),T.success("Slack connected")}catch(o){N(o instanceof J?o.message:"Could not reach the server.")}};return e.jsx(F,{open:r,onOpenChange:c,children:e.jsx($,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(E,{children:[e.jsx(L,{children:"Connect a site to Slack"}),e.jsx(D,{children:"Create the app in your workspace from our manifest — one click, the scopes are filled in — install it, and paste its Bot User OAuth Token. The token is checked against the channel before it is saved, and stored encrypted with this instance's secret key."})]}),v&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:v}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-site",children:"Site"}),e.jsx("select",{id:"sl-site",value:u,onChange:s=>j(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:p.map(s=>e.jsx("option",{value:s.uid,children:s.name},s.uid))})]}),e.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border px-3 py-2 text-[13px]",children:[e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block font-medium",children:"1. Create the app"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Opens api.slack.com with the manifest pasted; then Install to Workspace."})]}),e.jsx(y,{type:"button",variant:"outline",size:"sm",disabled:!a.data,render:e.jsx("a",{href:a.data?.url??"#",target:"_blank",rel:"noreferrer"}),children:"Create app…"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-token",children:"2. Bot User OAuth Token"}),e.jsx(A,{id:"sl-token",type:"password",placeholder:"xoxb-…",value:d,onChange:s=>b(s.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"On the app's OAuth & Permissions page after installing."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-channel",children:"3. Channel"}),e.jsx(A,{id:"sl-channel",placeholder:"#reviews",value:l,onChange:s=>m(s.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"A public channel by name; a private one needs the app invited first, then its name works too."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:h,onChange:s=>k(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"A message for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"On by default: a channel is where people are told. Turn it off to post from the brief when you mean it."})]})]}),e.jsxs(O,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(y,{type:"submit",disabled:f.isPending||!l.trim()||!d.trim()||!u,children:f.isPending?"Checking…":"Connect"})]})]})})})}function he({owner:r,sites:c}){const p=B(),g=G(q.mcpTokens()),[x,j]=i.useState(!1),[l,m]=i.useState(null),[d,b]=i.useState(null),h=P({mutationFn:a=>S.revokeMcpToken(a),onSuccess:()=>{b(null),p.invalidateQueries({queryKey:["mcp-tokens"]})},onError:a=>T.error(K(a))}),k=g.data?.data??[],v=k.filter(a=>!a.revokedAt),N=a=>{const f=new Set(a),u=f.has("comments:write")||f.has("threads:write");return!u&&!f.has("context:read")?"Read-only":u?`Writes: ${[f.has("comments:write")?"reply":"",f.has("threads:write")?"mark ready":""].filter(Boolean).join(", ")}`:"Read-only, with capture context"};return e.jsxs(Q,{title:"MCP",description:"A coding agent — Claude Code, Cursor, any MCP client — reads the same brief this dashboard copies, maps a comment to the file in its checkout, and can reply or mark a fix ready. It never resolves: whoever reported a snag decides when it is fixed. A token per agent, shown once, revocable here.",children:[g.isPending&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:"Reading…"}),g.isSuccess&&v.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(U,{variant:"outline",children:"No tokens"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:"No agent can read this studio yet."})]}),k.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0","aria-label":"Agent tokens",children:k.map(a=>e.jsxs("li",{className:`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-border px-3 py-2.5 text-[13px] ${a.revokedAt?"opacity-60":""}`,children:[e.jsx("span",{className:"font-medium",children:a.name}),e.jsxs("code",{className:"font-mono text-[12.5px] text-muted-foreground",children:[a.prefix,"…"]}),e.jsx(U,{variant:"outline",className:a.revokedAt?"":"border-ok text-ok",children:a.revokedAt?"Revoked":N(a.scopes)}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[a.site?a.site.name:"All sites"," · ",a.lastUsedAt?`last used ${V(a.lastUsedAt)}`:"never used",a.expiresAt&&!a.revokedAt?` · expires ${new Date(a.expiresAt).toLocaleDateString()}`:"",a.createdBy?` · by ${a.createdBy}`:""]}),r&&!a.revokedAt&&e.jsx("span",{className:"ml-auto flex gap-1",children:e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>b(a),children:"Revoke"})})]},a.id))}),r&&e.jsx("div",{children:e.jsx(y,{variant:"outline",size:"sm",onClick:()=>j(!0),children:"New token…"})}),e.jsx(ue,{open:x,onOpenChange:j,sites:c,onDone:a=>{p.invalidateQueries({queryKey:["mcp-tokens"]}),m(a)}}),e.jsx(xe,{state:l,onClose:()=>m(null)}),e.jsx(z,{open:d!==null,onOpenChange:a=>!a&&b(null),title:`Revoke “${d?.name??""}”?`,description:e.jsx(e.Fragment,{children:"The agent holding it loses access on its next request. Its past replies stay, under its name. This cannot be undone — mint a new token instead."}),confirmLabel:"Revoke",busy:h.isPending,onConfirm:async()=>{d&&await h.mutateAsync(d.id)}})]})}function ue({open:r,onOpenChange:c,sites:p,onDone:g}){const[x,j]=i.useState(""),[l,m]=i.useState(""),[d,b]=i.useState(["threads:read","source:map"]),[h,k]=i.useState(""),[v,N]=i.useState(""),a=P({mutationFn:()=>S.mintMcpToken({name:x.trim(),...l?{site:l}:{},scopes:d,...h?{expiresInDays:Number(h)}:{}})}),f=(t,s)=>b(o=>s?[...new Set([...o,t])]:o.filter(n=>n!==t)),u=async t=>{t.preventDefault(),N("");try{const s=await a.mutateAsync();j(""),m(""),b(["threads:read","source:map"]),k(""),c(!1),g(s)}catch(s){N(s instanceof J?s.message:"Could not reach the server.")}};return e.jsx(F,{open:r,onOpenChange:c,children:e.jsx($,{children:e.jsxs("form",{onSubmit:t=>void u(t),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(E,{children:[e.jsx(L,{children:"New agent token"}),e.jsx(D,{children:"Read-only by default, plus mapping a comment to a file in the agent's own checkout. Tick more only for an agent you want writing here — and it still cannot resolve anything."})]}),v&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:v}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-name",children:"Name"}),e.jsx(A,{id:"mcp-name",placeholder:"Claude Code",value:x,onChange:t=>j(t.target.value),autoComplete:"off",maxLength:80}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"What a client sees on the agent's replies, so name the agent, not the person."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-site",children:"Site"}),e.jsxs("select",{id:"mcp-site",value:l,onChange:t=>m(t.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:[e.jsx("option",{value:"",children:"All sites"}),p.map(t=>e.jsx("option",{value:t.uid,children:t.name},t.uid))]})]}),e.jsxs("fieldset",{className:"m-0 flex flex-col gap-2 border-0 p-0",children:[e.jsx("legend",{className:"mb-1 text-[13px] font-medium",children:"Scopes"}),ne.map(t=>e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:d.includes(t.scope),onChange:s=>f(t.scope,s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:t.label}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:t.hint})]})]},t.scope))]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-expires",children:"Expires"}),e.jsxs("select",{id:"mcp-expires",value:h,onChange:t=>k(t.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:[e.jsx("option",{value:"",children:"Never"}),e.jsx("option",{value:"30",children:"In 30 days"}),e.jsx("option",{value:"90",children:"In 90 days"}),e.jsx("option",{value:"365",children:"In a year"})]})]}),e.jsxs(O,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(y,{type:"submit",disabled:a.isPending||!x.trim()||d.length===0,children:a.isPending?"Minting…":"Create token"})]})]})})})}function xe({state:r,onClose:c}){const p=typeof location<"u"?location.origin:"",g={SNAGSET_MCP_TOKEN:r?.secret??"",SNAGSET_MCP_HOST:p,...r?.token.site?{SNAGSET_MCP_PROJECT:r.token.site.uid}:{}},x=JSON.stringify({mcpServers:{snagset:{command:"npx",args:["-y","@snagset/mcp"],env:g}}},null,2),j=["claude mcp add snagset",...Object.entries(g).map(([l,m])=>`-e ${l}=${m}`),"--","npx -y @snagset/mcp"].join(" ");return e.jsx(F,{open:r!==null,onOpenChange:l=>!l&&c(),children:e.jsxs($,{className:"max-w-xl",children:[e.jsxs(E,{children:[e.jsxs(L,{children:["Token for “",r?.token.name??"","”"]}),e.jsx(D,{children:"Shown this once — only its hash is stored. Put it in the agent's config, then start the agent from the site's checkout so it can map comments to files."})]}),r&&e.jsxs("div",{className:"flex flex-col gap-4 text-[13px]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1.5 font-mono text-[12px]","data-testid":"mcp-token",children:r.secret}),e.jsx(_,{text:r.secret,label:"Copy the token"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Claude Code"}),e.jsx(_,{text:j,label:"Copy the Claude Code command"})]}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:j})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Cursor, Claude Desktop, any MCP client"}),e.jsx(_,{text:x,label:"Copy the JSON config"})]}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:x}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Cursor reads it from .cursor/mcp.json in the project; Claude Desktop from its claude_desktop_config.json."})]})]}),e.jsx(O,{children:e.jsx(y,{type:"button",onClick:c,children:"Done"})})]})})}export{$e as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,e as y,r as f,B as x,N,z as A,C as p,_ as C,x as R}from"./index-C87aqO18.js";import{u as T}from"./useQuery-COJ09EkU.js";import{u as S,a as D}from"./zod-iC-UhR5u.js";import{A as M,a as E}from"./avatar-BITl2vTh.js";import{B as F}from"./badge-CGEswzew.js";import{C as k}from"./card-8T0wnIiU.js";import{X as B,E as H,G as P,I as z,H as I,J as O,K as L}from"./dialog-DrrnCoT5.js";import{L as m,I as u}from"./label-BfMHjFA7.js";import{T as $,a as V,b as j,c as d,d as _,e as c}from"./table-DkqScFZb.js";import{C as q}from"./ConfirmDialog-CCAJDc_P.js";import{P as G}from"./parts-B-HQayFH.js";import{a as J}from"./labels--UUyt9uB.js";import{u as K}from"./me-D1prnPpY.js";import{c as Q,d as X,e as Y}from"./studio-DVFn025O.js";import{P as U}from"./plus-CuMhvZUZ.js";import"./useBaseQuery-0OqUJMfc.js";import"./useRender-dtgBGlgC.js";import"./createLucideIcon-llnWWh0E.js";import"./createBaseUIEventDetails-CEmaecLi.js";function b({className:s,...a}){return e.jsx("select",{className:y("h-8 rounded-md border border-input bg-card px-2.5 text-[13.5px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50",s),...a})}function we(){const a=K().user.role==="owner",t=T(R.members()),[i,o]=f.useState(!1);return e.jsxs("div",{className:"p-7",children:[e.jsx(G,{title:"Members",sub:a?"Owners and admins can do everything; only owners change this list.":"Owners and admins can do everything. Ask an owner to change this list.",actions:a?e.jsxs(x,{onClick:()=>o(!0),children:[e.jsx(U,{}),"Add member"]}):void 0}),e.jsx(k,{className:"max-w-[1040px] overflow-hidden py-0",children:e.jsxs($,{children:[e.jsx(V,{children:e.jsxs(j,{children:[e.jsx(d,{children:"Name"}),e.jsx(d,{children:"Email"}),e.jsx(d,{children:"Role"}),a&&e.jsx(d,{className:"w-0"})]})}),e.jsx(_,{children:(t.data?.data??[]).map(r=>e.jsx(W,{m:r,owner:a},r.email))})]})}),e.jsx("p",{className:"m-0 mt-3 max-w-[1040px] text-[12.5px] text-muted-foreground",children:"There is no invitation mail: an owner sets an initial password and hands it over, and the person changes it under You."}),a&&e.jsx(ee,{open:i,onOpenChange:o})]})}function W({m:s,owner:a}){const t=Q(),i=X(),[o,r]=f.useState(!1);return e.jsxs(j,{children:[e.jsx(c,{children:e.jsxs("span",{className:"flex items-center gap-2.5",children:[e.jsx(M,{className:"size-6",children:e.jsx(E,{className:"bg-brand-soft text-[10px] font-semibold text-brand",children:J(s.name,s.email)})}),e.jsx("span",{className:"font-medium",children:s.name||s.email}),s.you&&e.jsx(F,{variant:"outline",className:"text-[11px]",children:"you"})]})}),e.jsx(c,{className:"text-muted-foreground",children:s.email}),e.jsx(c,{children:a?e.jsxs(b,{"aria-label":`Role for ${s.email}`,value:s.role,onChange:h=>t.mutate({email:s.email,role:h.target.value}),children:[e.jsx("option",{value:"owner",children:"Owner"}),e.jsx("option",{value:"admin",children:"Admin"})]}):e.jsx("span",{className:"capitalize",children:s.role})}),a&&e.jsxs(c,{className:"text-right",children:[!s.you&&e.jsx(x,{variant:"ghost",size:"icon-sm","aria-label":`Remove ${s.email}`,onClick:()=>r(!0),children:e.jsx(B,{})}),e.jsx(q,{open:o,onOpenChange:r,title:`Remove ${s.name||s.email}?`,description:"Every session of theirs ends now. Nothing they wrote is destroyed.",confirmLabel:"Remove",busy:i.isPending,onConfirm:()=>{r(!1),i.mutate(s.email)}})]})]})}const Z=A({email:p().trim().email("An email address"),name:p().trim().max(120).optional(),role:C(["owner","admin"]),password:p().min(12,"At least 12 characters")});function ee({open:s,onOpenChange:a}){const t=Y(),[i,o]=f.useState(""),{register:r,handleSubmit:h,formState:n,reset:g}=S({resolver:D(Z),defaultValues:{role:"admin"}}),w=h(async l=>{o("");try{await t.mutateAsync({email:l.email,name:l.name??"",role:l.role,password:l.password}),g(),a(!1)}catch(v){o(N(v))}});return e.jsx(H,{open:s,onOpenChange:a,children:e.jsx(P,{children:e.jsxs("form",{onSubmit:w,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(z,{children:[e.jsx(I,{children:"Add a member"}),e.jsx(O,{children:"They sign in with this email and the password you set; there is no invitation mail, so you tell them the password yourself."})]}),i&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:i}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(m,{htmlFor:"member-email",children:"Email"}),e.jsx(u,{id:"member-email",type:"email",autoComplete:"off","aria-invalid":!!n.errors.email,...r("email")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(m,{htmlFor:"member-name",children:"Name"}),e.jsx(u,{id:"member-name",autoComplete:"off",...r("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(m,{htmlFor:"member-role",children:"Role"}),e.jsxs(b,{id:"member-role",className:"w-full",...r("role"),children:[e.jsx("option",{value:"admin",children:"Admin"}),e.jsx("option",{value:"owner",children:"Owner"})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(m,{htmlFor:"member-password",children:"Initial password"}),e.jsx(u,{id:"member-password",type:"text",autoComplete:"off","aria-invalid":!!n.errors.password,...r("password")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters — a short phrase of real words is fine. They can change it afterwards."})]}),e.jsxs(L,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(x,{type:"submit",disabled:n.isSubmitting,children:n.isSubmitting?"Adding…":"Add"})]})]})})})}export{we as component};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{c as t}from"./createLucideIcon-llnWWh0E.js";/**
|
|
2
|
+
* @license lucide-react v1.39.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const e=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],y=t("monitor",e);/**
|
|
7
|
+
* @license lucide-react v1.39.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const o=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],a=t("moon",o);/**
|
|
12
|
+
* @license lucide-react v1.39.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const c=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],h=t("sun",c);export{y as M,h as S,a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,e as l}from"./index-C87aqO18.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i="https://registry.npmjs.org/@snagset%2Fserver/latest";async function p(s){const e=await fetch(i,{signal:AbortSignal.timeout(6e3),headers:{accept:"application/json"}});if(!e.ok)throw new Error(`npm answered ${e.status}`);const t=await e.json();if(typeof t.version!="string")throw new Error("npm's answer carried no version");return{latest:t.version,newer:c(t.version,s)>0}}function c(s,e){const t=r=>r.replace(/^v/,"").split("-")[0].split(".").map(n=>parseInt(n,10)||0),[o,a]=[t(s),t(e)];for(let r=0;r<3;r++){const n=(o[r]??0)-(a[r]??0);if(n!==0)return n}return 0}export{p as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aF as N,aG as h,aH as O,aI as U,aJ as k,aK as B,aL as A,aM as y,aN as H,aO as V,aP as Q,aQ as F,r as p,aR as x,s as W}from"./index-C87aqO18.js";var st=class extends N{#e;#t=void 0;#f=void 0;#s=void 0;#a;#c;#i;#p;#u;#l;#n;#o;#r;#d=new Set;constructor(t,e){super(),this.options=e,this.#e=t,this.#i=null,this.bindMethods(),this.setOptions(e)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),w(this.#t,this.options)?this.#h():this.updateResult(),this.#S())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return E(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return E(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#m(),this.#g(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,s=this.#t;if(this.options=this.#e.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof h(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#O(),this.#t.setOptions(this.options),e._defaulted&&!O(this.options,e)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const i=this.hasListeners();i&&P(this.#t,s,this.options,e)&&this.#h(),this.updateResult(),i&&(this.#t!==s||h(this.options.enabled,this.#t)!==h(e.enabled,this.#t)||h(this.options.staleTime,this.#t)!==h(e.staleTime,this.#t))&&this.#R();const r=this.#v();i&&(this.#t!==s||h(this.options.enabled,this.#t)!==h(e.enabled,this.#t)||r!==this.#r)&&this.#y(r)}getOptimisticResult(t){const e=this.#e.getQueryCache().build(this.#e,t),s=this.createResult(e,t);return O(this.getCurrentResult(),s)||(this.#s=s,this.#c=this.options,this.#a=this.#t.state),s}getCurrentResult(){return this.#s}trackResult(t,e){return new Proxy(t,{get:(s,i)=>(this.trackProp(i),e?.(i),Reflect.get(s,i))})}trackProp(t){this.#d.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#e.defaultQueryOptions(t),s=this.#e.getQueryCache().build(this.#e,e);let i=()=>{},r;const c=new Promise(n=>{r=n,i=this.#e.getQueryCache().subscribe(u=>{u.type==="updated"&&u.query.queryHash===s.queryHash&&s.state.data!==void 0&&(i(),n(this.createResult(s,e)))})});return Promise.race([s.fetch().then(()=>{const n=this.createResult(s,e);return r?.(n),n}).finally(()=>{i()}),c])}fetch(t){return this.#h({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#s))}#h(t){this.#O();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(U)),e}#b(t){return!k()&&h(this.options.enabled,this.#t)!==!1&&B(t)}#R(){this.#m();const t=h(this.options.staleTime,this.#t);if(this.#s.isStale||!this.#b(t))return;const e=A(this.#s.dataUpdatedAt,t)+1;this.#n=y.setTimeout(()=>{this.#s.isStale||this.updateResult()},e)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(t){this.#g(),this.#r=t,!(this.#r===0||!this.#b(this.#r))&&(this.#o=y.setInterval(()=>{(this.options.refetchIntervalInBackground||H.isFocused())&&this.#h()},this.#r))}#S(){this.#R(),this.#y(this.#v())}#m(){this.#n!==void 0&&(y.clearTimeout(this.#n),this.#n=void 0)}#g(){this.#o!==void 0&&(y.clearInterval(this.#o),this.#o=void 0)}createResult(t,e){const s=this.#t,i=this.options,r=this.#s,c=this.#a,n=this.#c,u=t!==s?t.state:this.#f,{state:l}=t;let a={...l},d=!1,o;if(e._optimisticResults){const f=this.hasListeners(),D=!f&&w(t,e),L=f&&P(t,s,e,i);(D||L)&&(a={...a,...V(l.data,t.options)}),e._optimisticResults==="isRestoring"&&(a.fetchStatus="idle")}let{error:R,errorUpdatedAt:v,status:b}=a;o=a.data;let I=!1;if(e.placeholderData!==void 0&&o===void 0&&b==="pending"){let f;r?.isPlaceholderData&&e.placeholderData===n?.placeholderData?(f=r.data,I=!0):f=typeof e.placeholderData=="function"?e.placeholderData(this.#l?.state.data,this.#l):e.placeholderData,f!==void 0&&(b="success",o=Q(r?.data,f,e),d=!0)}if(e.select&&o!==void 0&&!I)if(r&&o===c?.data&&e.select===this.#p)o=this.#u;else try{this.#p=e.select,o=e.select(o),o=Q(r?.data,o,e),this.#u=o,this.#i=null}catch(f){this.#i=f}else o===void 0&&(this.#i=null);this.#i&&(R=this.#i,o=this.#u,v=Date.now(),b="error",d=!1);const S=a.fetchStatus==="fetching",m=b==="pending",g=b==="error",T=m&&S,M=o!==void 0;return{status:b,fetchStatus:a.fetchStatus,isPending:m,isSuccess:b==="success",isError:g,isInitialLoading:T,isLoading:T,data:o,dataUpdatedAt:a.dataUpdatedAt,error:R,errorUpdatedAt:v,failureCount:a.fetchFailureCount,failureReason:a.fetchFailureReason,errorUpdateCount:a.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:a.dataUpdateCount>u.dataUpdateCount||a.errorUpdateCount>u.errorUpdateCount,isFetching:S,isRefetching:S&&!m,isLoadingError:g&&!M,isPaused:a.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:g&&M,isStale:C(t,e),refetch:this.refetch,isEnabled:h(e.enabled,t)!==!1}}updateResult(){const t=this.#s,e=this.createResult(this.#t,this.options);if(this.#a=this.#t.state,this.#c=this.options,this.#a.data!==void 0&&(this.#l=this.#t),O(e,t))return;this.#s=e;const i=(()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,c=typeof r=="function"?r():r;if(c==="all"||!c&&!this.#d.size)return!0;const n=new Set(c??this.#d);return this.options.throwOnError&&n.add("error"),Object.keys(this.#s).some(u=>{const l=u;return this.#s[l]!==t[l]&&n.has(l)})})();F.batch(()=>{i&&this.listeners.forEach(r=>{r(this.#s)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}#O(){const t=this.#e.getQueryCache().build(this.#e,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#f=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#S()}};function j(t,e){return h(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&h(e.retryOnMount,t)===!1)}function w(t,e){return j(t,e)||t.state.data!==void 0&&E(t,e,e.refetchOnMount)}function E(t,e,s){if(h(e.enabled,t)!==!1&&h(e.staleTime,t)!=="static"){const i=typeof s=="function"?s(t):s;return i==="always"||i!==!1&&C(t,e)}return!1}function P(t,e,s,i){return(t!==e||h(i.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&C(t,s)}function C(t,e){return h(e.enabled,t)!==!1&&t.isStaleByTime(h(e.staleTime,t))}const _=p.createContext(!1),z=()=>p.useContext(_);_.Provider;function K(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}const G=p.createContext(K()),J=()=>p.useContext(G),X=(t,e,s)=>{const i=s?.state.error&&typeof t.throwOnError=="function"?x(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||i)&&(e.isReset()||(t.retryOnMount=!1))},Y=t=>{p.useEffect(()=>{t.clearReset()},[t])},Z=({result:t,errorResetBoundary:e,throwOnError:s,query:i,suspense:r})=>t.isError&&!e.isReset()&&!t.isFetching&&i&&(r&&t.data===void 0||x(s,[t.error,i])),it=(t,e)=>e.state.data===void 0,$=t=>{if(t.suspense){const s=r=>r==="static"?r:Math.max(r??1e3,1e3),i=t.staleTime;t.staleTime=typeof i=="function"?(...r)=>s(i(...r)):s(i),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},q=(t,e)=>t?.suspense&&e.isPending,tt=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function rt(t,e,s){const i=z(),r=J(),c=W(),n=c.defaultQueryOptions(t),u=c.getQueryCache().get(n.queryHash),l=t.subscribed!==!1;n._optimisticResults=i?"isRestoring":l?"optimistic":void 0,$(n),X(n,r,u),Y(r);const[a]=p.useState(()=>new e(c,n)),d=a.getOptimisticResult(n),o=!i&&l;if(p.useSyncExternalStore(p.useCallback(R=>{const v=o?a.subscribe(F.batchCalls(R)):U;return a.updateResult(),v},[a,o]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),p.useEffect(()=>{a.setOptions(n)},[n,a]),q(n,d))throw tt(n,a,r);if(Z({result:d,errorResetBoundary:r,throwOnError:n.throwOnError,query:u,suspense:n.suspense}))throw d.error;return n.notifyOnChangeProps?d:a.trackResult(d)}export{st as Q,it as d,rt as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as r,Q as u}from"./useBaseQuery-0OqUJMfc.js";function a(e,s){return r(e,u)}export{a as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as n}from"./index-C87aqO18.js";function u(e){return n(e.defaultTagName??"div",e,e)}export{u};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as e}from"./createLucideIcon-llnWWh0E.js";/**
|
|
2
|
+
* @license lucide-react v1.39.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const c=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],r=e("users",c);export{r as U};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{F as z,n as D,s as F,r as l,j as e,G as M,e as y,B as o,o as E,x as p,A as B}from"./index-C87aqO18.js";import{C as x}from"./card-8T0wnIiU.js";import{L as v,I as N}from"./label-BfMHjFA7.js";import{I as L}from"./InstallTag-CkeGLk1a.js";import{C as K}from"./check-CiLHTeII.js";import{c as S}from"./createLucideIcon-llnWWh0E.js";import{A as k}from"./arrow-left-D08BSlJU.js";import"./createBaseUIEventDetails-CEmaecLi.js";import"./copy-CKgsZbj1.js";/**
|
|
2
|
+
* @license lucide-react v1.39.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const P=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],h=S("arrow-right",P);/**
|
|
7
|
+
* @license lucide-react v1.39.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const Q=[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]],R=S("party-popper",Q),w=["Site","Address","Install"];function Z(){const{me:C,site:r}=z.useRouteContext(),A=D(),u=F(),[a,d]=l.useState(0),[n,I]=l.useState(r.name==="First project"?"":r.name),[c,q]=l.useState(""),[i,g]=l.useState(!1),[f,j]=l.useState(""),b=async(t,s)=>{g(!0),j("");try{await E.editSite(r.uid,t),t.domain&&u.setQueryData(p.origins(r.uid).queryKey,{domain:t.domain,origins:[]}),await u.invalidateQueries({queryKey:p.me().queryKey}),await u.fetchQuery(p.me()),s()}catch(m){j(m instanceof B?m.message:"Could not reach the server.")}finally{g(!1)}};return e.jsx("div",{className:"relative min-h-dvh bg-background",children:e.jsxs(M,{width:600,children:[e.jsxs("div",{className:"absolute right-6 top-5 text-[12.5px] text-muted-foreground",children:["Signed in as ",C.user.email]}),a<3&&e.jsx("ol",{className:"m-0 mb-6 flex list-none items-center gap-3.5 p-0","aria-label":"Steps",children:w.map((t,s)=>e.jsxs("li",{className:"flex items-center gap-2.5 text-[13.5px] font-medium",children:[e.jsx("span",{className:y("flex size-7 items-center justify-center rounded-full border-[1.5px] text-[12.5px]",s<a&&"border-brand bg-brand text-brand-foreground",s===a&&"border-brand text-brand ring-[3px] ring-brand-soft",s>a&&"border-line-strong text-muted-foreground"),"aria-current":s===a?"step":void 0,children:s<a?e.jsx(K,{className:"size-3.5"}):s+1}),e.jsx("span",{className:s===a?"text-foreground":"text-muted-foreground",children:t}),s<w.length-1&&e.jsx("span",{className:y("h-px w-[90px]",s<a?"bg-brand":"bg-border")})]},t))}),f&&e.jsx("p",{role:"alert",className:"m-0 mb-4 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:f}),a===0&&e.jsx(x,{className:"gap-4 p-7",children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:t=>{t.preventDefault(),!(!n.trim()||i)&&b({name:n.trim()},()=>d(1))},children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[21px] font-semibold leading-tight tracking-tight",children:"What is the site called?"}),e.jsx("p",{className:"m-0 mt-2 text-muted-foreground",children:"One client website. You can add more from Sites later."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(v,{htmlFor:"first-name",children:"Name"}),e.jsx(N,{id:"first-name",placeholder:"Kilnwork",value:n,onChange:t=>I(t.target.value),autoFocus:!0})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(o,{type:"submit",disabled:!n.trim()||i,children:[i?"Saving…":"Continue",e.jsx(h,{})]})})]})}),a===1&&e.jsx(x,{className:"gap-4 p-7",children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:t=>{t.preventDefault(),!(!c.trim()||i)&&b({domain:c.trim()},()=>d(2))},children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"m-0 text-[21px] font-semibold leading-tight tracking-tight",children:["Where does ",n||r.name," live?"]}),e.jsx("p",{className:"m-0 mt-2 text-muted-foreground",children:"Its domain. 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 the site's settings."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(v,{htmlFor:"first-domain",children:"Domain"}),e.jsx(N,{id:"first-domain",placeholder:"kilnwork.studio",value:c,onChange:t=>q(t.target.value),autoFocus:!0})]}),e.jsxs("div",{className:"flex items-center",children:[e.jsxs(o,{type:"button",variant:"ghost",onClick:()=>d(0),children:[e.jsx(k,{}),"Back"]}),e.jsx("div",{className:"flex-1"}),e.jsxs(o,{type:"submit",disabled:!c.trim()||i,children:[i?"Saving…":"Continue",e.jsx(h,{})]})]})]})}),a===2&&e.jsxs(x,{className:"gap-4 p-7",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[21px] font-semibold leading-tight tracking-tight",children:"Install the widget"}),e.jsxs("p",{className:"m-0 mt-2 text-muted-foreground",children:["Paste this before ",e.jsx("code",{className:"font-mono",children:"</body>"})," on every page you want reviewed, and deploy."]})]}),e.jsx(L,{uid:r.uid}),e.jsxs("div",{className:"flex items-center",children:[e.jsxs(o,{type:"button",variant:"ghost",onClick:()=>d(1),children:[e.jsx(k,{}),"Back"]}),e.jsx("div",{className:"flex-1"}),e.jsxs(o,{type:"button",onClick:()=>d(3),children:["Done",e.jsx(h,{})]})]})]}),a===3&&e.jsxs(x,{className:"items-center gap-4 p-8 text-center",children:[e.jsx("span",{className:"flex size-11 items-center justify-center rounded-[10px] bg-brand-soft text-brand",children:e.jsx(R,{className:"size-5"})}),e.jsxs("h1",{className:"m-0 text-[21px] font-semibold leading-tight tracking-tight",children:[n||r.name," is set up"]}),e.jsx("p",{className:"m-0 text-muted-foreground",children:"Three things left, in this order."}),e.jsx("ol",{className:"m-0 flex w-full list-none flex-col gap-2 p-0 text-left",children:[["Deploy the site with the tag on every page","Comments start arriving here the moment a page loads it."],["Add a reviewer and send them their link","Your client gets their own link; you can revoke it without touching the site."],["Start the first round","A round is one pass of feedback. Starting the next one closes the last."]].map(([t,s],m)=>e.jsxs("li",{className:"flex gap-3 rounded-md border border-border px-3 py-2.5",children:[e.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-full border border-line-strong text-[11px] text-muted-foreground",children:m+1}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-[13px] font-medium",children:t}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:s})]})]},t))}),e.jsxs(o,{size:"lg",className:"mt-2 w-full",onClick:()=>void A({to:"/s/$site/comments",params:{site:r.uid},replace:!0}),children:["Go to Comments",e.jsx(h,{})]})]})]})})}export{Z as component};
|