'use client'; import { FiAlertTriangle } from 'react-icons/fi'; import { EnterpriseMatch, GraphInsightsPayload, PublicBadgeData, ScoringSummary, TopBusinessRule } from './types'; // import ShareButton from './components/ShareButton'; import EnterpriseCoaching from './components/EnterpriseCoaching'; import IpRiskAnalysisDisplay from './components/IpRiskAnalysisDisplay'; import ReportHeader from './components/ReportHeader'; // import Image from 'next/image'; import ConnectedPlatforms from './components/ConnectedPlatforms'; import GaugeCard from './components/GaugeCard'; import GraphInsights from './components/GraphInsights'; import RiskCard from './components/RiskCard'; import RoleOverviewCard from './components/RoleOverviewCard'; import ChatWidget from './chat/ChatWidget'; import { yellow } from './colors'; import { BusinessRulesProvider } from './components/BusinessRulesContext'; import CategoryBars from './components/CategoryBars'; import Reveal from './components/Reveal'; import SkillsBubble from './components/SkillsBubble'; import SkillsValidation from './components/SkillsValidation'; import TopContributingFactors from './components/TopContributingFactors'; import UseCases from './components/UseCases'; import { formatLocalDateTime } from './utils/date'; // import AiUsageBody from './components/AiUsageBody'; import AppendixContent from './components/AppendixContent'; import { getCategoryTooltipCopy } from './utils/provider'; const DEFAULT_AI_CATEGORY_ORDER = [ 'Ecosystems & Providers', 'Orchestration & Dev', 'Specialized AI', 'Machine Learning', 'Infrastructure', 'Governance', ] as const; type ChatWidgetProps = Partial<{ api: string; title: string; hintText: string; loginPath: string; headerOffset: 'auto' | 'none' | number; developerName: string; }>; // const hexToRgba = (hex: string, alpha: number) => { // const clean = hex.replace('#', ''); // const r = parseInt(clean.substring(0, 2), 16); // const g = parseInt(clean.substring(2, 4), 16); // const b = parseInt(clean.substring(4, 6), 16); // return `rgba(${r}, ${g}, ${b}, ${alpha})`; // }; const SharedBadgeDisplay = ({ badgeData, chatProps, headless }: { badgeData: PublicBadgeData, chatProps?: ChatWidgetProps, headless?: boolean }) => { const { badgeId, developerName, assessmentResult, updatedAt, // connectedAccounts } = badgeData; const { // report_summary, // developer_trust_explanation, screening_sources, // industry_considerations } = assessmentResult; const graphInsights: GraphInsightsPayload = (assessmentResult)?.graph_insights || {} as GraphInsightsPayload; const scoringSummary: ScoringSummary = (assessmentResult)?.scoring_summary || {} as ScoringSummary; const wrapperMaxWidth = 'max-w-5xl'; const isHeadless = !!headless; // Overall and genre scores const overallFinalPercent = assessmentResult?.final_percent || 0; // Build category display grouped by genres from scoring_summary.config.genre_mapping const genreMapping = (scoringSummary?.config?.genre_mapping) || {}; const categoryScores = (scoringSummary?.category_scores) || {}; const categoryTopByGraph = (graphInsights?.categoryTopBusiness) || {}; const aiCategoryOrder = graphInsights?.aiCategoryOrder && graphInsights.aiCategoryOrder.length > 0 ? graphInsights.aiCategoryOrder : [...DEFAULT_AI_CATEGORY_ORDER]; const aiCategoryScores = (graphInsights?.aiCategoryScores) || {}; const aiCategoryTopByGraph = (graphInsights?.aiCategoryTopBusiness) || {}; const roleTargets: Record | undefined = (() => { try { const em: EnterpriseMatch | undefined = assessmentResult?.enterprise_match; return (em && em.role && em.role.categoryTargets) ? (em.role.categoryTargets as Record) : undefined; } catch { return undefined; } })(); const hasEnterpriseMatch = !!assessmentResult?.enterprise_match; const topBusinessForGenre = (genre: string) => { const cats: string[] = (genreMapping)?.[genre] || []; const items = []; for (const c of cats) { const arr = (categoryTopByGraph)?.[c] || []; for (const it of arr) items.push(it); } items.sort((a, b) => Number(b?.weight || 0) - Number(a?.weight || 0)); return items.slice(0, 3) as TopBusinessRule[]; }; const skillsMatrix = assessmentResult?.skills_matrix || { skills: [] }; const skillsAll = assessmentResult?.skills_all || { skills: [] }; const connected = badgeData?.connectedAccounts || []; return (
{isHeadless && ( )} {/* Overview quadrant layout (mirrors SharedBadgeDisplay overview) */}
(a?.name || '').toLowerCase())} connectedAccounts={connected} rightBadgeLayout={!hasEnterpriseMatch} />
{hasEnterpriseMatch && (
{(() => { const em = assessmentResult?.enterprise_match; if (!em) return null; const role = em.role || {}; return ( ); })()}
)}
{(() => { const uiTech = graphInsights?.uiSummary?.technical || {}; const techPct = Math.round(Number(uiTech?.percent ?? 0)); const techLabel = uiTech?.label || 'EVIDENCE'; return ( ); })()}
{(() => { const uiRisk = graphInsights?.uiSummary?.risk || {}; const riskPctGood = Math.round(Number(uiRisk?.percent_good ?? 0)); const riskLabel = uiRisk?.label || 'RISK'; return ( ); })()}

Skills Footprint

{/* Coaching / Evidence under header when present */} {(() => { const em = assessmentResult.enterprise_match; const coaching = em?.coaching; if (!coaching || !(Array.isArray(coaching.items) && coaching.items.length)) return null; return ( ); })()}
{/* Enterprise Use Cases (directly under the three summary cards) */} {assessmentResult?.enterprise_use_cases?.items && assessmentResult.enterprise_use_cases.items.length > 0 && ( )} {/* Technical Scores */}
KYD Technical {/* technical graph insights */}
{/* category bars and contributing factors */}
{/* Left: Bars */} {/* Right: Contributing Factors (hidden on small screens) */}
Top Contributing Factors

KYD Technical - Skills Insights

KYD Risk - Overview {/* Risk Graph Insights and Category Bars */}
{/* Left: Bars */} {/* Right: Contributing Factors (hidden on small screens) */}
Top Contributing Factors
{/* cyber risk display */} {badgeData.optOutScreening ? (

User Opted Out of Screening

The user chose not to participate in the automated sanctions and risk screening process. The risk score reflects this decision and is for informational purposes only.

) : ( <> {/* Sanctions match cards are temporarily not displayed in PDF/downloaded reports. The screening data is still generated and stored — this is a display-only suppression. To re-enable, restore: */} )}
KYD AI
Top Contributing Factors

KYD AI - Skills Insights

{/* Connected Platforms */}

Appendix

{/* Skills */} {/* screeningSources is intentionally passed as undefined to suppress the Sanctions & Watchlists appendix section from PDF/downloaded reports. The data is still generated and stored. To re-enable, change screeningSources back to: screeningSources={!badgeData.optOutScreening ? screening_sources : undefined} */} } screeningSources={undefined} headless={isHeadless} skillsAll={skillsAll} />
Report Completed: {formatLocalDateTime(updatedAt)}

© 2025 Know Your Developer, LLC. All rights reserved. KYD Self-Check™, and associated marks are trademarks of Know Your Developer, LLC. This document is confidential, proprietary, and intended solely for the individual or entity to whom it is addressed. Unauthorized use, disclosure, copying, or distribution of this document or any of its contents is strictly prohibited and may be unlawful. Know Your Developer, LLC assumes no responsibility or liability for any errors or omissions contained herein. Report validity subject to the terms and conditions stated on the official Know Your Developer website located at https://knowyourdeveloper.ai.

{/* Floating chat widget */} {!headless && ( )}
); }; export default SharedBadgeDisplay;