Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 18 additions & 2 deletions src/libs/API/parameters/ResendValidateCodeParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
// Exclude reasons that require parameters - redefine them as separate types below to enforce their parameters are always passed
reasonCode: Exclude<
ValueOf<typeof CONST.VALIDATE_CODE_REASONS>,
typeof CONST.VALIDATE_CODE_REASONS.REVEAL_CARD_DETAILS | typeof CONST.VALIDATE_CODE_REASONS.REPLACE_CARD | typeof CONST.VALIDATE_CODE_REASONS.REPORT_CARD_FRAUD
| typeof CONST.VALIDATE_CODE_REASONS.REVEAL_CARD_DETAILS
| typeof CONST.VALIDATE_CODE_REASONS.REPLACE_CARD
| typeof CONST.VALIDATE_CODE_REASONS.REPORT_CARD_FRAUD
| typeof CONST.VALIDATE_CODE_REASONS.ADD_DELEGATE

Check failure on line 11 in src/libs/API/parameters/ResendValidateCodeParams.ts

View workflow job for this annotation

GitHub Actions / typecheck

Property 'ADD_DELEGATE' does not exist on type '{ readonly SIGN_IN: "sign_in"; readonly ADD_CONTACT_METHOD: "add_contact_method"; readonly VALIDATE_ACCOUNT: "validate_account"; readonly REVEAL_CARD_DETAILS: "reveal_card_details"; ... 5 more ...; readonly UPDATE_CARD: "update_card"; }'.

Check failure on line 11 in src/libs/API/parameters/ResendValidateCodeParams.ts

View workflow job for this annotation

GitHub Actions / typecheck

Property 'ADD_DELEGATE' does not exist on type '{ readonly SIGN_IN: "sign_in"; readonly ADD_CONTACT_METHOD: "add_contact_method"; readonly VALIDATE_ACCOUNT: "validate_account"; readonly REVEAL_CARD_DETAILS: "reveal_card_details"; ... 5 more ...; readonly UPDATE_CARD: "update_card"; }'.

Check failure on line 11 in src/libs/API/parameters/ResendValidateCodeParams.ts

View workflow job for this annotation

GitHub Actions / ESLint check

'any' overrides all other types in this union type

Check failure on line 11 in src/libs/API/parameters/ResendValidateCodeParams.ts

View workflow job for this annotation

GitHub Actions / ESLint check

'any' overrides all other types in this union type
| typeof CONST.VALIDATE_CODE_REASONS.UPDATE_DELEGATE

Check failure on line 12 in src/libs/API/parameters/ResendValidateCodeParams.ts

View workflow job for this annotation

GitHub Actions / typecheck

Property 'UPDATE_DELEGATE' does not exist on type '{ readonly SIGN_IN: "sign_in"; readonly ADD_CONTACT_METHOD: "add_contact_method"; readonly VALIDATE_ACCOUNT: "validate_account"; readonly REVEAL_CARD_DETAILS: "reveal_card_details"; ... 5 more ...; readonly UPDATE_CARD: "update_card"; }'.

Check failure on line 12 in src/libs/API/parameters/ResendValidateCodeParams.ts

View workflow job for this annotation

GitHub Actions / typecheck

Property 'UPDATE_DELEGATE' does not exist on type '{ readonly SIGN_IN: "sign_in"; readonly ADD_CONTACT_METHOD: "add_contact_method"; readonly VALIDATE_ACCOUNT: "validate_account"; readonly REVEAL_CARD_DETAILS: "reveal_card_details"; ... 5 more ...; readonly UPDATE_CARD: "update_card"; }'.

Check failure on line 12 in src/libs/API/parameters/ResendValidateCodeParams.ts

View workflow job for this annotation

GitHub Actions / ESLint check

'any' overrides all other types in this union type

Check failure on line 12 in src/libs/API/parameters/ResendValidateCodeParams.ts

View workflow job for this annotation

GitHub Actions / ESLint check

'any' overrides all other types in this union type
>;
};

Expand All @@ -24,6 +28,16 @@
reasonCardID: number;
};

type ResendValidateCodeForAddDelegateParams = {
reasonCode: typeof CONST.VALIDATE_CODE_REASONS.ADD_DELEGATE;

Check failure on line 32 in src/libs/API/parameters/ResendValidateCodeParams.ts

View workflow job for this annotation

GitHub Actions / typecheck

Property 'ADD_DELEGATE' does not exist on type '{ readonly SIGN_IN: "sign_in"; readonly ADD_CONTACT_METHOD: "add_contact_method"; readonly VALIDATE_ACCOUNT: "validate_account"; readonly REVEAL_CARD_DETAILS: "reveal_card_details"; ... 5 more ...; readonly UPDATE_CARD: "update_card"; }'.
reasonTargetEmail: string;
};

type ResendValidateCodeForUpdateDelegateParams = {
reasonCode: typeof CONST.VALIDATE_CODE_REASONS.UPDATE_DELEGATE;

Check failure on line 37 in src/libs/API/parameters/ResendValidateCodeParams.ts

View workflow job for this annotation

GitHub Actions / typecheck

Property 'UPDATE_DELEGATE' does not exist on type '{ readonly SIGN_IN: "sign_in"; readonly ADD_CONTACT_METHOD: "add_contact_method"; readonly VALIDATE_ACCOUNT: "validate_account"; readonly REVEAL_CARD_DETAILS: "reveal_card_details"; ... 5 more ...; readonly UPDATE_CARD: "update_card"; }'.
reasonTargetEmail: string;
};

// Will be removed eventually
type ResendValidateCodeNotYetImplementedParams = {
reasonCode: null;
Expand All @@ -34,6 +48,8 @@
| ResendValidateCodeNotYetImplementedParams
| ResendValidateCodeForRevealCardDetailsParams
| ResendValidateCodeForReplaceCardParams
| ResendValidateCodeForReportCardFraudParams;
| ResendValidateCodeForReportCardFraudParams
| ResendValidateCodeForAddDelegateParams
| ResendValidateCodeForUpdateDelegateParams;

export default ResendValidateCodeParams;
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import type {ValueOf} from 'type-fest';

import {CONST as COMMON_CONST} from 'expensify-common';
import React, {useEffect} from 'react';

type ConfirmDelegateValidateCodePageProps = PlatformStackScreenProps<SettingsNavigatorParamList, typeof SCREENS.SETTINGS.DELEGATE.DELEGATE_CONFIRM_VALIDATE_CODE>;
Expand Down Expand Up @@ -57,7 +58,8 @@
onClose={() => Navigation.goBack(ROUTES.SETTINGS_DELEGATE_CONFIRM.getRoute(login, role))}
validateError={validateLoginError}
title={translate('delegate.makeSureItIsYou')}
sendValidateCode={() => requestValidateCodeAction()}
sendValidateCode={() => requestValidateCodeAction({reasonCode: COMMON_CONST.VALIDATE_CODE_REASONS.ADD_DELEGATE, reasonTargetEmail: login})}

Check failure on line 61 in src/pages/settings/Security/AddDelegate/ConfirmDelegateValidateCodePage.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Property 'ADD_DELEGATE' does not exist on type '{ readonly SIGN_IN: "sign_in"; readonly ADD_CONTACT_METHOD: "add_contact_method"; readonly VALIDATE_ACCOUNT: "validate_account"; readonly REVEAL_CARD_DETAILS: "reveal_card_details"; ... 5 more ...; readonly UPDATE_CARD: "update_card"; }'.

Check failure on line 61 in src/pages/settings/Security/AddDelegate/ConfirmDelegateValidateCodePage.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Unsafe assignment of an error typed value

Check failure on line 61 in src/pages/settings/Security/AddDelegate/ConfirmDelegateValidateCodePage.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Unsafe assignment of an error typed value
validateCodeReasonCode={COMMON_CONST.VALIDATE_CODE_REASONS.ADD_DELEGATE}

Check failure on line 62 in src/pages/settings/Security/AddDelegate/ConfirmDelegateValidateCodePage.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Property 'ADD_DELEGATE' does not exist on type '{ readonly SIGN_IN: "sign_in"; readonly ADD_CONTACT_METHOD: "add_contact_method"; readonly VALIDATE_ACCOUNT: "validate_account"; readonly REVEAL_CARD_DETAILS: "reveal_card_details"; ... 5 more ...; readonly UPDATE_CARD: "update_card"; }'.

Check failure on line 62 in src/pages/settings/Security/AddDelegate/ConfirmDelegateValidateCodePage.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Unsafe assignment of an error typed value
handleSubmitForm={(validateCode) => addDelegate({email: login, role, validateCode, delegatedAccess: account?.delegatedAccess})}
descriptionPrimary={translate('delegate.enterSecurityCode', account?.primaryLogin ?? session?.email ?? '')}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import type {ValueOf} from 'type-fest';

import {CONST as COMMON_CONST} from 'expensify-common';
import React, {useEffect} from 'react';

type UpdateDelegateValidateCodePageProps = PlatformStackScreenProps<SettingsNavigatorParamList, typeof SCREENS.SETTINGS.DELEGATE.UPDATE_DELEGATE_ROLE_CONFIRM_VALIDATE_CODE>;
Expand Down Expand Up @@ -54,7 +55,8 @@
onClose={() => Navigation.goBack(ROUTES.SETTINGS_UPDATE_DELEGATE_ROLE.getRoute(login, currentDelegate?.role ?? ''))}
validateError={updateDelegateErrors}
title={translate('delegate.makeSureItIsYou')}
sendValidateCode={() => requestValidateCodeAction()}
sendValidateCode={() => requestValidateCodeAction({reasonCode: COMMON_CONST.VALIDATE_CODE_REASONS.UPDATE_DELEGATE, reasonTargetEmail: login})}

Check failure on line 58 in src/pages/settings/Security/AddDelegate/UpdateDelegateRole/UpdateDelegateValidateCodePage.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Property 'UPDATE_DELEGATE' does not exist on type '{ readonly SIGN_IN: "sign_in"; readonly ADD_CONTACT_METHOD: "add_contact_method"; readonly VALIDATE_ACCOUNT: "validate_account"; readonly REVEAL_CARD_DETAILS: "reveal_card_details"; ... 5 more ...; readonly UPDATE_CARD: "update_card"; }'.

Check failure on line 58 in src/pages/settings/Security/AddDelegate/UpdateDelegateRole/UpdateDelegateValidateCodePage.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Unsafe assignment of an error typed value
validateCodeReasonCode={COMMON_CONST.VALIDATE_CODE_REASONS.UPDATE_DELEGATE}

Check failure on line 59 in src/pages/settings/Security/AddDelegate/UpdateDelegateRole/UpdateDelegateValidateCodePage.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Property 'UPDATE_DELEGATE' does not exist on type '{ readonly SIGN_IN: "sign_in"; readonly ADD_CONTACT_METHOD: "add_contact_method"; readonly VALIDATE_ACCOUNT: "validate_account"; readonly REVEAL_CARD_DETAILS: "reveal_card_details"; ... 5 more ...; readonly UPDATE_CARD: "update_card"; }'.

Check failure on line 59 in src/pages/settings/Security/AddDelegate/UpdateDelegateRole/UpdateDelegateValidateCodePage.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Unsafe assignment of an error typed value
handleSubmitForm={(validateCode) => updateDelegateRole({email: login, role: newRole, validateCode, delegatedAccess: account?.delegatedAccess})}
descriptionPrimary={translate('delegate.enterSecurityCode', account?.primaryLogin ?? session?.email ?? '')}
/>
Expand Down
Loading