kyd-shared-badge 0.2.14 → 0.2.16
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/components/AppendixTables.tsx +86 -33
- package/src/types.ts +1 -1
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@ interface SanctionSource {
|
|
|
7
7
|
issuingEntity: string;
|
|
8
8
|
listName: string;
|
|
9
9
|
matched?: boolean;
|
|
10
|
+
sublists?: string[];
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
interface DomainSource {
|
|
@@ -25,34 +26,73 @@ interface AppendixTableProps {
|
|
|
25
26
|
developerName: string;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
const SanctionsRow = ({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
29
|
+
const SanctionsRow = ({
|
|
30
|
+
source,
|
|
31
|
+
searchedAt,
|
|
32
|
+
developerName,
|
|
33
|
+
onToggle,
|
|
34
|
+
expanded,
|
|
35
|
+
colSpan,
|
|
36
|
+
}: {
|
|
37
|
+
source: SanctionSource;
|
|
38
|
+
searchedAt: string;
|
|
39
|
+
developerName: string;
|
|
40
|
+
onToggle: () => void;
|
|
41
|
+
expanded: boolean;
|
|
42
|
+
colSpan: number;
|
|
43
|
+
}) => (
|
|
44
|
+
<>
|
|
45
|
+
<tr className={'transition-colors'} style={source.matched ? { backgroundColor: 'rgba(236,102,98,0.08)' } : undefined}>
|
|
46
|
+
<td className={'px-4 py-4 whitespace-nowrap align-top text-sm font-medium'} style={{ color: 'var(--text-main)' }}>
|
|
47
|
+
<div className="flex flex-col gap-1">
|
|
48
|
+
<span>{source.issuingEntity}</span>
|
|
49
|
+
{source.sublists && source.sublists.length > 0 && (
|
|
50
|
+
<button
|
|
51
|
+
type="button"
|
|
52
|
+
onClick={onToggle}
|
|
53
|
+
className={'text-xs inline-flex items-center gap-1 text-left'}
|
|
54
|
+
style={{ color: 'var(--text-secondary)' }}
|
|
55
|
+
aria-expanded={expanded}
|
|
56
|
+
>
|
|
57
|
+
<span style={{ display: 'inline-block', transform: expanded ? 'rotate(90deg)' : 'rotate(0deg)', transition: 'transform 150ms ease' }}>▶</span>
|
|
58
|
+
<span>View sub-lists</span>
|
|
59
|
+
</button>
|
|
60
|
+
)}
|
|
61
|
+
</div>
|
|
62
|
+
</td>
|
|
63
|
+
<td className={'px-4 py-4 whitespace-normal align-top text-sm'} style={{ color: 'var(--text-secondary)' }}>
|
|
64
|
+
{source.listName}
|
|
65
|
+
</td>
|
|
66
|
+
<td className={'px-4 py-4 whitespace-nowrap align-top text-sm'} style={{ color: 'var(--text-secondary)' }}>
|
|
67
|
+
{searchedAt}
|
|
68
|
+
</td>
|
|
69
|
+
<td className={'px-4 py-4 whitespace-nowrap align-top text-sm'} style={{ color: 'var(--text-secondary)' }}>
|
|
70
|
+
{source.matched ? (
|
|
71
|
+
<span className={'text-xs font-semibold'} style={{ color: 'var(--text-main)' }}>Match</span>
|
|
72
|
+
) : (
|
|
73
|
+
<span className={'text-xs'} style={{ color: 'var(--text-secondary)' }}>Not Found</span>
|
|
74
|
+
)}
|
|
75
|
+
</td>
|
|
76
|
+
<td className={'px-4 py-4 text-sm whitespace-normal align-top'} style={{ color: 'var(--text-secondary)' }}>
|
|
77
|
+
{source.matched
|
|
78
|
+
? (<span>Exact or strong match for <strong style={{ color: 'var(--text-main)' }}>{developerName}</strong> was found on this list.</span>)
|
|
79
|
+
: (<span>No exact match for <strong style={{ color: 'var(--text-main)' }}>{developerName}</strong> was found on this list.</span>)}
|
|
80
|
+
</td>
|
|
81
|
+
</tr>
|
|
82
|
+
{expanded && source.sublists && source.sublists.length > 0 && (
|
|
83
|
+
<tr>
|
|
84
|
+
<td colSpan={colSpan} className={'px-6 pb-4'}>
|
|
85
|
+
<div className={'mt-1 border-t pt-3'} style={{ borderColor: 'var(--icon-button-secondary)' }}>
|
|
86
|
+
<ul className={'grid grid-cols-1 sm:grid-cols-2 gap-y-1 gap-x-6 text-sm list-disc pl-5'} style={{ color: 'var(--text-secondary)' }}>
|
|
87
|
+
{source.sublists.map((sl, idx) => (
|
|
88
|
+
<li key={idx}>{sl}</li>
|
|
89
|
+
))}
|
|
90
|
+
</ul>
|
|
91
|
+
</div>
|
|
92
|
+
</td>
|
|
93
|
+
</tr>
|
|
94
|
+
)}
|
|
95
|
+
</>
|
|
56
96
|
);
|
|
57
97
|
|
|
58
98
|
const DomainRow = ({ source, searchedAt, developerName }: { source: DomainSource, searchedAt: string, developerName: string }) => (
|
|
@@ -75,6 +115,7 @@ const DomainRow = ({ source, searchedAt, developerName }: { source: DomainSource
|
|
|
75
115
|
|
|
76
116
|
const AppendixTables: React.FC<AppendixTableProps> = ({ type, sources, searchedAt, developerName }) => {
|
|
77
117
|
const [visibleCount, setVisibleCount] = useState(PAGE_SIZE);
|
|
118
|
+
const [expanded, setExpanded] = useState<{ [k: number]: boolean }>({});
|
|
78
119
|
|
|
79
120
|
const formattedDate = new Date(searchedAt).toLocaleString(undefined, {
|
|
80
121
|
year: 'numeric', month: 'short', day: 'numeric',
|
|
@@ -133,11 +174,23 @@ const AppendixTables: React.FC<AppendixTableProps> = ({ type, sources, searchedA
|
|
|
133
174
|
</tr>
|
|
134
175
|
</thead>
|
|
135
176
|
<tbody className={''}>
|
|
136
|
-
{visibleParsedSources.map((source, index) =>
|
|
137
|
-
type === 'sanctions'
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
177
|
+
{visibleParsedSources.map((source, index) => {
|
|
178
|
+
if (type === 'sanctions') {
|
|
179
|
+
const src = source as SanctionSource;
|
|
180
|
+
return (
|
|
181
|
+
<SanctionsRow
|
|
182
|
+
key={index}
|
|
183
|
+
source={src}
|
|
184
|
+
searchedAt={formattedDate}
|
|
185
|
+
developerName={developerName}
|
|
186
|
+
onToggle={() => setExpanded(prev => ({ ...prev, [index]: !prev[index] }))}
|
|
187
|
+
expanded={!!expanded[index]}
|
|
188
|
+
colSpan={headers.length}
|
|
189
|
+
/>
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
return <DomainRow key={index} source={source as DomainSource} searchedAt={formattedDate} developerName={developerName} />
|
|
193
|
+
})}
|
|
141
194
|
</tbody>
|
|
142
195
|
</table>
|
|
143
196
|
</div>
|
package/src/types.ts
CHANGED
|
@@ -161,7 +161,7 @@ export interface AssessmentResult {
|
|
|
161
161
|
sources?: string[];
|
|
162
162
|
matches?: any[];
|
|
163
163
|
};
|
|
164
|
-
sanctions_sources_detailed?: { issuingEntity: string; listName: string; matched?: boolean }[];
|
|
164
|
+
sanctions_sources_detailed?: { issuingEntity: string; listName: string; matched?: boolean; sublists?: string[] }[];
|
|
165
165
|
sanctions_sublists?: string[];
|
|
166
166
|
};
|
|
167
167
|
optOutScreening?: boolean;
|