Skip to content

Commit 6361f34

Browse files
authored
Merge pull request Expensify#88285 from shubham1206agra/knip-audit-export-6
[NoQA] Remove unused exports (batch 6)
2 parents 5a2d4dd + 0236638 commit 6361f34

16 files changed

Lines changed: 9 additions & 272 deletions

File tree

src/libs/actions/Report/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7395,14 +7395,12 @@ export {
73957395
addAttachmentWithComment,
73967396
addComment,
73977397
addPolicyReport,
7398-
broadcastUserIsLeavingRoom,
73997398
broadcastUserIsTyping,
74007399
buildOptimisticChangePolicyData,
74017400
buildOptimisticResolvedFollowups,
74027401
clearAddRoomMemberError,
74037402
clearAvatarErrors,
74047403
clearDeleteTransactionNavigateBackUrl,
7405-
clearGroupChat,
74067404
clearIOUError,
74077405
clearNewRoomFormError,
74087406
setNewRoomFormLoading,
@@ -7442,7 +7440,6 @@ export {
74427440
markAsManuallyExported,
74437441
markCommentAsUnread,
74447442
navigateToAndOpenChildReport,
7445-
createChildReport,
74467443
navigateToAndOpenReport,
74477444
navigateToAndOpenReportWithAccountIDs,
74487445
navigateToAndCreateGroupChat,

src/libs/actions/Search.ts

Lines changed: 0 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import cloneDeep from 'lodash/cloneDeep';
21
import isEmpty from 'lodash/isEmpty';
32
import Onyx from 'react-native-onyx';
43
import type {OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx';
@@ -17,7 +16,6 @@ import type {
1716
OpenBulkChangeApproverPageParams,
1817
OpenSearchPageParams,
1918
ReportExportParams,
20-
RevertSplitTransactionParams,
2119
SubmitReportParams,
2220
} from '@libs/API/parameters';
2321
import {READ_COMMANDS, SIDE_EFFECT_REQUEST_COMMANDS, WRITE_COMMANDS} from '@libs/API/types';
@@ -38,7 +36,6 @@ import {
3836
buildOptimisticIOUReportAction,
3937
generateReportID,
4038
getParsedComment,
41-
getReportOrDraftReport,
4239
getReportTransactions,
4340
hasHeldExpenses,
4441
isExpenseReport,
@@ -75,10 +72,8 @@ import type {PaymentInformation} from '@src/types/onyx/LastPaymentMethod';
7572
import type {ConnectionName} from '@src/types/onyx/Policy';
7673
import type {OnyxData} from '@src/types/onyx/Request';
7774
import type Nullable from '@src/types/utils/Nullable';
78-
import type PrefixedRecord from '@src/types/utils/PrefixedRecord';
7975
import SafeString from '@src/utils/SafeString';
8076
import {setPersonalBankAccountContinueKYCOnSuccess} from './BankAccounts';
81-
import {getReportPreviewAction} from './IOU';
8277
import {deleteMoneyRequest} from './IOU/DeleteMoneyRequest';
8378
import {prepareRejectMoneyRequestData, rejectMoneyRequest} from './IOU/RejectMoneyRequest';
8479
import type {RejectMoneyRequestData} from './IOU/RejectMoneyRequest';
@@ -991,161 +986,6 @@ function bulkDeleteReports({
991986
}
992987
}
993988

994-
function revertSplitTransactionOnSearch(
995-
hash: number,
996-
originalTransactionID: string,
997-
params: RevertSplitTransactionParams,
998-
optimisticDeletedSplitTransactions: PrefixedRecord<typeof ONYXKEYS.COLLECTION.TRANSACTION, Transaction> = {},
999-
optimisticRestoredTransaction?: Transaction,
1000-
optimisticOriginalTransaction?: Transaction,
1001-
previousSnapshotOriginalTransaction?: Transaction,
1002-
) {
1003-
let optimisticData: Array<
1004-
OnyxUpdate<typeof ONYXKEYS.COLLECTION.REPORT | typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS | typeof ONYXKEYS.COLLECTION.SNAPSHOT | typeof ONYXKEYS.COLLECTION.TRANSACTION>
1005-
> = [];
1006-
let failureData: Array<
1007-
OnyxUpdate<typeof ONYXKEYS.COLLECTION.REPORT | typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS | typeof ONYXKEYS.COLLECTION.SNAPSHOT | typeof ONYXKEYS.COLLECTION.TRANSACTION>
1008-
> = [];
1009-
const successData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.REPORT | typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS>> = [];
1010-
let finallyData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.SNAPSHOT>> = [];
1011-
1012-
if (Object.keys(optimisticDeletedSplitTransactions).length > 0 && optimisticRestoredTransaction) {
1013-
const {optimisticData: loadingOptimisticData, finallyData: loadingFinallyData} = getOnyxLoadingData(hash);
1014-
optimisticData = [...(loadingOptimisticData ?? [])];
1015-
finallyData = [...(loadingFinallyData ?? [])];
1016-
const iouReport = params.reportID ? getReportOrDraftReport(params.reportID) : undefined;
1017-
const previousIOUReport = cloneDeep(iouReport ?? null);
1018-
const reportPreviewAction = getReportPreviewAction(iouReport?.chatReportID, iouReport?.reportID);
1019-
const previousReportPreviewAction = cloneDeep(reportPreviewAction ?? null);
1020-
1021-
const deletedSplitEntries = Object.fromEntries(Object.keys(optimisticDeletedSplitTransactions).map((transactionKey) => [transactionKey, null])) as PrefixedRecord<
1022-
typeof ONYXKEYS.COLLECTION.TRANSACTION,
1023-
null
1024-
>;
1025-
1026-
const optimisticSnapshotData: PrefixedRecord<typeof ONYXKEYS.COLLECTION.TRANSACTION, Transaction | null> = {
1027-
...deletedSplitEntries,
1028-
[`${ONYXKEYS.COLLECTION.TRANSACTION}${originalTransactionID}`]: optimisticRestoredTransaction,
1029-
};
1030-
1031-
const optimisticSnapshotUpdate: OnyxUpdate<typeof ONYXKEYS.COLLECTION.SNAPSHOT> = {
1032-
onyxMethod: Onyx.METHOD.MERGE,
1033-
key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`,
1034-
value: {
1035-
data: {
1036-
...optimisticSnapshotData,
1037-
},
1038-
},
1039-
};
1040-
optimisticData.push(optimisticSnapshotUpdate);
1041-
// Keep the transaction collection in sync for screens that do not render from the search snapshot.
1042-
optimisticData.push(
1043-
...Object.keys(optimisticDeletedSplitTransactions).map(
1044-
(transactionKey) =>
1045-
({
1046-
onyxMethod: Onyx.METHOD.SET,
1047-
key: transactionKey,
1048-
value: null,
1049-
}) as OnyxUpdate<typeof ONYXKEYS.COLLECTION.TRANSACTION>,
1050-
),
1051-
{
1052-
onyxMethod: Onyx.METHOD.SET,
1053-
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${originalTransactionID}`,
1054-
value: optimisticRestoredTransaction,
1055-
},
1056-
);
1057-
1058-
if (params.reportID) {
1059-
optimisticData.push({
1060-
onyxMethod: Onyx.METHOD.MERGE,
1061-
key: `${ONYXKEYS.COLLECTION.REPORT}${params.reportID}`,
1062-
value: {
1063-
reportID: null,
1064-
pendingFields: {
1065-
preview: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE,
1066-
},
1067-
},
1068-
});
1069-
1070-
successData.push({
1071-
onyxMethod: Onyx.METHOD.SET,
1072-
key: `${ONYXKEYS.COLLECTION.REPORT}${params.reportID}`,
1073-
value: null,
1074-
});
1075-
1076-
failureData.push({
1077-
onyxMethod: Onyx.METHOD.SET,
1078-
key: `${ONYXKEYS.COLLECTION.REPORT}${params.reportID}`,
1079-
value: previousIOUReport,
1080-
});
1081-
}
1082-
1083-
if (previousReportPreviewAction?.reportActionID && iouReport?.chatReportID) {
1084-
const updatedReportPreviewAction: Partial<ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW>> = cloneDeep(previousReportPreviewAction);
1085-
updatedReportPreviewAction.pendingAction = CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE;
1086-
1087-
optimisticData.push({
1088-
onyxMethod: Onyx.METHOD.MERGE,
1089-
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport.chatReportID}`,
1090-
value: {[previousReportPreviewAction.reportActionID]: updatedReportPreviewAction},
1091-
});
1092-
1093-
successData.push({
1094-
onyxMethod: Onyx.METHOD.MERGE,
1095-
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport.chatReportID}`,
1096-
value: {
1097-
[previousReportPreviewAction.reportActionID]: {
1098-
pendingAction: null,
1099-
errors: null,
1100-
},
1101-
},
1102-
});
1103-
1104-
failureData.push({
1105-
onyxMethod: Onyx.METHOD.MERGE,
1106-
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport.chatReportID}`,
1107-
value: {
1108-
[previousReportPreviewAction.reportActionID]: previousReportPreviewAction,
1109-
},
1110-
});
1111-
}
1112-
1113-
const failureSnapshotData: PrefixedRecord<typeof ONYXKEYS.COLLECTION.TRANSACTION, Transaction | null> = {
1114-
...optimisticDeletedSplitTransactions,
1115-
[`${ONYXKEYS.COLLECTION.TRANSACTION}${originalTransactionID}`]: previousSnapshotOriginalTransaction ?? null,
1116-
};
1117-
1118-
const failureSnapshotUpdate: OnyxUpdate<typeof ONYXKEYS.COLLECTION.SNAPSHOT> = {
1119-
onyxMethod: Onyx.METHOD.MERGE,
1120-
key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`,
1121-
value: {
1122-
data: {
1123-
...failureSnapshotData,
1124-
},
1125-
},
1126-
};
1127-
failureData = [
1128-
...failureData,
1129-
failureSnapshotUpdate,
1130-
...Object.entries(optimisticDeletedSplitTransactions).map(
1131-
([transactionKey, transaction]) =>
1132-
({
1133-
onyxMethod: Onyx.METHOD.SET,
1134-
key: transactionKey,
1135-
value: transaction,
1136-
}) as OnyxUpdate<typeof ONYXKEYS.COLLECTION.TRANSACTION>,
1137-
),
1138-
{
1139-
onyxMethod: Onyx.METHOD.SET,
1140-
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${originalTransactionID}`,
1141-
value: optimisticOriginalTransaction ?? null,
1142-
},
1143-
];
1144-
}
1145-
1146-
API.write(WRITE_COMMANDS.REVERT_SPLIT_TRANSACTION, params, {optimisticData, successData, failureData, finallyData});
1147-
}
1148-
1149989
function rejectMoneyRequestInBulk(
1150990
reportID: string,
1151991
comment: string,
@@ -1703,7 +1543,6 @@ function setOptimisticDataForTransactionThreadPreview(item: TransactionListItemT
17031543
export {
17041544
saveSearch,
17051545
search,
1706-
revertSplitTransactionOnSearch,
17071546
bulkDeleteReports,
17081547
rejectMoneyRequestsOnSearch,
17091548
exportSearchItemsToCSV,
@@ -1723,7 +1562,6 @@ export {
17231562
getLastPolicyBankAccountID,
17241563
exportToIntegrationOnSearch,
17251564
getPayOption,
1726-
isValidBulkPayOption,
17271565
handleBulkPayItemSelected,
17281566
isCurrencySupportWalletBulkPay,
17291567
getExportTemplates,

src/libs/actions/Session/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,7 +1657,6 @@ export {
16571657
clearAccountMessages,
16581658
setAccountError,
16591659
authenticatePusher,
1660-
reauthenticatePusher,
16611660
invalidateCredentials,
16621661
invalidateAuthToken,
16631662
expireSessionWithDelay,
@@ -1679,5 +1678,4 @@ export {
16791678
MergeIntoAccountAndLogin,
16801679
resetSMSDeliveryFailureStatus,
16811680
clearDisableTwoFactorAuthErrors,
1682-
getShortLivedLoginParams,
16831681
};

src/libs/actions/Task.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1487,7 +1487,6 @@ export {
14871487
setDetailsValue,
14881488
setAssigneeValue,
14891489
setShareDestinationValue,
1490-
clearOutTaskInfo,
14911490
reopenTask,
14921491
buildTaskData,
14931492
completeTask,

src/libs/actions/TransactionEdit.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@ export {
241241
removeBackupTransactionWithImageCleanup,
242242
restoreOriginalTransactionFromBackup,
243243
restoreOriginalTransactionFromBackupWithImageCleanup,
244-
createDraftTransaction,
245244
removeDraftTransaction,
246245
removeTransactionReceipt,
247246
getRemoveDraftTransactionsByIDsData,

src/libs/actions/Welcome/OnboardingFlow.ts

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
import {findFocusedRoute, getStateFromPath} from '@react-navigation/native';
2-
import type {NavigationState, PartialState} from '@react-navigation/native';
1+
import {getStateFromPath} from '@react-navigation/native';
32
import type {OnyxEntry} from 'react-native-onyx';
43
import Onyx from 'react-native-onyx';
54
import type {ValueOf} from 'type-fest';
65
import {translate} from '@libs/Localize';
7-
import getAdaptedStateFromPath from '@libs/Navigation/helpers/getAdaptedStateFromPath';
86
import {linkingConfig} from '@libs/Navigation/linkingConfig';
9-
import {navigationRef} from '@libs/Navigation/Navigation';
10-
import type {RootNavigatorParamList} from '@libs/Navigation/types';
117
import type {Video} from '@userActions/Report';
128
import CONST from '@src/CONST';
139
import IntlStore from '@src/languages/IntlStore';
1410
import NAVIGATORS from '@src/NAVIGATORS';
1511
import ONYXKEYS from '@src/ONYXKEYS';
16-
import type {Route} from '@src/ROUTES';
1712
import ROUTES from '@src/ROUTES';
1813
import {hasCompletedGuidedSetupFlowSelector} from '@src/selectors/Onboarding';
1914
import type {Locale, Onboarding} from '@src/types/onyx';
@@ -78,26 +73,6 @@ Onyx.connectWithoutView({
7873
},
7974
});
8075

81-
/**
82-
* Start a new onboarding flow or continue from the last visited onboarding page.
83-
*/
84-
function startOnboardingFlow(startOnboardingFlowParams: GetOnboardingInitialPathParamsType) {
85-
const currentRoute = navigationRef.getCurrentRoute();
86-
const adaptedState = getAdaptedStateFromPath(getOnboardingInitialPath(startOnboardingFlowParams) as Route, undefined, false);
87-
const focusedRoute = findFocusedRoute(adaptedState as PartialState<NavigationState<RootNavigatorParamList>>);
88-
if (focusedRoute?.name === currentRoute?.name) {
89-
return;
90-
}
91-
const rootState = navigationRef.getRootState();
92-
const rootStateRouteNamesSet = new Set(rootState.routes.map((route) => route.name));
93-
navigationRef.resetRoot({
94-
...rootState,
95-
...adaptedState,
96-
stale: true,
97-
routes: [...rootState.routes, ...(adaptedState?.routes.filter((route) => !rootStateRouteNamesSet.has(route.name)) ?? [])],
98-
} as PartialState<NavigationState>);
99-
}
100-
10176
function getOnboardingInitialPath(getOnboardingInitialPathParams: GetOnboardingInitialPathParamsType): string {
10277
const {
10378
isUserFromPublicDomain,
@@ -386,4 +361,4 @@ const getOnboardingMessages = (locale?: Locale) => {
386361
};
387362

388363
export type {OnboardingMessage, OnboardingTask, OnboardingTaskLinks, OnboardingPurpose, OnboardingCompanySize, GetOnboardingInitialPathParamsType};
389-
export {getOnboardingInitialPath, startOnboardingFlow, getOnboardingMessages};
364+
export {getOnboardingInitialPath, getOnboardingMessages};

src/libs/actions/getCompanyCardBankConnection/index.tsx

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import type {LinkAccount} from 'react-native-plaid-link-sdk';
2-
import type {PlaidAccount} from 'react-plaid-link';
31
import {getApiRoot} from '@libs/ApiUtils';
42
import * as NetworkStore from '@libs/Network/NetworkStore';
53
import * as PolicyUtils from '@libs/PolicyUtils';
@@ -13,16 +11,6 @@ type CompanyCardBankConnection = {
1311
isNewDot: string;
1412
};
1513

16-
type CompanyCardPlaidConnection = {
17-
authToken: string;
18-
publicToken: string;
19-
domainName: string;
20-
feedName: string;
21-
feed: string;
22-
country: string;
23-
plaidAccounts: string;
24-
};
25-
2614
type PersonalCardBankConnection = {
2715
authToken: string;
2816
isNewDot: string;
@@ -56,27 +44,6 @@ function getCompanyCardBankConnection(policyID?: string, bankName?: string | nul
5644
return `${commandURL}partners/banks/${bank}/oauth_callback.php?${new URLSearchParams(params).toString()}`;
5745
}
5846

59-
function getCompanyCardPlaidConnection(policyID?: string, publicToken?: string, feed?: string, feedName?: string, country?: string, plaidAccounts?: LinkAccount[] | PlaidAccount[]) {
60-
if (!policyID || !publicToken || !feed || !feedName || !country || !plaidAccounts?.length) {
61-
return null;
62-
}
63-
const authToken = NetworkStore.getAuthToken();
64-
const params: CompanyCardPlaidConnection = {
65-
authToken: authToken ?? '',
66-
feed,
67-
feedName,
68-
publicToken,
69-
country,
70-
domainName: PolicyUtils.getDomainNameForPolicy(policyID),
71-
plaidAccounts: JSON.stringify(plaidAccounts),
72-
};
73-
74-
const commandURL = getApiRoot({
75-
shouldSkipWebProxy: true,
76-
});
77-
return `${commandURL}partners/banks/plaid/oauth_callback.php?${new URLSearchParams(params).toString()}`;
78-
}
79-
8047
function getPersonalCardBankConnection(bankName?: string | null) {
8148
const bankConnection = Object.keys(CONST.PERSONAL_CARDS.BANKS).find((key) => CONST.PERSONAL_CARDS.BANKS[key as keyof typeof CONST.PERSONAL_CARDS.BANKS] === bankName);
8249

@@ -103,4 +70,4 @@ function getPersonalCardBankConnection(bankName?: string | null) {
10370
return `${commandURL}partners/banks/${bank}/oauth_callback.php?${new URLSearchParams(params).toString()}`;
10471
}
10572

106-
export {getCompanyCardPlaidConnection, getCompanyCardBankConnection, getPersonalCardBankConnection};
73+
export {getCompanyCardBankConnection, getPersonalCardBankConnection};

src/libs/telemetry/submitFollowUpAction.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -286,15 +286,5 @@ function isTracking(): boolean {
286286
return trackingState !== null;
287287
}
288288

289-
export {
290-
endSubmitFollowUpActionSpan,
291-
setPendingSubmitFollowUpAction,
292-
getPendingSubmitFollowUpAction,
293-
cancelSubmitFollowUpActionSpan,
294-
startTracking,
295-
setFastPath,
296-
addOptimization,
297-
cancelTracking,
298-
isTracking,
299-
};
289+
export {endSubmitFollowUpActionSpan, setPendingSubmitFollowUpAction, getPendingSubmitFollowUpAction, cancelSubmitFollowUpActionSpan, startTracking, setFastPath, addOptimization, isTracking};
300290
export type {SubmitFollowUpAction, PendingSubmitFollowUpAction, FastPathType, Optimization, SubmitExpenseContext, StartTrackingOptions};

src/libs/telemetry/trackExpenseCreationError.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,4 @@ function trackExpenseApiError(context: ApiErrorContext): void {
138138
}
139139

140140
export default trackExpenseCreationError;
141-
export {trackExpenseApiError, isExpenseCommand, isLostExpenseIndicatorCommand};
141+
export {trackExpenseApiError};

0 commit comments

Comments
 (0)