PageSourceSearch

https://vault22.com/_next/static/chunks/pages/admin/customer-support/audit-8a1939f71ae75fa8.js

js vault22.com collected 2026-09-24 13:40:32 UTC 8,653 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5818],{67574:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>x});var s=a(37876),l=a(14232),r=a(37497),d=a(52042),i=a(53403);let n=[{value:"",label:"All actions"},{value:"apply-classification",label:"apply-classification"},{value:"send-reply",label:"send-reply"},{value:"update-assignee",label:"update-assignee"},{value:"update-status",label:"update-status"},{value:"add-tags",label:"add-tags"},{value:"bulk-status",label:"bulk-status"},{value:"bulk-assignee",label:"bulk-assignee"},{value:"bulk-tag",label:"bulk-tag"},{value:"bulk-macro",label:"bulk-macro"}],c=[50,100,200,500];function o(e){if(!e)return"";try{return JSON.stringify(JSON.parse(e),null,2)}catch(t){return e}}function x(){let{adminUser:e,idToken:t}=(0,d.bn)(),[a,x]=(0,l.useState)([]),[u,p]=(0,l.useState)(null),[m,h]=(0,l.useState)(!1),[g,b]=(0,l.useState)(null),[y,j]=(0,l.useState)(100),[N,v]=(0,l.useState)(""),[f,w]=(0,l.useState)(""),[k,S]=(0,l.useState)(new Set);(0,l.useEffect)(()=>{if(!e||!t)return;let a=!1;return(async()=>{h(!0),b(null);try{let[e,t]=await Promise.all([i.KD.getAuditLog(y,N||void 0,f||void 0),i.KD.getMyRateUsage()]);if(a)return;e.success&&e.data?x(e.data.entries):b(e.error||"Failed to load audit log"),t.success&&t.data&&p(t.data)}catch(e){a||b((null==e?void 0:e.message)||"Failed to load audit log")}finally{a||h(!1)}})(),()=>{a=!0}},[e,t,y,N,f]);let E=(0,l.useMemo)(()=>{let e=new Set;return a.forEach(t=>{t.adminEmail&&e.add(t.adminEmail)}),Array.from(e).sort()},[a]);return(0,s.jsx)(r.A,{children:(0,s.jsxs)("div",{className:"p-6 max-w-7xl mx-auto space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-xl font-semibold text-gray-900",children:"Audit log"}),(0,s.jsxs)("p",{className:"text-xs text-gray-500 mt-1",children:["Every USER-TRIGGERED Zendesk write — from ",(0,s.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"sven_actions"})," Mongo collection. Read-only. AI auto-apply paths NEVER write here."]})]}),u&&(0,s.jsxs)("div",{className:"text-right text-xs bg-white border border-gray-200 rounded-lg p-3","data-testid":"cs-audit-rate-usage",children:[(0,s.jsx)("div",{className:"font-medium text-gray-900",children:"Your write quota"}),(0,s.jsx)("div",{className:"text-gray-700 mt-1",children:(0,s.jsxs)("span",{className:u.minuteCount>=u.minuteLimit?"text-red-700 font-semibold":"",children:[u.minuteCount,"/",u.minuteLimit," per minute"]})}),(0,s.jsx)("div",{className:"text-gray-700",children:(0,s.jsxs)("span",{className:u.hourCount>=u.hourLimit?"text-red-700 font-semibold":"",children:[u.hourCount,"/",u.hourLimit," per hour"]})})]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-3 items-end bg-white border border-gray-200 rounded-lg p-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-[11px] uppercase tracking-wide text-gray-500 mb-1",children:"Admin email"}),(0,s.jsx)("input",{type:"text",value:N,onChange:e=>v(e.target.value),placeholder:"filter by sven email",className:"border border-gray-300 rounded px-2 py-1 text-sm w-64",list:"cs-audit-email-options","data-testid":"cs-audit-email-filter"}),(0,s.jsx)("datalist",{id:"cs-audit-email-options",children:E.map(e=>(0,s.jsx)("option",{value:e},e))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-[11px] uppercase tracking-wide text-gray-500 mb-1",children:"Action"}),(0,s.jsx)("select",{value:f,onChange:e=>w(e.target.value),className:"border border-gray-300 rounded px-2 py-1 text-sm","data-testid":"cs-audit-action-filter",children:n.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-[11px] uppercase tracking-wide text-gray-500 mb-1",children:"Limit"}),(0,s.jsx)("select",{value:y,onChange:e=>j(parseInt(e.target.value,10)),className:"border border-gray-300 rounded px-2 py-1 text-sm",children:c.map(e=>(0,s.jsx)("option",{value:e,children:e},e))})]}),(0,s.jsx)("div",{className:"ml-auto text-xs text-gray-500",children:m?"Loading…":"".concat(a.length," rows")})]}),g&&(0,s.jsx)("div",{className:"bg-red-50 border border-red-200 rounded p-3 text-sm text-red-800","data-testid":"cs-audit-error",children:g}),(0,s.jsx)("div",{className:"bg-white border border-gray-200 rounded-lg overflow-hidden",children:(0,s.jsxs)("table",{className:"w-full text-sm",children:[(0,s.jsx)("thead",{className:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-500",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"px-3 py-2 text-left",children:"When"}),(0,s.jsx)("th",{className:"px-3 py-2 text-left",children:"Sven"}),(0,s.jsx)("th",{className:"px-3 py-2 text-left",children:"Action"}),(0,s.jsx)("th",{className:"px-3 py-2 text-left",children:"Ticket"}),(0,s.jsx)("th",{className:"px-3 py-2 text-left",children:"Zendesk"}),(0,s.jsx)("th",{className:"px-3 py-2"})]})}),(0,s.jsxs)("tbody",{className:"divide-y divide-gray-100","data-testid":"cs-audit-rows",children:[0===a.length&&!m&&(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:6,className:"px-3 py-10 text-center text-sm text-gray-500",children:"No audit rows match."})}),a.map(e=>{var t;let a=!!e.id&&k.has(e.id);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("tr",{className:"hover:bg-blue-50/40","data-testid":"cs-audit-row-".concat(e.id),children:[(0,s.jsx)("td",{className:"px-3 py-2 align-top text-xs text-gray-700 whitespace-nowrap",children:function(e){if(!e)return"";
1try{return new Date(e).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium"})}catch(t){return e}}(e.appliedAt)}),(0,s.jsx)("td",{className:"px-3 py-2 align-top text-xs text-gray-800 max-w-[220px] truncate",title:e.adminEmail||"",children:e.adminEmail||"—"}),(0,s.jsx)("td",{className:"px-3 py-2 align-top",children:(0,s.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium ".concat((t=e.action)?t.startsWith("bulk-")?"bg-purple-100 text-purple-800":"send-reply"===t||"bulk-macro"===t?"bg-blue-100 text-blue-800":"apply-classification"===t?"bg-emerald-100 text-emerald-800":"update-status"===t?"bg-amber-100 text-amber-800":"update-assignee"===t||"bulk-assignee"===t?"bg-indigo-100 text-indigo-800":"add-tags"===t||"bulk-tag"===t?"bg-pink-100 text-pink-800":"bg-gray-100 text-gray-700":"bg-gray-100 text-gray-700"),children:e.action||"?"})}),(0,s.jsx)("td",{className:"px-3 py-2 align-top text-xs",children:e.ticketId?(0,s.jsxs)("a",{href:"/admin/customer-support/tickets/".concat(e.ticketId),className:"text-blue-600",children:["#",e.ticketId]}):(0,s.jsx)("span",{className:"text-gray-400",children:"bulk"})}),(0,s.jsx)("td",{className:"px-3 py-2 align-top text-xs",children:(0,s.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium ".concat(e.zendeskStatusCode>=200&&e.zendeskStatusCode<300?"bg-emerald-100 text-emerald-800":"bg-red-100 text-red-800"),children:e.zendeskStatusCode||"?"})}),(0,s.jsx)("td",{className:"px-3 py-2 align-top text-xs text-right",children:(0,s.jsx)("button",{onClick:()=>{var t;(t=e.id)&&S(e=>{let a=new Set(e);return a.has(t)?a.delete(t):a.add(t),a})},className:"text-blue-600 hover:underline",children:a?"hide":"details"})})]},e.id||"".concat(e.appliedAt,"-").concat(e.ticketId)),a&&(0,s.jsx)("tr",{className:"bg-gray-50",children:(0,s.jsx)("td",{colSpan:6,className:"px-3 py-3",children:(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 text-[11px]",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-semibold text-gray-700 mb-1",children:"payload"}),(0,s.jsx)("pre",{className:"bg-white border border-gray-200 rounded p-2 overflow-x-auto whitespace-pre-wrap",children:o(e.payloadJson)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-semibold text-gray-700 mb-1",children:"priorState"}),(0,s.jsx)("pre",{className:"bg-white border border-gray-200 rounded p-2 overflow-x-auto whitespace-pre-wrap",children:e.priorStateJson?o(e.priorStateJson):"(not applicable)"})]}),e.zendeskBodySnippet&&(0,s.jsxs)("div",{className:"md:col-span-2",children:[(0,s.jsx)("div",{className:"font-semibold text-gray-700 mb-1",children:"zendesk response (first 500 chars)"}),(0,s.jsx)("pre",{className:"bg-white border border-gray-200 rounded p-2 overflow-x-auto whitespace-pre-wrap",children:e.zendeskBodySnippet})]})]})})},"".concat(e.id,"-detail"))]})})]})]})})]})})}},67972:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/customer-support/audit",function(){return a(67574)}])}},e=>{e.O(0,[7497,636,6593,8792],()=>e(e.s=67972)),_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.