Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
d054eb4
Inject phone formatter into MoneyRequestBuilder
marufsharifi Aug 3, 2026
5dac56d
fixed lint failure
marufsharifi Aug 3, 2026
1bcabe4
fixed type failures
marufsharifi Aug 3, 2026
3dab925
fixed type & lint errors
marufsharifi Aug 3, 2026
a74525e
Merge branch 'main' into fix/66327-money-request-builder-phone-format…
marufsharifi Aug 3, 2026
c1ed948
Merge branch 'main' into fix/66327-money-request-builder-phone-format…
marufsharifi Aug 3, 2026
0a61fb7
fixed type failures
marufsharifi Aug 3, 2026
f729e8e
Pass phone formatter into split bill completion
marufsharifi Aug 3, 2026
f56e8f3
Merge branch 'main' into fix/66327-money-request-builder-phone-format…
marufsharifi Aug 5, 2026
1bf19cd
Merge branch 'main' into fix/66327-money-request-builder-phone-format…
marufsharifi Aug 5, 2026
1a32c1a
fixed typescript errors
marufsharifi Aug 6, 2026
e5c9f0e
Merge branch 'main' into fix/66327-money-request-builder-phone-format…
marufsharifi Aug 7, 2026
df15322
Merge branch 'main' into fix/66327-money-request-builder-phone-format…
marufsharifi Aug 10, 2026
bda94c5
Merge branch 'main' into fix/66327-money-request-builder-phone-format…
marufsharifi Aug 10, 2026
e6676a5
Merge branch 'main' into fix/66327-money-request-builder-phone-format…
marufsharifi Aug 10, 2026
d61151c
Merge branch 'main' into fix/66327-money-request-builder-phone-format…
marufsharifi Aug 10, 2026
5bd155a
Fix spellcheck typo and missing money request test param
marufsharifi Aug 10, 2026
9249441
Merge branch 'main' into fix/66327-money-request-builder-phone-format…
marufsharifi Aug 10, 2026
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: 2 additions & 1 deletion src/components/AddExistingExpenseFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type AddExistingExpenseFooterProps = {
};

function AddExistingExpenseFooter({selectedIds, report, reportToConfirm, policy, policyCategories, errorMessage, setErrorMessage}: AddExistingExpenseFooterProps) {
const {translate} = useLocalize();
const {translate, formatPhoneNumber} = useLocalize();
const styles = useThemeStyles();
const {isBetaEnabled} = usePermissions();
const isASAPSubmitBetaEnabled = isBetaEnabled(CONST.BETAS.ASAP_SUBMIT);
Expand Down Expand Up @@ -95,6 +95,7 @@ function AddExistingExpenseFooter({selectedIds, report, reportToConfirm, policy,
selfDMReportActions,
delegateAccountID,
isTrackIntentUser,
formatPhoneNumber,
});
} else {
changeTransactionsReport({
Expand Down
4 changes: 4 additions & 0 deletions src/hooks/useDeleteTransactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {useCurrencyListActions} from './useCurrencyList';
import useCurrentUserPersonalDetails from './useCurrentUserPersonalDetails';
import useDelegateAccountID from './useDelegateAccountID';
import useEnvironment from './useEnvironment';
import useLocalize from './useLocalize';
import useNetwork from './useNetwork';
import useOnyx from './useOnyx';
import usePermissions from './usePermissions';
Expand Down Expand Up @@ -110,6 +111,7 @@ function useDeleteTransactions({report, reportActions, policy}: UseDeleteTransac
const restrictedActionPolicyID = useRestrictedActionPolicyID(policy);
const {isOffline} = useNetwork();
const {isProduction} = useEnvironment();
const {formatPhoneNumber} = useLocalize();

const getSplitExpenseEditTransactionOnDelete = useCallback(
(transactionIDs: string[]): Transaction | undefined => {
Expand Down Expand Up @@ -343,6 +345,7 @@ function useDeleteTransactions({report, reportActions, policy}: UseDeleteTransac
isOffline,
delegateAccountID,
isTrackIntentUser,
formatPhoneNumber,
});
}

Expand Down Expand Up @@ -422,6 +425,7 @@ function useDeleteTransactions({report, reportActions, policy}: UseDeleteTransac
personalPolicy?.outputCurrency,
delegateAccountID,
isTrackIntentUser,
formatPhoneNumber,
getCurrencyDecimals,
getCurrencySymbol,
],
Expand Down
5 changes: 4 additions & 1 deletion src/libs/IOUAmountSubmission.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {LocalizedTranslate} from '@components/LocaleContextProvider';
import type {LocaleContextProps, LocalizedTranslate} from '@components/LocaleContextProvider';

import type {CurrencyListActionsContextType} from '@hooks/useCurrencyList';

Expand Down Expand Up @@ -82,6 +82,7 @@ type SubmitAmountArgs = {
amount: string;
paymentMethod?: PaymentMethodType;
translate: LocalizedTranslate;
formatPhoneNumber: LocaleContextProps['formatPhoneNumber'];

// Submit-time Onyx data — supplied by the screen via AmountSubmitDataSync so this module owns no subscriptions.
allPersonalDetails: OnyxEntry<OnyxTypes.PersonalDetailsList>;
Expand Down Expand Up @@ -323,6 +324,7 @@ function submitSkipConfirmationExpense(args: SubmitAmountArgs, ctx: SubmitAmount
action,
currentUserPersonalDetails,
isTrackIntentUser,
formatPhoneNumber,
getCurrencyDecimals,
} = args;
const {currentUserAccountID, currentUserEmail, existingTransactionID, isASAPSubmitBetaEnabled, newAmount: backendAmount} = ctx;
Expand Down Expand Up @@ -410,6 +412,7 @@ function submitSkipConfirmationExpense(args: SubmitAmountArgs, ctx: SubmitAmount
optimisticTransactionID,
delegateAccountID,
isTrackIntentUser,
formatPhoneNumber,
getCurrencyDecimals,
});
}
Expand Down
2 changes: 2 additions & 0 deletions src/libs/actions/IOU/Duplicate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,7 @@ function duplicateExpenseTransaction({
shouldDeferAutoSubmit,
isTrackIntentUser,
delegateAccountID,
formatPhoneNumber,
getCurrencyDecimals,
};

Expand Down Expand Up @@ -1108,6 +1109,7 @@ function duplicateReport({
shouldDeferAutoSubmit: !isLastExpense,
isTrackIntentUser,
delegateAccountID,
formatPhoneNumber,
getCurrencyDecimals,
};

Expand Down
3 changes: 3 additions & 0 deletions src/libs/actions/IOU/MoneyRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ type CreateTransactionParams = {
currentUserLocalCurrency: string | undefined;
isTrackIntentUser: boolean | undefined;
delegateAccountID: number | undefined;
formatPhoneNumber: LocaleContextProps['formatPhoneNumber'];
getCurrencyDecimals: CurrencyListActionsContextType['getCurrencyDecimals'];
};

Expand Down Expand Up @@ -146,6 +147,7 @@ function createTransaction({
currentUserLocalCurrency,
isTrackIntentUser,
delegateAccountID,
formatPhoneNumber,
getCurrencyDecimals,
}: CreateTransactionParams) {
const draftTransactionIDs = Object.keys(allTransactionDrafts ?? {});
Expand Down Expand Up @@ -256,6 +258,7 @@ function createTransaction({
optimisticTransactionID,
isTrackIntentUser,
delegateAccountID,
formatPhoneNumber,
getCurrencyDecimals,
});
}
Expand Down
6 changes: 5 additions & 1 deletion src/libs/actions/IOU/MoneyRequestBuilder.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import type {LocaleContextProps} from '@components/LocaleContextProvider';

import type {CurrencyListActionsContextType} from '@hooks/useCurrencyList';

import DateUtils from '@libs/DateUtils';
import {getMicroSecondOnyxErrorObject, getMicroSecondOnyxErrorWithTranslationKey} from '@libs/ErrorUtils';
import {isLocalFile} from '@libs/fileDownload/FileUtils';
import type {MinimalTransaction} from '@libs/Formula';
import {updateIOUOwnerAndTotal} from '@libs/IOUUtils';
import {formatPhoneNumber} from '@libs/LocalePhoneNumber';
import {translateLocal} from '@libs/Localize';
import {buildOptimisticNextStep} from '@libs/NextStepUtils';
import {rand64} from '@libs/NumberUtils';
Expand Down Expand Up @@ -196,6 +197,7 @@ type RequestMoneyInformation = {
shouldDeferAutoSubmit?: boolean;
delegateAccountID: number | undefined;
isTrackIntentUser: boolean | undefined;
formatPhoneNumber: LocaleContextProps['formatPhoneNumber'];
getCurrencyDecimals: CurrencyListActionsContextType['getCurrencyDecimals'];
};

Expand Down Expand Up @@ -232,6 +234,7 @@ type MoneyRequestInformationParams = {
personalDetails: OnyxEntry<OnyxTypes.PersonalDetailsList>;
isTrackIntentUser: boolean | undefined;
delegateAccountID: number | undefined;
formatPhoneNumber: LocaleContextProps['formatPhoneNumber'];
getCurrencyDecimals: CurrencyListActionsContextType['getCurrencyDecimals'];
};

Expand Down Expand Up @@ -1285,6 +1288,7 @@ function getMoneyRequestInformation(moneyRequestInformation: MoneyRequestInforma
betas,
delegateAccountID,
isTrackIntentUser,
formatPhoneNumber,
getCurrencyDecimals,
} = moneyRequestInformation;
const {payeeAccountID = currentUserAccountIDParam, payeeEmail = currentUserEmailParam, participant} = participantParams;
Expand Down
1 change: 1 addition & 0 deletions src/libs/actions/IOU/Split.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2229,6 +2229,7 @@ function createDistanceRequest(distanceRequestInformation: CreateDistanceRequest
delegateAccountID,
isTrackIntentUser,
optimisticChatReportID,
formatPhoneNumber,
getCurrencyDecimals,
});

Expand Down
5 changes: 5 additions & 0 deletions src/libs/actions/IOU/SplitTransactionUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type {LocaleContextProps} from '@components/LocaleContextProvider';
import type {SearchActionsContextValue, SearchStateContextValue} from '@components/Search/types';

import type {CurrencyListActionsContextType} from '@hooks/useCurrencyList';
Expand Down Expand Up @@ -121,6 +122,7 @@ type UpdateSplitTransactionsParams = {
isOffline: boolean;
delegateAccountID: number | undefined;
isTrackIntentUser: boolean | undefined;
formatPhoneNumber: LocaleContextProps['formatPhoneNumber'];
getCurrencyDecimals: CurrencyListActionsContextType['getCurrencyDecimals'];
};

Expand Down Expand Up @@ -203,6 +205,7 @@ function updateSplitTransactions({
isOffline,
delegateAccountID,
isTrackIntentUser,
formatPhoneNumber,
getCurrencyDecimals,
}: UpdateSplitTransactionsParams) {
const parentTransactionReport = getReportOrDraftReport(transactionReport?.parentReportID);
Expand Down Expand Up @@ -666,6 +669,7 @@ function updateSplitTransactions({
personalDetails,
delegateAccountID,
isTrackIntentUser,
formatPhoneNumber,
getCurrencyDecimals,
} as MoneyRequestInformationParams;

Expand Down Expand Up @@ -781,6 +785,7 @@ function updateSplitTransactions({
personalDetails,
delegateAccountID,
isTrackIntentUser,
formatPhoneNumber,
getCurrencyDecimals,
});

Expand Down
7 changes: 7 additions & 0 deletions src/libs/actions/IOU/TrackExpense.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import ReceiptGeneric from '@assets/images/receipt-generic.png';

import type {LocaleContextProps} from '@components/LocaleContextProvider';

import type {CurrencyListActionsContextType} from '@hooks/useCurrencyList';

import * as API from '@libs/API';
Expand Down Expand Up @@ -1666,6 +1668,7 @@ function requestMoney(requestMoneyInformation: RequestMoneyInformation): {iouRep
shouldDeferAutoSubmit,
delegateAccountID,
isTrackIntentUser,
formatPhoneNumber,
getCurrencyDecimals,
} = requestMoneyInformation;
const {payeeAccountID} = participantParams;
Expand Down Expand Up @@ -1777,6 +1780,7 @@ function requestMoney(requestMoneyInformation: RequestMoneyInformation): {iouRep
personalDetails,
delegateAccountID,
isTrackIntentUser,
formatPhoneNumber,
getCurrencyDecimals,
});
const activeReportID = isMoneyRequestReport ? report?.reportID : chatReport.reportID;
Expand Down Expand Up @@ -1973,6 +1977,7 @@ function convertBulkTrackedExpensesToIOU({
selfDMReportActions,
delegateAccountID,
isTrackIntentUser,
formatPhoneNumber,
getCurrencyDecimals,
}: {
transactions: OnyxTypes.Transaction[];
Expand All @@ -1990,6 +1995,7 @@ function convertBulkTrackedExpensesToIOU({
selfDMReportActions: OnyxEntry<OnyxTypes.ReportActions>;
delegateAccountID: number | undefined;
isTrackIntentUser: boolean | undefined;
formatPhoneNumber: LocaleContextProps['formatPhoneNumber'];
getCurrencyDecimals: CurrencyListActionsContextType['getCurrencyDecimals'];
}) {
const iouReportID = iouReport?.reportID;
Expand Down Expand Up @@ -2111,6 +2117,7 @@ function convertBulkTrackedExpensesToIOU({
},
delegateAccountID,
isTrackIntentUser,
formatPhoneNumber,
getCurrencyDecimals,
});

Expand Down
3 changes: 2 additions & 1 deletion src/pages/Share/SubmitDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function SubmitDetailsPage({
},
}: ShareDetailsPageProps) {
const styles = useThemeStyles();
const {translate, dateFnsLocale} = useLocalize();
const {translate, dateFnsLocale, formatPhoneNumber} = useLocalize();
const {getCurrencyDecimals} = useCurrencyListActions();
const delegateAccountID = useDelegateAccountID();
const [unknownUserDetails] = useOnyx(ONYXKEYS.SHARE_UNKNOWN_USER_DETAILS);
Expand Down Expand Up @@ -457,6 +457,7 @@ function SubmitDetailsPage({
optimisticTransactionID,
isTrackIntentUser,
delegateAccountID,
formatPhoneNumber,
optimisticChatReportID: routeReportID,
});
}
Expand Down
3 changes: 2 additions & 1 deletion src/pages/iou/SplitExpensePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const TAB_NAVIGATOR_HEIGHT_LANDSCAPE = variables.tabSelectorButtonHeight + varia

function SplitExpensePage({route}: SplitExpensePageProps) {
const styles = useThemeStyles();
const {translate, dateFnsLocale} = useLocalize();
const {translate, dateFnsLocale, formatPhoneNumber} = useLocalize();
const delegateAccountID = useDelegateAccountID();

const {reportID, transactionID, splitExpenseTransactionID, backTo} = route.params;
Expand Down Expand Up @@ -400,6 +400,7 @@ function SplitExpensePage({route}: SplitExpensePageProps) {
isOffline,
delegateAccountID,
isTrackIntentUser,
formatPhoneNumber,
});
};

Expand Down
3 changes: 2 additions & 1 deletion src/pages/iou/request/step/IOURequestStepAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function IOURequestStepAmount({
transaction,
shouldKeepUserInput = false,
}: IOURequestStepAmountProps) {
const {translate, dateFnsLocale} = useLocalize();
const {translate, dateFnsLocale, formatPhoneNumber} = useLocalize();
const {getCurrencyDecimals} = useCurrencyListActions();
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const [isCurrencyPickerVisible, setIsCurrencyPickerVisible] = useState(false);
Expand Down Expand Up @@ -246,6 +246,7 @@ function IOURequestStepAmount({
navigateBack: saveAndNavigateBack,
amount,
paymentMethod,
formatPhoneNumber,
isTrackIntentUser,
policyTags,
reportPolicyTags,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ function ScanSkipConfirmation({report, action, iouType, reportID, transactionID,
currentUserLocalCurrency: currentUserPersonalDetails.localCurrencyCode ?? CONST.CURRENCY.USD,
isTrackIntentUser,
delegateAccountID,
formatPhoneNumber,
};

const scanDestinationReportID = iouType === CONST.IOU.TYPE.TRACK ? (report?.reportID ?? selfDMReport?.reportID) : report?.reportID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ function useExpenseSubmission(params: UseExpenseSubmissionParams) {
personalDetails,
isTrackIntentUser,
delegateAccountID,
formatPhoneNumber,
});
existingIOUReport = iouReport;
if (!iouReport) {
Expand Down
40 changes: 39 additions & 1 deletion tests/actions/IOU/BuildOnyxDataForMoneyRequestTest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {buildOnyxDataForMoneyRequest} from '@libs/actions/IOU/MoneyRequestBuilder';
import {buildOnyxDataForMoneyRequest, getMoneyRequestInformation} from '@libs/actions/IOU/MoneyRequestBuilder';
import {getOriginalMessage} from '@libs/ReportActionsUtils';
import type {OptimisticCreatedReportAction, OptimisticIOUReportAction} from '@libs/ReportUtils';

Expand Down Expand Up @@ -480,4 +480,42 @@ describe('buildOnyxDataForMoneyRequest', () => {
expect((chatReportEntry?.value as Partial<Report>)?.iouReportID).toBeUndefined();
});
});

it('uses the injected formatter for optimistic new-chat personal detail display name', () => {
const mockFormatPhoneNumber = jest.fn((phoneNumber: string) => `formatted:${phoneNumber}`);
const result = getMoneyRequestInformation({
getCurrencyDecimals: getCurrencyDecimalsLocal,
parentChatReport: undefined,
participantParams: {
payeeAccountID: CURRENT_USER_ACCOUNT_ID,
payeeEmail: CURRENT_USER_EMAIL,
participant: {
accountID: PAYER_ACCOUNT_ID,
login: '+15551234567',
},
},
transactionParams: {
amount: 1000,
currency: CONST.CURRENCY.USD,
created: '2024-01-01',
merchant: 'Test Merchant',
},
betas: [],
isASAPSubmitBetaEnabled: false,
currentUserAccountIDParam: CURRENT_USER_ACCOUNT_ID,
currentUserEmailParam: CURRENT_USER_EMAIL,
transactionViolations: {},
quickAction: undefined,
policyRecentlyUsedCurrencies: [],
personalDetails: {},
delegateAccountID: undefined,
isTrackIntentUser: false,
formatPhoneNumber: mockFormatPhoneNumber,
});

const personalDetailsEntry = result.onyxData.optimisticData?.find((entry) => entry.key === ONYXKEYS.PERSONAL_DETAILS_LIST);

expect(mockFormatPhoneNumber).toHaveBeenCalledWith('+15551234567');
expect((personalDetailsEntry?.value as Record<number, {displayName: string}>)?.[PAYER_ACCOUNT_ID]?.displayName).toBe('formatted:+15551234567');
});
});
3 changes: 2 additions & 1 deletion tests/actions/IOU/GetMoneyRequestInformationTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {Beta, PolicyTagLists, Report, Transaction} from '@src/types/onyx';

import Onyx from 'react-native-onyx';

import {getCurrencyDecimalsLocal} from '../../utils/TestHelper';
import {formatPhoneNumber, getCurrencyDecimalsLocal} from '../../utils/TestHelper';
import waitForBatchedUpdates from '../../utils/waitForBatchedUpdates';

jest.mock('@src/libs/Navigation/Navigation', () => ({
Expand Down Expand Up @@ -71,6 +71,7 @@ const baseParams = {
personalDetails: {},
delegateAccountID: undefined,
isTrackIntentUser: false,
formatPhoneNumber,
} as const;

describe('getMoneyRequestInformation', () => {
Expand Down
Loading
Loading