From 26225aabe041570cdfda1687632afc2adddb7421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Oliv=C3=A9?= Date: Thu, 20 Jul 2023 10:11:14 +0200 Subject: [PATCH] =?UTF-8?q?[MMI]=C2=A0Removed=20compliance=20feature=20fro?= =?UTF-8?q?m=20the=20codebase=20(#20088)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/_locales/en/messages.json | 81 ------- app/scripts/controllers/mmi-controller.js | 9 - app/scripts/metamask-controller.js | 24 -- shared/constants/metametrics.ts | 2 +- ui/components/app/app-components.scss | 3 +- ui/components/app/modals/index.scss | 4 +- ui/components/app/modals/modal.js | 31 --- .../component-library/icon/icon.types.ts | 1 - .../compliance-details-modal.js | 36 --- .../compliance-details-modal.test.js | 31 --- .../compliance-details-modal/index.js | 1 - .../compliance-details-modal/index.scss | 3 - .../compliance-details.test.js.snap | 146 ------------ .../compliance-details/compliance-details.js | 159 ------------- .../compliance-details.stories.js | 48 ---- .../compliance-details.test.js | 67 ------ .../institutional/compliance-details/index.js | 1 - .../compliance-details/index.scss | 5 - .../compliance-modal.test.js.snap | 93 -------- .../compliance-modal/compliance-modal.js | 95 -------- .../compliance-modal.stories.js | 22 -- .../compliance-modal/compliance-modal.test.js | 55 ----- .../institutional/compliance-modal/index.js | 1 - .../institutional/compliance-modal/index.scss | 6 - .../compliance-settings.test.js.snap | 92 -------- .../compliance-settings.js | 114 --------- .../compliance-settings.stories.js | 34 --- .../compliance-settings.test.js | 67 ------ .../compliance-settings/index.js | 1 - .../compliance-settings/index.scss | 19 -- .../institutional-components.scss | 2 - .../interactive-replacement-token-modal.js | 2 +- ui/ducks/institutional/institutional.js | 93 +------- ui/ducks/institutional/institutional.test.js | 48 +--- ui/helpers/constants/routes.ts | 8 - ui/pages/home/home.component.js | 9 +- .../compliance-feature-page.js | 95 -------- .../compliance-feature-page.stories.js | 35 --- .../compliance-feature-page.test.js | 107 --------- .../compliance-feature-page/index.js | 1 - .../compliance-feature-page/index.scss | 29 --- .../confirm-add-custodian-token.js | 18 +- .../confirm-add-custodian-token.stories.js | 1 - .../confirm-add-custodian-token.test.js | 2 - ...irm-add-institutional-feature.test.js.snap | 69 ------ .../confirm-add-institutional-feature.js | 217 ------------------ ...nfirm-add-institutional-feature.stories.js | 57 ----- .../confirm-add-institutional-feature.test.js | 122 ---------- .../index.js | 3 - ...eractive-replacement-token-page.stories.js | 1 - ...interactive-replacement-token-page.test.js | 6 - ui/pages/pages.scss | 5 +- ui/pages/routes/routes.component.js | 12 - .../institution-background.test.js | 24 -- .../institutional/institution-background.ts | 18 -- 55 files changed, 18 insertions(+), 2217 deletions(-) delete mode 100644 ui/components/institutional/compliance-details-modal/compliance-details-modal.js delete mode 100644 ui/components/institutional/compliance-details-modal/compliance-details-modal.test.js delete mode 100644 ui/components/institutional/compliance-details-modal/index.js delete mode 100644 ui/components/institutional/compliance-details-modal/index.scss delete mode 100644 ui/components/institutional/compliance-details/__snapshots__/compliance-details.test.js.snap delete mode 100644 ui/components/institutional/compliance-details/compliance-details.js delete mode 100644 ui/components/institutional/compliance-details/compliance-details.stories.js delete mode 100644 ui/components/institutional/compliance-details/compliance-details.test.js delete mode 100644 ui/components/institutional/compliance-details/index.js delete mode 100644 ui/components/institutional/compliance-details/index.scss delete mode 100644 ui/components/institutional/compliance-modal/__snapshots__/compliance-modal.test.js.snap delete mode 100644 ui/components/institutional/compliance-modal/compliance-modal.js delete mode 100644 ui/components/institutional/compliance-modal/compliance-modal.stories.js delete mode 100644 ui/components/institutional/compliance-modal/compliance-modal.test.js delete mode 100644 ui/components/institutional/compliance-modal/index.js delete mode 100644 ui/components/institutional/compliance-modal/index.scss delete mode 100644 ui/components/institutional/compliance-settings/__snapshots__/compliance-settings.test.js.snap delete mode 100644 ui/components/institutional/compliance-settings/compliance-settings.js delete mode 100644 ui/components/institutional/compliance-settings/compliance-settings.stories.js delete mode 100644 ui/components/institutional/compliance-settings/compliance-settings.test.js delete mode 100644 ui/components/institutional/compliance-settings/index.js delete mode 100644 ui/components/institutional/compliance-settings/index.scss delete mode 100644 ui/pages/institutional/compliance-feature-page/compliance-feature-page.js delete mode 100644 ui/pages/institutional/compliance-feature-page/compliance-feature-page.stories.js delete mode 100644 ui/pages/institutional/compliance-feature-page/compliance-feature-page.test.js delete mode 100644 ui/pages/institutional/compliance-feature-page/index.js delete mode 100644 ui/pages/institutional/compliance-feature-page/index.scss delete mode 100644 ui/pages/institutional/confirm-add-institutional-feature/__snapshots__/confirm-add-institutional-feature.test.js.snap delete mode 100644 ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.js delete mode 100644 ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.stories.js delete mode 100644 ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.test.js delete mode 100644 ui/pages/institutional/confirm-add-institutional-feature/index.js diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 567e7ca3f..ea2738348 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -153,9 +153,6 @@ "accountSelectionRequired": { "message": "You need to select an account!" }, - "activated": { - "message": "Active" - }, "active": { "message": "Active" }, @@ -376,9 +373,6 @@ "message": "Allow $1 to withdraw and spend up to the following amount:", "description": "The url of the site that requested permission to 'withdraw and spend'" }, - "amlCompliance": { - "message": "AML/CFT Compliance" - }, "amount": { "message": "Amount" }, @@ -676,45 +670,9 @@ "close": { "message": "Close" }, - "codefiCompliance": { - "message": "Codefi Compliance" - }, "coingecko": { "message": "CoinGecko" }, - "complianceActivatedDesc": { - "message": "You can now use compliance in MetaMask Institutional. Receiving AML/CFT analysis within the confirmation screen on all the addresses you interact with." - }, - "complianceActivatedTitle": { - "message": "Your compliance feature is activated" - }, - "complianceBlurb0": { - "message": "DeFi raises AML/CFT risk for institutions, given the decentralised pools and pseudonymous counterparties." - }, - "complianceBlurb1": { - "message": "Codefi Compliance is the only product capable of running AML/CFT analysis on DeFi pools. This allows you to identify and avoid pools and counterparties that fail your risk setting." - }, - "complianceBlurbStep1": { - "message": "Sign up to Codefi Compliance below" - }, - "complianceBlurbStep2": { - "message": "Create an organisation" - }, - "complianceBlurbStep3": { - "message": "Create a project" - }, - "complianceBlurbStep4": { - "message": "Set your compliance settings" - }, - "complianceBlurbStep5": { - "message": "Click the \"Enable Compliance in MMI\" button" - }, - "complianceBlurpStep0": { - "message": "Steps to enable AML/CFT Compliance:" - }, - "complianceSettingsExplanation": { - "message": "Change your settings or view reports by opening up Codefi Compliance or disconnect below." - }, "configureSnapPopupDescription": { "message": "You're now leaving MetaMask to configure this snap." }, @@ -838,9 +796,6 @@ "connectingToSepolia": { "message": "Connecting to Sepolia test network" }, - "connectionError": { - "message": "Connection error" - }, "connectionFailed": { "message": "Connection failed" }, @@ -1974,9 +1929,6 @@ "message": "Installed on $1", "description": "$1 is the date when the snap has been installed" }, - "institutionalFeatures": { - "message": "Institutional Features" - }, "insufficientBalance": { "message": "Insufficient balance." }, @@ -2315,9 +2267,6 @@ "mmiAddToken": { "message": "The page at $1 would like to authorise the following custodian token in MetaMask Institutional" }, - "mmiAuthenticate": { - "message": "The page at $1 would like to authorise the following project’s compliance settings in MetaMask Institutional" - }, "mmiBuiltAroundTheWorld": { "message": "MetaMask Institutional is designed and built around the world." }, @@ -2544,9 +2493,6 @@ "noNFTs": { "message": "No NFTs yet" }, - "noReport": { - "message": "No Report" - }, "noSnaps": { "message": "You don't have any snaps installed." }, @@ -2988,9 +2934,6 @@ "onlyConnectTrust": { "message": "Only connect with sites you trust." }, - "openCodefiCompliance": { - "message": "Open Codefi Compliance" - }, "openFullScreenForLedgerWebHid": { "message": "Go to full screen to connect your Ledger.", "description": "Shown to the user on the confirm screen when they are viewing MetaMask in a popup window but need to connect their ledger via webhid." @@ -3326,12 +3269,6 @@ "proceedWithTransaction": { "message": "I want to proceed anyway" }, - "projectIdInvalid": { - "message": "Provided Project ID is invalid" - }, - "projectName": { - "message": "Project Name" - }, "proposedApprovalLimit": { "message": "Proposed approval limit" }, @@ -3450,12 +3387,6 @@ "replace": { "message": "replace" }, - "reportLastRun": { - "message": "Report last run" - }, - "reportLastRunTooltip": { - "message": "The date and time of when the last AML/CFT report was run" - }, "requestFlaggedAsMaliciousFallbackCopyReason": { "message": "The security provider has not shared additional details" }, @@ -3594,18 +3525,9 @@ "revokeSpendingCapTooltipText": { "message": "This third party will be unable to spend any more of your current or future tokens." }, - "riskRating": { - "message": "Risk rating" - }, - "riskRatingTooltip": { - "message": "The risk rating of the address you are interacting with based on your risk settings" - }, "rpcUrl": { "message": "New RPC URL" }, - "runReport": { - "message": "Run report" - }, "safeTransferFrom": { "message": "Safe transfer from" }, @@ -3830,9 +3752,6 @@ "showPrivateKeys": { "message": "Show Private Keys" }, - "showReport": { - "message": "Show report" - }, "showTestnetNetworks": { "message": "Show test networks" }, diff --git a/app/scripts/controllers/mmi-controller.js b/app/scripts/controllers/mmi-controller.js index 0ed4deaae..04694b716 100644 --- a/app/scripts/controllers/mmi-controller.js +++ b/app/scripts/controllers/mmi-controller.js @@ -225,15 +225,6 @@ export default class MMIController extends EventEmitter { ) { this.transactionUpdateController.getCustomerProofForAddresses(addresses); } - - try { - if (this.institutionalFeaturesController.getComplianceProjectId()) { - this.institutionalFeaturesController.startPolling(); - } - } catch (e) { - log.error('Failed to start Compliance polling'); - log.error(e); - } } async connectCustodyAddresses(custodianType, custodianName, accounts) { diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index eaeb27816..d0e5a2f43 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -2471,30 +2471,6 @@ export default class MetamaskController extends EventEmitter { this.mmiConfigurationController.getConfiguration.bind( this.mmiConfigurationController, ), - setComplianceAuthData: - this.institutionalFeaturesController.setComplianceAuthData.bind( - this.institutionalFeaturesController, - ), - deleteComplianceAuthData: - this.institutionalFeaturesController.deleteComplianceAuthData.bind( - this.institutionalFeaturesController, - ), - generateComplianceReport: - this.institutionalFeaturesController.generateComplianceReport.bind( - this.institutionalFeaturesController, - ), - syncReportsInProgress: - this.institutionalFeaturesController.syncReportsInProgress.bind( - this.institutionalFeaturesController, - ), - removeConnectInstitutionalFeature: - this.institutionalFeaturesController.removeConnectInstitutionalFeature.bind( - this.institutionalFeaturesController, - ), - getComplianceHistoricalReportsByAddress: - this.institutionalFeaturesController.getComplianceHistoricalReportsByAddress.bind( - this.institutionalFeaturesController, - ), removeAddTokenConnectRequest: this.institutionalFeaturesController.removeAddTokenConnectRequest.bind( this.institutionalFeaturesController, diff --git a/shared/constants/metametrics.ts b/shared/constants/metametrics.ts index f69a09169..9e7fdbe1f 100644 --- a/shared/constants/metametrics.ts +++ b/shared/constants/metametrics.ts @@ -587,7 +587,7 @@ export enum MetaMetricsEventName { ConnectCustodialAccountClicked = 'Connect Custodial Account Clicked', MMIPortfolioButtonClicked = 'MMI Portfolio Button Clicked', StakeButtonClicked = 'Stake Button Clicked', - ComplianceButtonClicked = 'Compliance Button Clicked', + InteractiveReplacementTokenButtonClicked = 'Interactive Replacement Token Button Clicked', RefreshTokenListClicked = 'Refresh Token List Clicked', SignatureDeeplinkDisplayed = 'Signature Deeplink Displayed', InstitutionalFeatureConnected = 'Institutional Feature Connected', diff --git a/ui/components/app/app-components.scss b/ui/components/app/app-components.scss index 5db2b28f4..271976859 100644 --- a/ui/components/app/app-components.scss +++ b/ui/components/app/app-components.scss @@ -98,8 +98,9 @@ @import 'network-account-balance-header/index'; @import 'approve-content-card/index'; @import 'transaction-alerts/transaction-alerts'; -@import '../institutional/compliance-details/index'; +///: BEGIN:ONLY_INCLUDE_IN(build-mmi) @import '../institutional/interactive-replacement-token-notification/index'; @import '../institutional/confirm-remove-jwt-modal/index'; @import '../institutional/custody-confirm-link-modal/index'; @import '../institutional/transaction-failed-modal/index'; +///: END:ONLY_INCLUDE_IN diff --git a/ui/components/app/modals/index.scss b/ui/components/app/modals/index.scss index 7aa398288..c457f3c2a 100644 --- a/ui/components/app/modals/index.scss +++ b/ui/components/app/modals/index.scss @@ -12,11 +12,11 @@ @import 'convert-token-to-nft-modal/index'; @import 'contract-details-modal/index'; @import 'hold-to-reveal-modal/index'; +///: BEGIN:ONLY_INCLUDE_IN(build-mmi) @import '../../institutional/confirm-remove-jwt-modal/index'; @import '../../institutional/custody-confirm-link-modal/index'; -@import '../../institutional/compliance-modal/index'; -@import '../../institutional/compliance-details/index'; @import '../../institutional/transaction-failed-modal/index'; +///: END:ONLY_INCLUDE_IN @import 'eth-sign-modal/index'; .modal { diff --git a/ui/components/app/modals/modal.js b/ui/components/app/modals/modal.js index 55b044a7c..f16447804 100644 --- a/ui/components/app/modals/modal.js +++ b/ui/components/app/modals/modal.js @@ -13,8 +13,6 @@ import { mmiActionsFactory } from '../../../store/institutional/institution-back // Modal Components import AddNetworkModal from '../../../pages/onboarding-flow/add-network-modal'; ///: BEGIN:ONLY_INCLUDE_IN(build-mmi) -import ComplianceDetailsModal from '../../institutional/compliance-details'; -import ComplianceModal from '../../institutional/compliance-modal'; import ConfirmRemoveJWT from '../../institutional/confirm-remove-jwt-modal'; import CustodyConfirmLink from '../../institutional/custody-confirm-link-modal'; import InteractiveReplacementTokenModal from '../../institutional/interactive-replacement-token-modal'; @@ -330,35 +328,6 @@ const MODALS = { }, ///: BEGIN:ONLY_INCLUDE_IN(build-mmi) - COMPLIANCE: { - contents: , - onHide: (props) => props.hideWarning(), - mobileModalStyle: { - ...modalContainerMobileStyle, - }, - laptopModalStyle: { - ...modalContainerLaptopStyle, - }, - contentStyle: { - borderRadius: '8px', - }, - }, - - COMPLIANCE_DETAILS: { - contents: , - onHide: (props) => props.hideWarning(), - mobileModalStyle: { - ...modalContainerMobileStyle, - }, - laptopModalStyle: { - ...modalContainerLaptopStyle, - }, - contentStyle: { - padding: '0px', - borderRadius: '8px', - }, - }, - CONFIRM_REMOVE_JWT: { contents: , mobileModalStyle: { diff --git a/ui/components/component-library/icon/icon.types.ts b/ui/components/component-library/icon/icon.types.ts index 1ad735719..af1282d66 100644 --- a/ui/components/component-library/icon/icon.types.ts +++ b/ui/components/component-library/icon/icon.types.ts @@ -108,7 +108,6 @@ export enum IconName { People = 'people', ProgrammingArrows = 'programming-arrows', MmmiPortfolioDashboard = 'portfolio-dashboard', - Compliance = 'compliance', Custody = 'custody', Question = 'question', Received = 'received', diff --git a/ui/components/institutional/compliance-details-modal/compliance-details-modal.js b/ui/components/institutional/compliance-details-modal/compliance-details-modal.js deleted file mode 100644 index 929321f9e..000000000 --- a/ui/components/institutional/compliance-details-modal/compliance-details-modal.js +++ /dev/null @@ -1,36 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { useContext } from 'react'; -import { useDispatch } from 'react-redux'; -import Modal from '../../app/modal'; -import { hideModal } from '../../../store/actions'; -import ComplianceDetails from '../compliance-details'; -import { I18nContext } from '../../../contexts/i18n'; - -export default function ComplianceDetailsModal({ - onGenerateComplianceReport, - reportAddress, -}) { - const dispatch = useDispatch(); - const handleClose = () => dispatch(hideModal); - const t = useContext(I18nContext); - - return ( - - - - ); -} - -ComplianceDetailsModal.propTypes = { - reportAddress: PropTypes.func.isRequired, - onGenerateComplianceReport: PropTypes.func.isRequired, -}; diff --git a/ui/components/institutional/compliance-details-modal/compliance-details-modal.test.js b/ui/components/institutional/compliance-details-modal/compliance-details-modal.test.js deleted file mode 100644 index ddf7a338a..000000000 --- a/ui/components/institutional/compliance-details-modal/compliance-details-modal.test.js +++ /dev/null @@ -1,31 +0,0 @@ -import React from 'react'; -import { renderWithProvider } from '../../../../test/jest'; -import configureStore from '../../../store/store'; -import mockState from '../../../../test/data/mock-state.json'; -import ComplianceDetailsModal from './compliance-details-modal'; - -const props = { - hideModal: jest.fn(), - onGenerateComplianceReport: jest.fn(), - reportAddress: '0xAddress', -}; - -const render = () => { - const store = configureStore({ - ...mockState, - metamask: {}, - history: { - mostRecentOverviewPage: 'test', - }, - }); - - return renderWithProvider(, store); -}; - -describe('Compliance Modal', function () { - it('render correctly with the correct header', function () { - const { getByText } = render(); - - expect(getByText('AML/CFT Compliance')).toBeVisible(); - }); -}); diff --git a/ui/components/institutional/compliance-details-modal/index.js b/ui/components/institutional/compliance-details-modal/index.js deleted file mode 100644 index 40956b073..000000000 --- a/ui/components/institutional/compliance-details-modal/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './compliance-details-modal'; diff --git a/ui/components/institutional/compliance-details-modal/index.scss b/ui/components/institutional/compliance-details-modal/index.scss deleted file mode 100644 index 38660498a..000000000 --- a/ui/components/institutional/compliance-details-modal/index.scss +++ /dev/null @@ -1,3 +0,0 @@ -.compliance-details-modal-content { - padding: 0; -} diff --git a/ui/components/institutional/compliance-details/__snapshots__/compliance-details.test.js.snap b/ui/components/institutional/compliance-details/__snapshots__/compliance-details.test.js.snap deleted file mode 100644 index ad6564213..000000000 --- a/ui/components/institutional/compliance-details/__snapshots__/compliance-details.test.js.snap +++ /dev/null @@ -1,146 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`ComplianceDetails should render correctly 1`] = ` -
-
-
-

- Address -

-

- 0xAddress -

-
-
-
-

- Risk rating -

-
-
-
- - - -
-
-
-
-
-

- low -

-
-
-
-
-

- Report last run -

-
-
-
- - - -
-
-
-
-

-

-
- -
-
-
-`; diff --git a/ui/components/institutional/compliance-details/compliance-details.js b/ui/components/institutional/compliance-details/compliance-details.js deleted file mode 100644 index 518831b2d..000000000 --- a/ui/components/institutional/compliance-details/compliance-details.js +++ /dev/null @@ -1,159 +0,0 @@ -import React, { useContext, useEffect, useState } from 'react'; -import { useSelector, useDispatch } from 'react-redux'; -import PropTypes from 'prop-types'; -import classnames from 'classnames'; -import { I18nContext } from '../../../contexts/i18n'; -import InfoTooltip from '../../ui/info-tooltip'; -import SwapsFooter from '../../../pages/swaps/swaps-footer'; -import { - fetchHistoricalReports, - getComplianceHistoricalReportsByAddress, - getComplianceTenantSubdomain, -} from '../../../ducks/institutional/institutional'; -import { formatDate } from '../../../helpers/utils/util'; -import { Box, Text } from '../../component-library'; - -import { - TextColor, - TextVariant, - JustifyContent, - AlignItems, - BlockSize, - Display, - FlexDirection, -} from '../../../helpers/constants/design-system'; - -const ComplianceDetails = ({ address, onClose, onGenerate }) => { - const t = useContext(I18nContext); - const dispatch = useDispatch(); - - useEffect(() => { - dispatch(fetchHistoricalReports(address)); - }, [address, dispatch]); - - const [lastReport, setLastReport] = useState(null); - const historicalReports = useSelector( - getComplianceHistoricalReportsByAddress(address), - ); - - useEffect(() => { - if (historicalReports && historicalReports.length) { - setLastReport( - historicalReports.reduce((prev, cur) => - prev.createTime > cur.createTime ? prev : cur, - ), - ); - } - }, [historicalReports]); - - const complianceTenantSubdomain = useSelector(getComplianceTenantSubdomain); - - return ( - - - {t('address')} - {address} - - - - {t('riskRating')} - {t('riskRatingTooltip')}} - /> - - - {lastReport ? lastReport.risk : t('noReport')} - - - - - {t('reportLastRun')} - {t('reportLastRunTooltip')}} - /> - - - {lastReport - ? formatDate(new Date(lastReport.createTime).getTime()) - : 'N/A'} - - - - { - onGenerate(address); - onClose(); - }} - submitText={t('runReport')} - onCancel={() => - global.platform.openTab({ - url: `https://${complianceTenantSubdomain}.compliance.codefi.network/app/kyt/addresses/${lastReport.address}/${lastReport.reportId}`, - }) - } - cancelText={t('showReport')} - hideCancel={!lastReport} - approveActive={lastReport} - showTopBorder - /> - - - ); -}; - -ComplianceDetails.propTypes = { - address: PropTypes.string, - onClose: PropTypes.func, - onGenerate: PropTypes.func, -}; - -export default ComplianceDetails; diff --git a/ui/components/institutional/compliance-details/compliance-details.stories.js b/ui/components/institutional/compliance-details/compliance-details.stories.js deleted file mode 100644 index b4ead4450..000000000 --- a/ui/components/institutional/compliance-details/compliance-details.stories.js +++ /dev/null @@ -1,48 +0,0 @@ -import React from 'react'; -import { Provider } from 'react-redux'; -import configureStore from '../../../store/store'; -import testData from '../../../../.storybook/test-data'; -import ComplianceDetails from '.'; - -const customData = { - ...testData, - metamask: { - institutionalFeatures: { - complianceProjectId: '', - complianceClientId: '', - reportsInProgress: {}, - historicalReports: { - '0xAddress': [ - { - reportId: 'reportId', - address: '0xAddress', - risk: 'low', - creatTime: new Date(), - }, - ], - }, - }, - }, -}; - -const store = configureStore(customData); - -export default { - title: 'Components/Institutional/ComplianceDetails', - decorators: [(story) => {story()}], - component: ComplianceDetails, - args: { - address: '0xAddress', - onClose: () => undefined, - onGenerate: () => undefined, - }, - argTypes: { - onClick: { - action: 'onClick', - }, - }, -}; - -export const DefaultStory = (args) => ; - -DefaultStory.storyName = 'ComplianceDetails'; diff --git a/ui/components/institutional/compliance-details/compliance-details.test.js b/ui/components/institutional/compliance-details/compliance-details.test.js deleted file mode 100644 index 670d8a1b4..000000000 --- a/ui/components/institutional/compliance-details/compliance-details.test.js +++ /dev/null @@ -1,67 +0,0 @@ -import React from 'react'; -import configureStore from 'redux-mock-store'; -import { fireEvent, screen } from '@testing-library/react'; -import thunk from 'redux-thunk'; -import { renderWithProvider } from '../../../../test/lib/render-helpers'; -import ComplianceDetails from './compliance-details'; - -const initState = { - metamask: { - institutionalFeatures: { - complianceProjectId: '', - complianceClientId: '', - reportsInProgress: {}, - historicalReports: { - '0xAddress': [ - { - reportId: 'reportId', - address: '0xAddress', - risk: 'low', - creatTime: new Date(), - }, - ], - }, - }, - }, -}; -const middlewares = [thunk]; -const mockStore = configureStore(middlewares); - -describe('ComplianceDetails', () => { - const props = { - address: '0xAddress', - onClose: jest.fn(), - onGenerate: jest.fn(), - }; - - const store = mockStore(initState); - - it('should render correctly', () => { - const { container } = renderWithProvider( - , - store, - ); - - expect(container).toMatchSnapshot(); - }); - - it('runs onGenerate fuction', () => { - renderWithProvider( - , - store, - ); - - fireEvent.click(screen.queryByTestId('page-container-footer-next')); - - expect(props.onGenerate).toHaveBeenCalledTimes(1); - expect(props.onGenerate).toHaveBeenCalledWith(props.address); - }); -}); diff --git a/ui/components/institutional/compliance-details/index.js b/ui/components/institutional/compliance-details/index.js deleted file mode 100644 index 4cccdb1cd..000000000 --- a/ui/components/institutional/compliance-details/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './compliance-details'; diff --git a/ui/components/institutional/compliance-details/index.scss b/ui/components/institutional/compliance-details/index.scss deleted file mode 100644 index d342c36ff..000000000 --- a/ui/components/institutional/compliance-details/index.scss +++ /dev/null @@ -1,5 +0,0 @@ -.compliance-details { - &__row { - border-top: 1px solid var(--color-border-muted); - } -} diff --git a/ui/components/institutional/compliance-modal/__snapshots__/compliance-modal.test.js.snap b/ui/components/institutional/compliance-modal/__snapshots__/compliance-modal.test.js.snap deleted file mode 100644 index 23d1ab868..000000000 --- a/ui/components/institutional/compliance-modal/__snapshots__/compliance-modal.test.js.snap +++ /dev/null @@ -1,93 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`ComplianceModal should render the correct content 1`] = ` -
- -
-`; diff --git a/ui/components/institutional/compliance-modal/compliance-modal.js b/ui/components/institutional/compliance-modal/compliance-modal.js deleted file mode 100644 index 629cf330f..000000000 --- a/ui/components/institutional/compliance-modal/compliance-modal.js +++ /dev/null @@ -1,95 +0,0 @@ -import React from 'react'; -import { useDispatch } from 'react-redux'; -import { useI18nContext } from '../../../hooks/useI18nContext'; -import { hideModal } from '../../../store/actions'; -import Modal from '../../app/modal'; - -import { - ButtonIcon, - IconSize, - IconName, - Text, - Box, -} from '../../component-library'; - -import { - AlignItems, - JustifyContent, - TextColor, - Display, -} from '../../../helpers/constants/design-system'; - -const ComplianceModal = () => { - const dispatch = useDispatch(); - const t = useI18nContext(); - - const handleSubmit = () => { - global.platform.openTab({ - url: 'https://start.compliance.codefi.network/', - }); - }; - - const handleClose = () => dispatch(hideModal()); - - return ( - - - - - Codefi Compliance - - {t('codefiCompliance')} - - - - - - {t('complianceBlurb0')} - - - {t('complianceBlurb1')} - - - {t('complianceBlurpStep0')} - -
    -
  1. {t('complianceBlurbStep1')}
  2. -
  3. {t('complianceBlurbStep2')}
  4. -
  5. {t('complianceBlurbStep3')}
  6. -
  7. {t('complianceBlurbStep4')}
  8. -
  9. {t('complianceBlurbStep5')}
  10. -
-
-
- ); -}; - -export default ComplianceModal; diff --git a/ui/components/institutional/compliance-modal/compliance-modal.stories.js b/ui/components/institutional/compliance-modal/compliance-modal.stories.js deleted file mode 100644 index 5416daeba..000000000 --- a/ui/components/institutional/compliance-modal/compliance-modal.stories.js +++ /dev/null @@ -1,22 +0,0 @@ -import React from 'react'; -import { Provider } from 'react-redux'; -import configureStore from '../../../store/store'; -import testData from '../../../../.storybook/test-data'; -import ComplianceModal from '.'; - -const store = configureStore(testData); - -export default { - title: 'Components/Institutional/ComplianceModal', - decorators: [(story) => {story()}], - component: ComplianceModal, - argTypes: { - onClick: { - action: 'onClick', - }, - }, -}; - -export const DefaultStory = (args) => ; - -DefaultStory.storyName = 'ComplianceModal'; diff --git a/ui/components/institutional/compliance-modal/compliance-modal.test.js b/ui/components/institutional/compliance-modal/compliance-modal.test.js deleted file mode 100644 index 259340edd..000000000 --- a/ui/components/institutional/compliance-modal/compliance-modal.test.js +++ /dev/null @@ -1,55 +0,0 @@ -import React from 'react'; -import { render, fireEvent } from '@testing-library/react'; -import { useDispatch } from 'react-redux'; -import sinon from 'sinon'; -import { hideModal } from '../../../store/actions'; -import ComplianceModal from '.'; - -jest.mock('react-redux', () => ({ - useDispatch: jest.fn(), -})); - -jest.mock('../../../store/actions', () => ({ - hideModal: jest.fn(), -})); - -describe('ComplianceModal', () => { - let dispatchMock; - - beforeEach(() => { - dispatchMock = jest.fn(); - useDispatch.mockReturnValue(dispatchMock); - }); - - afterEach(() => { - jest.resetAllMocks(); - }); - - it('should render the correct content', () => { - const { container, getByTestId } = render(); - - expect(getByTestId('compliance-info')).toBeInTheDocument(); - expect(getByTestId('compliance-bullets')).toBeInTheDocument(); - expect(container).toMatchSnapshot(); - }); - - it('should close the modal when close button is clicked', () => { - const { getByTestId } = render(); - - fireEvent.click(getByTestId('compliance-modal-close')); - - expect(hideModal).toHaveBeenCalled(); - expect(dispatchMock).toHaveBeenCalledWith(hideModal()); - }); - - it('should open the Compliance page when submit button is clicked', () => { - global.platform = { openTab: sinon.spy() }; - const { container } = render(); - - const btn = container.getElementsByClassName('btn-primary')[0]; - - fireEvent.click(btn); - - expect(global.platform.openTab.called).toBeTruthy(); - }); -}); diff --git a/ui/components/institutional/compliance-modal/index.js b/ui/components/institutional/compliance-modal/index.js deleted file mode 100644 index 04582c660..000000000 --- a/ui/components/institutional/compliance-modal/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './compliance-modal'; diff --git a/ui/components/institutional/compliance-modal/index.scss b/ui/components/institutional/compliance-modal/index.scss deleted file mode 100644 index 76570844e..000000000 --- a/ui/components/institutional/compliance-modal/index.scss +++ /dev/null @@ -1,6 +0,0 @@ -.compliance-modal { - ol { - list-style: decimal; - list-style-position: inside; - } -} 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 deleted file mode 100644 index ff4e3a70c..000000000 --- a/ui/components/institutional/compliance-settings/__snapshots__/compliance-settings.test.js.snap +++ /dev/null @@ -1,92 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Compliance Settings shows disconnect when Compliance is activated 1`] = ` -
-
-
- Change your settings or view reports by opening up Codefi Compliance or disconnect below. -
- -
-
-`; - -exports[`Compliance Settings shows start btn when Compliance its not activated 1`] = ` -
-
-
-

- DeFi raises AML/CFT risk for institutions, given the decentralised pools and pseudonymous counterparties. -

-

- Codefi Compliance is the only product capable of running AML/CFT analysis on DeFi pools. This allows you to identify and avoid pools and counterparties that fail your risk setting. -

-

- Steps to enable AML/CFT Compliance: -

-
    -
  1. - Sign up to Codefi Compliance below -
  2. -
  3. - Create an organisation -
  4. -
  5. - Create a project -
  6. -
  7. - Set your compliance settings -
  8. -
  9. - Click the "Enable Compliance in MMI" button -
  10. -
-
-
- -
-
-
-`; diff --git a/ui/components/institutional/compliance-settings/compliance-settings.js b/ui/components/institutional/compliance-settings/compliance-settings.js deleted file mode 100644 index 7bbaaa18b..000000000 --- a/ui/components/institutional/compliance-settings/compliance-settings.js +++ /dev/null @@ -1,114 +0,0 @@ -import React, { useContext } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import { - JustifyContent, - Display, - TextColor, - FlexDirection, - TextVariant, - BorderStyle, - BorderColor, -} from '../../../helpers/constants/design-system'; -import { I18nContext } from '../../../contexts/i18n'; -import { mmiActionsFactory } from '../../../store/institutional/institution-background'; -import { - Button, - BUTTON_VARIANT, - BUTTON_SIZES, - Text, - Box, -} from '../../component-library'; - -const ComplianceSettings = () => { - const t = useContext(I18nContext); - const dispatch = useDispatch(); - const mmiActions = mmiActionsFactory(); - - const complianceActivated = useSelector((state) => - Boolean(state.metamask.institutionalFeatures?.complianceProjectId), - ); - - const linkButton = ( - - ); - - return complianceActivated ? ( - - - {t('complianceSettingsExplanation')} - - - - {linkButton} - - - ) : ( - - - {t('complianceBlurb0')} - {t('complianceBlurb1')} - {t('complianceBlurpStep0')} -
    -
  1. {t('complianceBlurbStep1')}
  2. -
  3. {t('complianceBlurbStep2')}
  4. -
  5. {t('complianceBlurbStep3')}
  6. -
  7. {t('complianceBlurbStep4')}
  8. -
  9. {t('complianceBlurbStep5')}
  10. -
-
- - - {linkButton} - - -
- ); -}; - -export default ComplianceSettings; diff --git a/ui/components/institutional/compliance-settings/compliance-settings.stories.js b/ui/components/institutional/compliance-settings/compliance-settings.stories.js deleted file mode 100644 index cfcef8689..000000000 --- a/ui/components/institutional/compliance-settings/compliance-settings.stories.js +++ /dev/null @@ -1,34 +0,0 @@ -import React from 'react'; -import { Provider } from 'react-redux'; -import configureStore from '../../../store/store'; -import testData from '../../../../.storybook/test-data'; -import ComplianceSettings from '.'; - -const customData = { - ...testData, - metamask: { - ...testData.metamask, - institutionalFeatures: { - complianceProjectId: '', - complianceClientId: '', - reportsInProgress: {}, - }, - }, -}; - -const store = configureStore(customData); - -export default { - title: 'Components/Institutional/ComplianceSettings', - decorators: [(story) => {story()}], - component: ComplianceSettings, - argTypes: { - onClick: { - action: 'onClick', - }, - }, -}; - -export const DefaultStory = (args) => ; - -DefaultStory.storyName = 'ComplianceSettings'; diff --git a/ui/components/institutional/compliance-settings/compliance-settings.test.js b/ui/components/institutional/compliance-settings/compliance-settings.test.js deleted file mode 100644 index 0478f7d75..000000000 --- a/ui/components/institutional/compliance-settings/compliance-settings.test.js +++ /dev/null @@ -1,67 +0,0 @@ -import React from 'react'; -import configureMockStore from 'redux-mock-store'; -import { renderWithProvider } from '../../../../test/lib/render-helpers'; -import ComplianceSettings from '.'; - -const mockedDeleteComplianceAuthData = jest - .fn() - .mockReturnValue({ type: 'TYPE' }); -jest.mock('../../../store/institutional/institution-background', () => ({ - mmiActionsFactory: () => ({ - deleteComplianceAuthData: mockedDeleteComplianceAuthData, - }), -})); - -const mockStore = { - metamask: { - providerConfig: { - type: 'test', - }, - institutionalFeatures: { - complianceProjectId: '', - complianceClientId: '', - reportsInProgress: {}, - }, - preferences: { - useNativeCurrencyAsPrimaryCurrency: true, - }, - }, -}; - -describe('Compliance Settings', () => { - it('shows start btn when Compliance its not activated', () => { - const store = configureMockStore()(mockStore); - - const { container, getByTestId } = renderWithProvider( - , - store, - ); - - expect(getByTestId('start-compliance')).toBeVisible(); - expect(container).toMatchSnapshot(); - }); - - it('shows disconnect when Compliance is activated', () => { - const customMockStore = { - ...mockStore, - metamask: { - ...mockStore.metamask, - institutionalFeatures: { - complianceProjectId: '123', - complianceClientId: '123', - reportsInProgress: {}, - }, - }, - }; - - const store = configureMockStore()(customMockStore); - - const { container, getByTestId } = renderWithProvider( - , - store, - ); - - expect(getByTestId('disconnect-compliance')).toBeVisible(); - expect(container).toMatchSnapshot(); - }); -}); diff --git a/ui/components/institutional/compliance-settings/index.js b/ui/components/institutional/compliance-settings/index.js deleted file mode 100644 index 5105b8bea..000000000 --- a/ui/components/institutional/compliance-settings/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './compliance-settings'; diff --git a/ui/components/institutional/compliance-settings/index.scss b/ui/components/institutional/compliance-settings/index.scss deleted file mode 100644 index cb9c22a12..000000000 --- a/ui/components/institutional/compliance-settings/index.scss +++ /dev/null @@ -1,19 +0,0 @@ -.institutional-feature { - &__footer { - button { - min-width: 0; - margin-right: 16px; - - &:last-of-type { - margin-right: 0; - } - } - } - - &__content { - ol { - list-style: decimal; - list-style-position: inside; - } - } -} diff --git a/ui/components/institutional/institutional-components.scss b/ui/components/institutional/institutional-components.scss index 8ae612682..9e2914411 100644 --- a/ui/components/institutional/institutional-components.scss +++ b/ui/components/institutional/institutional-components.scss @@ -4,8 +4,6 @@ * This will help improve specificity and reduce the chance of * unintended overrides. **/ -@import 'compliance-details/index'; -@import 'compliance-settings/index'; @import 'jwt-dropdown/jwt-dropdown'; @import 'jwt-url-form/jwt-url-form'; @import 'note-to-trader/index'; 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 eae1529f2..31359540d 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 @@ -60,7 +60,7 @@ const InteractiveReplacementTokenModal = () => { trackEvent({ category: MetaMetricsEventCategory.MMI, - event: MetaMetricsEventName.ComplianceButtonClicked, + event: MetaMetricsEventName.InteractiveReplacementTokenButtonClicked, }); }; diff --git a/ui/ducks/institutional/institutional.js b/ui/ducks/institutional/institutional.js index c0f5c3c52..a11613b32 100644 --- a/ui/ducks/institutional/institutional.js +++ b/ui/ducks/institutional/institutional.js @@ -1,106 +1,17 @@ -import { createSelector } from 'reselect'; import { createSlice } from '@reduxjs/toolkit'; -import { captureException } from '@sentry/browser'; -import { mmiActionsFactory } from '../../store/institutional/institution-background'; const name = 'institutionalFeatures'; -const initialState = { - historicalReports: {}, - complianceProjectId: '', - complianceClientId: '', - reportsInProgress: {}, -}; +const initialState = {}; const slice = createSlice({ name, initialState, - reducers: { - setHistoricalReports(state, action) { - state.historicalReports[action.payload.address] = [ - ...action.payload.reports, - ]; - }, - }, }); -const { actions, reducer } = slice; +const { reducer } = slice; export default reducer; -export const getComplianceProjectId = (state) => - state.metamask[name]?.complianceProjectId; -export const getComplianceClientId = (state) => - state.metamask[name]?.complianceClientId; -export const getComplianceTenantSubdomain = (state) => - state.metamask[name]?.complianceTenantSubdomain; -export const getComplianceHistoricalReports = (state) => - state.metamask[name]?.historicalReports; -export const getComplianceReportsInProgress = (state) => - state.metamask[name]?.reportsInProgress; export const getInstitutionalConnectRequests = (state) => state.metamask[name]?.connectRequests; -export const complianceActivated = (state) => - Boolean(state.metamask[name]?.complianceProjectId); - -export const getComplianceHistoricalReportsByAddress = (address) => - createSelector(getComplianceHistoricalReports, (reports) => - reports ? reports[address] : [], - ); - -export const getComplianceReportsInProgressByAddress = (address) => - createSelector(getComplianceReportsInProgress, (reports) => - reports ? reports[address.toLowerCase()] : undefined, - ); - -export const fetchHistoricalReports = (address, testProjectId = undefined) => { - return async (dispatch, getState) => { - const state = getState(); - const mmiActions = mmiActionsFactory(); - - let projectId; - - // testProjectId is provided to make a test request, which checks if projectId is correct - if (!testProjectId) { - projectId = getComplianceProjectId(state); - if (!projectId) { - return; - } - } - - try { - const result = await dispatch( - mmiActions.getComplianceHistoricalReportsByAddress(address, projectId), - ); - - dispatch( - mmiActions.syncReportsInProgress({ - address, - historicalReports: result.items ? result.items : [], - }), - ); - dispatch( - actions.setHistoricalReports({ - address, - reports: result.items - ? result.items.filter((report) => report.status !== 'inProgress') - : [], - }), - ); - } catch (error) { - console.error(error); - captureException(error); - } - }; -}; - -export function generateComplianceReport(address) { - return (dispatch, _getState) => { - const mmiActions = mmiActionsFactory(); - dispatch(mmiActions.generateComplianceReport(address)); - }; -} - -const { setHistoricalReports } = actions; - -export { setHistoricalReports }; diff --git a/ui/ducks/institutional/institutional.test.js b/ui/ducks/institutional/institutional.test.js index b0b8e7bf3..c8af602dd 100644 --- a/ui/ducks/institutional/institutional.test.js +++ b/ui/ducks/institutional/institutional.test.js @@ -1,34 +1,9 @@ import InstitutionalReducer, { - fetchHistoricalReports, - getComplianceClientId, - getComplianceProjectId, - getComplianceTenantSubdomain, - getComplianceHistoricalReports, - getComplianceReportsInProgress, getInstitutionalConnectRequests, - complianceActivated, - getComplianceReportsInProgressByAddress, - generateComplianceReport, } from './institutional'; -const mockSyncReportsInProgress = jest.fn(); -const mockGenerateComplianceReport = jest.fn(); - -jest.mock('../../store/institutional/institution-background', () => ({ - mmiActionsFactory: () => ({ - generateComplianceReport: mockGenerateComplianceReport, - getComplianceHistoricalReportsByAddress: jest.fn(), - syncReportsInProgress: mockSyncReportsInProgress, - }), -})); - describe('Institutional Duck', () => { - const initState = { - historicalReports: {}, - complianceProjectId: '', - complianceClientId: '', - reportsInProgress: {}, - }; + const initState = {}; describe('InstitutionalReducer', () => { it('should initialize state', () => { @@ -39,32 +14,11 @@ describe('Institutional Duck', () => { const state = { metamask: { institutionalFeatures: { - complianceProjectId: 'complianceProjectId', - complianceClientId: 'complianceClientId', - complianceTenantSubdomain: 'subdomain', - reportsInProgress: { id: [{ reportId: 'id' }] }, connectRequests: [{ id: 'id' }], - historicalReports: { id: [{ reportId: 'id' }] }, }, }, }; - expect(getComplianceProjectId(state)).toBe('complianceProjectId'); - expect(getComplianceClientId(state)).toBe('complianceClientId'); - expect(getComplianceTenantSubdomain(state)).toBe('subdomain'); - expect(getComplianceHistoricalReports(state).id[0].reportId).toBe('id'); - expect(getComplianceReportsInProgress(state).id).toHaveLength(1); expect(getInstitutionalConnectRequests(state)).toHaveLength(1); - expect(complianceActivated(state)).toBe(true); - expect(getComplianceReportsInProgressByAddress('id')(state)).toHaveLength( - 1, - ); - await fetchHistoricalReports('0xAddress', 'projectId')( - jest.fn().mockReturnValue({ items: [{ status: 'test' }] }), - () => state, - ); - expect(mockSyncReportsInProgress).toHaveBeenCalled(); - await generateComplianceReport('0xAddress')(jest.fn(), () => state); - expect(mockGenerateComplianceReport).toHaveBeenCalled(); }); }); }); diff --git a/ui/helpers/constants/routes.ts b/ui/helpers/constants/routes.ts index 53b864cb8..ccd2631ec 100644 --- a/ui/helpers/constants/routes.ts +++ b/ui/helpers/constants/routes.ts @@ -32,9 +32,6 @@ const CONNECT_HARDWARE_ROUTE = '/new-account/connect'; const CUSTODY_ACCOUNT_ROUTE = '/new-account/custody'; const INSTITUTIONAL_FEATURES_DONE_ROUTE = '/institutional-features/done'; const CUSTODY_ACCOUNT_DONE_ROUTE = '/new-account/custody/done'; -const COMPLIANCE_FEATURE_ROUTE = '/compliance-feature'; -const CONFIRM_INSTITUTIONAL_FEATURE_CONNECT = - '/confirm-institutional-feature-connect'; const CONFIRM_ADD_CUSTODIAN_TOKEN = '/confirm-add-custodian-token'; const INTERACTIVE_REPLACEMENT_TOKEN_PAGE = '/interactive-replacement-token-page'; @@ -144,9 +141,6 @@ const PATH_NAME_MAP = { [INSTITUTIONAL_FEATURES_DONE_ROUTE]: 'Institutional Features Done Page', [CUSTODY_ACCOUNT_ROUTE]: 'Connect Custody', [CUSTODY_ACCOUNT_DONE_ROUTE]: 'Connect Custody Account done', - [COMPLIANCE_FEATURE_ROUTE]: 'Compliance Feature Page', - [CONFIRM_INSTITUTIONAL_FEATURE_CONNECT]: - 'Confirm Institutional Feature Connect', [CONFIRM_ADD_CUSTODIAN_TOKEN]: 'Confirm Add Custodian Token', [INTERACTIVE_REPLACEMENT_TOKEN_PAGE]: 'Interactive replacement token page', ///: END:ONLY_INCLUDE_IN @@ -237,8 +231,6 @@ export { CUSTODY_ACCOUNT_DONE_ROUTE, CUSTODY_ACCOUNT_ROUTE, INSTITUTIONAL_FEATURES_DONE_ROUTE, - COMPLIANCE_FEATURE_ROUTE, - CONFIRM_INSTITUTIONAL_FEATURE_CONNECT, CONFIRM_ADD_CUSTODIAN_TOKEN, INTERACTIVE_REPLACEMENT_TOKEN_PAGE, ///: END:ONLY_INCLUDE_IN diff --git a/ui/pages/home/home.component.js b/ui/pages/home/home.component.js index fff8e559c..a61b285fc 100644 --- a/ui/pages/home/home.component.js +++ b/ui/pages/home/home.component.js @@ -64,7 +64,6 @@ import { CONFIRMATION_V_NEXT_ROUTE, ONBOARDING_SECURE_YOUR_WALLET_ROUTE, ///: BEGIN:ONLY_INCLUDE_IN(build-mmi) - CONFIRM_INSTITUTIONAL_FEATURE_CONNECT, CONFIRM_ADD_CUSTODIAN_TOKEN, INTERACTIVE_REPLACEMENT_TOKEN_PAGE, ///: END:ONLY_INCLUDE_IN @@ -100,7 +99,7 @@ function shouldCloseNotificationPopup({ shouldCLose &&= // MMI User must be shown a deeplink !waitForConfirmDeepLinkDialog && - // MMI User is connecting to custodian or compliance + // MMI User is connecting to custodian institutionalConnectRequests.length === 0; ///: END:ONLY_INCLUDE_IN @@ -247,12 +246,6 @@ export default class Home extends PureComponent { ) { history.push(CONFIRM_ADD_CUSTODIAN_TOKEN); } - } else if ( - institutionalConnectRequests && - institutionalConnectRequests.length > 0 && - institutionalConnectRequests[0].feature !== 'custodian' - ) { - history.push(CONFIRM_INSTITUTIONAL_FEATURE_CONNECT); } } diff --git a/ui/pages/institutional/compliance-feature-page/compliance-feature-page.js b/ui/pages/institutional/compliance-feature-page/compliance-feature-page.js deleted file mode 100644 index 4ccba021a..000000000 --- a/ui/pages/institutional/compliance-feature-page/compliance-feature-page.js +++ /dev/null @@ -1,95 +0,0 @@ -import React, { useContext } from 'react'; -import { useSelector } from 'react-redux'; -import { useHistory } from 'react-router-dom'; -import { I18nContext } from '../../../contexts/i18n'; -import { DEFAULT_ROUTE } from '../../../helpers/constants/routes'; -import { - JustifyContent, - DISPLAY, - AlignItems, - TextColor, - TEXT_ALIGN, - BackgroundColor, - Color, - FLEX_DIRECTION, -} from '../../../helpers/constants/design-system'; -import { - ButtonIcon, - ButtonIconSize, - IconName, -} from '../../../components/component-library'; -import { Text } from '../../../components/component-library/text/deprecated'; -import Box from '../../../components/ui/box'; -import ComplianceSettings from '../../../components/institutional/compliance-settings'; - -const ComplianceFeaturePage = () => { - const t = useContext(I18nContext); - const history = useHistory(); - - const complianceActivated = useSelector((state) => - Boolean(state.metamask.institutionalFeatures?.complianceProjectId), - ); - - return ( - - <> - - history.push(DEFAULT_ROUTE)} - display={[DISPLAY.FLEX]} - /> - - - Codefi Compliance - {t('codefiCompliance')} - {complianceActivated && ( - - {t('activated')} - - )} - - - - - - - ); -}; - -export default ComplianceFeaturePage; diff --git a/ui/pages/institutional/compliance-feature-page/compliance-feature-page.stories.js b/ui/pages/institutional/compliance-feature-page/compliance-feature-page.stories.js deleted file mode 100644 index a70991369..000000000 --- a/ui/pages/institutional/compliance-feature-page/compliance-feature-page.stories.js +++ /dev/null @@ -1,35 +0,0 @@ -import React from 'react'; -import { Provider } from 'react-redux'; -import { action } from '@storybook/addon-actions'; -import configureStore from '../../../store/store'; -import testData from '../../../../.storybook/test-data'; -import ComplianceFeaturePage from '.'; - -const customData = { - ...testData, - metamask: { - ...testData.metamask, - institutionalFeatures: { - complianceProjectId: '', - complianceClientId: '', - reportsInProgress: {}, - }, - }, -}; - -const store = configureStore(customData); - -export default { - title: 'Pages/Institutional/ComplianceFeaturePage', - decorators: [(story) => {story()}], - component: ComplianceFeaturePage, - args: { - onClick: () => { - action('onClick'); - }, - }, -}; - -export const DefaultStory = (args) => ; - -DefaultStory.storyName = 'ComplianceFeaturePage'; diff --git a/ui/pages/institutional/compliance-feature-page/compliance-feature-page.test.js b/ui/pages/institutional/compliance-feature-page/compliance-feature-page.test.js deleted file mode 100644 index 281e4ec7b..000000000 --- a/ui/pages/institutional/compliance-feature-page/compliance-feature-page.test.js +++ /dev/null @@ -1,107 +0,0 @@ -import React from 'react'; -import sinon from 'sinon'; -import configureMockStore from 'redux-mock-store'; -import { fireEvent, waitFor } from '@testing-library/react'; -import { renderWithProvider } from '../../../../test/lib/render-helpers'; -import ComplianceFeaturePage from '.'; - -const mockedDeleteComplianceAuthData = jest - .fn() - .mockReturnValue({ type: 'TYPE' }); -jest.mock('../../../store/institutional/institution-background', () => ({ - mmiActionsFactory: () => ({ - deleteComplianceAuthData: mockedDeleteComplianceAuthData, - }), -})); - -describe('Compliance Feature, connect', function () { - const mockStore = { - metamask: { - providerConfig: { - type: 'test', - }, - institutionalFeatures: { - complianceProjectId: '', - }, - preferences: { - useNativeCurrencyAsPrimaryCurrency: true, - }, - }, - }; - - it('shows compliance feature button as activated', () => { - const customMockStore = { - ...mockStore, - metamask: { - ...mockStore.metamask, - institutionalFeatures: { - complianceProjectId: '123', - complianceClientId: '123', - reportsInProgress: {}, - }, - }, - }; - - const store = configureMockStore()(customMockStore); - - const { getByText, getByTestId } = renderWithProvider( - , - store, - ); - - expect(getByTestId('activated-label')).toBeVisible(); - expect(getByText('Active')).toBeInTheDocument(); - }); - - it('shows ComplianceSettings when feature is not activated', () => { - const store = configureMockStore()(mockStore); - - const { getByTestId } = renderWithProvider( - , - store, - ); - - expect(getByTestId('institutional-content')).toBeVisible(); - }); - - it('opens new tab on Open Codefi Compliance click', async () => { - global.platform = { openTab: sinon.spy() }; - const store = configureMockStore()(mockStore); - - const { queryByTestId } = renderWithProvider( - , - store, - ); - - const startBtn = queryByTestId('start-compliance'); - fireEvent.click(startBtn); - - await waitFor(() => { - expect(global.platform.openTab.calledOnce).toStrictEqual(true); - }); - }); - - it('calls deleteComplianceAuthData on disconnect click', async () => { - const customMockStore = { - ...mockStore, - metamask: { - ...mockStore.metamask, - institutionalFeatures: { - complianceProjectId: '123', - complianceClientId: '123', - reportsInProgress: {}, - }, - }, - }; - - const store = configureMockStore()(customMockStore); - const { getByTestId } = renderWithProvider( - , - store, - ); - - const disconnectBtn = getByTestId('disconnect-compliance'); - fireEvent.click(disconnectBtn); - expect(mockedDeleteComplianceAuthData).toHaveBeenCalled(); - }); -}); diff --git a/ui/pages/institutional/compliance-feature-page/index.js b/ui/pages/institutional/compliance-feature-page/index.js deleted file mode 100644 index e105bee40..000000000 --- a/ui/pages/institutional/compliance-feature-page/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './compliance-feature-page'; diff --git a/ui/pages/institutional/compliance-feature-page/index.scss b/ui/pages/institutional/compliance-feature-page/index.scss deleted file mode 100644 index 61166d988..000000000 --- a/ui/pages/institutional/compliance-feature-page/index.scss +++ /dev/null @@ -1,29 +0,0 @@ -.institutional-entity { - box-shadow: 0 0 7px 0 rgba(0, 0, 0, 0.08); -} - -.feature-connect { - &__list { - &__list-item { - &__img { - height: 32px; - width: 32px; - margin: 0 10px 0 0; - } - } - } - - &__label { - &__text { - font-size: 0.6rem; - - &--activated { - color: var(--color-text-default); - background: var(--color-primary-default); - padding: 3px 10px; - border-radius: 10px; - margin-top: 0; - } - } - } -} 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 f49144ac4..c3ba507c5 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 @@ -30,10 +30,7 @@ import { MetaMetricsEventCategory, MetaMetricsEventName, } from '../../../../shared/constants/metametrics'; -import { - complianceActivated, - getInstitutionalConnectRequests, -} from '../../../ducks/institutional/institutional'; +import { getInstitutionalConnectRequests } from '../../../ducks/institutional/institutional'; const ConfirmAddCustodianToken = () => { const t = useContext(I18nContext); @@ -44,7 +41,6 @@ const ConfirmAddCustodianToken = () => { const mostRecentOverviewPage = useSelector(getMostRecentOverviewPage); const connectRequests = useSelector(getInstitutionalConnectRequests, isEqual); - const isComplianceActivated = useSelector(complianceActivated); const [showMore, setShowMore] = useState(false); const [isLoading, setIsLoading] = useState(false); const [connectError, setConnectError] = useState(''); @@ -160,13 +156,11 @@ const ConfirmAddCustodianToken = () => { )} - {!isComplianceActivated && ( - - - {connectError} - - - )} + + + {connectError} + + {isLoading ? ( diff --git a/ui/pages/institutional/confirm-add-custodian-token/confirm-add-custodian-token.stories.js b/ui/pages/institutional/confirm-add-custodian-token/confirm-add-custodian-token.stories.js index 01055b785..0614e8e8c 100644 --- a/ui/pages/institutional/confirm-add-custodian-token/confirm-add-custodian-token.stories.js +++ b/ui/pages/institutional/confirm-add-custodian-token/confirm-add-custodian-token.stories.js @@ -9,7 +9,6 @@ const customData = { metamask: { ...testData.metamask, institutionalFeatures: { - complianceProjectId: '', connectRequests: [ { labels: [ diff --git a/ui/pages/institutional/confirm-add-custodian-token/confirm-add-custodian-token.test.js b/ui/pages/institutional/confirm-add-custodian-token/confirm-add-custodian-token.test.js index 262d46b16..8fafcdd86 100644 --- a/ui/pages/institutional/confirm-add-custodian-token/confirm-add-custodian-token.test.js +++ b/ui/pages/institutional/confirm-add-custodian-token/confirm-add-custodian-token.test.js @@ -24,7 +24,6 @@ describe('Confirm Add Custodian Token', () => { useNativeCurrencyAsPrimaryCurrency: true, }, institutionalFeatures: { - complianceProjectId: '', connectRequests: [ { labels: [ @@ -78,7 +77,6 @@ describe('Confirm Add Custodian Token', () => { useNativeCurrencyAsPrimaryCurrency: true, }, institutionalFeatures: { - complianceProjectId: '', connectRequests: [ { labels: [ diff --git a/ui/pages/institutional/confirm-add-institutional-feature/__snapshots__/confirm-add-institutional-feature.test.js.snap b/ui/pages/institutional/confirm-add-institutional-feature/__snapshots__/confirm-add-institutional-feature.test.js.snap deleted file mode 100644 index 10ee36b9b..000000000 --- a/ui/pages/institutional/confirm-add-institutional-feature/__snapshots__/confirm-add-institutional-feature.test.js.snap +++ /dev/null @@ -1,69 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Confirm Add Institutional Feature opens confirm institutional sucessfully 1`] = ` -
-
-
-

- Institutional Features -

-

- The page at origin would like to authorise the following project’s compliance settings in MetaMask Institutional -

-
-
-

- Project Name -

-

- projectName -

-

- Id - : - projectId -

-
- -
-
- - -
-
-
-
-`; 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 deleted file mode 100644 index bc528a094..000000000 --- a/ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.js +++ /dev/null @@ -1,217 +0,0 @@ -import React, { useState, useContext, useEffect } from 'react'; -import { useSelector, useDispatch } from 'react-redux'; -import PropTypes from 'prop-types'; -import { useI18nContext } from '../../../hooks/useI18nContext'; -import Button from '../../../components/ui/button'; -import PulseLoader from '../../../components/ui/pulse-loader'; -import { INSTITUTIONAL_FEATURES_DONE_ROUTE } from '../../../helpers/constants/routes'; -import { MetaMetricsContext } from '../../../contexts/metametrics'; -import { getMostRecentOverviewPage } from '../../../ducks/history/history'; -import { - BUTTON_SIZES, - BUTTON_VARIANT, -} from '../../../components/component-library'; -import { Text } from '../../../components/component-library/text/deprecated'; -import { - TextColor, - TextVariant, - OVERFLOW_WRAP, - TEXT_ALIGN, - DISPLAY, -} 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(); - const dispatch = useDispatch(); - const mmiActions = mmiActionsFactory(); - const [isLoading, setIsLoading] = useState(false); - const [connectError, setConnectError] = useState(''); - const mostRecentOverviewPage = useSelector(getMostRecentOverviewPage); - const connectRequests = useSelector( - (state) => state.metamask.institutionalFeatures?.connectRequests, - ); - - const trackEvent = useContext(MetaMetricsContext); - const connectRequest = connectRequests[0]; - - useEffect(() => { - if (!connectRequest) { - history.push(mostRecentOverviewPage); - } - }, [connectRequest, history, mostRecentOverviewPage]); - - if (!connectRequest) { - return null; - } - - const serviceLabel = connectRequest.labels.find( - (label) => label.key === 'service', - ); - - const sendEvent = ({ actions, service }) => { - trackEvent({ - category: MetaMetricsEventCategory.MMI, - event: MetaMetricsEventName.InstitutionalFeatureConnected, - properties: { - actions, - service, - }, - }); - }; - - const handleConnectError = ({ message }) => { - let error = message; - if (message.startsWith('401')) { - error = t('projectIdInvalid'); - } - - if (!error) { - error = t('connectionError'); - } - - setIsLoading(false); - setConnectError(error); - sendEvent({ actions: 'Institutional feature RPC error' }); - }; - - const removeConnectInstitutionalFeature = ({ actions, service, push }) => { - dispatch( - mmiActions.removeConnectInstitutionalFeature({ - origin: connectRequest.origin, - projectId: connectRequest.token.projectId, - }), - ); - sendEvent({ actions, service }); - history.push(push); - }; - - const confirmAddInstitutionalFeature = async () => { - setIsLoading(true); - setConnectError(''); - - try { - await dispatch( - mmiActions.setComplianceAuthData({ - clientId: connectRequest.token.clientId, - projectId: connectRequest.token.projectId, - }), - ); - removeConnectInstitutionalFeature({ - actions: 'Institutional feature RPC confirm', - service: serviceLabel.value, - push: { - pathname: INSTITUTIONAL_FEATURES_DONE_ROUTE, - state: { - imgSrc: 'images/compliance-logo.png', - title: t('complianceActivatedTitle'), - description: t('complianceActivatedDesc'), - }, - }, - }); - } catch (e) { - handleConnectError(e); - } - }; - - sendEvent({ - actions: 'Institutional feature RPC request', - service: serviceLabel.value, - }); - - return ( - - - - {t('institutionalFeatures')} - - - {t('mmiAuthenticate', [connectRequest.origin, serviceLabel.value])} - - - - - {t('projectName')} - - - {connectRequest?.token?.projectName} - - - {t('id')}: {connectRequest?.token?.projectId} - - - {connectError && ( - - {connectError} - - )} - - - {isLoading ? ( - - ) : ( - - - - - )} - - - ); -} - -ConfirmAddInstitutionalFeature.propTypes = { - history: PropTypes.object, -}; diff --git a/ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.stories.js b/ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.stories.js deleted file mode 100644 index 383013a44..000000000 --- a/ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.stories.js +++ /dev/null @@ -1,57 +0,0 @@ -import React from 'react'; -import { Provider } from 'react-redux'; -import configureStore from '../../../store/store'; -import testData from '../../../../.storybook/test-data'; -import ConfirmAddInstitutionalFeature from '.'; - -const customData = { - ...testData, - metamask: { - providerConfig: { - type: 'test', - }, - institutionalFeatures: { - complianceProjectId: '', - connectRequests: [ - { - labels: [ - { - key: 'service', - value: 'test', - }, - ], - origin: 'origin', - token: { - projectName: 'projectName', - projectId: 'projectId', - clientId: 'clientId', - }, - }, - ], - }, - preferences: { - useNativeCurrencyAsPrimaryCurrency: true, - }, - }, -}; - -const store = configureStore(customData); - -export default { - title: 'Pages/Institutional/ConfirmAddInstitutionalFeature', - decorators: [(story) => {story()}], - component: ConfirmAddInstitutionalFeature, - args: { - history: { - push: () => { - /**/ - }, - }, - }, -}; - -export const DefaultStory = (args) => ( - -); - -DefaultStory.storyName = 'ConfirmAddInstitutionalFeature'; diff --git a/ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.test.js b/ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.test.js deleted file mode 100644 index 6815adafe..000000000 --- a/ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.test.js +++ /dev/null @@ -1,122 +0,0 @@ -import React from 'react'; -import { fireEvent, screen } from '@testing-library/react'; -import configureMockStore from 'redux-mock-store'; -import thunk from 'redux-thunk'; -import { renderWithProvider } from '../../../../test/lib/render-helpers'; -import mockState from '../../../../test/data/mock-state.json'; -import ConfirmAddInstitutionalFeature from '.'; - -const mockRemoveConnectInstitutionalFeature = jest - .fn() - .mockReturnValue({ type: 'TYPE' }); - -let mockSetComplianceAuthData = jest.fn().mockReturnValue({ type: 'TYPE' }); - -jest.mock('../../../store/institutional/institution-background', () => ({ - mmiActionsFactory: () => ({ - setComplianceAuthData: mockSetComplianceAuthData, - removeConnectInstitutionalFeature: mockRemoveConnectInstitutionalFeature, - }), -})); - -const connectRequests = [ - { - labels: [ - { - key: 'service', - value: 'test', - }, - ], - origin: 'origin', - token: { - projectName: 'projectName', - projectId: 'projectId', - clientId: 'clientId', - }, - }, -]; - -const props = { - history: { - push: jest.fn(), - }, -}; - -const render = ({ newState } = {}) => { - const state = { - ...mockState, - metamask: { - providerConfig: { - type: 'test', - }, - institutionalFeatures: { - complianceProjectId: '', - connectRequests, - }, - preferences: { - useNativeCurrencyAsPrimaryCurrency: true, - }, - ...newState, - }, - }; - const middlewares = [thunk]; - const mockStore = configureMockStore(middlewares); - const store = mockStore(state); - - return renderWithProvider( - , - store, - ); -}; - -describe('Confirm Add Institutional Feature', function () { - it('opens confirm institutional sucessfully', () => { - const { container } = render(); - expect(container).toMatchSnapshot(); - expect( - screen.getByText(`Id: ${connectRequests[0].token.projectId}`), - ).toBeInTheDocument(); - }); - - it('runs removeConnectInstitutionalFeature on cancel click', () => { - render(); - fireEvent.click(screen.queryByText('Cancel')); - expect(mockRemoveConnectInstitutionalFeature).toHaveBeenCalledTimes(1); - expect(mockRemoveConnectInstitutionalFeature).toHaveBeenCalledWith({ - origin: connectRequests[0].origin, - projectId: connectRequests[0].token.projectId, - }); - expect(props.history.push).toHaveBeenCalledTimes(1); - }); - - it('runs setComplianceAuthData on confirm click', () => { - render(); - fireEvent.click(screen.queryByText('Confirm')); - expect(mockSetComplianceAuthData).toHaveBeenCalledTimes(1); - expect(mockSetComplianceAuthData).toHaveBeenCalledWith({ - clientId: connectRequests[0].token.clientId, - projectId: connectRequests[0].token.projectId, - }); - }); - - it('handles error', () => { - mockSetComplianceAuthData = jest - .fn() - .mockReturnValue(new Error('Async error message')); - const { queryByTestId } = render(); - fireEvent.click(screen.queryByText('Confirm')); - expect(queryByTestId('connect-error-message')).toBeInTheDocument(); - }); - - it('does not render without connectRequest', () => { - const newState = { - institutionalFeatures: { - connectRequests: [], - }, - }; - const { queryByTestId } = render({ newState }); - expect( - queryByTestId('confirm-add-institutional-feature'), - ).not.toBeInTheDocument(); - }); -}); diff --git a/ui/pages/institutional/confirm-add-institutional-feature/index.js b/ui/pages/institutional/confirm-add-institutional-feature/index.js deleted file mode 100644 index 062300085..000000000 --- a/ui/pages/institutional/confirm-add-institutional-feature/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import ConfirmAddInstitutionalFeature from './confirm-add-institutional-feature'; - -export default ConfirmAddInstitutionalFeature; diff --git a/ui/pages/institutional/interactive-replacement-token-page/interactive-replacement-token-page.stories.js b/ui/pages/institutional/interactive-replacement-token-page/interactive-replacement-token-page.stories.js index ed51dbc78..4b3c52735 100644 --- a/ui/pages/institutional/interactive-replacement-token-page/interactive-replacement-token-page.stories.js +++ b/ui/pages/institutional/interactive-replacement-token-page/interactive-replacement-token-page.stories.js @@ -30,7 +30,6 @@ const customData = { ], }, institutionalFeatures: { - complianceProjectId: '', connectRequests: [ { labels: [ diff --git a/ui/pages/institutional/interactive-replacement-token-page/interactive-replacement-token-page.test.js b/ui/pages/institutional/interactive-replacement-token-page/interactive-replacement-token-page.test.js index 187acf4f9..a888b0a89 100644 --- a/ui/pages/institutional/interactive-replacement-token-page/interactive-replacement-token-page.test.js +++ b/ui/pages/institutional/interactive-replacement-token-page/interactive-replacement-token-page.test.js @@ -70,11 +70,6 @@ const connectRequests = [ labels, origin: 'origin', apiUrl: 'apiUrl', - token: { - projectName: 'projectName', - projectId: 'projectId', - clientId: 'clientId', - }, }, ]; @@ -109,7 +104,6 @@ const render = ({ newState } = {}) => { ], }, institutionalFeatures: { - complianceProjectId: '', connectRequests, }, ...newState, diff --git a/ui/pages/pages.scss b/ui/pages/pages.scss index b582d5fa5..5907e6234 100644 --- a/ui/pages/pages.scss +++ b/ui/pages/pages.scss @@ -13,13 +13,12 @@ @import 'connected-accounts/index'; @import 'connected-sites/index'; @import 'create-account/connect-hardware/index'; +///: BEGIN:ONLY_INCLUDE_IN(build-mmi) @import "institutional/connect-custody/index"; @import "institutional/institutional-entity-done-page/index"; -@import "institutional/compliance-feature-page/index"; @import "institutional/confirm-add-custodian-token/index"; @import "institutional/interactive-replacement-token-page/index"; -@import 'institutional/interactive-replacement-token-page/index'; -@import 'institutional/confirm-add-custodian-token/index'; +///: END:ONLY_INCLUDE_IN @import 'error/index'; @import 'send/gas-display/index'; @import 'home/index'; diff --git a/ui/pages/routes/routes.component.js b/ui/pages/routes/routes.component.js index 681f05a51..59b9bf73f 100644 --- a/ui/pages/routes/routes.component.js +++ b/ui/pages/routes/routes.component.js @@ -51,10 +51,8 @@ import DesktopErrorPage from '../desktop-error'; import DesktopPairingPage from '../desktop-pairing'; ///: END:ONLY_INCLUDE_IN ///: BEGIN:ONLY_INCLUDE_IN(build-mmi) -import ComplianceFeaturePage from '../institutional/compliance-feature-page'; import InstitutionalEntityDonePage from '../institutional/institutional-entity-done-page'; import InteractiveReplacementTokenNotification from '../../components/institutional/interactive-replacement-token-notification'; -import ConfirmAddInstitutionalFeature from '../institutional/confirm-add-institutional-feature'; import ConfirmAddCustodianToken from '../institutional/confirm-add-custodian-token'; import InteractiveReplacementTokenPage from '../institutional/interactive-replacement-token-page'; import CustodyPage from '../institutional/custody'; @@ -83,10 +81,8 @@ import { ONBOARDING_UNLOCK_ROUTE, TOKEN_DETAILS, ///: BEGIN:ONLY_INCLUDE_IN(build-mmi) - COMPLIANCE_FEATURE_ROUTE, INSTITUTIONAL_FEATURES_DONE_ROUTE, CUSTODY_ACCOUNT_DONE_ROUTE, - CONFIRM_INSTITUTIONAL_FEATURE_CONNECT, CONFIRM_ADD_CUSTODIAN_TOKEN, INTERACTIVE_REPLACEMENT_TOKEN_PAGE, CUSTODY_ACCOUNT_ROUTE, @@ -327,14 +323,6 @@ export default class Routes extends Component { component={InteractiveReplacementTokenPage} exact /> - - { getCustodianSignMessageDeepLink: jest.fn(), getCustodianToken: jest.fn(), getCustodianJWTList: jest.fn(), - setComplianceAuthData: jest.fn(), - deleteComplianceAuthData: jest.fn(), - generateComplianceReport: jest.fn(), - getComplianceHistoricalReportsByAddress: jest.fn(), - syncReportsInProgress: jest.fn(), - removeConnectInstitutionalFeature: jest.fn(), removeAddTokenConnectRequest: jest.fn(), setCustodianConnectRequest: jest.fn(), getCustodianConnectRequest: jest.fn(), @@ -78,24 +72,6 @@ describe('Institution Actions', () => { custodianType: 'custodianType', token: 'token', }); - mmiActions.setComplianceAuthData({ - clientId: 'id', - projectId: 'projectId', - }); - mmiActions.deleteComplianceAuthData(); - mmiActions.generateComplianceReport('0xAddress'); - mmiActions.getComplianceHistoricalReportsByAddress( - '0xAddress', - 'projectId', - ); - mmiActions.syncReportsInProgress({ - address: '0xAddress', - historicalReports: [], - }); - mmiActions.removeConnectInstitutionalFeature({ - origin: 'origin', - projectId: 'projectId', - }); mmiActions.removeAddTokenConnectRequest({ origin: 'origin', apiUrl: 'https://jupiter-custody.codefi.network', diff --git a/ui/store/institutional/institution-background.ts b/ui/store/institutional/institution-background.ts index 626f43844..40a5696d3 100644 --- a/ui/store/institutional/institution-background.ts +++ b/ui/store/institutional/institution-background.ts @@ -189,24 +189,6 @@ export function mmiActionsFactory() { 'setWaitForConfirmDeepLinkDialog', waitForConfirmDeepLinkDialog, ), - setComplianceAuthData: (clientId: string, projectId: string) => - createAsyncAction('setComplianceAuthData', [{ clientId, projectId }]), - deleteComplianceAuthData: () => - createAsyncAction('deleteComplianceAuthData', []), - generateComplianceReport: (address: string) => - createAction('generateComplianceReport', address), - getComplianceHistoricalReportsByAddress: ( - address: string, - projectId: string, - ) => - createAsyncAction('getComplianceHistoricalReportsByAddress', [ - address, - projectId, - ]), - syncReportsInProgress: (address: string, historicalReports: []) => - createAction('syncReportsInProgress', { address, historicalReports }), - removeConnectInstitutionalFeature: (origin: string, projectId: string) => - createAction('removeConnectInstitutionalFeature', { origin, projectId }), removeAddTokenConnectRequest: ({ origin, apiUrl,