[pull] main from MetaMask:main#430
Merged
Merged
Conversation
<!--
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**
* Resolution for qs package
* Remove qs package dependency
<!--
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?
-->
## **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:
## **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]
> Ensures a single, consistent `qs` version across the project.
>
> - Adds `resolutions` entry for `qs` at `6.14.1` in `package.json`
> - Updates `dependencies` `qs` from `6.12.1` to `6.14.1`
> - Regenerates `yarn.lock` to use `qs@6.14.1` and drop previous `qs`
versions (`6.12.1`, `6.13.0`, `6.14.0`)
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
f02c580. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## **Description** This PR adds code ownership entries for the new ramps-controller related paths to ensure the Ramp team is properly assigned as reviewers for changes to these files: - `app/core/Engine/controllers/ramps-controller` - `app/core/Engine/messengers/ramps-controller-messenger` - `app/core/Engine/messengers/ramps-service-messenger` - `app/selectors/rampsController` ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/TRAM-2945 ## **Manual testing steps** N/A - CODEOWNERS file change only. ## **Screenshots/Recordings** N/A - No UI changes. ### **Before** N/A ### **After** N/A ## **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] > Adds Ramps team ownership entries for ramps controller, messengers, and selector paths in CODEOWNERS. > > - **CODEOWNERS**: > - Add Ramps team ownership for: > - `app/core/Engine/controllers/ramps-controller` > - `app/core/Engine/messengers/ramps-controller-messenger` > - `app/core/Engine/messengers/ramps-service-messenger` > - `app/selectors/rampsController` > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit fdbb6f2. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description** Use chain ID from transaction if available when building alert requests, rather than always relying on network client ID. ## **Changelog** CHANGELOG entry: null ## **Related issues** ## **Manual testing steps** ## **Screenshots/Recordings** ### **Before** ### **After** ## **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] > Prioritizes accurate chain selection for security alert validation. > > - In `ppom-util.validateRequest`, compute `chainId` from `transactionMeta.chainId` first; otherwise use `NetworkController.getNetworkClientById(networkClientId).configuration.chainId` resolved from `transactionMeta.networkClientId`, request `networkClientId`, then global selection > - Handle possibly undefined `transactionMeta` by safely extracting `id`, `networkClientId`, and `chainId` > - Update tests to assert precedence: transaction `chainId` > request network client `chainId` > global; adjust mocks and expectations; rename test to clarify behavior > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 3a3201a. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
<!-- 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** This prevents making extra calls to Sentinel `/networks` when it should be cached. It uses the `cache-control` HTTP header returned by Sentinel. <!-- 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? --> ## **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: Use cache headers on sentinel calls ## **Related issues** Fixes: ## **Manual testing steps** 1. Open the Expo DevTools 2. Click on "Swap" in MetaMask 3. See the call to `https://tx-sentinel-ethereum-mainnet.api.cx.metamask.io/networks` 4. Go back to the main screen, and click on "Swap" again 5. Check no extra calls to `/networks` are made 6. Wait for 5 minutes 7. Go back to the main screen, and click on "Swap" again 8. See the new call to `https://tx-sentinel-ethereum-mainnet.api.cx.metamask.io/networks` ## **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** - [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] > Improves Sentinel `/networks` fetch efficiency and resilience. > > - Adds in-memory caching in `sentinel-api.ts` with a 5-minute TTL aligned to server cache headers; subsequent calls reuse cached `getAllSentinelNetworkFlags()` data > - Deduplicates concurrent requests via a shared `pendingPromise`, ensuring only one network fetch in flight > - Adds robust HTTP error handling in `fetchNetworkFlags()` (non-OK responses throw and are not cached) and propagates errors to concurrent callers > - Exposes `clearSentinelNetworkCache()` for tests; updates tests to cover caching reuse, TTL expiry, concurrent deduplication, and error scenarios; minor Jest setup/teardown adjustments > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 4c6a7a9. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
<!--
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**
Merge 7.61.3, 7.61.4 and 7.61.5 back to main
<!--
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?
-->
## **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**
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]
> Strengthens origin validation for external requests and expands
hardware auto-signing.
>
> - Rejects external `eth_sendTransaction` and connections using
internal origins via checks in `eth_sendTransaction`, WalletConnect
(session proposal/init and sendTransaction), SDKConnect (bridge setup,
deeplink protocol, V2 connection registry), and deeplink handlers;
surfaces `invalidParams`/errors
> - Normalizes `channelId` handling in deeplink flows and guards against
internal-origin channel IDs
> - Adds comprehensive tests covering blocked/allowed origins for SDK
deeplink protocol, SDK V2 connection registry, and WalletConnect V2
> - Expands auto-sign to include QR hardware accounts in
`RootRPCMethodsUI` (in addition to Ledger)
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c2d4bd0. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Nicholas Ellul <15018469+NicholasEllul@users.noreply.github.com>
Co-authored-by: Jiexi Luan <jiexiluan@gmail.com>
Co-authored-by: sethkfman <seth.kaufman@consensys.net>
Co-authored-by: tommasini <46944231+tommasini@users.noreply.github.com>
<!--
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?
-->
## **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: fix: phishing screen UX background color papercut
## **Related issues**
Fixes: fix: phishing screen UX background color papercut
## **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]
> Switch phishing modal backdrop to background.alternative across
AccountConnect and MultichainAccountConnect.
>
> - **UI**:
> - Update `PhishingModal` backdrop to `colors.background.alternative`
(from `colors.error.default`) in:
> - `app/components/Views/AccountConnect/AccountConnect.tsx`
> -
`app/components/Views/MultichainAccounts/MultichainAccountConnect/MultichainAccountConnect.tsx`
> - Adjust corresponding `useCallback` dependency arrays to reference
`colors.background.alternative`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
e40654e. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!--
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**
This PR centralizes authentication-related operations by introducing a
new `useAuthentication` hook in the `app/core/Authentication/`
directory. The hook encapsulates the logic for turning off the "Remember
Me" feature and locking the app, which was previously scattered directly
in the `TurnOffRememberMeModal` component.
**Reason for the change:**
- Authentication logic was directly embedded in UI components, making it
difficult to reuse and test
- Redux dispatch calls and Authentication service calls were mixed with
component logic
- No centralized place for authentication-related operations
**Improvement/Solution:**
- Created `useAuthentication` hook that combines Redux action
dispatching with Authentication service calls
- Moved `turnOffRememberMeAndLockApp` logic from
`TurnOffRememberMeModal` to the new hook
- Updated `TurnOffRememberMeModal` to use the centralized hook instead
of direct dispatch and service calls
- Added comprehensive unit test coverage (12 tests) following project
testing guidelines
- Hook is exported from `app/core/Authentication/index.ts` for easy
consumption
This change improves code organization, testability, and reusability of
authentication features across the application.
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
Feature: Turn off Remember Me and lock app
Scenario: user turns off Remember Me feature
Given the user has "Remember Me" enabled and is logged into the app
And the user navigates to the Turn Off Remember Me modal
When user enters their password correctly
And user taps the "Turn Off Remember Me" button
Then the "Remember Me" feature is disabled
And the app is locked
And the user is redirected to the login screen
```
## **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**
- [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
- [ ] 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]
> Modernizes auth flows and centralizes logic while tightening tests.
>
> - API change: `Authentication.updateAuthPreference` now accepts `{
authType, password }`; all callers updated (`TurnOffRememberMeModal`,
`LoginOptionsSettings`, `RememberMeOptionSection`, related tests)
> - New `useAuthentication` hook (exported via
`core/Authentication/index.ts`) with unit tests; provides `lockApp`
> - `TurnOffRememberMeModal`: simplifies disable flow, restores previous
auth with entered password, clears stored state, updates Redux, and
removes direct `lockApp` calls; improves loading handling with `act`
> - Authentication internals: `componentAuthenticationType` prioritizes
`REMEMBER_ME`, uses `PASSCODE_DISABLED` to infer BIOMETRIC/PASSCODE, and
`storePassword` now dispatches `passwordSet`; removed lock-time side
effects; `lockApp` gains `allowRememberMe` control and ordering tests
> - Expanded tests across settings sections to cover password-required
flows, callbacks, mutual exclusivity, and error handling
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
d511fa8. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## **Description**
This PR enhances the header components API in
`component-library/components-temp` to provide more flexibility and
consistency:
1. **HeaderCenter**: Added `startButtonIconProps` support by removing
the `Omit` constraint, allowing direct control over the start button.
2. **HeaderWithTitleLeft & HeaderWithTitleLeftScrollable**: Added close
button support via `onClose` and `closeButtonProps` props, along with
`endButtonIconProps` for additional end accessories.
3. **HeaderWithTitleLeftScrollable**: Added `isInsideSafeAreaView` prop
to properly position the header when used inside a SafeAreaView,
respecting safe area insets.
4. **TitleLeft**: Added `twClassName` prop for custom Tailwind styling.
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
Feature: Header Components API
Scenario: HeaderCenter with custom startButtonIconProps
Given the app renders a HeaderCenter component
When user provides startButtonIconProps
Then the custom start button should render instead of the default back button
Scenario: HeaderWithTitleLeft with close button
Given the app renders a HeaderWithTitleLeft component
When user provides onClose callback
Then a close button should appear on the right side of the header
Scenario: HeaderWithTitleLeftScrollable inside SafeAreaView
Given the app renders HeaderWithTitleLeftScrollable inside a SafeAreaView
When isInsideSafeAreaView is set to true
Then the header should position at the safe area boundary instead of top-0
```
## **Screenshots/Recordings**
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **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]
> Introduces more flexible header controls and positioning while
aligning APIs across components.
>
> - **Close button support**: `HeaderWithTitleLeft` and
`HeaderWithTitleLeftScrollable` accept `onClose`/`closeButtonProps`;
merged into `endButtonIconProps` alongside any provided end icons
> - **Custom start button**: `HeaderCenter` now accepts
`startButtonIconProps` (takes priority over `onBack`);
`HeaderCenterProps` now extends `HeaderBaseProps`
> - **Safe area handling**: `HeaderWithTitleLeftScrollable` adds
`isInsideSafeAreaView` to position container using `useSafeAreaInsets()`
> - **Styling**: `TitleLeft` adds `twClassName` to customize container
classes
> - Tests updated/added to cover new behaviors and prop precedence
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
65cdf6c. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
…#24245) ## **Description** The `ramp_type` analytics property was hardcoded to `BUY` in `BalanceEmptyState` and `AssetOverview` components, but when Unified Ramp V1 is enabled, it should be `UNIFIED_BUY` to correctly segment analytics data for the Unified Buy funnel. This PR adds the `useRampsUnifiedV1Enabled` hook to both components and conditionally sets `ramp_type` based on the flag: - When Unified V1 is **enabled** → `ramp_type: "UNIFIED_BUY"` - When Unified V1 is **disabled** → `ramp_type: "BUY"` This is consistent with the existing implementation in `FundActionMenu.tsx`. ## **Changelog** CHANGELOG entry: Fixed analytics `ramp_type` to correctly report `UNIFIED_BUY` when Unified Ramp V1 is enabled ## **Related issues** Fixes: #24219 ## **Manual testing steps** ```gherkin Feature: Ramps Button Analytics Scenario: user taps Add Funds from BalanceEmptyState with Unified V1 enabled Given Ramps Unified V1 feature flag is enabled And user has zero balance (BalanceEmptyState is visible) When user taps "Add funds" button Then RAMPS_BUTTON_CLICKED event is tracked with ramp_type: "UNIFIED_BUY" Scenario: user taps Buy from TokenDetails with Unified V1 disabled Given Ramps Unified V1 feature flag is disabled And user is viewing token details (AssetOverview) When user taps "Buy" button Then RAMPS_BUTTON_CLICKED event is tracked with ramp_type: "BUY" ``` ## **Screenshots/Recordings** N/A - No UI changes, analytics fix only. ### **Before** N/A ### **After** N/A ## **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] > Aligns buy-flow analytics with Unified Ramp V1. > > - In `AssetOverview.tsx` and `BalanceEmptyState.tsx`, add `useRampsUnifiedV1Enabled` and set `ramp_type` to `UNIFIED_BUY` when enabled, otherwise `BUY`, for `RAMPS_BUTTON_CLICKED` > - Update tests (`AssetOverview.test.tsx`, `BalanceEmptyState.test.tsx`) to mock the flag and assert `ramp_type` for both enabled/disabled scenarios > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 3d0409a. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )