You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## **Description**
Phase 3 analytics migration (Batch 3-8): migrate Account Backup/Recovery
components from `useMetrics` to the new analytics system
(`useAnalytics`).
**Reason**: Deprecate MetaMetrics in favour of the shared analytics
utility and AnalyticsController.
**Changes**: `SRPListItem`, `SRPList`, `SRPQuiz`, `ManualBackupStep1`,
and `ManualBackupStep2` now use `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-301 (Batch
3-8)
## **Manual testing steps**
```gherkin
Feature: Account Backup/Recovery analytics
Scenario: user triggers an account backup/recovery flow event
Given app is open and user is in an account backup/recovery flow
When user performs an action that triggers analytics (e.g. SRP picker selection, SRP quiz progression, seed phrase reveal)
Then the event is tracked on Mixpanel
```
## **Screenshots/Recordings**
N/A – analytics migration, no UI change.
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Primarily a hook migration from `useMetrics` to `useAnalytics` with no
functional flow changes; risk is limited to potential missing/incorrect
analytics wiring due to API/mocking differences.
>
> **Overview**
> Migrates SRP backup/recovery UI surfaces (`SRPList`, `SRPListItem`,
`ManualBackupStep1`, `ManualBackupStep2`, and `SRPQuiz`) from the
deprecated `useMetrics` hook to the new `useAnalytics` hook while
keeping existing event names/properties and event-builder usage.
>
> Updates the associated Jest tests to mock `useAnalytics` instead of
`useMetrics`, including adjusting mocked IDs (`getMetaMetricsId`
`getAnalyticsId`) and providing a compatible `createEventBuilder` mock
shape where needed.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
988af76. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
0 commit comments