Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/subscription-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Added `modalType` field and constant to `SubscriptionEligibility` ([#7124](https://github.com/MetaMask/core/pull/7124))

## [4.0.0]

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import type {
RecurringInterval,
} from './types';
import {
MODAL_TYPE,
PAYMENT_TYPES,
PRODUCT_TYPES,
RECURRING_INTERVALS,
Expand Down Expand Up @@ -1426,6 +1427,7 @@ describe('SubscriptionController', () => {
canSubscribe: true,
minBalanceUSD: 100,
canViewEntryModal: true,
modalType: MODAL_TYPE.A,
cohorts: [],
assignedCohort: null,
hasAssignedCohortExpired: false,
Expand Down
2 changes: 2 additions & 0 deletions packages/subscription-controller/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export type {
BalanceCategory,
AssignCohortRequest,
GetSubscriptionsEligibilitiesRequest,
ModalType,
} from './types';
export {
CRYPTO_PAYMENT_METHOD_ERRORS,
Expand All @@ -75,6 +76,7 @@ export {
SubscriptionUserEvent,
COHORT_NAMES,
BALANCE_CATEGORIES,
MODAL_TYPE,
} from './types';
export { SubscriptionServiceError } from './errors';
export { Env, SubscriptionControllerErrorMessage } from './constants';
Expand Down
8 changes: 8 additions & 0 deletions packages/subscription-controller/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ export const CRYPTO_PAYMENT_METHOD_ERRORS = {
export type CryptoPaymentMethodError =
(typeof CRYPTO_PAYMENT_METHOD_ERRORS)[keyof typeof CRYPTO_PAYMENT_METHOD_ERRORS];

export const MODAL_TYPE = {
A: 'A',
B: 'B',
} as const;

export type ModalType = (typeof MODAL_TYPE)[keyof typeof MODAL_TYPE];

/** only usd for now */
export type Currency = 'usd';

Expand Down Expand Up @@ -266,6 +273,7 @@ export type SubscriptionEligibility = {
canSubscribe: boolean;
minBalanceUSD: number;
canViewEntryModal: boolean;
modalType?: ModalType;
cohorts: Cohort[];
assignedCohort: string | null;
hasAssignedCohortExpired: boolean;
Expand Down
Loading