1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9821],{3510:(e,r,t)=>{"use strict";t.r(r),t.d(r,{default:()=>g});var i=t(95155),n=t(12115),o=t(5865),a=t(65576),s=t(18286),d=t(70437);let l="#1a2744",c="#e4d8c4",u={deactivate_user:{verb:"Deactivated",icon:"\uD83D\uDEAB",color:"#dc2626"},reset_vault_wipe:{verb:"Wiped vault",icon:"\uD83D\uDDD1ï¸",color:"#dc2626"},undo:{verb:"Reverted",icon:"â©ï¸",color:"#16a34a"}},f={platform_admin:{label:"Platform admin",bg:"#1a2744",fg:"#d4a520"},enterprise_admin:{label:"Enterprise admin",bg:"#7c3aed",fg:"#fff"},org_admin:{label:"Org admin",bg:"#e4d8c4",fg:"#1a2744"}};function p(e){if(!e)return"";let r=new Date(e),t=Math.floor((Date.now()-r.getTime())/1e3);if(t<60)return"just now";let i=Math.floor(t/60);if(i<60)return`${i}m ago`;let n=Math.floor(i/60);if(n<24)return`${n}h ago`;let o=Math.floor(n/24);return o<30?`${o}d ago`:r.toLocaleDateString()}function g(){let e=(0,d.gc)(),{user:r}=(0,a.A)(),[t,g]=(0,n.useState)([]),[m,h]=(0,n.useState)(!0),[b,x]=(0,n.useState)(!1),[v,_]=(0,n.useState)(null),[y,j]=(0,n.useState)(""),[S,w]=(0,n.useState)(null);async function k(){h(!0),j("");try{let e=await (0,s.request)(`/api/features/admin/action-log?include_reverted=${b}`);g(e.actions||[])}catch(e){j(String(e?.message||e))}h(!1)}async function R(e){let t=String(e.actor_user_id)===String(r?.id),i=`Undo "${u[e.action_type]?.verb||e.action_type}" on ${e.resource_label||e.resource_id}?`;if(t&&(i+="\n\nâ ï¸ You initiated this action originally. Peer review prefers a different admin to undo it. Click OK only if you intend to self-undo."),confirm(i)){_(e.id),j("");try{await (0,s.request)(`/api/features/admin/action-log/${e.id}/undo`,{method:"POST",body:JSON.stringify({allow_self_undo:t})}),await k()}catch(e){j(String(e?.message||e))}_(null)}}return((0,n.useEffect)(()=>{k()},[b]),e.gateLoading)?null:(0,i.jsx)(o.A,{title:"Activity Log",children:(0,i.jsxs)("div",{style:{padding:"24px",maxWidth:1100,margin:"0 auto",fontFamily:"var(--font-dm-sans),sans-serif"},children:[(0,i.jsxs)("div",{style:{marginBottom:24},children:[(0,i.jsx)("h1",{style:{fontSize:24,fontWeight:900,color:l,marginBottom:4},children:"Admin Activity Log"}),(0,i.jsx)("p",{style:{fontSize:14,color:l+"99",marginBottom:0,lineHeight:1.5},children:"A peer-reviewable record of admin actions affecting your organization. Most actions are reversible by another admin â review and undo if anything looks wrong. Vault-wipe actions destroy ciphertext we cannot reconstruct, so those are flagged irreversible."})]}),(0,i.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[(0,i.jsxs)("label",{style:{fontSize:13,color:l,display:"flex",alignItems:"center",gap:6,cursor:"pointer"},children:[(0,i.jsx)("input",{type:"checkbox",checked:b,onChange:e=>x(e.target.checked)}),"Show already-reverted actions"]}),(0,i.jsx)("button",{onClick:k,style:{padding:"6px 14px",background:"transparent",border:`1px solid ${c}`,borderRadius:6,color:l,fontSize:12,fontWeight:700,cursor:"pointer"},children:"â» Refresh"})]}),y&&(0,i.jsx)("div",{style:{padding:12,background:"#fee2e2",border:"1px solid #dc2626",borderRadius:8,color:"#991b1b",fontSize:13,marginBottom:16},children:y}),m?(0,i.jsx)("div",{style:{background:"#fff",border:`1px solid ${c}`,borderRadius:12,padding:32,textAlign:"center",color:l+"70",fontSize:14},children:"Loadingâ¦"}):0===t.length?(0,i.jsx)("div",{style:{background:"#fff",border:`1px solid ${c}`,borderRadius:12,padding:32,textAlign:"center",color:l+"70",fontSize:14},children:"No admin actions to show."}):(0,i.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:t.map(e=>{let r=u[e.action_type]||{verb:e.action_type,icon:"â¢",color:l},t=f[e.actor_tier]||{label:e.actor_tier,bg:"#999",fg:"#fff"},n=e.actor?`${e.actor.first_name||""} ${e.actor.last_name||""}`.trim()||e.actor.email:`User #${e.actor_user_id}`,o=S===e.id,a=!!e.reverted_at;return(0,i.jsxs)("div",{style:{background:a?"#f5f5f4":"#fff",border:`1px solid ${a?"#d6d3d1":c}`,borderRadius:8,padding:14,opacity:a?.7:1},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",ga
1p:12},children:[(0,i.jsx)("div",{style:{fontSize:20,lineHeight:1,paddingTop:2},children:r.icon}),(0,i.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",marginBottom:4},children:[(0,i.jsx)("span",{style:{fontWeight:800,color:r.color,fontSize:14},children:r.verb}),(0,i.jsx)("span",{style:{fontSize:14,color:l,fontWeight:600},children:e.resource_label||`${e.resource_type} #${e.resource_id}`}),(0,i.jsx)("span",{style:{fontSize:10,fontWeight:800,padding:"2px 6px",background:t.bg,color:t.fg,borderRadius:3,textTransform:"uppercase",letterSpacing:.4},children:t.label}),!e.is_reversible&&(0,i.jsx)("span",{style:{fontSize:10,fontWeight:700,padding:"2px 6px",background:"#fef3c7",color:"#92400e",borderRadius:3,textTransform:"uppercase",letterSpacing:.4},children:"Irreversible"}),a&&(0,i.jsx)("span",{style:{fontSize:10,fontWeight:700,padding:"2px 6px",background:"#dcfce7",color:"#166534",borderRadius:3,textTransform:"uppercase",letterSpacing:.4},children:"Reverted"})]}),(0,i.jsxs)("div",{style:{fontSize:12,color:l+"99"},children:["by ",(0,i.jsx)("strong",{style:{color:l},children:n})," \xb7 ",(0,i.jsx)("span",{title:new Date(e.created_at).toLocaleString(),children:p(e.created_at)}),a&&e.reverter&&(0,i.jsxs)(i.Fragment,{children:[" \xb7 reverted by ",(0,i.jsx)("strong",{style:{color:l},children:`${e.reverter.first_name||""} ${e.reverter.last_name||""}`.trim()||e.reverter.email})," ",p(e.reverted_at)]})]}),e.metadata?.reason&&(0,i.jsxs)("div",{style:{fontSize:12,color:l+"aa",marginTop:4,fontStyle:"italic"},children:["â",e.metadata.reason,"â"]})]}),(0,i.jsxs)("div",{style:{display:"flex",gap:6,alignItems:"flex-start"},children:[(0,i.jsx)("button",{onClick:()=>w(o?null:e.id),style:{padding:"4px 10px",background:"transparent",border:`1px solid ${c}`,borderRadius:6,color:l+"aa",fontSize:11,fontWeight:600,cursor:"pointer"},children:o?"Hide":"Details"}),e.is_reversible&&!a&&(0,i.jsx)("button",{onClick:()=>R(e),disabled:v===e.id,style:{padding:"4px 12px",background:l,color:"#d4a520",border:"none",borderRadius:6,fontSize:11,fontWeight:800,cursor:v===e.id?"wait":"pointer",opacity:v===e.id?.6:1},children:v===e.id?"â¦":"Undo"})]})]}),o&&(0,i.jsxs)("div",{style:{marginTop:12,paddingTop:12,borderTop:`1px dashed ${c}`},children:[(0,i.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12,fontSize:11,fontFamily:"ui-monospace, Menlo, monospace"},children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{style:{fontWeight:700,color:l,fontSize:11,marginBottom:4},children:"Before"}),(0,i.jsx)("pre",{style:{background:"#f5ede0",padding:8,borderRadius:4,overflowX:"auto",margin:0,color:l},children:JSON.stringify(e.before_state,null,2)})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{style:{fontWeight:700,color:l,fontSize:11,marginBottom:4},children:"After"}),(0,i.jsx)("pre",{style:{background:"#f5ede0",padding:8,borderRadius:4,overflowX:"auto",margin:0,color:l},children:JSON.stringify(e.after_state,null,2)})]})]}),e.irreversible_reason&&(0,i.jsxs)("div",{style:{marginTop:10,padding:8,background:"#fef3c7",borderRadius:4,fontSize:12,color:"#92400e"},children:[(0,i.jsx)("strong",{children:"Irreversible:"})," ",e.irreversible_reason]})]})]},e.id)})})]})})}},21634:(e,r,t)=>{Promise.resolve().then(t.bind(t,3510))},70437:(e,r,t)=>{"use strict";t.d(r,{P2:()=>l,X4:()=>s,gc:()=>d});var i=t(12115),n=t(73321),o=t(65576);function a(e){return!!e&&(!!e.is_platform_admin||!!e.is_support_admin&&e.platform_capabilities?.view_all_orgs===!0)}function s(){let{user:e,loading:r}=(0,o.A)(),t=(0,n.useRouter)();(0,i.useEffect)(()=>{if(!r){if(!e)return void t.push("/login");a(e)||t.push("/admin/dashboard")}},[r,e,t]);let s=r||!e||!a(e);return{user:e,gateLoading:s}}function d(){let{user:e,loading:r}=(0,o.A)(),t=(0,n.useRouter)(),a=!!(e&&(e.is_platform_admin||e.is_support_admin||e.is_enterprise_admin||(e.org_roles||[]).some(e=>"principal"===e.role||"it_admin"===e.role||"enterprise_admin"===e.role)));(0,i.useEffect)(()=>{if(!r){if(!e)return void t.push("/login");a||t.push("/dashboard")}},[r,e,a,t]);let s=r||!e||!a;return{user:e,gateLoading:s}}function l(){let{user:e,loading:r}=(0,o.A)(),t=(0,n.useRouter)();(0,i.useEffect)(()=>{r||(e?e.is_platform_admin||e.is_support_admin||e.is_enterprise_admin||(e.org_roles||[]).some(e=>"enterprise_admin"===e.role)||t.push("/admin/dashboard"):t.push("/login"))},[r,e,t]);let a=!!(e&&(e.is_platform_admin||e.is_support_admin||e.is_enterprise_admin||(e.org_roles||[]).some(e=>"enterprise_admin"===e.role))),s=r||!e||!a;return{user:e,gateLoading:s}}},73321:(e,r,t)=>{"use strict";var i=t(74645);t.o(i,"useParams")&&t.d(r,{useParams:function(){return i.useParams}}),t.o(i,"usePathname")&&t.d(r,{usePathname:function(){return i.usePathname}}),t.o(i,"useRouter")&&t.d(r,{useRouter:function(){return i.useRouter}}),t.o(i,"useSearchParams")&&t.d(r,{useSearchParams:function(){return i.useSearchParams}})},82849:(e,r,t)=>{"use strict";function i(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var i in t)"__proto__"!==i&&(e[i]=t[i])}return e}t.r(r),t.d(r,{default:()=>n});var n=function e(r,t){function n(e,n,o){if("u">typeof document){"number"==typeof(o=i({},t,o)).expires&&(o.expires=new Date(Date.now()+864e5*o.expires)),o.expires&&(o.expires=o.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decode
1URIComponent).replace(/[()]/g,escape);var a="";for(var s in o)o[s]&&(a+="; "+s,!0!==o[s]&&(a+="="+o[s].split(";")[0]));return document.cookie=e+"="+r.write(n,e)+a}}return Object.create({set:n,get:function(e){if("u">typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],i={},n=0;n<t.length;n++){var o=t[n].split("="),a=o.slice(1).join("=");try{var s=decodeURIComponent(o[0]);if(s in i||(i[s]=r.read(a,s)),e===s)break}catch(e){}}return e?i[e]:i}},remove:function(e,r){n(e,"",i({},r,{expires:-1}))},withAttributes:function(r){return e(this.converter,i({},this.attributes,r))},withConverter:function(r){return e(i({},this.converter,r),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(r)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"})}},e=>{e.O(0,[8500,5772,8286,5576,3480,5865,8441,5254,7358],()=>e(e.s=21634)),_N_E=e.O()}]);
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.