Skip to content

Commit 6900f0b

Browse files
authored
feat(*): update report ui (#2660)
1 parent a73c198 commit 6900f0b

File tree

9 files changed

+124
-17
lines changed

9 files changed

+124
-17
lines changed

apps/kyb-app/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# kyb-app
22

3+
## 0.3.43
4+
5+
### Patch Changes
6+
7+
- Updated dependencies
8+
- @ballerine/ui@0.5.22
9+
310
## 0.3.42
411

512
### Patch Changes

apps/kyb-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@ballerine/kyb-app",
33
"private": true,
4-
"version": "0.3.42",
4+
"version": "0.3.43",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
@@ -16,7 +16,7 @@
1616
"dependencies": {
1717
"@ballerine/blocks": "0.2.12",
1818
"@ballerine/common": "^0.9.25",
19-
"@ballerine/ui": "0.5.21",
19+
"@ballerine/ui": "0.5.22",
2020
"@ballerine/workflow-browser-sdk": "0.6.36",
2121
"@lukemorales/query-key-factory": "^1.0.3",
2222
"@radix-ui/react-icons": "^1.3.0",

packages/react-pdf-toolkit/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @ballerine/react-pdf-toolkit
22

3+
## 1.2.22
4+
5+
### Patch Changes
6+
7+
- Updated dependencies
8+
- @ballerine/ui@0.5.22
9+
310
## 1.2.21
411

512
### Patch Changes

packages/react-pdf-toolkit/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@ballerine/react-pdf-toolkit",
33
"private": false,
4-
"version": "1.2.21",
4+
"version": "1.2.22",
55
"types": "./dist/build.d.ts",
66
"main": "./dist/react-pdf-toolkit.js",
77
"module": "./dist/react-pdf-toolkit.mjs",
@@ -27,7 +27,7 @@
2727
},
2828
"dependencies": {
2929
"@ballerine/config": "^1.1.11",
30-
"@ballerine/ui": "0.5.21",
30+
"@ballerine/ui": "0.5.22",
3131
"@react-pdf/renderer": "^3.1.14",
3232
"@sinclair/typebox": "^0.31.7",
3333
"ajv": "^8.12.0",

packages/ui/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @ballerine/ui
22

3+
## 0.5.22
4+
5+
### Patch Changes
6+
7+
- readded content explanations and screenshots
8+
39
## 0.5.21
410

511
### Patch Changes

packages/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@ballerine/ui",
33
"private": false,
4-
"version": "0.5.21",
4+
"version": "0.5.22",
55
"type": "module",
66
"main": "dist/index.js",
77
"types": "dist/index.d.ts",

packages/ui/src/components/templates/report/adapters/report-adapter/report-adapter.ts

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ const getLabel = ({ label, provider }: { label: string; provider: string }) => {
1111
return label;
1212
};
1313

14-
export const toRiskLabels = (
15-
riskIndicators: Array<{ name: string; riskLevel: string; [key: string]: unknown }>,
16-
) => {
14+
export const toRiskLabels = (riskIndicators: Array<{ name: string; riskLevel: string }>) => {
1715
if (!Array.isArray(riskIndicators) || !riskIndicators.length) {
1816
return [];
1917
}
@@ -22,7 +20,6 @@ export const toRiskLabels = (
2220
label: name,
2321
severity:
2422
severityToDisplaySeverity[riskLevel as keyof typeof severityToDisplaySeverity] ?? riskLevel,
25-
...rest,
2623
}));
2724
};
2825

@@ -68,9 +65,29 @@ export const reportAdapter = {
6865
};
6966
})
7067
?.filter((value): value is NonNullable<typeof value> => Boolean(value)),
71-
websiteLineOfBusinessAnalysis: toRiskLabels(
72-
report?.summary?.riskIndicatorsByDomain?.lineOfBusinessViolations,
73-
),
68+
websiteLineOfBusinessAnalysis:
69+
report?.summary?.riskIndicatorsByDomain?.lineOfBusinessViolations?.map(
70+
({
71+
name,
72+
riskLevel,
73+
sourceUrl,
74+
screenshot,
75+
}: {
76+
name: string;
77+
riskLevel: string;
78+
sourceUrl: string;
79+
screenshot: {
80+
screenshotUrl: string;
81+
};
82+
}) => ({
83+
label: name,
84+
severity:
85+
severityToDisplaySeverity[riskLevel as keyof typeof severityToDisplaySeverity] ??
86+
riskLevel,
87+
screenshotUrl: screenshot?.screenshotUrl,
88+
sourceUrl,
89+
}),
90+
),
7491
ecosystemAndTransactionsAnalysis: toRiskLabels(
7592
report?.summary?.riskIndicatorsByDomain?.ecosystemViolations,
7693
),
@@ -196,9 +213,29 @@ export const reportAdapter = {
196213
};
197214
})
198215
?.filter((value): value is NonNullable<typeof value> => Boolean(value)),
199-
websiteLineOfBusinessAnalysis: toRiskLabels(
200-
report?.summary?.riskIndicatorsByDomain?.lineOfBusinessViolations,
201-
),
216+
websiteLineOfBusinessAnalysis:
217+
report?.summary?.riskIndicatorsByDomain?.lineOfBusinessViolations?.map(
218+
({
219+
name,
220+
riskLevel,
221+
sourceUrl,
222+
screenshot,
223+
}: {
224+
name: string;
225+
riskLevel: string;
226+
sourceUrl: string;
227+
screenshot: {
228+
screenshotUrl: string;
229+
};
230+
}) => ({
231+
label: name,
232+
severity:
233+
severityToDisplaySeverity[riskLevel as keyof typeof severityToDisplaySeverity] ??
234+
riskLevel,
235+
screenshotUrl: screenshot?.screenshotUrl,
236+
sourceUrl,
237+
}),
238+
),
202239
ecosystemAndTransactionsAnalysis: toRiskLabels(
203240
report?.summary?.riskIndicatorsByDomain?.ecosystemViolations,
204241
),

packages/ui/src/components/templates/report/components/WebsiteLineOfBusiness/WebsiteLineOfBusiness.tsx

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ export const WebsiteLineOfBusiness: FunctionComponent<{
77
violations: Array<{
88
label: string;
99
severity: string;
10+
explanation: string;
11+
screenshotUrl: string;
12+
sourceUrl: string;
1013
}>;
1114
description: string;
1215
formattedMcc: string | null;
@@ -36,6 +39,53 @@ export const WebsiteLineOfBusiness: FunctionComponent<{
3639
)}
3740
</CardContent>
3841
</Card>
42+
{!!violations.length && (
43+
<Card>
44+
<CardHeader className={'pt-4 font-bold'}>Content Violations Summary</CardHeader>
45+
<CardContent className={'flex flex-col space-y-4'}>
46+
<h4 className={'font-semibold'}>Findings</h4>
47+
{violations.map(violation => (
48+
<div key={violation.label} className={'flex flex-col space-y-2'}>
49+
<h5 className={'font-semibold'}>{violation.label}</h5>
50+
{violation.explanation && <p>{violation.explanation}</p>}
51+
{violation.screenshotUrl && (
52+
<a
53+
href={violation.screenshotUrl}
54+
target={'_blank'}
55+
rel={'noreferrer'}
56+
className={'relative w-1/2'}
57+
title={'Click to view full screenshot'}
58+
>
59+
<img
60+
src={violation.screenshotUrl}
61+
alt={`${violation.label} screenshot of the website`}
62+
className={'h-auto max-h-[400px] w-full object-cover object-top'}
63+
/>
64+
<div
65+
className={
66+
'absolute bottom-4 right-4 rounded border border-white bg-black p-1 text-xs text-white'
67+
}
68+
>
69+
Click to view full screenshot
70+
</div>
71+
</a>
72+
)}
73+
<div className={'text-sm italic'}>
74+
Source:{' '}
75+
<a
76+
href={violation.sourceUrl}
77+
target={'_blank'}
78+
rel={'noreferrer'}
79+
className={'link text-blue-500'}
80+
>
81+
{violation.sourceUrl}
82+
</a>
83+
</div>
84+
</div>
85+
))}
86+
</CardContent>
87+
</Card>
88+
)}
3989
</div>
4090
);
4191
};

pnpm-lock.yaml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)