-
-
Notifications
You must be signed in to change notification settings - Fork 254
feat: implement cohort-based gating system for subscriptions #7099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@metamaskbot publish-preview |
|
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls don't send the actual user balance. send the user balance category
0-100
100-1k
1k-10k
10k-100k
100k-1M
1M+
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed here
…ohort eligibility
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
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.