From 19d5cdb014e948adc117bee6714ecb65a49c8617 Mon Sep 17 00:00:00 2001 From: David Walsh Date: Tue, 18 Jul 2023 08:31:02 -0500 Subject: [PATCH 001/377] UX: Remove unwanted async callback (#20065) --- ui/components/multichain/network-list-menu/network-list-menu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/components/multichain/network-list-menu/network-list-menu.js b/ui/components/multichain/network-list-menu/network-list-menu.js index dd9278bc1238..ab3ad899c6d6 100644 --- a/ui/components/multichain/network-list-menu/network-list-menu.js +++ b/ui/components/multichain/network-list-menu/network-list-menu.js @@ -95,7 +95,7 @@ export const NetworkListMenu = ({ onClose }) => { iconSrc={network?.rpcPrefs?.imageUrl} key={`${network.id || network.chainId}-${index}`} selected={isCurrentNetwork} - onClick={async () => { + onClick={() => { dispatch(toggleNetworkMenu()); if (network.providerType) { dispatch(setProviderType(network.providerType)); From e105a6030efc7d541cd2f3b3f6ca6087ff0b8d2c Mon Sep 17 00:00:00 2001 From: Nidhi Kumari Date: Tue, 18 Jul 2023 19:02:00 +0530 Subject: [PATCH 002/377] added background color of testnet to activity screen (#20068) --- .../transaction-list-item/transaction-list-item.component.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/components/app/transaction-list-item/transaction-list-item.component.js b/ui/components/app/transaction-list-item/transaction-list-item.component.js index a8b6045fd838..ec8f1ed1a220 100644 --- a/ui/components/app/transaction-list-item/transaction-list-item.component.js +++ b/ui/components/app/transaction-list-item/transaction-list-item.component.js @@ -51,6 +51,7 @@ import { import { checkNetworkAndAccountSupports1559, getCurrentNetwork, + getTestNetworkBackgroundColor, } from '../../../selectors'; import { isLegacyTransaction } from '../../../helpers/utils/transactions.util'; import { formatDateWithYearContext } from '../../../helpers/utils/util'; @@ -77,6 +78,7 @@ function TransactionListItemInner({ const [showRetryEditGasPopover, setShowRetryEditGasPopover] = useState(false); const { supportsEIP1559 } = useGasFeeContext(); const { openModal } = useTransactionModalContext(); + const testNetworkBackgroundColor = useSelector(getTestNetworkBackgroundColor); const { initialTransaction: { id }, @@ -276,6 +278,7 @@ function TransactionListItemInner({ src={currentChain?.rpcPrefs?.imageUrl} borderWidth={1} borderColor={BackgroundColor.backgroundDefault} + backgroundColor={testNetworkBackgroundColor} /> } > From f8bfb6cff5fd92d30cfadc85c6b42ba4627c0014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B3nio=20Regadas?= Date: Tue, 18 Jul 2023 14:55:37 +0100 Subject: [PATCH 003/377] [MMI] adds segment events to Metametrics constants (#19468) * adds metametrics enums * prettier * adds necessary code fence * edits events names and title cases them * edits events names * updates events according to segment-schema --- shared/constants/metametrics.ts | 17 +++++++++---- .../signature-request.component.js | 11 ++++++--- .../app/wallet-overview/eth-overview.js | 8 +++---- .../custody-confirm-link-modal.js | 2 +- .../interactive-replacement-token-modal.js | 8 +++++-- .../account-list-menu/account-list-menu.js | 2 +- .../multichain/global-menu/global-menu.js | 2 +- .../confirm-add-custodian-token.js | 16 ++++++++----- .../confirm-add-institutional-feature.js | 8 +++++-- ui/pages/institutional/custody/custody.js | 24 +++++++++++-------- 10 files changed, 64 insertions(+), 34 deletions(-) diff --git a/shared/constants/metametrics.ts b/shared/constants/metametrics.ts index 453ba97ea0c7..f69a091691b5 100644 --- a/shared/constants/metametrics.ts +++ b/shared/constants/metametrics.ts @@ -583,10 +583,19 @@ export enum MetaMetricsEventName { WalletSetupFailed = 'Wallet Setup Failed', WalletCreated = 'Wallet Created', ///: BEGIN:ONLY_INCLUDE_IN(build-mmi) - UserClickedDeepLink = 'User Clicked Deeplink', - UserClickedConnectCustodialAccount = 'Clicked Connect Custodial Account', - UserClickedPortfolioButton = 'Clicked Portfolio Button', - UserClickedCompliance = 'Clicked Compliance', + DeeplinkClicked = 'Deeplink Clicked', + ConnectCustodialAccountClicked = 'Connect Custodial Account Clicked', + MMIPortfolioButtonClicked = 'MMI Portfolio Button Clicked', + StakeButtonClicked = 'Stake Button Clicked', + ComplianceButtonClicked = 'Compliance Button Clicked', + RefreshTokenListClicked = 'Refresh Token List Clicked', + SignatureDeeplinkDisplayed = 'Signature Deeplink Displayed', + InstitutionalFeatureConnected = 'Institutional Feature Connected', + CustodianSelected = 'Custodian Selected', + CustodianConnected = 'Custodian Connected', + CustodianConnectionCanceled = 'Custodian Connection Canceled', + CustodianConnectionFailed = 'Custodian Connection Failed', + CustodialAccountsConnected = 'Custodial Accounts Connected', ///: END:ONLY_INCLUDE_IN AccountDetailMenuOpened = 'Account Details Menu Opened', BlockExplorerLinkClicked = 'Block Explorer Clicked', diff --git a/ui/components/app/signature-request/signature-request.component.js b/ui/components/app/signature-request/signature-request.component.js index 601d73e3507c..f5eda00e9c00 100644 --- a/ui/components/app/signature-request/signature-request.component.js +++ b/ui/components/app/signature-request/signature-request.component.js @@ -11,7 +11,12 @@ import { shortenAddress, ///: END:ONLY_INCLUDE_IN } from '../../../helpers/utils/util'; -import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics'; +import { + MetaMetricsEventCategory, + ///: BEGIN:ONLY_INCLUDE_IN(build-mmi) + MetaMetricsEventName, + ///: END:ONLY_INCLUDE_IN +} from '../../../../shared/constants/metametrics'; import SiteOrigin from '../../ui/site-origin'; import Button from '../../ui/button'; import ContractDetailsModal from '../modals/contract-details-modal/contract-details-modal'; @@ -121,8 +126,8 @@ export default class SignatureRequest extends PureComponent { onDeepLinkFetched: () => undefined, onDeepLinkShown: () => { this.context.trackEvent({ - category: 'MMI', - event: 'Show deeplink for signature', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.SignatureDeeplinkDisplayed, }); }, }); diff --git a/ui/components/app/wallet-overview/eth-overview.js b/ui/components/app/wallet-overview/eth-overview.js index 4cafa05149d2..30133118227b 100644 --- a/ui/components/app/wallet-overview/eth-overview.js +++ b/ui/components/app/wallet-overview/eth-overview.js @@ -73,15 +73,15 @@ const EthOverview = ({ className, showAddress }) => { const portfolioEvent = () => { trackEvent({ - category: 'Navigation', - event: 'Clicked Portfolio Button', + category: MetaMetricsEventCategory.Navigation, + event: MetaMetricsEventName.MMIPortfolioButtonClicked, }); }; const stakingEvent = () => { trackEvent({ - category: 'Navigation', - event: 'Clicked Stake Button', + category: MetaMetricsEventCategory.Navigation, + event: MetaMetricsEventName.MMIPortfolioButtonClicked, }); }; diff --git a/ui/components/institutional/custody-confirm-link-modal/custody-confirm-link-modal.js b/ui/components/institutional/custody-confirm-link-modal/custody-confirm-link-modal.js index e7d0c4d5bc90..f4c15c41266e 100644 --- a/ui/components/institutional/custody-confirm-link-modal/custody-confirm-link-modal.js +++ b/ui/components/institutional/custody-confirm-link-modal/custody-confirm-link-modal.js @@ -70,7 +70,7 @@ const CustodyConfirmLink = ({ hideModal }) => { trackEvent({ category: MetaMetricsEventCategory.MMI, - event: MetaMetricsEventName.UserClickedDeepLink, + event: MetaMetricsEventName.DeeplinkClicked, }); dispatch(mmiActions.setWaitForConfirmDeepLinkDialog(false)); dispatch(hideModal()); diff --git a/ui/components/institutional/interactive-replacement-token-modal/interactive-replacement-token-modal.js b/ui/components/institutional/interactive-replacement-token-modal/interactive-replacement-token-modal.js index 232f4817f5f8..eae1529f2add 100644 --- a/ui/components/institutional/interactive-replacement-token-modal/interactive-replacement-token-modal.js +++ b/ui/components/institutional/interactive-replacement-token-modal/interactive-replacement-token-modal.js @@ -26,6 +26,10 @@ import { TextAlign, AlignItems, } from '../../../helpers/constants/design-system'; +import { + MetaMetricsEventCategory, + MetaMetricsEventName, +} from '../../../../shared/constants/metametrics'; const InteractiveReplacementTokenModal = () => { const t = useI18nContext(); @@ -55,8 +59,8 @@ const InteractiveReplacementTokenModal = () => { }); trackEvent({ - category: 'MMI', - event: 'User clicked refresh token link', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.ComplianceButtonClicked, }); }; diff --git a/ui/components/multichain/account-list-menu/account-list-menu.js b/ui/components/multichain/account-list-menu/account-list-menu.js index 80c1b91f4927..6f3935e4dfe8 100644 --- a/ui/components/multichain/account-list-menu/account-list-menu.js +++ b/ui/components/multichain/account-list-menu/account-list-menu.js @@ -298,7 +298,7 @@ export const AccountListMenu = ({ onClose }) => { trackEvent({ category: MetaMetricsEventCategory.Navigation, event: - MetaMetricsEventName.UserClickedConnectCustodialAccount, + MetaMetricsEventName.ConnectCustodialAccountClicked, }); if (getEnvironmentType() === ENVIRONMENT_TYPE_POPUP) { global.platform.openExtensionInBrowser( diff --git a/ui/components/multichain/global-menu/global-menu.js b/ui/components/multichain/global-menu/global-menu.js index 350f159471cd..1de3222acc1b 100644 --- a/ui/components/multichain/global-menu/global-menu.js +++ b/ui/components/multichain/global-menu/global-menu.js @@ -113,7 +113,7 @@ export const GlobalMenu = ({ closeMenu, anchorElement }) => { onClick={() => { trackEvent({ category: MetaMetricsEventCategory.Navigation, - event: MetaMetricsEventName.UserClickedPortfolioButton, + event: MetaMetricsEventName.MMIPortfolioButtonClicked, }); window.open(mmiPortfolioUrl, '_blank'); closeMenu(); diff --git a/ui/pages/institutional/confirm-add-custodian-token/confirm-add-custodian-token.js b/ui/pages/institutional/confirm-add-custodian-token/confirm-add-custodian-token.js index 4f0257e77bdc..f49144ac4cdb 100644 --- a/ui/pages/institutional/confirm-add-custodian-token/confirm-add-custodian-token.js +++ b/ui/pages/institutional/confirm-add-custodian-token/confirm-add-custodian-token.js @@ -26,6 +26,10 @@ import { Box, } from '../../../components/component-library'; import { Text } from '../../../components/component-library/text/deprecated'; +import { + MetaMetricsEventCategory, + MetaMetricsEventName, +} from '../../../../shared/constants/metametrics'; import { complianceActivated, getInstitutionalConnectRequests, @@ -59,8 +63,8 @@ const ConfirmAddCustodianToken = () => { } trackEvent({ - category: 'MMI', - event: 'Custodian onboarding', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.TokenAdded, properties: { actions: 'Custodian RPC request', custodian: connectRequest.custodian, @@ -184,8 +188,8 @@ const ConfirmAddCustodianToken = () => { ); trackEvent({ - category: 'MMI', - event: 'Custodian onboarding', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.TokenAdded, properties: { actions: 'Custodian RPC cancel', custodian: connectRequest.custodian, @@ -238,8 +242,8 @@ const ConfirmAddCustodianToken = () => { ); trackEvent({ - category: 'MMI', - event: 'Custodian onboarding', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.TokenAdded, properties: { actions: 'Custodian RPC confirm', custodian: connectRequest.custodian, diff --git a/ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.js b/ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.js index 627f7acb3275..bc528a094fca 100644 --- a/ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.js +++ b/ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.js @@ -21,6 +21,10 @@ import { } from '../../../helpers/constants/design-system'; import Box from '../../../components/ui/box'; import { mmiActionsFactory } from '../../../store/institutional/institution-background'; +import { + MetaMetricsEventCategory, + MetaMetricsEventName, +} from '../../../../shared/constants/metametrics'; export default function ConfirmAddInstitutionalFeature({ history }) { const t = useI18nContext(); @@ -52,8 +56,8 @@ export default function ConfirmAddInstitutionalFeature({ history }) { const sendEvent = ({ actions, service }) => { trackEvent({ - category: 'MMI', - event: 'Institutional feature connection', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.InstitutionalFeatureConnected, properties: { actions, service, diff --git a/ui/pages/institutional/custody/custody.js b/ui/pages/institutional/custody/custody.js index d9825ead94ef..f5e5734542e1 100644 --- a/ui/pages/institutional/custody/custody.js +++ b/ui/pages/institutional/custody/custody.js @@ -44,6 +44,10 @@ import { getCurrentChainId, getSelectedAddress } from '../../../selectors'; import { getMMIConfiguration } from '../../../selectors/institutional/selectors'; import CustodyAccountList from '../connect-custody/account-list'; import JwtUrlForm from '../../../components/institutional/jwt-url-form'; +import { + MetaMetricsEventCategory, + MetaMetricsEventName, +} from '../../../../shared/constants/metametrics'; import PulseLoader from '../../../components/ui/pulse-loader/pulse-loader'; const CustodyPage = () => { @@ -141,8 +145,8 @@ const CustodyPage = () => { setCurrentJwt(jwtListValue[0] || ''); setJwtList(jwtListValue); trackEvent({ - category: 'MMI', - event: 'Custodian Selected', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.CustodianSelected, properties: { custodian: custodian.name, }, @@ -192,8 +196,8 @@ const CustodyPage = () => { `Something went wrong connecting your custodian account. Error details: ${errorMessage}`, ); trackEvent({ - category: 'MMI', - event: 'Connect to custodian error', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.CustodianConnectionFailed, properties: { custodian: selectedCustodianName, }, @@ -225,8 +229,8 @@ const CustodyPage = () => { setAccounts(accountsValue); trackEvent({ - category: 'MMI', - event: 'Connect to custodian', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.CustodianConnected, properties: { custodian: selectedCustodianName, apiUrl, @@ -553,8 +557,8 @@ const CustodyPage = () => { ); trackEvent({ - category: 'MMI', - event: 'Custodial accounts connected', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.CustodialAccountsConnected, properties: { custodian: selectedCustodianName, numberOfAccounts: Object.keys(selectedAccounts).length, @@ -588,8 +592,8 @@ const CustodyPage = () => { } trackEvent({ - category: 'MMI', - event: 'Connect to custodian cancel', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.CustodianConnectionCanceled, properties: { custodian: selectedCustodianName, numberOfAccounts: Object.keys(selectedAccounts).length, From a8716db6943cfe5e594085b1771d0f87e766fbdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Oliv=C3=A9?= Date: Tue, 18 Jul 2023 15:58:33 +0200 Subject: [PATCH 004/377] [MMI] Fix wrong custody logo location (#20072) * Added missing styles * updated snapshots * fixed snapshot * updated snapshot --- .../__snapshots__/app-header.test.js.snap | 2 +- .../multichain/app-header/app-header.scss | 14 ++++++++++++++ .../metafox-logo.component.test.js.snap | 6 +++--- .../ui/metafox-logo/metafox-logo.component.js | 2 +- .../onboarding-app-header.test.js.snap | 2 +- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/ui/components/multichain/app-header/__snapshots__/app-header.test.js.snap b/ui/components/multichain/app-header/__snapshots__/app-header.test.js.snap index 0687107d4427..fc0fc5c4bde4 100644 --- a/ui/components/multichain/app-header/__snapshots__/app-header.test.js.snap +++ b/ui/components/multichain/app-header/__snapshots__/app-header.test.js.snap @@ -7,7 +7,7 @@ exports[`App Header should match snapshot 1`] = ` data-testid="app-header-logo" >

[complianceBlurb0]

[complianceBlurb1]

[complianceBlurpStep0]

diff --git a/ui/components/institutional/compliance-modal/compliance-modal.js b/ui/components/institutional/compliance-modal/compliance-modal.js index 5c3805c56fd1..629cf330f6ba 100644 --- a/ui/components/institutional/compliance-modal/compliance-modal.js +++ b/ui/components/institutional/compliance-modal/compliance-modal.js @@ -3,14 +3,20 @@ import { useDispatch } from 'react-redux'; import { useI18nContext } from '../../../hooks/useI18nContext'; import { hideModal } from '../../../store/actions'; import Modal from '../../app/modal'; -import Box from '../../ui/box'; -import { ButtonIcon, IconSize, IconName } from '../../component-library'; -import { Text } from '../../component-library/text/deprecated'; + +import { + ButtonIcon, + IconSize, + IconName, + Text, + Box, +} from '../../component-library'; + import { AlignItems, JustifyContent, TextColor, - DISPLAY, + Display, } from '../../../helpers/constants/design-system'; const ComplianceModal = () => { @@ -35,11 +41,11 @@ const ComplianceModal = () => { diff --git a/ui/components/institutional/compliance-settings/__snapshots__/compliance-settings.test.js.snap b/ui/components/institutional/compliance-settings/__snapshots__/compliance-settings.test.js.snap index 52b06d34b23b..ff4e3a70ca67 100644 --- a/ui/components/institutional/compliance-settings/__snapshots__/compliance-settings.test.js.snap +++ b/ui/components/institutional/compliance-settings/__snapshots__/compliance-settings.test.js.snap @@ -3,15 +3,15 @@ exports[`Compliance Settings shows disconnect when Compliance is activated 1`] = `
Change your settings or view reports by opening up Codefi Compliance or disconnect below.