kyd-shared-badge 0.3.135 → 0.3.136
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 +1 -1
- package/src/SharedBadgeDisplay.tsx +81 -55
package/package.json
CHANGED
|
@@ -497,66 +497,92 @@ const SharedBadgeDisplay = ({ badgeData, chatProps, headless, selfCheck = false,
|
|
|
497
497
|
</div>
|
|
498
498
|
);
|
|
499
499
|
|
|
500
|
-
const RiskSection = () =>
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
<div>
|
|
539
|
-
<h4 className={'font-bold'} style={{ color: 'var(--text-main)' }}>User Opted Out of Screening</h4>
|
|
540
|
-
<p className={'text-sm mt-1'} style={{ color: 'var(--text-secondary)' }}>
|
|
541
|
-
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.
|
|
542
|
-
</p>
|
|
543
|
-
</div>
|
|
500
|
+
const RiskSection = () => {
|
|
501
|
+
const adjustedCategoryScores = (() => {
|
|
502
|
+
if (!badgeData.optOutScreening) return categoryScores;
|
|
503
|
+
try {
|
|
504
|
+
const copy = { ...categoryScores } as Record<string, any>;
|
|
505
|
+
const key = Object.keys(copy).find(k => /sanctions?.*criminal|sanction|criminal/i.test(k));
|
|
506
|
+
if (key) {
|
|
507
|
+
const prev = copy[key] || {};
|
|
508
|
+
const business = { ...(prev.business || {}), percent_progress_signed: 0, percent_progress: 0 };
|
|
509
|
+
const combined = { ...(prev.combined || {}), percent_progress_signed: 0, percent_progress: 0 };
|
|
510
|
+
copy[key] = { ...prev, business, combined };
|
|
511
|
+
}
|
|
512
|
+
return copy;
|
|
513
|
+
} catch {
|
|
514
|
+
return categoryScores;
|
|
515
|
+
}
|
|
516
|
+
})();
|
|
517
|
+
|
|
518
|
+
const getRiskTooltipCopy = (category: string) => {
|
|
519
|
+
if (badgeData.optOutScreening && /sanction|criminal/i.test(category)) {
|
|
520
|
+
return 'User opted out of screening; score shown as 0.';
|
|
521
|
+
}
|
|
522
|
+
return getCategoryTooltipCopy(category);
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
return (
|
|
526
|
+
<div className={`${wrapperMaxWidth} mx-auto`}>
|
|
527
|
+
<div className={'rounded-xl shadow-xl p-6 sm:p-8 mt-6 border'} style={{ backgroundColor: 'var(--content-card-background)', borderColor: 'var(--icon-button-secondary)' }}>
|
|
528
|
+
<Reveal headless={isHeadless} as={'h3'} offsetY={8} className={'text-2xl font-bold'} style={{ color: 'var(--text-main)' }}>KYD Risk</Reveal>
|
|
529
|
+
<Reveal headless={isHeadless}>
|
|
530
|
+
<div className="mt-4">
|
|
531
|
+
<GraphInsights
|
|
532
|
+
graphInsights={graphInsights}
|
|
533
|
+
categories={genreMapping?.['Risk'] as string[]}
|
|
534
|
+
genre={'Risk'}
|
|
535
|
+
scoringSummary={scoringSummary}
|
|
536
|
+
headless={isHeadless}
|
|
537
|
+
/>
|
|
544
538
|
</div>
|
|
545
539
|
</Reveal>
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
540
|
+
<div className="grid grid-cols-1 lg:grid-cols-12 gap-8 w-full items-stretch py-8 kyd-avoid-break" style={{ borderColor: 'var(--icon-button-secondary)' }}>
|
|
541
|
+
<Reveal headless={isHeadless} className="lg:col-span-8 h-full">
|
|
542
|
+
<CategoryBars
|
|
543
|
+
title={'KYD Risk - Category Insights'}
|
|
544
|
+
categories={genreMapping?.['Risk'] as string[]}
|
|
545
|
+
categoryScores={adjustedCategoryScores}
|
|
546
|
+
barColor={barColor}
|
|
547
|
+
getCategoryTooltipCopy={getRiskTooltipCopy}
|
|
548
|
+
barHeight={16}
|
|
549
|
+
categoryTargets={roleTargets}
|
|
550
|
+
/>
|
|
551
551
|
</Reveal>
|
|
552
|
-
<Reveal headless={isHeadless}>
|
|
553
|
-
<
|
|
552
|
+
<Reveal headless={isHeadless} className="lg:col-span-4 w-full ml-0 lg:ml-20 hidden lg:flex flex-col items-start justify-start" delayMs={80}>
|
|
553
|
+
<div className={'text-sm font-semibold mb-3'} style={{ color: 'var(--text-main)' }}>Top Contributing Factors</div>
|
|
554
|
+
<TopContributingFactors categories={genreMapping?.['Risk'] as string[] || []} categoryTopByGraph={categoryTopByGraph as any} />
|
|
554
555
|
</Reveal>
|
|
555
|
-
|
|
556
|
-
|
|
556
|
+
</div>
|
|
557
|
+
{badgeData.optOutScreening ? (
|
|
558
|
+
<Reveal headless={isHeadless} className={'p-4 rounded-lg border mt-6'} style={{ backgroundColor: 'var(--icon-button-secondary)', borderColor: 'var(--icon-button-secondary)' }}>
|
|
559
|
+
<div className="flex items-start">
|
|
560
|
+
<span className="h-5 w-5 mr-3 mt-0.5 flex-shrink-0" style={{ color: yellow }}>
|
|
561
|
+
<FiAlertTriangle size={20} />
|
|
562
|
+
</span>
|
|
563
|
+
<div>
|
|
564
|
+
<h4 className={'font-bold'} style={{ color: 'var(--text-main)' }}>User Opted Out of Screening</h4>
|
|
565
|
+
<p className={'text-sm mt-1'} style={{ color: 'var(--text-secondary)' }}>
|
|
566
|
+
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.
|
|
567
|
+
</p>
|
|
568
|
+
</div>
|
|
569
|
+
</div>
|
|
570
|
+
</Reveal>
|
|
571
|
+
) : (
|
|
572
|
+
|
|
573
|
+
<>
|
|
574
|
+
<Reveal headless={isHeadless} className={'mb-0 mt-6'}>
|
|
575
|
+
<SanctionsMatches ss={assessmentResult?.screening_sources} />
|
|
576
|
+
</Reveal>
|
|
577
|
+
<Reveal headless={isHeadless}>
|
|
578
|
+
<IpRiskAnalysisDisplay ipRiskAnalysis={screening_sources?.ip_risk_analysis} />
|
|
579
|
+
</Reveal>
|
|
580
|
+
</>
|
|
581
|
+
)}
|
|
582
|
+
</div>
|
|
557
583
|
</div>
|
|
558
|
-
|
|
559
|
-
|
|
584
|
+
);
|
|
585
|
+
};
|
|
560
586
|
|
|
561
587
|
// const AiSection = () => (
|
|
562
588
|
// <div className={`${wrapperMaxWidth} mx-auto`}>
|