kyd-shared-badge 0.3.59 → 0.3.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kyd-shared-badge",
3
- "version": "0.3.59",
3
+ "version": "0.3.61",
4
4
  "private": false,
5
5
  "main": "./src/index.ts",
6
6
  "module": "./src/index.ts",
@@ -10,15 +10,11 @@ import BusinessRuleLink from './components/BusinessRuleLink';
10
10
  import IpRiskAnalysisDisplay from './components/IpRiskAnalysisDisplay';
11
11
  import GraphInsights from './components/GraphInsights';
12
12
  import ConnectedPlatforms from './components/ConnectedPlatforms';
13
- import { FaGithub, FaGitlab, FaStackOverflow, FaLinkedin, FaGoogle, FaKaggle } from 'react-icons/fa';
14
- import { SiCredly, SiFiverr } from 'react-icons/si';
15
- import GaugeCard from './components/GaugeCard';
16
- import RiskCard from './components/RiskCard';
17
13
  import AiIcon from './components/icons/ai';
18
14
  import CodeIcon from './components/icons/code';
19
15
  import RiskIcon from './components/icons/risk';
20
16
 
21
- import { yellow, green } from './colors';
17
+ import { yellow } from './colors';
22
18
  import Skills from './components/Skills';
23
19
  import CategoryBars from './components/CategoryBars';
24
20
  import SkillsAppendixTable from './components/SkillsAppendixTable';
@@ -31,8 +27,7 @@ import SummaryCards from './components/SummaryCards';
31
27
  import TopContributingFactors from './components/TopContributingFactors';
32
28
  import AiUsageBody from './components/AiUsageBody';
33
29
  import SanctionsMatches from './components/SanctionsMatches';
34
- import AppendixContent from './components/AppendixContent';
35
- import { ProviderIcon, getProviderDisplayName, getProviderTooltipCopy, getCategoryTooltipCopy, barColor } from './utils/provider';
30
+ import { getCategoryTooltipCopy, barColor } from './utils/provider';
36
31
  import { matchLabelToColor } from './colors';
37
32
  import { useEffect, useMemo, useState } from 'react';
38
33
  type ChatWidgetProps = Partial<{
@@ -18,8 +18,9 @@ const BusinessRuleLink = ({ uid, label, className }: { uid?: string; label: stri
18
18
  {tooltip && (
19
19
  <div className="hidden group-hover:block absolute z-30 left-1/2 -translate-x-1/2 top-full mt-2 w-72">
20
20
  <div style={{ background: 'var(--content-card-background)', border: '1px solid var(--icon-button-secondary)', color: 'var(--text-main)', padding: 10, borderRadius: 6, fontSize: 12 }}>
21
- <div style={{ fontWeight: 600, color: 'var(--text-main)' }}>{meta?.category || ''}</div>
22
- <div style={{ fontSize: 12, color: 'var(--text-secondary)', marginTop: 4 }}>{meta?.likert_label || ''}</div>
21
+ <div style={{ fontWeight: 600, color: 'var(--text-secondary)' }}>
22
+ <span className='font-semibold'>{meta?.category || ''} | </span> <span>{meta?.likert_label || ''}</span>
23
+ </div>
23
24
  </div>
24
25
  </div>
25
26
  )}
@@ -2,8 +2,7 @@
2
2
 
3
3
  import React, { useEffect } from 'react';
4
4
  import { formatLocalDate } from '../utils/date';
5
- import { FaGithub, FaGitlab, FaStackOverflow, FaLinkedin, FaGoogle, FaKaggle } from 'react-icons/fa';
6
- import { SiCredly, SiFiverr } from 'react-icons/si';
5
+ import { ProviderIcon } from '../utils/provider';
7
6
 
8
7
  type ConnectedAccount = {
9
8
  name?: string;
@@ -12,19 +11,6 @@ type ConnectedAccount = {
12
11
  observedAt?: string | null;
13
12
  };
14
13
 
15
- const ProviderIcon = ({ name }: { name?: string }) => {
16
- const n = (name || '').toLowerCase();
17
- if (n.includes('github')) return <FaGithub />;
18
- if (n.includes('gitlab')) return <FaGitlab />;
19
- if (n.includes('stack')) return <FaStackOverflow />;
20
- if (n.includes('credly')) return <SiCredly />;
21
- if (n.includes('fiverr')) return <SiFiverr />;
22
- if (n.includes('kaggle')) return <FaKaggle />;
23
- if (n.includes('google')) return <FaGoogle />;
24
- if (n.includes('linkedin')) return <FaLinkedin />;
25
- return <span className="inline-block w-4 h-4 rounded-full" style={{ backgroundColor: 'var(--icon-button-secondary)' }} />;
26
- };
27
-
28
14
  const formatProviderName = (name?: string) => {
29
15
  const n = (name || '').trim();
30
16
  if (!n) return '';
@@ -6,6 +6,7 @@ import { GraphInsightsPayload, ScoringSummary } from '../types';
6
6
  import { green1, green2, green3, green4, green5 } from '../colors';
7
7
  import {
8
8
  ResponsiveContainer,
9
+ Tooltip,
9
10
  PieChart,
10
11
  Pie,
11
12
  Cell,
@@ -21,7 +22,6 @@ import {
21
22
  // CartesianGrid,
22
23
  // Legend,
23
24
  } from 'recharts';
24
- import { ChartTooltip, ChartLegend } from './ui/chart';
25
25
 
26
26
  // avoid platform based charts.
27
27
  // target over arching insights that can
@@ -272,7 +272,7 @@ const GraphInsights = ({
272
272
  <Radar name="Category Score" dataKey="score" stroke={'var(--text-main)'} fill={'var(--text-main)'} fillOpacity={0.22} isAnimationActive={!disableAnimations} />
273
273
  {/* Subtle average ring (arbitrary benchmark for comparison) */}
274
274
  <Radar name="Avg" dataKey="avg" stroke="rgba(128,128,128,0.6)" fill="rgba(128,128,128,0.08)" strokeDasharray="4 4" fillOpacity={1} isAnimationActive={!disableAnimations} />
275
- <ChartTooltip content={<RadarCategoryTooltip />} />
275
+ <Tooltip content={<RadarCategoryTooltip />} />
276
276
  </RadarChart>
277
277
  </ResponsiveContainer>
278
278
  {!headless && labelHover && (
@@ -357,28 +357,35 @@ const GraphInsights = ({
357
357
  </Pie>
358
358
  );
359
359
  })()}
360
- <ChartTooltip content={<CategoryPieTooltip />} />
360
+ <Tooltip content={<CategoryPieTooltip />} />
361
361
  </PieChart>
362
362
  </ResponsiveContainer>
363
363
 
364
364
  </div>
365
365
  {/* Legend below the pie chart: includes 0% categories */}
366
366
  <div className="mt-3">
367
- {(() => {
368
- const palette = [green1, green2, green3, green4, green5];
369
- const pieNames = categoryData.map((d) => d.category);
370
- const getColor = (name: string) => {
371
- const idx = pieNames.indexOf(name);
372
- return idx >= 0 ? palette[idx % palette.length] : 'rgba(128,128,128,0.5)';
373
- };
374
- const items = legendData.map((item) => ({
375
- color: getColor(item.name),
376
- label: item.name,
377
- value: `${Math.round(((item?.share ?? 0) * 100))}%`,
378
- }));
379
- return <ChartLegend items={items} />;
380
- })()}
381
- </div>
367
+ {(() => {
368
+ const palette = [green1, green2, green3, green4, green5];
369
+ const pieNames = categoryData.map((d) => d.category);
370
+ const getColor = (name: string) => {
371
+ const idx = pieNames.indexOf(name);
372
+ return idx >= 0 ? palette[idx % palette.length] : 'rgba(128,128,128,0.5)';
373
+ };
374
+ return (
375
+ <div className="flex flex-wrap items-center justify-center gap-x-4 gap-y-2" style={{ color: 'var(--text-secondary)', fontSize: 12 }}>
376
+ {legendData.map((item, idx) => {
377
+ const pct = Math.round(((item?.share ?? 0) * 100));
378
+ return (
379
+ <div key={`legend-${item.name}-${idx}`} className="flex items-center gap-2">
380
+ <span style={{ display: 'inline-block', width: 10, height: 10, background: getColor(item.name), border: '1px solid var(--icon-button-secondary)' }} />
381
+ <span>{item.name} {pct}%</span>
382
+ </div>
383
+ );
384
+ })}
385
+ </div>
386
+ );
387
+ })()}
388
+ </div>
382
389
  </div>
383
390
  </div>
384
391
  </div>
@@ -10,8 +10,8 @@ import {
10
10
  XAxis,
11
11
  YAxis,
12
12
  CartesianGrid,
13
+ Tooltip,
13
14
  } from 'recharts';
14
- import { ChartTooltip } from './ui/chart';
15
15
 
16
16
 
17
17
  type SkillsRadarPoint = {
@@ -389,7 +389,7 @@ const Skills = ({ skillsCategoryRadar, headless }: { skillsMatrix?: SkillsMatrix
389
389
  <CartesianGrid strokeDasharray="3 3" stroke={'var(--icon-button-secondary)'} />
390
390
  <XAxis dataKey="axis" tick={{ fill: 'var(--text-secondary)', fontSize: 12 }} interval={0} angle={-20} textAnchor="end" height={50} />
391
391
  <YAxis domain={[0, 100]} tick={{ fill: 'var(--text-secondary)' }} />
392
- <ChartTooltip />
392
+ <Tooltip contentStyle={{ background: 'var(--content-card-background)', border: `1px solid var(--icon-button-secondary)`, color: 'var(--text-main)' }} />
393
393
  <Bar dataKey="observed" name="Observed" fill={'var(--bar-observed)'} isAnimationActive={!disableAnimations} />
394
394
  <Bar dataKey="self_reported" name="Self-reported" fill={'var(--bar-self-reported)'} isAnimationActive={!disableAnimations} />
395
395
  <Bar dataKey="certified" name="Certified" fill={'var(--bar-certified)'} isAnimationActive={!disableAnimations} />
@@ -1,20 +1,22 @@
1
1
  'use client';
2
2
 
3
- import React from 'react';
4
3
  import { FaGithub, FaGitlab, FaStackOverflow, FaLinkedin, FaGoogle, FaKaggle } from 'react-icons/fa';
5
- import { SiCredly, SiFiverr } from 'react-icons/si';
4
+ import { SiCoursera, SiCredly, SiFiverr, SiToptal, SiUdemy } from 'react-icons/si';
6
5
 
7
- export const ProviderIcon = ({ name }: { name?: string }) => {
6
+ export const ProviderIcon = ({ name, className }: { name?: string; className?: string }) => {
8
7
  const n = (name || '').toLowerCase();
9
- if (n.includes('github')) return <FaGithub />;
10
- if (n.includes('gitlab')) return <FaGitlab />;
11
- if (n.includes('stack')) return <FaStackOverflow />;
12
- if (n.includes('credly')) return <SiCredly />;
13
- if (n.includes('fiverr')) return <SiFiverr />;
14
- if (n.includes('kaggle')) return <FaKaggle />;
15
- if (n.includes('google')) return <FaGoogle />;
16
- if (n.includes('linkedin')) return <FaLinkedin />;
17
- return <span className="inline-block w-3 h-3 rounded-full" style={{ backgroundColor: 'var(--icon-button-secondary)' }} />;
8
+ if (n.includes('github')) return <FaGithub className={className} />;
9
+ if (n.includes('gitlab')) return <FaGitlab className={className} />;
10
+ if (n.includes('stack')) return <FaStackOverflow className={className} />;
11
+ if (n.includes('credly')) return <SiCredly className={className} />;
12
+ if (n.includes('fiverr')) return <SiFiverr className={className} />;
13
+ if (n.includes('kaggle')) return <FaKaggle className={className} />;
14
+ if (n.includes('google')) return <FaGoogle className={className} />;
15
+ if (n.includes('linkedin')) return <FaLinkedin className={className} />;
16
+ if (n.includes('toptal')) return <SiToptal className={className} />;
17
+ if (n.includes('coursera')) return <SiCoursera className={className} />;
18
+ if (n.includes('udemy')) return <SiUdemy className={className} />;
19
+ return <span className={className || 'inline-block w-3 h-3 rounded-full'} style={{ backgroundColor: 'var(--icon-button-secondary)' }} />;
18
20
  };
19
21
 
20
22
  export const getProviderDisplayName = (name?: string): string => {
@@ -27,6 +29,9 @@ export const getProviderDisplayName = (name?: string): string => {
27
29
  if (n.includes('kaggle')) return 'Kaggle';
28
30
  if (n.includes('google')) return 'Google Scholar';
29
31
  if (n.includes('linkedin')) return 'LinkedIn';
32
+ if (n.includes('toptal')) return 'TopTal';
33
+ if (n.includes('coursera')) return 'Coursera';
34
+ if (n.includes('udemy')) return 'Udemy';
30
35
  return name || 'Provider';
31
36
  };
32
37
 
@@ -40,23 +45,26 @@ export const getProviderTooltipCopy = (provider?: string): string => {
40
45
  if (n.includes('kaggle')) return 'Competition results, notebooks, and dataset contributions that reflect analytical skill.';
41
46
  if (n.includes('google')) return 'Publications, citations, and scholarly presence indicating research impact.';
42
47
  if (n.includes('linkedin')) return 'Professional history, endorsements, and network signals indicating credibility.';
48
+ if (n.includes('toptal')) return 'Professional history, endorsements, and network signals indicating credibility.';
49
+ if (n.includes('coursera')) return 'Professional history, training, and course completion signals indicating credibility.';
50
+ if (n.includes('udemy')) return 'Professional history, training, and course completion signals indicating credibility.';
43
51
  return 'Signals contributed from this provider relevant to capability and trust.';
44
52
  };
45
53
 
46
54
  export const getCategoryTooltipCopy = (category: string): string => {
47
55
  const name = (category || '').toLowerCase();
48
- if (/network|connection|collab|peer/.test(name)) return 'Signals from the developers professional connections, collaborations, and peer recognition.';
49
- if (/project|repo|portfolio|work/.test(name)) return 'Signals from a developers visible projects, repositories, or published work that indicate breadth and quality of output.';
56
+ if (/network|connection|collab|peer/.test(name)) return 'Signals from the developer\'s professional connections, collaborations, and peer recognition.';
57
+ if (/project|repo|portfolio|work/.test(name)) return 'Signals from a developer\'s visible projects, repositories, or published work that indicate breadth and quality of output.';
50
58
  if (/skill|cert|assessment|endorse/.test(name)) return 'Signals tied to specific technical abilities, such as verified certifications, assessments, or endorsements.';
51
59
  if (/experience|tenure|history/.test(name)) return 'Signals of tenure and diversity of professional or project involvement over time.';
52
60
  if (/activity|recency|frequency|engage/.test(name)) return 'Signals of recency and frequency of developer engagement in professional or technical platforms.';
53
61
  if (/sanction|legal|criminal|regulatory|ofac|fbi|watchlist/.test(name)) return 'Signals of legal, criminal, or regulatory red flags linked to an identity.';
54
- if (/identity|authentic|consisten/.test(name)) return 'Signals that indicate whether a developers identity is genuine and consistent across platforms.';
62
+ if (/identity|authentic|consisten/.test(name)) return 'Signals that indicate whether a developer\'s identity is genuine and consistent across platforms.';
55
63
  if (/reputation|review|rating|feedback|perceive|peer/.test(name)) return 'Signals of how peers, clients, and communities perceive the developer.';
56
- if (/geo|jurisdiction|country|region|ip|location/.test(name)) return 'Signals tied to a developers geographic or jurisdictional context.';
64
+ if (/geo|jurisdiction|country|region|ip|location/.test(name)) return 'Signals tied to a developer\'s geographic or jurisdictional context.';
57
65
  if (/security|cyber/.test(name)) return 'Signals of security posture and potential cyber-risk exposure.';
58
66
  if (/risk/.test(name)) return 'KYD Risk surfaces signals of authenticity, reputation, and environmental telemetry that indicate potential risks in engaging with a developer.';
59
- if (/tech|technical/.test(name)) return 'KYD Technical surfaces signals from a developers portfolio, skills, experience, activity, and network to indicate the likelihood of technical capability.';
67
+ if (/tech|technical/.test(name)) return "KYD Technical surfaces signals from a developer's portfolio, skills, experience, activity, and network to indicate the likelihood of technical capability.";
60
68
  return 'Share of overall contribution by category based on applied weights.';
61
69
  };
62
70
 
@@ -1,110 +0,0 @@
1
- 'use client';
2
-
3
- import React from 'react';
4
- import { Tooltip as RechartsTooltip } from 'recharts';
5
-
6
- type ChartContainerProps = {
7
- className?: string;
8
- style?: React.CSSProperties;
9
- children: React.ReactNode;
10
- };
11
-
12
- /**
13
- * Lightweight shadcn-like chart container.
14
- * Provides a consistent surface, border, and color variables for charts.
15
- */
16
- export function ChartContainer({ className, style, children }: ChartContainerProps) {
17
- return (
18
- <div
19
- className={`rounded-lg border ${className || ''}`}
20
- style={{
21
- backgroundColor: 'var(--content-card-background)',
22
- borderColor: 'var(--icon-button-secondary)',
23
- ...style,
24
- }}
25
- >
26
- {children}
27
- </div>
28
- );
29
- }
30
-
31
- type ChartTooltipProps = {
32
- // passthrough props accepted by Recharts Tooltip
33
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
- content?: any;
35
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
- cursor?: any;
37
- };
38
-
39
- /**
40
- * shadcn-style tooltip wrapper for Recharts Tooltip.
41
- * Ensures consistent content styling (background, border, text, radius).
42
- */
43
- export function ChartTooltip({ content, cursor }: ChartTooltipProps) {
44
- return (
45
- <RechartsTooltip
46
- cursor={cursor}
47
- content={content}
48
- wrapperStyle={{ outline: 'none' }}
49
- contentStyle={{
50
- background: 'var(--content-card-background)',
51
- border: '1px solid var(--icon-button-secondary)',
52
- color: 'var(--text-main)',
53
- borderRadius: 6,
54
- padding: 10,
55
- }}
56
- itemStyle={{ color: 'var(--text-secondary)' }}
57
- labelStyle={{ color: 'var(--text-main)', fontWeight: 600 }}
58
- />
59
- );
60
- }
61
-
62
- type ChartTooltipContentProps = {
63
- title?: string;
64
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
65
- children?: any;
66
- // Optional compact body text for simpler tooltips
67
- body?: string;
68
- };
69
-
70
- /**
71
- * Generic content frame for tooltips used by charts.
72
- */
73
- export function ChartTooltipContent({ title, body, children }: ChartTooltipContentProps) {
74
- return (
75
- <div style={{ maxWidth: 320 }}>
76
- {title ? <div style={{ fontWeight: 600, color: 'var(--text-main)' }}>{title}</div> : null}
77
- {body ? (
78
- <div style={{ fontSize: 12, color: 'var(--text-secondary)', marginTop: title ? 6 : 0 }}>{body}</div>
79
- ) : null}
80
- {children}
81
- </div>
82
- );
83
- }
84
-
85
- type LegendItem = { color: string; label: string; value?: string };
86
-
87
- export function ChartLegend({ items }: { items: LegendItem[] }) {
88
- return (
89
- <div className="mt-3 flex flex-wrap items-center justify-center gap-x-4 gap-y-2" style={{ color: 'var(--text-secondary)', fontSize: 12 }}>
90
- {items.map((it, idx) => (
91
- <div key={idx} className="flex items-center gap-2">
92
- <span
93
- style={{
94
- display: 'inline-block',
95
- width: 10,
96
- height: 10,
97
- background: it.color,
98
- border: '1px solid var(--icon-button-secondary)',
99
- }}
100
- />
101
- <span>
102
- {it.label} {it.value}
103
- </span>
104
- </div>
105
- ))}
106
- </div>
107
- );
108
- }
109
-
110
-