-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: add privacy query params to portfolio navigation #25958
Changes from all commits
31a51bb
f700dd3
df8eb69
91b07bd
88fdc3f
4516f36
b83ae62
6b3e19e
9420554
27c3b7e
5e7ccb3
246c3da
bfdca88
b7886b4
aef1d74
1e31967
fbda63b
8443abf
2b321a9
332feee
2f1066f
f7b1ec8
4ae034a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,9 @@ import GanacheContractAddressRegistry from '../../seeder/ganache-contract-addres | |
import { Driver } from '../../webdriver/driver'; | ||
import { BridgePage, getBridgeFixtures } from './bridge-test-utils'; | ||
|
||
const EXPECTED_PORTFOLIO_URL = | ||
'https://portfolio.metamask.io/bridge?metametricsId=null&metricsEnabled=false&marketingEnabled=false'; | ||
|
||
describe('Click bridge button from asset page @no-mmi', function (this: Suite) { | ||
it('loads portfolio tab when flag is turned off', async function () { | ||
await withFixtures( | ||
|
@@ -25,18 +28,13 @@ describe('Click bridge button from asset page @no-mmi', function (this: Suite) { | |
// ETH | ||
await bridgePage.loadAssetPage(contractRegistry); | ||
await bridgePage.load('coin-overview'); | ||
await bridgePage.verifyPortfolioTab( | ||
'https://portfolio.metamask.io/bridge?metametricsId=null', | ||
); | ||
|
||
await bridgePage.verifyPortfolioTab(EXPECTED_PORTFOLIO_URL); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Updated URL verification to include |
||
await bridgePage.reloadHome(); | ||
|
||
// TST | ||
await bridgePage.loadAssetPage(contractRegistry, 'TST'); | ||
await bridgePage.load('token-overview'); | ||
await bridgePage.verifyPortfolioTab( | ||
'https://portfolio.metamask.io/bridge?metametricsId=null', | ||
); | ||
await bridgePage.verifyPortfolioTab(EXPECTED_PORTFOLIO_URL); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Updated URL verification to include |
||
}, | ||
); | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ describe('Click bridge button from wallet overview @no-mmi', function (this: Sui | |
await logInWithBalanceValidation(driver, ganacheServer); | ||
await bridgePage.load(); | ||
await bridgePage.verifyPortfolioTab( | ||
'https://portfolio.metamask.io/bridge?metametricsId=null', | ||
'https://portfolio.metamask.io/bridge?metametricsId=null&metricsEnabled=false&marketingEnabled=false', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Added |
||
); | ||
}, | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,10 +42,10 @@ describe('Portfolio site', function () { | |
await driver.switchToWindowWithTitle('E2E Test Page', windowHandles); | ||
|
||
// Verify site | ||
assert.equal( | ||
await driver.getCurrentUrl(), | ||
'https://portfolio.metamask.io/?metamaskEntry=ext_portfolio_button&metametricsId=null', | ||
); | ||
const currentUrl = await driver.getCurrentUrl(); | ||
const expectedUrl = | ||
'https://portfolio.metamask.io/?metamaskEntry=ext_portfolio_button&metametricsId=null&metricsEnabled=false&marketingEnabled=false'; | ||
assert.equal(currentUrl, expectedUrl); | ||
Comment on lines
+45
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Updated the expected URL to include |
||
}, | ||
); | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import React from 'react'; | ||
import configureMockStore from 'redux-mock-store'; | ||
import { fireEvent } from '@testing-library/react'; | ||
import { fireEvent, waitFor } from '@testing-library/react'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Added |
||
import thunk from 'redux-thunk'; | ||
import { Cryptocurrency } from '@metamask/assets-controllers'; | ||
import { BtcAccountType, BtcMethod } from '@metamask/keyring-api'; | ||
|
@@ -208,6 +208,7 @@ describe('BtcOverview', () => { | |
metamaskEntry: RampsMetaMaskEntry.BuySellButton, | ||
chainId: MultichainNetworks.BITCOIN, | ||
metametricsId: mockMetaMetricsId, | ||
metricsEnabled: String(false), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Added |
||
}), | ||
}); | ||
}); | ||
|
@@ -227,11 +228,12 @@ describe('BtcOverview', () => { | |
fireEvent.click(portfolioButton as HTMLElement); | ||
|
||
expect(openTabSpy).toHaveBeenCalledTimes(1); | ||
expect(openTabSpy).toHaveBeenCalledWith({ | ||
url: makePortfolioUrl('', { | ||
metamaskEntry: 'ext_portfolio_button', | ||
metametricsId: mockMetaMetricsId, | ||
await waitFor(() => | ||
expect(openTabSpy).toHaveBeenCalledWith({ | ||
url: expect.stringContaining( | ||
`?metamaskEntry=ext_portfolio_button&metametricsId=${mockMetaMetricsId}`, | ||
), | ||
}), | ||
Comment on lines
+231
to
236
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Updated test to use |
||
}); | ||
); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,9 @@ import { | |
///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask) | ||
SwapsEthToken, | ||
getCurrentKeyring, | ||
getDataCollectionForMarketing, | ||
getMetaMetricsId, | ||
getParticipateInMetaMetrics, | ||
Comment on lines
+39
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Added selectors to fetch privacy preferences for marketing and MetaMetrics. |
||
///: END:ONLY_INCLUDE_IF | ||
getUseExternalServices, | ||
} from '../../../selectors'; | ||
|
@@ -97,6 +99,8 @@ const CoinButtons = ({ | |
///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask) | ||
const location = useLocation(); | ||
const metaMetricsId = useSelector(getMetaMetricsId); | ||
const isMetaMetricsEnabled = useSelector(getParticipateInMetaMetrics); | ||
const isMarketingEnabled = useSelector(getDataCollectionForMarketing); | ||
Comment on lines
+102
to
+103
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Fetched MetaMetrics and marketing preferences using Redux selectors. |
||
const keyring = useSelector(getCurrentKeyring); | ||
const usingHardwareWallet = isHardwareKeyring(keyring?.type); | ||
///: END:ONLY_INCLUDE_IF | ||
|
@@ -287,6 +291,8 @@ const CoinButtons = ({ | |
'bridge', | ||
'ext_bridge_button', | ||
metaMetricsId, | ||
isMetaMetricsEnabled, | ||
isMarketingEnabled, | ||
); | ||
global.platform.openTab({ | ||
url: `${portfolioUrl}${ | ||
|
@@ -307,7 +313,13 @@ const CoinButtons = ({ | |
}, [isBridgeChain, chainId, metaMetricsId]); | ||
|
||
const handlePortfolioOnClick = useCallback(() => { | ||
const url = getPortfolioUrl('', 'ext_portfolio_button', metaMetricsId); | ||
const url = getPortfolioUrl( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Included privacy preferences in the portfolio URL. |
||
'', | ||
'ext_portfolio_button', | ||
metaMetricsId, | ||
isMetaMetricsEnabled, | ||
isMarketingEnabled, | ||
); | ||
global.platform.openTab({ url }); | ||
trackEvent({ | ||
category: MetaMetricsEventCategory.Navigation, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,8 @@ import { | |
getMetaMetricsId, | ||
getTestNetworkBackgroundColor, | ||
getTokensMarketData, | ||
getParticipateInMetaMetrics, | ||
getDataCollectionForMarketing, | ||
Comment on lines
39
to
+43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Added selectors to fetch user privacy preferences for MetaMetrics and marketing data collection. |
||
} from '../../../selectors'; | ||
import { | ||
getMultichainCurrentChainId, | ||
|
@@ -82,8 +84,10 @@ export const TokenListItem = ({ | |
const isEvm = useSelector(getMultichainIsEvm); | ||
const primaryTokenImage = useSelector(getMultichainNativeCurrencyImage); | ||
const trackEvent = useContext(MetaMetricsContext); | ||
const metaMetricsId = useSelector(getMetaMetricsId); | ||
const chainId = useSelector(getMultichainCurrentChainId); | ||
const metaMetricsId = useSelector(getMetaMetricsId); | ||
const isMetaMetricsEnabled = useSelector(getParticipateInMetaMetrics); | ||
const isMarketingEnabled = useSelector(getDataCollectionForMarketing); | ||
Comment on lines
84
to
+90
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Fetched user privacy preferences using Redux selectors. |
||
|
||
// Scam warning | ||
const showScamWarning = | ||
|
@@ -133,7 +137,13 @@ export const TokenListItem = ({ | |
onClick={(e) => { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
const url = getPortfolioUrl('stake', 'ext_stake_button', metaMetricsId); | ||
const url = getPortfolioUrl( | ||
'stake', | ||
'ext_stake_button', | ||
metaMetricsId, | ||
isMetaMetricsEnabled, | ||
isMarketingEnabled, | ||
Comment on lines
137
to
+145
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Updated the URL generation logic to include
Comment on lines
+143
to
+145
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Logic: Potential security issue: Ensure that the values of |
||
); | ||
global.platform.openTab({ url }); | ||
trackEvent({ | ||
event: MetaMetricsEventName.StakingEntryPointClicked, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,8 @@ import { | |
getMetaMetricsId, | ||
getUseTokenDetection, | ||
getUseExternalServices, | ||
getParticipateInMetaMetrics, | ||
getDataCollectionForMarketing, | ||
Comment on lines
21
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Added selectors to fetch user privacy preferences for MetaMetrics and marketing data collection. |
||
} from '../../../selectors'; | ||
import { setFirstTimeUsedNetwork } from '../../../store/actions'; | ||
import { | ||
|
@@ -49,6 +51,8 @@ export default function NewNetworkInfo() { | |
const currentNetwork = useSelector(getCurrentNetwork); | ||
const metaMetricsId = useSelector(getMetaMetricsId); | ||
const isBridgeChain = useSelector(getIsBridgeChain); | ||
const isMetaMetricsEnabled = useSelector(getParticipateInMetaMetrics); | ||
const isMarketingEnabled = useSelector(getDataCollectionForMarketing); | ||
Comment on lines
51
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Fetched user privacy preferences for MetaMetrics and marketing data collection from the Redux store. |
||
|
||
const onCloseClick = () => { | ||
setShowPopup(false); | ||
|
@@ -203,6 +207,8 @@ export default function NewNetworkInfo() { | |
'bridge', | ||
'ext_bridge_new_network_info_link', | ||
metaMetricsId, | ||
isMetaMetricsEnabled, | ||
isMarketingEnabled, | ||
Comment on lines
207
to
+211
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Appended |
||
)}&destChain=${currentNetwork?.chainId}`} | ||
target="_blank" | ||
rel="noreferrer" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,18 @@ export function getPortfolioUrl( | |
endpoint = '', | ||
metamaskEntry = '', | ||
metaMetricsId = '', | ||
metricsEnabled = false, | ||
marketingEnabled = false, | ||
Comment on lines
+5
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Added |
||
) { | ||
const portfolioUrl = process.env.PORTFOLIO_URL || ''; | ||
return `${portfolioUrl}/${endpoint}?metamaskEntry=${metamaskEntry}&metametricsId=${metaMetricsId}`; | ||
const baseUrl = process.env.PORTFOLIO_URL || ''; | ||
const url = new URL(endpoint, baseUrl); | ||
|
||
url.searchParams.append('metamaskEntry', metamaskEntry); | ||
url.searchParams.append('metametricsId', metaMetricsId); | ||
|
||
// Append privacy preferences for metrics + marketing on user navigation to Portfolio | ||
url.searchParams.append('metricsEnabled', String(metricsEnabled)); | ||
url.searchParams.append('marketingEnabled', String(marketingEnabled)); | ||
|
||
return url.href; | ||
Comment on lines
+8
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Updated URL construction to include new privacy parameters. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,7 @@ describe('useRamps', () => { | |
}, | ||
}; | ||
|
||
const mockBuyURI = `${process.env.PORTFOLIO_URL}/buy?metamaskEntry=${metaMaskEntry}&chainId=${mockChainId}&metametricsId=${mockedMetametricsId}`; | ||
const mockBuyURI = `${process.env.PORTFOLIO_URL}/buy?metamaskEntry=${metaMaskEntry}&chainId=${mockChainId}&metametricsId=${mockedMetametricsId}&metricsEnabled=false`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Added |
||
const openTabSpy = jest.spyOn(global.platform, 'openTab'); | ||
|
||
const { result } = renderHook(() => useRamps(), { wrapper }); // default metamask entry | ||
|
@@ -68,7 +68,7 @@ describe('useRamps', () => { | |
}, | ||
}; | ||
|
||
const mockBuyURI = `${process.env.PORTFOLIO_URL}/buy?metamaskEntry=${metaMaskEntry}&chainId=${mockChainId}&metametricsId=${mockedMetametricsId}`; | ||
const mockBuyURI = `${process.env.PORTFOLIO_URL}/buy?metamaskEntry=${metaMaskEntry}&chainId=${mockChainId}&metametricsId=${mockedMetametricsId}&metricsEnabled=false`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Included |
||
const openTabSpy = jest.spyOn(global.platform, 'openTab'); | ||
|
||
const { result } = renderHook( | ||
|
@@ -97,7 +97,7 @@ describe('useRamps', () => { | |
}, | ||
}; | ||
|
||
const mockBuyURI = `${process.env.PORTFOLIO_URL}/buy?metamaskEntry=ext_buy_sell_button&chainId=${mockChainId}&metametricsId=${mockedMetametricsId}`; | ||
const mockBuyURI = `${process.env.PORTFOLIO_URL}/buy?metamaskEntry=ext_buy_sell_button&chainId=${mockChainId}&metametricsId=${mockedMetametricsId}&metricsEnabled=false`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Updated mockBuyURI to include |
||
const openTabSpy = jest.spyOn(global.platform, 'openTab'); | ||
const { result } = renderHook(() => useRamps(), { wrapper }); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,12 @@ import { useCallback } from 'react'; | |
import { useSelector } from 'react-redux'; | ||
import { CaipChainId } from '@metamask/utils'; | ||
import { ChainId } from '../../../../shared/constants/network'; | ||
import { getCurrentChainId, getMetaMetricsId } from '../../../selectors'; | ||
import { | ||
getCurrentChainId, | ||
getDataCollectionForMarketing, | ||
getMetaMetricsId, | ||
getParticipateInMetaMetrics, | ||
Comment on lines
+7
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Added selectors to fetch marketing and MetaMetrics participation preferences. |
||
} from '../../../selectors'; | ||
|
||
type IUseRamps = { | ||
openBuyCryptoInPdapp: (chainId?: ChainId | CaipChainId) => void; | ||
|
@@ -23,6 +28,8 @@ const useRamps = ( | |
): IUseRamps => { | ||
const chainId = useSelector(getCurrentChainId); | ||
const metaMetricsId = useSelector(getMetaMetricsId); | ||
const isMetaMetricsEnabled = useSelector(getParticipateInMetaMetrics); | ||
const isMarketingEnabled = useSelector(getDataCollectionForMarketing); | ||
Comment on lines
+31
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Fetched MetaMetrics participation preference from the Redux store. |
||
|
||
Comment on lines
+32
to
33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Fetched marketing data collection preference from the Redux store. |
||
const getBuyURI = useCallback( | ||
(_chainId: ChainId | CaipChainId) => { | ||
|
@@ -32,6 +39,11 @@ const useRamps = ( | |
if (metaMetricsId) { | ||
params.set('metametricsId', metaMetricsId); | ||
} | ||
params.set('metricsEnabled', String(isMetaMetricsEnabled)); | ||
if (isMarketingEnabled) { | ||
params.set('marketingEnabled', String(isMarketingEnabled)); | ||
} | ||
Comment on lines
+42
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Added |
||
|
||
return `${portfolioUrl}/buy?${params.toString()}`; | ||
}, | ||
[metaMetricsId], | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -246,9 +246,7 @@ describe('AssetPage', () => { | |
|
||
await waitFor(() => | ||
expect(openTabSpy).toHaveBeenCalledWith({ | ||
url: expect.stringContaining( | ||
`/bridge?metamaskEntry=ext_bridge_button&metametricsId=&token=${token.address}`, | ||
), | ||
url: `https://portfolio.test/bridge?metamaskEntry=ext_bridge_button&metametricsId=&metricsEnabled=false&marketingEnabled=false&token=${token.address}`, | ||
}), | ||
Comment on lines
246
to
250
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Updated the expected URL to include |
||
); | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,8 @@ import { | |
getIsBridgeChain, | ||
getCurrentKeyring, | ||
getMetaMetricsId, | ||
getParticipateInMetaMetrics, | ||
getDataCollectionForMarketing, | ||
Comment on lines
+32
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Added selector to get MetaMetrics participation status. |
||
///: END:ONLY_INCLUDE_IF | ||
Comment on lines
+33
to
34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Added selector to get marketing data collection status. |
||
} from '../../../selectors'; | ||
import { INVALID_ASSET_TYPE } from '../../../helpers/constants/error-keys'; | ||
|
@@ -73,6 +75,8 @@ const TokenButtons = ({ | |
const isBridgeChain = useSelector(getIsBridgeChain); | ||
const isBuyableChain = useSelector(getIsNativeTokenBuyable); | ||
const metaMetricsId = useSelector(getMetaMetricsId); | ||
const isMetaMetricsEnabled = useSelector(getParticipateInMetaMetrics); | ||
const isMarketingEnabled = useSelector(getDataCollectionForMarketing); | ||
Comment on lines
+78
to
+79
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Retrieved MetaMetrics participation status from Redux store. |
||
const { openBuyCryptoInPdapp } = useRamps(); | ||
Comment on lines
+79
to
80
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Retrieved marketing data collection status from Redux store. |
||
///: END:ONLY_INCLUDE_IF | ||
|
||
|
@@ -284,6 +288,8 @@ const TokenButtons = ({ | |
'bridge', | ||
'ext_bridge_button', | ||
metaMetricsId, | ||
isMetaMetricsEnabled, | ||
isMarketingEnabled, | ||
); | ||
Comment on lines
+291
to
293
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Included new query parameters for privacy settings in the Portfolio URL. |
||
global.platform.openTab({ | ||
url: `${portfolioUrl}&token=${token.address}`, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ jest.mock('../../../contexts/transaction-modal', () => ({ | |
})); | ||
|
||
const EXPECTED_BUY_URL = | ||
'https://portfolio.test/buy?metamaskEntry=ext_buy_sell_button&chainId=0x5'; | ||
'https://portfolio.test/buy?metamaskEntry=ext_buy_sell_button&chainId=0x5&metricsEnabled=false'; | ||
Comment on lines
12
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Updated EXPECTED_BUY_URL to include metricsEnabled query parameter. |
||
|
||
function processAlertActionKey(actionKey: string) { | ||
const { result } = renderHookWithProvider( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,8 @@ import { | |
getHardwareWalletType, | ||
getIsBridgeChain, | ||
getMetaMetricsId, | ||
getParticipateInMetaMetrics, | ||
getDataCollectionForMarketing, | ||
} from '../../../selectors'; | ||
Comment on lines
64
to
69
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Added selectors to fetch user privacy preferences for MetaMetrics and marketing data collection. |
||
import { | ||
getSmartTransactionsOptInStatus, | ||
|
@@ -219,6 +221,8 @@ export default function PrepareSwapPage({ | |
const currentCurrency = useSelector(getCurrentCurrency); | ||
const fetchingQuotes = useSelector(getFetchingQuotes); | ||
const loadingComplete = !fetchingQuotes && areQuotesPresent; | ||
const isMetaMetricsEnabled = useSelector(getParticipateInMetaMetrics); | ||
const isMarketingEnabled = useSelector(getDataCollectionForMarketing); | ||
Comment on lines
221
to
+225
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Fetched user privacy preferences using the newly added selectors. |
||
|
||
const fetchParamsFromToken = isSwapsDefaultTokenSymbol( | ||
sourceTokenInfo?.symbol, | ||
|
@@ -1024,6 +1028,8 @@ export default function PrepareSwapPage({ | |
'bridge', | ||
'ext_bridge_prepare_swap_link', | ||
metaMetricsId, | ||
isMetaMetricsEnabled, | ||
isMarketingEnabled, | ||
); | ||
Comment on lines
1028
to
1033
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info: Passed the fetched privacy preferences to the |
||
|
||
global.platform.openTab({ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Info: Added
EXPECTED_PORTFOLIO_URL
constant to include new query parameters.