Skip to content

feat(rewards): add First Predict On Us splash and order sheet UI (RWDS-1435 3/4) - #32859

Merged
sophieqgu merged 6 commits into
mainfrom
rwds-1435/3-rewards-ui
Jul 24, 2026
Merged

feat(rewards): add First Predict On Us splash and order sheet UI (RWDS-1435 3/4)#32859
sophieqgu merged 6 commits into
mainfrom
rwds-1435/3-rewards-ui

Conversation

@sophieqgu

@sophieqgu sophieqgu commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Description

Adds the First Predict On Us Rewards UI for the onboarding campaign splash, markets carousel, and fixed-amount order sheet (RWDS-1435 3/4).

Analytics

Instruments Product-standard Segment events (see segment-schema#684):

Event When
First Prediction On Us Viewed Splash mounts
First Prediction On Us Skipped User taps Skip
First Prediction On Us Outcome Opened User opens an outcome (market_id, outcome)
First Prediction On Us Order Confirm CTA (status: confirmed)

Support-state Redux persistence and onboarding launch wiring land in PR 4/4 (#32860).

Stacked under parent: #32688

Test plan

  • Unit tests for splash, carousel, and order sheet pass
  • Splash fires Viewed on mount and Skipped on skip
  • Outcome tap fires Outcome Opened with market/outcome
  • Confirm fires Order with status: confirmed

Note

Medium Risk
Touches onboarding navigation and Predict order preview UX; confirm does not place a real trade yet, which limits financial risk but could confuse reviewers expecting full execution in this PR.

Overview
Adds the First Predict On Us onboarding campaign UI: CMS-driven splash, horizontal markets carousel, fixed-amount order bottom sheet, and legal footer.

The splash screen (FirstPredictOnUsSplashScreen) expects pre-resolved content and markets from route params, fires Viewed on mount, and Skip resets navigation to onboarding success while tracking Skipped. Layout pulls copy via FIRST_PREDICT_ON_US_CMS_KEYS, optional hero image (compact on short screens), and wires the carousel plus region/terms footer.

The carousel renders PredictMarketCard entries with buy overrides that track Outcome Opened and navigate to FIRST_PREDICT_ON_US_ORDER_SHEET with the sponsored USD amount and CMS trade strings.

The order sheet previews the fixed buy via usePredictOrderPreview, shows amount / to-win / Polymarket disclaimer, and on confirm tracks Order (status: confirmed) then calls useFirstPredictOnUsOrder—currently a stub that shows an interpolated success toast only (real submission lands in PR 4/4).

Also registers onboarding routes and nav param types, four MetaMetrics events, and unit tests across the new components.

Reviewed by Cursor Bugbot for commit 8769055. Bugbot is set up for automated code reviews on this repo. Configure here.

@sophieqgu
sophieqgu requested a review from a team as a code owner July 7, 2026 04:25
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

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.

@metamask-ci metamask-ci Bot added the team-rewards Rewards team label Jul 7, 2026
Comment thread app/components/UI/Rewards/hooks/useFirstPredictOnUsOrder.ts
@sophieqgu
sophieqgu force-pushed the rwds-1435/3-rewards-ui branch from 1fcc042 to 9e9f1cc Compare July 7, 2026 15:30
@sophieqgu
sophieqgu force-pushed the rwds-1435/2-predict-api branch from 1183d30 to 163a65a Compare July 7, 2026 15:30
@sophieqgu
sophieqgu requested a review from a team as a code owner July 7, 2026 16:08
@sophieqgu
sophieqgu force-pushed the rwds-1435/2-predict-api branch from 163a65a to 1c6c427 Compare July 9, 2026 16:57
@sophieqgu
sophieqgu requested review from a team as code owners July 9, 2026 16:57
@sophieqgu
sophieqgu force-pushed the rwds-1435/3-rewards-ui branch from 837a9fc to 1fa8aad Compare July 9, 2026 17:11
@sophieqgu
sophieqgu removed request for a team July 9, 2026 17:29
@sophieqgu
sophieqgu force-pushed the rwds-1435/2-predict-api branch from 1c6c427 to d056e53 Compare July 9, 2026 17:58
@sophieqgu
sophieqgu force-pushed the rwds-1435/3-rewards-ui branch from 1fa8aad to 52001a8 Compare July 9, 2026 18:03
Base automatically changed from rwds-1435/2-predict-api to main July 9, 2026 18:56
@metamask-ci metamask-ci Bot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Jul 9, 2026
@metamask-ci

metamask-ci Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

PR template — items to address before "Ready for review"

Warnings — informational, address before merging:

See docs/readme/ready-for-review.md for the full Definition of Ready for Review.

@sophieqgu
sophieqgu force-pushed the rwds-1435/3-rewards-ui branch from 52001a8 to 43dff2e Compare July 9, 2026 19:09
@github-actions github-actions Bot added the risk:medium AI analysis: medium risk label Jul 9, 2026
pull Bot pushed a commit to Reality2byte/metamask-mobile that referenced this pull request Jul 9, 2026
…35 2/4) (MetaMask#32858)

## Description

Part **2/4** of RWDS-1435 (First Predict On Us). Adds a reusable
buy-button override and `cardPressDisabled` to Predict market cards so a
sponsored carousel can drive its own buy flow and disable card-body
navigation while keeping outcome buttons active.

Stacked PRs (merge in order):
1. [MetaMask#32857](MetaMask#32857) —
Rewards CMS/API + flag foundation ✅ merged
2. [MetaMask#32858](MetaMask#32858) —
Predict buy-button + cardPressDisabled (**this PR**, base `main`)
3. [MetaMask#32859](MetaMask#32859) —
First Predict On Us Rewards UI
4. [MetaMask#32860](MetaMask#32860) —
Onboarding integration

## Changes

- Add `PredictMarketBuyButtonPress` and a richer `onBuyButtonPress({
market, outcome, outcomeToken })` across Predict card variants (single,
multiple, sport, crypto up/down). Returning `true` skips the default
Predict buy sheet so a caller can handle the buy externally.
- Add `cardPressDisabled` so card-body taps can be disabled while
outcome buttons stay active.
- Update Trending/Explore call sites for the new callback shape.

## Testing

- `yarn jest
app/components/UI/Predict/components/PredictMarket/PredictMarket.test.tsx`
- `yarn jest
app/components/UI/Predict/components/PredictMarketSingle/PredictMarketSingle.test.tsx`
- `yarn jest
app/components/UI/Predict/components/PredictMarketMultiple/PredictMarketMultiple.test.tsx`
- `yarn jest
app/components/UI/Predict/components/PredictMarketSportCard/PredictMarketSportCard.test.tsx`
- `yarn jest
app/components/UI/Predict/components/PredictCryptoUpDownMarketCard/PredictCryptoUpDownMarketCard.test.tsx`

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes the shared Predict buy and navigation path across all market
card types; behavior stays backward-compatible when new props are
omitted, but a buggy external handler could block the default buy sheet.
> 
> **Overview**
> Adds **Predict card hooks** so a parent (e.g. a sponsored “First
Predict On Us” carousel) can control navigation and buying without
forking each card variant.
> 
> **`cardPressDisabled`** is threaded through `PredictMarket` into
single, multiple, sport, and crypto up/down cards. When set, tapping the
card body no longer opens market details; outcome buy buttons still
work.
> 
> **`onBuyButtonPress`** is now typed as `PredictMarketBuyButtonPress`
and receives `{ market, outcome, outcomeToken }` instead of only
`marketId`. If the callback returns **`true`**, the default Predict buy
sheet is skipped so the caller can run its own flow; otherwise behavior
is unchanged.
> 
> Explore Trending carousel analytics were updated to read `market.id`
from the new callback shape. Unit tests cover disabled card press,
external buy handling, and prop forwarding from `PredictMarket`.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
d056e53. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-project-automation github-project-automation Bot moved this to Needs dev review in PR review queue Jul 24, 2026
@sophieqgu sophieqgu moved this from Needs dev review to Has approvals, needs CODEOWNER in PR review queue Jul 24, 2026
Comment on lines +104 to +112
trackEvent(
createEventBuilder(MetaMetricsEvents.FIRST_PREDICTION_ON_US_ORDER)
.addProperties({
market_id: marketId,
outcome,
status: 'confirmed',
})
.build(),
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (blocking): Order analytics reports confirmation before the operation succeeds

FIRST_PREDICTION_ON_US_ORDER is emitted with status: 'confirmed' before submitOrder runs. If submitOrder rejects, the event still records the order as confirmed.

This currently has limited impact in this PR because the hook only displays a toast, but it establishes incorrect semantics for the real trade implementation expected in the next stacked PR.
It can inflate successful-order analytics and makes failures indistinguishable from completed submissions.

Suggestion: move the confirmed event after the awaited operation succeeds. A separate failed event/status should be emitted from the catch branch if required by the schema.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes makes sense, will modify after backend submitOrder is fully wired

Comment thread app/components/UI/Rewards/hooks/useFirstPredictOnUsOrder.ts
sophieqgu and others added 4 commits July 24, 2026 12:43
…S-1435 3/4)

Co-authored-by: Cursor <cursoragent@cursor.com>
Add Product-standard Viewed, Skipped, Outcome Opened, and Order analytics
to the First Predict On Us splash UI.

Co-authored-by: Cursor <cursoragent@cursor.com>
Rely on backend localizedText defaults (including toast templates) and
match survey Skip typography on the splash.

Co-authored-by: Cursor <cursoragent@cursor.com>
Move goBack into waitFor with submitOrder, and route param overrides
through renderWithParams so missing-params cases stay explicit.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sophieqgu
sophieqgu force-pushed the rwds-1435/3-rewards-ui branch from 35926ef to 8f50cf5 Compare July 24, 2026 16:44

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8f50cf5. Configure here.

status: 'confirmed',
})
.build(),
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Order analytics before submit succeeds

Medium Severity

FIRST_PREDICTION_ON_US_ORDER is emitted with status: 'confirmed' before await submitOrder finishes. If submission fails, analytics still records a confirmed order, skewing success metrics and diverging from the intended Segment semantics for this event.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8f50cf5. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will address after full backend integration with submitOrder

Make the preview mock deterministic and initialize mockRouteParams at
module scope so route-param tests do not depend on declaration order.

Co-authored-by: Cursor <cursoragent@cursor.com>
EugeniyBykov
EugeniyBykov previously approved these changes Jul 24, 2026
…arams

Flush async confirm handler updates with act, and reset mockRouteParams in
afterEach for OrderSheet and SplashScreen route-param helpers.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePredictions, SmokeSeedlessOnboarding, SmokeWalletPlatform, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

E2E Test Selection:
This PR introduces a new "First Predict On Us" onboarding campaign feature with the following components:

  1. New UI components in app/components/UI/Rewards/components/FirstPredictOnUs/: Splash screen, layout, markets carousel, order sheet, legal footer, and constants. All are new files with no modifications to existing code.

  2. New analytics events in MetaMetrics.events.ts (CRITICAL): 4 new events added for the feature (FIRST_PREDICTION_ON_US_VIEWED, FIRST_PREDICTION_ON_US_SKIPPED, FIRST_PREDICTION_ON_US_OUTCOME_OPENED, FIRST_PREDICTION_ON_US_ORDER). Purely additive - no existing events modified.

  3. New navigation types in NavigationService/types.ts (CRITICAL): Two new route param types added (FirstPredictOnUsSplash, FirstPredictOnUsOrderSheet). Purely additive - no existing types modified.

  4. New route constants in Routes.ts: Two new constants for the feature routes. Purely additive.

  5. New hook useFirstPredictOnUsOrder.ts: Handles order submission logic.

Tag selection rationale:

  • SmokePredictions: The feature directly integrates with Polymarket prediction markets - it shows market cards, allows selecting outcomes, and places prediction orders. This is core Predictions functionality.
  • SmokeSeedlessOnboarding: The splash screen is explicitly designed for seedless (social login) onboarding users, shown after any survey and before the wallet success screen. The FirstPredictOnUsSplashScreen navigates to OnboardingSuccessFlowOnboardingSuccess, directly touching the seedless onboarding flow.
  • SmokeWalletPlatform: Per tag description, Predictions is a section inside the Trending tab, and changes to Predictions views affect Trending/SmokeWalletPlatform.
  • SmokeConfirmations: Per SmokePredictions tag description, opening/closing positions are on-chain transactions requiring confirmations. The order sheet involves transaction confirmation flows.

The critical files only have additive changes, so risk of breaking existing functionality is low-medium. The new feature itself warrants testing to ensure it integrates correctly with the onboarding and predictions flows.

Performance Test Selection:
The changes are entirely new UI components for a 'First Predict On Us' onboarding campaign feature. These are additive changes (new files, new analytics events, new navigation routes) that don't modify any existing performance-sensitive flows such as app launch, login, account list rendering, asset loading, or swap execution. The new splash screen and order sheet are shown only during a specific onboarding campaign flow for eligible seedless users, not in the critical performance paths measured by the available performance test tags. No performance test tags are warranted.

View GitHub Actions results

@sophieqgu
sophieqgu enabled auto-merge July 24, 2026 17:37

@NicolasMassart NicolasMassart left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving despite the fact that I'm totally against shipping non working parts only because they are behind a FF. I really think this is dangerous. But here I trust @sophieqgu to do the best to prevent any issues. Still I warn against this very dangerous and confising practice.

@github-project-automation github-project-automation Bot moved this from Has approvals, needs CODEOWNER to Review finalised - Ready to be merged in PR review queue Jul 24, 2026
@sonarqubecloud

Copy link
Copy Markdown

@sophieqgu
sophieqgu added this pull request to the merge queue Jul 24, 2026
Merged via the queue into main with commit 2f4dfef Jul 24, 2026
178 of 179 checks passed
@sophieqgu
sophieqgu deleted the rwds-1435/3-rewards-ui branch July 24, 2026 18:39
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 24, 2026
@metamask-ci metamask-ci Bot added the release-8.6.0 Issue or pull request that will be included in release 8.6.0 label Jul 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

INVALID-PR-TEMPLATE PR's body doesn't match template release-8.6.0 Issue or pull request that will be included in release 8.6.0 risk:medium AI analysis: medium risk size-XL team-rewards Rewards team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants