PageSourceSearch

https://screened.io/app/assets/audit-log-DCxitRoD.js

js screened.io collected 2026-10-04 06:51:06 UTC 14,210 bytes, 1 lines download raw bytes

1import{ap as te,an as ae,a9 as se,u as U,t as H,d as ie,aq as ne,D as oe,f as re,r,F as P,j as t,b as L,ar as I,B as F,as as b,s as le,I as de,G as ce,e as me}from"./index-BMTnbVbk.js";import{B as ue}from"./badge-DOY4ulTc.js";import{S as g}from"./skeleton-DBq0WJrg.js";import{T as pe,a as ge,b as y,c as w,d as he,e as v}from"./table-DpzScgi8.js";import{D as fe}from"./date-range-picker-BghCzqtS.js";import{U as k}from"./unified-select-DGzCmwkJ.js";import{E as xe}from"./EmptyState-M8576AyU.js";import{F as be,a as ve}from"./FilterPanel-BaTfrwbf.js";import{H as M}from"./HelpTooltip-DrrCVJbx.js";import{P as je}from"./Pagination-DCR8SKN3.js";import{T as _e}from"./TableSkeleton-FB6fN2UF.js";import{c as ye,f as we,a as Ne}from"./formatUtils-CZI4-7KU.js";import{u as Ee,f as Se,a as $e}from"./SidebarContext-BMWbwsz9.js";import{R as Ae}from"./index-Blf9cp0q.js";import{M as Ce,a as Te}from"./ats-JOhPhzJ9.js";import{u as Re}from"./useMutation-D4IOLLPn.js";import{R as De}from"./index-4D5XvB9c.js";import{a as Pe}from"./hooks-DQNZ7-lj.js";import{D as Le}from"./download-C-DuBXBc.js";import{S as Ie}from"./sliders-horizontal-cFc5DV8q.js";import{H as Fe}from"./history-BNIMoM8Z.js";import"./chevron-down-gjNhGAIq.js";import"./check-ALE3Cy0K.js";import"./input-CBFzWtye.js";import"./checkbox-Dm2Ja1Jh.js";import"./index-BIo0l1-b.js";import"./index-CeCoLOdX.js";import"./x-Cjrou8Y1.js";import"./search-DGsA21hs.js";import"./dropdown-menu-B7tD1gMR.js";import"./index-DvWe22Mo.js";import"./chevron-left-BA74HP4p.js";import"./chevron-right-CnPCCBM2.js";import"./format-CA2G4vmO.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"aabf4ad"};var a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="fcbb8cf3-2d1e-4ee5-9be6-8914ae940e8a",e._sentryDebugIdIdentifier="sentry-dbid-fcbb8cf3-2d1e-4ee5-9be6-8914ae940e8a")}catch{}})();function G(e){const a=new URLSearchParams;return e.type&&a.set("type",e.type),e.member&&a.set("member",e.member),e.start&&a.set("start",e.start),e.end&&a.set("end",e.end),a}async function ke(e={}){const a=G(e);e.page&&a.set("page",String(e.page)),e.limit&&a.set("limit",String(e.limit));const i=a.toString();return ae("/api/v1/audit-log"+(i?"?"+i:""))}async function Me(e,a){return te("/api/v1/audit-log/export",{body:Object.fromEntries(G(e)),csrfToken:a,fallbackFilename:"audit-log.csv"})}function Oe(e){return se({queryKey:["audit-log",e],queryFn:()=>ke(e),placeholderData:ne})}function Ue(){const{csrfToken:e}=U();return Re({mutationFn:a=>Me(a,e||""),onError:a=>{H.error(a instanceof ie&&a.code==="RATE_LIMITED"?De:"Couldn't export the audit log — please try again")}})}const He=["type","member","range","start","end"],j=$e(le,He),B=[{value:"auth",label:"Sign-ins",summary:"Successful sign-ins, failed attempts, lockouts, sign-outs, workspace switches, and sign-in accounts being connected or disconnected"},{value:"team",label:"Team",summary:"Invites, teammates joining, role and email changes, removals, and job assignment changes"},{value:"integration",label:"Integrations",summary:"Connecting and disconnecting an ATS"},{value:"automation",label:"Automations",summary:"Automations created, updated, and deleted"},{value:"data",label:"Data",summary:"Permanent candidate deletions, expired interview recordings, recording and retention setting changes, and CSV exports of the audit log, candidate lists and analytics"}],Ge=B.map(e=>({value:e.value,label:e.label}));function Be(){return t.jsx("div",{className:"space-y-1.5",children:B.map(e=>t.jsxs("div",{children:[t.jsxs("span",{className:"font-semibold",children:[e.label,":"]})," ",e.summary]},e.value))})}const _=e=>e&&Ae[e]||e||"a team member",O=e=>e?.ats_slug&&(Ce[e.ats_slug]||e.ats_slug)||e?.ats&&e.ats!=="merge"&&Te[e.ats]?.displayName||"an ATS",Ve={google:" with Google",microsoft:" with Microsoft",otp:" with an email code"},ze={login_success:e=>{const a=e.details?.method;return a==="workspace_switch"?"Switched into this workspace":a==="signup"?"Created an account and signed in":`Signed in${Ve[a??""]??""}`},login_failed:()=>"Failed sign-in attempt",account_locked:e=>e.details?.duration_minutes?`Account locked for ${e.details.duration_minutes} minutes after repeated failed sign-in attempts`:"Account locked after repeated failed sign-in attempts",logout:()=>"Signed out",identity_connected:e=>e.details?.provider==="microsoft"?"Connected a Microsoft account for sign-in":"Connected an account for sign-in",identity_disconnected:e=>e.details?.provider==="microsoft"?"Disconnected a Microsoft account from sign-in":"Disconnected an account from sign-in",member_invited:(e,a)=>`Invited ${a} as ${_(e.details?.role)}`,member_joined:()=>"Joined the team",member_reinstated:(e,a)=>`Reinstated ${a} as ${_(e.details?.role)}`,role_changed:(e,a)=>`Changed ${a}'s role from ${_(e.details?.old_role)} to ${_(e.details?.new_role)}`,member_updated:(e,a)=>{const i=e.details;return!i?.email_changed||!e.targetEmail?`Updated ${a}'s profile`:i.old_email?a===e.targetEmail?`Changed ${i.old_email}'s email to ${e.targetEmail}`:`Changed ${a}'s email from ${i.old_email} to ${e.targetEmail}`:a===e.targetEmail?`Changed the member's email to ${e.targetEmail}`:`Changed ${a}'s email to ${e.targetEmail}`},member_removed:(e,a)=>`Removed ${a} from the team`,member_jobs_changed:(e,a)=>{const i=e.details;if(i?.job_title)return i.added_job_ids?`Added ${a} to '${i.job_title}'`:`Removed ${a} from '${i.job_title}'`;if(i?.job_titles){if(!i.job_titles.length)return`Removed all of ${a}'s assigned jobs`;const n=i.job_titles.slice(0,2).join(", ");return`Updated ${a}'s assigned jobs: ${n}${i.job_titles.length>2?`, +${i.job_titles.length-2} more`:""}`}return`Updated ${a}'s assigned jobs`},ats_connected:e=>`Connected ${O(e.details)}`,ats_disconnected:e=>`Disconnected ${O(e.details)}`,automation_created:e=>e.details?.name?`Created the automation '${e.details.name}'`:"Created an automation",automation_updated:e=>e.details?.name?`Updated the automation '${e.details.name}'`:"Updated an automation",automation_deleted:e=>e.details?.name?`Deleted the automation '${e.details.name}'`:"Deleted an automation",candidate_deleted:e=>{const a=e.details?.cv_count,i=a==null?"Permanently deleted candidates":`Permanently deleted ${a} ${a===1?"candidate":"candidates"}`;return e.details?.reason==="retention"?`${i} that reached the end of the retention period`:e.details?.job_title?`${i} from '${e.details.job_title}'`:i},recording_deleted:e=>{const a=e.details?.recording_count;return a==null?"Removed interview recordings that reached the end of the retention period":`Removed ${a} interview ${a===1?"recording":"recordings"} that reached the end of the retention period`},recordings_enabled:()=>"Turned on access to interview recordings",recordings_disabled:()=>"Turned off access to interview recordings",retention_setting_changed:e=>{const a=e.details?.setting==="recording_retention_months"?"interview recordings":"candidate data",i=e.details?.old_months,n=e.details?.new_months;return i==null||n==null?`Changed how long Screened keeps ${a}`:`Changed how long Screened keeps ${a} from ${i} to ${n} ${n===1?"month":"months"}`},data_exported:e=>{const a=e.details?.row_count,[i,n]=e.details?.export==="candidates"?["the candidate list","candidate"]:e.details?.export==="analytics"?["analytics","job"]:e.details?.export==="assurance"?["the Audit check","comparison"]:["the audit log","row"];return a==null?`Exported ${i}`:`Exported ${i} (${a} ${a===1?n:n+"s"})`}};function Ke(e){if(e.type==="all")return{};if(e.type==="custom")return{start:e.customStart||void 0,end:e.customEnd||void 0};const a=new Date,i=e.type==="last7"?7:e.type==="last30"?30:90;return{start:new Date(a.getTime()-i*864e5).toISOString().slice(0,10)}}function Ye(){const e=oe({from:"/_app/settings/audit-log"}),a=re({from:"/settings/audit-log"}),i=s=>a({search:o=>({...o,...s}),replace:!0}),n=r.useMemo(()=>({type:e.range??"all",customStart:e.start??"",customEnd:e.end??""}),[e.range,e.start,e.end]),V=s=>i({range:s.type==="all"?void 0:s.type,start:s.customStart||void 0,end:s.customEnd||void 0,page:1}),N=r.useMemo(()=>Ke(n),[n]),d={type:e.type==="all"?void 0:e.type,member:e.member,start:N.start,end:N.end,page:e.page,limit:b},{data:E,isLoading:z,isPlaceholderData:S}=Oe(d),{data:h=[]}=Pe(!0),{user:K,companies:Y}=U(),$=Ue(),J=r.useMemo(()=>[...h].sort((s,o)=>Number(s.isRemoved)-Number(o.isRemoved)||(s.name||s.email).localeCompare(o.name||o.email)).map(s=>({value:s.id,label:s.isRemoved?`${s.name||s.email} · Past member`:s.name||s.email})),[h]),Q=r.useMemo(()=>new Map(h.map(s=>[s.id,s.name])),[h]),A=(s,o)=>s&&Q.get(s)||o||"a team member",c=e.page,C=E?.data??[],l=E?.total??0,m=Math.min(Math.ceil(l/b),2e3);r.useEffect(()=>{c>m&&m>0&&a({search:s=>({...s,page:m}),replace:!0})},[c,m,a]);const u=(e.type!=="all"?1:0)+(e.member?1:0)+(e.range!=null?1:0),[T,R]=r.useState(!1),{requestCollapse:f}=Ee(),W=()=>{R(!0),f(!0)},x=()=>{R(!1),f(!1)};r.useEffect(()=>()=>f(!1),[f]);const X=Y.find(s=>
1s.isActive)?.id,p=Se("audit-log",X,K?.id),D=r.useRef(!1);r.useEffect(()=>{if(D.current)return;D.current=!0;const s=P(p);s&&a({search:o=>j.isSetInUrl(o)?o:{...o,...j.hydrate(s),page:1},replace:!0})},[p,a]);const Z=()=>{de(p,j.pick(e)),H.success("Filters saved"),x()},q=()=>{ce(p),i({...j.reset(),page:1}),x()},ee=()=>$.mutate({type:d.type,member:d.member,start:d.start,end:d.end});return t.jsxs("div",{className:"flex flex-1 h-full","data-testid":"spa-audit-log",children:[t.jsxs("div",{className:"flex flex-col flex-1 min-h-0 min-w-0",children:[t.jsx("div",{className:"flex-shrink-0 bg-slate-50 border-b border-slate-200",children:t.jsx("div",{className:"px-4 sm:px-8 py-3 sm:py-4",children:t.jsxs("div",{className:"max-w-4xl flex items-center justify-between gap-4",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("h1",{className:"text-lg font-semibold",children:"Audit log"}),t.jsx(M,{ariaLabel:"Audit log help",iconSize:"w-3.5 h-3.5",width:"w-64",learnMoreHref:L.auditLog,children:"Only you and other admins can see this. It covers workspace activity."})]}),!S&&l>I&&t.jsxs("p",{className:"text-xs text-amber-600 mt-1",children:["CSV exports cap at the ",I.toLocaleString()," newest matching rows — narrow the date range for older activity."]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(F,{variant:"outline",size:"sm",className:"h-8 text-xs px-3",disabled:S||l===0||$.isPending,onClick:ee,"data-testid":"spa-audit-log-export-btn",children:[t.jsx(Le,{className:"w-3.5 h-3.5 mr-1.5"}),"Export"]}),t.jsxs(F,{variant:"outline",size:"sm",className:"h-8 text-xs px-3",onClick:()=>T?x():W(),children:[t.jsx(Ie,{className:"w-3.5 h-3.5 mr-1.5"}),"Filters",u>0&&t.jsx(ue,{variant:"secondary",className:"ml-1.5 bg-slate-900 text-white hover:bg-slate-900 h-4 px-1 text-[10px]",children:u})]})]})]})})}),t.jsx("div",{className:"flex-1 overflow-auto p-4 sm:p-8",children:t.jsx("div",{className:"max-w-4xl space-y-6",children:z?t.jsx("div",{className:"bg-white border border-slate-200 rounded-lg overflow-hidden",children:t.jsx(_e,{rows:5,headerClassName:"bg-slate-50",columns:[{header:"Activity",headerClassName:"text-xs",cellClassName:"py-2",cell:t.jsxs(t.Fragment,{children:[t.jsx(g,{className:"h-4 w-56 mb-1"}),t.jsx(g,{className:"h-3 w-36"})]})},{header:"IP address",headerClassName:"text-xs",cellClassName:"py-2",cell:t.jsxs(t.Fragment,{children:[t.jsx(g,{className:"h-4 w-24 mb-1"}),t.jsx(g,{className:"h-3 w-28"})]})},{header:"Date",headerClassName:"text-xs",cellClassName:"py-2",cell:t.jsx(g,{className:"h-4 w-20"})}]})}):l===0&&u===0?t.jsx(xe,{className:"py-16",icon:Fe,title:"No activity yet",description:"Sign-ins and team changes appear here."}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"bg-white border border-slate-200 rounded-lg overflow-x-auto",children:t.jsxs(pe,{className:"min-w-[640px]",children:[t.jsx(ge,{children:t.jsxs(y,{className:"bg-slate-50 hover:bg-slate-50",children:[t.jsx(w,{className:"text-xs",children:"Activity"}),t.jsx(w,{className:"text-xs",children:"IP address"}),t.jsx(w,{className:"text-xs",children:"Date"})]})}),t.jsxs(he,{children:[C.map(s=>{const o=A(s.targetUserId,s.targetEmail);return t.jsxs(y,{children:[t.jsxs(v,{className:"py-2",children:[t.jsx("div",{className:"text-sm",title:s.targetEmail??void 0,children:ze[s.event]?.(s,o)??s.event}),t.jsx("div",{className:"text-xs text-slate-500",title:s.actorEmail??void 0,children:A(s.actorUserId,s.actorEmail)})]}),t.jsxs(v,{className:"py-2 text-xs text-slate-500",children:[t.jsx("div",{className:"tabular-nums",children:s.ipAddress??"—"}),s.userAgent&&t.jsx("div",{children:ye(s.userAgent)})]}),t.jsx(v,{className:"py-2 text-slate-500 text-sm whitespace-nowrap",title:Ne(s.createdAt),children:we(s.createdAt)})]},s.id)}),C.length===0&&t.jsx(y,{children:t.jsx(v,{colSpan:3,className:"text-center text-slate-500 py-8",children:"No activity matches these filters."})})]})]})}),t.jsx(je,{currentPage:c,totalPages:m,onPageChange:s=>i({page:s}),label:`Showing ${Math.min((c-1)*b+1,l)}-${Math.min(c*b,l)} of ${l}`})]})})})]}),t.jsxs(be,{open:T,onClose:x,children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-medium text-slate-500 mb-1",children:"Date range"}),t.jsx(fe,{allowAllTime:!0,value:n,onChange:V})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx("p",{className:"text-xs font-medium text-slate-500",children:"Category"}),t.jsx(M,{ariaLabel:"Audit log categories help",iconSize:"w-3 h-3",width:"w-72",learnMoreHref:L.auditLogCategories,children:t.jsx(Be,{})})]}
1),t.jsx(k,{options:Ge,value:e.type==="all"?"":e.type,onChange:s=>i({type:s||"all",page:1}),placeholder:"All",mode:"single",hideSearch:!0})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-medium text-slate-500 mb-1",children:"Team"}),t.jsx(k,{options:J,value:e.member??"",onChange:s=>i({member:s||void 0,page:1}),placeholder:"All",searchPlaceholder:"Search team...",mode:"single"})]}),t.jsx(ve,{canSave:u>0,canClear:u>0||P(p)!=null,onClear:q,onSave:Z})]})]})}function At(){return me("Audit Log"),t.jsx(Ye,{})}export{At as component};

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.