@@ -5,17 +5,38 @@ import type {OnyxEntry} from 'react-native-onyx';
55import Text from '@components/Text' ;
66import TextLink from '@components/TextLink' ;
77import useLocalize from '@hooks/useLocalize' ;
8+ import useOnyx from '@hooks/useOnyx' ;
89import useThemeStyles from '@hooks/useThemeStyles' ;
9- import { getExportIntegrationActionFragments } from '@libs/ReportActionsUtils' ;
10- import type { ReportAction } from '@src/types/onyx' ;
10+ import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID' ;
11+ import { getExportIntegrationActionFragments , getExportIntegrationMessageHTML , hasReasoning } from '@libs/ReportActionsUtils' ;
12+ import ReportActionItemMessageWithExplain from '@pages/inbox/report/ReportActionItemMessageWithExplain' ;
13+ import ONYXKEYS from '@src/ONYXKEYS' ;
14+ import type { Report , ReportAction } from '@src/types/onyx' ;
1115
1216type ExportIntegrationProps = {
1317 action : OnyxEntry < ReportAction > ;
18+
19+ /** Original report from which the given reportAction is first created */
20+ originalReport : OnyxEntry < Report > ;
1421} ;
1522
16- function ExportIntegration ( { action} : ExportIntegrationProps ) {
23+ function ExportIntegration ( { action, originalReport } : ExportIntegrationProps ) {
1724 const styles = useThemeStyles ( ) ;
1825 const { translate} = useLocalize ( ) ;
26+ const [ childReport ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ getNonEmptyStringOnyxID ( action ?. childReportID ) } ` ) ;
27+
28+ if ( hasReasoning ( action ) ) {
29+ const message = getExportIntegrationMessageHTML ( translate , action ) ;
30+ return (
31+ < ReportActionItemMessageWithExplain
32+ message = { message }
33+ action = { action }
34+ childReport = { childReport }
35+ originalReport = { originalReport }
36+ />
37+ ) ;
38+ }
39+
1940 const fragments = getExportIntegrationActionFragments ( translate , action ) ;
2041
2142 return (
0 commit comments