From 5c0d43ff3f913f1123e56470d3b0ae33c2c8226a Mon Sep 17 00:00:00 2001 From: Chirag Chandrakant Salian Date: Mon, 4 Dec 2023 11:20:26 -0800 Subject: [PATCH] Merge pull request #32410 from Expensify/nikki-match-bank-names [CP Staging] Match bank names for credit card icons (cherry picked from commit 6dbaa4a7ac8c8142a452bf2a059a16b2947616c9) --- src/CONST.ts | 1 + src/components/Icon/BankIcons.ts | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/CONST.ts b/src/CONST.ts index 13b79179f431..43921d9a4457 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -2873,6 +2873,7 @@ const CONST = { FIDELITY: 'fidelity', GENERIC_BANK: 'generic bank', HUNTINGTON_BANK: 'huntington bank', + HUNTINGTON_NATIONAL: 'huntington national', NAVY_FEDERAL_CREDIT_UNION: 'navy federal credit union', PNC: 'pnc', REGIONS_BANK: 'regions bank', diff --git a/src/components/Icon/BankIcons.ts b/src/components/Icon/BankIcons.ts index 81e9075091c6..ece9a865629b 100644 --- a/src/components/Icon/BankIcons.ts +++ b/src/components/Icon/BankIcons.ts @@ -62,6 +62,9 @@ function getAssetIcon(bankNameKey: BankNameKey, isCard: boolean): React.FC) : (require('@assets/images/bankicons/huntington-bank.svg').default as React.FC), + [CONST.BANK_NAMES.HUNTINGTON_NATIONAL]: isCard + ? (require('@assets/images/cardicons/huntington-bank.svg').default as React.FC) + : (require('@assets/images/bankicons/huntington-bank.svg').default as React.FC), [CONST.BANK_NAMES.NAVY_FEDERAL_CREDIT_UNION]: isCard ? (require('@assets/images/cardicons/navy-federal-credit-union.svg').default as React.FC) : (require('@assets/images/bankicons/navy-federal-credit-union.svg').default as React.FC), @@ -95,7 +98,17 @@ function getAssetIcon(bankNameKey: BankNameKey, isCard: boolean): React.FC value?.toLowerCase() === bankName); + const bank = Object.entries(CONST.BANK_NAMES).find(([, value]) => { + const condensedValue = value.replace(/\s/g, ''); + return ( + bankName === value || + bankName.includes(value) || + bankName.startsWith(value) || + bankName === condensedValue || + bankName.includes(condensedValue) || + bankName.startsWith(condensedValue) + ); + }); return (bank?.[0] as BankNameKey) ?? ''; }