Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/components/AddExistingExpenseFooter.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {useCurrencyListActions} from '@hooks/useCurrencyList';
import useDelegateAccountID from '@hooks/useDelegateAccountID';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
Expand Down Expand Up @@ -49,6 +50,7 @@ function AddExistingExpenseFooter({selectedIds, report, reportToConfirm, policy,
const styles = useThemeStyles();
const {isBetaEnabled} = usePermissions();
const isASAPSubmitBetaEnabled = isBetaEnabled(CONST.BETAS.ASAP_SUBMIT);
const {getCurrencyDecimals} = useCurrencyListActions();
const session = useSession();
const personalDetails = usePersonalDetails();
const delegateAccountID = useDelegateAccountID();
Expand Down Expand Up @@ -109,6 +111,7 @@ function AddExistingExpenseFooter({selectedIds, report, reportToConfirm, policy,
isTrackIntentUser,
personalPolicyOutputCurrency: personalPolicy?.outputCurrency,
selfDMReportActions,
getCurrencyDecimals,
});
}
},
Expand Down
4 changes: 4 additions & 0 deletions src/components/KYCWall/BaseKYCWall.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import AddPaymentMethodMenu from '@components/AddPaymentMethodMenu';

import {useCurrencyListActions} from '@hooks/useCurrencyList';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
Expand Down Expand Up @@ -88,6 +89,7 @@ function KYCWall({
const [doesSubmitterPersonalDetailExist] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {selector: doesSubmitterPersonalDetailExistSelector});

const {translate} = useLocalize();
const {getCurrencyDecimals} = useCurrencyListActions();
const currentUserDetails = useCurrentUserPersonalDetails();
const currentUserAccountID = currentUserDetails.accountID;
const currentUserEmail = currentUserDetails.email ?? '';
Expand Down Expand Up @@ -218,6 +220,7 @@ function KYCWall({
localeTranslate: translate,
reportActionsList: filteredReportActions,
doesEmployeePersonalDetailExist: doesSubmitterPersonalDetailExist ?? false,
getCurrencyDecimals,
}) ?? {};
if (policyID && iouReport?.policyID) {
savePreferredPaymentMethod(iouReport.policyID, policyID, CONST.LAST_PAYMENT_METHOD.IOU, lastPaymentMethod?.[iouReport?.policyID]);
Expand Down Expand Up @@ -285,6 +288,7 @@ function KYCWall({
betas,
conciergeChat,
localCurrency,
getCurrencyDecimals,
],
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Button from '@components/Button';

import useCreateEmptyReportConfirmation from '@hooks/useCreateEmptyReportConfirmation';
import {useCurrencyListActions} from '@hooks/useCurrencyList';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
Expand Down Expand Up @@ -57,6 +58,7 @@ function QuickCreationActionsBar() {
const [travelSettings] = useOnyx(ONYXKEYS.NVP_TRAVEL_SETTINGS);

const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const {getCurrencyDecimals} = useCurrencyListActions();
const {isBetaEnabled} = usePermissions();
const isASAPSubmitBetaEnabled = isBetaEnabled(CONST.BETAS.ASAP_SUBMIT);
const hasViolations = hasViolationsReportUtils(undefined, transactionViolations, session?.accountID ?? CONST.DEFAULT_NUMBER_ID, session?.email ?? '');
Expand Down Expand Up @@ -104,6 +106,7 @@ function QuickCreationActionsBar() {
defaultChatEnabledPolicy,
allBetas,
isTrackIntentUser,
getCurrencyDecimals,
false,
shouldDismissEmptyReportsConfirmation,
);
Expand All @@ -114,7 +117,7 @@ function QuickCreationActionsBar() {
Navigation.navigate(getCreateReportRoute({reportID: createdReportID}));
});
},
[currentUserPersonalDetails, hasViolations, defaultChatEnabledPolicy, isASAPSubmitBetaEnabled, allBetas, isTrackIntentUser],
[currentUserPersonalDetails, hasViolations, defaultChatEnabledPolicy, isASAPSubmitBetaEnabled, allBetas, isTrackIntentUser, getCurrencyDecimals],
);

const {openCreateReportConfirmation} = useCreateEmptyReportConfirmation({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type {PopoverMenuItem} from '@components/PopoverMenu';
import PopoverMenu from '@components/PopoverMenu';

import useCreateEmptyReportConfirmation from '@hooks/useCreateEmptyReportConfirmation';
import {useCurrencyListActions} from '@hooks/useCurrencyList';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
Expand Down Expand Up @@ -59,6 +60,7 @@ function SearchActionsBarCreateButton() {
selector: (policies: OnyxCollection<OnyxTypes.Policy>) => getGroupPoliciesWhereReportCanBeCreated(policies, isSubmit2026BetaEnabled, email),
});
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const {getCurrencyDecimals} = useCurrencyListActions();
const hasViolations = hasViolationsReportUtils(undefined, transactionViolations, session?.accountID ?? CONST.DEFAULT_NUMBER_ID, session?.email ?? '');
const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID);
const [activePolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID}`);
Expand Down Expand Up @@ -88,6 +90,7 @@ function SearchActionsBarCreateButton() {
defaultChatEnabledPolicy,
allBetas,
isTrackIntentUser,
getCurrencyDecimals,
false,
shouldDismissEmptyReportsConfirmation,
);
Expand All @@ -99,7 +102,7 @@ function SearchActionsBarCreateButton() {
);
});
},
[currentUserPersonalDetails, hasViolations, defaultChatEnabledPolicy, isASAPSubmitBetaEnabled, allBetas, isTrackIntentUser],
[currentUserPersonalDetails, hasViolations, defaultChatEnabledPolicy, isASAPSubmitBetaEnabled, allBetas, isTrackIntentUser, getCurrencyDecimals],
);

const {openCreateReportConfirmation} = useCreateEmptyReportConfirmation({
Expand Down
3 changes: 3 additions & 0 deletions src/hooks/useBulkDuplicateReportAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type {OnyxCollection} from 'react-native-onyx';

import {hasSeenTourSelector, isTrackIntentUserSelector} from '@selectors/Onboarding';

import {useCurrencyListActions} from './useCurrencyList';
import useCurrentUserPersonalDetails from './useCurrentUserPersonalDetails';
import useDefaultExpensePolicy from './useDefaultExpensePolicy';
import useDelegateAccountID from './useDelegateAccountID';
Expand All @@ -33,6 +34,7 @@ function useBulkDuplicateReportAction({selectedReports, allReports, searchData}:
const {isBetaEnabled} = usePermissions();
const isASAPSubmitBetaEnabled = isBetaEnabled(CONST.BETAS.ASAP_SUBMIT);
const {translate, formatPhoneNumber} = useLocalize();
const {getCurrencyDecimals} = useCurrencyListActions();

const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE);
const [policyRecentlyUsedCurrencies] = useOnyx(ONYXKEYS.RECENTLY_USED_CURRENCIES);
Expand Down Expand Up @@ -73,6 +75,7 @@ function useBulkDuplicateReportAction({selectedReports, allReports, searchData}:
isTrackIntentUser,
delegateAccountID,
formatPhoneNumber,
getCurrencyDecimals,
});

clearSelectedTransactions(undefined, true);
Expand Down
16 changes: 14 additions & 2 deletions src/hooks/useCreateNewReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {isTrackIntentUserSelector} from '@selectors/Onboarding';
import {accountIDSelector, emailSelector} from '@selectors/Session';
import {useCallback} from 'react';

import {useCurrencyListActions} from './useCurrencyList';
import useCurrentUserPersonalDetails from './useCurrentUserPersonalDetails';
import useOnyx from './useOnyx';
import usePermissions from './usePermissions';
Expand All @@ -26,15 +27,26 @@ function useCreateNewReport() {
const [betas] = useOnyx(ONYXKEYS.BETAS);
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY);
const [isTrackIntentUser] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {selector: isTrackIntentUserSelector});
const {getCurrencyDecimals} = useCurrencyListActions();

const hasViolations = hasViolationsUtil(undefined, transactionViolations, accountID ?? CONST.DEFAULT_NUMBER_ID, email ?? '');

return useCallback(
(policyID: string, shouldDismissEmptyReportsConfirmation = false) => {
const policy = policies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`];
return createNewReport(currentUserPersonalDetails, hasViolations, isASAPSubmitBetaEnabled, policy, betas, isTrackIntentUser, false, shouldDismissEmptyReportsConfirmation);
return createNewReport(
currentUserPersonalDetails,
hasViolations,
isASAPSubmitBetaEnabled,
policy,
betas,
isTrackIntentUser,
getCurrencyDecimals,
false,
shouldDismissEmptyReportsConfirmation,
);
},
[betas, currentUserPersonalDetails, hasViolations, isASAPSubmitBetaEnabled, policies, isTrackIntentUser],
[betas, currentUserPersonalDetails, hasViolations, isASAPSubmitBetaEnabled, policies, isTrackIntentUser, getCurrencyDecimals],
);
}

Expand Down
1 change: 1 addition & 0 deletions src/hooks/useExpenseActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ function useExpenseActions({reportID, isReportInSearch = false, backTo, onDuplic
isTrackIntentUser,
delegateAccountID,
formatPhoneNumber,
getCurrencyDecimals,
});
},
},
Expand Down
3 changes: 3 additions & 0 deletions src/hooks/useUndeleteTransactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import type {Transaction} from '@src/types/onyx';

import {isTrackIntentUserSelector} from '@selectors/Onboarding';

import {useCurrencyListActions} from './useCurrencyList';
import useCurrentUserPersonalDetails from './useCurrentUserPersonalDetails';
import useOnyx from './useOnyx';
import usePermissions from './usePermissions';

function useUndeleteTransactions() {
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const {getCurrencyDecimals} = useCurrencyListActions();
const {isBetaEnabled} = usePermissions();
const isASAPSubmitBetaEnabled = isBetaEnabled(CONST.BETAS.ASAP_SUBMIT);
const [personalPolicyID] = useOnyx(ONYXKEYS.PERSONAL_POLICY_ID);
Expand Down Expand Up @@ -40,6 +42,7 @@ function useUndeleteTransactions() {
selfDMReportActions,
isTrackIntentUser,
personalPolicyOutputCurrency: policy?.outputCurrency,
getCurrencyDecimals,
});
};
}
Expand Down
Loading
Loading