feat: implement cohort-based gating system for subscriptions - #7099
Merged
Merged
Conversation
Member
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
| const path = 'subscriptions/eligibility'; | ||
| const results = await this.#makeRequest<SubscriptionEligibility[]>(path); | ||
| let query: Record<string, string> | undefined; | ||
| if (request?.balanceUsd !== undefined) { |
Member
There was a problem hiding this comment.
pls don't send the actual user balance. send the user balance category
0-100
100-1k
1k-10k
10k-100k
100k-1M
1M+
…ohort eligibility
Member
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
tanguyenvn
reviewed
Nov 11, 2025
Member
Author
|
@metamaskbot publish-preview |
chaitanyapotti
approved these changes
Nov 11, 2025
Contributor
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
tanguyenvn
approved these changes
Nov 11, 2025
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Explanation
Implements cohort-based gating API support for Shield entry modal display based on user entry points (wallet_home, post_tx)
Changes
assignUserToCohortmethod to assign users to cohorts via backend APIgetSubscriptionsEligibilitiesto accept optionalbalanceUsdparameter for cohort eligibility evaluationsubmitSubscriptionUserEventsto include optionalcohortparameter for event trackingCohort,CohortName,AssignCohortRequest,GetSubscriptionsEligibilitiesRequestSubscriptionEligibilitytype with cohort fields (cohorts,assignedCohort,hasAssignedCohortExpired)SubscriptionServiceto usemakeRequesthelper for cleaner query parameter handlingReferences
Fixes https://consensyssoftware.atlassian.net/browse/SUBS-711
Checklist
Note
Introduce cohort-based subscription gating: new
assignUserToCohort, eligibilitybalanceCategoryfiltering, cohort-aware events, extended types/exports, and request helper refactor for query params.assignUserToCohort(request)and forwardablegetSubscriptionsEligibilities(request?)to passbalanceCategory.submitUserEventnow accepts optionalcohort.assignUserToCohort(POST cohorts/assign).getSubscriptionsEligibilities(request?)to sendbalanceCategoryas query param; normalize cohort fields in response.#makeRequestto acceptqueryParamsfor URL construction.Cohort,CohortName,BalanceCategory,AssignCohortRequest,GetSubscriptionsEligibilitiesRequestand constantsCOHORT_NAMES,BALANCE_CATEGORIES.SubscriptionEligibilitywithcohorts,assignedCohort,hasAssignedCohortExpired.ShieldCohortAssignedtoSubscriptionUserEvent.index.CHANGELOG.mdreflecting additions and refactor.Written by Cursor Bugbot for commit 2958797. This will update automatically on new commits. Configure here.