Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
1286948
Hide the chat history when Concierge is opened up in the right hand p…
Krishna2323 Feb 8, 2026
e521788
Hide the chat history when Concierge is opened up in the right hand p…
Krishna2323 Feb 8, 2026
eed8e6a
minor updates.
Krishna2323 Feb 8, 2026
dad0a06
fix prettier.
Krishna2323 Feb 8, 2026
102d51c
add tests.
Krishna2323 Feb 8, 2026
81b087d
remove eslint-disable-next-line.
Krishna2323 Feb 8, 2026
3eee30b
hide status indicators.
Krishna2323 Feb 11, 2026
1fbd89b
fix prettier.
Krishna2323 Feb 11, 2026
7fd7a97
handle offline scenarios.
Krishna2323 Feb 11, 2026
0975dd4
Merge branch 'Expensify:main' into krishna2323/issue/81587
Krishna2323 Feb 13, 2026
60d90d1
Merge branch 'main' into krishna2323/issue/81587
Krishna2323 Feb 17, 2026
a12b77d
Merge branch 'Expensify:main' into krishna2323/issue/81587
Krishna2323 Feb 19, 2026
1ed1f3e
show created action after user adds comment.
Krishna2323 Feb 19, 2026
5a30653
update tests.
Krishna2323 Feb 19, 2026
d11109c
fix prettier.
Krishna2323 Feb 19, 2026
9532219
add icon.
Krishna2323 Feb 19, 2026
87c53be
address codex review comments.
Krishna2323 Feb 19, 2026
94e9163
remove ConciergeSidePanelWelcome.
Krishna2323 Feb 20, 2026
b155bc1
fix tests.
Krishna2323 Feb 20, 2026
b89ce01
add temporary action.
Krishna2323 Feb 20, 2026
fed3df5
Merge branch 'main' into krishna2323/issue/81587
Krishna2323 Feb 21, 2026
655510e
hide context menu for fake action.
Krishna2323 Feb 21, 2026
da72c6c
add useConciergeSidePanelReportActions hook.
Krishna2323 Feb 21, 2026
2364166
fix offline case.
Krishna2323 Feb 21, 2026
a09e808
fix tests.
Krishna2323 Feb 21, 2026
a64b2c9
Merge branch 'main' into krishna2323/issue/81587
Krishna2323 Feb 23, 2026
9971c97
show history for brand-new account.
Krishna2323 Feb 23, 2026
29ef491
Merge branch 'Expensify:main' into krishna2323/issue/81587
Krishna2323 Feb 23, 2026
1b49d19
Merge branch 'Expensify:main' into krishna2323/issue/81587
Krishna2323 Feb 24, 2026
b6db3ce
Merge branch 'Expensify:main' into krishna2323/issue/81587
Krishna2323 Feb 24, 2026
85a33df
add translations.
Krishna2323 Feb 24, 2026
a428769
Merge branch 'main' into krishna2323/issue/81587
Krishna2323 Feb 25, 2026
52bf372
fix created header not shown.
Krishna2323 Feb 25, 2026
7a6e932
udpate tests.
Krishna2323 Feb 25, 2026
1cede40
Merge branch 'main' into krishna2323/issue/81587
Krishna2323 Feb 26, 2026
ef6bc7e
fix ESLint.
Krishna2323 Feb 26, 2026
130905c
fix hide history condition.
Krishna2323 Feb 26, 2026
f87f1dd
Merge branch 'main' into krishna2323/issue/81587
Krishna2323 Feb 26, 2026
68756ae
Add missing import.
Krishna2323 Feb 26, 2026
6aed048
fix old messages not hidden.
Krishna2323 Feb 26, 2026
a38e1a6
fix ESLint.
Krishna2323 Feb 26, 2026
8dece91
Refactor session start time tracking into SidePanelContextProvider
Krishna2323 Feb 27, 2026
7425d32
Merge branch 'main' into krishna2323/issue/81587
Krishna2323 Feb 27, 2026
efab4a6
fix showFullHistory state.
Krishna2323 Feb 27, 2026
0533bee
Merge branch 'main' into krishna2323/issue/81587
Krishna2323 Feb 27, 2026
bde223a
fix history visible.
Krishna2323 Feb 27, 2026
f2dbefd
Merge branch 'main' into krishna2323/issue/81587
Krishna2323 Feb 28, 2026
399fc6f
fix hadUserMessageAtSessionStart condition.
Krishna2323 Mar 3, 2026
d581b12
Merge branch 'main' into krishna2323/issue/81587
Krishna2323 Mar 4, 2026
53bc6bd
Show skeleton in Concierge side panel until report data is loaded
Krishna2323 Mar 4, 2026
8c3a0e9
fix tests.
Krishna2323 Mar 4, 2026
a5d66d6
Merge branch 'main' into krishna2323/issue/81587
Krishna2323 Mar 6, 2026
7d0b4c6
Merge branch 'main' into krishna2323/issue/81587
Krishna2323 Mar 9, 2026
e478675
Merge branch 'main' into krishna2323/issue/81587
Krishna2323 Mar 10, 2026
4c97a01
Merge remote-tracking branch 'origin/main' into krishna2323/issue/81587
Krishna2323 Mar 11, 2026
202c8d8
Merge upstream/main and resolve conflict in ReportActionsList.tsx
Krishna2323 Mar 11, 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
1 change: 1 addition & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2413,6 +2413,7 @@ const CONST = {
},

CONCIERGE_DISPLAY_NAME: 'Concierge',
CONCIERGE_GREETING_ACTION_ID: 'concierge-side-panel-greeting',

INTEGRATION_ENTITY_MAP_TYPES: {
DEFAULT: 'DEFAULT',
Expand Down
14 changes: 14 additions & 0 deletions src/components/SidePanel/SidePanelContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useSidePanelDisplayStatus from '@hooks/useSidePanelDisplayStatus';
import useWindowDimensions from '@hooks/useWindowDimensions';
import SidePanelActions from '@libs/actions/SidePanel';
import DateUtils from '@libs/DateUtils';
import focusComposerWithDelay from '@libs/focusComposerWithDelay';
import {isPolicyAdmin, shouldShowPolicy} from '@libs/PolicyUtils';
import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager';
Expand All @@ -28,6 +29,7 @@ type SidePanelStateContextProps = {
sidePanelTranslateX: RefObject<Animated.Value>;
sidePanelNVP?: SidePanel;
reportID?: string;
sessionStartTime: string | null;
};

type SidePanelActionsContextProps = {
Expand All @@ -44,6 +46,7 @@ const SidePanelStateContext = createContext<SidePanelStateContextProps>({
shouldHideToolTip: false,
sidePanelOffset: {current: new Animated.Value(0)},
sidePanelTranslateX: {current: new Animated.Value(0)},
sessionStartTime: null,
});

const SidePanelActionsContext = createContext<SidePanelActionsContextProps>({
Expand Down Expand Up @@ -83,6 +86,16 @@ function SidePanelContextProvider({children}: PropsWithChildren) {

const reportID = isRHPAdminsRoom && isUserAdmin && isPolicyActive && adminsChatReportID ? adminsChatReportID : conciergeReportID;

const [sessionStartTime, setSessionStartTime] = useState<string | null>(null);
const [prevShouldHideSidePanel, setPrevShouldHideSidePanel] = useState(shouldHideSidePanel);

if (prevShouldHideSidePanel !== shouldHideSidePanel) {
setPrevShouldHideSidePanel(shouldHideSidePanel);
if (!shouldHideSidePanel) {
setSessionStartTime(DateUtils.getDBTime());
}
}

useEffect(() => {
sidePanelWidthRef.current = sidePanelWidth;
}, [sidePanelWidth]);
Expand Down Expand Up @@ -133,6 +146,7 @@ function SidePanelContextProvider({children}: PropsWithChildren) {
sidePanelTranslateX,
sidePanelNVP,
reportID,
sessionStartTime,
};

// Because of the React Compiler we don't need to memoize it manually
Expand Down
150 changes: 150 additions & 0 deletions src/hooks/useConciergeSidePanelReportActions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
import {useCallback, useMemo, useState} from 'react';
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;
reportActions: OnyxTypes.ReportAction[];
visibleReportActions: OnyxTypes.ReportAction[];
isConciergeSidePanel: boolean;
hasUserSentMessage: boolean;
hasOlderActions: boolean;
sessionStartTime: string | null;
currentUserAccountID: number;
greetingText: string;
loadOlderChats: (force?: boolean) => void;
};

function useConciergeSidePanelReportActions({
report,
reportActions,
visibleReportActions,
isConciergeSidePanel,
hasUserSentMessage,
hasOlderActions,
sessionStartTime,
currentUserAccountID,
greetingText,
loadOlderChats,
}: UseConciergeSidePanelReportActionsParams) {
const [showFullHistory, setShowFullHistory] = useState(false);
const [prevSessionStartTime, setPrevSessionStartTime] = useState(sessionStartTime);
const [prevHasUserSentMessage, setPrevHasUserSentMessage] = useState(hasUserSentMessage);

if (prevSessionStartTime !== sessionStartTime) {
setPrevSessionStartTime(sessionStartTime);
setShowFullHistory(false);
} else if (prevHasUserSentMessage && !hasUserSentMessage) {
setPrevHasUserSentMessage(hasUserSentMessage);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just false.

setShowFullHistory(false);
} else if (prevHasUserSentMessage !== hasUserSentMessage) {
setPrevHasUserSentMessage(hasUserSentMessage);
}

// Check if the user had sent any message BEFORE this session started.
// Uses sessionStartTime as the boundary — any user message created before the
// panel opened is a pre-session message, regardless of when it was loaded.
//
// When no user message is found in the loaded set, hasOlderActions indicates
// whether there is unloaded history. On a new account all onboarding messages
// fit in a single page (hasOlderActions=false). On an existing account with
// prior interactions the history spans multiple pages (hasOlderActions=true).
//

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB

Suggested change
//

const hadUserMessageAtSessionStart = useMemo(() => {
if (!isConciergeSidePanel || !sessionStartTime) {
return false;
}
const hasUserMessageInLoadedSet = visibleReportActions.some(
(action) => !isCreatedAction(action) && action.actorAccountID === currentUserAccountID && action.created < sessionStartTime,
);
return hasUserMessageInLoadedSet || hasOlderActions;
}, [isConciergeSidePanel, visibleReportActions, currentUserAccountID, sessionStartTime, hasOlderActions]);

const hasPreviousMessages = useMemo(() => {
if (!isConciergeSidePanel || !hadUserMessageAtSessionStart || !sessionStartTime) {
return false;
}
return visibleReportActions.some((action) => !isCreatedAction(action) && action.created < sessionStartTime);
}, [isConciergeSidePanel, visibleReportActions, sessionStartTime, hadUserMessageAtSessionStart]);

const showConciergeSidePanelWelcome = isConciergeSidePanel && hadUserMessageAtSessionStart && !hasUserSentMessage && !showFullHistory;
const showConciergeGreeting = isConciergeSidePanel && hadUserMessageAtSessionStart && !showFullHistory;

const conciergeGreetingAction = useMemo(() => {
if (!showConciergeGreeting) {
return undefined;
}
return buildConciergeGreetingReportAction(report.reportID, greetingText, report.lastReadTime ?? DateUtils.getDBTime());
}, [showConciergeGreeting, report.reportID, report.lastReadTime, greetingText]);

const firstUserMessageCreated = useMemo(() => {
if (showConciergeSidePanelWelcome || !isConciergeSidePanel || !hasUserSentMessage || !sessionStartTime) {
return undefined;
}
return reportActions.reduce<string | undefined>((earliest, action) => {
if (isCreatedAction(action) || action.created < sessionStartTime || action.actorAccountID !== currentUserAccountID) {
return earliest;
}
return !earliest || action.created < earliest ? action.created : earliest;
}, undefined);
}, [showConciergeSidePanelWelcome, isConciergeSidePanel, hasUserSentMessage, sessionStartTime, reportActions, currentUserAccountID]);

const isCurrentSessionAction = useCallback(
(action: OnyxTypes.ReportAction): boolean => {
if (!firstUserMessageCreated || !sessionStartTime) {
return false;
}
return isCreatedAction(action) || (action.created >= sessionStartTime && action.created >= firstUserMessageCreated);
},
[firstUserMessageCreated, sessionStartTime],
);

const filterActions = useCallback(
(actions: OnyxTypes.ReportAction[]): OnyxTypes.ReportAction[] => {
if (showConciergeSidePanelWelcome && conciergeGreetingAction) {
const createdAction = actions.find(isCreatedAction);
return createdAction ? [conciergeGreetingAction, createdAction] : [conciergeGreetingAction];
}
if (!isConciergeSidePanel || showFullHistory) {
return actions;
}
if (!sessionStartTime) {
return actions.filter(isCreatedAction);
}
if (!hadUserMessageAtSessionStart) {
return actions;
}
const filtered = actions.filter(isCurrentSessionAction);
if (filtered.length === 0) {
return actions;
}
if (conciergeGreetingAction) {
const createdIndex = filtered.findIndex(isCreatedAction);
filtered.splice(createdIndex === -1 ? filtered.length : createdIndex, 0, conciergeGreetingAction);
}
return filtered;
},
[showConciergeSidePanelWelcome, conciergeGreetingAction, isConciergeSidePanel, showFullHistory, sessionStartTime, isCurrentSessionAction, hadUserMessageAtSessionStart],
);

const filteredVisibleActions = useMemo(() => filterActions(visibleReportActions), [filterActions, visibleReportActions]);
const filteredReportActions = useMemo(() => filterActions(reportActions), [filterActions, reportActions]);

const handleShowPreviousMessages = useCallback(() => {
setShowFullHistory(true);
loadOlderChats(true);
}, [loadOlderChats]);

return {
filteredVisibleActions,
filteredReportActions,
showConciergeSidePanelWelcome,
showFullHistory,
hasPreviousMessages,
handleShowPreviousMessages,
};
}

export default useConciergeSidePanelReportActions;
1 change: 1 addition & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ const translations: TranslationDeepObject<typeof en> = {
quarter: 'Quartal',
vacationDelegate: 'Urlaubsvertretung',
expensifyLogo: 'Expensify-Logo',
concierge: {sidePanelGreeting: 'Hallo, wie kann ich helfen?', showHistory: 'Verlauf anzeigen'},
duplicateReport: 'Duplizierten Bericht',
approver: 'Genehmiger',
},
Expand Down
4 changes: 4 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,10 @@ const translations = {
week: 'Week',
year: 'Year',
quarter: 'Quarter',
concierge: {
sidePanelGreeting: 'Hi there, how can I help?',
showHistory: 'Show history',
},
vacationDelegate: 'Vacation delegate',
expensifyLogo: 'Expensify logo',
approver: 'Approver',
Expand Down
4 changes: 4 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,10 @@ const translations: TranslationDeepObject<typeof en> = {
week: 'Semana',
year: 'Año',
quarter: 'Trimestre',
concierge: {
sidePanelGreeting: 'Hola, ¿en qué puedo ayudarte?',
showHistory: 'Mostrar historial',
},
vacationDelegate: 'Delegado de vacaciones',
expensifyLogo: 'Logo de Expensify',
approver: 'Aprobador',
Expand Down
1 change: 1 addition & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ const translations: TranslationDeepObject<typeof en> = {
quarter: 'Trimestre',
vacationDelegate: 'Délégué de vacances',
expensifyLogo: 'Logo Expensify',
concierge: {sidePanelGreeting: 'Bonjour, comment puis-je vous aider ?', showHistory: 'Afficher l’historique'},
duplicateReport: 'Note de frais en double',
approver: 'Approbateur',
},
Expand Down
1 change: 1 addition & 0 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ const translations: TranslationDeepObject<typeof en> = {
quarter: 'Trimestre',
vacationDelegate: 'Delega ferie',
expensifyLogo: 'Logo Expensify',
concierge: {sidePanelGreeting: 'Ciao, come posso aiutarti?', showHistory: 'Mostra cronologia'},
duplicateReport: 'Report duplicato',
approver: 'Approvante',
},
Expand Down
1 change: 1 addition & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ const translations: TranslationDeepObject<typeof en> = {
quarter: '四半期',
vacationDelegate: '休暇代理人',
expensifyLogo: 'Expensifyロゴ',
concierge: {sidePanelGreeting: 'こんにちは、どのようにお手伝いできますか?', showHistory: '履歴を表示'},
duplicateReport: 'レポートを複製',
approver: '承認者',
},
Expand Down
1 change: 1 addition & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ const translations: TranslationDeepObject<typeof en> = {
quarter: 'Kwartaal',
vacationDelegate: 'Vertegenwoordiger tijdens vakantie',
expensifyLogo: 'Expensify-logo',
concierge: {sidePanelGreeting: 'Hoi, waarmee kan ik je helpen?', showHistory: 'Geschiedenis weergeven'},
duplicateReport: 'Dubbel rapport',
approver: 'Fiatteur',
},
Expand Down
1 change: 1 addition & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ const translations: TranslationDeepObject<typeof en> = {
quarter: 'Kwartał',
vacationDelegate: 'Zastępca urlopowy',
expensifyLogo: 'Logo Expensify',
concierge: {sidePanelGreeting: 'Cześć, w czym mogę pomóc?', showHistory: 'Pokaż historię'},
duplicateReport: 'Zduplikowany raport',
approver: 'Osoba zatwierdzająca',
},
Expand Down
1 change: 1 addition & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ const translations: TranslationDeepObject<typeof en> = {
quarter: 'Trimestre',
vacationDelegate: 'Delegado de férias',
expensifyLogo: 'Logo da Expensify',
concierge: {sidePanelGreeting: 'Oi, como posso ajudar?', showHistory: 'Mostrar histórico'},
duplicateReport: 'Duplicar relatório',
approver: 'Aprovador',
},
Expand Down
1 change: 1 addition & 0 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ const translations: TranslationDeepObject<typeof en> = {
quarter: '季度',
vacationDelegate: '休假代理',
expensifyLogo: 'Expensify徽标',
concierge: {sidePanelGreeting: '你好,我能帮你做什么?', showHistory: '显示历史'},
duplicateReport: '重复报销单',
approver: '审批人',
},
Expand Down
15 changes: 15 additions & 0 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@
};

let conciergeReportIDOnyxConnect: OnyxEntry<string>;
Onyx.connect({

Check warning on line 1036 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.CONCIERGE_REPORT_ID,
callback: (value) => {
conciergeReportIDOnyxConnect = value;
Expand All @@ -1041,7 +1041,7 @@
});

const defaultAvatarBuildingIconTestID = 'SvgDefaultAvatarBuilding Icon';
Onyx.connect({

Check warning on line 1044 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
// When signed out, val is undefined
Expand All @@ -1059,7 +1059,7 @@
let allPersonalDetails: OnyxEntry<PersonalDetailsList>;
let allPersonalDetailLogins: string[];
let currentUserPersonalDetails: OnyxEntry<PersonalDetails>;
Onyx.connect({

Check warning on line 1062 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
if (currentUserAccountID) {
Expand All @@ -1071,7 +1071,7 @@
});

let allReportsDraft: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 1074 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_DRAFT,
waitForCollectionCallback: true,
callback: (value) => (allReportsDraft = value),
Expand All @@ -1079,7 +1079,7 @@

let allPolicies: OnyxCollection<Policy>;
let policiesArray: Policy[] = [];
Onyx.connect({

Check warning on line 1082 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -1089,7 +1089,7 @@
});

let allPolicyDrafts: OnyxCollection<Policy>;
Onyx.connect({

Check warning on line 1092 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY_DRAFTS,
waitForCollectionCallback: true,
callback: (value) => (allPolicyDrafts = value),
Expand All @@ -1097,7 +1097,7 @@

let allReports: OnyxCollection<Report>;
let reportsByPolicyID: ReportByPolicyMap;
Onyx.connect({

Check warning on line 1100 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -1133,14 +1133,14 @@
});

let betaConfiguration: OnyxEntry<BetaConfiguration> = {};
Onyx.connect({

Check warning on line 1136 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.BETA_CONFIGURATION,
callback: (value) => (betaConfiguration = value ?? {}),
});

let allTransactions: OnyxCollection<Transaction> = {};
let reportsTransactions: Record<string, Transaction[]> = {};
Onyx.connect({

Check warning on line 1143 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -1166,7 +1166,7 @@
});

let allReportActions: OnyxCollection<ReportActions>;
Onyx.connect({

Check warning on line 1169 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => {
Expand Down Expand Up @@ -6403,6 +6403,20 @@
};
}

function buildConciergeGreetingReportAction(reportID: string, greetingText: string, created: string): ReportAction {
return {
reportActionID: CONST.CONCIERGE_GREETING_ACTION_ID,
reportID,
actionName: CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT,
actorAccountID: CONST.ACCOUNT_ID.CONCIERGE,
person: [{style: 'strong', text: CONST.CONCIERGE_DISPLAY_NAME, type: 'TEXT'}],
created,
message: [{type: CONST.REPORT.MESSAGE.TYPE.COMMENT, html: greetingText, text: greetingText}],
originalMessage: {html: greetingText, whisperedTo: []},
shouldShow: true,
} as ReportAction;
}

/**
* update optimistic parent reportAction when a comment is added or remove in the child report
* @param parentReportAction - Parent report action of the child report
Expand Down Expand Up @@ -13037,6 +13051,7 @@

export {
areAllRequestsBeingSmartScanned,
buildConciergeGreetingReportAction,
buildOptimisticAddCommentReportAction,
buildOptimisticApprovedReportAction,
checkBulkRejectHydration,
Expand Down
16 changes: 16 additions & 0 deletions src/pages/inbox/ReportScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import useReportIsArchived from '@hooks/useReportIsArchived';
import useReportTransactionsCollection from '@hooks/useReportTransactionsCollection';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useSidePanelActions from '@hooks/useSidePanelActions';
import useSidePanelState from '@hooks/useSidePanelState';
import useSubmitToDestinationVisible from '@hooks/useSubmitToDestinationVisible';
import useThemeStyles from '@hooks/useThemeStyles';
import useViewportOffsetTop from '@hooks/useViewportOffsetTop';
Expand Down Expand Up @@ -294,6 +295,16 @@ function ReportScreen({route, navigation, isInSidePanel = false}: ReportScreenPr
const reportActions = useMemo(() => getFilteredReportActionsForReportView(unfilteredReportActions), [unfilteredReportActions]);
const [childReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${linkedAction?.childReportID}`);

const isConciergeSidePanel = useMemo(() => isInSidePanel && isConciergeChatReport(report, conciergeReportID), [isInSidePanel, report, conciergeReportID]);

const {sessionStartTime} = useSidePanelState();

const hasUserSentMessage = useMemo(() => {
if (!isConciergeSidePanel || !sessionStartTime) {
return false;
}
return reportActions.some((action) => !isCreatedAction(action) && action.actorAccountID === currentUserAccountID && action.created >= sessionStartTime);
}, [isConciergeSidePanel, reportActions, currentUserAccountID, sessionStartTime]);
const viewportOffsetTop = useViewportOffsetTop();

const {reportPendingAction, reportErrors} = getReportOfflinePendingActionAndErrors(report);
Expand Down Expand Up @@ -1056,11 +1067,15 @@ function ReportScreen({route, navigation, isInSidePanel = false}: ReportScreenPr
report={report}
reportActions={reportActions}
isLoadingInitialReportActions={reportMetadata?.isLoadingInitialReportActions}
hasOnceLoadedReportActions={reportMetadata?.hasOnceLoadedReportActions}
hasNewerActions={hasNewerActions}
hasOlderActions={hasOlderActions}
parentReportAction={parentReportAction}
transactionThreadReportID={transactionThreadReportID}
isReportTransactionThread={isTransactionThreadView}
isConciergeSidePanel={isConciergeSidePanel}
hasUserSentMessage={hasUserSentMessage}
sessionStartTime={sessionStartTime}
isConciergeProcessing={isConciergeProcessing}
conciergeReasoningHistory={conciergeReasoningHistory}
conciergeStatusLabel={conciergeStatusLabel}
Expand Down Expand Up @@ -1088,6 +1103,7 @@ function ReportScreen({route, navigation, isInSidePanel = false}: ReportScreenPr
// 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}
isInSidePanel={isInSidePanel}
shouldHideStatusIndicators={isConciergeSidePanel && !hasUserSentMessage}
kickoffWaitingIndicator={kickoffWaitingIndicator}
/>
) : null}
Expand Down
Loading
Loading