Commit a14a1f2
authored
refactor(analytics): migrate Batch 3-7: mobile-platform (#26385)
## **Description**
Phase 3 analytics migration (Batch 3-7): migrate Payment Request's
`PaymentRequest` class component from `withMetricsAwareness` HOC to the
new analytics system.
**Reason**: Deprecate MetaMetrics in favour of the shared analytics
utility and AnalyticsController.
**Changes**: `PaymentRequest/index.js` now uses `analytics.trackEvent()`
and `AnalyticsEventBuilder` from `app/util/analytics` directly instead
of the `withMetricsAwareness` HOC; test mocks updated to mock the
analytics utility instead of MetaMetrics.
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/MCWP-301 (Batch
3-7)
## **Manual testing steps**
```gherkin
Feature: Payment Request analytics
Scenario: user triggers a payment request flow event
Given app is open and user is in a payment request flow
When user performs an action that triggers analytics (e.g. network selector press)
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**
> Analytics plumbing is swapped from `withMetricsAwareness` to the
shared `analytics` utility with minimal behavioral change and no
sensitive data handling.
>
> **Overview**
> Migrates `PaymentRequest` analytics from the deprecated
`withMetricsAwareness`/MetaMetrics injection to the shared
`analytics.trackEvent()` + `AnalyticsEventBuilder` flow when the network
picker is pressed, preserving the `chain_id` property.
>
> Removes the `metrics` prop/HOC wrapper and updates tests to mock the
new analytics module (plus a small TypeScript cast workaround for the
connected `.js` component).
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
89e949b. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 14c57d5 commit a14a1f2
2 files changed
Lines changed: 22 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | 67 | | |
69 | 68 | | |
| 69 | + | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| |||
308 | 309 | | |
309 | 310 | | |
310 | 311 | | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | 312 | | |
316 | 313 | | |
317 | 314 | | |
| |||
910 | 907 | | |
911 | 908 | | |
912 | 909 | | |
913 | | - | |
914 | | - | |
915 | | - | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
916 | 914 | | |
917 | 915 | | |
918 | 916 | | |
| |||
967 | 965 | | |
968 | 966 | | |
969 | 967 | | |
970 | | - | |
| 968 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
10 | 16 | | |
11 | 17 | | |
12 | 18 | | |
| |||
21 | 27 | | |
22 | 28 | | |
23 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
24 | 37 | | |
25 | 38 | | |
26 | 39 | | |
| |||
115 | 128 | | |
116 | 129 | | |
117 | 130 | | |
| 131 | + | |
118 | 132 | | |
119 | 133 | | |
120 | 134 | | |
| |||
259 | 273 | | |
260 | 274 | | |
261 | 275 | | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | 276 | | |
272 | | - | |
273 | 277 | | |
274 | 278 | | |
275 | 279 | | |
| |||
0 commit comments