Commit b64014f
authored
refactor(analytics): migrate Batch 3-15: mobile-platform (#26591)
## **Description**
Phase 3 analytics migration (Batch 3-15): migrate the ResetPassword view
from `MetaMetrics.getInstance()` / `MetricsEventBuilder` to the new
`analytics` utility and `AnalyticsEventBuilder`.
**Reason**: Deprecate MetaMetrics in favour of the shared analytics
utility and AnalyticsController.
**Changes**: `ResetPassword/index.js` now uses `analytics.trackEvent()`
and `AnalyticsEventBuilder` from `app/util/analytics`; test mocks
updated to mock the analytics utility instead of MetaMetrics.
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/MCWP-302 (Batch
3-15)
## **Manual testing steps**
```gherkin
Feature: Settings analytics
Scenario: user triggers a password change event
Given app is open and user is in Settings > Change Password flow
When user performs an action that triggers analytics (e.g. password change confirmation)
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**
> Low risk refactor limited to analytics plumbing in the password reset
flow; main risk is mis-tracking or missing the `PASSWORD_CHANGED` event
due to the API swap.
>
> **Overview**
> Migrates `ResetPassword` analytics from legacy
`MetaMetrics.getInstance()`/`MetricsEventBuilder` to the shared
`analytics` utility with `AnalyticsEventBuilder`, keeping the
`PASSWORD_CHANGED` event and its biometry-related properties.
>
> Updates the `ResetPassword` tests to mock `util/analytics/analytics`
instead of `MetaMetrics`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
22501d0. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 3424cca commit b64014f
2 files changed
Lines changed: 10 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| |||
513 | 514 | | |
514 | 515 | | |
515 | 516 | | |
516 | | - | |
| 517 | + | |
517 | 518 | | |
518 | 519 | | |
519 | 520 | | |
520 | 521 | | |
521 | 522 | | |
522 | | - | |
| 523 | + | |
523 | 524 | | |
524 | 525 | | |
525 | 526 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
112 | 111 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
119 | 117 | | |
120 | 118 | | |
121 | 119 | | |
| |||
0 commit comments