Skip to content

Commit

Permalink
fix: commont ts fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
barttom committed Jan 17, 2024
1 parent 945c338 commit 2d9c55f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 42 deletions.
18 changes: 7 additions & 11 deletions src/pages/ReimbursementAccount/BeneficialOwnersStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,17 @@ type BeneficialOwnerInfoOnyxProps = {
reimbursementAccountDraft: OnyxEntry<ReimbursementAccountDraft>;
};

type BeneficialOwnersStepProps = {
type BeneficialOwnersStepProps = BeneficialOwnerInfoOnyxProps & {
/** Goes to the previous step */
onBackButtonPress: () => void;

/** Exits flow and goes back to the workspace initial page */
onCloseButtonPress: () => void;
} & BeneficialOwnerInfoOnyxProps;

const BODY_CONTENT: Array<React.ComponentType<SubStepProps & {beneficialOwnerBeingModifiedID: string; setBeneficialOwnerBeingModifiedID?: (id: string) => void}>> = [
LegalNameUBO,
DateOfBirthUBO,
SocialSecurityNumberUBO,
AddressUBO,
ConfirmationUBO,
];
};

type BeneficialOwnerSubStepProps = SubStepProps & {beneficialOwnerBeingModifiedID: string; setBeneficialOwnerBeingModifiedID?: (id: string) => void};

const BODY_CONTENT: Array<React.ComponentType<BeneficialOwnerSubStepProps>> = [LegalNameUBO, DateOfBirthUBO, SocialSecurityNumberUBO, AddressUBO, ConfirmationUBO];
const SUBSTEP = CONST.BANK_ACCOUNT.BENEFICIAL_OWNER_INFO_STEP.SUBSTEP;
const MAX_NUMBER_OF_UBOS = 4;

Expand Down Expand Up @@ -119,7 +115,7 @@ function BeneficialOwnersStep({reimbursementAccount, reimbursementAccountDraft,
moveTo,
resetScreenIndex,
goToTheLastStep,
} = useSubStep<SubStepProps & {beneficialOwnerBeingModifiedID: string; setBeneficialOwnerBeingModifiedID?: (id: string) => void}>({
} = useSubStep<BeneficialOwnerSubStepProps>({
bodyContent: BODY_CONTENT,
startFrom: 0,
onFinished: handleBeneficialOwnerDetailsFormSubmit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,11 @@ function ConfirmationBusiness({reimbursementAccount, reimbursementAccountDraft,
LabelComponent={() => (
<Text>
{`${translate('businessInfoStep.confirmCompanyIsNot')} `}
<TextLink
// eslint-disable-next-line max-len
href={CONST.LIST_OF_RESTRICTED_BUSINESSES}
>
{`${translate('businessInfoStep.listOfRestrictedBusinesses')}.`}
</TextLink>
<TextLink href={CONST.LIST_OF_RESTRICTED_BUSINESSES}>{`${translate('businessInfoStep.listOfRestrictedBusinesses')}.`}</TextLink>
</Text>
)}
style={[styles.mt4]}
shouldSaveDraft
onInputChange={() => {}}
/>
</FormProvider>
<View style={[styles.ph5, styles.mtAuto]}>
Expand Down
4 changes: 1 addition & 3 deletions src/pages/ReimbursementAccount/ReimbursementAccountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,7 @@ function ReimbursementAccountPage({reimbursementAccount, route, onfidoToken, pol
*/
const getDefaultStateForField = (fieldName, defaultValue = '') => lodashGet(reimbursementAccount, ['achData', fieldName], defaultValue);

const goBackToWorkspace = () => {
Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(policyID));
};
const goBackToWorkspace = () => Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(policyID));

const goBack = () => {
const subStep = achData.subStep;
Expand Down
42 changes: 21 additions & 21 deletions src/types/onyx/ReimbursementAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,34 @@ type BankAccountStep = ValueOf<typeof CONST.BANK_ACCOUNT.STEP>;

type BankAccountSubStep = ValueOf<typeof CONST.BANK_ACCOUNT.SUBSTEP>;

type ACHData = {
/** Step of the setup flow that we are on. Determines which view is presented. */
currentStep?: BankAccountStep;
type ACHData = BeneficialOwnersStepProps &
CompanyStepProps &
RequestorStepProps &
ACHContractStepProps & {
/** Step of the setup flow that we are on. Determines which view is presented. */
currentStep?: BankAccountStep;

/** Optional subStep we would like the user to start back on */
subStep?: BankAccountSubStep;
/** Optional subStep we would like the user to start back on */
subStep?: BankAccountSubStep;

/** Bank account state */
state?: string;
/** Bank account state */
state?: string;

/** Bank account ID of the VBA that we are validating is required */
bankAccountID?: number;
/** Bank account ID of the VBA that we are validating is required */
bankAccountID?: number;

/** Bank account routing number */
routingNumber?: string;
/** Bank account routing number */
routingNumber?: string;

/** Bank account number */
accountNumber?: string;
/** Bank account number */
accountNumber?: string;

/** Bank account name */
bankName?: BankName;
/** Bank account name */
bankName?: BankName;

/** Bank account owner name */
addressName?: string;
} & BeneficialOwnersStepProps &
CompanyStepProps &
RequestorStepProps &
ACHContractStepProps;
/** Bank account owner name */
addressName?: string;
};

type ReimbursementAccount = {
/** Whether we are loading the data via the API */
Expand Down

0 comments on commit 2d9c55f

Please sign in to comment.