Skip to content

fix(subscriptions): show scheduled cancel and keep hub sections - #38738

Open
smgv wants to merge 18 commits into
mainfrom
fix/pro-hub-scheduled-cancel
Open

smgv wants to merge 18 commits into
mainfrom
fix/pro-hub-scheduled-cancel

Conversation

@smgv

@smgv smgv commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Description

Pro Hub, checkout, and the Orange menu each decided membership status on their own. A scheduled cancel, a payment problem, and a checkout that was still moving funds could show the wrong label, the wrong next step, or a flicker.

Scheduled cancel

  • A period-end cancellation leaves Plus active with cancelAtPeriodEnd. Pro Hub keeps the Active label and shows the cancelled alert while resume is still available.
  • The alert action is Resume membership, which uncancels in place. The button shows a loading state, and a failure shows an error with an accessibility announcement.
  • Membership says Ends on while that period end is still ahead, including when a payment problem means Resume is not offered.
  • Resume is offered only for an active or trialing plan whose latest invoice has not failed. Past due, paused, unpaid, awaiting funds, and a failed renewal keep their own status and add-funds action.
  • The Contact support row is removed from Membership.
  • Get card opens the card stack directly, so the accounts menu does not appear first.

Member pricing

  • A paused or unpaid membership keeps current-period trade usage. The rows are labelled as paused, so they are not read as a fee waiver.
  • The app reads that usage from the subscription service, because the client controller refuses paused and unpaid benefits. A paused plan with no billing period stays hidden.
  • That usage is cached per subscription and billing period, so a new period fetches again.
  • Past due and awaiting funds show no member pricing, including when there is no entitlement. They no longer sit on a skeleton.

Orange menu

  • Accounts Menu and Profile Drawer hide the Orange row until membership is known. Home prefetches membership, and that result stays fresh for the five-minute poll, so opening a menu does not fetch again or hide the Join row.
  • Locking or signing out clears the cached result.
  • A stored member opens Pro Hub. A settled non-member, including a leftover entitlement, opens the join flow. The same rule decides this for the Orange row, Pro Hub, and the subscription screen.

Checkout

  • Paying with crypto through MetaMask Pay, including mUSD, opens the success screen and then Pro Hub.
  • A card or on-ramp payment shows the processing toaster, then the active-membership toaster once.
  • A card or on-ramp payment that starts in awaiting funds, without passing through provisional, is watched the same way. A later cancel opens the payment-failed sheet. Activation shows the active toaster once. An awaiting-funds plan that was already stored is not treated as this checkout.

Plus status groups live in one module, used by the selectors, the banner, resume, checkout, and member pricing.

Jira Link:
https://consensyssoftware.atlassian.net/browse/SUB-1170
https://consensyssoftware.atlassian.net/browse/SUB-1177

Changelog

CHANGELOG entry: Fixed Pro Hub and the Orange menu so a scheduled cancel, a payment problem, and card or crypto checkout each show the right status and next step, and the menu label no longer flickers while membership loads

Related issues

Fixes:

Refs: SUB-1170

Manual testing steps

Feature: Pro Hub membership status and Orange entry

  Scenario: scheduled cancellation stays Active and resumes in place
    Given a Plus membership is active
    And cancelAtPeriodEnd is true
    And currentPeriodEnd is still in the future

    When the user opens Pro Hub
    Then the membership status is Active
    And the alert says the membership is cancelled
    And Resume membership is shown

    When the user taps Resume membership
    Then the button shows a loading state
    And a successful resume clears the cancelled alert

  Scenario: Membership says Ends on while a cancel is scheduled
    Given a Plus membership has cancelAtPeriodEnd set
    And currentPeriodEnd is still in the future

    When the user opens Membership
    Then the date row says Ends on
    And Contact support is not shown

    When the plan is active or trialing and the latest invoice has not failed
    Then the manage row says Resume membership

    When the plan is past due, paused, unpaid, or awaiting funds
    Then Resume membership is not offered

  Scenario: Get card opens the card stack directly
    Given the user opened Pro Hub from the accounts menu

    When the user taps Get card
    Then the card screen opens
    And the accounts menu is not shown first

  Scenario: deactivated membership keeps member pricing
    Given a Plus membership is paused or unpaid
    And the current billing period has usage

    When the user opens Pro Hub
    Then the status is Deactivated
    And the member pricing section shows current-period usage
    And the section says member pricing is paused

    When that billing period ends and a new paused period is stored
    Then member pricing shows the new period's usage

  Scenario: past due and awaiting funds show no member pricing
    Given a Plus membership is past due or awaiting funds
    And the user has no Plus entitlement

    When the user opens Pro Hub
    Then the status banner shows Overdue or the add-funds alert
    And the member pricing section is not shown
    And no pricing skeleton remains

  Scenario: Orange menu label waits until membership is known
    Given the Pro flow is on
    And membership status is still loading

    When the user opens the accounts menu or profile drawer
    Then the Orange row is not shown

    When Home has already fetched membership
    And the user opens either menu within the five-minute poll
    Then no second membership request starts
    And a member sees MetaMask Orange and opens Pro Hub
    And a non-member sees Join MetaMask Orange and opens the join flow

  Scenario: a payment problem keeps its status during a scheduled cancel
    Given a Plus membership is past due, paused, unpaid, or waiting for funds
    And cancelAtPeriodEnd is true
    And currentPeriodEnd is still in the future

    When the user opens Pro Hub
    Then the status stays Overdue, Deactivated, or the add-funds alert
    And Resume membership is not the alert action

  Scenario: crypto checkout opens the success screen
    Given the user pays for Plus with mUSD through MetaMask Pay

    When checkout finishes
    Then the success screen is shown
    And the processing toaster is not shown

    When the user continues
    Then Pro Hub opens

  Scenario: card or on-ramp checkout shows processing, then the active toaster
    Given the user pays with a card or on-ramp
    And the plan is provisional or awaiting funds

    When checkout finishes
    Then Pro Hub opens
    And the processing payment toaster is shown

    When the membership becomes active
    Then the active membership toaster is shown once

    When the payment fails and the plan is canceled
    Then the processing toaster is dismissed
    And the payment-failed sheet opens

Screenshots/Recordings

Before

N/A

After

Screenshot 2026-11-03 at 5 28 06 PM Screenshot 2026-11-03 at 5 31 36 PM Screenshot 2026-11-03 at 5 32 35 PM Screenshot 2026-11-05 at 5 21 51 PM

https://consensys.slack.com/archives/C0BCCKYRJH2/p1793946635763949?thread_ts=1793772178.180049&cid=C0BCCKYRJH2

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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.

Note

Medium Risk
Touches subscription gating, payment toasts, and navigation across Orange, Pro Hub, and checkout; regressions could mis-route users or show wrong membership actions, but logic is heavily test-covered.

Overview
Unifies Money Account Plus behavior across Pro Hub, Orange menu, and subscription checkout by centralizing status helpers in moneyAccountPlusStatus and routing via resolveMoneyAccountPlusEntry so the accounts menu, Pro Hub, and Benefits screen agree on when to show the row, hub vs join, and pending states.

Scheduled cancellation now keeps an Active label with a warning alert and Resume membership (uncancel in place) when the period end is still ahead and payment is healthy; payment problems block resume and keep their own alerts. Membership shows Ends on for pending period-end cancels, drops Contact support, and Get card navigates into the Home card stack so the accounts menu does not flash first.

Member pricing for paused/unpaid plans loads current-period usage from SubscriptionService with a paused disclaimer (not a fee waiver); past due/awaiting funds hide the section instead of spinning on skeletons.

Orange row stays hidden until membership is known; Wallet Home prefetches subscriptions with cache/stale-time handling so menus do not refetch or flicker Join vs member labels.

Checkout distinguishes crypto (success screen) from card/on-ramp (processing path) using top-up metadata; a session activation toast debt ties processing toasts to one active-membership toast and failure sheet behavior, including checkouts that start in awaiting_funds.

Navigation types add CardScreens under the main stack for nested card entry.

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

A period-end cancel leaves the membership active, so Pro Hub showed Active with no alert and Membership said Renews on. Get card also revealed the accounts menu, and a deactivated plan hid member pricing.

Co-authored-by: Cursor <cursoragent@cursor.com>
@smgv smgv self-assigned this Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 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.

@github-actions github-actions Bot added the size-M label Nov 3, 2026
@metamask-ci metamask-ci Bot added the team-onboarding Onboarding team label Nov 3, 2026
@metamask-ci

metamask-ci Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

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

Warnings — informational, address before merging:

  • Pre-merge author checklist has unchecked items (e.g. "I've tested on Android"). Every box must be consciously checked — see docs/readme/ready-for-review.md.

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

@smgv smgv changed the title fix(pro): show scheduled cancel and keep hub sections fix(subscriptions): show scheduled cancel and keep hub sections Nov 3, 2026
@smgv smgv added team-subscriptions Subscriptions team and removed team-onboarding Onboarding team labels Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Smart E2E Test Selection

Selected E2E tags: ALL

AI Confidence: 100

E2E reasoning

Expand to read

I kept the seed's ALL selection. The Wallet home view (app/components/Views/Wallet/index.tsx) now mounts usePrefetchMoneyAccountPlusSubscriptions on every render of the home screen. That hook calls the shared useSubscriptions query, which now sets a staleTime and refetchOnMount and removes cached queries when the session locks or signs out. The new prefetch is gated by the Pro subscription feature flag, so the blast radius is probably limited. But the Wallet home is the entry point for nearly every smoke flow, and useSubscriptions is also used by useMoneyAccountPlusAccess. Other changes (ProHub, ProSubscription, the subscription selectors, which now use shared status helpers, and en.json) are mostly additive or refactors, so they add little extra risk. Because the Wallet root view and a global hook changed, broad coverage is the conservative choice.

View run

@smgv
smgv marked this pull request as ready for review November 3, 2026 11:34

@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.

Stale Bugbot comment from a previous run.

The accounts menu showed Join for a member, then switched after Pro Hub loaded. The row now shows a skeleton until the check settles, then the matching label.

Co-authored-by: Cursor <cursoragent@cursor.com>
@smgv
smgv requested review from a team as code owners November 3, 2026 13:05
@github-actions github-actions Bot added size-L and removed size-M labels Nov 3, 2026
The membership screen no longer renders that row, so the test was checking a label that is not on the screen.

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

@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.

Stale Bugbot comment from a previous run.

A period-end cancel is still an active membership, so the Renew action opened the subscription screen and bounced straight back.

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

@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.

Stale Bugbot comment from a previous run.

Comment thread app/hooks/useMetamaskOrangeEntry.ts Resolved
smgv and others added 4 commits November 5, 2026 17:06
Entitlement-only users (Subscriber access without a membership) were sent
to Pro Hub, which immediately navigated back. Gate the Orange row on
hasMembership, and send settled entitlement-only users to Benefits.

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

@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.

Stale Bugbot comment from a previous run.

Comment thread app/hooks/useMetamaskOrangeEntry.ts Resolved

Copy link
Copy Markdown
Contributor

Accessibility

Quick a11y notes on the new Orange loading path and member-pricing skeletons:

  • MetamaskOrangeMenuSkeleton.tsx:20 and MemberPricingOnTrades.tsx:27 only turn off Skeleton autoPlay for low hardware / offline network. Someone with Reduce Motion on a normal device still gets the shimmer. Wire useReducedMotion() (or equivalent) into that gate too (WCAG 2.3.3).
  • While the Orange label is pending, AccountsMenu.tsx:467 and ProfileDrawer.tsx:185 clear accessibilityLabel, so the fox + skeleton row has no accessible name. Keep a loading label (and accessibilityState busy/disabled) until the real copy lands (WCAG 4.1.2).

Nice that Resume already announces in-progress/errors and the banner error uses accessibilityRole="alert".

An AI accessibility agent posted this. If this is wrong, reply here.

@github-actions github-actions Bot added size-XL and removed size-L labels Nov 6, 2026
return UNAVAILABLE_MODEL;
}

if (canResumeMembership(subscription)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A plan with a payment problem shows as Active.
The new check runs first and only asks "is cancel-at-period-end set, and is the period end still in the future?" It never looks at the status. A past-due, paused, or unpaid plan in that window is labeled Active, and the alert offers Resume instead of add funds. The same input also hides the "renewal failed" alert on an active plan whose latest invoice failed, and the add-funds alert on a plan waiting for funds. Membership uses that same check for the date row, so it says Ends on too.
I think we should check subscription statuses first.

Comment thread app/hooks/useMetamaskOrangeEntry.ts Outdated
// entitlement, including before the list loads, so it is not enough to open
// the hub. An empty result waits until that query settles, then joins.
const isMember = hasMembership;
const isKnownNonMember =

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Join shows while the subscriptions request is still running.
"Eligible" is treated as a finished non-member, with no check that the request has settled. In React Query 5, isLoading is true only when there is no data yet and a request is running. A refetch already has data, so isLoading is false, access stays Eligible, and isSubscriptionsSettled is false. The row says Join MetaMask Orange and opens the join flow. That happens for the whole refetch, including the five-minute refresh, whenever the controller does not yet hold a membership.
Same in useMoneyAccountPlusAccess.ts

const menuItems: {
iconName: IconName;
label: string;
label: React.ReactNode;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The drawer row still has the loading-skeleton API.
The skeleton was removed. Every row still passes a string, and no row sets accessibilityLabel or isDisabled. The extra props and the ReactNode label are unused.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Contact support is gone, but its handler is still there

…ctive toast

mUSD through MetaMask Pay was treated as a still-funding top-up, so checkout skipped the success screen. On-ramp and card payments still show the processing toaster, and the root watcher now shows the active-membership toaster once after it.

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

@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.

Stale Bugbot comment from a previous run.

A past-due, paused, unpaid, or awaiting-funds plan was labeled Active because cancel-at-period-end was checked first. Join also stayed visible during a subscriptions refetch, and the removed Contact support handler and drawer skeleton props were still in place.

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

@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 using default effort and found 1 potential issue.

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 d8b6428. Configure here.

smgv and others added 2 commits November 6, 2026 13:38
…me promise

A payment problem hid Resume, and the date row followed that action, so a plan still set to end said Renews on. Resume already handles its own failure, so the banner no longer leaves that promise floating.

Co-authored-by: Cursor <cursoragent@cursor.com>
tuna1207
tuna1207 previously approved these changes Nov 6, 2026
@smgv
smgv removed the request for review from a team November 6, 2026 09:22
montelaidev
montelaidev previously approved these changes Nov 6, 2026

@PatrykLucka PatrykLucka 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.

Requesting changes as payment failure can remain stuck behind the processing toast if every processing checkout does not observe provisional before awaiting_funds (1st issue below):

  1. Medium — Direct awaiting_funds checkout is not fully monitored
    resolveProSubscriptionStartOutcome returns Processing for an external-funds checkout in awaitingFunds, but useProSubscriptionPaymentMonitor only arms awaitingFunds after observing provisional.
    A direct awaiting_funds → canceled transition can leave the processing toast/debt active without opening the failure sheet. Please use one checkout-session marker for the Processing outcome and add tests for direct awaitingFunds → canceled and awaitingFunds → active.
  2. Medium — Some Pro Hub states can leave member pricing on an endless skeleton
    awaitingFunds and pastDue route to Pro Hub, but without an entitlement they can resolve to Eligible. useMoneyAccountPlusBenefits then returns Loading before reaching its Empty branch.
    Please derive a single benefits mode from subscription status/access and add tests for awaitingFunds and pastDue without entitlements.
  3. Medium — Paused/unpaid benefits cache is not scoped to the subscription period
    The service-backed query key contains only the subscription status. If the subscription ID or billing period changes while the status remains paused or unpaid, the previous usage snapshot can be reused while Pro Hub remains mounted.
    Please include subscription/period identifiers in the query key or explicitly invalidate/refetch when they change.
  4. Low — Home prefetch can still refetch when a menu opens
    useSubscriptions has no explicit staleTime or refetchOnMount policy. React Query can therefore treat the Home-prefetched result as stale when Accounts Menu or Profile Drawer mounts, causing another request and temporarily hiding the non-member row.
    Please define the freshness policy explicitly and add a query-client test for Home prefetch followed by menu opening.
    A broader simplification would be to centralize subscription status/session resolution and reuse it across checkout monitoring, Pro Hub access, benefits rendering, and Orange-entry routing.

- Add a shared Money Account Plus status module used by selectors, checkout
  monitoring, Pro Hub, the banner, and benefits.
- Add one entry resolver (hub, join, pending, disabled) shared by the Orange
  row, Pro Hub, and the subscription screen.
- Watch a processing checkout that lands directly on awaiting_funds, so a
  later cancel opens the failed sheet and activation shows the toast once.
- Derive member pricing from subscription status, so past_due and
  awaiting_funds without an entitlement show Empty instead of a skeleton.
- Scope the benefits query to subscription id and period end, so a new
  paused period does not reuse old usage.
- Keep the subscriptions result fresh for one refetch interval, so opening a
  menu after the Home prefetch does not refetch; drop it on lock or sign-out.

Co-authored-by: Cursor <cursoragent@cursor.com>
@smgv
smgv dismissed stale reviews from montelaidev and tuna1207 via 5d0acff November 6, 2026 10:47
PatrykLucka
PatrykLucka previously approved these changes Nov 6, 2026
@smgv
smgv enabled auto-merge November 7, 2026 06:30
…-cancel

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

# Conflicts:
#	app/components/Views/SocialProfile/ProfileDrawer/ProfileDrawer.test.tsx
@sonarqubecloud

Copy link
Copy Markdown

shouldShowNewPrivacyToast,
storePrivacyPolicyClickedOrClosed,
}: WalletProps) => {
// Fills SubscriptionController before the accounts menu or profile drawer

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Before this PR, only the accounts menu, Pro Hub and the subscription screen mounted the subscriptions query, which polls every 5 minutes (refetchInterval). Now Home mounts it too.
Home stay open for every user so i think we should make the fetching interval of this one more infrequent

enabled: enabled && isSignedIn && isUnlocked,
enabled: enabled && isSessionActive,
staleTime: SUBSCRIPTIONS_REFETCH_INTERVAL,
refetchOnMount: true,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: this is already the default

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants