This repository was archived by the owner on Apr 16, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathIdentifyingInformation.tsx
More file actions
82 lines (74 loc) · 2.78 KB
/
Copy pathIdentifyingInformation.tsx
File metadata and controls
82 lines (74 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* eslint-disable react/require-default-props */
import Links from 'components/CommonLinks';
import FormSectionWrapper from 'components/FormSectionWrapper';
import SectionIntro from 'components/SectionIntro';
import { WellContainer } from 'design-system-react';
import type { ReactNode } from 'react';
import type { InstitutionDetailsApiType } from 'types/formTypes';
import { formatFederalRegulator } from 'utils/formatting';
import InstitutionDataLabels from '../formHelpers';
import { DisplayField, NOT_PROVIDED } from './DisplayField';
const defaultDescription = (
<>
If your financial institution has an RSSD ID, and you wish to update the
following information, visit the <Links.FederalReserveBoard />. If your
financial institution does not have an RSSD ID and you wish to make an
update, submit a request to <Links.UpdateInstitutionProfile />.
</>
);
export function IdentifyingInformation({
data,
heading = 'Financial institution identifying information',
description = defaultDescription,
}: {
data: InstitutionDetailsApiType;
heading?: string;
description?: ReactNode;
}): JSX.Element {
// TODO: Asking Le about 'Other' institution type/detail in mock data and the ending period
// https://github.com/cfpb/sbl-frontend/issues/137
const institutionTypeNamesArray = data.sbl_institution_types?.map(
institutionType => {
let name = '';
if (typeof institutionType === 'string') name = institutionType;
else if (institutionType.sbl_type.name === 'Other') {
return institutionType.details;
} else {
const { sbl_type: sblType } = institutionType;
const { name: typeName } = sblType;
name = typeName;
}
return name.replace(/\.$/, '');
},
);
const institutionTypeNamesString = institutionTypeNamesArray?.join(', ');
return (
<FormSectionWrapper>
<SectionIntro heading={heading}>{description}</SectionIntro>
<WellContainer className='u-mt30'>
<DisplayField
label={InstitutionDataLabels.tin}
value={data.tax_id}
fallbackValue={NOT_PROVIDED}
/>
<DisplayField label={InstitutionDataLabels.rssd} value={data.rssd_id} />
<DisplayField
label={InstitutionDataLabels.regName}
value={formatFederalRegulator(data)}
/>
</WellContainer>
<SectionIntro className='u-mt45'>
To update your type of financial institution, submit a request to{' '}
<Links.UpdateInstitutionProfile />.
</SectionIntro>
<WellContainer className='u-mt30'>
<DisplayField
label={InstitutionDataLabels.fiType}
value={institutionTypeNamesString}
fallbackValue={NOT_PROVIDED}
/>
</WellContainer>
</FormSectionWrapper>
);
}
export default IdentifyingInformation;