1import{p as v,a6 as A,r as i,C as _,j as e,a3 as w,W as I,g as U,at as B,o as N,dV as L,aJ as O}from"./index-BokBcvef.js";import{em as F,E as D,dV as M}from"./ObjectIcon-DirRsqjg.js";import{S}from"./StatusPill-CQyTDcxR.js";import{u as P,e as z,A as H}from"./AdminSupportPage-fdVCXRNU.js";import{S as V}from"./SectionHeader-CsWqkHd2.js";import{m as G,d as K}from"./MyRequestsPanel-DrVcvM1e.js";import{a as W,b as Y}from"./presentation-BvUFIWx4.js";import{aS as q,aT as y,aU as Q}from"./App-BGMiVqzd.js";import"./Logo-BQftxmvq.js";import"./WarningOctagon.es-BPQTGpVh.js";import"./Card-DuADMCgg.js";import"./Skeleton-fQvEY9Jq.js";import"./Banner-LYMtZ1YA.js";import"./site-meta-BMinDe9p.js";import"./quota-plans-BI2dQx_Z.js";import"./analytics-C4bPpHpE.js";import"./highlight-text-_FusPQ_W.js";import"./booking-types-rHJx1g2H.js";import"./microsoft_logo-BmSJe2pD.js";import"./useChainedSearchParams-DjXSNO6w.js";import"./api-DtGdU2Cw.js";import"./api-wplEdlCb.js";import"./useVoiceChat-BNC2Gc_H.js";import"./useTween-DQfAWz8r.js";import"./credit-addons-BackbiXZ.js";import"./referrals-DcnDmGru.js";import"./plan-copy-BPyxMWSl.js";import"./plan-features-CsHW5Oov.js";import"./PasswordStrengthMeter-GOnegCEt.js";const $="_page_c2sw4_3",J="_filters_c2sw4_11",Z="_body_c2sw4_17",X="_table_c2sw4_23",ee="_row_c2sw4_54",se="_muted_c2sw4_67",te="_mono_c2sw4_71",ae="_reporter_c2sw4_77",ne="_description_c2sw4_83",oe="_pagination_c2sw4_91",le="_detail_c2sw4_99",re="_screenshots_c2sw4_148",ie="_screenshot_c2sw4_148",t={page:$,filters:J,body:Z,table:X,"table-scroll":"_table-scroll_c2sw4_45",row:ee,muted:se,mono:te,reporter:ae,description:ne,pagination:oe,"detail-row":"_detail-row_c2sw4_99",detail:le,"detail-section":"_detail-section_c2sw4_110","detail-label":"_detail-label_c2sw4_116","detail-description":"_detail-description_c2sw4_123","detail-context":"_detail-context_c2sw4_130","context-entry":"_context-entry_c2sw4_136","context-label":"_context-label_c2sw4_143",screenshots:re,screenshot:ie},ce=50,de=300,C={open:"Open",triaged:"Triaged",resolved:"Resolved",closed:"Closed"},f=G.map(s=>({value:s,label:C[s]})),me=[{value:"",label:"All statuses"},...f],ue={open:"var(--ds-color-status-red)",triaged:"var(--ds-color-status-orange)",resolved:"var(--ds-color-status-green)",closed:"var(--ds-color-status-gray)"},he=s=>_(s,"Couldn't load bug reports");function Ke(){const s=v(),r=A(),[l,c]=i.useState(""),[h,m]=i.useState(""),x=F(h,de),[j,u]=i.useState(null),p=i.useCallback(async n=>{const o=await q({status:l||void 0,workspaceId:x||void 0,cursor:n,limit:ce});return{rows:o.reports,nextCursor:o.nextCursor}},[l,x]),a=P(p,he),T=i.useCallback(async()=>{const n=await a.loadMore();n&&s.error(_(n,"Couldn't load more reports"))},[a,s]),k=i.useCallback(async(n,o)=>{const g=a.patchRow(b=>b.id===n,{status:o});try{await y(n,{status:o}),r.invalidateQueries({queryKey:Q})}catch(b){g(),s.error(_(b,"Couldn't update the status"))}},[a,s,r]),R=i.useCallback((n,o)=>{a.patchRow(g=>g.id===n,{adminNotes:o})},[a]);return e.jsxs("div",{className:t.page,children:[e.jsx(V,{title:"Bug reports"}),e.jsxs("div",{className:t.filters,children:[e.jsx(w,{value:l,onChange:c,options:me,"aria-label":"Filter by status"}),e.jsx(I,{inputType:"text",value:h,onChange:m,placeholder:"Filter by workspace ID","aria-label":"Filter by workspace ID"})]}),e.jsxs("div",{className:t.body,children:[a.loading&&e.jsx(U,{size:"md"}),!a.loading&&a.error&&e.jsx(B,{variant:"block",message:a.error,onRetry:a.reload}),!a.loading&&!a.error&&a.rows.length===0&&e.jsx(D,{iconName:"bug",title:"No bug reports",hint:"No reports match your filters."}),!a.loading&&!a.error&&a.rows.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:t["table-scroll"],children:e.jsxs("table",{className:t.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"When"}),e.jsx("th",{children:"Workspace"}),e.jsx("th",{children:"Reporter"}),e.jsx("th",{children:"Severity"}),e.jsx("th",{children:"Browser"}),e.jsx("th",{children:"Description"}),e.jsx("th",{children:"Screenshots"}),e.jsx("th",{children:"Status"})]})}),e.jsx("tbody",{children:a.rows.map(n=>e.jsx(xe,{report:n,expanded:j===n.id,onToggle:()=>u(o=>o===n.id?null:n.id),onStatusChange:o=>k(n.id,o),onNotesSaved:o=>R(n.id,o)},n.id))})]})}),a.hasMore&&e.jsx("div",{className:t.pagination,children:e.jsx(N,{variant:"secondary",size:"sm",onClick:T,loading:a.loadingMore,children:"Load more"})})]})]})]})}function xe({report:s,expanded:r,onToggle:l,onStatusChange:c,onNotesSaved:h}){return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{className:t.row,onClick:l,onKeyDown:z(l),role:"button",tabIndex:0,"aria-expanded":r,children:[e.jsx("td",{className:t.muted,children:E(s.createdAt)}),e.jsx("td",{children:s.workspaceName||e.jsx("span",{className:t.mono,children:s.workspaceId})}),e.jsx("td",{children:e.jsxs("div",{className:t.reporter,children:[e.jsx("span",{children:s.reporterName||s.reporterEmail}),s.reporterName&&e.jsx("span",{className:t.muted,children:s.reporterEmail})]})}),e.jsx("td",{children:e.jsx(S,{status:s.severity??"blocker",map:Y,labelMap:K,iconMap:W,fallback:"var(--ds-color-status-gray)"})}),e.jsx("td",{children:s.browserSummary}),e.jsx("td",{children:e.jsx("span",{className:t.description,children:L(s.descriptionHtml).trim()})}),e.jsx("td",{className:t.muted,children:s.screenshotUrls.length||"None"}),e.jsx("td",{onClick:m=>m.stopPropagation(),children:e.jsx(w,{value:s.status,onChange:m=>c(m),options:f,size:"sm","aria-label":"Status"})})]}),r&&e.jsx(pe,{report:s,onNotesSaved:h})]})}function pe({report:s,onNotesSaved:r}){const l=v(),[c,h]=i.useState(s.adminNotes??""),[m,x]=i.useState(!1),j=async()=>{x(!0);try{await y(s.id,{adminNotes:c}),r(c),l.success("Notes saved")}catch(u){l.error(_(u,"Couldn't save the notes"))}finally{x(!1)}};return e.jsx("tr",{className:t["detail-row"],children:e.jsx("td",{colSpan:8,children:e.jsxs("div",{className:t.detail,children:[e.jsxs("div",{className:t["detail-section"],children:[e.jsx("span",{className:t["detail-label"],children:"Description"}),e.jsx("div",{className:t["detail-description"],dangerouslySetInnerHTML:{__html:M(s.descriptionHtml)}})]}),s.screenshotUrls.length>0&&e.jsxs("div",{className:t["detail-section"],children:[e.jsx("span",{className:t["detail-label"],children:"Screenshots"}
1),e.jsx("div",{className:t.screenshots,children:s.screenshotUrls.map(({fileId:u,url:p})=>e.jsx("a",{href:p,target:"_blank",rel:"noopener noreferrer",children:e.jsx("img",{src:p,alt:"Bug screenshot",className:t.screenshot})},u))})]}),e.jsxs("div",{className:t["detail-section"],children:[e.jsx("span",{className:t["detail-label"],children:"Context"}),e.jsxs("div",{className:t["detail-context"],children:[e.jsx(d,{label:"Occurred at",value:E(s.occurredAt)}),s.timezone&&e.jsx(d,{label:"Timezone",value:s.timezone}),s.context.route&&e.jsx(d,{label:"Page",value:s.context.route,mono:!0}),s.context.viewport&&e.jsx(d,{label:"Viewport",value:`${s.context.viewport.width} x ${s.context.viewport.height}`}),s.context.language&&e.jsx(d,{label:"Language",value:s.context.language}),e.jsx(d,{label:"User agent",value:s.context.userAgent||"Unknown",mono:!0}),e.jsx(d,{label:"Report ID",value:s.id,mono:!0}),e.jsx(d,{label:"Status",value:e.jsx(S,{status:s.status,map:ue,labelMap:C,fallback:"var(--ds-color-status-gray)"})})]})]}),e.jsx(H,{kind:"bug",itemId:s.id,reporterName:s.reporterName||s.reporterEmail}),e.jsxs("div",{className:t["detail-section"],children:[e.jsx("span",{className:t["detail-label"],children:"Admin notes"}),e.jsx(O,{value:c,onChange:u=>h(u.target.value),placeholder:"Triage notes (visible to super-admins only)","aria-label":"Admin notes",autoExpand:!0}),e.jsx("div",{children:e.jsx(N,{variant:"secondary",size:"sm",onClick:j,loading:m,disabled:c===(s.adminNotes??""),children:"Save notes"})})]})]})})})}function d({label:s,value:r,mono:l}){return e.jsxs("div",{className:t["context-entry"],children:[e.jsx("span",{className:t["context-label"],children:s}),e.jsx("span",{className:l?t.mono:void 0,children:r})]})}function E(s){try{return new Date(s).toLocaleString()}catch{return s}}export{Ke as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.