// evaluation-soc2-engine.jsx — Verigo Global: SOC 2 readiness evaluation engine // Questions, scoring, quiz + results components, and a results-PDF generator. // Common Criteria are assessed across the CC1–CC9 series, then each optional category. // Exposes window.EVAL_SOC2 const { V: GV, MAXW: GMW, FONT: GFT } = window; /* ── QUESTION BANK — Common Criteria (CC1–CC9) + optional categories ─── */ // Each question is [criterion code, statement] so every answer maps to a specific SOC 2 criterion. const SQUESTIONS = [ { group: 'Security · Common Criteria', theme: 'CC1–CC3 · Governance, Risk & Communication', icon: 'briefcase', controls: 12, docs: ['Information Security Policy', 'Risk Assessment & Management Policy', 'Human Resources Security Policy'], q: [ ['CC1.1', 'Management has defined and communicated integrity and ethical values, with a code of conduct staff acknowledge.'], ['CC1.3', 'Organizational structures, reporting lines, and security roles & authorities are formally defined.'], ['CC2.2', 'Security objectives and responsibilities are communicated internally to those who need them.'], ['CC3.2', 'A documented risk assessment identifies, analyzes, and rates risks to in-scope systems.'], ] }, { group: 'Security · Common Criteria', theme: 'CC4–CC5 · Monitoring & Control Activities', icon: 'activity', controls: 5, docs: ['Logging & Monitoring Policy', 'Control Owner Review Procedure'], q: [ ['CC4.1', 'Controls are monitored through a mix of ongoing and periodic evaluations.'], ['CC4.2', 'Control deficiencies are tracked to remediation and communicated to management.'], ['CC5.2', 'General IT controls (baseline configurations, segregation of duties) are selected and deployed.'], ] }, { group: 'Security · Common Criteria', theme: 'CC6 · Logical & Physical Access', icon: 'lock', controls: 8, docs: ['Access Control Policy', 'Access Provisioning & Deprovisioning Procedure', 'Physical & Environmental Security Policy'], q: [ ['CC6.1', 'Logical access is protected by an identity provider, MFA, and least-privilege entitlements.'], ['CC6.2', 'New user access is registered and authorized before it is granted.'], ['CC6.3', 'Access rights are reviewed and recertified on a defined cadence (e.g., quarterly).'], ['CC6.4', 'Physical access to facilities and data environments is restricted and logged.'], ] }, { group: 'Security · Common Criteria', theme: 'CC7 · System Operations', icon: 'refresh', controls: 5, docs: ['Vulnerability Management Policy', 'Logging & Monitoring Procedure', 'Incident Response Procedure'], q: [ ['CC7.1', 'Vulnerabilities and configuration changes are detected through scanning and monitoring.'], ['CC7.2', 'System components are monitored for anomalies and security events.'], ['CC7.4', 'Security events are evaluated and incidents are responded to on a documented, exercised process.'], ] }, { group: 'Security · Common Criteria', theme: 'CC8–CC9 · Change Management & Risk Mitigation', icon: 'layers', controls: 3, docs: ['Change Management Policy', 'Business Continuity & Disaster Recovery Policy', 'Vendor & Third-Party Management Policy'], q: [ ['CC8.1', 'Changes to infrastructure and software are authorized, tested, and approved before release.'], ['CC9.1', 'Business-disruption risks are mitigated through continuity and recovery planning.'], ['CC9.2', 'Vendor and subservice-organization risk is assessed and monitored.'], ] }, { group: 'Optional category', theme: 'Availability', icon: 'gauge', controls: 3, docs: ['Business Continuity & Disaster Recovery Policy', 'Backup Policy'], q: [ ['A1.1', 'System capacity is monitored and managed against processing demand.'], ['A1.2', 'Backups are performed, encrypted, and supported by recovery infrastructure.'], ['A1.3', 'Disaster recovery plans are tested at least annually.'], ] }, { group: 'Optional category', theme: 'Confidentiality', icon: 'shield', controls: 2, docs: ['Data Classification & Handling Policy', 'Encryption & Key Management Policy'], q: [ ['C1.1', 'Confidential information is identified, classified, and protected across its lifecycle.'], ['C1.2', 'Confidential information is securely disposed of when no longer required.'], ] }, { group: 'Optional category', theme: 'Processing Integrity', icon: 'check', controls: 5, docs: ['Change Management Policy', 'Secure Software Development Policy'], q: [ ['PI1.2', 'System inputs are validated for completeness and accuracy.'], ['PI1.3', 'Processing is monitored to be complete, valid, accurate, and timely.'], ['PI1.4', 'System outputs are reviewed and reconciled for accuracy.'], ] }, { group: 'Optional category', theme: 'Privacy', icon: 'users', controls: 18, docs: ['Privacy Policy', 'Data Retention & Disposal Policy'], q: [ ['P1.1', 'A privacy notice describes how personal information is collected and used.'], ['P2.1', 'Choice and consent are obtained before collecting personal information.'], ['P4.3', 'Personal information is retained only as long as needed and disposed of securely.'], ['P5.1', 'Data-subject access and correction requests are handled on a defined process.'], ] }, ]; const SOPTIONS = [ ['Not started', 0], ['Partial', 1], ['Largely', 2], ['Fully', 3], ]; const SBANDS = [ [0, 'Initial', GV.orange, 'Foundations are largely missing — start with the core policy and risk set.'], [40, 'Developing', GV.orange, 'Key pieces exist, but real gaps remain before an examination is viable.'], [60, 'Established', GV.purple, 'A working control environment is in place — focus on closing the weaker areas.'], [80, 'Optimized', GV.purple, 'Strong posture — fine-tune evidence and keep it continuous.'], ]; const sBandFor = (pct) => { let b = SBANDS[0]; SBANDS.forEach((x) => { if (pct >= x[0]) b = x; }); return b; }; // Sections in scope: Common Criteria are always included; optional categories only if selected. function sSectionsInScope(criteria) { return SQUESTIONS.filter((s) => s.group === 'Security · Common Criteria' || !criteria || criteria.indexOf(s.theme) !== -1); } function sCompute(answers, sections) { const secs = sections || SQUESTIONS; const themes = secs.map((t, ti) => { const max = t.q.length * 3; let sum = 0; t.q.forEach((_, qi) => { sum += (answers[ti + '-' + qi] || 0); }); const pct = Math.round((sum / max) * 100); return { theme: t.theme, group: t.group, icon: t.icon, docs: t.docs, controls: t.controls, pct, gaps: Math.round((1 - pct / 100) * t.controls) }; }); const totSum = themes.reduce((a, t) => a + (t.pct), 0); const overall = themes.length ? Math.round(totSum / themes.length) : 0; const gaps = themes.reduce((a, t) => a + t.gaps, 0); const totalControls = secs.reduce((a, t) => a + t.controls, 0); return { themes, overall, gaps, totalControls, band: sBandFor(overall) }; } /* ── SEGMENTED MATURITY CONTROL ──────────────────────────── */ const SSegmented = ({ value, onChange }) => (
{SOPTIONS.map(([label, val]) => { const on = value === val; return ( ); })}
); /* ── QUIZ ────────────────────────────────────────────────── */ const EvalQuizSOC2 = ({ onComplete, onExit, criteria, initialAnswers, initialStep, onProgress }) => { const sections = React.useMemo(() => sSectionsInScope(criteria), [criteria]); const [step, setStep] = React.useState(() => Math.min(Math.max(initialStep || 0, 0), sections.length - 1)); const [answers, setAnswers] = React.useState(() => initialAnswers || {}); const total = sections.length; const cur = sections[step]; const report = (a, s) => { if (onProgress) onProgress(a, s); }; const set = (qi, v) => setAnswers((a) => { const na = { ...a, [step + '-' + qi]: v }; report(na, step); return na; }); const stepDone = cur.q.every((_, qi) => answers[step + '-' + qi] !== undefined); const answeredCount = Object.keys(answers).length; const totalQ = sections.reduce((a, t) => a + t.q.length, 0); const progress = Math.round((answeredCount / totalQ) * 100); const next = () => { if (step < total - 1) { const ns = step + 1; setStep(ns); report(answers, ns); window.scrollTo({ top: 0 }); } else { onComplete(sCompute(answers, sections)); } }; const back = () => { if (step > 0) { const ns = step - 1; setStep(ns); report(answers, ns); window.scrollTo({ top: 0 }); } else { onExit(); } }; return (
Section {step + 1} of {total} {progress}% complete
{cur.group}

{cur.theme}

For each statement, choose how completely it reflects your organization today. Each maps to a specific SOC 2 criterion.

{cur.q.map(([code, text], qi) => (
{code}

{text}

set(qi, v)} />
))}
{step === 0 ? 'Exit' : 'Back'} {step === total - 1 ? 'See my results' : 'Next section'}
{!stepDone &&

Answer all {cur.q.length} statements to continue.

}
Your progress is saved automatically — you can leave and resume this evaluation later.
); }; /* ── RESULTS ─────────────────────────────────────────────── */ const SDonut = ({ pct, color }) => (
{pct} / 100
); const EvalResultsSOC2 = ({ results, user, onNav, onRetake }) => { const { themes, overall, gaps, band } = results; const [, label, bandColor, bandDesc] = band; const sorted = [...themes].sort((a, b) => a.pct - b.pct); const focus = sorted.filter((t) => t.pct < 80); const MODULES = window.TK_SOC2.QUOTE_MODULES; const reco = new Set(['tailor']); if (overall < 80) reco.add('guidance'); if (overall < 60) { reco.add('impl'); reco.add('preaudit'); } themes.forEach((t) => { if (t.pct < 60) { if (t.group === 'Security · Common Criteria') { reco.add('evidence'); reco.add('cpa'); } if (t.theme === 'Availability') reco.add('cpa'); if (t.theme === 'Privacy' || t.theme === 'Confidentiality' || t.theme === 'Processing Integrity') reco.add('criteria'); } }); const recoIds = [...reco]; const recoModules = MODULES.filter((m) => reco.has(m.id)); const goBuild = () => { try { localStorage.setItem('verigo_reco_soc2', JSON.stringify(recoIds)); } catch (e) {} onNav('checkout'); }; return (
{/* SCORE HEADER */}
Your readiness report
Overall maturity · {label}

{overall >= 80 ? 'You\u2019re close to examination-ready.' : overall >= 60 ? 'A solid base, with clear gaps to close.' : 'There\u2019s real groundwork to do first.'}

{bandDesc} We estimate ~{gaps} of {results.totalControls} criteria need attention before your examination. {user && user.company ? ` Prepared for ${user.company}.` : ''}

{/* THEME BREAKDOWN */}
{themes.map((t, i) => { const c = t.pct < 60 ? GV.orange : GV.purple; return (
{t.theme} {t.pct}%
~{t.gaps} of {t.controls} criteria need attention
); })}
{/* ACTION PLAN */}
{focus.length === 0 && (
Every area scored 80%+ — you\u2019re in strong shape. A practitioner can help validate evidence and close the final details.
)} {focus.map((t, i) => (
{i + 1}

{t.theme}

{t.pct}%
{t.docs.map((d, di) => ( {d} ))}
onNav('toolkit:soc2')} style={{ whiteSpace: 'nowrap' }}>Open toolkit
))}
window.EVAL_SOC2.generateEvalPDF(results, user)}> Download my results (PDF) Retake the evaluation
{/* CUSTOM PACKAGE CTA */}
{recoModules.map((m, i) => (
{m.name}
{m.desc}
))}
Build my custom package Pick your options, see the price, then download a custom quote.
); }; /* ── RESULTS PDF ─────────────────────────────────────────── */ function genEvalPDFSOC2(results, user) { const lib = window.jspdf; if (!lib || !lib.jsPDF) { alert('PDF engine is still loading — please try again in a moment.'); return; } const { themes, overall, gaps, band } = results; const doc = new lib.jsPDF({ unit: 'pt', format: 'a4' }); const W = doc.internal.pageSize.getWidth(); const H = doc.internal.pageSize.getHeight(); const M = 50; const PURPLE = [91, 46, 145], ORANGE = [232, 98, 42], INK = [30, 30, 46], GREY = [120, 120, 134]; let y = 100; doc.setFillColor(...PURPLE); doc.rect(0, 0, W, 70, 'F'); doc.setFillColor(...ORANGE); doc.rect(W - M - 11, 28, 11, 11, 'F'); doc.setTextColor(255, 255, 255); doc.setFont('helvetica', 'bold'); doc.setFontSize(15); doc.text('VERIGO GLOBAL', M, 33); doc.setFont('helvetica', 'normal'); doc.setFontSize(8.5); doc.setTextColor(214, 204, 232); doc.text('Compliance by Design', M, 49); doc.setTextColor(255, 255, 255); doc.setFontSize(8.5); doc.text('AICPA · SOC 2', W - M - 20, 35, { align: 'right' }); doc.setTextColor(...INK); doc.setFont('helvetica', 'bold'); doc.setFontSize(21); doc.text('SOC 2 Readiness Report', M, y); y += 12; doc.setDrawColor(...ORANGE); doc.setLineWidth(2.5); doc.line(M, y, M + 54, y); y += 24; doc.setFont('helvetica', 'bold'); doc.setFontSize(40); doc.setTextColor(...PURPLE); doc.text(String(overall), M, y + 14); doc.setFontSize(11); doc.setTextColor(...GREY); doc.setFont('helvetica', 'normal'); doc.text('/ 100', M + 58, y + 14); doc.setFont('helvetica', 'bold'); doc.setFontSize(13); doc.setTextColor(...INK); doc.text('Overall maturity: ' + band[1], M + 130, y - 2); doc.setFont('helvetica', 'normal'); doc.setFontSize(10); doc.setTextColor(...GREY); doc.splitTextToSize('~' + gaps + ' of ' + (results.totalControls || 61) + ' criteria need attention before your examination. ' + band[3], W - M - (M + 130)).forEach((ln, i) => doc.text(ln, M + 130, y + 14 + i * 13)); y += 56; if (user && (user.company || user.name)) { doc.setDrawColor(224, 224, 232); doc.setLineWidth(0.5); doc.line(M, y, W - M, y); y += 16; doc.setFontSize(9); doc.setTextColor(...PURPLE); doc.setFont('helvetica', 'bold'); doc.text('Prepared for ' + (user.company || user.name), M, y); doc.setFont('helvetica', 'normal'); doc.setTextColor(...GREY); doc.text(new Date().toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' }), W - M, y, { align: 'right' }); y += 22; } doc.setFont('helvetica', 'bold'); doc.setFontSize(12.5); doc.setTextColor(...PURPLE); doc.text('Maturity by criterion area', M, y); y += 6; doc.setDrawColor(...PURPLE); doc.setLineWidth(0.8); doc.line(M, y, W - M, y); y += 20; const barX = M + 230, barW = W - M - barX; themes.forEach((t) => { if (y > H - 70) { doc.addPage(); y = 60; } doc.setFont('helvetica', 'bold'); doc.setFontSize(9.5); doc.setTextColor(...INK); doc.splitTextToSize(t.theme, 210).forEach((ln, i) => doc.text(ln, M, y + 3 + i * 11)); doc.setFillColor(237, 237, 245); doc.rect(barX, y - 7, barW, 10, 'F'); const col = t.pct < 60 ? ORANGE : PURPLE; doc.setFillColor(...col); doc.rect(barX, y - 7, barW * (t.pct / 100), 10, 'F'); doc.setFont('helvetica', 'bold'); doc.setFontSize(10); doc.setTextColor(...col); doc.text(t.pct + '%', W - M, y + 3, { align: 'right' }); y += 26; }); y += 6; const focus = [...themes].sort((a, b) => a.pct - b.pct).filter((t) => t.pct < 80); if (focus.length) { if (y > H - 90) { doc.addPage(); y = 60; } doc.setFont('helvetica', 'bold'); doc.setFontSize(12.5); doc.setTextColor(...PURPLE); doc.text('Recommended next steps', M, y); y += 6; doc.setDrawColor(...PURPLE); doc.setLineWidth(0.8); doc.line(M, y, W - M, y); y += 18; focus.forEach((t, i) => { if (y > H - 90) { doc.addPage(); y = 60; } doc.setFont('helvetica', 'bold'); doc.setFontSize(10.5); doc.setTextColor(...INK); doc.text((i + 1) + '. ' + t.theme + ' (' + t.pct + '%)', M, y); y += 14; doc.setFont('helvetica', 'normal'); doc.setFontSize(9.5); doc.setTextColor(...GREY); doc.splitTextToSize('Toolkit documents: ' + t.docs.join(', '), W - 2 * M - 14).forEach((ln) => { doc.text(ln, M + 14, y); y += 12; }); y += 8; }); } const total = doc.internal.getNumberOfPages(); for (let i = 1; i <= total; i++) { doc.setPage(i); doc.setDrawColor(224, 224, 232); doc.setLineWidth(0.5); doc.line(M, H - 38, W - M, H - 38); doc.setFont('helvetica', 'normal'); doc.setFontSize(8); doc.setTextColor(150, 150, 160); doc.text('© 2026 Verigo Global · Readiness self-assessment — indicative, not a formal examination', M, H - 24); doc.text(i + ' / ' + total, W - M, H - 24, { align: 'right' }); } doc.save('Verigo-SOC2-Readiness-Report.pdf'); } window.EVAL_SOC2 = { QUESTIONS: SQUESTIONS, OPTIONS: SOPTIONS, BANDS: SBANDS, computeResults: sCompute, EvalQuiz: EvalQuizSOC2, EvalResults: EvalResultsSOC2, generateEvalPDF: genEvalPDFSOC2 }; Object.assign(window, { EvalQuizSOC2, EvalResultsSOC2 });