import PropTypes from 'prop-types'; import React from 'react'; import Box from '../box/box.jsx'; import {defineMessages, injectIntl, intlShape, FormattedMessage} from 'react-intl'; import Modal from '../../containers/windowed-modal.jsx'; import { isRendererSupported, isNewFunctionSupported, findIncompatibleUserscripts } from '../../lib/tw-environment-support-prober.js'; import unhappyBrowser from './unsupported-browser.svg'; const messages = defineMessages({ label: { id: 'gui.unsupportedBrowser.label', defaultMessage: 'Browser is not supported', description: '' } }); const BrowserModal = ({intl, ...props}) => { const label = messages.label; const incompatibleUserscripts = findIncompatibleUserscripts(); return ( {}} // Prevent closing this critical modal className="browser-modal" >

{/* eslint-disable max-len */} {isNewFunctionSupported() ? null : ( // This message should only be seen by website operators, so we don't need to translate it

{'Unable to compile JavaScript with new Function(). This is most likely caused by an overly-strict Content-Security-Policy. The CSP must include \'unsafe-eval\'.'}

)} {incompatibleUserscripts.length > 0 && ( {incompatibleUserscripts.map((message, index) => (

{message}

))}
)} {!isRendererSupported() && (

) }} />

) }} />

)}
); }; BrowserModal.propTypes = { intl: intlShape.isRequired, isRtl: PropTypes.bool }; const WrappedBrowserModal = injectIntl(BrowserModal); export default WrappedBrowserModal;