Skip to content
Draft
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
bbc1155
Consolidate AgentZero status into a shared context provider
adhorodyski Mar 17, 2026
24d20dd
Split AgentZero context into state and actions providers
adhorodyski Mar 17, 2026
e152383
Merge remote-tracking branch 'exfy/main' into decompose/agent-zero-st…
adhorodyski Mar 18, 2026
7c1c53a
chore: trigger CI re-run after upstream merge
adhorodyski Mar 18, 2026
498a5bd
Use imported ReasoningEntry type instead of inline duplication
adhorodyski Mar 18, 2026
cd080bb
Suppress thinking bubble and typing indicator during side-panel welco…
adhorodyski Mar 18, 2026
ff6322c
Merge branch 'Expensify:main' into decompose/agent-zero-status-context
adhorodyski Mar 19, 2026
f21ad4a
Merge branch 'Expensify:main' into decompose/agent-zero-status-context
adhorodyski Mar 23, 2026
773377e
chore: fix inline def with getReportChannelName
adhorodyski Mar 23, 2026
a94cce1
Add documentation to AgentZeroStatusContext state and internals
adhorodyski Mar 23, 2026
192df9f
Move indicator suppression from context to self-subscribing consumer …
adhorodyski Mar 23, 2026
cf71724
fix: accept optional reportID in useShouldSuppressConciergeIndicators
adhorodyski Mar 23, 2026
819ef14
Make ReportActionsView self-subscribing via reportID
adhorodyski Mar 23, 2026
1b799f5
Move comment submission and task creation into ReportActionCompose
adhorodyski Mar 23, 2026
ddda5e7
Make ReportActionCompose self-subscribing via reportID
adhorodyski Mar 23, 2026
2356ac8
Make ReportFooter self-subscribing, move to inbox/ReportFooter.tsx
adhorodyski Mar 23, 2026
8f74d98
Update tests for self-subscribing ReportActionsView and ReportActionC…
adhorodyski Mar 23, 2026
f9218d2
Fix typecheck errors in ReportActionsViewTest mock return values
adhorodyski Mar 23, 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
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import useNewTransactions from '@hooks/useNewTransactions';
import useOnyx from '@hooks/useOnyx';
import usePaginatedReportActions from '@hooks/usePaginatedReportActions';
import useParentReportAction from '@hooks/useParentReportAction';
import useReportTransactionsCollection from '@hooks/useReportTransactionsCollection';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
Expand All @@ -25,15 +24,15 @@
import Log from '@libs/Log';
import {getAllNonDeletedTransactions, shouldDisplayReportTableView, shouldWaitForTransactions as shouldWaitForTransactionsUtil} from '@libs/MoneyRequestReportUtils';
import navigationRef from '@libs/Navigation/navigationRef';
import {getFilteredReportActionsForReportView, getOneTransactionThreadReportID, isMoneyRequestAction, isSentMoneyReportAction} from '@libs/ReportActionsUtils';
import {canEditReportAction, getReportOfflinePendingActionAndErrors, isReportTransactionThread} from '@libs/ReportUtils';
import {getFilteredReportActionsForReportView, getOneTransactionThreadReportID} from '@libs/ReportActionsUtils';
import {getReportOfflinePendingActionAndErrors, isReportTransactionThread} from '@libs/ReportUtils';
import {buildCannedSearchQuery} from '@libs/SearchQueryUtils';
import {cancelSpan} from '@libs/telemetry/activeSpans';
import markOpenReportEnd from '@libs/telemetry/markOpenReportEnd';
import type {SkeletonSpanReasonAttributes} from '@libs/telemetry/useSkeletonSpan';
import Navigation from '@navigation/Navigation';
import ReportActionsView from '@pages/inbox/report/ReportActionsView';
import ReportFooter from '@pages/inbox/report/ReportFooter';
import ReportFooter from '@pages/inbox/ReportFooter';
import CONST from '@src/CONST';
import NAVIGATORS from '@src/NAVIGATORS';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down Expand Up @@ -146,13 +145,8 @@
}, [transactions, isOffline]);
const reportTransactionIDs = visibleTransactions.map((transaction) => transaction.transactionID);
const transactionThreadReportID = getOneTransactionThreadReportID(report, chatReport, reportActions ?? [], isOffline, reportTransactionIDs);
const isSentMoneyReport = useMemo(() => reportActions.some((action) => isSentMoneyReportAction(action)), [reportActions]);

const newTransactions = useNewTransactions(reportMetadata?.hasOnceLoadedReportActions, transactions);

const parentReportAction = useParentReportAction(report);

const lastReportAction = [...reportActions, parentReportAction].find((action) => canEditReportAction(action) && !isMoneyRequestAction(action));
const isLoadingInitialReportActions = reportMetadata?.isLoadingInitialReportActions;
const dismissReportCreationError = useCallback(() => {
goBackFromSearchMoneyRequest();
Expand Down Expand Up @@ -246,14 +240,7 @@
<View style={styles.flex1}>
<ReportHeaderSkeletonView reasonAttributes={loadingAppReasonAttributes} />
<ReportActionsSkeletonView />
{shouldDisplayReportFooter ? (
<ReportFooter
report={report}
lastReportAction={lastReportAction}
// If the report is from the 'Send Money' flow, we add the comment to the `iou` report because for these we don't combine reportActions even if there is a single transaction (they always have a single transaction)
transactionThreadReportID={isSentMoneyReport ? undefined : transactionThreadReportID}
/>
) : null}
{shouldDisplayReportFooter ? <ReportFooter reportID={report?.reportID ?? ''} /> : null}

Check failure on line 243 in src/components/MoneyRequestReportView/MoneyRequestReportView.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Check failure on line 243 in src/components/MoneyRequestReportView/MoneyRequestReportView.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Check failure on line 243 in src/components/MoneyRequestReportView/MoneyRequestReportView.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Check failure on line 243 in src/components/MoneyRequestReportView/MoneyRequestReportView.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

</View>
);
}
Expand Down Expand Up @@ -307,25 +294,13 @@
/>
) : (
<ReportActionsView
report={report}
reportActions={reportActions}
isLoadingInitialReportActions={reportMetadata?.isLoadingInitialReportActions}
hasNewerActions={hasNewerActions}
hasOlderActions={hasOlderActions}
parentReportAction={parentReportAction}
reportID={reportID ?? ''}

Check failure on line 297 in src/components/MoneyRequestReportView/MoneyRequestReportView.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Check failure on line 297 in src/components/MoneyRequestReportView/MoneyRequestReportView.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Check failure on line 297 in src/components/MoneyRequestReportView/MoneyRequestReportView.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Check failure on line 297 in src/components/MoneyRequestReportView/MoneyRequestReportView.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

onLayout={onLayout}
transactionThreadReportID={transactionThreadReportID}
/>
)}
{shouldDisplayReportFooter ? (
<>
<ReportFooter
report={report}
lastReportAction={lastReportAction}
reportTransactions={transactions}
// If the report is from the 'Send Money' flow, we add the comment to the `iou` report because for these we don't combine reportActions even if there is a single transaction (they always have a single transaction)
transactionThreadReportID={isSentMoneyReport ? undefined : transactionThreadReportID}
/>
<ReportFooter reportID={report?.reportID ?? ''} />

Check failure on line 303 in src/components/MoneyRequestReportView/MoneyRequestReportView.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Check failure on line 303 in src/components/MoneyRequestReportView/MoneyRequestReportView.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Check failure on line 303 in src/components/MoneyRequestReportView/MoneyRequestReportView.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Check failure on line 303 in src/components/MoneyRequestReportView/MoneyRequestReportView.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

<PortalHost name="suggestions" />
</>
) : null}
Expand Down
164 changes: 0 additions & 164 deletions src/hooks/useAgentZeroStatusIndicator.ts

This file was deleted.

7 changes: 4 additions & 3 deletions src/hooks/useConciergeSidePanelReportActions.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import {useCallback, useMemo, useState} from 'react';
import type {OnyxEntry} from 'react-native-onyx';
import DateUtils from '@libs/DateUtils';
import {isCreatedAction} from '@libs/ReportActionsUtils';
import {buildConciergeGreetingReportAction} from '@libs/ReportUtils';
import type * as OnyxTypes from '@src/types/onyx';

type UseConciergeSidePanelReportActionsParams = {
report: OnyxTypes.Report;
report: OnyxEntry<OnyxTypes.Report>;
reportActions: OnyxTypes.ReportAction[];
visibleReportActions: OnyxTypes.ReportAction[];
isConciergeSidePanel: boolean;
Expand Down Expand Up @@ -76,8 +77,8 @@
if (!showConciergeGreeting) {
return undefined;
}
return buildConciergeGreetingReportAction(report.reportID, greetingText, report.lastReadTime ?? DateUtils.getDBTime());
}, [showConciergeGreeting, report.reportID, report.lastReadTime, greetingText]);
return buildConciergeGreetingReportAction(report?.reportID ?? '', greetingText, report?.lastReadTime ?? DateUtils.getDBTime());

Check failure on line 80 in src/hooks/useConciergeSidePanelReportActions.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Check failure on line 80 in src/hooks/useConciergeSidePanelReportActions.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Check failure on line 80 in src/hooks/useConciergeSidePanelReportActions.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Check failure on line 80 in src/hooks/useConciergeSidePanelReportActions.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

}, [showConciergeGreeting, report?.reportID, report?.lastReadTime, greetingText]);

const firstUserMessageCreated = useMemo(() => {
if (showConciergeSidePanelWelcome || !isConciergeSidePanel || !hasUserSentMessage || !sessionStartTime) {
Expand Down
36 changes: 36 additions & 0 deletions src/hooks/useShouldSuppressConciergeIndicators.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type {OnyxEntry} from 'react-native-onyx';
import {isCreatedAction} from '@libs/ReportActionsUtils';
import ONYXKEYS from '@src/ONYXKEYS';
import type {ReportActions} from '@src/types/onyx/ReportAction';
import useCurrentUserPersonalDetails from './useCurrentUserPersonalDetails';
import useIsInSidePanel from './useIsInSidePanel';
import useOnyx from './useOnyx';
import useSidePanelState from './useSidePanelState';

/**
* Returns true when thinking/typing indicators should be hidden in the side-panel
* welcome state — specifically for Concierge DMs before the user sends their first message.
*/
function useShouldSuppressConciergeIndicators(reportID: string | undefined): boolean {
const isInSidePanel = useIsInSidePanel();
const {sessionStartTime} = useSidePanelState();
const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails();
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);

const isConciergeChat = reportID === conciergeReportID;

const hasUserSentMessageSelector = (actions: OnyxEntry<ReportActions>) => {
if (!actions || !sessionStartTime) {
return false;
}
return Object.values(actions).some((action) => !isCreatedAction(action) && action.actorAccountID === currentUserAccountID && action.created >= sessionStartTime);
};
// eslint-disable-next-line rulesdir/no-inline-useOnyx-selector -- React Compiler handles memoization
const [hasUserSentMessage] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, {
selector: hasUserSentMessageSelector,
});

return isConciergeChat && isInSidePanel && !hasUserSentMessage;
}

export default useShouldSuppressConciergeIndicators;
Loading
Loading