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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kyd-shared-badge",
3
- "version": "0.2.14",
3
+ "version": "0.2.16",
4
4
  "private": false,
5
5
  "main": "./src/index.ts",
6
6
  "module": "./src/index.ts",
@@ -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 = ({ source, searchedAt, developerName }: { source: SanctionSource, searchedAt: string, developerName: string }) => (
29
- <tr className={'transition-colors hover:bg-black/5'} style={source.matched ? { backgroundColor: 'rgba(236,102,98,0.08)' } : undefined}>
30
- <td className={'px-4 py-4 whitespace-nowrap text-sm font-medium'} style={{ color: 'var(--text-main)' }}>
31
- {source.issuingEntity}
32
- </td>
33
- <td className={'px-4 py-4 whitespace-normal text-sm'} style={{ color: 'var(--text-secondary)' }}>
34
- {source.listName}
35
- </td>
36
- <td className={'px-4 py-4 whitespace-nowrap text-sm'} style={{ color: 'var(--text-secondary)' }}>
37
- {searchedAt}
38
- </td>
39
- <td className={'px-4 py-4 whitespace-nowrap text-sm'} style={{ color: 'var(--text-secondary)' }}>
40
- {source.matched ? (
41
- <span className={'px-2 inline-flex text-xs leading-5 font-semibold rounded-full'} style={{ backgroundColor: 'rgba(236,102,98,0.2)', color: 'var(--text-main)' }}>
42
- Match
43
- </span>
44
- ) : (
45
- <span className={'px-2 inline-flex text-xs leading-5 font-semibold rounded-full'} style={{ backgroundColor: 'var(--icon-button-secondary)', color: 'var(--text-main)' }}>
46
- Not Found
47
- </span>
48
- )}
49
- </td>
50
- <td className={'px-4 py-4 text-sm whitespace-normal'} style={{ color: 'var(--text-secondary)' }}>
51
- {source.matched
52
- ? (<span>Exact or strong match for <strong style={{ color: 'var(--text-main)' }}>{developerName}</strong> was found on this list.</span>)
53
- : (<span>No exact match for <strong style={{ color: 'var(--text-main)' }}>{developerName}</strong> was found on this list.</span>)}
54
- </td>
55
- </tr>
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
- ? <SanctionsRow key={index} source={source as SanctionSource} searchedAt={formattedDate} developerName={developerName} />
139
- : <DomainRow key={index} source={source as DomainSource} searchedAt={formattedDate} developerName={developerName} />
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;