feat(rewards): add First Predict On Us splash and order sheet UI (RWDS-1435 3/4) - #32859
Conversation
|
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. |
83d2d3b to
1fcc042
Compare
34af7e6 to
1183d30
Compare
1fcc042 to
9e9f1cc
Compare
1183d30 to
163a65a
Compare
163a65a to
1c6c427
Compare
837a9fc to
1fa8aad
Compare
1c6c427 to
d056e53
Compare
1fa8aad to
52001a8
Compare
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. |
52001a8 to
43dff2e
Compare
…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>
2c92541 to
4257f62
Compare
| trackEvent( | ||
| createEventBuilder(MetaMetricsEvents.FIRST_PREDICTION_ON_US_ORDER) | ||
| .addProperties({ | ||
| market_id: marketId, | ||
| outcome, | ||
| status: 'confirmed', | ||
| }) | ||
| .build(), | ||
| ); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Yes makes sense, will modify after backend submitOrder is fully wired
…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>
35926ef to
8f50cf5
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ 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(), | ||
| ); |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 8f50cf5. Configure here.
There was a problem hiding this comment.
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>
…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>
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Tag selection rationale:
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: |
NicolasMassart
left a comment
There was a problem hiding this comment.
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.
|





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):
First Prediction On Us ViewedFirst Prediction On Us SkippedFirst Prediction On Us Outcome Openedmarket_id,outcome)First Prediction On Us Orderstatus: confirmed)Support-state Redux persistence and onboarding launch wiring land in PR 4/4 (#32860).
Stacked under parent: #32688
Test plan
status: confirmedNote
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-resolvedcontentandmarketsfrom route params, fires Viewed on mount, and Skip resets navigation to onboarding success while tracking Skipped. Layout pulls copy viaFIRST_PREDICT_ON_US_CMS_KEYS, optional hero image (compact on short screens), and wires the carousel plus region/terms footer.The carousel renders
PredictMarketCardentries with buy overrides that track Outcome Opened and navigate toFIRST_PREDICT_ON_US_ORDER_SHEETwith 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 callsuseFirstPredictOnUsOrder—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.