PageSourceSearch

https://agentchecker.ai/assets/AuditNew-XwYdhXPv.js

js agentchecker.ai collected 2026-10-05 11:47:33 UTC 5,252 bytes, 1 lines download raw bytes

1import{c as A,l as I,r as i,q as N,aq as d,j as e,T as _}from"./app-PfWi3kO6.js";import{I as E}from"./input-BldBHK-M.js";import{L as p}from"./label-0QIBO9un.js";import{T as q}from"./textarea-BVwFB7pu.js";import{S as P,a as U,b as M,c as R,d as C}from"./select-BS-mK9m1.js";import{B as S}from"./badge-Dj4w2ajA.js";import{n as B}from"./normalizeUrl-DECtg5dV.js";import{L as Q}from"./loader-circle-DwzaXTEL.js";import{F as z}from"./flask-conical-Dz6Ddli4.js";import"./index-CiJ9j9Ez.js";const Y=()=>{A("New Audit | Admin");const g=I(),[m,w]=i.useState(""),[o,F]=i.useState(""),[x,T]=i.useState(""),[h,L]=i.useState([]),[f,j]=i.useState(!0),[n,y]=i.useState(!1),b=i.useCallback(async()=>{j(!0);const{data:s,error:t}=await N.invoke("admin-test-categories",{method:"GET"});t?d.error(t.message||"Failed to load test categories"):s!=null&&s.categories&&L(s.categories),j(!1)},[]);i.useEffect(()=>{b()},[b]);const r=i.useMemo(()=>[...h].filter(s=>s.is_active).sort((s,t)=>{const a=Number(s.is_admin_only)-Number(t.is_admin_only);return a!==0?a:s.sort_order!==t.sort_order?s.sort_order-t.sort_order:s.display_name.localeCompare(t.display_name)}),[h]),c=i.useMemo(()=>{const s=r.filter(a=>!a.is_admin_only),t=r.filter(a=>a.is_admin_only);return{publicCats:s,testingCats:t}},[r]),l=i.useMemo(()=>r.find(s=>
1s.slug===o)||null,[r,o]),v=!n&&m.trim().length>0&&o.length>0&&!!l,k=async s=>{if(s.preventDefault(),!v)return;const t=B(m);if(!t){d.error("Please enter a valid URL (e.g. example.com)");return}y(!0);const{data:a,error:u}=await N.invoke("admin-test-audit",{body:{url:t,fullAudit:!0,businessType:o,customInstructions:x.trim()||void 0}});if(y(!1),u||!(a!=null&&a.auditId)){d.error((u==null?void 0:u.message)||"Failed to queue audit");return}d.success("Audit queued"),g(`/admin/audits/${a.auditId}`)};return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"New Audit"}),e.jsx("p",{className:"mt-1 text-sm text-neutral-500",children:"Queue a full audit against any URL using any test category, including admin-only categories that are hidden from the public dropdown."})]}),e.jsxs("form",{onSubmit:k,className:"space-y-6 max-w-2xl",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{htmlFor:"audit-url",children:"Website URL"}),e.jsx(E,{id:"audit-url",type:"text",inputMode:"url",placeholder:"example.com",value:m,onChange:s=>w(s.target.value),required:!0,disabled:n})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{htmlFor:"audit-category",children:"Test Category"}),e.jsxs(P,{value:o,onValueChange:F,disabled:f||n,children:[e.jsx(U,{id:"audit-category",children:e.jsx(M,{placeholder:f?"Loading...":"Select a test category"})}),e.jsx(R,{children:r.length===0?e.jsx("div",{className:"px-2 py-1.5 text-sm text-neutral-500",children:"No active categories configured"}):e.jsxs(e.Fragment,{children:[c.publicCats.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-neutral-500",children:"Public"}),c.publicCats.map(s=>e.jsx(C,{value:s.slug,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{children:s.display_name}),e.jsx(S,{variant:"outline",className:"text-[10px] uppercase",children:"Public"}),typeof s.test_count=="number"&&e.jsxs("span",{className:"text-xs text-neutral-500",children:["(",s.test_count,")"]})]})},s.slug))]}),c.testingCats.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-2 pt-2 pb-1 text-[10px] font-semibold uppercase tracking-wider text-neutral-500",children:"Testing (admin only)"}),c.testingCats.map(s=>e.jsx(C,{value:s.slug,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{children:s.display_name}),e.jsx(S,{variant:"outline",className:"text-[10px] uppercase",children:"Testing"}),typeof s.test_count=="number"&&e.jsxs("span",{className:"text-xs text-neutral-500",children:["(",s.test_count,")"]})]})},s.slug))]})]})})]}),(l==null?void 0:l.is_admin_only)&&e.jsx("p",{className:"text-xs text-neutral-500",children:"Testing category, hidden from the public business-type dropdown."}),l&&!l.is_admin_only&&e.jsx("p",{className:"text-xs text-neutral-500",children:"Public category, also available to end users."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{htmlFor:"audit-custom-instructions",children:"Custom Instructions (optional)"}),e.jsx(q,{id:"audit-custom-instructions",placeholder:"E.g., Focus on the checkout form's accessibility for screen readers",value:x,onChange:s=>T(s.target.value),maxLength:500,rows:3,disabled:n}),e.jsxs("div",{className:"flex justify-between text-xs text-neutral-500",children:[e.jsx("span",{children:"Extra focus-area prompt passed to the runner."}),e.jsxs("span",{children:[x.length,"/500"]})]})]}),e.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[e.jsx(_,{type:"submit",disabled:!v,children:n?e.jsxs(e.Fragment,{children:[e.jsx(Q,{className:"mr-2 h-4 w-4 animate-spin"}),"Queueing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"mr-2 h-4 w-4"}),"Queue Audit"]})}),e.jsx(_,{type:"button",variant:"outline",onClick:()=>g("/admin/audits/status"),disabled:n,children:"Cancel"})]})]})]})};export{Y 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.