import bowser from 'bowser' ; /**
 * Automated report template filenames.
 */ enum ReportTemplate { Bug = '2_automated_bug_report.yml' , Error = '3_automated_error_report.yml' } /**
 * Opens the report issue page on Github.
 */ export function reportBug ( ) { openReportOnGithub ( getReportParameters ( ReportTemplate . Bug ) ) ; } param error export function reportError ( error ) { openReportOnGithub ( [ ... getReportParameters ( ReportTemplate . Error ) , `stack=${ encodeURIComponent ( error . stack ?? '' ) }` ] ) ; } param params function openReportOnGithub ( params ) { const { REACT_APP_BUGS_URL } = process . env ; window . open ( `${ REACT_APP_BUGS_URL }/new?${ params . join ( '&' ) }` ) ; } return function getReportParameters ( template ) { const parser = bowser . getParser ( window . navigator . userAgent ) ; const browser = parser . getBrowser ( ) ; const os = parser . getOS ( ) ; const { REACT_APP_VERSION : yataVersion } = process . env ; const browserVersion = `${ browser . name } ${ browser . version }` ; const osVersion = `${ os . name } ${ os . version || '' }` ; return [ `template=${ template }` , `yata_version=${ encodeURIComponent ( yataVersion ) }` , `browser_version=${ browserVersion }` , `os_version=${ osVersion }` , ] ; }