1 import { useEffect } from 'react';
3 import { Href } from '@proton/atoms';
4 import type { CompatibilityItem } from '@proton/components/containers/compatibilityCheck/compatibilityCheckHelper';
5 import { isWebCryptoRsaSigningSupported } from '@proton/crypto/lib/compatibilityChecks';
6 import { getAppName } from '@proton/shared/lib/apps/helper';
7 import type { APP_NAMES } from '@proton/shared/lib/constants';
8 import { APPS } from '@proton/shared/lib/constants';
9 import { getBrowser } from '@proton/shared/lib/helpers/browser';
10 import { captureMessage } from '@proton/shared/lib/helpers/sentry';
11 import { getItem, setItem } from '@proton/shared/lib/helpers/storage';
12 import { getKnowledgeBaseUrl } from '@proton/shared/lib/helpers/url';
13 import unsupportedBrowserSettings from '@proton/styles/assets/img/errors/unsupported-browser.svg';
15 import useAppTitle from '../../hooks/useAppTitle';
19 incompatibilities: CompatibilityItem[];
22 const key = 'compatibility-check.notified';
24 // Note: This is not translated because locales are not loaded at this point
25 const CompatibilityCheckView = ({ appName = APPS.PROTONMAIL, incompatibilities }: Props) => {
26 const isVPN = appName === APPS.PROTONVPN_SETTINGS;
28 ? 'https://protonvpn.com/support/browsers-supported/'
29 : getKnowledgeBaseUrl('/recommended-browsers');
31 useAppTitle('Compatibility check');
34 const notified = getItem(key);
36 captureMessage('Compatibility check failed', {
38 extra: { reason: incompatibilities.map(({ name }) => name).join(',') },
40 // the following check is just for informational purposes for now, to understand how many browsers require fallback code for RSA signatures
41 void isWebCryptoRsaSigningSupported().then((isSupported) => {
43 captureMessage('Crypto compatibility report: RSA signing not supported by WebCrypto API', {
52 const app = getAppName(appName);
53 const incompatibilitiesWithText = incompatibilities.filter((incompat) => !!incompat.text);
54 const browser = getBrowser();
57 <div className="h-full flex items-center overflow-auto">
58 <div className="m-auto text-center max-w-custom" style={{ '--max-w-custom': '30em' }}>
59 <div className="mb-8 text-center">
60 <img src={unsupportedBrowserSettings} alt="" />
62 <h1 className="text-bold text-4xl">Compatibility check</h1>
64 {app} requires a modern web browser with cutting edge support for{' '}
65 <Href className="primary-link" href="http://caniuse.com/#feat=cryptography">
69 <Href className="primary-link" href="http://caniuse.com/#feat=namevalue-storage">
74 <p>Your browser: {`${browser.name} - ${browser.version}`}</p>
75 {incompatibilitiesWithText.length > 0 && (
76 <ul className="text-left">
77 {incompatibilitiesWithText.map(({ name, text }) => {
86 <Href href={kbUrl} target="_self">
94 export default CompatibilityCheckView;