Commit 67febaf
authored
feat: track input_amount_preset on quick option press (#26442)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
This PR tracks `input_amount_preset` when the user clicks on a quick
preset source input amount, e.g. 25%, 50%.
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: null
## **Related issues**
Resolves: https://consensyssoftware.atlassian.net/browse/SWAPS-3893
## **Manual testing steps**
```gherkin
Feature: Quick options metrics
Scenario: user is on Swaps screen
Given user is on Swaps screen
When user clicks on quick options, e.g. 25%, 50%
Then that event is tracked
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
<img width="1056" height="345" alt="Screenshot 2026-02-23 at 3 17 15 PM"
src="https://github.com/user-attachments/assets/8754094d-3062-496d-b920-161017406b7e"
/>
https://github.com/user-attachments/assets/7b21d196-15d9-49e6-935c-e0742496879b
## **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]
> **Medium Risk**
> Adds new analytics emission on percentage/max quick-pick actions and
bumps `@metamask/bridge-controller`, which could affect event
schemas/behavior but does not change core swap/bridge execution logic.
>
> **Overview**
> Adds analytics tracking for source-amount quick picks in
`GaslessQuickPickOptions`: pressing `25%/50%/75%/90%` (or `Max`) now
emits `UnifiedSwapBridgeEventName.InputChanged` with the corresponding
`input_amount_preset` (via a new `PERCENTAGE_TO_PRESET` mapping).
>
> Removes the `useTopTokens` hook and its unit tests, and updates
dependencies by replacing the patched `@metamask/bridge-controller` with
`^67.3.0` (lockfile updated accordingly).
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
734acac. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 7774958 commit 67febaf
7 files changed
Lines changed: 90 additions & 529 deletions
File tree
- app/components/UI/Bridge
- components/GaslessQuickPickOptions
- hooks/useTopTokens
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
9 | 20 | | |
10 | 21 | | |
11 | 22 | | |
| |||
Lines changed: 31 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
9 | 15 | | |
10 | 16 | | |
11 | 17 | | |
| |||
26 | 32 | | |
27 | 33 | | |
28 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
29 | 46 | | |
30 | | - | |
| 47 | + | |
31 | 48 | | |
32 | 49 | | |
33 | 50 | | |
| |||
40 | 57 | | |
41 | 58 | | |
42 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
43 | 65 | | |
44 | | - | |
| 66 | + | |
45 | 67 | | |
46 | 68 | | |
47 | 69 | | |
| |||
67 | 89 | | |
68 | 90 | | |
69 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
70 | 97 | | |
71 | 98 | | |
72 | 99 | | |
| |||
84 | 111 | | |
85 | 112 | | |
86 | 113 | | |
87 | | - | |
| 114 | + | |
88 | 115 | | |
89 | 116 | | |
90 | | - | |
| 117 | + | |
91 | 118 | | |
92 | 119 | | |
93 | 120 | | |
| |||
0 commit comments