-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[Internal QA] Update Company Cards logic to show domain cards #61706
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
puneetlath
merged 16 commits into
Expensify:main
from
callstack-internal:VickyStash/feature/60978-cross-compitable-corporate-cards
May 15, 2025
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
055b421
Implement useCardsList hook, fixed useDefaultFundID hook
VickyStash 766347a
Improve getAllCardsForWorkspace function to return domain cards
VickyStash e53a60e
Merge branch 'refs/heads/main' into VickyStash/feature/60978-cross-co…
VickyStash bff5c64
Lint fixes
VickyStash 02450f3
Update CompanyCard methods to use domain id if exists
VickyStash c316591
Update flatAllCards function to support domains check
VickyStash a38ad70
Minor improvement
VickyStash ef4a9da
Merge branch 'refs/heads/main' into VickyStash/feature/60978-cross-co…
VickyStash dd68e8f
Fix member's cards display
VickyStash e75e28b
Fix the check
VickyStash 2b5745f
Fix lint errors
VickyStash 74e8817
Send domainAccountID for SetFeedName command
VickyStash 722e180
Update getDomainOrWorkspaceAccountID params
VickyStash f67b1ff
Fix expensify cards display on the member details page
VickyStash 2049fb4
Merge branch 'refs/heads/main' into VickyStash/feature/60978-cross-co…
VickyStash f3f646e
Add explanation comment
VickyStash 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type {ResultMetadata} from 'react-native-onyx'; | ||
import {filterInactiveCards, getCompanyFeeds, getDomainOrWorkspaceAccountID} from '@libs/CardUtils'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
import type {CardList, CompanyCardFeed} from '@src/types/onyx'; | ||
import useCardFeeds from './useCardFeeds'; | ||
import useOnyx from './useOnyx'; | ||
import useWorkspaceAccountID from './useWorkspaceAccountID'; | ||
|
||
/* Custom hook that retrieves a list of company cards for the given policy and selected feed. */ | ||
const useCardsList = (policyID: string | undefined, selectedFeed: CompanyCardFeed | undefined): [CardList | undefined, ResultMetadata<CardList>] => { | ||
const workspaceAccountID = useWorkspaceAccountID(policyID); | ||
const [cardFeeds] = useCardFeeds(policyID); | ||
const companyCards = getCompanyFeeds(cardFeeds); | ||
const domainOrWorkspaceAccountID = getDomainOrWorkspaceAccountID(workspaceAccountID, selectedFeed ? companyCards[selectedFeed] : undefined); | ||
const [cardsList, cardsListMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}${domainOrWorkspaceAccountID}_${selectedFeed}`, { | ||
selector: filterInactiveCards, | ||
canBeMissing: true, | ||
}); | ||
|
||
return [cardsList, cardsListMetadata]; | ||
}; | ||
|
||
export default useCardsList; |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a comment explaining what this hook is for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added small comment: f3f646e