Skip to content

refactor(analytics): migrate Batch 3-11: mobile-platform#26567

Merged
NicolasMassart merged 3 commits into
mainfrom
refactor/MCWP-297_analytics_migration_batch_3-11_mobile-platform
Feb 27, 2026
Merged

refactor(analytics): migrate Batch 3-11: mobile-platform#26567
NicolasMassart merged 3 commits into
mainfrom
refactor/MCWP-297_analytics_migration_batch_3-11_mobile-platform

Conversation

@NicolasMassart

@NicolasMassart NicolasMassart commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Description

Phase 3 analytics migration (Batch 3-11): migrate Hardware Wallet's LedgerSelectAccount component from useMetrics to the new analytics system.

Reason: Deprecate MetaMetrics in favour of the shared analytics utility and AnalyticsController.

Changes: LedgerSelectAccount/index.tsx now uses useAnalytics from app/components/hooks/useAnalytics/useAnalytics instead of useMetrics; test mocks updated to mock useAnalytics instead of useMetrics.

Changelog

CHANGELOG entry: null

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/MCWP-302 (Batch 3-11)

Manual testing steps

Feature: Hardware Wallet analytics

  Scenario: user triggers a hardware wallet flow event
    Given app is open and user is in a hardware wallet flow

    When user performs an action that triggers analytics (e.g. open account selector, unlock account, forget device)
    Then the event is tracked on Mixpanel

Screenshots/Recordings

N/A – analytics migration, no UI change.

Pre-merge author checklist

Pre-merge reviewer checklist

  • 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.

Note

Low Risk
Swaps the analytics hook used by LedgerSelectAccount and updates its unit test mock; behavior should be equivalent but could affect event emission if the new hook differs in runtime wiring.

Overview
Migrates hardware wallet LedgerSelectAccount analytics from the deprecated useMetrics hook to the new useAnalytics hook while keeping the same trackEvent/createEventBuilder call sites.

Updates LedgerSelectAccount tests to mock useAnalytics instead of useMetrics so existing analytics-related assertions continue to run against the new hook.

Written by Cursor Bugbot for commit d71565b. This will update automatically on new commits. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

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.

@metamaskbot metamaskbot added the team-mobile-platform Mobile Platform team label Feb 25, 2026
@NicolasMassart NicolasMassart self-assigned this Feb 25, 2026
@NicolasMassart NicolasMassart requested a review from a team February 25, 2026 14:42
@github-project-automation github-project-automation Bot moved this to Needs dev review in PR review queue Feb 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
This PR is a simple refactoring change that migrates the LedgerSelectAccount component from the deprecated useMetrics hook to the new useAnalytics hook. Both hooks provide identical APIs (trackEvent, createEventBuilder) and use the same underlying analytics infrastructure. The change is purely internal with no functional behavior changes.

The LedgerSelectAccount component is used for Ledger hardware wallet account selection. While the change is low-risk (1:1 hook migration), selecting SmokeAccounts provides minimal coverage for account-related flows including hardware wallet account management. The unit tests have been properly updated to mock the new hook.

No other tags are needed because:

  • The change doesn't affect confirmations, network management, trading, or other features
  • It's a simple analytics hook swap with no user-facing changes
  • The component is isolated to Ledger account selection functionality

Performance Test Selection:
This change is a simple refactoring that swaps one analytics hook for another with identical behavior. There are no changes to UI rendering, data loading, state management, or any performance-sensitive code paths. The analytics hooks are functionally equivalent and this migration has no performance implications.

View GitHub Actions results

@Cal-L Cal-L left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@NicolasMassart NicolasMassart added this pull request to the merge queue Feb 27, 2026
@github-project-automation github-project-automation Bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue Feb 27, 2026
Merged via the queue into main with commit a707689 Feb 27, 2026
87 checks passed
@NicolasMassart NicolasMassart deleted the refactor/MCWP-297_analytics_migration_batch_3-11_mobile-platform branch February 27, 2026 19:34
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 27, 2026
@metamaskbot metamaskbot added the release-7.69.0 Issue or pull request that will be included in release 7.69.0 label Feb 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.69.0 Issue or pull request that will be included in release 7.69.0 size-XS team-mobile-platform Mobile Platform team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants