[pull] main from MetaMask:main - #255
Merged
Merged
Conversation
## Explanation <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> Add last subscription response in getSubscriptions method ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds `lastSubscription` to controller state and `getSubscriptions` response, updates comparison/update logic and metadata, extends `Subscription` fields, and updates tests/changelog. > > - **Subscription Controller**: > - Add `lastSubscription` to `SubscriptionControllerState` and wire into `getSubscriptions` (fetch, compare, persist, expose to UI). > - Introduce `#isSubscriptionEqual` and reuse in `#areSubscriptionsEqual`; update state only when `lastSubscription`/`subscriptions`/`trialedProducts`/`customerId` change. > - Update metadata: `subscriptions.includeInStateLogs` → `false`; add `persist`/`usedInUi` flags; add metadata for `lastSubscription`. > - **Types**: > - Extend `GetSubscriptionsResponse` with `lastSubscription`. > - Extend `Subscription` with `canceledAt`, `inactiveAt`, and required `isEligibleForSupport`. > - **Tests**: > - Update mocks to include `isEligibleForSupport`. > - Add test for `lastSubscription` state update; adjust snapshots for metadata changes. > - **Docs/Changelog**: > - Update CHANGELOG with `lastSubscription` addition. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit d9c1f29. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## Explanation <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> This PR adds new public methods and updates controller state. - `ClaimsController.fetchClaimsConfigurations` and `ClaimsService.fetchClaimsConfigurations` to fetch the claims configuration from the Claims backend. - Updated controller state with new properties, - `validSubmissionWindowDays` - `supportedNetworks` ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds methods to fetch claims configurations from the backend, stores them in controller state (with defaults), renames API URL constant, adjusts headers, and updates exports/tests. > > - **Claims configurations**: > - Add `ClaimsService.fetchClaimsConfigurations` (GET `.../configurations`) using bearer auth. > - Add `ClaimsController.fetchClaimsConfigurations` to map decimal `networks` to hex `supportedNetworks` and update state. > - **State**: > - Introduce `claimsConfigurations` in controller state with `validSubmissionWindowDays` and `supportedNetworks`. > - Add `DEFAULT_CLAIMS_CONFIGURATIONS` and include in default state. > - **Constants & networking**: > - Rename `CLAIMS_API_URL` to `CLAIMS_API_URL_MAP`. > - `getRequestHeaders` no longer sets `Content-Type`; `generateMessageForClaimSignature` sets `'application/json'` explicitly. > - **Types & exports**: > - Add/export `ClaimsConfigurations`, `ClaimsConfigurationsResponse`, `CreateClaimRequest`, `SubmitClaimConfig` and new service action `ClaimsServiceFetchClaimsConfigurationsAction`. > - Export `CLAIMS_API_URL_MAP`, `DEFAULT_CLAIMS_CONFIGURATIONS`, `ClaimsServiceErrorMessages`. > - **Tests & tooling**: > - Update/add tests and mocks for new configurations flow and header behaviors. > - Add `keyring-controller` TS project reference. > - **Docs**: > - Update `CHANGELOG.md` with new method, state fields, and exports. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 9941fe9. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Chaitanya Potti <chaitanya.potti@gmail.com>
## Explanation <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> Minor release of `@metamask/claims-controller` -> `v0.2.0`. ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Bumps monorepo to 668.0.0 and releases @metamask/claims-controller v0.2.0 with updated changelog. > > - **Release**: > - Bump monorepo version in `package.json` to `668.0.0`. > - **`@metamask/claims-controller` v0.2.0**: > - Update `package.json` version to `0.2.0`. > - Update `CHANGELOG.md`: > - Note CI fix for `tsconfig.json` errors. > - Document new `fetchClaimsConfigurations` method and `claimsConfigurations` state (including `validSubmissionWindowDays`, `supportedNetworks`). > - Exported types `CreateClaimRequest` and `SubmitClaimConfig`. > - Update comparison links. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 8fd712f. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## Explanation <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> Implements cohort-based gating API support for Shield entry modal display based on user entry points (wallet_home, post_tx) ## Changes - Add `assignUserToCohort` method to assign users to cohorts via backend API - Update `getSubscriptionsEligibilities` to accept optional `balanceUsd` parameter for cohort eligibility evaluation - Update `submitSubscriptionUserEvents` to include optional `cohort` parameter for event tracking - Add cohort-related types: `Cohort`, `CohortName`, `AssignCohortRequest`, `GetSubscriptionsEligibilitiesRequest` - Update `SubscriptionEligibility` type with cohort fields (`cohorts`, `assignedCohort`, `hasAssignedCohortExpired`) - Refactor `SubscriptionService` to use `makeRequest` helper for cleaner query parameter handling ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> Fixes https://consensyssoftware.atlassian.net/browse/SUBS-711 ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Introduce cohort-based subscription gating: new `assignUserToCohort`, eligibility `balanceCategory` filtering, cohort-aware events, extended types/exports, and request helper refactor for query params. > > - **Controller**: > - Add `assignUserToCohort(request)` and forwardable `getSubscriptionsEligibilities(request?)` to pass `balanceCategory`. > - `submitUserEvent` now accepts optional `cohort`. > - **Service**: > - Implement `assignUserToCohort` (`POST cohorts/assign`). > - Extend `getSubscriptionsEligibilities(request?)` to send `balanceCategory` as query param; normalize cohort fields in response. > - Refactor `#makeRequest` to accept `queryParams` for URL construction. > - **Types/Constants/Exports**: > - Add cohort types `Cohort`, `CohortName`, `BalanceCategory`, `AssignCohortRequest`, `GetSubscriptionsEligibilitiesRequest` and constants `COHORT_NAMES`, `BALANCE_CATEGORIES`. > - Extend `SubscriptionEligibility` with `cohorts`, `assignedCohort`, `hasAssignedCohortExpired`. > - Add `ShieldCohortAssigned` to `SubscriptionUserEvent`. > - Export new types/constants from `index`. > - **Tests/Docs**: > - Update unit tests for new methods/params and cohort payloads. > - Update `CHANGELOG.md` reflecting additions and refactor. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 2958797. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## Explanation <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> Major release of `@metamask/subscription-controller` --> `v4.0.0`. ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Publish @metamask/subscription-controller v4.0.0 adding cohort APIs/types and new state fields, plus a request URL refactor; bump monorepo version to 669.0.0. > > - **@metamask/subscription-controller v4.0.0**: > - **APIs/Types**: Add `assignUserToCohort`, cohort-related types/constants, and optional `cohort`/`balanceCategory` params. > - **State**: Add `lastSubscription` and cohort fields to `SubscriptionEligibility`. > - **Refactor**: Update `SubscriptionService.makeRequest` to accept query params for cleaner URL construction. > - **Repo**: > - Bump monorepo `version` to `669.0.0` and package version to `4.0.0`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 1fb0f6a. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )