refactor(analytics): PR C1 useAnalytics for HW, recovery, onboarding#27738
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. |
# Conflicts: # app/components/UI/LedgerModals/LedgerConfirmationModal.test.tsx # app/components/UI/LedgerModals/LedgerConfirmationModal.tsx
2c22bd8 to
bf5858f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf5858f7b5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…uding action properties
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
The migration from Performance tests are not warranted as these are analytics hook migrations with no impact on rendering, data loading, or app startup performance. Performance Test Selection: |
|
✅ E2E Fixture Validation — Schema is up to date |
|



Description
Part of the analytics cleanup workstream (#26686). Delivers PR C1: migrate
useMetricstouseAnalyticsin hardware wallet, wallet recovery, onboarding-adjacent, and related UI (~27 files).LedgerConfirmationModal,LedgerConnect(Scan, entry), andConnectHardware/SelectHardwarenow calluseAnalyticsfromapp/components/hooks/useAnalytics/useAnalyticsinstead ofuseMetrics.ConnectQRHardware(container +Instruction),AnimatedQRScanner, andQRSigningDetailsuse the same hook swap; event names andMetaMetricsEvents/ builder usage stay as before.RestoreWallet,WalletRestored, andWalletResetNeeded(+ tests) migrated touseAnalytics.OnboardingSuccess/OnboardingGeneralSettings,OnboardingSuccess/OnboardingSecuritySettings(+ test) migrated.ExperienceEnhancerModal,NftGridandNftGridItemActionSheettests—aligned with the C1 slice that includes onboarding-adjacent and shared UI still on legacy metrics.jest.mocktargets point atuseAnalytics; mocks usecreateMockUseAnalyticsHookfromapp/util/test/analyticsMock. Where builders were referenced from tests, imports useAnalyticsEventBuilderfromapp/util/analytics/AnalyticsEventBuilderinstead ofMetricsEventBuilder.No change to which events fire or their payloads—this is an API migration only, consistent with prior analytics refactors (e.g. PR A2 — split types from MetaMetrics).
Changelog
CHANGELOG entry: null
Related issues
Fixes: #26812
Refs: #26686
Manual testing steps
N/A — refactor-only; behavior and analytics events are unchanged. Unit tests cover updated mocks and components.
Screenshots/Recordings
Before
N/A
After
N/A
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Mostly a hook/API swap, but it touches user-facing hardware wallet and recovery/onboarding flows and can subtly change analytics payloads or break tracking if the new hook differs from
useMetrics. One NFT tracking event (WALLET_ADD_COLLECTIBLES) also gains additional properties, changing event data.Overview
Swaps analytics wiring across Ledger/QR hardware wallet UI, wallet recovery views, and onboarding success settings to use
useAnalyticsinstead ofuseMetrics, including updating imports and call sites.Updates unit tests to mock
useAnalyticsconsistently viacreateMockUseAnalyticsHook/AnalyticsEventBuilder, and adjusts one NFT event (MetaMetricsEvents.WALLET_ADD_COLLECTIBLES) to include extra properties in its payload.Written by Cursor Bugbot for commit aee6674. This will update automatically on new commits. Configure here.