1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

[MMI] Allows the mmi build to be generated using the dist command (#20148)

* adds listeners for signatureControll and adds the handleSigningEvents method

* clean up

* updates signature request containers files

* adds necessary methods

* wip

* signing flow with core methods

* yarn lint

* updates logic to fit latest signatureCOntroller

* updates mmi extension package

* updates signature-controller and message-manager packages

* checkout develop lock file and run yarn

* checkout develop lock file and package.json to test circleci

* test fix

* adds signature-controller new version

* updates mmi extension package

* tx-list update and runs lavamoat auto

* lint fix

* runs lavamoat auto

* resets lavamoat/build-system/policy.jsono to develop

* Update LavaMoat policies

* adds back the dispatch

* lint

* changes needed to generate a mmi build

* adds metametricsId in url param

* adds necessary fence

---------

Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com>
This commit is contained in:
António Regadas 2023-07-25 09:31:52 +01:00 committed by GitHub
parent 5693d1945a
commit 4b9a4d330c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 91 additions and 50 deletions

View File

@ -137,7 +137,7 @@ function createManifestTasks({
const buildName = const buildName =
buildType === 'mmi' buildType === 'mmi'
? `MetaMask Institutional ${mv3Str}${lavamoatStr}${snowStr}` ? `MetaMask Institutional ${mv3Str}`
: `MetaMask ${capitalize(buildType)}${mv3Str}${lavamoatStr}${snowStr}`; : `MetaMask ${capitalize(buildType)}${mv3Str}${lavamoatStr}${snowStr}`;
manifest.name = buildName; manifest.name = buildName;

View File

@ -2,7 +2,9 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classnames from 'classnames'; import classnames from 'classnames';
import { Tabs, Tab } from '../../../ui/tabs'; import { Tabs, Tab } from '../../../ui/tabs';
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
import Button from '../../../ui/button'; import Button from '../../../ui/button';
///: END:ONLY_INCLUDE_IN
import ActionableMessage from '../../../ui/actionable-message/actionable-message'; import ActionableMessage from '../../../ui/actionable-message/actionable-message';
import { PageContainerFooter } from '../../../ui/page-container'; import { PageContainerFooter } from '../../../ui/page-container';
import ErrorMessage from '../../../ui/error-message'; import ErrorMessage from '../../../ui/error-message';
@ -57,7 +59,9 @@ export default class ConfirmPageContainerContent extends Component {
toAddress: PropTypes.string, toAddress: PropTypes.string,
transactionType: PropTypes.string, transactionType: PropTypes.string,
isBuyableChain: PropTypes.bool, isBuyableChain: PropTypes.bool,
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
openBuyCryptoInPdapp: PropTypes.func, openBuyCryptoInPdapp: PropTypes.func,
///: END:ONLY_INCLUDE_IN
txData: PropTypes.object, txData: PropTypes.object,
///: BEGIN:ONLY_INCLUDE_IN(build-mmi) ///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
noteComponent: PropTypes.node, noteComponent: PropTypes.node,
@ -197,7 +201,9 @@ export default class ConfirmPageContainerContent extends Component {
toAddress, toAddress,
transactionType, transactionType,
isBuyableChain, isBuyableChain,
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
openBuyCryptoInPdapp, openBuyCryptoInPdapp,
///: END:ONLY_INCLUDE_IN
txData, txData,
} = this.props; } = this.props;

View File

@ -1,4 +1,11 @@
import React, { useCallback, useContext, useEffect, useState } from 'react'; import React, {
useCallback,
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
useContext,
///: END:ONLY_INCLUDE_IN
useEffect,
useState,
} from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
@ -45,11 +52,13 @@ import {
getSwapsDefaultToken, getSwapsDefaultToken,
} from '../../../selectors'; } from '../../../selectors';
import useRamps from '../../../hooks/experiences/useRamps'; import useRamps from '../../../hooks/experiences/useRamps';
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
import { MetaMetricsContext } from '../../../contexts/metametrics'; import { MetaMetricsContext } from '../../../contexts/metametrics';
import { import {
MetaMetricsEventCategory, MetaMetricsEventCategory,
MetaMetricsEventName, MetaMetricsEventName,
} from '../../../../shared/constants/metametrics'; } from '../../../../shared/constants/metametrics';
///: END:ONLY_INCLUDE_IN
import { import {
ConfirmPageContainerHeader, ConfirmPageContainerHeader,
ConfirmPageContainerContent, ConfirmPageContainerContent,
@ -105,8 +114,9 @@ const ConfirmPageContainer = (props) => {
} = props; } = props;
const t = useI18nContext(); const t = useI18nContext();
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
const trackEvent = useContext(MetaMetricsContext); const trackEvent = useContext(MetaMetricsContext);
///: END:ONLY_INCLUDE_IN
const [collectionBalance, setCollectionBalance] = useState('0'); const [collectionBalance, setCollectionBalance] = useState('0');
const isBuyableChain = useSelector(getIsBuyableChain); const isBuyableChain = useSelector(getIsBuyableChain);

View File

@ -64,9 +64,6 @@ export default class SignatureRequestOriginal extends Component {
address: PropTypes.string.isRequired, address: PropTypes.string.isRequired,
name: PropTypes.string, name: PropTypes.string,
}).isRequired, }).isRequired,
clearConfirmTransaction: PropTypes.func.isRequired,
history: PropTypes.object.isRequired,
mostRecentOverviewPage: PropTypes.string.isRequired,
txData: PropTypes.object.isRequired, txData: PropTypes.object.isRequired,
subjectMetadata: PropTypes.object, subjectMetadata: PropTypes.object,
hardwareWalletRequiresConnection: PropTypes.bool, hardwareWalletRequiresConnection: PropTypes.bool,
@ -75,6 +72,9 @@ export default class SignatureRequestOriginal extends Component {
showRejectTransactionsConfirmationModal: PropTypes.func.isRequired, showRejectTransactionsConfirmationModal: PropTypes.func.isRequired,
cancelAllApprovals: PropTypes.func.isRequired, cancelAllApprovals: PropTypes.func.isRequired,
rejectPendingApproval: PropTypes.func.isRequired, rejectPendingApproval: PropTypes.func.isRequired,
clearConfirmTransaction: PropTypes.func.isRequired,
history: PropTypes.object.isRequired,
mostRecentOverviewPage: PropTypes.string.isRequired,
resolvePendingApproval: PropTypes.func.isRequired, resolvePendingApproval: PropTypes.func.isRequired,
completedTx: PropTypes.func.isRequired, completedTx: PropTypes.func.isRequired,
///: BEGIN:ONLY_INCLUDE_IN(build-mmi) ///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
@ -258,11 +258,11 @@ export default class SignatureRequestOriginal extends Component {
onSubmit = async () => { onSubmit = async () => {
const { const {
resolvePendingApproval,
completedTx,
clearConfirmTransaction, clearConfirmTransaction,
history, history,
mostRecentOverviewPage, mostRecentOverviewPage,
resolvePendingApproval,
completedTx,
txData, txData,
} = this.props; } = this.props;
///: BEGIN:ONLY_INCLUDE_IN(build-mmi) ///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
@ -272,12 +272,10 @@ export default class SignatureRequestOriginal extends Component {
} }
///: END:ONLY_INCLUDE_IN ///: END:ONLY_INCLUDE_IN
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
await resolvePendingApproval(txData.id); await resolvePendingApproval(txData.id);
completedTx(txData.id); completedTx(txData.id);
clearConfirmTransaction(); clearConfirmTransaction();
history.push(mostRecentOverviewPage); history.push(mostRecentOverviewPage);
///: END:ONLY_INCLUDE_IN
}; };
onCancel = async () => { onCancel = async () => {
@ -332,11 +330,9 @@ export default class SignatureRequestOriginal extends Component {
} }
///: END:ONLY_INCLUDE_IN ///: END:ONLY_INCLUDE_IN
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
await resolvePendingApproval(txData.id); await resolvePendingApproval(txData.id);
clearConfirmTransaction(); clearConfirmTransaction();
history.push(mostRecentOverviewPage); history.push(mostRecentOverviewPage);
///: END:ONLY_INCLUDE_IN
} }
}} }}
disabled={ disabled={

View File

@ -13,9 +13,11 @@ import { ethErrors, serializeError } from 'eth-rpc-errors';
import { showCustodianDeepLink } from '@metamask-institutional/extension'; import { showCustodianDeepLink } from '@metamask-institutional/extension';
///: END:ONLY_INCLUDE_IN ///: END:ONLY_INCLUDE_IN
import { import {
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
resolvePendingApproval, resolvePendingApproval,
rejectPendingApproval,
completedTx, completedTx,
///: END:ONLY_INCLUDE_IN
rejectPendingApproval,
} from '../../../store/actions'; } from '../../../store/actions';
import { import {
doesAddressRequireLedgerHidConnection, doesAddressRequireLedgerHidConnection,

View File

@ -176,7 +176,6 @@ export default function TransactionList({
{pendingTransactions.map((dateGroup) => { {pendingTransactions.map((dateGroup) => {
return dateGroup.transactionGroups.map( return dateGroup.transactionGroups.map(
(transactionGroup, index) => { (transactionGroup, index) => {
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
if ( if (
transactionGroup.initialTransaction.transactionType === transactionGroup.initialTransaction.transactionType ===
TransactionType.smart TransactionType.smart
@ -193,7 +192,6 @@ export default function TransactionList({
</> </>
); );
} }
///: END:ONLY_INCLUDE_IN
return ( return (
<> <>
{renderDateStamp(index, dateGroup)} {renderDateStamp(index, dateGroup)}
@ -218,7 +216,7 @@ export default function TransactionList({
<> <>
{renderDateStamp(index, dateGroup)} {renderDateStamp(index, dateGroup)}
{transactionGroup.initialTransaction?.transactionType === {transactionGroup.initialTransaction?.transactionType ===
'smart' ? ( TransactionType.smart ? (
<SmartTransactionListItem <SmartTransactionListItem
transactionGroup={transactionGroup} transactionGroup={transactionGroup}
smartTransaction={transactionGroup.initialTransaction} smartTransaction={transactionGroup.initialTransaction}

View File

@ -2,7 +2,12 @@ import React, { useContext } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import classnames from 'classnames'; import classnames from 'classnames';
import { useHistory, useLocation } from 'react-router-dom'; import {
useHistory,
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
useLocation,
///: END:ONLY_INCLUDE_IN
} from 'react-router-dom';
///: BEGIN:ONLY_INCLUDE_IN(build-mmi) ///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
import { import {
@ -25,11 +30,13 @@ import {
getCurrentKeyring, getCurrentKeyring,
getSwapsDefaultToken, getSwapsDefaultToken,
getIsSwapsChain, getIsSwapsChain,
getIsBridgeChain,
getIsBuyableChain,
getSelectedAccountCachedBalance, getSelectedAccountCachedBalance,
getCurrentChainId, getCurrentChainId,
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
getIsBridgeChain,
getIsBuyableChain,
getMetaMetricsId, getMetaMetricsId,
///: END:ONLY_INCLUDE_IN
} from '../../../selectors'; } from '../../../selectors';
import { setSwapsFromToken } from '../../../ducks/swaps/swaps'; import { setSwapsFromToken } from '../../../ducks/swaps/swaps';
import IconButton from '../../ui/icon-button'; import IconButton from '../../ui/icon-button';
@ -45,8 +52,10 @@ import { startNewDraftTransaction } from '../../../ducks/send';
import { AssetType } from '../../../../shared/constants/transaction'; import { AssetType } from '../../../../shared/constants/transaction';
import { Icon, IconName } from '../../component-library'; import { Icon, IconName } from '../../component-library';
import { IconColor } from '../../../helpers/constants/design-system'; import { IconColor } from '../../../helpers/constants/design-system';
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
import useRamps from '../../../hooks/experiences/useRamps'; import useRamps from '../../../hooks/experiences/useRamps';
import { getPortfolioUrl } from '../../../helpers/utils/portfolio'; import { getPortfolioUrl } from '../../../helpers/utils/portfolio';
///: END:ONLY_INCLUDE_IN
import WalletOverview from './wallet-overview'; import WalletOverview from './wallet-overview';
const EthOverview = ({ className, showAddress }) => { const EthOverview = ({ className, showAddress }) => {
@ -54,18 +63,20 @@ const EthOverview = ({ className, showAddress }) => {
const t = useContext(I18nContext); const t = useContext(I18nContext);
const trackEvent = useContext(MetaMetricsContext); const trackEvent = useContext(MetaMetricsContext);
const history = useHistory(); const history = useHistory();
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
const location = useLocation(); const location = useLocation();
const isBridgeChain = useSelector(getIsBridgeChain);
const isBuyableChain = useSelector(getIsBuyableChain);
const metaMetricsId = useSelector(getMetaMetricsId);
///: END:ONLY_INCLUDE_IN
const keyring = useSelector(getCurrentKeyring); const keyring = useSelector(getCurrentKeyring);
const usingHardwareWallet = isHardwareKeyring(keyring?.type); const usingHardwareWallet = isHardwareKeyring(keyring?.type);
const balanceIsCached = useSelector(isBalanceCached); const balanceIsCached = useSelector(isBalanceCached);
const showFiat = useSelector(getShouldShowFiat); const showFiat = useSelector(getShouldShowFiat);
const balance = useSelector(getSelectedAccountCachedBalance); const balance = useSelector(getSelectedAccountCachedBalance);
const isSwapsChain = useSelector(getIsSwapsChain); const isSwapsChain = useSelector(getIsSwapsChain);
const isBridgeChain = useSelector(getIsBridgeChain);
const isBuyableChain = useSelector(getIsBuyableChain);
const defaultSwapsToken = useSelector(getSwapsDefaultToken); const defaultSwapsToken = useSelector(getSwapsDefaultToken);
const chainId = useSelector(getCurrentChainId); const chainId = useSelector(getCurrentChainId);
const metaMetricsId = useSelector(getMetaMetricsId);
///: BEGIN:ONLY_INCLUDE_IN(build-mmi) ///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
const mmiPortfolioEnabled = useSelector(getMmiPortfolioEnabled); const mmiPortfolioEnabled = useSelector(getMmiPortfolioEnabled);
@ -95,7 +106,7 @@ const EthOverview = ({ className, showAddress }) => {
onClick={() => { onClick={() => {
stakingEvent(); stakingEvent();
global.platform.openTab({ global.platform.openTab({
url: 'https://metamask-institutional.io/staking', url: 'https://metamask-institutional.io/stake',
}); });
}} }}
/> />
@ -117,7 +128,9 @@ const EthOverview = ({ className, showAddress }) => {
}; };
///: END:ONLY_INCLUDE_IN ///: END:ONLY_INCLUDE_IN
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
const { openBuyCryptoInPdapp } = useRamps(); const { openBuyCryptoInPdapp } = useRamps();
///: END:ONLY_INCLUDE_IN
return ( return (
<WalletOverview <WalletOverview

View File

@ -33,7 +33,9 @@ import {
MetaMetricsEventCategory, MetaMetricsEventCategory,
MetaMetricsContextProp, MetaMetricsContextProp,
} from '../../../../shared/constants/metametrics'; } from '../../../../shared/constants/metametrics';
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
import { getPortfolioUrl } from '../../../helpers/utils/portfolio'; import { getPortfolioUrl } from '../../../helpers/utils/portfolio';
///: END:ONLY_INCLUDE_IN
///: BEGIN:ONLY_INCLUDE_IN(build-mmi) ///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
import { import {
getMmiPortfolioEnabled, getMmiPortfolioEnabled,
@ -129,7 +131,10 @@ export const GlobalMenu = ({ closeMenu, anchorElement }) => {
category: MetaMetricsEventCategory.Navigation, category: MetaMetricsEventCategory.Navigation,
event: MetaMetricsEventName.MMIPortfolioButtonClicked, event: MetaMetricsEventName.MMIPortfolioButtonClicked,
}); });
window.open(mmiPortfolioUrl, '_blank'); window.open(
`${mmiPortfolioUrl}?metametricsId=${metaMetricsId}`,
'_blank',
);
closeMenu(); closeMenu();
}} }}
data-testid="global-menu-mmi-portfolio" data-testid="global-menu-mmi-portfolio"

View File

@ -1,17 +1,19 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Redirect, Route } from 'react-router-dom'; import { Redirect, Route } from 'react-router-dom';
///: BEGIN:ONLY_INCLUDE_IN(build-main)
// eslint-disable-next-line import/no-duplicates
import { MetaMetricsContextProp } from '../../../shared/constants/metametrics';
///: END:ONLY_INCLUDE_IN
import { import {
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-mmi)
MetaMetricsContextProp,
///: END:ONLY_INCLUDE_IN
MetaMetricsEventCategory, MetaMetricsEventCategory,
MetaMetricsEventName, MetaMetricsEventName,
// eslint-disable-next-line import/no-duplicates
} from '../../../shared/constants/metametrics'; } from '../../../shared/constants/metametrics';
import AssetList from '../../components/app/asset-list'; import AssetList from '../../components/app/asset-list';
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
import NftsTab from '../../components/app/nfts-tab'; import NftsTab from '../../components/app/nfts-tab';
import TermsOfUsePopup from '../../components/app/terms-of-use-popup';
import RecoveryPhraseReminder from '../../components/app/recovery-phrase-reminder';
///: END:ONLY_INCLUDE_IN
import HomeNotification from '../../components/app/home-notification'; import HomeNotification from '../../components/app/home-notification';
import MultipleNotifications from '../../components/app/multiple-notifications'; import MultipleNotifications from '../../components/app/multiple-notifications';
import TransactionList from '../../components/app/transaction-list'; import TransactionList from '../../components/app/transaction-list';
@ -22,8 +24,7 @@ import ConnectedAccounts from '../connected-accounts';
import { Tabs, Tab } from '../../components/ui/tabs'; import { Tabs, Tab } from '../../components/ui/tabs';
import { EthOverview } from '../../components/app/wallet-overview'; import { EthOverview } from '../../components/app/wallet-overview';
import WhatsNewPopup from '../../components/app/whats-new-popup'; import WhatsNewPopup from '../../components/app/whats-new-popup';
import TermsOfUsePopup from '../../components/app/terms-of-use-popup';
import RecoveryPhraseReminder from '../../components/app/recovery-phrase-reminder';
import ActionableMessage from '../../components/ui/actionable-message/actionable-message'; import ActionableMessage from '../../components/ui/actionable-message/actionable-message';
import { import {
FONT_WEIGHT, FONT_WEIGHT,
@ -62,7 +63,9 @@ import {
BUILD_QUOTE_ROUTE, BUILD_QUOTE_ROUTE,
VIEW_QUOTE_ROUTE, VIEW_QUOTE_ROUTE,
CONFIRMATION_V_NEXT_ROUTE, CONFIRMATION_V_NEXT_ROUTE,
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
ONBOARDING_SECURE_YOUR_WALLET_ROUTE, ONBOARDING_SECURE_YOUR_WALLET_ROUTE,
///: END:ONLY_INCLUDE_IN
///: BEGIN:ONLY_INCLUDE_IN(build-mmi) ///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
CONFIRM_ADD_CUSTODIAN_TOKEN, CONFIRM_ADD_CUSTODIAN_TOKEN,
INTERACTIVE_REPLACEMENT_TOKEN_PAGE, INTERACTIVE_REPLACEMENT_TOKEN_PAGE,
@ -118,15 +121,29 @@ export default class Home extends PureComponent {
hasTransactionPendingApprovals: PropTypes.bool.isRequired, hasTransactionPendingApprovals: PropTypes.bool.isRequired,
hasWatchTokenPendingApprovals: PropTypes.bool, hasWatchTokenPendingApprovals: PropTypes.bool,
hasWatchNftPendingApprovals: PropTypes.bool, hasWatchNftPendingApprovals: PropTypes.bool,
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
shouldShowSeedPhraseReminder: PropTypes.bool.isRequired, shouldShowSeedPhraseReminder: PropTypes.bool.isRequired,
isPopup: PropTypes.bool, isPopup: PropTypes.bool,
connectedStatusPopoverHasBeenShown: PropTypes.bool,
showRecoveryPhraseReminder: PropTypes.bool.isRequired,
showTermsOfUsePopup: PropTypes.bool.isRequired,
seedPhraseBackedUp: (props) => {
if (
props.seedPhraseBackedUp !== null &&
typeof props.seedPhraseBackedUp !== 'boolean'
) {
throw new Error(
`seedPhraseBackedUp is required to be null or boolean. Received ${props.seedPhraseBackedUp}`,
);
}
},
///: END:ONLY_INCLUDE_IN
isNotification: PropTypes.bool.isRequired, isNotification: PropTypes.bool.isRequired,
firstPermissionsRequestId: PropTypes.string, firstPermissionsRequestId: PropTypes.string,
// This prop is used in the `shouldCloseNotificationPopup` function // This prop is used in the `shouldCloseNotificationPopup` function
// eslint-disable-next-line react/no-unused-prop-types // eslint-disable-next-line react/no-unused-prop-types
totalUnapprovedCount: PropTypes.number.isRequired, totalUnapprovedCount: PropTypes.number.isRequired,
setConnectedStatusPopoverHasBeenShown: PropTypes.func, setConnectedStatusPopoverHasBeenShown: PropTypes.func,
connectedStatusPopoverHasBeenShown: PropTypes.bool,
defaultHomeActiveTabName: PropTypes.string, defaultHomeActiveTabName: PropTypes.string,
firstTimeFlowType: PropTypes.string, firstTimeFlowType: PropTypes.string,
completedOnboarding: PropTypes.bool, completedOnboarding: PropTypes.bool,
@ -143,29 +160,17 @@ export default class Home extends PureComponent {
infuraBlocked: PropTypes.bool.isRequired, infuraBlocked: PropTypes.bool.isRequired,
showWhatsNewPopup: PropTypes.bool.isRequired, showWhatsNewPopup: PropTypes.bool.isRequired,
hideWhatsNewPopup: PropTypes.func.isRequired, hideWhatsNewPopup: PropTypes.func.isRequired,
showTermsOfUsePopup: PropTypes.bool.isRequired,
announcementsToShow: PropTypes.bool.isRequired, announcementsToShow: PropTypes.bool.isRequired,
///: BEGIN:ONLY_INCLUDE_IN(snaps) ///: BEGIN:ONLY_INCLUDE_IN(snaps)
errorsToShow: PropTypes.object.isRequired, errorsToShow: PropTypes.object.isRequired,
shouldShowErrors: PropTypes.bool.isRequired, shouldShowErrors: PropTypes.bool.isRequired,
removeSnapError: PropTypes.func.isRequired, removeSnapError: PropTypes.func.isRequired,
///: END:ONLY_INCLUDE_IN ///: END:ONLY_INCLUDE_IN
showRecoveryPhraseReminder: PropTypes.bool.isRequired,
setRecoveryPhraseReminderHasBeenShown: PropTypes.func.isRequired, setRecoveryPhraseReminderHasBeenShown: PropTypes.func.isRequired,
setRecoveryPhraseReminderLastShown: PropTypes.func.isRequired, setRecoveryPhraseReminderLastShown: PropTypes.func.isRequired,
setTermsOfUseLastAgreed: PropTypes.func.isRequired, setTermsOfUseLastAgreed: PropTypes.func.isRequired,
showOutdatedBrowserWarning: PropTypes.bool.isRequired, showOutdatedBrowserWarning: PropTypes.bool.isRequired,
setOutdatedBrowserWarningLastShown: PropTypes.func.isRequired, setOutdatedBrowserWarningLastShown: PropTypes.func.isRequired,
seedPhraseBackedUp: (props) => {
if (
props.seedPhraseBackedUp !== null &&
typeof props.seedPhraseBackedUp !== 'boolean'
) {
throw new Error(
`seedPhraseBackedUp is required to be null or boolean. Received ${props.seedPhraseBackedUp}`,
);
}
},
newNetworkAddedName: PropTypes.string, newNetworkAddedName: PropTypes.string,
// This prop is used in the `shouldCloseNotificationPopup` function // This prop is used in the `shouldCloseNotificationPopup` function
// eslint-disable-next-line react/no-unused-prop-types // eslint-disable-next-line react/no-unused-prop-types
@ -372,9 +377,11 @@ export default class Home extends PureComponent {
const { t } = this.context; const { t } = this.context;
const { const {
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
history, history,
shouldShowSeedPhraseReminder, shouldShowSeedPhraseReminder,
isPopup, isPopup,
///: END:ONLY_INCLUDE_IN
shouldShowWeb3ShimUsageNotification, shouldShowWeb3ShimUsageNotification,
setWeb3ShimUsageAlertDismissed, setWeb3ShimUsageAlertDismissed,
originOfCurrentTab, originOfCurrentTab,
@ -719,14 +726,16 @@ export default class Home extends PureComponent {
onTabClick, onTabClick,
forgottenPassword, forgottenPassword,
history, history,
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
connectedStatusPopoverHasBeenShown, connectedStatusPopoverHasBeenShown,
isPopup, isPopup,
seedPhraseBackedUp,
showRecoveryPhraseReminder,
showTermsOfUsePopup,
///: END:ONLY_INCLUDE_IN
announcementsToShow, announcementsToShow,
showWhatsNewPopup, showWhatsNewPopup,
hideWhatsNewPopup, hideWhatsNewPopup,
showTermsOfUsePopup,
seedPhraseBackedUp,
showRecoveryPhraseReminder,
firstTimeFlowType, firstTimeFlowType,
completedOnboarding, completedOnboarding,
onboardedInThisUISession, onboardedInThisUISession,
@ -751,8 +760,10 @@ export default class Home extends PureComponent {
!process.env.IN_TEST && !process.env.IN_TEST &&
!newNetworkAddedConfigurationId; !newNetworkAddedConfigurationId;
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
const showTermsOfUse = const showTermsOfUse =
completedOnboarding && !onboardedInThisUISession && showTermsOfUsePopup; completedOnboarding && !onboardedInThisUISession && showTermsOfUsePopup;
///: END:ONLY_INCLUDE_IN
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-mmi) ///: BEGIN:ONLY_INCLUDE_IN(build-main,build-mmi)
// The style in activity screen for support is different // The style in activity screen for support is different

View File

@ -3507,15 +3507,15 @@ export function resolvePendingApproval(
id: string, id: string,
value: unknown, value: unknown,
): ThunkAction<void, MetaMaskReduxState, unknown, AnyAction> { ): ThunkAction<void, MetaMaskReduxState, unknown, AnyAction> {
return async (dispatch: MetaMaskReduxDispatch) => { return async (_dispatch: MetaMaskReduxDispatch) => {
await submitRequestToBackground('resolvePendingApproval', [id, value]); await submitRequestToBackground('resolvePendingApproval', [id, value]);
// Before closing the current window, check if any additional confirmations // Before closing the current window, check if any additional confirmations
// are added as a result of this confirmation being accepted // are added as a result of this confirmation being accepted
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask) ///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
const { pendingApprovals } = await forceUpdateMetamaskState(dispatch); const { pendingApprovals } = await forceUpdateMetamaskState(_dispatch);
if (Object.values(pendingApprovals).length === 0) { if (Object.values(pendingApprovals).length === 0) {
dispatch(closeCurrentNotificationWindow()); _dispatch(closeCurrentNotificationWindow());
} }
///: END:ONLY_INCLUDE_IN ///: END:ONLY_INCLUDE_IN
}; };