@@ -172,6 +172,7 @@ function MoneyReportHeader({
172172 const [ download ] = useOnyx ( `${ ONYXKEYS . COLLECTION . DOWNLOAD } ${ reportPDFFilename } ` , { canBeMissing : true } ) ;
173173 const isDownloadingPDF = download ?. isDownloading ?? false ;
174174 const [ session ] = useOnyx ( ONYXKEYS . SESSION , { canBeMissing : false } ) ;
175+ const [ integrationsExportTemplates ] = useOnyx ( ONYXKEYS . NVP_INTEGRATION_SERVER_EXPORT_TEMPLATES , { canBeMissing : true } ) ;
175176 const requestParentReportAction = useMemo ( ( ) => {
176177 if ( ! reportActions || ! transactionThreadReport ?. parentReportActionID ) {
177178 return null ;
@@ -549,8 +550,8 @@ function MoneyReportHeader({
549550
550551 const [ offlineModalVisible , setOfflineModalVisible ] = useState ( false ) ;
551552
552- const exportSubMenuOptions : Record < ValueOf < typeof CONST . REPORT . EXPORT_OPTIONS > , DropdownOption < ValueOf < typeof CONST . REPORT . EXPORT_OPTIONS > > > = useMemo (
553- ( ) => ( {
553+ const exportSubmenuOptions : Record < string , DropdownOption < string > > = useMemo ( ( ) => {
554+ const options : Record < string , DropdownOption < string > > = {
554555 [ CONST . REPORT . EXPORT_OPTIONS . DOWNLOAD_CSV ] : {
555556 text : translate ( 'export.basicExport' ) ,
556557 icon : Expensicons . Table ,
@@ -611,9 +612,22 @@ function MoneyReportHeader({
611612 markAsManuallyExported ( moneyRequestReport ?. reportID , connectedIntegration ) ;
612613 } ,
613614 } ,
614- } ) ,
615- [ translate , connectedIntegrationFallback , connectedIntegration , moneyRequestReport , isOffline , transactionIDs , isExported , beginExportWithTemplate ] ,
616- ) ;
615+ } ;
616+
617+ // If the user has any custom integration export templates, add them as export options
618+ if ( integrationsExportTemplates && integrationsExportTemplates . length > 0 ) {
619+ for ( const template of integrationsExportTemplates ) {
620+ options [ template . name ] = {
621+ text : template . name ,
622+ icon : Expensicons . Table ,
623+ value : template . name ,
624+ onSelected : ( ) => beginExportWithTemplate ( template . name , CONST . EXPORT_TEMPLATE_TYPES . INTEGRATIONS , transactionIDs ) ,
625+ } ;
626+ }
627+ }
628+
629+ return options ;
630+ } , [ translate , connectedIntegrationFallback , connectedIntegration , moneyRequestReport , isOffline , transactionIDs , isExported , beginExportWithTemplate , integrationsExportTemplates ] ) ;
617631
618632 const primaryActionsImplementation = {
619633 [ CONST . REPORT . PRIMARY_ACTIONS . SUBMIT ] : (
@@ -759,8 +773,8 @@ function MoneyReportHeader({
759773 if ( ! moneyRequestReport ) {
760774 return [ ] ;
761775 }
762- return getSecondaryExportReportActions ( moneyRequestReport , policy , reportActions ) ;
763- } , [ moneyRequestReport , policy , reportActions ] ) ;
776+ return getSecondaryExportReportActions ( moneyRequestReport , policy , reportActions , integrationsExportTemplates ?? [ ] ) ;
777+ } , [ moneyRequestReport , policy , reportActions , integrationsExportTemplates ] ) ;
764778
765779 const secondaryActionsImplementation : Record <
766780 ValueOf < typeof CONST . REPORT . SECONDARY_ACTIONS > ,
@@ -779,7 +793,7 @@ function MoneyReportHeader({
779793 text : translate ( 'common.export' ) ,
780794 backButtonText : translate ( 'common.export' ) ,
781795 icon : Expensicons . Export ,
782- subMenuItems : secondaryExportActions . map ( ( action ) => exportSubMenuOptions [ action ] ) ,
796+ subMenuItems : secondaryExportActions . map ( ( action ) => exportSubmenuOptions [ action as string ] ) ,
783797 } ,
784798 [ CONST . REPORT . SECONDARY_ACTIONS . DOWNLOAD_PDF ] : {
785799 value : CONST . REPORT . SECONDARY_ACTIONS . DOWNLOAD_PDF ,
0 commit comments