Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3567279
Select stable Concierge report fields in report action screens
LukasMod Oct 16, 2026
6786605
Read Concierge chat with Onyx.get in report action scroll hooks
LukasMod Oct 28, 2026
d60119d
Read openReport inputs with Onyx.get at the call sites
LukasMod Oct 29, 2026
8f9e22c
Read Pay handler inputs with Onyx.multiGet and pass async row handler…
LukasMod Oct 29, 2026
2a1d645
Move handler-only payment context fields to Onyx.multiGet
LukasMod Oct 30, 2026
6641814
Remove self-explanatory comments
LukasMod Oct 30, 2026
3b9a6a5
Await async pay handlers in PayActionButton and PayActionCell tests
LukasMod Oct 30, 2026
2f4a13d
Check the Search submit popover guard before the async Onyx reads
LukasMod Oct 30, 2026
18a5520
Add Explain press test and usePaymentContext hook test
LukasMod Oct 30, 2026
bb793f7
Read the Concierge chat on press in the Search page and report preview
LukasMod Nov 1, 2026
e92e77a
Share the press-time Search reads and accept async pay handlers in Se…
LukasMod Nov 2, 2026
6eebf13
Format the Search row readers and stop exporting SearchActionInputs
LukasMod Nov 2, 2026
77fe288
Type the payment context mock and read the bulk pay inputs before the…
LukasMod Nov 2, 2026
60d9a7e
Merge remote-tracking branch 'upstream/main' into LukasMod/investigat…
LukasMod Nov 2, 2026
3deba71
Remove the onSelectRow wrapper comment
LukasMod Nov 2, 2026
841cd3c
Drop the early preventDefault on the Search new-tab thread press
LukasMod Nov 2, 2026
64f515d
Merge remote-tracking branch 'upstream/main' into LukasMod/investigat…
LukasMod Nov 2, 2026
4882a44
Merge remote-tracking branch 'origin/main' into LukasMod/investigate-…
LukasMod Nov 3, 2026
828576c
Silence the deprecated originalMessage read in the Explain press test
LukasMod Nov 3, 2026
0aac6aa
Keep the resume callback void-returning in verify-account callers
LukasMod Nov 3, 2026
e3f7b64
Merge remote-tracking branch 'origin/main' into LukasMod/investigate-…
LukasMod Nov 3, 2026
989bd52
Move the Search row press steps into useSearchActionPressInputs and r…
LukasMod Nov 3, 2026
23895a5
Rename the Search row press hook to useSearchActionPress
LukasMod Nov 3, 2026
dc7ea27
Narrow hasSeenTourSelector to boolean and drop the dead false fallbacks
LukasMod Nov 3, 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
2 changes: 1 addition & 1 deletion src/components/KYCWall/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ type KYCWallProps = {
shouldShowPersonalBankAccountOption?: boolean;

/** Callback for the end of the onContinue trigger on option selection */
onSuccessfulKYC: (iouPaymentType?: PaymentMethodType, currentSource?: Source) => void;
onSuccessfulKYC: (iouPaymentType?: PaymentMethodType, currentSource?: Source) => void | Promise<void>;

/** Children to build the KYC */
children: (continueAction: (params?: ContinueActionParams) => void, anchorRef: RefObject<ComponentRef<typeof View> | null>) => void;
Expand Down
111 changes: 61 additions & 50 deletions src/components/MoneyReportHeaderPrimaryAction/PayPrimaryAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import type {Transaction} from '@src/types/onyx';

import {hasSeenTourSelector} from '@selectors/Onboarding';
import React from 'react';
import Onyx from 'react-native-onyx';

import useTransactionThreadData from './useTransactionThreadData';

Expand All @@ -63,15 +64,7 @@ function PayPrimaryAction({reportID, chatReportID, isDisabled}: PayPrimaryAction

const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${getNonEmptyStringOnyxID(moneyRequestReport?.policyID)}`);
const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST);
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
const [isSelfTourViewed = false] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: hasSeenTourSelector});
const [userBillingGracePeriodEnds] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END);
const [amountOwed] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED);
const [ownerBillingGracePeriodEnd] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END);
const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID);
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const [conciergeChat] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${conciergeReportID}`);
const [rules] = useOnyx(ONYXKEYS.COLLECTION.RULE);

const activePolicy = usePolicy(activePolicyID);
const chatReportPolicy = usePolicy(chatReport?.policyID);
Expand All @@ -81,7 +74,6 @@ function PayPrimaryAction({reportID, chatReportID, isDisabled}: PayPrimaryAction
const existingB2BInvoiceReport = useParticipantsInvoiceReport(activePolicyID, CONST.REPORT.INVOICE_RECEIVER_TYPE.BUSINESS, chatReport?.policyID);
const getChatReportActions = usePayChatReportActions(chatReport, existingB2BInvoiceReport);
const {getCurrencyDecimals, convertToDisplayString} = useCurrencyListActions();
const isTrackIntentUser = isTrackOnboardingChoice(introSelected?.choice);

const isInvoiceReport = isInvoiceReportUtil(moneyRequestReport);

Expand Down Expand Up @@ -127,20 +119,38 @@ function PayPrimaryAction({reportID, chatReportID, isDisabled}: PayPrimaryAction

const {openHoldMenu} = useMoneyReportHeaderModals();

const confirmPayment = ({paymentType: type, payAsBusiness, methodID, paymentMethod}: PaymentActionParams) => {
const runPayment = async ({paymentType: type, payAsBusiness, methodID, paymentMethod}: PaymentActionParams) => {
if (!type || !chatReport) {
return;
}
if (isDelegateAccessRestricted) {
showDelegateNoAccessModal();
} else if (isAnyTransactionOnHold) {
return;
}
if (isAnyTransactionOnHold) {
openHoldMenu({
requestType: CONST.IOU.REPORT_ACTION_TYPE.PAY,
paymentType: type,
methodID,
onConfirm: () => startAnimation(),
});
} else if (isInvoiceReport) {
return;
}

const [conciergeReportID, introSelected, onboarding, rules, userBillingGracePeriodEnds, amountOwed, ownerBillingGracePeriodEnd] = await Onyx.multiGet([
ONYXKEYS.CONCIERGE_REPORT_ID,
ONYXKEYS.NVP_INTRO_SELECTED,
ONYXKEYS.NVP_ONBOARDING,
ONYXKEYS.COLLECTION.RULE,
ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END,
ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED,
ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END,
]);
const conciergeChat = await Onyx.get(`${ONYXKEYS.COLLECTION.REPORT}${conciergeReportID}`);
const isSelfTourViewed = hasSeenTourSelector(onboarding);
const isTrackIntentUser = isTrackOnboardingChoice(introSelected?.choice);

if (isInvoiceReport) {
startAnimation();
payInvoice({
bankAccountList,
Expand All @@ -167,44 +177,45 @@ function PayPrimaryAction({reportID, chatReportID, isDisabled}: PayPrimaryAction
isTrackIntentUser,
rules,
});
} else {
payMoneyRequest({
bankAccountList,
isASAPSubmitBetaEnabled: isBetaEnabled(CONST.BETAS.ASAP_SUBMIT),
getCurrencyDecimals,
paymentType: type,
chatReport,
iouReport: moneyRequestReport,
iouReportTransactions: transactions,
introSelected,
currentUserAccountID: accountID,
currentUserLogin: currentUserLogin ?? '',
activePolicy,
policy,
chatReportPolicy,
isSelfTourViewed,
userBillingGracePeriodEnds,
amountOwed,
ownerBillingGracePeriodEnd,
methodID: type === CONST.IOU.PAYMENT_TYPE.VBBA ? methodID : undefined,
isWiseReimbursementsBetaEnabled: isBetaEnabled(CONST.BETAS.WISE_REIMBURSEMENTS),
onPaid: startAnimation,
chatReportActions: getChatReportActions(false),
delegateAccountID,
isTrackIntentUser,
conciergeChat,
rules,
return;
}

payMoneyRequest({
bankAccountList,
isASAPSubmitBetaEnabled: isBetaEnabled(CONST.BETAS.ASAP_SUBMIT),
getCurrencyDecimals,
paymentType: type,
chatReport,
iouReport: moneyRequestReport,
iouReportTransactions: transactions,
introSelected,
currentUserAccountID: accountID,
currentUserLogin: currentUserLogin ?? '',
activePolicy,
policy,
chatReportPolicy,
isSelfTourViewed,
userBillingGracePeriodEnds,
amountOwed,
ownerBillingGracePeriodEnd,
methodID: type === CONST.IOU.PAYMENT_TYPE.VBBA ? methodID : undefined,
isWiseReimbursementsBetaEnabled: isBetaEnabled(CONST.BETAS.WISE_REIMBURSEMENTS),
onPaid: startAnimation,
chatReportActions: getChatReportActions(false),
delegateAccountID,
isTrackIntentUser,
conciergeChat,
rules,
});
if (currentSearchQueryJSON && !isOffline) {
search({
searchKey: currentSearchKey,
shouldCalculateTotals,
offset: 0,
queryJSON: currentSearchQueryJSON,
isLoading: !!currentSearchResults?.search?.isLoading,
shouldReturnTripRooms,
});
if (currentSearchQueryJSON && !isOffline) {
search({
searchKey: currentSearchKey,
shouldCalculateTotals,
offset: 0,
queryJSON: currentSearchQueryJSON,
isLoading: !!currentSearchResults?.search?.isLoading,
shouldReturnTripRooms,
});
}
}
};

Expand All @@ -222,7 +233,7 @@ function PayPrimaryAction({reportID, chatReportID, isDisabled}: PayPrimaryAction
policyID={moneyRequestReport?.policyID}
chatReportID={chatReport?.reportID}
iouReport={moneyRequestReport}
onPress={confirmPayment}
onPress={runPayment}
enablePaymentsRoute={ROUTES.ENABLE_PAYMENTS}
shouldHidePaymentOptions={!shouldShowPayButton}
isDisabled={(isOffline && !canAllowSettlement) || isDisabled}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ function MoneyRequestReportView({report, reportIDFromRoute, reportLoadingState,
const isAppLoadPending = useIsAppLoadPending();
const {reportPendingAction, reportErrors: allReportErrors} = getReportOfflinePendingActionAndErrors(report);
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(report?.chatReportID)}`);
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const [conciergeChat] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${conciergeReportID}`);

const {reportActions: unfilteredReportActions} = usePaginatedReportActions(reportID);

Expand Down Expand Up @@ -268,7 +266,6 @@ function MoneyRequestReportView({report, reportIDFromRoute, reportLoadingState,
<>
<ReportActionsList
reportID={report.reportID}
conciergeChat={conciergeChat}
onLayout={onLayout}
/>
<UserTypingEventListener report={report} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import type {PaymentMethodType} from '@src/types/onyx/OriginalMessage';

import {hasSeenTourSelector} from '@selectors/Onboarding';
import React from 'react';
import Onyx from 'react-native-onyx';

import {useReportPreviewActions, useReportPreviewActionState, useReportPreviewAnimationState, useReportPreviewData, useReportPreviewUIState} from './MoneyRequestReportPreviewContext';
import useReportPreviewActionButtonData from './useReportPreviewActionButtonData';
Expand All @@ -55,19 +56,11 @@ function PayActionButton() {
const {buttonMaxWidth} = useReportPreviewUIState();
const {reportPreviewAction, canIOUBePaid, onlyShowPayElsewhere, shouldShowPayButton} = useReportPreviewActionState();

const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST);
const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID);
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const [conciergeChat] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${conciergeReportID}`);
const activePolicy = usePolicy(activePolicyID);
const actionButtonData = useReportPreviewActionButtonData(iouReportID);
const {iouReport, policy, userBillingGracePeriodEnds, amountOwed, ownerBillingGracePeriodEnd} = actionButtonData;
const chatReportPolicy = usePolicy(chatReport?.policyID);
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
const [isSelfTourViewed] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: hasSeenTourSelector});
const [rules] = useOnyx(ONYXKEYS.COLLECTION.RULE);

const isTrackIntentUser = isTrackOnboardingChoice(introSelected?.choice);

const existingB2BInvoiceReport = useParticipantsInvoiceReport(activePolicyID, CONST.REPORT.INVOICE_RECEIVER_TYPE.BUSINESS, chatReport?.policyID);
const getChatReportActions = usePayChatReportActions(chatReport, existingB2BInvoiceReport);
Expand Down Expand Up @@ -96,7 +89,7 @@ function PayActionButton() {
});
};

const confirmPayment = ({paymentType: type, payAsBusiness, methodID, paymentMethod}: PaymentActionParams) => {
const runPayment = async ({paymentType: type, payAsBusiness, methodID, paymentMethod}: PaymentActionParams) => {
if (!type) {
return;
}
Expand All @@ -105,6 +98,16 @@ function PayActionButton() {
} else if (hasHeldExpensesReportUtils(transactions)) {
openHoldMenu(type, methodID);
} else if (chatReport && iouReport) {
const [conciergeReportID, introSelected, onboarding, rules, bankAccountList] = await Onyx.multiGet([
ONYXKEYS.CONCIERGE_REPORT_ID,
ONYXKEYS.NVP_INTRO_SELECTED,
ONYXKEYS.NVP_ONBOARDING,
ONYXKEYS.COLLECTION.RULE,
ONYXKEYS.BANK_ACCOUNT_LIST,
]);
const conciergeChat = await Onyx.get(`${ONYXKEYS.COLLECTION.REPORT}${conciergeReportID}`);
const isSelfTourViewed = hasSeenTourSelector(onboarding);
const isTrackIntentUser = isTrackOnboardingChoice(introSelected?.choice);
const currentChatReport = getReportOrDraftReport({reportID: chatReportID}) ?? chatReport;
if (isInvoiceReportUtils(iouReport)) {
startAnimation();
Expand Down Expand Up @@ -179,7 +182,7 @@ function PayActionButton() {
iouReport={iouReport}
currency={iouReport?.currency}
wrapperStyle={buttonMaxWidth}
onPress={confirmPayment}
onPress={runPayment}
onPaymentOptionsShow={onPaymentOptionsShow}
onPaymentOptionsHide={onPaymentOptionsHide}
formattedAmount={formattedAmount}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import {fullPolicySnapshotLastModifiedSelector} from '@src/selectors/Policy';
import {hasOnceLoadedReportActionsSelector, isLoadingInitialReportActionsSelector, pendingNewTransactionIDsSelector} from '@src/selectors/ReportMetaData';
import type {ReportAction, ReportActions, Transaction} from '@src/types/onyx';
import type {Report, ReportAction, ReportActions, Transaction} from '@src/types/onyx';

import type {ListRenderItem} from '@shopify/flash-list';
import type {LayoutChangeEvent} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';

import {useIsFocused} from '@react-navigation/core';
import React, {useEffect, useRef, useState} from 'react';
import Onyx from 'react-native-onyx';

import type {MoneyRequestReportPreviewProps} from './types';

Expand Down Expand Up @@ -83,8 +84,6 @@ function MoneyRequestReportPreview({
const personalDetailsList = usePersonalDetails();
const {email: currentUserEmail, accountID: currentUserAccountID} = useCurrentUserPersonalDetails();
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const [conciergeChat] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${conciergeReportID}`);
const invoiceReceiverPolicyID = chatReport?.invoiceReceiver && 'policyID' in chatReport.invoiceReceiver ? chatReport.invoiceReceiver.policyID : undefined;
const [invoiceReceiverPolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${getNonEmptyStringOnyxID(invoiceReceiverPolicyID)}`);
const invoiceReceiverPersonalDetail = chatReport?.invoiceReceiver && 'accountID' in chatReport.invoiceReceiver ? personalDetailsList?.[chatReport.invoiceReceiver.accountID] : null;
Expand All @@ -102,7 +101,7 @@ function MoneyRequestReportPreview({
const [hasIOUReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${getNonEmptyStringOnyxID(iouReportID)}`, {
selector: hasReportActionsSelector,
});
const pendingExpenseTransactionRef = useRef<{transaction: Transaction; originRoute: string} | null>(null);
const pendingExpenseTransactionRef = useRef<{transaction: Transaction; originRoute: string; conciergeChat: OnyxEntry<Report>} | null>(null);
// Subscribing to the whole action list re-rendered every card on each write, and a split writes a burst of
// them. Narrow it to the one action a deferred press is waiting for, so nothing pending means nothing changes.
const pendingPressActionCountSelector = (reportActions: OnyxEntry<ReportActions>) => {
Expand Down Expand Up @@ -223,7 +222,7 @@ function MoneyRequestReportPreview({

const transactionPreviewContainerStyles = [styles.h100, reportPreviewStyles.transactionPreviewCarouselStyle];

const resolveChildReportID = (transaction: Transaction) => {
const resolveChildReportID = (transaction: Transaction, conciergeChat: OnyxEntry<Report>) => {
let transactionIOUAction = getIOUActionForReportID(transaction.reportID, transaction.transactionID);
if (transactionIOUAction && !isLiveIOUAction(transactionIOUAction)) {
const liveIOUAction = getIOUActionForTransactionID(Object.values(getAllReportActions(transaction.reportID) ?? {}).filter(isLiveIOUAction), transaction.transactionID);
Expand Down Expand Up @@ -329,7 +328,7 @@ function MoneyRequestReportPreview({
});
};

const openTransactionFromPreview = (transaction: Transaction) => {
const openTransactionFromPreview = async (transaction: Transaction) => {
if (contextMenuRef.current?.isContextMenuOpening) {
return;
}
Expand All @@ -353,8 +352,11 @@ function MoneyRequestReportPreview({
return;
}

// Read once per press and carry it to the deferred continuation below, which runs in an effect and must not read Onyx itself
const conciergeReportID = await Onyx.get(ONYXKEYS.CONCIERGE_REPORT_ID);
const conciergeChat = await Onyx.get(`${ONYXKEYS.COLLECTION.REPORT}${conciergeReportID}`);
const isIOUActionLoaded = !!getIOUActionForReportID(transaction.reportID, transaction.transactionID);
const childReportID = resolveChildReportID(transaction);
const childReportID = resolveChildReportID(transaction, conciergeChat);
const fullPolicySnapshot = policyID && fullPolicySnapshotLastModified ? {policyID, lastModified: fullPolicySnapshotLastModified} : undefined;
if (childReportID) {
if (!isIOUActionLoaded && iouReportID) {
Expand All @@ -369,7 +371,7 @@ function MoneyRequestReportPreview({
}

if (!isIOUActionLoaded && iouReportID && !isOffline) {
pendingExpenseTransactionRef.current = {transaction, originRoute: routeAtPress};
pendingExpenseTransactionRef.current = {transaction, originRoute: routeAtPress, conciergeChat};
openReport({reportID: iouReportID, introSelected, conciergeChat, currentUserAccountID, hasReportActions: !!hasIOUReportActions, fullPolicySnapshot});
return;
}
Expand All @@ -387,7 +389,7 @@ function MoneyRequestReportPreview({
return;
}
const pendingTransaction = pendingPress.transaction;
const childReportID = resolveChildReportID(pendingTransaction);
const childReportID = resolveChildReportID(pendingTransaction, pendingPress.conciergeChat);
if (childReportID) {
pendingExpenseTransactionRef.current = null;
navigateToExpense(childReportID, pendingPress.originRoute);
Expand Down Expand Up @@ -426,7 +428,9 @@ function MoneyRequestReportPreview({
transactionPreviewWidth={reportPreviewStyles.transactionPreviewCarouselStyle.width}
transactionID={item.transactionID}
reportPreviewAction={action}
onPreviewPressed={() => openTransactionFromPreview(item)}
onPreviewPressed={() => {
openTransactionFromPreview(item);
}}
shouldShowPayerAndReceiver={shouldShowPayerAndReceiver}
shouldHighlight={!!newTransactionIDs?.has(item.transactionID)}
/>
Expand Down
Loading
Loading