Commit 0e76ada
authored
feat: fix button label for action button clicked event cp-7.69.0 (#27117)
## **Description**
The sticky Buy and Sell buttons on the token details page were both
firing ACTION_BUTTON_CLICKED with button_label: "Swap", making it
impossible to distinguish between the two actions in Mixpanel.
Changes:
* Added an optional buttonLabel param to goToSwaps / goToNativeBridge in
useSwapBridgeNavigation, falls back to "Swap" so all existing callers
are unaffected
* `handleBuyPress` now passes `button_label: "Buy"` and
`handleSellPress` passes `button_label: "Sell"`
## **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: updated event property for ACTION_BUTTON_CLICKED
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
Feature: my feature name
Scenario: user [verb for user action]
Given [describe expected initial app state]
When user [verb for user action]
Then [describe expected outcome]
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
- [ ] 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).
- [ ] I've completed the PR template to the best of my ability
- [ ] I've included tests if applicable
- [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] 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: changes only analytics event properties by threading an
optional `buttonLabel` through navigation helpers; swap/bridge
navigation behavior is unchanged due to a default fallback.
>
> **Overview**
> Fixes token details *Buy*/*Sell* sticky buttons reporting
`ACTION_BUTTON_CLICKED` with `button_label: "Swap"`.
>
> `useSwapBridgeNavigation` now accepts an optional `buttonLabel` in
`goToNativeBridge`/`goToSwaps` and uses it for `trackActionButtonClick`
(defaulting to the existing Swap label), and `useTokenActions` passes
the correct localized Buy/Sell labels; tests were updated to assert the
new arguments.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
8c1b45d. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent a290214 commit 0e76ada
3 files changed
Lines changed: 22 additions & 4 deletions
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| 143 | + | |
143 | 144 | | |
144 | 145 | | |
145 | 146 | | |
| |||
283 | 284 | | |
284 | 285 | | |
285 | 286 | | |
286 | | - | |
| 287 | + | |
287 | 288 | | |
288 | 289 | | |
289 | 290 | | |
| |||
328 | 329 | | |
329 | 330 | | |
330 | 331 | | |
331 | | - | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
332 | 337 | | |
333 | 338 | | |
334 | 339 | | |
335 | 340 | | |
| 341 | + | |
336 | 342 | | |
337 | 343 | | |
338 | 344 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
655 | 655 | | |
656 | 656 | | |
657 | 657 | | |
| 658 | + | |
658 | 659 | | |
659 | 660 | | |
660 | 661 | | |
| |||
692 | 693 | | |
693 | 694 | | |
694 | 695 | | |
| 696 | + | |
695 | 697 | | |
696 | 698 | | |
697 | 699 | | |
| |||
743 | 745 | | |
744 | 746 | | |
745 | 747 | | |
| 748 | + | |
746 | 749 | | |
747 | 750 | | |
748 | 751 | | |
| |||
767 | 770 | | |
768 | 771 | | |
769 | 772 | | |
| 773 | + | |
770 | 774 | | |
771 | 775 | | |
772 | 776 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
440 | | - | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
441 | 445 | | |
442 | 446 | | |
443 | 447 | | |
| |||
450 | 454 | | |
451 | 455 | | |
452 | 456 | | |
453 | | - | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
454 | 462 | | |
455 | 463 | | |
456 | 464 | | |
| |||
0 commit comments