Repository navigation
Add Assign new cards option for direct card feeds v2
#86032
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
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
ec123a9
Add refresh card feed connection route and screen
fedirjh 2f3cfa1
Add translations for assigning new cards in English and Spanish
fedirjh f040967
Add RefreshCardFeedConnectionPage and integrate with WorkspaceCompany…
fedirjh 577e492
Enhance card assignment flow with refresh state management
fedirjh a6a1eec
Refactor RefreshCardFeedConnectionPage to improve refresh state handling
fedirjh f591523
Enhance card connection components with title prop support
fedirjh 3f800d3
Enhance RefreshCardFeedConnectionPage with feed expiration handling
fedirjh 5172537
Add unit tests for RefreshCardFeedConnectionPage
fedirjh 5a684b3
Add WorkspaceCompanyCardsVerifyAccountPage and related routing logic
fedirjh 1c588a4
Enhance company card feed functionality with new refresh logic
fedirjh 1dfd79a
Refactor RefreshCardFeedConnectionPage and WorkspaceCompanyCardsSetti…
fedirjh f7fb565
Refactor imports and enhance test structure for RefreshCardFeedConnec…
fedirjh ed6dbad
Merge branch 'Expensify:main' into sync-feed-cards
fedirjh 19ae51a
Add 'assignNewCards' feature to multiple language files with titles a…
fedirjh 08a33b7
Refactor CompanyCards actions by removing unused setFeedRefreshComple…
fedirjh 2e377ba
Remove unused setFeedRefreshComplete function from RefreshCardFeedCon…
fedirjh 21ff93a
Merge branch 'Expensify:main' into sync-feed-cards
fedirjh aaab346
Refactor mock components in RefreshCardFeedConnectionPageTest to dyna…
fedirjh 66c6c15
Add NotFoundPage component and validation for direct feed in RefreshC…
fedirjh 4fb7c1f
Merge branch 'Expensify:main' into sync-feed-cards
fedirjh 2f18dd5
Refactor imports in RefreshCardFeedConnectionPage to streamline code …
fedirjh fa3d94e
Enhance validation in RefreshCardFeedConnectionPage by adding current…
fedirjh 361bf96
Merge branch 'Expensify:main' into sync-feed-cards
fedirjh 50a1db5
Merge branch 'Expensify:main' into sync-feed-cards
fedirjh 0b8b7da
Enhance RefreshCardFeedConnectionPage tests to include NotFoundPage r…
fedirjh c6ec064
Add tests for ROUTES helper functions in RefreshCardFeedConnectionPag…
fedirjh 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
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
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
88 changes: 88 additions & 0 deletions
88
src/pages/workspace/companyCards/RefreshCardFeedConnectionPage.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,88 @@ | ||
| import React, {useEffect} from 'react'; | ||
| import useCardFeeds from '@hooks/useCardFeeds'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useOnyx from '@hooks/useOnyx'; | ||
| import usePrevious from '@hooks/usePrevious'; | ||
| import {isDirectFeed} from '@libs/CardUtils'; | ||
| import Navigation from '@libs/Navigation/Navigation'; | ||
| import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; | ||
| import type {SettingsNavigatorParamList} from '@navigation/types'; | ||
| import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; | ||
| import LoadingPage from '@pages/LoadingPage'; | ||
| import type {WithPolicyAndFullscreenLoadingProps} from '@pages/workspace/withPolicyAndFullscreenLoading'; | ||
| import withPolicyAndFullscreenLoading from '@pages/workspace/withPolicyAndFullscreenLoading'; | ||
| import {clearAssignCardStepAndData} from '@userActions/CompanyCards'; | ||
| import CONST from '@src/CONST'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import type SCREENS from '@src/SCREENS'; | ||
| import PlaidConnectionStep from './addNew/PlaidConnectionStep'; | ||
| import BankConnection from './BankConnection'; | ||
|
|
||
| type RefreshCardFeedConnectionPageProps = PlatformStackScreenProps<SettingsNavigatorParamList, typeof SCREENS.WORKSPACE.COMPANY_CARDS_REFRESH_CARD_FEED_CONNECTION> & | ||
| WithPolicyAndFullscreenLoadingProps; | ||
|
|
||
| function RefreshCardFeedConnectionPage({route, policy}: RefreshCardFeedConnectionPageProps) { | ||
| const feed = route.params?.feed; | ||
| const policyID = policy?.id; | ||
|
|
||
| const {translate} = useLocalize(); | ||
|
|
||
| const [assignCard] = useOnyx(ONYXKEYS.ASSIGN_CARD); | ||
| const currentStep = assignCard?.currentStep; | ||
| const isRefreshing = assignCard?.isRefreshing; | ||
| const prevIsRefreshing = usePrevious(isRefreshing); | ||
| const title = translate('workspace.companyCards.assignNewCards.title'); | ||
|
|
||
| const [cardFeeds] = useCardFeeds(policyID); | ||
| const feedExpiration = feed ? cardFeeds?.[feed]?.expiration : undefined; | ||
| const prevFeedExpiration = usePrevious(feedExpiration); | ||
|
|
||
| useEffect(() => { | ||
| return () => { | ||
| clearAssignCardStepAndData(); | ||
| }; | ||
| }, []); | ||
|
|
||
| // Plaid feeds: isRefreshing is cleared by importPlaidAccounts successData | ||
| useEffect(() => { | ||
| if (prevIsRefreshing !== true || isRefreshing) { | ||
| return; | ||
| } | ||
| Navigation.closeRHPFlow(); | ||
| }, [prevIsRefreshing, isRefreshing]); | ||
|
|
||
| // OAuth feeds: expiration updates after bank re-authentication completes | ||
| useEffect(() => { | ||
| if (prevFeedExpiration === undefined || prevFeedExpiration === feedExpiration || !isRefreshing) { | ||
| return; | ||
| } | ||
| Navigation.closeRHPFlow(); | ||
| }, [prevFeedExpiration, feedExpiration, isRefreshing]); | ||
|
|
||
| if (!isDirectFeed(feed) || !cardFeeds?.[feed] || !currentStep) { | ||
| return <NotFoundPage />; | ||
| } | ||
|
|
||
| switch (currentStep) { | ||
| case CONST.COMPANY_CARD.STEP.BANK_CONNECTION: | ||
| return ( | ||
| <BankConnection | ||
| policyID={policyID} | ||
| feed={feed} | ||
| title={title} | ||
| /> | ||
| ); | ||
| case CONST.COMPANY_CARD.STEP.PLAID_CONNECTION: | ||
| return ( | ||
| <PlaidConnectionStep | ||
| feed={feed} | ||
| policyID={policyID} | ||
| title={title} | ||
| /> | ||
| ); | ||
| default: | ||
| return <LoadingPage title={title} />; | ||
| } | ||
| } | ||
|
|
||
| export default withPolicyAndFullscreenLoading(RefreshCardFeedConnectionPage); | ||
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.