@@ -9,6 +9,7 @@ import _assign from 'lodash/assign'
99import _isArray from 'lodash/isArray'
1010import _includes from 'lodash/includes'
1111
12+ import { logger } from 'utils/logger'
1213import { LANGUAGES } from 'locales/i18n'
1314import { makeFetchCall } from 'state/utils'
1415import { formatRawSymbols , mapRequestSymbols , mapRequestPairs } from 'state/symbols/utils'
@@ -61,15 +62,21 @@ import config from 'config'
6162
6263import actions from './actions'
6364import types from './constants'
64- import { getExportEmail , getIsPdfExportRequired } from './selectors'
65+ import {
66+ getExportEmail ,
67+ getIsSingleExport ,
68+ getLocalExportPath ,
69+ getFirstExportPath ,
70+ getIsPdfExportRequired ,
71+ } from './selectors'
6572import {
6673 getQueryLimit ,
6774 NO_TIME_FRAME_TARGETS ,
6875 NO_QUERY_LIMIT_TARGETS ,
6976} from './utils'
7077
7178
72- const { showFrameworkMode } = config
79+ const { isElectronApp , showFrameworkMode } = config
7380const {
7481 MENU_ACCOUNT_BALANCE ,
7582 MENU_AFFILIATES_EARNINGS ,
@@ -467,7 +474,22 @@ function* prepareExport() {
467474 }
468475}
469476
477+ function * openExportFolder ( ) {
478+ if ( isElectronApp ) {
479+ const filePath = yield select ( getFirstExportPath )
480+ const folderPath = yield select ( getLocalExportPath )
481+ const isSingleExport = yield select ( getIsSingleExport )
482+ const fullPath = isSingleExport ? filePath : folderPath
483+ try {
484+ yield call ( window . bfxReportElectronApi . showItemInFolder , { fullPath } )
485+ } catch ( error ) {
486+ yield call ( logger . error , error )
487+ }
488+ }
489+ }
490+
470491export default function * exportSaga ( ) {
471492 yield takeLatest ( types . PREPARE_EXPORT , prepareExport )
472493 yield takeLatest ( types . EXPORT_REPORT , exportReport )
494+ yield takeLatest ( types . OPEN_EXPORT_FOLDER , openExportFolder )
473495}
0 commit comments