import React, { useContext, useMemo, useRef, useState, useEffect } from 'react';
import { useHistory } from 'react-router-dom';
import { useSelector } from 'react-redux';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { getCurrentLocale } from '../../../ducks/metamask/metamask';
import { I18nContext } from '../../../contexts/i18n';
import { useEqualityCheck } from '../../../hooks/useEqualityCheck';
import Button from '../../ui/button';
import Popover from '../../ui/popover';
import Typography from '../../ui/typography';
import { updateViewedNotifications } from '../../../store/actions';
import { getTranslatedUINotifications } from '../../../../shared/notifications';
import { getSortedAnnouncementsToShow } from '../../../selectors';
import {
BUILD_QUOTE_ROUTE,
ADVANCED_ROUTE,
EXPERIMENTAL_ROUTE,
SECURITY_ROUTE,
} from '../../../helpers/constants/routes';
import { TYPOGRAPHY } from '../../../helpers/constants/design-system';
import ZENDESK_URLS from '../../../helpers/constants/zendesk-url';
function getActionFunctionById(id, history) {
const actionFunctions = {
2: () => {
global.platform.openTab({
url: 'https://survey.alchemer.com/s3/6173069/MetaMask-Extension-NPS-January-2021',
});
},
3: () => {
global.platform.openTab({
url: 'https://community.metamask.io/t/about-the-security-category/72',
});
},
4: () => {
updateViewedNotifications({ 4: true });
history.push(BUILD_QUOTE_ROUTE);
},
5: () => {
updateViewedNotifications({ 5: true });
global.platform.openTab({
url: ZENDESK_URLS.SECRET_RECOVERY_PHRASE,
});
},
8: () => {
updateViewedNotifications({ 8: true });
history.push(ADVANCED_ROUTE);
},
10: () => {
updateViewedNotifications({ 10: true });
history.push(`${ADVANCED_ROUTE}#token-description`);
},
12: () => {
updateViewedNotifications({ 12: true });
history.push(EXPERIMENTAL_ROUTE);
},
14: () => {
updateViewedNotifications({ 14: true });
history.push(`${ADVANCED_ROUTE}#backup-userdata`);
},
16: () => {
updateViewedNotifications({ 16: true });
history.push(EXPERIMENTAL_ROUTE);
},
17: () => {
updateViewedNotifications({ 17: true });
history.push(SECURITY_ROUTE);
},
};
return actionFunctions[id];
}
const renderDescription = (description) => {
if (!Array.isArray(description)) {
return (