Skip to content

Commit 484fa2b

Browse files
authored
feat: MUSD-691 clean up deprecated quick convert code (#29351)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until this PR meets the canonical Definition of Ready For Review in `docs/readme/ready-for-review.md`. In short: the template must be materially complete (not just section titles present), all status checks must be currently passing, and the only expected follow-up commits must be reviewer-driven. --> ## **Description** This PR removes the now deprecated Quick Convert code paths. We're keeping the Max convert bottom sheet and the `MusdConversionAssetRow` components to integrate into the Money Home screen. <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: remove deprecated quick convert feature code paths ## **Related issues** Fixes: - [MUSD-691: Clean up deprecated Quick Convert Home and related code paths](https://consensyssoftware.atlassian.net/browse/MUSD-691) ## **Manual testing steps** N/A ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> N/A ### **After** <!-- [screenshots/recordings] --> N/A ## **Pre-merge author checklist** <!-- Every checklist item must be consciously assessed before marking this PR as "Ready for review". A checked box means you deliberately considered that responsibility, not that you literally performed every action listed. Unchecked boxes are ambiguous: they are not an implicit "N/A" and they are not a silent "skip". See `docs/readme/ready-for-review.md` for the full checklist semantics. --> - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. #### Performance checks (if applicable) - [ ] I've tested on Android - Ideally on a mid-range device; emulator is acceptable - [ ] I've tested with a power user scenario - Use these [power-user SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93) to import wallets with many accounts and tokens - [ ] I've instrumented key operations with Sentry traces for production performance metrics - See [`trace()`](/app/util/trace.ts) for usage and [`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274) for an example For performance guidelines and tooling, see the [Performance Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers). ## **Pre-merge reviewer checklist** <!-- Reviewer checklist items follow the same semantics as the author checklist: an unchecked box is ambiguous, a checked box means the reviewer consciously assessed that responsibility. See `docs/readme/ready-for-review.md`. --> - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Medium risk because it removes a navigation route/feature flag and rewires mUSD conversion CTAs and analytics to always use the custom-amount flow, which could affect user routing and event reporting if any remaining callers expected Quick Convert. > > **Overview** > Removes the deprecated mUSD **Quick Convert** flow end-to-end: deletes `MusdQuickConvertView` (and `MusdBalanceCard`), drops the `MM_MUSD_QUICK_CONVERT_ENABLED` env var, removes the quick-convert feature-flag selector/remote registry entries, and removes the `Routes.EARN.MUSD.QUICK_CONVERT` route. > > Updates mUSD conversion entry points (`useMusdConversion`, education screen, cash/token list/asset CTAs) to stop passing/handling `navigationOverride` and to always route/track redirects to `CUSTOM_AMOUNT_SCREEN` (while keeping the max-convert bottom sheet location constant). > > Renames `ConvertTokenRow` to `MusdConversionAssetRow` and updates downstream usage/tests (e.g., Money convert stablecoins, cash tokens skeleton) to use the new component/test IDs. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 74947e7. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 9b73aff commit 484fa2b

39 files changed

Lines changed: 139 additions & 1872 deletions

.js.env.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ export MM_POOLED_STAKING_ENABLED="true"
114114
export MM_POOLED_STAKING_SERVICE_INTERRUPTION_BANNER_ENABLED="true"
115115
# mUSD
116116
export MM_MUSD_CONVERSION_FLOW_ENABLED="false"
117-
export MM_MUSD_QUICK_CONVERT_ENABLED="false"
118117
# See app/components/UI/Earn/docs/wildcard-token-list.md for more information.
119118
export MM_MUSD_CONVERTIBLE_TOKENS_BLOCKLIST=''
120119
export MM_MUSD_CONVERTIBLE_TOKENS_ALLOWLIST=''

app/components/UI/Earn/Views/EarnMusdConversionEducationView/index.test.tsx

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ import { useMusdConversionFlowData } from '../../hooks/useMusdConversionFlowData
2121
import { useRampNavigation } from '../../../Ramp/hooks/useRampNavigation';
2222
import Routes from '../../../../../constants/navigation/Routes';
2323
import AppConstants from '../../../../../core/AppConstants';
24-
import { MUSD_CONVERSION_NAVIGATION_OVERRIDE } from '../../types/musd.types';
25-
import { selectMusdQuickConvertEnabledFlag } from '../../selectors/featureFlags';
2624
import { selectMoneyHubEnabledFlag } from '../../../Money/selectors/featureFlags';
2725
import { MUSD_EVENTS_CONSTANTS } from '../../constants/events';
2826
import { MONEY_EVENTS_CONSTANTS } from '../../../Money/constants/moneyEvents';
@@ -74,10 +72,6 @@ jest.mock('../../../Ramp/hooks/useRampNavigation', () => ({
7472
useRampNavigation: jest.fn(),
7573
}));
7674

77-
jest.mock('../../selectors/featureFlags', () => ({
78-
selectMusdQuickConvertEnabledFlag: jest.fn(() => false),
79-
}));
80-
8175
jest.mock('../../../Money/selectors/featureFlags', () => ({
8276
selectMoneyHubEnabledFlag: jest.fn(() => false),
8377
}));
@@ -123,10 +117,6 @@ const mockUseMusdConversionFlowData =
123117
const mockUseRampNavigation = useRampNavigation as jest.MockedFunction<
124118
typeof useRampNavigation
125119
>;
126-
const mockSelectMusdQuickConvertEnabledFlag =
127-
selectMusdQuickConvertEnabledFlag as jest.MockedFunction<
128-
typeof selectMusdQuickConvertEnabledFlag
129-
>;
130120
const mockSelectMoneyHubEnabledFlag =
131121
selectMoneyHubEnabledFlag as jest.MockedFunction<
132122
typeof selectMoneyHubEnabledFlag
@@ -236,7 +226,6 @@ describe('EarnMusdConversionEducationView', () => {
236226
goToSell: jest.fn(),
237227
goToDeposit: jest.fn(),
238228
});
239-
mockSelectMusdQuickConvertEnabledFlag.mockReturnValue(false);
240229
mockSelectMoneyHubEnabledFlag.mockReturnValue(false);
241230

242231
mockBuild.mockReturnValue({ name: 'mock-built-event' });
@@ -321,7 +310,6 @@ describe('EarnMusdConversionEducationView', () => {
321310
chainId: '0x1',
322311
},
323312
skipEducationCheck: true,
324-
navigationOverride: MUSD_CONVERSION_NAVIGATION_OVERRIDE.QUICK_CONVERT,
325313
});
326314
expect(mockNavigation.navigate).not.toHaveBeenCalledWith(
327315
Routes.WALLET.HOME,
@@ -512,7 +500,6 @@ describe('EarnMusdConversionEducationView', () => {
512500
chainId: mockConversionTokenHighBalance.chainId,
513501
},
514502
skipEducationCheck: true,
515-
navigationOverride: MUSD_CONVERSION_NAVIGATION_OVERRIDE.QUICK_CONVERT,
516503
});
517504
});
518505
});
@@ -1057,7 +1044,6 @@ describe('EarnMusdConversionEducationView', () => {
10571044
expect(mockInitiateConversion).toHaveBeenCalledWith({
10581045
preferredPaymentToken: mockRouteParams.preferredPaymentToken,
10591046
skipEducationCheck: true,
1060-
navigationOverride: MUSD_CONVERSION_NAVIGATION_OVERRIDE.QUICK_CONVERT,
10611047
});
10621048
});
10631049
});
@@ -1115,38 +1101,6 @@ describe('EarnMusdConversionEducationView', () => {
11151101
});
11161102
expect(mockInitiateConversion).not.toHaveBeenCalled();
11171103
});
1118-
1119-
it("forwards caller's navigationOverride (CUSTOM) to initiateCustomConversion instead of hardcoding QUICK_CONVERT", async () => {
1120-
mockUseParams.mockReturnValue({
1121-
preferredPaymentToken: {
1122-
address: '0xabc' as Hex,
1123-
chainId: '0x1' as Hex,
1124-
},
1125-
navigationOverride: MUSD_CONVERSION_NAVIGATION_OVERRIDE.CUSTOM,
1126-
});
1127-
1128-
const { getByTestId } = renderWithProvider(
1129-
<EarnMusdConversionEducationView />,
1130-
{ state: {} },
1131-
);
1132-
1133-
await act(async () => {
1134-
fireEvent.press(
1135-
getByTestId(
1136-
EARN_TEST_IDS.MUSD.CONVERSION_EDUCATION_VIEW.PRIMARY_BUTTON,
1137-
),
1138-
);
1139-
});
1140-
1141-
await waitFor(() => {
1142-
expect(mockInitiateConversion).toHaveBeenCalledWith(
1143-
expect.objectContaining({
1144-
navigationOverride: MUSD_CONVERSION_NAVIGATION_OVERRIDE.CUSTOM,
1145-
skipEducationCheck: true,
1146-
}),
1147-
);
1148-
});
1149-
});
11501104
});
11511105

11521106
describe('MetaMetrics', () => {
@@ -1232,42 +1186,6 @@ describe('EarnMusdConversionEducationView', () => {
12321186
});
12331187
});
12341188

1235-
it('tracks quick convert redirect when quick convert is enabled', async () => {
1236-
mockSelectMusdQuickConvertEnabledFlag.mockReturnValue(true);
1237-
1238-
const { getByTestId } = renderWithProvider(
1239-
<EarnMusdConversionEducationView />,
1240-
{ state: {} },
1241-
);
1242-
1243-
mockTrackEvent.mockClear();
1244-
mockCreateEventBuilder.mockClear();
1245-
mockAddProperties.mockClear();
1246-
mockBuild.mockClear();
1247-
1248-
await act(async () => {
1249-
fireEvent.press(
1250-
getByTestId(
1251-
EARN_TEST_IDS.MUSD.CONVERSION_EDUCATION_VIEW.PRIMARY_BUTTON,
1252-
),
1253-
);
1254-
});
1255-
1256-
await waitFor(() => {
1257-
expect(mockCreateEventBuilder).toHaveBeenCalledWith(
1258-
MetaMetricsEvents.MUSD_FULLSCREEN_ANNOUNCEMENT_BUTTON_CLICKED,
1259-
);
1260-
1261-
expect(mockAddProperties).toHaveBeenCalledWith({
1262-
location: 'conversion_education_screen',
1263-
button_type: 'primary',
1264-
button_text: strings('earn.musd_conversion.education.primary_button'),
1265-
redirects_to:
1266-
MUSD_EVENTS_CONSTANTS.EVENT_LOCATIONS.QUICK_CONVERT_HOME_SCREEN,
1267-
});
1268-
});
1269-
});
1270-
12711189
it('tracks fullscreen announcement button clicked event when go back button is pressed', () => {
12721190
const { getByTestId } = renderWithProvider(
12731191
<EarnMusdConversionEducationView />,

app/components/UI/Earn/Views/EarnMusdConversionEducationView/index.tsx

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ import { useRampNavigation } from '../../../Ramp/hooks/useRampNavigation';
4040
import { RampIntent } from '../../../Ramp/types';
4141
import { EARN_TEST_IDS } from '../../constants/testIds';
4242
import AppConstants from '../../../../../core/AppConstants';
43-
import {
44-
MUSD_CONVERSION_NAVIGATION_OVERRIDE,
45-
MusdNavigationTarget,
46-
} from '../../types/musd.types';
47-
import { selectMusdQuickConvertEnabledFlag } from '../../selectors/featureFlags';
43+
import { MusdNavigationTarget } from '../../types/musd.types';
4844
import { toChecksumAddress } from '../../../../../util/address';
4945
import { safeFormatChainIdToHex } from '../../../Card/util/safeFormatChainIdToHex';
5046
import { MONEY_EVENTS_CONSTANTS } from '../../../Money/constants/moneyEvents';
@@ -65,12 +61,6 @@ interface EarnMusdConversionEducationViewRouteParams {
6561
address: Hex;
6662
chainId: Hex;
6763
};
68-
/**
69-
* Caller's intended navigation override. When present, this is forwarded to
70-
* `initiateCustomConversion` on continue so the education screen doesn't hijack
71-
* the destination (e.g., pencil-in-Hub preserves CUSTOM; other callers keep their intent).
72-
*/
73-
navigationOverride?: MUSD_CONVERSION_NAVIGATION_OVERRIDE;
7464
/**
7565
* Pure-navigation exit target. When present, the primary button routes here and
7666
* skips conversion entirely. Use for entry points that only needed the education
@@ -86,18 +76,13 @@ interface EarnMusdConversionEducationViewRouteParams {
8676
const EarnMusdConversionEducationView = () => {
8777
const dispatch = useDispatch();
8878

89-
const isQuickConvertEnabled = useSelector(selectMusdQuickConvertEnabledFlag);
9079
const isMoneyHubEnabled = useSelector(selectMoneyHubEnabledFlag);
9180

9281
const { initiateCustomConversion } = useMusdConversion();
9382
const { goToBuy } = useRampNavigation();
9483

95-
const {
96-
preferredPaymentToken,
97-
isDeeplink,
98-
navigationOverride: callerNavigationOverride,
99-
returnTo,
100-
} = useParams<EarnMusdConversionEducationViewRouteParams>();
84+
const { preferredPaymentToken, isDeeplink, returnTo } =
85+
useParams<EarnMusdConversionEducationViewRouteParams>();
10186

10287
// Hooks for deeplink case (when no params provided)
10388
const {
@@ -219,9 +204,7 @@ const EarnMusdConversionEducationView = () => {
219204
}, [submitScreenViewedEvent]);
220205

221206
const submitContinuePressedEvent = useCallback(() => {
222-
let redirectsTo = isQuickConvertEnabled
223-
? MUSD_EVENT_LOCATIONS.QUICK_CONVERT_HOME_SCREEN
224-
: MUSD_EVENT_LOCATIONS.CUSTOM_AMOUNT_SCREEN;
207+
let redirectsTo = MUSD_EVENT_LOCATIONS.CUSTOM_AMOUNT_SCREEN;
225208
if (returnTo) {
226209
redirectsTo = MONEY_EVENT_LOCATIONS.MONEY_HUB;
227210
} else if (deeplinkState?.action === 'navigate_money_hub') {
@@ -245,9 +228,7 @@ const EarnMusdConversionEducationView = () => {
245228
.build(),
246229
);
247230
}, [
248-
isQuickConvertEnabled,
249231
returnTo,
250-
MUSD_EVENT_LOCATIONS.QUICK_CONVERT_HOME_SCREEN,
251232
MUSD_EVENT_LOCATIONS.CUSTOM_AMOUNT_SCREEN,
252233
MUSD_EVENT_LOCATIONS.CONVERSION_EDUCATION_SCREEN,
253234
MUSD_EVENT_LOCATIONS.HOME_SCREEN,
@@ -325,22 +306,15 @@ const EarnMusdConversionEducationView = () => {
325306
await initiateCustomConversion({
326307
preferredPaymentToken: deeplinkState.paymentToken,
327308
skipEducationCheck: true,
328-
navigationOverride:
329-
MUSD_CONVERSION_NAVIGATION_OVERRIDE.QUICK_CONVERT,
330309
});
331310
return;
332311
}
333312
}
334313

335-
// Proceed to conversion flow if we have the required params (normal flow).
336-
// Honor caller's navigationOverride; fall back to QUICK_CONVERT.
337314
if (!isDeeplink && preferredPaymentToken) {
338315
await initiateCustomConversion({
339316
preferredPaymentToken,
340317
skipEducationCheck: true,
341-
navigationOverride:
342-
callerNavigationOverride ??
343-
MUSD_CONVERSION_NAVIGATION_OVERRIDE.QUICK_CONVERT,
344318
});
345319
return;
346320
}
@@ -365,7 +339,6 @@ const EarnMusdConversionEducationView = () => {
365339
goToBuy,
366340
isDeeplink,
367341
returnTo,
368-
callerNavigationOverride,
369342
]);
370343

371344
const handleNotNow = () => {

app/components/UI/Earn/Views/MusdQuickConvertView/MusdQuickConvertView.styles.ts

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)