Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ function ActionContentRouter({
<IntegrationSyncFailedMessage
action={action}
policyID={policyID}
originalReport={originalReport}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import RenderHTML from '@components/RenderHTML';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';

import {getIntegrationSyncFailedMessage} from '@libs/ReportActionsUtils';
import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID';
import {getIntegrationSyncFailedMessage, hasReasoning} from '@libs/ReportActionsUtils';

import ReportActionItemBasicMessage from '@pages/inbox/report/ReportActionItemBasicMessage';
import ReportActionItemMessageWithExplain from '@pages/inbox/report/ReportActionItemMessageWithExplain';

import ONYXKEYS from '@src/ONYXKEYS';
import type * as OnyxTypes from '@src/types/onyx';
Expand All @@ -17,16 +19,32 @@ import React from 'react';
type IntegrationSyncFailedMessageProps = {
action: OnyxEntry<OnyxTypes.ReportAction>;
policyID: string | undefined;

/** Original report from which the given reportAction is first created */
originalReport: OnyxEntry<OnyxTypes.Report>;
};

function IntegrationSyncFailedMessage({action, policyID}: IntegrationSyncFailedMessageProps) {
function IntegrationSyncFailedMessage({action, policyID, originalReport}: IntegrationSyncFailedMessageProps) {
const {translate} = useLocalize();
const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT);
const [childReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(action?.childReportID)}`);
const isTryNewDotNVPDismissed = !!tryNewDot?.classicRedirect?.dismissed;
const message = getIntegrationSyncFailedMessage(translate, action, policyID, isTryNewDotNVPDismissed);

if (hasReasoning(action)) {
return (
<ReportActionItemMessageWithExplain
message={message}
action={action}
childReport={childReport}
originalReport={originalReport}
/>
);
}

return (
<ReportActionItemBasicMessage message="">
<RenderHTML html={`<comment><muted-text>${getIntegrationSyncFailedMessage(translate, action, policyID, isTryNewDotNVPDismissed)}</muted-text></comment>`} />
<RenderHTML html={`<comment><muted-text>${message}</muted-text></comment>`} />
</ReportActionItemBasicMessage>
);
}
Expand Down
Loading