diff --git a/client/deposits/list/index.tsx b/client/deposits/list/index.tsx index 1ac643d31dc..dd3d737a8fb 100644 --- a/client/deposits/list/index.tsx +++ b/client/deposits/list/index.tsx @@ -312,48 +312,11 @@ export const DepositsList = (): JSX.Element => { const onDownload = async () => { setIsDownloading( true ); - const downloadType = totalRows > rows.length ? 'endpoint' : 'browser'; - if ( 'endpoint' === downloadType ) { - if ( ! isDefaultSiteLanguage() && ! isExportModalDismissed() ) { - setCSVExportModalOpen( true ); - } else { - endpointExport( '' ); - } + if ( ! isDefaultSiteLanguage() && ! isExportModalDismissed() ) { + setCSVExportModalOpen( true ); } else { - const params = getQuery(); - - const csvColumns = [ - { - ...columns[ 0 ], - label: __( 'Payout Id', 'woocommerce-payments' ), - }, - ...columns.slice( 1 ), - ]; - - const csvRows = rows.map( ( row ) => [ - row[ 0 ], - { - ...row[ 1 ], - value: dateI18n( - 'Y-m-d', - moment.utc( row[ 1 ].value ).toISOString(), - true - ), - }, - ...row.slice( 2 ), - ] ); - - downloadCSVFile( - generateCSVFileName( title, params ), - generateCSVDataFromTable( csvColumns, csvRows ) - ); - - recordEvent( 'wcpay_deposits_download', { - exported_deposits: rows.length, - total_deposits: depositsSummary.count, - download_type: 'browser', - } ); + endpointExport( '' ); } setIsDownloading( false ); diff --git a/client/disputes/index.tsx b/client/disputes/index.tsx index 060afccce35..7471c130d0b 100644 --- a/client/disputes/index.tsx +++ b/client/disputes/index.tsx @@ -444,71 +444,11 @@ export const DisputesList = (): JSX.Element => { const onDownload = async () => { setIsDownloading( true ); - const title = __( 'Disputes', 'woocommerce-payments' ); - const downloadType = totalRows > rows.length ? 'endpoint' : 'browser'; - - if ( 'endpoint' === downloadType ) { - if ( ! isDefaultSiteLanguage() && ! isExportModalDismissed() ) { - setCSVExportModalOpen( true ); - } else { - endpointExport( '' ); - } + + if ( ! isDefaultSiteLanguage() && ! isExportModalDismissed() ) { + setCSVExportModalOpen( true ); } else { - const csvColumns = [ - { - ...headers[ 0 ], - label: __( 'Dispute Id', 'woocommerce-payments' ), - }, - ...headers.slice( 1, -1 ), // Remove details (position 0) and action (last position) column headers. - ]; - - const csvRows = rows.map( ( row ) => { - return [ - ...row.slice( 0, 3 ), // Amount, Currency, Status. - { - // Reason. - ...row[ 3 ], - value: - disputeStatusMapping[ row[ 3 ].value ?? '' ] - .message, - }, - { - // Source. - ...row[ 4 ], - value: formatStringValue( - ( row[ 4 ].value ?? '' ).toString() - ), - }, - ...row.slice( 5, 10 ), // Order #, Customer, Email, Country. - { - // Disputed On. - ...row[ 10 ], - value: dateI18n( - 'Y-m-d', - moment( row[ 10 ].value ).toISOString() - ), - }, - { - // Respond by. - ...row[ 11 ], - value: dateI18n( - 'Y-m-d / g:iA', - moment( row[ 11 ].value ).toISOString() - ), - }, - ]; - } ); - - downloadCSVFile( - generateCSVFileName( title, getQuery() ), - generateCSVDataFromTable( csvColumns, csvRows ) - ); - - recordEvent( 'wcpay_disputes_download', { - exported_disputes: csvRows.length, - total_disputes: disputesSummary.count, - download_type: 'browser', - } ); + endpointExport( '' ); } setIsDownloading( false ); diff --git a/client/transactions/list/index.tsx b/client/transactions/list/index.tsx index a5206ae0e5e..0ac0c84a9d0 100644 --- a/client/transactions/list/index.tsx +++ b/client/transactions/list/index.tsx @@ -711,35 +711,10 @@ export const TransactionsList = ( const onDownload = async () => { setIsDownloading( true ); - // We destructure page and path to get the right params. - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const { page, path, ...params } = getQuery(); - const downloadType = totalRows > rows.length ? 'endpoint' : 'browser'; - - recordEvent( 'wcpay_transactions_download_csv_click', { - location: props.depositId ? 'deposit_details' : 'transactions', - download_type: downloadType, - exported_transactions: rows.length, - total_transactions: transactionsSummary.count, - } ); - - if ( 'endpoint' === downloadType ) { - if ( ! isDefaultSiteLanguage() && ! isExportModalDismissed() ) { - setCSVExportModalOpen( true ); - } else { - endpointExport( '' ); - } + if ( ! isDefaultSiteLanguage() && ! isExportModalDismissed() ) { + setCSVExportModalOpen( true ); } else { - const columnsToDisplayInCsv = columnsToDisplay.map( ( column ) => { - if ( column.labelInCsv ) { - return { ...column, label: column.labelInCsv }; - } - return column; - } ); - downloadCSVFile( - generateCSVFileName( title, params ), - generateCSVDataFromTable( columnsToDisplayInCsv, rows ) - ); + endpointExport( '' ); } setIsDownloading( false );