-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Home Page] Add Locked VBA (Verified Bank Account) widget to Time Sensitive #88429
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
Merged
mountiny
merged 26 commits into
Expensify:main
from
software-mansion-labs:@adamgrzybowski/time-sensitive-locked-VBA
May 4, 2026
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
64c9cf6
Add unit tests for UnlockBankAccount time-sensitive widget
adamgrzybowski 810078e
Add translations
adamgrzybowski a0629f0
Add UnlockBankAccount widget to TimeSensitiveSection
adamgrzybowski cdf5c6e
Add BankLock icon asset and export
adamgrzybowski cca8e51
Update UnlockBankAccount concierge chat handling
adamgrzybowski 55da97e
Extract locked bank account detection into a dedicated time-sensitive…
adamgrzybowski c7382b2
Add Spanish translations for locked bank account widget
adamgrzybowski 0cfaf89
Refactor locked bank account hook to source Onyx data
adamgrzybowski c06d290
Update bank-lock SVG compression
adamgrzybowski 0b1e2eb
Fix es translation
adamgrzybowski 799930e
Fix locked bank account widget gating for reimbursers
adamgrzybowski 5cf022e
Fix null-safe locked bank account iteration
adamgrzybowski eab18e2
Fix personal locked bank account type filtering
adamgrzybowski 292f1fb
Fix duplicate keys for locked bank account widgets
adamgrzybowski 7940279
Add unlock bank account translations for additional locales
adamgrzybowski ead2ab8
Fix locked bank account iteration when list is undefined
adamgrzybowski 63d4336
Add workspace subtitles for locked bank account locales
adamgrzybowski 9f797cb
Merge branch 'main' into @adamgrzybowski/time-sensitive-locked-VBA
adamgrzybowski 928ff87
Fix namespace imports in UnlockBankAccountTest to use named imports
adamgrzybowski 7f88888
Remove .cursor
adamgrzybowski 92090ba
Fix duplicate key and lint issues in locked bank account tests
adamgrzybowski 9306abd
Fix workspaceLockedBankAccountIDs ordering to allow personal widget f…
adamgrzybowski 7f8c40f
Merge branch 'main' into @adamgrzybowski/time-sensitive-locked-VBA
adamgrzybowski 30ee9be
Merge branch 'main' into @adamgrzybowski/time-sensitive-locked-VBA
adamgrzybowski 83ca9a5
Pass delegateAccountID to pressLockedBankAccount in UnlockBankAccount
adamgrzybowski 1dd9cb4
Fix UnlockBankAccount test assertion to include delegateAccountID arg…
adamgrzybowski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/pages/home/TimeSensitiveSection/hooks/useTimeSensitiveLockedBankAccount.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import {primaryLoginSelector} from '@selectors/Account'; | ||
| import useOnyx from '@hooks/useOnyx'; | ||
| import CONST from '@src/CONST'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import type {BankAccountList, Policy} from '@src/types/onyx'; | ||
| import {getEmptyObject} from '@src/types/utils/EmptyObject'; | ||
|
|
||
| type LockedBankAccount = { | ||
| /** Stable key used to render this account widget */ | ||
| key: string; | ||
|
|
||
| /** The ID of the locked bank account */ | ||
| bankAccountID: number; | ||
|
|
||
| /** The policy name — undefined means personal account */ | ||
| policyName?: string; | ||
| }; | ||
|
|
||
| function useTimeSensitiveLockedBankAccount(adminPolicies: Policy[] | undefined) { | ||
|
adamgrzybowski marked this conversation as resolved.
|
||
| const [bankAccountList = getEmptyObject<BankAccountList>()] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST); | ||
| const [primaryLogin] = useOnyx(ONYXKEYS.ACCOUNT, {selector: primaryLoginSelector}); | ||
| const lockedBankAccounts: LockedBankAccount[] = []; | ||
| const workspaceLockedBankAccountIDs = new Set<number>(); | ||
|
|
||
| for (const policy of adminPolicies ?? []) { | ||
| const achAccount = policy.achAccount; | ||
| if (achAccount?.state !== CONST.BANK_ACCOUNT.STATE.LOCKED || !achAccount.bankAccountID) { | ||
| continue; | ||
| } | ||
|
|
||
| const isCurrentUserReimburser = !!primaryLogin && achAccount.reimburser === primaryLogin; | ||
| if (!isCurrentUserReimburser) { | ||
| continue; | ||
| } | ||
|
|
||
| workspaceLockedBankAccountIDs.add(achAccount.bankAccountID); | ||
| lockedBankAccounts.push({ | ||
| key: `workspace-${policy.id}-${achAccount.bankAccountID}`, | ||
| bankAccountID: achAccount.bankAccountID, | ||
| policyName: policy.name, | ||
| }); | ||
| } | ||
|
|
||
| for (const account of Object.values(bankAccountList ?? {})) { | ||
| const {bankAccountID, state, type} = account?.accountData ?? {}; | ||
| const isPersonalAccount = type === undefined || type === CONST.BANK_ACCOUNT.TYPE.PERSONAL; | ||
|
|
||
| if (!isPersonalAccount) { | ||
| continue; | ||
| } | ||
|
|
||
| if (state === CONST.BANK_ACCOUNT.STATE.LOCKED && bankAccountID && !workspaceLockedBankAccountIDs.has(bankAccountID)) { | ||
| lockedBankAccounts.push({ | ||
| key: `personal-${bankAccountID}`, | ||
| bankAccountID, | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| return { | ||
| lockedBankAccounts, | ||
| }; | ||
| } | ||
|
|
||
| export default useTimeSensitiveLockedBankAccount; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/pages/home/TimeSensitiveSection/items/UnlockBankAccount.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import {hasSeenTourSelector} from '@selectors/Onboarding'; | ||
| import React from 'react'; | ||
| import BaseWidgetItem from '@components/BaseWidgetItem'; | ||
| import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; | ||
| import useDelegateAccountID from '@hooks/useDelegateAccountID'; | ||
| import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useOnyx from '@hooks/useOnyx'; | ||
| import {pressLockedBankAccount} from '@libs/actions/BankAccounts'; | ||
| import {navigateToConciergeChat} from '@libs/actions/Report'; | ||
| import colors from '@styles/theme/colors'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
|
|
||
| type UnlockBankAccountProps = { | ||
| /** The ID of the locked bank account */ | ||
| bankAccountID: number; | ||
|
|
||
| /** The policy name — undefined means personal account (subtitle: 'Wallet') */ | ||
| policyName?: string; | ||
| }; | ||
|
|
||
| function UnlockBankAccount({bankAccountID, policyName}: UnlockBankAccountProps) { | ||
| const {translate} = useLocalize(); | ||
| const icons = useMemoizedLazyExpensifyIcons(['BankLock']); | ||
| const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID); | ||
| const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED); | ||
| const [betas] = useOnyx(ONYXKEYS.BETAS); | ||
| const [isSelfTourViewed] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: hasSeenTourSelector}); | ||
| const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails(); | ||
| const delegateAccountID = useDelegateAccountID(); | ||
|
|
||
| const title = policyName ? translate('homePage.timeSensitiveSection.unlockBankAccount.workspaceTitle') : translate('homePage.timeSensitiveSection.unlockBankAccount.personalTitle'); | ||
|
|
||
| const subtitle = policyName | ||
| ? translate('homePage.timeSensitiveSection.unlockBankAccount.workspaceSubtitle', {policyName}) | ||
| : translate('homePage.timeSensitiveSection.unlockBankAccount.personalSubtitle'); | ||
|
|
||
| const handleCtaPress = () => { | ||
| pressLockedBankAccount(bankAccountID, translate, conciergeReportID, delegateAccountID); | ||
| navigateToConciergeChat(conciergeReportID, introSelected, currentUserAccountID, isSelfTourViewed, betas); | ||
| }; | ||
|
|
||
| return ( | ||
| <BaseWidgetItem | ||
| icon={icons.BankLock} | ||
| iconBackgroundColor={colors.tangerine100} | ||
| iconFill={colors.tangerine500} | ||
| title={title} | ||
| subtitle={subtitle} | ||
| ctaText={translate('homePage.timeSensitiveSection.ctaFix')} | ||
| onCtaPress={handleCtaPress} | ||
| buttonProps={{danger: true}} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| export default UnlockBankAccount; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.