Commit ef5e684
authored
feat(earn): gate Tron unstaked claim button behind remote flag (MetaMask#27908)
## **Description**
Adds the remote boolean flag **`tronClaimUnstakedTrxButtonEnabled`** so
we can hide the **claim** action on the Tron unstaked banner if
something goes wrong in production, without removing the banner copy.
**Why:** We need a safe kill switch for the claim CTA only.
**How:**
- Register the flag in `FeatureFlagNames` with default `false`
(missing/undefined → button hidden; opt-in).
- **`selectTronClaimUnstakedTrxButtonEnabled`** in
`app/selectors/featureFlagController/tronClaimUnstakedTrxButtonEnabled/`
reads merged remote flags (same pattern as other boolean flags).
- `TronUnstakedBanner` uses
`useSelector(selectTronClaimUnstakedTrxButtonEnabled)` and renders the
primary claim button only when the flag is `true`; title and description
stay visible when the button is hidden.
- Register the flag in
**`tests/feature-flags/feature-flag-registry.ts`** (`inProd: true`,
`productionDefault: false`) so CI/E2E mocks match production
client-config.
**Ops:** Ensure **`tronClaimUnstakedTrxButtonEnabled`** exists in
LaunchDarkly / client-config; set to **`true`** where the claim button
should appear.
## **Changelog**
CHANGELOG entry: Added a remote feature flag to control visibility of
the Tron unstaked TRX claim button on the token details banner.
## **Related issues**
Fixes: NEB-838
## **Manual testing steps**
```gherkin
Feature: Tron unstaked banner claim button behind remote flag
Scenario: user views TRX token details with claimable unstaked balance and flag enabled
Given a Tron account with TRX ready for withdrawal and remote flag `tronClaimUnstakedTrxButtonEnabled` is true (or overridden in dev tools)
When user opens native TRX token details and the unstaked banner is shown
Then the banner shows title, description, and the claim button, and tapping claim still triggers the existing flow
Scenario: user views TRX token details when flag is off or unset
Given the same balance state but `tronClaimUnstakedTrxButtonEnabled` is false, missing, or undefined in remote flags
When user opens native TRX token details and the unstaked banner is shown
Then the banner shows title and description but does not show the claim button
```
## **Screenshots/Recordings**
### **Before**
See prior screenshots on this PR (token details with banner).
### **After**
Feature flag disabled / enabled — screenshots attached in thread (banner
with and without claim CTA).
## **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.1 parent 5e444bd commit ef5e684
8 files changed
Lines changed: 153 additions & 33 deletions
File tree
- app
- components/UI
- Earn/components/Tron/TronUnstakedBanner
- Perps/utils
- constants
- selectors/featureFlagController/tronClaimUnstakedTrxButtonEnabled
- tests/feature-flags
Lines changed: 58 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
9 | 19 | | |
10 | 20 | | |
11 | 21 | | |
| |||
23 | 33 | | |
24 | 34 | | |
25 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
26 | 42 | | |
27 | 43 | | |
28 | 44 | | |
29 | 45 | | |
30 | 46 | | |
| 47 | + | |
31 | 48 | | |
32 | 49 | | |
33 | 50 | | |
| |||
42 | 59 | | |
43 | 60 | | |
44 | 61 | | |
45 | | - | |
46 | | - | |
47 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
48 | 66 | | |
49 | 67 | | |
50 | 68 | | |
| |||
53 | 71 | | |
54 | 72 | | |
55 | 73 | | |
56 | | - | |
57 | | - | |
58 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
59 | 78 | | |
60 | 79 | | |
61 | 80 | | |
62 | 81 | | |
63 | 82 | | |
64 | 83 | | |
65 | 84 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
70 | 90 | | |
71 | 91 | | |
72 | 92 | | |
73 | 93 | | |
74 | 94 | | |
75 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
76 | 112 | | |
77 | | - | |
78 | | - | |
79 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
80 | 117 | | |
81 | 118 | | |
82 | 119 | | |
| |||
89 | 126 | | |
90 | 127 | | |
91 | 128 | | |
92 | | - | |
93 | | - | |
94 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
95 | 133 | | |
96 | 134 | | |
97 | 135 | | |
| |||
104 | 142 | | |
105 | 143 | | |
106 | 144 | | |
107 | | - | |
| 145 | + | |
108 | 146 | | |
109 | 147 | | |
110 | 148 | | |
| |||
117 | 155 | | |
118 | 156 | | |
119 | 157 | | |
120 | | - | |
| 158 | + | |
121 | 159 | | |
122 | 160 | | |
123 | 161 | | |
124 | 162 | | |
125 | 163 | | |
126 | 164 | | |
127 | | - | |
| 165 | + | |
128 | 166 | | |
129 | 167 | | |
130 | 168 | | |
| |||
Lines changed: 15 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| |||
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
44 | | - | |
| 47 | + | |
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
57 | 62 | | |
58 | 63 | | |
59 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| 28 | + | |
27 | 29 | | |
Lines changed: 49 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
3618 | 3618 | | |
3619 | 3619 | | |
3620 | 3620 | | |
| 3621 | + | |
| 3622 | + | |
| 3623 | + | |
| 3624 | + | |
| 3625 | + | |
| 3626 | + | |
| 3627 | + | |
| 3628 | + | |
3621 | 3629 | | |
3622 | 3630 | | |
3623 | 3631 | | |
| |||
0 commit comments