diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index a567bd8aca17..57360b931e96 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -91,7 +91,7 @@ import type {IOURequestType} from './actions/IOU'; import {unholdRequest} from './actions/IOU/Hold'; import {canApproveIOU, canIOUBePaid, canSubmitReport, getBadgeFromIOUReport, getIOUReportActionWithBadge} from './actions/IOU/ReportWorkflow'; import {createDraftWorkspace} from './actions/Policy/Policy'; -import {hasCreditBankAccount} from './actions/ReimbursementAccount/store'; +import hasCreditBankAccount from './actions/ReimbursementAccount/hasCreditBankAccount'; import {openUnreportedExpense} from './actions/Report'; import type {GuidedSetupData, TaskForParameters} from './actions/Report'; import {isAnonymousUser as isAnonymousUserSession} from './actions/Session'; diff --git a/src/libs/actions/BankAccounts.ts b/src/libs/actions/BankAccounts.ts index d35848039ea3..819bf530426c 100644 --- a/src/libs/actions/BankAccounts.ts +++ b/src/libs/actions/BankAccounts.ts @@ -47,8 +47,6 @@ import {setBankAccountSubStep} from './ReimbursementAccount'; export { goToWithdrawalAccountSetupStep, - setBankAccountFormValidationErrors, - resetReimbursementAccount, resetUSDBankAccount, resetNonUSDBankAccount, hideBankAccountErrors, diff --git a/src/libs/actions/CompanyCards.ts b/src/libs/actions/CompanyCards.ts index 228e9d9152e2..60af6bfee331 100644 --- a/src/libs/actions/CompanyCards.ts +++ b/src/libs/actions/CompanyCards.ts @@ -154,10 +154,6 @@ function setAssignCardStepAndData({cardToAssign, isEditing, currentStep, isRefre Onyx.merge(ONYXKEYS.ASSIGN_CARD, {cardToAssign, isEditing, currentStep, isRefreshing}); } -function setTransactionStartDate(startDate: string) { - Onyx.merge(ONYXKEYS.ASSIGN_CARD, {startDate}); -} - function clearAssignCardStepAndData() { Onyx.set(ONYXKEYS.ASSIGN_CARD, {}); } @@ -1025,35 +1021,6 @@ function openPolicyCompanyCardsFeed(domainAccountID: number, policyID: string, f API.read(READ_COMMANDS.OPEN_POLICY_COMPANY_CARDS_FEED, parameters, {optimisticData, successData, failureData}); } -function openAssignFeedCardPage(policyID: string, feed: CompanyCardFeedWithNumber, domainOrWorkspaceAccountID: number) { - const parameters: OpenPolicyCompanyCardsFeedParams = { - policyID, - feed, - }; - - const optimisticData: Array> = [ - { - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${domainOrWorkspaceAccountID}`, - value: { - isLoading: true, - }, - }, - ]; - - const finallyData: Array> = [ - { - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${domainOrWorkspaceAccountID}`, - value: { - isLoading: false, - }, - }, - ]; - - API.read(READ_COMMANDS.OPEN_ASSIGN_FEED_CARD_PAGE, parameters, {optimisticData, finallyData}); -} - function openPolicyAddCardFeedPage(policyID: string | undefined) { if (!policyID) { return; @@ -1425,9 +1392,7 @@ export { clearAddNewCardFlow, setAssignCardStepAndData, clearAssignCardStepAndData, - openAssignFeedCardPage, openPolicyAddCardFeedPage, - setTransactionStartDate, setFeedStatementPeriodEndDay, importCSVCompanyCards, clearErrorField, diff --git a/src/libs/actions/Delegate.ts b/src/libs/actions/Delegate.ts index a31097d7e3a7..4cbacabd6034 100644 --- a/src/libs/actions/Delegate.ts +++ b/src/libs/actions/Delegate.ts @@ -110,9 +110,6 @@ type IsConnectedAsDelegateParams = WithDelegatedAccess; // Connect as delegate type ConnectParams = WithEmail & WithDelegatedAccess & WithOldDotFlag & WithCredentials & WithSession & WithActivePolicyID; -// Clear pending action for role update -type ClearDelegateRolePendingActionParams = WithEmail & WithDelegatedAccess; - /** * Connects the user as a delegate to another account. * Returns a Promise that resolves to true on success, false on failure, or undefined if not applicable. @@ -332,10 +329,6 @@ function clearDelegatorErrors({delegatedAccess}: ClearDelegatorErrorsParams) { Onyx.merge(ONYXKEYS.ACCOUNT, {delegatedAccess: {delegators: delegatedAccess.delegators.map((delegator) => ({...delegator, errorFields: undefined}))}}); } -function requestValidationCode() { - API.write(WRITE_COMMANDS.RESEND_VALIDATE_CODE, null); -} - function addDelegate({email, role, validateCode, delegatedAccess}: AddDelegateParams) { if (!delegatedAccess?.delegates) { return; @@ -669,34 +662,6 @@ function updateDelegateRole({email, role, validateCode, delegatedAccess}: Update API.write(WRITE_COMMANDS.UPDATE_DELEGATE_ROLE, parameters, {optimisticData, successData, failureData}); } -function clearDelegateRolePendingAction({email, delegatedAccess}: ClearDelegateRolePendingActionParams) { - if (!delegatedAccess?.delegates) { - return; - } - - const optimisticData: Array> = [ - { - onyxMethod: Onyx.METHOD.MERGE, - key: ONYXKEYS.ACCOUNT, - value: { - delegatedAccess: { - delegates: delegatedAccess.delegates.map((delegate) => - delegate.email === email - ? { - ...delegate, - pendingAction: null, - pendingFields: undefined, - } - : delegate, - ), - }, - }, - }, - ]; - - Onyx.update(optimisticData); -} - function restoreDelegateSession(authenticateResponse: Response) { Onyx.clear(KEYS_TO_PRESERVE_DELEGATE_ACCESS).then(() => { updateSessionAuthTokens(authenticateResponse?.authToken, authenticateResponse?.encryptedAuthToken); @@ -719,11 +684,9 @@ export { disconnect, clearDelegatorErrors, addDelegate, - requestValidationCode, clearDelegateErrorsByField, restoreDelegateSession, isConnectedAsDelegate, - clearDelegateRolePendingAction, updateDelegateRole, removeDelegate, openSecuritySettingsPage, diff --git a/src/libs/actions/HybridApp/index.ts b/src/libs/actions/HybridApp/index.ts index 0401f8de1f74..ece621cd9c6b 100644 --- a/src/libs/actions/HybridApp/index.ts +++ b/src/libs/actions/HybridApp/index.ts @@ -131,14 +131,6 @@ function setUseNewDotSignInPage(useNewDotSignInPage: boolean) { return Onyx.merge(ONYXKEYS.HYBRID_APP, {useNewDotSignInPage}); } -function setClosingReactNativeApp(closingReactNativeApp: boolean) { - // This value is only relevant for HybridApp, so we can skip it in other environments. - if (!CONFIG.IS_HYBRID_APP) { - return; - } - Onyx.merge(ONYXKEYS.HYBRID_APP, {closingReactNativeApp}); -} - /* * Starts HybridApp sign-in flow from the beginning. */ @@ -154,4 +146,4 @@ function resetSignInFlow() { }); } -export {getHybridAppSettings, setReadyToShowAuthScreens, resetSignInFlow, setUseNewDotSignInPage, setClosingReactNativeApp, closeReactNativeApp}; +export {getHybridAppSettings, setReadyToShowAuthScreens, resetSignInFlow, setUseNewDotSignInPage, closeReactNativeApp}; diff --git a/src/libs/actions/IOU/BulkEdit.ts b/src/libs/actions/IOU/BulkEdit.ts index c02cdbdf5136..c033a33e191d 100644 --- a/src/libs/actions/IOU/BulkEdit.ts +++ b/src/libs/actions/IOU/BulkEdit.ts @@ -580,5 +580,5 @@ function updateBulkEditDraftTransaction(transactionChanges: NullishDeep { - return deprecatedCurrentUserPersonalDetails; -} - function getRecentAttendees(): OnyxEntry { return recentAttendees; } @@ -3780,7 +3775,6 @@ export { calculateDiffAmount, getUpdatedMoneyRequestReportData, startDistanceRequest, - hasOutstandingChildRequest, getReportPreviewAction, mergePolicyRecentlyUsedCurrencies, mergePolicyRecentlyUsedCategories, @@ -3792,14 +3786,12 @@ export { getAllReportNameValuePairs, getAllTransactionDrafts, getCurrentUserEmail, - getCurrentUserPersonalDetails, getUserAccountID, getRecentAttendees, getReceiptError, // TODO: Replace getPolicyTagsData (https://github.com/Expensify/App/issues/72721) and getPolicyRecentlyUsedTagsData (https://github.com/Expensify/App/issues/71491) with useOnyx hook // eslint-disable-next-line @typescript-eslint/no-deprecated getPolicyTagsData, - maybeUpdateReportNameForFormulaTitle, getSearchOnyxUpdate, getPolicyTags, // eslint-disable-next-line @typescript-eslint/no-deprecated diff --git a/src/libs/actions/OnyxUpdateManager/utils/DeferredOnyxUpdates.ts b/src/libs/actions/OnyxUpdateManager/utils/DeferredOnyxUpdates.ts index 0b6d2526844d..6a9e99b914fc 100644 --- a/src/libs/actions/OnyxUpdateManager/utils/DeferredOnyxUpdates.ts +++ b/src/libs/actions/OnyxUpdateManager/utils/DeferredOnyxUpdates.ts @@ -7,8 +7,6 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type {OnyxUpdatesFromServer, Response} from '@src/types/onyx'; import {isValidOnyxUpdateFromServer} from '@src/types/onyx/OnyxUpdatesFromServer'; -// eslint-disable-next-line import/no-cycle -import {validateAndApplyDeferredUpdates} from '.'; // eslint-disable-next-line @typescript-eslint/no-explicit-any let missingOnyxUpdatesQueryPromise: Promise | Array> | void> | undefined; @@ -59,17 +57,6 @@ function isEmpty() { return Object.keys(deferredUpdates).length === 0; } -/** - * Manually processes and applies the updates from the deferred updates queue. (used e.g. for push notifications) - */ -function process() { - if (missingOnyxUpdatesQueryPromise) { - missingOnyxUpdatesQueryPromise.finally(() => validateAndApplyDeferredUpdates); - } - - missingOnyxUpdatesQueryPromise = validateAndApplyDeferredUpdates(); -} - type EnqueueDeferredOnyxUpdatesOptions = { shouldPauseSequentialQueue?: boolean; }; @@ -129,4 +116,4 @@ function clear(options?: ClearDeferredOnyxUpdatesOptions) { } } -export {getMissingOnyxUpdatesQueryPromise, setMissingOnyxUpdatesQueryPromise, getUpdates, isEmpty, process, enqueue, clear}; +export {getMissingOnyxUpdatesQueryPromise, setMissingOnyxUpdatesQueryPromise, getUpdates, isEmpty, enqueue, clear}; diff --git a/src/libs/actions/PersonalDetails.ts b/src/libs/actions/PersonalDetails.ts index a23958859a58..b5b721145641 100644 --- a/src/libs/actions/PersonalDetails.ts +++ b/src/libs/actions/PersonalDetails.ts @@ -505,26 +505,6 @@ function deleteAvatar(currentUserPersonalDetails: Pick { - return Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {achData: {state}}); -} - function hideBankAccountErrors() { Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {error: '', errors: null}); } @@ -66,6 +61,17 @@ function setReimbursementAccountOptionPressed(optionPressed: ValueOf(items: readonly T[], searchValue: string } export default filterArrayByMatch; -export {MATCH_RANK}; diff --git a/src/libs/memoize/index.ts b/src/libs/memoize/index.ts index b0dcaad2c752..3f6837db016a 100644 --- a/src/libs/memoize/index.ts +++ b/src/libs/memoize/index.ts @@ -112,5 +112,3 @@ function memoize {