kyd-shared-badge 0.3.21 → 0.3.22
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
|
@@ -40,7 +40,7 @@ type ChatWidgetProps = Partial<{
|
|
|
40
40
|
// return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
41
41
|
// };
|
|
42
42
|
|
|
43
|
-
const SharedBadgeDisplay = ({ badgeData, chatProps
|
|
43
|
+
const SharedBadgeDisplay = ({ badgeData, chatProps }: { badgeData: PublicBadgeData, chatProps?: ChatWidgetProps }) => {
|
|
44
44
|
const {
|
|
45
45
|
badgeId,
|
|
46
46
|
developerName,
|
|
@@ -159,7 +159,7 @@ const SharedBadgeDisplay = ({ badgeData, chatProps, headless }: { badgeData: Pub
|
|
|
159
159
|
const em = assessmentResult?.enterprise_match;
|
|
160
160
|
if (!em) return null;
|
|
161
161
|
const role = em.role || {};
|
|
162
|
-
return {
|
|
162
|
+
return { label: em.label, description: em.description, roleName: role.name };
|
|
163
163
|
})()}
|
|
164
164
|
countries={(assessmentResult?.screening_sources?.ip_risk_analysis?.raw_data?.countries) || []}
|
|
165
165
|
/>
|
|
@@ -551,9 +551,7 @@ const SharedBadgeDisplay = ({ badgeData, chatProps, headless }: { badgeData: Pub
|
|
|
551
551
|
</footer>
|
|
552
552
|
</Reveal>
|
|
553
553
|
{/* Floating chat widget */}
|
|
554
|
-
{
|
|
555
|
-
<ChatWidget api={chatProps?.api || '/api/chat'} badgeId={badgeId} title={chatProps?.title} hintText={chatProps?.hintText} loginPath={chatProps?.loginPath} headerOffset={chatProps?.headerOffset} developerName={developerName} />
|
|
556
|
-
)}
|
|
554
|
+
<ChatWidget api={chatProps?.api || '/api/chat'} badgeId={badgeId} title={chatProps?.title} hintText={chatProps?.hintText} loginPath={chatProps?.loginPath} headerOffset={chatProps?.headerOffset} developerName={developerName} />
|
|
557
555
|
</div>
|
|
558
556
|
</BusinessRulesProvider>
|
|
559
557
|
);
|
|
@@ -299,11 +299,9 @@ const AppendixTables: React.FC<AppendixTableProps> = ({ type, sources, searchedA
|
|
|
299
299
|
<td className={'px-4 py-4 whitespace-normal text-sm'} style={{ color: 'var(--text-secondary)' }}>{br.category || '—'}</td>
|
|
300
300
|
<td className={'px-4 py-4 whitespace-normal text-sm font-medium'} style={{ color: 'var(--text-main)' }}>{br.label || '—'}</td>
|
|
301
301
|
<td className={'px-4 py-4 whitespace-normal text-sm'} style={{ color: 'var(--text-secondary)' }}>{(() => {
|
|
302
|
-
const weight = Number(br.weight);
|
|
303
|
-
if (!Number.isFinite(weight)) return '
|
|
304
|
-
|
|
305
|
-
if (weight < 0) return 'Negative';
|
|
306
|
-
return 'Neutral';
|
|
302
|
+
const weight = Number(br.weight || 0);
|
|
303
|
+
if (!Number.isFinite(weight)) return '—';
|
|
304
|
+
return weight.toFixed(3).replace(/\.000$/, '.0');
|
|
307
305
|
})()}</td>
|
|
308
306
|
</tr>
|
|
309
307
|
);
|
|
@@ -37,7 +37,7 @@ interface ReportHeaderProps {
|
|
|
37
37
|
isPublic: boolean;
|
|
38
38
|
badgeImageUrl: string;
|
|
39
39
|
summary?: string;
|
|
40
|
-
enterpriseMatch?: {
|
|
40
|
+
enterpriseMatch?: { label?: string; description?: string; roleName?: string } | null;
|
|
41
41
|
countries?: string[];
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -45,8 +45,7 @@ const ReportHeader = ({ badgeId, developerName, updatedAt, score = 0, badgeImage
|
|
|
45
45
|
// Use the dynamic image if available, otherwise fall back to the score-based one.
|
|
46
46
|
const finalBadgeImageUrl = badgeImageUrl || getBadgeImageUrl(score || 0);
|
|
47
47
|
const tint = hexToRgba(pickTint(score || 0), 0.06);
|
|
48
|
-
const
|
|
49
|
-
const matchTint = matchScore !== undefined ? hexToRgba(pickTint(matchScore), 0.06) : undefined;
|
|
48
|
+
const matchLabel = enterpriseMatch?.label;
|
|
50
49
|
|
|
51
50
|
const formattedDate = updatedAt ? formatLocalDate(updatedAt, {
|
|
52
51
|
year: 'numeric',
|
|
@@ -100,7 +99,7 @@ const ReportHeader = ({ badgeId, developerName, updatedAt, score = 0, badgeImage
|
|
|
100
99
|
})()
|
|
101
100
|
)}
|
|
102
101
|
</div>
|
|
103
|
-
{(enterpriseMatch?.description ||
|
|
102
|
+
{(enterpriseMatch?.description || matchLabel) ? (
|
|
104
103
|
<div className={'hidden md:block text-sm space-y-2 pt-4'} style={{ borderTop: '1px solid var(--icon-button-secondary)' }}>
|
|
105
104
|
<div className="flex items-center justify-between">
|
|
106
105
|
<div className="flex items-center gap-2">
|
|
@@ -110,14 +109,14 @@ const ReportHeader = ({ badgeId, developerName, updatedAt, score = 0, badgeImage
|
|
|
110
109
|
<div className="hidden group-hover:block absolute z-30 left-1/2 -translate-x-1/2 top-full mt-2 w-80">
|
|
111
110
|
<div style={{ background: 'var(--content-card-background)', border: '1px solid var(--icon-button-secondary)', color: 'var(--text-main)', padding: 10, borderRadius: 6 }}>
|
|
112
111
|
<div style={{ fontWeight: 600 }}>AI-generated</div>
|
|
113
|
-
<div style={{ marginTop: 6, fontSize: 12, color: 'var(--text-secondary)' }}>Role match
|
|
112
|
+
<div style={{ marginTop: 6, fontSize: 12, color: 'var(--text-secondary)' }}>Role match label and description are AI-generated.</div>
|
|
114
113
|
</div>
|
|
115
114
|
</div>
|
|
116
115
|
</span>
|
|
117
116
|
</div>
|
|
118
|
-
{
|
|
119
|
-
<span className="px-2 py-1 rounded text-xs font-semibold" style={{ backgroundColor: 'var(--content-card-background)',
|
|
120
|
-
{
|
|
117
|
+
{matchLabel && (
|
|
118
|
+
<span className="px-2 py-1 rounded text-xs font-semibold" style={{ backgroundColor: 'var(--content-card-background)', border: '1px solid var(--icon-button-secondary)', color: 'var(--text-main)' }}>
|
|
119
|
+
{matchLabel}
|
|
121
120
|
</span>
|
|
122
121
|
)}
|
|
123
122
|
</div>
|