refactor(analytics): migrate Batch 2-13: card#26302
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. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
The Since this is a refactoring that affects only the Card feature's analytics implementation without changing any business logic or UI, the risk is low. However, running SmokeCard tests will verify that the Card feature still functions correctly after this migration and that analytics events are properly tracked. Performance Test Selection: |
|



Description
Phase 2 analytics migration (Batch 2-13): migrate Card's hooks, onboarding components, views, and UI components from
useMetricsto the new analytics system.Reason: Deprecate MetaMetrics in favour of the shared analytics utility and AnalyticsController.
Changes: All 27 Card source files now use
useAnalyticsfromapp/components/hooks/useAnalytics/useAnalyticsandMetaMetricsEventsfromapp/core/Analytics. Test mocks updated to mockuseAnalyticsinstead ofuseMetrics. 15 additional files were discovered via grep that were not in the original batch definition and have been included.Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/MCWP-297 (Batch 2-13)
Manual testing steps
Screenshots/Recordings
N/A – analytics migration, no UI change.
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Largely mechanical import/mocking changes that should not affect runtime behavior beyond analytics emission; main risk is mismapped event constants or broken test mocks causing missing telemetry.
Overview
Migrates MetaMask Card UI (views, onboarding screens, bottom sheets, and related hooks) from the legacy
useMetricshook to the newuseAnalyticshook, and switches event constants imports toMetaMetricsEventsfromapp/core/Analytics.Updates unit tests accordingly by replacing
useMetricsmocks withuseAnalyticsmocks and adjusting assertions to use the centralizedMetaMetricsEventsconstants (instead of string literals in mocks).Written by Cursor Bugbot for commit ca45463. This will update automatically on new commits. Configure here.