kyd-shared-badge 0.3.131 → 0.3.133

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.131",
3
+ "version": "0.3.133",
4
4
  "private": false,
5
5
  "main": "./src/index.ts",
6
6
  "module": "./src/index.ts",
@@ -11,12 +11,17 @@ import { green1, green2, green3, green4, green5 } from '../colors';
11
11
  // Register English locale once at module import time
12
12
  countriesLib.registerLocale(enLocale);
13
13
 
14
- export const getBadgeImageUrl = (score: number, bland: boolean = false) => {
14
+ export const getBadgeImageUrl = (score: number, bland: boolean = false, selfCheck?: boolean) => {
15
+ if (selfCheck) { // self-check badges are always green
16
+ return bland ? 'badgegreensimple.png' : '/badgegreen2.png';
17
+ };
18
+
15
19
  if (score >= 75) return bland ? 'badgegreensimple.png' : '/badgegreen2.png';
16
20
  if (score >= 50) return bland ? 'badgeyellowsimple.png' : '/badgeyellow2.png';
17
21
  return bland ? 'badgeredsimple.png' : '/badgered2.png';
18
22
  };
19
23
 
24
+
20
25
  const hexToRgba = (hex: string, alpha: number) => {
21
26
  const clean = hex.replace('#', '');
22
27
  const r = parseInt(clean.substring(0, 2), 16);
@@ -57,7 +62,7 @@ interface ReportHeaderProps {
57
62
 
58
63
  const ReportHeader = ({ badgeId, developerName, updatedAt, score = 0, badgeImageUrl, summary, enterpriseMatch, countries = [], accountAuthenticity, companyName, sourcesProviders = [], selfCheck, rightBadgeLayout }: ReportHeaderProps) => {
59
64
  // Use the dynamic image if available, otherwise fall back to the score-based one.
60
- const finalBadgeImageUrl = badgeImageUrl || getBadgeImageUrl(score || 0);
65
+ const finalBadgeImageUrl = badgeImageUrl || getBadgeImageUrl(score || 0, false, selfCheck);
61
66
  const tint = hexToRgba(pickTint(score || 0, selfCheck), 0.06);
62
67
  const matchLabel = enterpriseMatch?.label;
63
68
  const sources = (() => {