Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tfi, poc): Provide Your Types of Financial Institutions - Skeleton; Point of Contact - Skeleton, Input Validation, Error Handling, Submission #300

Merged
merged 67 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from 60 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
48949ca
fix: [CrumbTrail] Allow conditional entries
meissadia Feb 8, 2024
240aff4
fix: [UpdateInstitutionProfile]
meissadia Feb 8, 2024
adf4a18
fix: [UpdateInstitutionProfile]
meissadia Feb 8, 2024
d0a4a62
feat: [UpdateFinancialProfile] Display FinancialInstitutionDetails
meissadia Feb 22, 2024
661ae59
feat: [UpdateFinancialProfile] Display FinancialInstitutionDetails an…
meissadia Feb 22, 2024
3b3233b
feat: [UpdateFinancialProfile] Display UpdateIdentifyingInformation a…
meissadia Feb 9, 2024
1d4415f
feat: [InputEntry] Support display of (optional) label
meissadia Feb 23, 2024
c527d56
fix: Lint error
meissadia Feb 23, 2024
de66307
feat: [UpdateFinancialProfile] Display AffiliateInformation and inclu…
meissadia Feb 23, 2024
b926c51
feat: [LabelOptional] Extract to a reusable component
meissadia Feb 23, 2024
190eb16
feat: [UpdateFinancialProfile] Display AffiliateInformation and inclu…
meissadia Feb 23, 2024
3373a31
fix: [UpdateAffiliateInformation] Display initial checkbox state and …
meissadia Feb 23, 2024
6b5187e
feat: [UpdateFinancialProfile] Simulated success upon form submission
meissadia Feb 23, 2024
7544f44
Merge branch 'main' into 222-update-fi-profile-phase1
meissadia Feb 26, 2024
33c0a9b
Merge branch 'main' into 222-update-fi-profile-phase1
meissadia Feb 27, 2024
c20b8c6
fix: [UpdateAffiliateInformation] Extract UFPForm in prep for generat…
meissadia Feb 27, 2024
eb770a8
fix: [UpdateAffiliateInformation] Change filename case
meissadia Feb 27, 2024
3236824
fix: removed double reference
shindigira Feb 27, 2024
4753436
Update src/components/LabelOptional.tsx
meissadia Feb 27, 2024
6508285
[UpdateInstitutionProfile]
meissadia Feb 28, 2024
98f3ea0
Merge branch 'main' into 222-update-fi-profile-phase1
meissadia Feb 29, 2024
8cb40cf
refactor(InputEntry): InputEntry's label prop only expects string
shindigira Mar 1, 2024
f212854
feat(poc): Point of Contact - start
shindigira Mar 1, 2024
9b69367
feat(poc): point of contact wip2
shindigira Mar 1, 2024
0dc2371
style: InputEntry accepts a className prop
shindigira Mar 1, 2024
240fbb2
feat(poc): added button group
shindigira Mar 1, 2024
05c7b70
feat(poc): use of Select for states
shindigira Mar 1, 2024
431bb87
style: FieldGroup box-border at 770px
shindigira Mar 1, 2024
0060dd5
feat: LabelOptional - Street Address line 2
shindigira Mar 1, 2024
fbab612
style: fixed InputEntry's custom className
shindigira Mar 1, 2024
64b66c4
[Update FI] New TODO - Navigate based on validation success
meissadia Mar 4, 2024
6b802db
[Update FI] Add placeholder for InputEntry prop errorMessage
meissadia Mar 4, 2024
e1975b3
Merge branch '222-update-fi-profile-phase1' of https://github.com/cfp…
meissadia Mar 4, 2024
926e154
[FormSectionWrapper] Extract to shared, reusable component
meissadia Mar 4, 2024
8b948fd
Merge branch 'main' into 222-update-fi-profile-phase3-beta
meissadia Mar 4, 2024
47e3df6
Merge branch '222-update-fi-profile-phase1' into 222-update-fi-profil…
meissadia Mar 4, 2024
76c074f
Merge branch 'main' into 222-update-fi-profile-phase3-beta
meissadia Mar 6, 2024
86ed9d4
[LabelOptional] Remove dead code
meissadia Mar 6, 2024
f5fb4d6
feat: Zod Schema Update - Centralize form types, Regex checks to TIN,…
shindigira Mar 6, 2024
c3d809c
fix: cpf button type fix
shindigira Mar 6, 2024
9ae4515
style: Remove financial institution button - bottom 15px padding
shindigira Mar 6, 2024
9907e35
fix: resolved merge conflict
shindigira Mar 6, 2024
f609163
Update src/pages/ProfileForm/Step1Form/Step1Form.tsx
meissadia Mar 7, 2024
d7bd402
feat(poc): added states.json
shindigira Mar 7, 2024
9592dc8
chore: updated label items on PoC
shindigira Mar 7, 2024
ba79747
resolved merge conflicts
shindigira Mar 12, 2024
6c4b927
feat(tfi): Provide Types of Financial Institutions -- start
shindigira Mar 12, 2024
dc1d04c
feat: created a Form component
shindigira Mar 12, 2024
bd301be
feat: started TypesFinancialInstitutionSection
shindigira Mar 12, 2024
2096aac
feat: functional skeleton
shindigira Mar 12, 2024
102770e
chore: renamed Form to FormMain, typescript in TypesFinancialInstitut…
shindigira Mar 12, 2024
8984026
feat: Point of Contact - Zod Schema & TypeScript
shindigira Mar 12, 2024
6cd3332
feat: poc API request WIP
shindigira Mar 12, 2024
18daed9
feat: modified proxy to handle the sbl filing app
shindigira Mar 12, 2024
803cc97
fix: resolved merge conflict
shindigira Mar 12, 2024
ac42b44
chore: added comment related to the international phone number regex
shindigira Mar 12, 2024
9c91bb5
chore: added Washington DC as a 'state'
shindigira Mar 14, 2024
8953805
fix: resolved merge conflicts from 'main'
shindigira Mar 14, 2024
a323131
comment: added phone number regex comment
shindigira Mar 14, 2024
234402f
Merge branch 'main' of github.com:cfpb/sbl-frontend into 222-284-287-…
shindigira Mar 15, 2024
9dadc05
chore: renamed variable
shindigira Mar 15, 2024
86360b4
feat(poc api): hardcoded api request
shindigira Mar 15, 2024
da170ee
updated point of contact regex in zod schema
shindigira Mar 15, 2024
67bdd6f
feat(submitPointOfContact): API Request using hardcoded values, wip
shindigira Mar 15, 2024
5b762a8
chore: removed 'id' as it is not needed in the request
shindigira Mar 15, 2024
a545bd3
style(SectionIntro): 670px max-width and box-border (includes padding…
shindigira Mar 15, 2024
06ecfb4
style: SectionIntro 30px margin-bottom
shindigira Mar 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ENV-GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ SBL_OIDC_AUTHORITY="http://localhost:8880/realms/regtech"
SBL_OIDC_CLIENT_ID="regtech-client"
SBL_OIDC_REDIRECT_URI="http://localhost:${SBL_DEV_PORT}/filing"
SBL_REGTECH_BASE_URL="http://localhost:8881"
SBL_FILING_BASE_URL="http://localhost:8882"
SBL_MAIL_BASE_URL="http://localhost:8765"
```

Expand Down
20 changes: 20 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ const PaperworkNotice = lazy(
async () => import('pages/Filing/PaperworkNotice'),
);
const Summary = lazy(async () => import('pages/Summary/Summary'));
const PointOfContact = lazy(async () => import('pages/PointOfContact'));
const TypesFinancialInstitutions = lazy(
async () => import('pages/TypesFinancialInstitutions'),
);

// allow developers to toggle routing in development
const isRoutingEnabled = getIsRoutingEnabled();
Expand Down Expand Up @@ -237,6 +241,22 @@ export default function App(): ReactElement {
</ProtectedRoute>
}
/>
<Route
path='/point-of-contact'
element={
<ProtectedRoute {...ProtectedRouteAuthorizations}>
<PointOfContact />
</ProtectedRoute>
}
/>
<Route
path='/types-financial-institutions'
element={
<ProtectedRoute {...ProtectedRouteAuthorizations}>
<TypesFinancialInstitutions />
</ProtectedRoute>
}
/>
<Route path='/privacy-act-notice' element={<PrivacyActNotice />} />
<Route
path='/paperwork-reduction-act-notice'
Expand Down
17 changes: 17 additions & 0 deletions src/api/requests/submitPointOfContact.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { request } from 'api/axiosService';
import type { SblAuthProperties } from 'api/useSblAuth';
import type { FormattedPointOfContactShema } from 'types/formTypes';

const submitPointOfContact = async (
auth: SblAuthProperties,
userProfileObject: FormattedPointOfContactShema,
): Promise<null> => {
return request<null>({
url: `/v1/filing/institutions/{lei}/filings/{period_name}/contact-info`,
method: 'post',
body: userProfileObject,
headers: { Authorization: `Bearer ${auth.user?.access_token}` },
});
};

export default submitPointOfContact;
2 changes: 1 addition & 1 deletion src/components/FieldGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface FieldGroupProperties {

function FieldGroup({ children }: FieldGroupProperties): JSX.Element {
return (
<div className='field-group max-w-[48.125rem] !border !border-solid !border-cfpbBorderColor bg-[#F7F8F9] p-[1.875rem]'>
<div className='field-group box-border max-w-[48.125rem] !border !border-solid !border-cfpbBorderColor bg-[#F7F8F9] p-[1.875rem]'>
{children}
</div>
);
Expand Down
18 changes: 18 additions & 0 deletions src/components/FormMain.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { ReactNode } from 'react';

interface FormProperties {
children: ReactNode;
}

/**
*
* @returns FormParagraph
*/
function FormMain({
children,
className = '',
}: FormProperties & React.ComponentPropsWithoutRef<'form'>): JSX.Element {
return <form className={`mb-[3.75rem] w-full ${className}`}>{children}</form>;
}

export default FormMain;
4 changes: 2 additions & 2 deletions src/components/FormWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { ReactNode } from 'react';

interface Properties {
interface FormWrapperProperties {
children: ReactNode;
}

function FormWrapper({ children }: Properties): JSX.Element {
function FormWrapper({ children }: FormWrapperProperties): JSX.Element {
return (
<div className='ml-5 mr-5 mt-[2.813rem]'>
<div className='mx-auto mb-12 max-w-[75rem]'>
Expand Down
5 changes: 3 additions & 2 deletions src/components/InputEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { forwardRef } from 'react';
import { Element } from 'react-scroll';

import InputErrorMessage from 'components/InputErrorMessage';
import LabelOptional from 'components/LabelOptional';
import { Heading, TextInput } from 'design-system-react';
import LabelOptional from './LabelOptional';

interface InputEntryProperties
extends PropsWithoutRef<JSX.IntrinsicElements['input']> {
Expand All @@ -23,6 +23,7 @@ interface InputEntryProperties
const InputEntry = forwardRef<HTMLInputElement, InputEntryProperties>(
(
{
className = '',
id,
errorMessage,
label,
Expand All @@ -38,7 +39,7 @@ const InputEntry = forwardRef<HTMLInputElement, InputEntryProperties>(
) => {
const handleError = Boolean(showError && errorMessage);
return (
<div className={`${isLast ? '' : 'mb-[0.9375rem]'}`}>
<div className={`${isLast ? '' : 'mb-[0.9375rem]'} ${className}`}>
<Element name={id}>
<label htmlFor={id}>
<div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import FieldGroup from 'components/FieldGroup';
meissadia marked this conversation as resolved.
Show resolved Hide resolved
import InputEntry from 'components/InputEntry';
import { Checkbox, Heading, List, ListItem } from 'design-system-react';
import type {
Control,
FieldErrors,
UseFormRegister,
UseFormSetValue,
} from 'react-hook-form';
import { Controller as FormController } from 'react-hook-form';
import { Zero } from 'utils/constants';
import type { CheckboxOption, UFPSchema } from './types';
import { checkboxOptions } from './types';

interface TypesFinancialInstitutionSectionProperties {
register: UseFormRegister<UFPSchema>;
setValue: UseFormSetValue<UFPSchema>;
formErrors: FieldErrors<UFPSchema>;
control: Control<UFPSchema>;
}

function TypesFinancialInstitutionSection({
register,
setValue,
formErrors,
control,
}: TypesFinancialInstitutionSectionProperties): JSX.Element {
// const typeOtherData = data.sbl_institution_types.find(item => {
// return item.sbl_type.id === sblInstitutionTypeMap.other;
// });
return (
<FieldGroup>
<Heading type='4'>Type(s) of financial institution</Heading>
<List isUnstyled>
{checkboxOptions.map((option: CheckboxOption): JSX.Element => {
const optionId = `sbl_institution_types.${option.id}`;

const onCheckboxChange = (
event: React.ChangeEvent<HTMLInputElement>,
): void => {
setValue(optionId, event.target.checked);
};

return (
<ListItem key={option.id}>
<FormController
render={({ field }) => {
return (
<Checkbox
id={option.id}
label={option.label}
{...register(optionId)}
checked={field.value}
onChange={onCheckboxChange}
/>
);
}}
control={control}
name={optionId}
/>
</ListItem>
);
})}
</List>
<InputEntry
label=''
id='institutionTypeOther'
{...register('sbl_institution_types_other', {
// value: typeOtherData?.details,
})}
errorMessage={formErrors[Zero]}
showError
/>
</FieldGroup>
);
}

export default TypesFinancialInstitutionSection;
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import CommonLinks from 'components/CommonLinks';
import FieldGroup from 'components/FieldGroup';
import FormMain from 'components/FormMain';
import SectionIntro from 'components/SectionIntro';

import {
Checkbox,
Heading,
Expand Down Expand Up @@ -107,9 +109,9 @@ function UpdateIdentifyingInformation({
If you wish to provide additional types of financial institutions add
them to “Other” and check the box.{' '}
</Paragraph>
<form>
<FormMain>
<FieldGroup>
<Heading type='4'>Type of financial institution</Heading>
<Heading type='4'>Types of financial institutions</Heading>
<List isUnstyled>
{checkboxOptions.map((option: CheckboxOption): JSX.Element => {
const optionId = `sbl_institution_types.${option.id}`;
Expand Down Expand Up @@ -151,7 +153,7 @@ function UpdateIdentifyingInformation({
showError
/>
</FieldGroup>
</form>
</FormMain>
</FormSectionWrapper>
);
}
Expand Down
54 changes: 27 additions & 27 deletions src/pages/Filing/UpdateFinancialProfile/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,32 +118,32 @@ export const ufpSchema = z.object({
sbl_institution_types: z.object(checkboxOptionsZod),
});

// export type UFPSchema = z.infer<typeof ufpSchema>;
export type UFPSchema = z.infer<typeof ufpSchema>;

interface ExpectedObject {
sbl_institution_types?: Record<string, boolean>;
tax_id?: string;
hq_address_street_1?: string;
hq_address_street_2?: string;
hq_address_city?: string;
hq_address_state_code?: string;
hq_address_zip?: string;
parent_lei?: string;
parent_legal_name?: string;
parent_rssd_id?: string;
top_holder_lei?: string;
top_holder_legal_name?: string;
top_holder_rssd_id?: string;
lei?: string;
name?: string;
is_active?: boolean | string;
rssd_id?: string;
primary_federal_regulator_id?: string;
hmda_institution_type_id?: string;
hq_address_state?: string;
primary_federal_regulator?: string;
additional_details?: string;
domains?: string;
}
// interface ExpectedObject {
// sbl_institution_types?: Record<string, boolean>;
// tax_id?: string;
// hq_address_street_1?: string;
// hq_address_street_2?: string;
// hq_address_city?: string;
// hq_address_state_code?: string;
// hq_address_zip?: string;
// parent_lei?: string;
// parent_legal_name?: string;
// parent_rssd_id?: string;
// top_holder_lei?: string;
// top_holder_legal_name?: string;
// top_holder_rssd_id?: string;
// lei?: string;
// name?: string;
// is_active?: boolean | string;
// rssd_id?: string;
// primary_federal_regulator_id?: string;
// hmda_institution_type_id?: string;
// hq_address_state?: string;
// primary_federal_regulator?: string;
// additional_details?: string;
// domains?: string;
// }

export type UFPSchema = ExpectedObject;
// export type UFPSchema = ExpectedObject;
Loading
Loading