refactor(analytics): migrate Batch 3-10: mobile-platform#26560
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. |
…3-10_mobile-platform
…3-10_mobile-platform
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
The changes are limited to:
The hooks provide the same interface ( Selected tags rationale:
While the risk is low (pure refactoring), running these tests provides confidence that the analytics hook migration doesn't break any critical user flows involving SRP import and account management. Performance Test Selection: |
Description
Phase 3 analytics migration (Batch 3-10): migrate Onboarding/Account Import's ImportNewSecretRecoveryPhrase, ExperienceEnhancerModal, and Pna25BottomSheet from useMetrics/MetaMetrics to the new analytics system.
Reason: Deprecate MetaMetrics in favour of the shared analytics utility and AnalyticsController.
Changes: ImportNewSecretRecoveryPhrase, ExperienceEnhancerModal, and Pna25BottomSheet now use
useAnalyticsandAnalyticsEventBuilderfromapp/components/hooks/useAnalyticsandapp/util/analytics; test mocks updated to mock useAnalytics instead of useMetrics. ImportFromSecretRecoveryPhrase already used useAnalytics — no migration needed.Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/MCWP-302 (Batch 3-10)
Manual testing steps
Screenshots/Recordings
N/A – analytics migration, no UI change.
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Replaces the legacy
useMetricsanalytics hook withuseAnalyticsin onboarding/consent flows, which could change or break event emission/consent traits if the new builder/hook behavior differs. No functional UI changes, but tracking correctness is compliance- and telemetry-sensitive.Overview
Migrates analytics instrumentation in ExperienceEnhancerModal, ImportNewSecretRecoveryPhrase, and Pna25BottomSheet from legacy
useMetricstouseAnalytics, updating event/builder usage (e.g., SRP import completion and PNA25 notice events) while keeping existingMetaMetricsEventsnames.Updates Jest tests to mock
useAnalyticsand (for SRP import) swapMetricsEventBuilderreferences toAnalyticsEventBuilder, ensuring tracking assertions still validate emitted events/properties.Written by Cursor Bugbot for commit 09f4586. This will update automatically on new commits. Configure here.