Skip to content
Merged
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
4 changes: 0 additions & 4 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ const ONYXKEYS = {
/** Keeps track if 'GPS in progress' modal is opened */
IS_GPS_IN_PROGRESS_MODAL_OPEN: 'isGpsInProgressModalOpen',

/** Stores the PIN for an activated UK/EU Expensify card to be shown once after activation */
ACTIVATED_CARD_PIN: 'activatedCardPin',

/** Keeps track if there is a full screen currently visible or not */
FULLSCREEN_VISIBILITY: 'fullscreenVisibility',

Expand Down Expand Up @@ -1220,7 +1217,6 @@ type OnyxValuesMapping = {
[ONYXKEYS.RECENTLY_USED_CURRENCIES]: string[];
[ONYXKEYS.ACTIVE_CLIENTS]: string[];
[ONYXKEYS.DEVICE_ID]: string;
[ONYXKEYS.ACTIVATED_CARD_PIN]: string | undefined;
[ONYXKEYS.IS_SIDEBAR_LOADED]: boolean;
[ONYXKEYS.PERSISTED_REQUESTS]: OnyxTypes.AnyRequest[];
[ONYXKEYS.PERSISTED_ONGOING_REQUESTS]: OnyxTypes.AnyRequest;
Expand Down
4 changes: 2 additions & 2 deletions src/libs/API/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const WRITE_COMMANDS = {
BANK_ACCOUNT_HANDLE_PLAID_ERROR: 'BankAccount_HandlePlaidError',
REPORT_VIRTUAL_EXPENSIFY_CARD_FRAUD: 'ReportVirtualExpensifyCardFraud',
REQUEST_REPLACEMENT_EXPENSIFY_CARD: 'RequestReplacementExpensifyCard',
ACTIVATE_PHYSICAL_EXPENSIFY_CARD: 'ActivatePhysicalExpensifyCard',
RESOLVE_FRAUD_ALERT: 'ResolveFraudAlert',
UPDATE_EXPENSIFY_CARD_LIMIT: 'UpdateExpensifyCardLimit',
UPDATE_EXPENSIFY_CARD_TITLE: 'UpdateExpensifyCardTitle',
Expand Down Expand Up @@ -573,6 +574,7 @@ type WriteCommandParameters = {
[WRITE_COMMANDS.BANK_ACCOUNT_HANDLE_PLAID_ERROR]: Parameters.BankAccountHandlePlaidErrorParams;
[WRITE_COMMANDS.REPORT_VIRTUAL_EXPENSIFY_CARD_FRAUD]: Parameters.ReportVirtualExpensifyCardFraudParams;
[WRITE_COMMANDS.REQUEST_REPLACEMENT_EXPENSIFY_CARD]: Parameters.RequestReplacementExpensifyCardParams;
[WRITE_COMMANDS.ACTIVATE_PHYSICAL_EXPENSIFY_CARD]: Parameters.ActivatePhysicalExpensifyCardParams;
[WRITE_COMMANDS.RESOLVE_FRAUD_ALERT]: Parameters.ResolveFraudAlertParams;
[WRITE_COMMANDS.UPDATE_EXPENSIFY_CARD_LIMIT]: Parameters.UpdateExpensifyCardLimitParams;
[WRITE_COMMANDS.UPDATE_EXPENSIFY_CARD_TITLE]: Parameters.UpdateExpensifyCardTitleParams;
Expand Down Expand Up @@ -1305,7 +1307,6 @@ const SIDE_EFFECT_REQUEST_COMMANDS = {
SET_PERSONAL_DETAILS_AND_REVEAL_EXPENSIFY_CARD: 'SetPersonalDetailsAndRevealExpensifyCard',
TWO_FACTOR_AUTH_VALIDATE: 'TwoFactorAuth_Validate',
CONNECT_AS_DELEGATE: 'ConnectAsDelegate',
ACTIVATE_PHYSICAL_EXPENSIFY_CARD: 'ActivatePhysicalExpensifyCard',
DISCONNECT_AS_DELEGATE: 'DisconnectAsDelegate',
COMPLETE_HYBRID_APP_ONBOARDING: 'CompleteHybridAppOnboarding',
CONNECT_POLICY_TO_QUICKBOOKS_DESKTOP: 'ConnectPolicyToQuickbooksDesktop',
Expand Down Expand Up @@ -1349,7 +1350,6 @@ type SideEffectRequestCommandParameters = {
[SIDE_EFFECT_REQUEST_COMMANDS.PAY_MONEY_REQUEST_ON_SEARCH]: Parameters.PayMoneyRequestOnSearchParams;
[SIDE_EFFECT_REQUEST_COMMANDS.MERGE_INTO_ACCOUNT_AND_LOGIN]: Parameters.MergeIntoAccountAndLogInParams;
[SIDE_EFFECT_REQUEST_COMMANDS.LOG_OUT]: Parameters.LogOutParams;
[SIDE_EFFECT_REQUEST_COMMANDS.ACTIVATE_PHYSICAL_EXPENSIFY_CARD]: Parameters.ActivatePhysicalExpensifyCardParams;
[SIDE_EFFECT_REQUEST_COMMANDS.CREATE_DIGITAL_WALLET]: Parameters.CreateDigitalWalletParams;
[SIDE_EFFECT_REQUEST_COMMANDS.VERIFY_TEST_DRIVE_RECIPIENT]: Parameters.VerifyTestDriveRecipientParams;
[SIDE_EFFECT_REQUEST_COMMANDS.LOCK_ACCOUNT]: Parameters.LockAccountParams;
Expand Down
18 changes: 1 addition & 17 deletions src/libs/actions/Card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,18 +216,10 @@ function activatePhysicalExpensifyCard(cardLastFourDigits: string, cardID: numbe
cardID,
};

// eslint-disable-next-line rulesdir/no-api-side-effects-method
API.makeRequestWithSideEffects(SIDE_EFFECT_REQUEST_COMMANDS.ACTIVATE_PHYSICAL_EXPENSIFY_CARD, parameters, {
API.write(WRITE_COMMANDS.ACTIVATE_PHYSICAL_EXPENSIFY_CARD, parameters, {
optimisticData,
successData,
failureData,
}).then((response) => {
if (!response) {
return;
}
if (response.pin) {
Onyx.set(ONYXKEYS.ACTIVATED_CARD_PIN, response.pin);
}
});
}

Expand All @@ -238,13 +230,6 @@ function clearCardListErrors(cardID: number) {
Onyx.merge(ONYXKEYS.CARD_LIST, {[cardID]: {errors: null, isLoading: false}});
}

/**
* Clears the PIN for an activated card
*/
function clearActivatedCardPin() {
Onyx.set(ONYXKEYS.ACTIVATED_CARD_PIN, '');
}

function clearCardErrorField(cardID: number, fieldName: string) {
Onyx.merge(ONYXKEYS.CARD_LIST, {
[cardID]: {
Expand Down Expand Up @@ -1453,7 +1438,6 @@ export {
configureExpensifyCardsForPolicy,
issueExpensifyCard,
openCardDetailsPage,
clearActivatedCardPin,
clearCardErrorField,
clearCardNameValuePairsErrorField,
setPersonalCardReimbursable,
Expand Down
13 changes: 1 addition & 12 deletions src/pages/settings/Wallet/ExpensifyCardPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import {buildCannedSearchQuery} from '@libs/SearchQueryUtils';
import NotFoundPage from '@pages/ErrorPage/NotFoundPage';
import RedDotCardSection from '@pages/settings/Wallet/RedDotCardSection';
import CardDetails from '@pages/settings/Wallet/WalletPage/CardDetails';
import {clearActivatedCardPin} from '@userActions/Card';
import {openOldDotLink} from '@userActions/Link';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
Expand Down Expand Up @@ -83,7 +82,6 @@ function ExpensifyCardPage({route}: ExpensifyCardPageProps) {
const {cardID} = route.params;
const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: false});
const [cardList] = useOnyx(ONYXKEYS.CARD_LIST, {selector: filterOutPersonalCards, canBeMissing: false});
const [pin] = useOnyx(ONYXKEYS.ACTIVATED_CARD_PIN, {canBeMissing: true});
const [privatePersonalDetails] = useOnyx(ONYXKEYS.PRIVATE_PERSONAL_DETAILS, {canBeMissing: false});
const {currencyList} = useCurrencyList();
const styles = useThemeStyles();
Expand All @@ -107,15 +105,6 @@ function ExpensifyCardPage({route}: ExpensifyCardPageProps) {
}, [shouldDisplayCardDomain, cardList, cardID, domain]);
const currentCard = useMemo(() => cardsToShow?.find((card) => String(card?.cardID) === cardID) ?? cardsToShow?.at(0), [cardsToShow, cardID]);

useEffect(() => {
return () => {
if (!pin) {
return;
}
clearActivatedCardPin();
};
}, [pin]);

useEffect(() => {
setIsNotFound(!currentCard);
}, [cardList, cardsToShow, currentCard]);
Expand Down Expand Up @@ -355,7 +344,7 @@ function ExpensifyCardPage({route}: ExpensifyCardPageProps) {
{shouldShowPIN && (
Comment thread
DylanDylann marked this conversation as resolved.
<MenuItemWithTopDescription
description={translate('cardPage.physicalCardPin')}
title={maskPin(pin)}
title={maskPin()}
interactive={false}
titleStyle={styles.walletCardNumber}
/>
Expand Down
Loading