@snagset/server 0.1.48 → 0.1.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +4 -1
- package/dist/app.js.map +1 -1
- package/dist/config.generated.js +2 -1
- package/dist/config.generated.js.map +1 -1
- package/package.json +1 -1
- package/static/dashboard/assets/CompositeItem-BbRWtb9E.js +1 -0
- package/static/dashboard/assets/{CompositeList-mtQNqoEk.js → CompositeList-DSzQJXEH.js} +1 -1
- package/static/dashboard/assets/ConfirmDialog-CsaYGnmH.js +1 -0
- package/static/dashboard/assets/{CopyButton-SKsj8T-U.js → CopyButton-CSLYWvcG.js} +1 -1
- package/static/dashboard/assets/{FieldItemContext-Co44CWks.js → FieldItemContext-CbsQB6MT.js} +1 -1
- package/static/dashboard/assets/InstallTag-Dl1CTzWW.js +17 -0
- package/static/dashboard/assets/InstanceRows-BWWvIdNa.js +1 -0
- package/static/dashboard/assets/{McpTokens-zKXG6hus.js → McpTokens-P8ZSGR0X.js} +1 -1
- package/static/dashboard/assets/{SaveState-Cm1lse3W.js → SaveState-4EBQGYTP.js} +1 -1
- package/static/dashboard/assets/{_app-BmENyWPI.js → _app-B7KgtJFl.js} +2 -2
- package/static/dashboard/assets/{_app-DsElKgcr.js → _app-kEANU5X8.js} +1 -1
- package/static/dashboard/assets/{activity-3RgBB7Ym.js → activity-Cqc-ic6s.js} +1 -1
- package/static/dashboard/assets/{arrow-left-DJMsLCm0.js → arrow-left-CQMGC49D.js} +1 -1
- package/static/dashboard/assets/avatar-BMXOnJqe.js +1 -0
- package/static/dashboard/assets/{badge-DCAtXinr.js → badge-BdtzL033.js} +1 -1
- package/static/dashboard/assets/{card-D7_e6s9k.js → card-lXS88Xn6.js} +1 -1
- package/static/dashboard/assets/{check-6rTEdn4e.js → check-H4pMNyt3.js} +1 -1
- package/static/dashboard/assets/{chevron-down-DmbQVjuJ.js → chevron-down-D69c6VJS.js} +1 -1
- package/static/dashboard/assets/{chevron-right-CGy7PKlX.js → chevron-right-BHW_CTxR.js} +1 -1
- package/static/dashboard/assets/{copy-BdKRO_6P.js → copy-yXvXlo6x.js} +1 -1
- package/static/dashboard/assets/dialog-ldK1isp6.js +6 -0
- package/static/dashboard/assets/{dropdown-menu-B2sNOB_4.js → dropdown-menu-tpaW--kP.js} +3 -3
- package/static/dashboard/assets/{forgot-Bxa_0p7_.js → forgot-DQRN5qaE.js} +1 -1
- package/static/dashboard/assets/{image-off-DhoUHAUP.js → image-off-CB0_ptbu.js} +1 -1
- package/static/dashboard/assets/{index-CpZelV1d.js → index-HjQimqNo.js} +3 -3
- package/static/dashboard/assets/index-vKxPrBs3.css +1 -0
- package/static/dashboard/assets/inertValue-CpUwNw2H.js +1 -0
- package/static/dashboard/assets/{invite-BHUvOvP3.js → invite-s8N0zAHs.js} +1 -1
- package/static/dashboard/assets/isElementDisabled-CwHw_lZC.js +1 -0
- package/static/dashboard/assets/{label-BiZMzk6M.js → label-ZZ2_d1y3.js} +1 -1
- package/static/dashboard/assets/{layout-grid-DPEmad0M.js → layout-grid-CN8YFdmp.js} +1 -1
- package/static/dashboard/assets/me-B5kRPSVM.js +1 -0
- package/static/dashboard/assets/{parts-BkYmVS7_.js → parts-M1caoeIG.js} +1 -1
- package/static/dashboard/assets/{plus-5tGvow8N.js → plus-B7tL4dNn.js} +1 -1
- package/static/dashboard/assets/{reset-D50LaU8s.js → reset-B4BnOPfb.js} +1 -1
- package/static/dashboard/assets/{s._site-B2u8oM7J.js → s._site-CXi-FiZX.js} +1 -1
- package/static/dashboard/assets/{s._site.comments-DrRufLGX.js → s._site.comments-BEvoE6oY.js} +3 -3
- package/static/dashboard/assets/s._site.reviewers-yZQv1Eoh.js +1 -0
- package/static/dashboard/assets/s._site.settings-DtUyYGPG.js +1 -0
- package/static/dashboard/assets/serializeValue-B8e3iXO-.js +1 -0
- package/static/dashboard/assets/{setup-Dq336EvQ.js → setup-DqRZupA9.js} +1 -1
- package/static/dashboard/assets/{sign-in-DAjAlDpU.js → sign-in-DsSPt8dp.js} +1 -1
- package/static/dashboard/assets/{sign-up-Dvxszmvc.js → sign-up-NX5jKoWF.js} +1 -1
- package/static/dashboard/assets/sites-B2wMCxPO.js +1 -0
- package/static/dashboard/assets/{studio-DG3kKx9a.js → studio-BaiYvlZ6.js} +1 -1
- package/static/dashboard/assets/studio-oeTZnGud.js +1 -0
- package/static/dashboard/assets/studio.index-B-ghTzpK.js +1 -0
- package/static/dashboard/assets/studio.integrations-BVx-DE6h.js +1 -0
- package/static/dashboard/assets/{studio.members-cxypTb70.js → studio.members-CB6-TcLJ.js} +2 -2
- package/static/dashboard/assets/studio.plan-CZTdFexy.js +1 -0
- package/static/dashboard/assets/{sun-CSVVDe1X.js → sun-u2NbMis0.js} +1 -1
- package/static/dashboard/assets/{switch-ySGaYAH0.js → switch-Dkt5l7OO.js} +1 -1
- package/static/dashboard/assets/{table-CGtu9q6t.js → table-ituK8K36.js} +1 -1
- package/static/dashboard/assets/{useAriaLabelledBy-gMwuRSdn.js → useAriaLabelledBy-CoSdPvYq.js} +1 -1
- package/static/dashboard/assets/{useBaseQuery-B_HwoqBR.js → useBaseQuery-BkYS0_tx.js} +1 -1
- package/static/dashboard/assets/useCompositeItem-C4UrPJVM.js +1 -0
- package/static/dashboard/assets/useQuery-BYaTQT7D.js +1 -0
- package/static/dashboard/assets/useRender-yrokxr5_.js +1 -0
- package/static/dashboard/assets/{useValueChanged-Cx2et9hZ.js → useValueChanged-DIgP-JEg.js} +1 -1
- package/static/dashboard/assets/{users-DWBXaGm0.js → users-BwiPZMJv.js} +1 -1
- package/static/dashboard/assets/welcome-DTTZgFzT.js +11 -0
- package/static/dashboard/assets/{widget-signin-CLJ-K-FY.js → widget-signin-gM29xP8c.js} +1 -1
- package/static/dashboard/assets/you-9mhYS1Uj.js +1 -0
- package/static/dashboard/assets/{zod-DNHyQCPk.js → zod-kvh5d1ad.js} +1 -1
- package/static/dashboard/index.html +2 -2
- package/static/widget/build.json +2 -2
- package/static/widget/snag.js +1 -1
- package/static/widget/snag.runtime.js +1 -1
- package/static/dashboard/assets/CompositeItem-Cgwb0AUm.js +0 -1
- package/static/dashboard/assets/ConfirmDialog-0AAEj87y.js +0 -1
- package/static/dashboard/assets/InstallTag-_Jm2Ff1g.js +0 -1
- package/static/dashboard/assets/InstanceRows-BqwDUoGv.js +0 -1
- package/static/dashboard/assets/avatar-CU4IfWze.js +0 -1
- package/static/dashboard/assets/dialog-CVhVRkOj.js +0 -6
- package/static/dashboard/assets/index-BwhaFC9P.css +0 -1
- package/static/dashboard/assets/me-CaNy_lRf.js +0 -1
- package/static/dashboard/assets/s._site.reviewers-B_i-TVSC.js +0 -1
- package/static/dashboard/assets/s._site.settings-DbZsXPqa.js +0 -1
- package/static/dashboard/assets/serializeValue-DRMAHja_.js +0 -1
- package/static/dashboard/assets/sites-DP5iKU1h.js +0 -1
- package/static/dashboard/assets/studio-ByRkLhpa.js +0 -1
- package/static/dashboard/assets/studio.index-JyIGSxHS.js +0 -1
- package/static/dashboard/assets/studio.integrations-BgH-8eEj.js +0 -1
- package/static/dashboard/assets/studio.plan-DcgvVMoO.js +0 -1
- package/static/dashboard/assets/useQuery-DxI1qRhV.js +0 -1
- package/static/dashboard/assets/useRender-DqFln9km.js +0 -1
- package/static/dashboard/assets/welcome-CtwHnU8a.js +0 -11
- package/static/dashboard/assets/you-OTV4EFPf.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function r(t){return t==null||t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true"}function i(t){if(t==null)return"";if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}export{r as i,i as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{q as w,a1 as y,r as p,j as e,B as m,L as N,p as A,d as S,s as $,C as k,D as C,F as g}from"./index-CpZelV1d.js";import{u as E,a as _}from"./zod-DNHyQCPk.js";import{C as D}from"./card-D7_e6s9k.js";import{E as F,G as I,I as L,H as P,J as T,K as z}from"./dialog-CVhVRkOj.js";import{L as f,I as j}from"./label-BiZMzk6M.js";import{P as q,E as H}from"./parts-BkYmVS7_.js";import{b as K}from"./labels--UUyt9uB.js";import{u as R}from"./me-CaNy_lRf.js";import{P as b}from"./plus-5tGvow8N.js";import{L as B}from"./layout-grid-DPEmad0M.js";import{I as G}from"./image-off-DhoUHAUP.js";import"./useBaseQuery-B_HwoqBR.js";function ae(){const s=R(),i=w(s.user.role,"settings"),{add:d}=y.useSearch(),[x,n]=p.useState(!!d&&i);p.useEffect(()=>{d&&i&&n(!0)},[d,i]);const a=s.projects.filter(r=>!r.archived),l=s.projects.filter(r=>r.archived),h=a.reduce((r,o)=>r+o.unresolved,0),t=s.limits.projects.limit,c=t!==null&&a.length>=t,u=t!==null&&a.length>t;return e.jsxs("div",{className:"p-7",children:[e.jsx(q,{title:"Sites",sub:a.length?`${a.length}${t!==null?` of ${t}`:""} site${a.length===1&&t===null?"":"s"} · ${h} open`:t!==null?`0 of ${t} sites`:void 0,actions:i?e.jsxs(m,{onClick:()=>n(!0),disabled:c,title:c?`This studio's plan allows ${t} sites.`:void 0,children:[e.jsx(b,{}),"Add a site"]}):void 0}),u&&e.jsxs("div",{role:"status",className:"mb-5 max-w-[1100px] rounded-md border border-border bg-warn-soft px-4 py-3 text-[13px]",children:["This studio has ",a.length," sites and its plan includes ",t,". The newest ",a.length-t," ",a.length-t===1?"is":"are"," ","read-only: comments can be read, nothing new comes in."," ",i?"Archive a site you have finished with, or move to a plan with more.":"An owner or an admin can archive a site or change the plan."]}),a.length===0?e.jsx(D,{className:"max-w-[1100px]",children:e.jsx(H,{icon:e.jsx(B,{className:"size-5"}),title:"No sites yet",action:i?e.jsxs(m,{onClick:()=>n(!0),children:[e.jsx(b,{}),"Add a site"]}):void 0,children:i?"A site is one client website. Add it, paste the tag, and comments start arriving here.":"A site is one client website. An owner or an admin adds it, and its comments appear here."})}):e.jsx("div",{className:"grid max-w-[1100px] grid-cols-1 gap-5 md:grid-cols-2 xl:grid-cols-3",children:a.map(r=>e.jsx(v,{p:r},r.uid))}),l.length>0&&e.jsxs("section",{className:"mt-10 max-w-[1100px]","aria-labelledby":"archived-sites",children:[e.jsx("h2",{id:"archived-sites",className:"m-0 mb-1 text-[14px] font-semibold",children:"Archived"}),e.jsx("p",{className:"m-0 mb-4 text-[12.5px] text-muted-foreground",children:"Finished or put away. Every comment is kept and can be read; nothing new comes in, and they do not count toward the plan."}),e.jsx("div",{className:"grid grid-cols-1 gap-5 md:grid-cols-2 xl:grid-cols-3",children:l.map(r=>e.jsx(v,{p:r},r.uid))})]}),e.jsx(U,{open:x,onOpenChange:n})]})}function v({p:s}){const i=s.archived?"Archived":s.locked?"Read-only":s.status==="paused"?"Paused":null;return 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${s.archived?" opacity-70 grayscale":""}`,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}),i&&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:i})]}),s.domain&&e.jsx("div",{className:"mt-0.5 truncate font-mono text-[12px] text-muted-foreground",children:s.domain}),e.jsx("div",{className:"mt-2 text-[12.5px] text-ink-soft",children:s.threads===0?"Nothing filed yet":`${s.unresolved} open of ${s.threads}${s.lastActivityAt?` · ${K(s.lastActivityAt)}`:""}`})]})]})}const Q=C({name:g().trim().min(1,"A name"),domain:g().trim().min(1,"Its domain")});function U({open:s,onOpenChange:i}){const d=A(),x=S(),[n,a]=p.useState(""),{register:l,handleSubmit:h,formState:t,reset:c}=E({resolver:_(Q)}),u=h(async r=>{a("");try{const o=await $.createProject(r.name,"",r.domain);await x.invalidateQueries({queryKey:["me"]}),c(),i(!1),d({to:"/s/$site/comments",params:{site:o.uid}})}catch(o){a(o instanceof k?o.message:"Could not add the site.")}});return e.jsx(F,{open:s,onOpenChange:i,children:e.jsx(I,{children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(L,{children:[e.jsx(P,{children:"Add a site"}),e.jsx(T,{children:"One client website. The tag it needs is shown right after."})]}),n&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:n}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(f,{htmlFor:"site-name",children:"Name"}),e.jsx(j,{id:"site-name",placeholder:"Kilnwork","aria-invalid":!!t.errors.name,...l("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(f,{htmlFor:"site-domain",children:"Domain"}),e.jsx(j,{id:"site-domain",placeholder:"kilnwork.studio","aria-invalid":!!t.errors.domain,...l("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(m,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(m,{type:"submit",loading:t.isSubmitting,children:t.isSubmitting?"Adding…":"Add site"})]})]})})})}export{ae as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t,O as o}from"./index-CpZelV1d.js";const n=()=>t.jsx(o,{});export{n as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{q as N,j as e,w as k,a4 as w,r as d,B as p,S as A,d as C,a5 as F,a2 as E,A as m,a6 as R,s as D}from"./index-CpZelV1d.js";import{u as h}from"./useQuery-DxI1qRhV.js";import{L as O,I as v}from"./label-BiZMzk6M.js";import{I as P,S as q}from"./InstanceRows-BqwDUoGv.js";import{A as z,P as G,a as g}from"./parts-BkYmVS7_.js";import{u as S}from"./me-CaNy_lRf.js";import{S as I}from"./SaveState-Cm1lse3W.js";import{b as L}from"./studio-DG3kKx9a.js";import{c as T}from"./update-duXzIzFS.js";import"./useBaseQuery-B_HwoqBR.js";import"./dialog-CVhVRkOj.js";import"./ConfirmDialog-0AAEj87y.js";import"./labels--UUyt9uB.js";import"./card-D7_e6s9k.js";function U(){const s=S(),t=h(m.meta()),i=h(m.members()),r=L(),n=N(s.user.role,"studio"),u=k(s),c=w(s),o=!h(m.setupState()).data?.billingUrl,[l,a]=d.useState(s.org.name),[b,y]=d.useState(null);d.useEffect(()=>a(s.org.name),[s.org.name]);const j=n&&l.trim().length>0&&l.trim()!==s.org.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(G,{title:"General",sub:s.org.name,actions:e.jsx(I,{saving:r.isPending,savedAt:b})}),e.jsx(g,{title:"Studio",description:"The name at the top of every screen.",children:e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:f=>{f.preventDefault(),j&&r.mutate(l.trim(),{onSuccess:()=>y(Date.now())})},children:[e.jsx(O,{htmlFor:"studio-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{id:"studio-name",value:l,readOnly:!n,onChange:f=>a(f.target.value)}),j&&e.jsx(p,{type:"submit",variant:"outline",children:"Save"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:n?"Shown at the top of the sidebar, above every site.":"Only an owner can change it."})]})}),u?e.jsx(g,{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(_,{version:t.data?.version??""})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Address"}),e.jsx("dd",{className:"m-0",children:e.jsx(B,{owner:n})}),t.data?.commit&&t.data.commit!=="unknown"&&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":""]})]}),o&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Sites · members"}),e.jsxs("dd",{className:"m-0",children:[s.projects.length," · ",i.data?.data.length??"—"]})]})]})}):o?e.jsx(g,{title:"This studio",description:"What is in it.",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:"Sites"}),e.jsx("dd",{className:"m-0",children:s.projects.length}),e.jsx("dt",{className:"text-muted-foreground",children:"Members"}),e.jsx("dd",{className:"m-0",children:i.data?.data.length??"—"})]})}):null,c==="instance"?e.jsx(P,{owner:n}):c==="usage"?e.jsx(q,{}):null]})}function _({version:s}){const[t,i]=d.useState({s:"idle"});return t.s==="idle"?e.jsxs(e.Fragment,{children:["·"," ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>{i({s:"checking"}),T(s).then(r=>i({s:"done",r})).catch(()=>i({s:"failed"}))},children:"Check for updates"})," ",e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"— from your browser, never from the server"})]}):t.s==="checking"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:["· ",e.jsx(A,{className:"size-3"})," 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"})}function B({owner:s}){const t=C(),i=h(m.instance()),[r,n]=d.useState(null),[u,c]=d.useState(""),x=F({mutationFn:a=>D.setAddress(a),onSuccess:a=>{t.setQueryData(m.instance().queryKey,a),n(null),c(""),R.success("Address saved — every new link is built from it")},onError:a=>c(E(a))}),o=i.data?.address;if(!o)return e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:location.origin});const l=o.source==="env";return r===null||!s||l?e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:o.url}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:l?"· set by the environment (SNAGSET_BASE_URL)":o.source==="stored"?"· set at claim; every link is built from it":"· this machine's default"}),s&&!l&&e.jsx(p,{variant:"ghost",size:"sm",onClick:()=>n(o.url),children:"Change…"})]}):e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:a=>{a.preventDefault(),x.mutate(r.trim())},children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(v,{"aria-label":"Address",value:r,onChange:a=>n(a.target.value),className:"h-8 max-w-[360px] font-mono text-[12px]",autoFocus:!0}),e.jsx(p,{type:"submit",size:"sm",loading:x.isPending,disabled:!r.trim(),children:x.isPending?"Saving…":"Save"}),e.jsx(p,{type:"button",variant:"ghost",size:"sm",onClick:()=>n(null),children:"Cancel"})]}),u&&e.jsx("span",{className:"text-[12px] text-destructive",children:u}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"https:// unless it is this machine; the origin only. Review links, issues and emails are built from it."})]})}const ae=()=>N(S().user.role,"settings")?e.jsx(U,{}):e.jsx(z,{title:"General"});export{ae as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{q as M,j as e,L as U,w as te,d as se,r as i,a5 as P,a6 as T,a2 as K,s as F,a7 as D,B as x,$ as ne,C as G,A as oe}from"./index-CpZelV1d.js";import{u as q}from"./useQuery-DxI1qRhV.js";import{B as _}from"./badge-DCAtXinr.js";import{E,G as O,I as R,H as W,J,K as H}from"./dialog-CVhVRkOj.js";import{L as S,I}from"./label-BiZMzk6M.js";import{C as ae}from"./ConfirmDialog-0AAEj87y.js";import{A as re,P as ie,a as ce}from"./parts-BkYmVS7_.js";import{u as V}from"./me-CaNy_lRf.js";import{C as B}from"./CopyButton-SKsj8T-U.js";import{b as le}from"./labels--UUyt9uB.js";import{M as de}from"./McpTokens-zKXG6hus.js";import"./useBaseQuery-B_HwoqBR.js";import"./useRender-DqFln9km.js";import"./card-D7_e6s9k.js";import"./check-6rTEdn4e.js";import"./copy-BdKRO_6P.js";import"./switch-ySGaYAH0.js";import"./useAriaLabelledBy-gMwuRSdn.js";import"./useValueChanged-Cx2et9hZ.js";const he={ok:{label:"Healthy",tone:"ok"},needs_reauth:{label:"Needs a new token",tone:"bad"},error:{label:"Failing",tone:"bad"}};function me(){const o=V(),l=M(o.user.role,"settings"),f=M(o.user.role,"studio")&&te(o),j=q(oe.integrations()),A=se(),N=()=>A.invalidateQueries({queryKey:["integrations"]}),[d,g]=i.useState(null),[c,b]=i.useState(null),[k,u]=i.useState(null),v=P({mutationFn:t=>F.regenerateGitHubWebhook(t),onSuccess:({webhook:t},r)=>u({site:r,provider:"github",hook:t,fresh:!1}),onError:t=>T.error(K(t))}),C=P({mutationFn:({uid:t,provider:r})=>F.testTracker(t,r).then(L=>({...L,provider:r})),onSuccess:t=>{T[t.ok?"success":"error"](t.ok?`${D[t.provider]} can see ${t.target}`:t.detail??`${D[t.provider]} refused the token`),N()},onError:t=>T.error(K(t))}),y=P({mutationFn:({uid:t,provider:r})=>F.disconnectTracker(t,r),onSuccess:()=>{b(null),N()},onError:t=>T.error(K(t))}),w=j.data?.data??[],m=t=>w.filter(r=>r.provider===t),p=o.projects.filter(t=>!t.archived&&!t.locked),a=t=>p.filter(r=>!m(t).some(L=>L.site===r.uid)),s=l?o.limits.integrations?p.length===0?"site":null:"plan":null;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(ie,{title:"Integrations",sub:"Mirrors converge on the comment's status here; Slack only announces"}),s&&e.jsxs("div",{role:"note",className:"flex max-w-[1040px] flex-wrap items-center gap-x-4 gap-y-2 rounded-lg border border-border bg-muted/40 px-4 py-3 text-[13px]",children:[e.jsx("span",{className:"min-w-0 flex-1",children:s==="plan"?o.user.role==="owner"?"This studio's plan does not include integrations. A plan that does lets you connect each site to GitHub, Linear, Jira and Slack.":"This studio's plan does not include integrations. An owner can change the plan.":o.projects.length===0?"An integration connects one site to one repository, team, project or channel. Add a site first, then connect it here.":"An integration connects one site at a time, and every site here is archived or read-only. Restore one, or add a site, then connect it here."}),s==="plan"?o.user.role==="owner"&&e.jsx(x,{variant:"outline",size:"sm",render:e.jsx(U,{to:"/studio/plan"}),children:"See plans"}):e.jsx(x,{variant:"outline",size:"sm",render:e.jsx(U,{to:"/sites"}),children:"Go to Sites"})]}),["github","linear","jira","slack"].map(t=>{const r=m(t),L=a(t);return e.jsxs(ce,{title:D[t],description:t==="github"?"A comment becomes an issue in the site's repository, with the brief as its body; resolving it here closes the issue there, and closing it there resolves it here. A fine-grained token per site — no OAuth app to register.":t==="linear"?"A comment becomes an issue in the site's team, with the brief as its body; our status moves it between the team's workflow states by type, and a webhook from Linear moves it back. A personal API key per site — no OAuth app to register.":t==="jira"?"A comment becomes an issue in the site's Jira project, with the brief as its description; our status moves it through the workflow by status category, and a webhook from Jira moves it back. An API token with the account's email — what Atlassian gives a self-hoster.":"One message per comment in a channel, edited in place as the status moves — never a second message, never a reply. A bot token from an app you create in a click from our manifest; Slack sends nothing back.",children:[j.isPending&&e.jsx(ne,{rows:2}),j.isSuccess&&r.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{variant:"outline",children:"Not connected"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:t==="github"?"No site is connected to a repository yet.":t==="linear"?"No site is connected to a team yet.":t==="jira"?"No site is connected to a project yet.":"No site is connected to a channel yet."})]}),r.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:r.map(n=>{const h=he[n.health]??{label:n.health,tone:"warn"};return e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-border px-3 py-2.5 text-[13px]",children:[e.jsx("span",{className:"font-medium",children:n.siteName??n.site}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("code",{className:"font-mono text-[12.5px]",children:n.provider==="github"?`${n.owner}/${n.repo}`:n.provider==="linear"?`${n.teamKey} · ${n.teamName}`:n.provider==="jira"?`${n.projectKey} · ${n.projectName}`:`#${n.channelName} · ${n.teamName}`}),e.jsx(_,{variant:"outline",className:h.tone==="ok"?"border-ok text-ok":h.tone==="bad"?"border-destructive text-destructive":"",children:h.label}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[n.provider==="slack"?n.createOn==="thread.created"?"A message for every new comment":"Messages when you ask, from the brief":n.createOn==="thread.created"?"An issue for every new comment":"Issues when you ask, from the brief",n.provider==="github"&&n.labels.length?` · labels ${n.labels.join(", ")}`:"",n.provider!=="github"&&n.provider!=="slack"&&!n.hasWebhookSecret?` · no webhook secret yet, so ${D[n.provider]} cannot move comments here`:""," · ",le(n.updatedAt)]}),n.lastError&&e.jsx("span",{className:"basis-full text-[12px] text-destructive",children:n.lastError}),l&&e.jsxs("span",{className:"ml-auto flex gap-1",children:[n.provider==="github"?e.jsx(x,{variant:"ghost",size:"sm",loading:v.isPending,onClick:()=>v.mutate(n.site),children:"Webhook…"}):n.provider==="slack"?null:e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>u({site:n.site,provider:n.provider,hook:{url:`${location.origin}/api/v1/integrations/${n.provider}/inbound`},fresh:!1}),children:"Webhook…"}),e.jsx(x,{variant:"ghost",size:"sm",loading:C.isPending,onClick:()=>C.mutate({uid:n.site,provider:n.provider}),children:"Test"}),e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>b(n),children:"Disconnect"})]})]},`${n.provider}:${n.site}`)})}),l&&!s&&L.length>0&&e.jsx("div",{children:e.jsx(x,{variant:"outline",size:"sm",onClick:()=>g(t),children:"Connect a site…"})})]},t)}),e.jsx(de,{owner:l,instanceOwner:f,sites:o.projects}),e.jsx(ue,{open:d==="github",onOpenChange:t=>!t&&g(null),sites:a("github"),onDone:(t,r)=>{N(),r&&u({site:t,provider:"github",hook:r,fresh:!0})}}),e.jsx(xe,{open:d==="linear",onOpenChange:t=>!t&&g(null),sites:a("linear"),onDone:(t,r)=>{N(),u({site:t,provider:"linear",hook:r,fresh:!0})}}),e.jsx(ge,{open:d==="jira",onOpenChange:t=>!t&&g(null),sites:a("jira"),onDone:(t,r)=>{N(),u({site:t,provider:"jira",hook:r,fresh:!0})}}),e.jsx(fe,{open:d==="slack",onOpenChange:t=>!t&&g(null),sites:a("slack"),onDone:()=>void N()}),e.jsx(pe,{state:k,onClose:()=>u(null),siteName:t=>w.find(r=>r.site===t)?.siteName??"the site"}),e.jsx(ae,{open:c!==null,onOpenChange:t=>!t&&b(null),title:`Disconnect ${c?.siteName??"this site"} from ${c?D[c.provider]:"the tracker"}?`,description:c?.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:y.isPending,onConfirm:async()=>{c&&await y.mutateAsync({uid:c.site,provider:c.provider})}})]})}function ue({open:o,onOpenChange:l,sites:f,onDone:j}){const[A,N]=i.useState(""),[d,g]=i.useState(""),[c,b]=i.useState(""),[k,u]=i.useState(""),[v,C]=i.useState(!1),[y,w]=i.useState(""),m=P({mutationFn:s=>F.connectTracker(s,"github",{repository:d.trim(),token:c.trim(),labels:k,createOn:v?"thread.created":"manual"})}),p=A||f[0]?.uid||"",a=async s=>{s.preventDefault(),w("");try{const t=await m.mutateAsync(p);g(""),b(""),u(""),C(!1),l(!1),j(p,t.webhook&&"secret"in t.webhook?t.webhook:void 0),T.success("GitHub connected")}catch(t){w(t instanceof G?t.message:"Could not reach the server.")}};return e.jsx(E,{open:o,onOpenChange:l,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void a(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(W,{children:"Connect a site to GitHub"}),e.jsxs(J,{children:["A fine-grained personal access token with ",e.jsx("b",{children:"Issues: read and write"})," on that one repository. It is checked against the repository before it is saved, and stored encrypted with this instance's secret key."]})]}),y&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:y}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"gh-site",children:"Site"}),e.jsx("select",{id:"gh-site",value:p,onChange:s=>N(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:f.map(s=>e.jsx("option",{value:s.uid,children:s.name},s.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"gh-repo",children:"Repository"}),e.jsx(I,{id:"gh-repo",placeholder:"kilnwork/site",value:d,onChange:s=>g(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"gh-token",children:"Token"}),e.jsx(I,{id:"gh-token",type:"password",placeholder:"github_pat_…",value:c,onChange:s=>b(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"gh-labels",children:"Labels"}),e.jsx(I,{id:"gh-labels",placeholder:"review, bug",value:k,onChange:s=>u(s.target.value)}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Applied to every issue this makes. Optional."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:s=>C(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:'Off by default: a reviewer walking a site leaves twenty comments and half are "never mind". Make issues from the brief when you mean it.'})]})]}),e.jsxs(H,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:m.isPending,disabled:!d.trim()||!c.trim()||!p,children:m.isPending?"Checking…":"Connect"})]})]})})})}function pe({state:o,onClose:l,siteName:f}){const j=o&&"secret"in o.hook?o.hook.secret:null;return e.jsx(E,{open:o!==null,onOpenChange:A=>!A&&l(),children:e.jsxs(O,{children:[e.jsxs(R,{children:[e.jsx(W,{children:o?.fresh?"Connected — now the webhook":"Webhook for "+(o?f(o.site):"")}),e.jsx(J,{children:o?.provider==="linear"?"Issues moved in Linear move the comment here. In Linear › Settings › API › Webhooks, create one for the team with this URL and Issue events; then paste its signing secret when connecting or replacing the connection.":o?.provider==="jira"?"Issues moved in Jira move the comment here. In Jira › Settings › System › Webhooks, create one with this URL, the events Issue updated and Issue deleted, and a secret; then paste the same secret when connecting or replacing the connection.":`Issues closed or reopened on GitHub move the comment here. Add a webhook to the repository — Settings › Webhooks › Add webhook — with these values. The secret is shown this once${o?.fresh?"":", and the previous one has stopped working"}.`})]}),o&&e.jsxs("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Payload URL"}),e.jsxs("dd",{className:"m-0 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]",children:o.hook.url}),e.jsx(B,{text:o.hook.url,label:"Copy the payload URL"})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Content type"}),e.jsx("dd",{className:"m-0",children:e.jsx("code",{className:"font-mono text-[12px]",children:"application/json"})}),j&&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:j}),e.jsx(B,{text:j,label:"Copy the secret"})]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Events"}),e.jsx("dd",{className:"m-0",children:o.provider==="linear"?"Issues":o.provider==="jira"?"Issue: updated, deleted":"Let me select individual events → Issues"})]}),e.jsx(H,{children:e.jsx(x,{type:"button",onClick:l,children:"Done"})})]})})}function xe({open:o,onOpenChange:l,sites:f,onDone:j}){const[A,N]=i.useState(""),[d,g]=i.useState(""),[c,b]=i.useState(""),[k,u]=i.useState(""),[v,C]=i.useState(!1),[y,w]=i.useState(""),m=P({mutationFn:s=>F.connectTracker(s,"linear",{team:d.trim(),apiKey:c.trim(),...k.trim()?{webhookSecret:k.trim()}:{},createOn:v?"thread.created":"manual"})}),p=A||f[0]?.uid||"",a=async s=>{s.preventDefault(),w("");try{const t=await m.mutateAsync(p);g(""),b(""),u(""),C(!1),l(!1),j(p,t.webhook??{url:`${location.origin}/api/v1/integrations/linear/inbound`}),T.success("Linear connected")}catch(t){w(t instanceof G?t.message:"Could not reach the server.")}};return e.jsx(E,{open:o,onOpenChange:l,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void a(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(W,{children:"Connect a site to Linear"}),e.jsx(J,{children:"A personal API key from Linear › Settings › API, belonging to a member of the team. It is checked against the team before it is saved, and stored encrypted with this instance's secret key."})]}),y&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:y}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"ln-site",children:"Site"}),e.jsx("select",{id:"ln-site",value:p,onChange:s=>N(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:f.map(s=>e.jsx("option",{value:s.uid,children:s.name},s.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"ln-team",children:"Team key"}),e.jsx(I,{id:"ln-team",placeholder:"ENG",value:d,onChange:s=>g(s.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The prefix of the team's issues, like the ENG in ENG-123."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"ln-key",children:"API key"}),e.jsx(I,{id:"ln-key",type:"password",placeholder:"lin_api_…",value:c,onChange:s=>b(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"ln-secret",children:"Webhook signing secret"}),e.jsx(I,{id:"ln-secret",type:"password",placeholder:"from Linear's webhook, optional",value:k,onChange:s=>u(s.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Lets Linear move comments here when issues move there. The URL to give Linear is shown after connecting."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:s=>C(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(H,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:m.isPending,disabled:!d.trim()||!c.trim()||!p,children:m.isPending?"Checking…":"Connect"})]})]})})})}function ge({open:o,onOpenChange:l,sites:f,onDone:j}){const[A,N]=i.useState(""),[d,g]=i.useState(""),[c,b]=i.useState(""),[k,u]=i.useState(""),[v,C]=i.useState(""),[y,w]=i.useState(""),[m,p]=i.useState(!1),[a,s]=i.useState(""),t=P({mutationFn:h=>F.connectTracker(h,"jira",{siteUrl:d.trim(),project:c.trim(),email:k.trim(),apiToken:v.trim(),...y.trim()?{webhookSecret:y.trim()}:{},createOn:m?"thread.created":"manual"})}),r=A||f[0]?.uid||"",L=async h=>{h.preventDefault(),s("");try{const $=await t.mutateAsync(r);b(""),C(""),w(""),p(!1),l(!1),j(r,$.webhook??{url:`${location.origin}/api/v1/integrations/jira/inbound`}),T.success("Jira connected")}catch($){s($ instanceof G?$.message:"Could not reach the server.")}},n=(h,$,Q,Y,X,Z="text",z)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:`jr-${h}`,children:$}),e.jsx(I,{id:`jr-${h}`,type:Z,placeholder:X,value:Q,onChange:ee=>Y(ee.target.value),autoComplete:"off"}),z&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:z})]});return e.jsx(E,{open:o,onOpenChange:l,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:h=>void L(h),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(W,{children:"Connect a site to Jira"}),e.jsx(J,{children:"An API token from id.atlassian.com › Security, with the email of the account it belongs to. It is checked against the project before it is saved, and stored encrypted with this instance's secret key."})]}),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(S,{htmlFor:"jr-site",children:"Site"}),e.jsx("select",{id:"jr-site",value:r,onChange:h=>N(h.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:f.map(h=>e.jsx("option",{value:h.uid,children:h.name},h.uid))})]}),n("url","Jira site",d,g,"https://kilnwork.atlassian.net"),n("project","Project key",c,b,"KAN","text","The prefix of the project's issues, like the KAN in KAN-12."),n("email","Account email",k,u,"you@kilnwork.studio","email"),n("token","API token",v,C,"","password"),n("secret","Webhook secret",y,w,"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:m,onChange:h=>p(h.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(H,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:t.isPending,disabled:!d.trim()||!c.trim()||!k.trim()||!v.trim()||!r,children:t.isPending?"Checking…":"Connect"})]})]})})})}function fe({open:o,onOpenChange:l,sites:f,onDone:j}){const[A,N]=i.useState(""),[d,g]=i.useState(""),[c,b]=i.useState(""),[k,u]=i.useState(!0),[v,C]=i.useState(""),y=q({queryKey:["integrations","slack","manifest"],queryFn:()=>F.slackManifest(),enabled:o,staleTime:1/0}),w=P({mutationFn:a=>F.connectTracker(a,"slack",{channel:d.trim(),token:c.trim(),createOn:k?"thread.created":"manual"})}),m=A||f[0]?.uid||"",p=async a=>{a.preventDefault(),C("");try{await w.mutateAsync(m),g(""),b(""),u(!0),l(!1),j(m),T.success("Slack connected")}catch(s){C(s instanceof G?s.message:"Could not reach the server.")}};return e.jsx(E,{open:o,onOpenChange:l,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:a=>void p(a),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(W,{children:"Connect a site to Slack"}),e.jsx(J,{children:"Create the app in your workspace from our manifest — one click, the scopes are filled in — install it, and paste its Bot User OAuth Token. The token is checked against the channel before it is saved, and stored encrypted with this instance's secret key."})]}),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(S,{htmlFor:"sl-site",children:"Site"}),e.jsx("select",{id:"sl-site",value:m,onChange:a=>N(a.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:f.map(a=>e.jsx("option",{value:a.uid,children:a.name},a.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(x,{type:"button",variant:"outline",size:"sm",disabled:!y.data,render:e.jsx("a",{href:y.data?.url??"#",target:"_blank",rel:"noreferrer"}),children:"Create app…"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"sl-token",children:"2. Bot User OAuth Token"}),e.jsx(I,{id:"sl-token",type:"password",placeholder:"xoxb-…",value:c,onChange:a=>b(a.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(S,{htmlFor:"sl-channel",children:"3. Channel"}),e.jsx(I,{id:"sl-channel",placeholder:"#reviews",value:d,onChange:a=>g(a.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:k,onChange:a=>u(a.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"A message for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"On by default: a channel is where people are told. Turn it off to post from the brief when you mean it."})]})]}),e.jsxs(H,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:w.isPending,disabled:!d.trim()||!c.trim()||!m,children:w.isPending?"Checking…":"Connect"})]})]})})})}const Re=()=>M(V().user.role,"settings")?e.jsx(me,{}):e.jsx(re,{title:"Integrations",children:e.jsxs("p",{className:"m-0",children:["Connecting a site to GitHub, Linear, Jira or Slack is done by an owner or an admin. Your own agent tokens are on"," ",e.jsx(U,{to:"/you",className:"text-brand hover:underline",children:"You"}),"."]})});export{Re as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,aj as S,r as N,S as $,h as c,B as y,A as _}from"./index-CpZelV1d.js";import{u as b}from"./useQuery-DxI1qRhV.js";import{b as u}from"./InstanceRows-BqwDUoGv.js";import{A as C,P}from"./parts-BkYmVS7_.js";import{u as f}from"./me-CaNy_lRf.js";import{C as R}from"./check-6rTEdn4e.js";import"./useBaseQuery-B_HwoqBR.js";import"./dialog-CVhVRkOj.js";import"./label-BiZMzk6M.js";import"./ConfirmDialog-0AAEj87y.js";import"./labels--UUyt9uB.js";import"./card-D7_e6s9k.js";function Y(){const s=f(),{said:n}=S.useSearch(),a=b(_.setupState()),l=a.data?.billingUrl??null,i=b({queryKey:["plan-state",l],enabled:!!l,queryFn:async()=>{const t=await fetch(`${l.replace(/\/+$/,"")}/state`,{credentials:"include",headers:{accept:"application/json"}});if(!t.ok)throw new Error(String(t.status));return await t.json()}}),r=i.data,[d,w]=N.useState(!1),v=!!r?.plans.some(t=>t.yearly),h=r?.plans.find(t=>t.current);return e.jsxs("div",{className:"flex flex-col gap-8 p-7",children:[e.jsx(P,{title:"Plan & billing",sub:s.org.name}),n&&e.jsx("p",{role:"status",className:"m-0 max-w-[1040px] rounded-md border border-border bg-card px-3 py-2 text-[13px]",children:n}),a.isSuccess&&!l?e.jsx("p",{className:"m-0 text-muted-foreground",children:"This instance has no plans: everything is included."}):i.isError?e.jsx("p",{className:"m-0 text-muted-foreground",children:"The plans could not be loaded. Reload to try again."}):r?e.jsxs("div",{className:"flex max-w-[1040px] flex-col",children:[e.jsxs("section",{"aria-label":"Your plan",className:"grid grid-cols-1 gap-5 rounded-xl border border-border bg-card px-6 py-5 sm:grid-cols-[minmax(0,1fr)_auto]",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"m-0 text-[11.5px] font-medium uppercase tracking-wider text-muted-foreground",children:"Your plan"}),e.jsxs("p",{className:"m-0 mt-1 text-[28px] font-bold leading-tight",children:[r.current?.name??h?.name,e.jsx("span",{className:"ml-2 text-[15px] font-normal text-muted-foreground",children:r.current?.price??h?.price})]}),r.current?.period&&e.jsx("p",{className:"m-0 mt-1 text-[13px] text-ink-soft",children:r.current.period})]}),r.manage&&e.jsx("div",{children:e.jsx(x,{base:l,form:r.manage})}),e.jsx("div",{className:"sm:col-span-2",children:e.jsx(A,{})}),r.current?.warning&&e.jsx("p",{role:"status",className:"m-0 rounded-md bg-warn-soft px-3.5 py-2.5 text-[13px] sm:col-span-2",children:r.current.warning}),r.nudge&&e.jsxs("div",{className:"flex flex-wrap items-center gap-3 rounded-lg bg-brand-soft px-3.5 py-2.5 sm:col-span-2",children:[e.jsx("p",{className:"m-0 min-w-[220px] flex-1 text-[13px]",children:r.nudge.text}),e.jsx(x,{base:l,form:r.nudge.action})]})]}),e.jsxs("div",{className:"mb-4 mt-9 flex flex-wrap items-center justify-between gap-3",children:[e.jsx("h2",{id:"compare",className:"m-0 text-[17px] font-semibold",children:"Compare plans"}),v&&e.jsx("div",{role:"radiogroup","aria-label":"Billing period",className:"inline-flex rounded-full border border-border bg-card p-0.5",children:[!1,!0].map(t=>e.jsx("button",{type:"button",role:"radio","aria-checked":d===t,onClick:()=>w(t),className:c("rounded-full px-3.5 py-1 text-[13px]",d===t?"bg-foreground text-background":"text-ink-soft"),children:t?e.jsxs(e.Fragment,{children:["Yearly ",e.jsx("span",{className:c("font-medium",d?"opacity-80":"text-brand"),children:"2 months free"})]}):"Monthly"},String(t)))})]}),e.jsx("div",{"aria-labelledby":"compare",className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:r.plans.map(t=>{const m=d&&t.yearly?t.yearly:null,g=m?m.actions:t.actions,k=t.relation==="downgrade";return e.jsxs("div",{className:c("relative flex min-w-0 flex-col gap-4 rounded-xl border bg-card p-5",t.recommended?"border-brand shadow-[0_0_0_1px_var(--color-brand),0_10px_30px_rgb(61_97_217/.12)]":"border-border"),children:[(t.current||t.recommended)&&e.jsx("span",{className:c("absolute -top-2.5 left-5 rounded-full px-2.5 py-px text-[11.5px] font-semibold",t.current?"bg-foreground text-background":"bg-brand text-white"),children:t.current?"Your plan":"Recommended"}),e.jsxs("div",{children:[e.jsx("h3",{className:"m-0 text-[16px] font-semibold",children:t.name}),t.pitch&&e.jsx("p",{className:"m-0 mt-0.5 text-[13px] text-muted-foreground",children:t.pitch})]}),e.jsxs("p",{className:"m-0 text-[34px] font-bold leading-none tracking-tight",children:[m?.amount??t.amount??t.price,(m?.unit??t.unit)&&e.jsx("span",{className:"ml-1 text-[13px] font-normal tracking-normal text-muted-foreground",children:m?.unit??t.unit})]}),e.jsx("ul",{className:"m-0 flex flex-1 list-none flex-col gap-2 p-0",children:t.features.map(o=>e.jsxs("li",{className:c("flex gap-2 text-[13.5px]",t.added?.includes(o)&&"font-semibold"),children:[e.jsx(R,{className:"mt-0.5 size-4 shrink-0 text-ok","aria-hidden":!0}),o]},o))}),t.current?e.jsx(y,{type:"button",variant:"outline",disabled:!0,className:"w-full",children:"Current plan"}):k?g.map(o=>e.jsx(M,{base:l,form:o,warning:t.warning??null},o.label)):g.map(o=>e.jsx(x,{base:l,form:{...o,primary:!!t.recommended||o.primary},wide:!0},o.label))]},t.id)})}),e.jsxs("p",{className:"m-0 mt-5 text-center text-[13px] text-muted-foreground",children:[r.footer?e.jsxs("b",{className:"font-semibold text-foreground",children:[r.footer.split(". ")[0],"."]}):r.intro," ",r.footer?.split(". ").slice(1).join(". ")]}),r.notes.length>0&&e.jsx("p",{className:"m-0 mt-1.5 text-center text-[12px] text-muted-foreground",children:r.notes.join(" ")})]}):e.jsx($,{})]})}function M({base:s,form:n,warning:a}){const[l,i]=N.useState(!1);return a&&l?e.jsxs("div",{className:"flex flex-col gap-2 rounded-md bg-warn-soft px-3 py-2.5 text-[12.5px]",children:[e.jsx("p",{className:"m-0",children:a}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(x,{base:s,form:{...n,label:"Downgrade anyway",primary:!1}}),e.jsx("button",{type:"button",className:"text-[13px] text-muted-foreground underline underline-offset-2",onClick:()=>i(!1),children:"Keep my plan"})]})]}):a?e.jsx("button",{type:"button",className:"self-center text-[13px] text-muted-foreground underline underline-offset-[3px]",onClick:()=>i(!0),children:n.label}):e.jsxs("form",{method:"post",action:new URL(n.action,s).toString(),className:"m-0 self-center",children:[Object.entries(n.fields).map(([r,d])=>e.jsx("input",{type:"hidden",name:r,value:d},r)),e.jsx("button",{type:"submit",className:"text-[13px] text-muted-foreground underline underline-offset-[3px]",children:n.label})]})}function x({base:s,form:n,wide:a}){return e.jsxs("form",{method:"post",action:new URL(n.action,s).toString(),className:"m-0",children:[Object.entries(n.fields).map(([l,i])=>e.jsx("input",{type:"hidden",name:l,value:i},l)),e.jsx(y,{type:"submit",variant:n.primary?"default":"outline",className:a?"w-full":void 0,children:n.label})]})}function A(){const{limits:s}=f(),n=[{label:"Sites",text:j(s.projects.used,s.projects.limit,"site","sites"),share:p(s.projects.used,s.projects.limit)},{label:"Members",text:j(s.members.used,s.members.limit,"member","members"),share:p(s.members.used,s.members.limit)},{label:"Screenshots",text:s.screenshots?s.storage.limit===null?`${u(s.storage.used)} used`:`${u(s.storage.used)} of ${u(s.storage.limit)}`:"Not on this plan",share:s.screenshots?p(s.storage.used,s.storage.limit):null}];return e.jsx("dl",{className:"m-0 grid grid-cols-1 gap-5 border-t border-border pt-4 sm:grid-cols-3",children:n.map(a=>e.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[e.jsx("dt",{className:"text-[12px] text-muted-foreground",children:a.label}),e.jsx("dd",{className:"m-0 text-[13px]",children:a.text}),a.share!==null&&e.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted","aria-hidden":!0,children:e.jsx("div",{className:c("h-full rounded-full",a.share>=1?"bg-destructive":"bg-brand"),style:{width:`${Math.min(100,Math.round(a.share*100))}%`}})})]},a.label))})}const p=(s,n)=>n===null||n===0?null:s/n,j=(s,n,a,l)=>n===null?`${s} ${s===1?a:l}, unlimited`:`${s} of ${n} ${n===1?a:l}`,Q=()=>f().user.role==="owner"?e.jsx(Y,{}):e.jsx(C,{title:"Plan & billing"});export{Q as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as r,Q as u}from"./useBaseQuery-B_HwoqBR.js";function a(e,s){return r(e,u)}export{a as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{k as n}from"./index-CpZelV1d.js";function u(e){return n(e.defaultTagName??"div",e,e)}export{u};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{c as z,V as E,p as F,d as B,r as l,j as e,G as L,h as k,B as n,s as w,A as x,C as S}from"./index-CpZelV1d.js";import{C as f}from"./card-D7_e6s9k.js";import{L as C,I as q}from"./label-BiZMzk6M.js";import{I as P}from"./InstallTag-_Jm2Ff1g.js";import{C as R}from"./check-6rTEdn4e.js";import{A}from"./arrow-left-DJMsLCm0.js";import"./copy-BdKRO_6P.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 T=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],j=z("arrow-right",T);/**
|
|
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 _=[["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"}]],G=z("party-popper",_),I=["Site","Address","Install"];function J(){const{me:D,site:r}=E.useRouteContext(),b=F(),o=B(),[a,c]=l.useState(0),[d,K]=l.useState(r.name==="First project"?"":r.name),[h,M]=l.useState(""),[i,u]=l.useState(!1),[m,y]=l.useState(!1),[v,p]=l.useState(""),Q=async()=>{u(!0),y(!0),p("");try{await w.deleteSite(r.uid),o.removeQueries({queryKey:["origins",r.uid]}),await o.invalidateQueries({queryKey:x.me().queryKey}),await o.fetchQuery(x.me()),b({to:"/sites",replace:!0})}catch(t){p(t instanceof S?t.message:"Something went wrong. Try again."),u(!1),y(!1)}},N=async(t,s)=>{u(!0),p("");try{await w.editSite(r.uid,t),t.domain&&o.setQueryData(x.origins(r.uid).queryKey,{domain:t.domain,origins:[]}),await o.invalidateQueries({queryKey:x.me().queryKey}),await o.fetchQuery(x.me()),s()}catch(g){p(g instanceof S?g.message:"Could not reach the server.")}finally{u(!1)}};return e.jsx("div",{className:"relative min-h-dvh bg-background",children:e.jsxs(L,{width:600,children:[e.jsxs("div",{className:"absolute right-6 top-5 text-[12.5px] text-muted-foreground",children:["Signed in as ",D.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:I.map((t,s)=>e.jsxs("li",{className:"flex items-center gap-2.5 text-[13.5px] font-medium",children:[e.jsx("span",{className:k("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(R,{className:"size-3.5"}):s+1}),e.jsx("span",{className:s===a?"text-foreground":"text-muted-foreground",children:t}),s<I.length-1&&e.jsx("span",{className:k("h-px w-[90px]",s<a?"bg-brand":"bg-border")})]},t))}),v&&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:v}),a===0&&e.jsx(f,{className:"gap-4 p-7",children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:t=>{t.preventDefault(),!(!d.trim()||i)&&N({name:d.trim()},()=>c(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("fieldset",{disabled:i,className:"m-0 flex min-w-0 flex-col gap-4 border-0 p-0",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"first-name",children:"Name"}),e.jsx(q,{id:"first-name",placeholder:"Kilnwork",value:d,onChange:t=>K(t.target.value),autoFocus:!0})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(n,{type:"button",variant:"ghost",loading:m,disabled:i&&!m,onClick:()=>void Q(),children:"Skip for now"}),e.jsxs(n,{type:"submit",loading:i&&!m,disabled:!d.trim()||m,children:[i&&!m?"Saving…":"Continue",e.jsx(j,{})]})]})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"No site yet? Skip, and add one from Sites when it is ready."})]})}),a===1&&e.jsx(f,{className:"gap-4 p-7",children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:t=>{t.preventDefault(),!(!h.trim()||i)&&N({domain:h.trim()},()=>c(2))},children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"m-0 text-[21px] font-semibold leading-tight tracking-tight",children:["Where does ",d||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("fieldset",{disabled:i,className:"m-0 flex min-w-0 flex-col gap-4 border-0 p-0",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"first-domain",children:"Domain"}),e.jsx(q,{id:"first-domain",placeholder:"kilnwork.studio",value:h,onChange:t=>M(t.target.value),autoFocus:!0})]}),e.jsxs("div",{className:"flex items-center",children:[e.jsxs(n,{type:"button",variant:"ghost",onClick:()=>c(0),children:[e.jsx(A,{}),"Back"]}),e.jsx("div",{className:"flex-1"}),e.jsxs(n,{type:"submit",loading:i,disabled:!h.trim(),children:[i?"Saving…":"Continue",e.jsx(j,{})]})]})]})]})}),a===2&&e.jsxs(f,{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(P,{uid:r.uid}),e.jsxs("div",{className:"flex items-center",children:[e.jsxs(n,{type:"button",variant:"ghost",onClick:()=>c(1),children:[e.jsx(A,{}),"Back"]}),e.jsx("div",{className:"flex-1"}),e.jsxs(n,{type:"button",onClick:()=>c(3),children:["Done",e.jsx(j,{})]})]})]}),a===3&&e.jsxs(f,{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(G,{className:"size-5"})}),e.jsxs("h1",{className:"m-0 text-[21px] font-semibold leading-tight tracking-tight",children:[d||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],g)=>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:g+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(n,{size:"lg",className:"mt-2 w-full",onClick:()=>void b({to:"/s/$site/comments",params:{site:r.uid},replace:!0}),children:["Go to Comments",e.jsx(j,{})]})]})]})})}export{J as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r,x as b,j as e,h as y,y as N,B as j,q as f,a2 as S}from"./index-CpZelV1d.js";import{L as c,I as d}from"./label-BiZMzk6M.js";import{P as C,a as h}from"./parts-BkYmVS7_.js";import{S as P}from"./SaveState-Cm1lse3W.js";import{M as A}from"./McpTokens-zKXG6hus.js";import{u as k}from"./me-CaNy_lRf.js";import{u as M,a as F}from"./studio-DG3kKx9a.js";import{M as E,S as T,a as D}from"./sun-CSVVDe1X.js";import"./card-D7_e6s9k.js";import"./labels--UUyt9uB.js";import"./useQuery-DxI1qRhV.js";import"./useBaseQuery-B_HwoqBR.js";import"./badge-DCAtXinr.js";import"./useRender-DqFln9km.js";import"./dialog-CVhVRkOj.js";import"./switch-ySGaYAH0.js";import"./useAriaLabelledBy-gMwuRSdn.js";import"./useValueChanged-Cx2et9hZ.js";import"./ConfirmDialog-0AAEj87y.js";import"./CopyButton-SKsj8T-U.js";import"./check-6rTEdn4e.js";import"./copy-BdKRO_6P.js";function z({items:t}){const[a,n]=r.useState(b);return e.jsx("div",{className:"flex gap-2",role:"radiogroup","aria-label":"Theme",children:t.map(s=>e.jsxs("button",{type:"button",role:"radio","aria-checked":a===s.value,onClick:()=>{N(s.value),n(s.value)},className:y("inline-flex h-7 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-[12.5px] font-medium text-ink-soft",a===s.value&&"border-line-strong bg-muted text-foreground"),children:[s.icon,s.label]},s.value))})}function re(){const t=k(),a=M(),[n,s]=r.useState(t.user.name),[u,i]=r.useState(null);r.useEffect(()=>s(t.user.name),[t.user.name]);const m=n.trim()!==t.user.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(C,{title:"You",sub:"Your own account on this studio",actions:e.jsx(P,{saving:a.isPending,savedAt:u})}),e.jsxs(h,{title:"Profile",description:"How you appear on replies and in the members list.",children:[e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:l=>{l.preventDefault(),m&&a.mutate(n.trim(),{onSuccess:()=>i(Date.now())})},children:[e.jsx(c,{htmlFor:"your-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(d,{id:"your-name",value:n,onChange:l=>s(l.target.value)}),m&&e.jsx(j,{type:"submit",variant:"outline",children:"Save"})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"your-email",children:"Email"}),e.jsx(d,{id:"your-email",value:t.user.email,readOnly:!0,className:"bg-muted text-ink-soft"}),e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["How you sign in, and how the server finds you. An owner changes it with"," ",e.jsx("code",{className:"font-mono",children:"snagset passwd"}),"."]})]})]}),e.jsx(h,{title:"Password",description:"Changing it keeps this session and ends every other one.",children:e.jsx(H,{})}),!f(t.user.role,"settings")&&f(t.user.role,"review")&&e.jsx(A,{owner:!0,mine:!0,instanceOwner:!1,sites:t.projects}),e.jsx(h,{title:"Appearance",description:"Also in your menu at the bottom of the sidebar.",children:e.jsx(z,{items:[{value:"system",label:"System",icon:e.jsx(E,{className:"size-3.5"})},{value:"light",label:"Light",icon:e.jsx(T,{className:"size-3.5"})},{value:"dark",label:"Dark",icon:e.jsx(D,{className:"size-3.5"})}]})})]})}function H(){const t=F(),[a,n]=r.useState(""),[s,u]=r.useState(""),[i,m]=r.useState(""),[l,g]=r.useState(""),[v,p]=r.useState(!1),x=a.length>0&&s.length>=12&&s===i;return e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:async o=>{if(o.preventDefault(),!(!x||t.isPending)){g("");try{await t.mutateAsync({current:a,next:s}),n(""),u(""),m(""),p(!0)}catch(w){g(S(w))}}},children:[l&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:l}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"pw-current",children:"Current password"}),e.jsx(d,{id:"pw-current",type:"password",autoComplete:"current-password",value:a,onChange:o=>{n(o.target.value),p(!1)}})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"pw-next",children:"New password"}),e.jsx(d,{id:"pw-next",type:"password",autoComplete:"new-password",value:s,onChange:o=>{u(o.target.value),p(!1)}}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. No composition rules — length is what matters."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"pw-again",children:"Confirm new password"}),e.jsx(d,{id:"pw-again",type:"password",autoComplete:"new-password",value:i,onChange:o=>{m(o.target.value),p(!1)}}),i.length>0&&s!==i&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Those do not match yet."})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(j,{type:"submit",loading:t.isPending,disabled:!x,children:t.isPending?"Changing…":v&&!x?"Changed":"Change password"})})]})}export{re as component};
|