feat: convert optinmetrics code to typescript#23519
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
| const onPressLink = useCallback( | ||
| (linkParams: { url: string; title: string }) => { | ||
| ( | ||
| navigation as unknown as { |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsThis PR refactors the OptinMetrics component from a class-based React component to a functional component using hooks. The changes include:
Why SmokeAnalytics: This component is the MetaMetrics opt-in screen that handles user consent for analytics tracking. It directly relates to analytics functionality. Why SmokeCore: The OptinMetrics component is part of the core onboarding flow, used in navigation from ManualBackupStep2, AccountBackupStep1, ImportFromSecretRecoveryPhrase, and NetworkSettings. It affects core app state and navigation. Risk Assessment: Medium risk because:
The E2E tests using |
|





Description
Changelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Screen.Recording.2025-12-01.at.4.42.04.PM.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Migrates
OptinMetricsfrom class-based JS to a typed functional component, extracting styles/types and updating tests accordingly.app/components/UI/OptinMetrics/index.jsasindex.tsxusing hooks (useState,useEffect,useCallback), Redux hooks, and React Navigation hooks with typed route params.ANALYTICS_PREFERENCE_SELECTED, and adds device/user traits; preserves navigation reset and webview "Learn more" link handling.OptinMetrics.styles.tsand addsOptinMetrics.types.tsfor route/link params.index.test.tsxto importindex.tsx; tests cover checkbox interdependency, feature flag text, scroll/layout handlers, and analytics event emissions.Written by Cursor Bugbot for commit 42ee375. Configure here.