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
1 change: 1 addition & 0 deletions src/components/AddExistingExpenseFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ function AddExistingExpenseFooter({selectedIds, report, reportToConfirm, policy,
afterTransition: () => {
if (report && isIOUReport(report)) {
convertBulkTrackedExpensesToIOU({
getCurrencyDecimals,
transactions,
iouReport: report,
chatReport,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function MoneyReportHeaderSecondaryActionsInner({reportID, primaryAction, isRepo
const chatReportPolicy = usePolicy(chatReport?.policyID);
const lastWorkspaceNumber = useLastWorkspaceNumber();

const {convertToDisplayString} = useCurrencyListActions();
const {getCurrencyDecimals, convertToDisplayString} = useCurrencyListActions();

const {isBetaEnabled} = usePermissions();
const isASAPSubmitBetaEnabled = isBetaEnabled(CONST.BETAS.ASAP_SUBMIT);
Expand Down Expand Up @@ -196,6 +196,7 @@ function MoneyReportHeaderSecondaryActionsInner({reportID, primaryAction, isRepo
} else if (isInvoiceReport) {
startAnimation();
payInvoice({
getCurrencyDecimals,
paymentMethodType: type,
chatReport,
invoiceReport: moneyRequestReport,
Expand All @@ -219,6 +220,7 @@ function MoneyReportHeaderSecondaryActionsInner({reportID, primaryAction, isRepo
} else {
startAnimation();
payMoneyRequest({
getCurrencyDecimals,
paymentType: type,
chatReport,
iouReport: moneyRequestReport,
Expand Down Expand Up @@ -427,6 +429,7 @@ function MoneyReportHeaderSecondaryActionsInner({reportID, primaryAction, isRepo
const onPaymentSelect = (event: KYCFlowEvent, iouPaymentType: PaymentMethodType, triggerKYCFlow: TriggerKYCFlow) => {
const runPaymentSelection = () =>
selectPaymentType({
getCurrencyDecimals,
event,
iouPaymentType,
triggerKYCFlow,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function PayPrimaryAction({reportID, chatReportID}: PayPrimaryActionProps) {
const [invoiceReceiverPolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${invoiceReceiverPolicyID}`);
const existingB2BInvoiceReport = useParticipantsInvoiceReport(activePolicyID, CONST.REPORT.INVOICE_RECEIVER_TYPE.BUSINESS, chatReport?.policyID);
const getChatReportActions = usePayChatReportActions(chatReport, existingB2BInvoiceReport);
const {convertToDisplayString} = useCurrencyListActions();
const {getCurrencyDecimals, convertToDisplayString} = useCurrencyListActions();
const isTrackIntentUser = isTrackOnboardingChoice(introSelected?.choice);

const isInvoiceReport = isInvoiceReportUtil(moneyRequestReport);
Expand Down Expand Up @@ -144,6 +144,7 @@ function PayPrimaryAction({reportID, chatReportID}: PayPrimaryActionProps) {
} else if (isInvoiceReport) {
startAnimation();
payInvoice({
getCurrencyDecimals,
paymentMethodType: type,
chatReport,
invoiceReport: moneyRequestReport,
Expand All @@ -167,6 +168,7 @@ function PayPrimaryAction({reportID, chatReportID}: PayPrimaryActionProps) {
} else {
startAnimation();
payMoneyRequest({
getCurrencyDecimals,
paymentType: type,
chatReport,
iouReport: moneyRequestReport,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {useSearchQueryContext, useSearchResultsContext} from '@components/Search

import useConfirmModal from '@hooks/useConfirmModal';
import useConfirmPendingRTERAndProceed from '@hooks/useConfirmPendingRTERAndProceed';
import {useCurrencyListActions} from '@hooks/useCurrencyList';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
Expand Down Expand Up @@ -68,6 +69,7 @@ function SubmitPrimaryAction({reportID}: SubmitPrimaryActionProps) {
function SubmitPrimaryActionContent({reportID}: SubmitPrimaryActionProps) {
const {isSubmittingAnimationRunning, stopAnimation, startSubmittingAnimation} = usePaymentAnimationsContext();
const {translate} = useLocalize();
const {getCurrencyDecimals} = useCurrencyListActions();
const {isOffline} = useNetwork();
const {accountID, email} = useCurrentUserPersonalDetails();
const {isBetaEnabled} = usePermissions();
Expand Down Expand Up @@ -155,6 +157,7 @@ function SubmitPrimaryActionContent({reportID}: SubmitPrimaryActionProps) {
}

submitReport({
getCurrencyDecimals,
expenseReport: moneyRequestReport,
policy,
currentUserAccountIDParam: accountID,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {useDelegateNoAccessActions, useDelegateNoAccessState} from '@components/DelegateNoAccessModalProvider';
import {useMoneyReportHeaderModals} from '@components/MoneyReportHeaderModalsContext';

import {useCurrencyListActions} from '@hooks/useCurrencyList';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useDelegateAccountID from '@hooks/useDelegateAccountID';
import useOnyx from '@hooks/useOnyx';
Expand All @@ -22,6 +23,7 @@ import {personalDetailsLoginSelector} from '@selectors/PersonalDetails';

function useConfirmApproval(reportID: string | undefined, startApprovedAnimation: () => void) {
const {accountID, email} = useCurrentUserPersonalDetails();
const {getCurrencyDecimals} = useCurrencyListActions();
const {isBetaEnabled} = usePermissions();
const {isDelegateAccessRestricted} = useDelegateNoAccessState();
const {showDelegateNoAccessModal} = useDelegateNoAccessActions();
Expand Down Expand Up @@ -57,6 +59,7 @@ function useConfirmApproval(reportID: string | undefined, startApprovedAnimation
startApprovedAnimation();
}
approveMoneyRequest({
getCurrencyDecimals,
expenseReport: moneyRequestReport,
expenseReportPolicy: policy,
currentUserAccountIDParam: accountID,
Expand Down
1 change: 1 addition & 0 deletions src/components/MoneyRequestHeaderSecondaryActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ function MoneyRequestHeaderSecondaryActions({reportID, onBackButtonPress}: Money
const existingTransactionDraft = existingTransactionID ? transactionDrafts?.[existingTransactionID] : undefined;

duplicateTransactionAction({
getCurrencyDecimals,
transaction: item,
optimisticChatReportID,
optimisticIOUReportID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function PayActionButton() {
const {isDelegateAccessRestricted} = useDelegateNoAccessState();
const {showDelegateNoAccessModal} = useDelegateNoAccessActions();
const lastWorkspaceNumber = useLastWorkspaceNumber();
const {convertToDisplayString} = useCurrencyListActions();
const {getCurrencyDecimals, convertToDisplayString} = useCurrencyListActions();

const {iouReportID, chatReportID, chatReport, transactions} = useReportPreviewData();
const {isPaidAnimationRunning, isApprovedAnimationRunning} = useReportPreviewAnimationState();
Expand Down Expand Up @@ -102,6 +102,7 @@ function PayActionButton() {
if (isInvoiceReportUtils(iouReport)) {
startAnimation();
payInvoice({
getCurrencyDecimals,
paymentMethodType: type,
chatReport: currentChatReport,
invoiceReport: iouReport,
Expand All @@ -124,6 +125,7 @@ function PayActionButton() {
});
} else {
payMoneyRequest({
getCurrencyDecimals,
paymentType: type,
chatReport: currentChatReport,
iouReport,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {ReportSubmitToPopoverAnchor, useOpenReportSubmitToPopover} from '@compon

import useConfirmModal from '@hooks/useConfirmModal';
import useConfirmPendingRTERAndProceed from '@hooks/useConfirmPendingRTERAndProceed';
import {useCurrencyListActions} from '@hooks/useCurrencyList';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
Expand Down Expand Up @@ -45,6 +46,7 @@ function SubmitActionButton() {

function SubmitActionButtonContent() {
const {translate} = useLocalize();
const {getCurrencyDecimals} = useCurrencyListActions();
const {showConfirmModal} = useConfirmModal();
const currentUserDetails = useCurrentUserPersonalDetails();
const currentUserAccountID = currentUserDetails.accountID;
Expand Down Expand Up @@ -94,6 +96,7 @@ function SubmitActionButtonContent() {
}

submitReport({
getCurrencyDecimals,
expenseReport: iouReport,
policy,
currentUserAccountIDParam: currentUserAccountID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
import {useDelegateNoAccessActions, useDelegateNoAccessState} from '@components/DelegateNoAccessModalProvider';

import {useCurrencyListActions} from '@hooks/useCurrencyList';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useOnyx from '@hooks/useOnyx';
import usePermissions from '@hooks/usePermissions';
Expand All @@ -24,6 +25,7 @@ import {useReportPreviewActions, useReportPreviewActionState} from './MoneyReque

function useConfirmApproveReportAction(actionButtonData: ReturnType<typeof useReportPreviewActionButtonData>, transactions: Transaction[], hasViolations: boolean) {
const currentUserDetails = useCurrentUserPersonalDetails();
const {getCurrencyDecimals} = useCurrencyListActions();
const {isBetaEnabled} = usePermissions();
const {isDelegateAccessRestricted} = useDelegateNoAccessState();
const {showDelegateNoAccessModal} = useDelegateNoAccessActions();
Expand All @@ -41,6 +43,7 @@ function useConfirmApproveReportAction(actionButtonData: ReturnType<typeof useRe
onHoldMenuOpen(CONST.IOU.REPORT_ACTION_TYPE.APPROVE, undefined, shouldShowPayButton);
} else {
approveMoneyRequest({
getCurrencyDecimals,
expenseReport: iouReport,
expenseReportPolicy: policy,
currentUserAccountIDParam: currentUserDetails.accountID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type PayActionCellProps = {

function PayActionCell({isLoading, policyID, reportID, hash, amount, shouldDisablePointerEvents, chatReport}: PayActionCellProps) {
const styles = useThemeStyles();
const {convertToDisplayString} = useCurrencyListActions();
const {getCurrencyDecimals, convertToDisplayString} = useCurrencyListActions();
const {isOffline} = useNetwork();
const {isDelegateAccessRestricted} = useDelegateNoAccessState();
const {showDelegateNoAccessModal} = useDelegateNoAccessActions();
Expand Down Expand Up @@ -110,6 +110,7 @@ function PayActionCell({isLoading, policyID, reportID, hash, amount, shouldDisab
allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${getNonEmptyStringOnyxID(shouldUseB2BInvoiceReport ? existingB2BInvoiceReport?.reportID : chatReport?.reportID)}`];

payInvoice({
getCurrencyDecimals,
paymentMethodType: type,
chatReport,
invoiceReport: iouReport,
Expand All @@ -135,6 +136,7 @@ function PayActionCell({isLoading, policyID, reportID, hash, amount, shouldDisab
}

payMoneyRequest({
getCurrencyDecimals,
paymentType: type,
chatReport,
iouReport,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function ExpenseReportListItemInner<TItem extends ListItem>({
transactionsWithoutPendingDelete.length > 0 && transactionsWithoutPendingDelete.every((transaction) => selectedTransactions[transaction.keyForList]?.isSelected);
const isSelected = liveRowSelected || areAllReportTransactionsSelected;
const {translate} = useLocalize();
const {convertToDisplayString} = useCurrencyListActions();
const {getCurrencyDecimals, convertToDisplayString} = useCurrencyListActions();
const {isLargeScreenWidth} = useResponsiveLayout();
const {currentSearchHash, currentSearchKey} = useSearchQueryContext();
const {currentSearchResults} = useSearchResultsContext();
Expand Down Expand Up @@ -245,6 +245,7 @@ function ExpenseReportListItemInner<TItem extends ListItem>({

const handleOnButtonPress = useCallback(() => {
handleActionButtonPress({
getCurrencyDecimals,
hash: currentSearchHash,
item: liveReportItem,
goToItem: () => onSelectRow(reportItem as unknown as TItem),
Expand Down Expand Up @@ -332,6 +333,7 @@ function ExpenseReportListItemInner<TItem extends ListItem>({
showConfirmModal,
translate,
convertToDisplayString,
getCurrencyDecimals,
currentUserAccountID,
currentUserLogin,
introSelected,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {useRowSelection} from '@components/Search/SearchSelectionProvider';
import type {ListItem} from '@components/SelectionList/types';

import useConfirmModal from '@hooks/useConfirmModal';
import {useCurrencyListActions} from '@hooks/useCurrencyList';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
Expand Down Expand Up @@ -288,6 +289,7 @@ function ReportListItemHeaderInner<TItem extends ListItem>({
const {isDelegateAccessRestricted} = useDelegateNoAccessState();
const {showDelegateNoAccessModal} = useDelegateNoAccessActions();
const {translate} = useLocalize();
const {getCurrencyDecimals} = useCurrencyListActions();
const {showConfirmModal} = useConfirmModal();
const {isSelected} = useRowSelection(reportItem.keyForList);
const avatarBorderColor =
Expand All @@ -298,6 +300,7 @@ function ReportListItemHeaderInner<TItem extends ListItem>({

const handleOnButtonPress = (event?: ModifiedMouseEvent) => {
handleActionButtonPress({
getCurrencyDecimals,
hash: currentSearchHash,
item: reportItem,
goToItem: () => onSelectRow(reportItem as unknown as TItem, event),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Text from '@components/Text';
import TransactionItemRow from '@components/TransactionItemRow';
import {useWideRHPActions} from '@components/WideRHPContextProvider';

import {useCurrencyListActions} from '@hooks/useCurrencyList';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
Expand Down Expand Up @@ -80,6 +81,7 @@ function TransactionGroupListExpandedImpl({
const {windowWidth} = useWindowDimensions();
const currentUserDetails = useCurrentUserPersonalDetails();
const {translate} = useLocalize();
const {getCurrencyDecimals} = useCurrencyListActions();
const [isMobileSelectionModeEnabled] = useOnyx(ONYXKEYS.RAM_ONLY_MOBILE_SELECTION_MODE);
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
const [betas] = useOnyx(ONYXKEYS.BETAS);
Expand Down Expand Up @@ -198,6 +200,7 @@ function TransactionGroupListExpandedImpl({
if (!transactionItem?.reportAction?.childReportID) {
if (isModifiedMousePress(event)) {
const targetReportID = createAndOpenSearchTransactionThread({
getCurrencyDecimals,
item: transactionItem,
introSelected,
backTo,
Expand All @@ -215,6 +218,7 @@ function TransactionGroupListExpandedImpl({
return;
}
createAndOpenSearchTransactionThread({
getCurrencyDecimals,
item: transactionItem,
introSelected,
backTo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import useLiveRowCapabilities from '@components/Search/SearchList/ListItem/useLi
import type {ListItem} from '@components/SelectionList/types';

import useConfirmModal from '@hooks/useConfirmModal';
import {useCurrencyListActions} from '@hooks/useCurrencyList';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
Expand Down Expand Up @@ -197,12 +198,14 @@ function TransactionListItemInner<TItem extends ListItem>({
const {isDelegateAccessRestricted} = useDelegateNoAccessState();
const {showDelegateNoAccessModal} = useDelegateNoAccessActions();
const {translate} = useLocalize();
const {getCurrencyDecimals} = useCurrencyListActions();
const {showConfirmModal} = useConfirmModal();
const openReportSubmitToPopover = useOpenReportSubmitToPopover();
const {shouldDisableSearchSubmitPress, consumeIgnoreNextSearchSubmitPress} = useSearchSubmitPopoverGuard();

const handleActionButtonPress = (event?: Parameters<typeof onSelectRow>[2]) => {
handleActionButtonPressUtil({
getCurrencyDecimals,
hash: currentSearchHash,
item: liveTransactionItem,
goToItem: () => onSelectRow(item, transactionPreviewData, event),
Expand Down
3 changes: 2 additions & 1 deletion src/components/Search/SearchStaticList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function SearchStaticList({
const theme = useTheme();
const StyleUtils = useStyleUtils();
const {translate, localeCompare, formatPhoneNumber} = useLocalize();
const {convertToDisplayString} = useCurrencyListActions();
const {getCurrencyDecimals, convertToDisplayString} = useCurrencyListActions();
const session = useSession();
const accountID = session?.accountID ?? CONST.DEFAULT_NUMBER_ID;
const email = session?.email;
Expand Down Expand Up @@ -140,6 +140,7 @@ function SearchStaticList({
// They're only used for guided-setup onboarding data, which is gated behind introSelected/onboarding checks
// that won't apply here - the user has already completed onboarding if they're submitting expenses.
createAndOpenSearchTransactionThread({
getCurrencyDecimals,
item,
introSelected: undefined,
backTo,
Expand Down
Loading
Loading