Skip to content

Commit f0217bb

Browse files
committed
Merge branch 'main' into make-tooltips-pressable
2 parents 77ac032 + 86b9c79 commit f0217bb

File tree

7 files changed

+49
-219
lines changed

7 files changed

+49
-219
lines changed

src/components/Accordion/index.native.tsx

Lines changed: 0 additions & 81 deletions
This file was deleted.

src/components/Accordion/index.tsx

Lines changed: 0 additions & 78 deletions
This file was deleted.

src/libs/Navigation/linkTo/index.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,7 @@ export default function linkTo(navigation: NavigationContainerRef<RootStackParam
183183
}
184184
}
185185

186-
if (
187-
action &&
188-
'payload' in action &&
189-
action.payload &&
190-
'name' in action.payload &&
191-
(isSideModalNavigator(action.payload.name) || action.payload.name === NAVIGATORS.FULL_SCREEN_NAVIGATOR)
192-
) {
186+
if (action && 'payload' in action && action.payload && 'name' in action.payload && isSideModalNavigator(action.payload.name)) {
193187
// Information about the state may be in the params.
194188
const currentFocusedRoute = findFocusedRoute(extrapolateStateFromParams(rootState));
195189
const targetFocusedRoute = findFocusedRoute(stateFromPath);
@@ -207,7 +201,7 @@ export default function linkTo(navigation: NavigationContainerRef<RootStackParam
207201
// There are situations where a route already exists on the current navigation stack
208202
// But we want to push the same route instead of going back in the stack
209203
// Which would break the user navigation history
210-
if ((!isActiveRoute && type === CONST.NAVIGATION.ACTION_TYPE.PUSH) || action.payload.name === NAVIGATORS.FULL_SCREEN_NAVIGATOR) {
204+
if (!isActiveRoute && type === CONST.NAVIGATION.ACTION_TYPE.PUSH) {
211205
minimalAction.type = CONST.NAVIGATION.ACTION_TYPE.PUSH;
212206
}
213207
root.dispatch(minimalAction);

src/libs/TransactionUtils/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,10 @@ function isOnHoldByTransactionID(transactionID: string | undefined | null): bool
951951
* Checks if any violations for the provided transaction are of type 'violation'
952952
*/
953953
function hasViolation(transactionID: string | undefined, transactionViolations: OnyxCollection<TransactionViolations>, showInReview?: boolean): boolean {
954+
const transaction = getTransaction(transactionID);
955+
if (isExpensifyCardTransaction(transaction) && isPending(transaction)) {
956+
return false;
957+
}
954958
return !!transactionViolations?.[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS + transactionID]?.some(
955959
(violation: TransactionViolation) => violation.type === CONST.VIOLATION_TYPES.VIOLATION && (showInReview === undefined || showInReview === (violation.showInReview ?? false)),
956960
);
@@ -960,6 +964,10 @@ function hasViolation(transactionID: string | undefined, transactionViolations:
960964
* Checks if any violations for the provided transaction are of type 'notice'
961965
*/
962966
function hasNoticeTypeViolation(transactionID: string | undefined, transactionViolations: OnyxCollection<TransactionViolation[]>, showInReview?: boolean): boolean {
967+
const transaction = getTransaction(transactionID);
968+
if (isExpensifyCardTransaction(transaction) && isPending(transaction)) {
969+
return false;
970+
}
963971
return !!transactionViolations?.[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS + transactionID]?.some(
964972
(violation: TransactionViolation) => violation.type === CONST.VIOLATION_TYPES.NOTICE && (showInReview === undefined || showInReview === (violation.showInReview ?? false)),
965973
);
@@ -969,6 +977,10 @@ function hasNoticeTypeViolation(transactionID: string | undefined, transactionVi
969977
* Checks if any violations for the provided transaction are of type 'warning'
970978
*/
971979
function hasWarningTypeViolation(transactionID: string | undefined, transactionViolations: OnyxCollection<TransactionViolation[]>, showInReview?: boolean): boolean {
980+
const transaction = getTransaction(transactionID);
981+
if (isExpensifyCardTransaction(transaction) && isPending(transaction)) {
982+
return false;
983+
}
972984
const violations = transactionViolations?.[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS + transactionID];
973985
const warningTypeViolations =
974986
violations?.filter(

src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ import useLocalize from '@hooks/useLocalize';
88
import useNetwork from '@hooks/useNetwork';
99
import useTheme from '@hooks/useTheme';
1010
import useThemeStyles from '@hooks/useThemeStyles';
11-
import * as CardUtils from '@libs/CardUtils';
11+
import {getCompanyFeeds, getFilteredCardList, getSelectedFeed, hasOnlyOneCardToAssign, isSelectedFeedExpired} from '@libs/CardUtils';
1212
import Navigation from '@libs/Navigation/Navigation';
1313
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
1414
import type {FullScreenNavigatorParamList} from '@libs/Navigation/types';
15-
import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils';
16-
import * as PolicyUtils from '@libs/PolicyUtils';
15+
import {getPersonalDetailByEmail} from '@libs/PersonalDetailsUtils';
16+
import {getWorkspaceAccountID, isDeletedPolicyEmployee} from '@libs/PolicyUtils';
1717
import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper';
1818
import WorkspacePageWithSections from '@pages/workspace/WorkspacePageWithSections';
19-
import * as CompanyCards from '@userActions/CompanyCards';
19+
import {openPolicyCompanyCardsFeed, openPolicyCompanyCardsPage, setAssignCardStepAndData} from '@userActions/CompanyCards';
2020
import CONST from '@src/CONST';
2121
import ONYXKEYS from '@src/ONYXKEYS';
2222
import ROUTES from '@src/ROUTES';
@@ -35,10 +35,10 @@ function WorkspaceCompanyCardPage({route}: WorkspaceCompanyCardPageProps) {
3535
const styles = useThemeStyles();
3636
const theme = useTheme();
3737
const policyID = route.params.policyID;
38-
const workspaceAccountID = PolicyUtils.getWorkspaceAccountID(policyID);
38+
const workspaceAccountID = getWorkspaceAccountID(policyID);
3939
const [lastSelectedFeed] = useOnyx(`${ONYXKEYS.COLLECTION.LAST_SELECTED_FEED}${policyID}`);
4040
const [cardFeeds] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${workspaceAccountID}`);
41-
const selectedFeed = CardUtils.getSelectedFeed(lastSelectedFeed, cardFeeds);
41+
const selectedFeed = getSelectedFeed(lastSelectedFeed, cardFeeds);
4242
const [cardsList] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}${workspaceAccountID}_${selectedFeed}`);
4343

4444
const {cardList, ...cards} = cardsList ?? {};
@@ -47,17 +47,17 @@ function WorkspaceCompanyCardPage({route}: WorkspaceCompanyCardPageProps) {
4747
const [isActingAsDelegate] = useOnyx(ONYXKEYS.ACCOUNT, {selector: (account) => !!account?.delegatedAccess?.delegate});
4848
const [isNoDelegateAccessMenuVisible, setIsNoDelegateAccessMenuVisible] = useState(false);
4949

50-
const filteredCardList = CardUtils.getFilteredCardList(cardsList, selectedFeed ? cardFeeds?.settings?.oAuthAccountDetails?.[selectedFeed] : undefined);
50+
const filteredCardList = getFilteredCardList(cardsList, selectedFeed ? cardFeeds?.settings?.oAuthAccountDetails?.[selectedFeed] : undefined);
5151

52-
const companyCards = CardUtils.getCompanyFeeds(cardFeeds);
52+
const companyCards = getCompanyFeeds(cardFeeds);
5353
const selectedFeedData = selectedFeed && companyCards[selectedFeed];
5454
const isNoFeed = !selectedFeedData;
5555
const isPending = !!selectedFeedData?.pending;
5656
const isFeedAdded = !isPending && !isNoFeed;
57-
const isFeedExpired = CardUtils.isSelectedFeedExpired(selectedFeed ? cardFeeds?.settings?.oAuthAccountDetails?.[selectedFeed] : undefined);
57+
const isFeedExpired = isSelectedFeedExpired(selectedFeed ? cardFeeds?.settings?.oAuthAccountDetails?.[selectedFeed] : undefined);
5858

5959
const fetchCompanyCards = useCallback(() => {
60-
CompanyCards.openPolicyCompanyCardsPage(policyID, workspaceAccountID);
60+
openPolicyCompanyCardsPage(policyID, workspaceAccountID);
6161
}, [policyID, workspaceAccountID]);
6262

6363
const {isOffline} = useNetwork({onReconnect: fetchCompanyCards});
@@ -70,7 +70,7 @@ function WorkspaceCompanyCardPage({route}: WorkspaceCompanyCardPageProps) {
7070
return;
7171
}
7272

73-
CompanyCards.openPolicyCompanyCardsFeed(policyID, selectedFeed);
73+
openPolicyCompanyCardsFeed(policyID, selectedFeed);
7474
}, [selectedFeed, isLoading, policyID, isPending]);
7575

7676
const handleAssignCard = () => {
@@ -86,17 +86,17 @@ function WorkspaceCompanyCardPage({route}: WorkspaceCompanyCardPageProps) {
8686
};
8787

8888
let currentStep: AssignCardStep = CONST.COMPANY_CARD.STEP.ASSIGNEE;
89-
const employeeList = Object.values(policy?.employeeList ?? {}).filter((employee) => !PolicyUtils.isDeletedPolicyEmployee(employee, isOffline));
89+
const employeeList = Object.values(policy?.employeeList ?? {}).filter((employee) => !isDeletedPolicyEmployee(employee, isOffline));
9090

9191
if (employeeList.length === 1) {
9292
const userEmail = Object.keys(policy?.employeeList ?? {}).at(0) ?? '';
9393
data.email = userEmail;
94-
const personalDetails = PersonalDetailsUtils.getPersonalDetailByEmail(userEmail);
94+
const personalDetails = getPersonalDetailByEmail(userEmail);
9595
const memberName = personalDetails?.firstName ? personalDetails.firstName : personalDetails?.login;
9696
data.cardName = `${memberName}'s card`;
9797
currentStep = CONST.COMPANY_CARD.STEP.CARD;
9898

99-
if (CardUtils.hasOnlyOneCardToAssign(filteredCardList)) {
99+
if (hasOnlyOneCardToAssign(filteredCardList)) {
100100
currentStep = CONST.COMPANY_CARD.STEP.TRANSACTION_START_DATE;
101101
data.cardNumber = Object.keys(filteredCardList).at(0);
102102
data.encryptedCardNumber = Object.values(filteredCardList).at(0);
@@ -107,7 +107,7 @@ function WorkspaceCompanyCardPage({route}: WorkspaceCompanyCardPageProps) {
107107
currentStep = CONST.COMPANY_CARD.STEP.BANK_CONNECTION;
108108
}
109109

110-
CompanyCards.setAssignCardStepAndData({data, currentStep});
110+
setAssignCardStepAndData({data, currentStep});
111111
Navigation.setNavigationActionToMicrotaskQueue(() => Navigation.navigate(ROUTES.WORKSPACE_COMPANY_CARDS_ASSIGN_CARD.getRoute(policyID, selectedFeed)));
112112
};
113113

0 commit comments

Comments
 (0)