feat(ramp): headless-aware external checkout + shared quote pick (Phase 2)#32912
Conversation
…se 2) P2.M6: the headless getQuotes facade now passes autoSelectProvider so the controller's shared getSmartSelectedQuote ranks the quotes and the best lands at success[0]; the UI never sorts locally. P2.M1: make useContinueWithQuote's external-browser branch headless-aware. iOS InAppBrowser.openAuth success resolves the provider callback into an order and fires onOrderCreated + onClose(completed); cancel fires onClose(user_dismissed); an open rejection / resolution failure fails the session (QUOTE_FAILED). Android/system-browser success keeps the session live for the deeplink return. Deeplink schemes and redirect URLs stay mobile-side. P2.M4: custom-action quotes ride the now-headless-aware external path, so they complete via the same terminal callbacks.
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
…#9414) Point the previewBuilds override at 15.1.0-preview-bbd2df29f so the mobile Phase 2 work can be RC-tested against the public getSmartSelectedQuote and scope-gated widening. Preview only; must be swapped to a released version before merge.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
These changes affect the core buy/ramp flow: quote fetching, provider selection, and order completion via external browser. The SmokeMoney tag covers ramps flows including buy, quote fetching, and on-ramp flows. No swap confirmations are directly triggered by these changes (they're in the quote/provider selection layer), so SmokeConfirmations and SmokeSwap are not needed unless SmokeMoney tests exercise those paths - but the tag description says to add SmokeSwap/SmokeConfirmations only when Card Add Funds or similar flows execute swaps, which is not the case here. The changes do NOT affect: accounts, network management, browser, snaps, staking, swaps, or any other feature area. Performance Test Selection: |
Description
Headless Buy "All Providers Support" Phase 2 mobile work, stacked on #32890. It consumes a preview build of the core follow-on (MetaMask/core#9414, stacked on MetaMask/core#9409) that promotes the quote pick to a public, pure
getSmartSelectedQuoteand lays the scope-gated widening groundwork.This PR keeps the "dumb UI, logic in the controller" boundary: core owns the provider-agnostic ranking/filtering; mobile keeps deeplink schemes, redirect/callback URLs, navigation, session lifecycle, and the error-taxonomy values.
Milestones in this PR:
getQuotesfacade (useHeadlessBuy) now passesautoSelectProvider: true, so the controller runs its shared, scope-awaregetSmartSelectedQuoteand places the best quote atsuccess[0]. The UI never ranks or sorts quotes locally.GetQuotesOptionsgainedautoSelectProvider/preferredProviderIdspassthrough.useContinueWithQuote's external-browser branch is now headless-aware whenctx.headlessSessionIdis set:InAppBrowser.openAuthsuccess resolves the provider callback into an order (getOrderFromCallback) and firesonOrderCreatedthenonClose({ reason: 'completed' }); a bailed/placeholder order is treated as a user exit (onClose({ reason: 'user_dismissed' })).onClose({ reason: 'user_dismissed' }).QUOTE_FAILED).isExternalBrowserQuotehelper.QUOTE_FAILEDcode viafailSession.Deferred to a follow-up (reported, not done here)
openAuthsuccess (E1) is already handled by P2.M1.all) is a runtime flip of the existingmoneyHeadlessProviderScopescope flag, not code.RAMPS_CHECKOUT_CLOSED/RAMPS_ORDER_FAILED+ramp_surfacefor the external-browser path) beyond the typedQUOTE_FAILEDcode.Changelog
CHANGELOG entry: null
Dev/RC-gated behind the
moneyHeadlessProviderScopeflag and dependent on an unreleased core preview build, so it is not end-user-facing yet. Labeledno-changelog.Related issues
Refs: MetaMask/core#9414
Refs: #32890
Manual testing steps
Requires an RC (or beta) build; the headless flow is hard-forced off in Production and only honors the dev/RC scope toggle on non-production builds.
Screenshots/Recordings
N/A - logic-only change in the headless behavior layer; the headless flow renders no UI of its own (the consumer renders all visible UI), so there is no before/after to capture.
Before
N/A
After
N/A
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Made with Cursor