1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 07:13:32 +00:00

(Billing) [PM-27562] Create PremiumInterestStateService (#17139)

Creates a `PremiumInterestStateService` that manages state which conveys whether or not a user intends to setup a premium subscription. Implemented in Web only. No-op for other clients.

This will apply for users who began the registration process on https://bitwarden.com/go/start-premium/, which is a marketing page designed to streamline users who intend to setup a premium subscription after registration.
This commit is contained in:
rr-bw
2025-11-03 14:42:21 -08:00
committed by GitHub
parent 906ac95175
commit 5c33b2dc89
7 changed files with 234 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
import { Injectable } from "@angular/core";
import { UserId } from "@bitwarden/user-core";
import { PremiumInterestStateService } from "./premium-interest-state.service.abstraction";
@Injectable()
export class NoopPremiumInterestStateService implements PremiumInterestStateService {
async getPremiumInterest(userId: UserId): Promise<boolean | null> {
return null;
} // no-op
async setPremiumInterest(userId: UserId, premiumInterest: boolean): Promise<void> {} // no-op
async clearPremiumInterest(userId: UserId): Promise<void> {} // no-op
}

View File

@@ -0,0 +1,14 @@
import { UserId } from "@bitwarden/user-core";
/**
* A service that manages state which conveys whether or not a user has expressed interest
* in setting up a premium subscription. This applies for users who began the registration
* process on https://bitwarden.com/go/start-premium/, which is a marketing page designed
* to streamline users who intend to setup a premium subscription after registration.
* - Implemented in Web only. No-op for other clients.
*/
export abstract class PremiumInterestStateService {
abstract getPremiumInterest(userId: UserId): Promise<boolean | null>;
abstract setPremiumInterest(userId: UserId, premiumInterest: boolean): Promise<void>;
abstract clearPremiumInterest(userId: UserId): Promise<void>;
}

View File

@@ -380,6 +380,8 @@ import { DefaultSetInitialPasswordService } from "../auth/password-management/se
import { SetInitialPasswordService } from "../auth/password-management/set-initial-password/set-initial-password.service.abstraction";
import { DeviceTrustToastService as DeviceTrustToastServiceAbstraction } from "../auth/services/device-trust-toast.service.abstraction";
import { DeviceTrustToastService } from "../auth/services/device-trust-toast.service.implementation";
import { NoopPremiumInterestStateService } from "../billing/services/premium-interest/noop-premium-interest-state.service";
import { PremiumInterestStateService } from "../billing/services/premium-interest/premium-interest-state.service.abstraction";
import { FormValidationErrorsService as FormValidationErrorsServiceAbstraction } from "../platform/abstractions/form-validation-errors.service";
import { DocumentLangSetter } from "../platform/i18n";
import { FormValidationErrorsService } from "../platform/services/form-validation-errors.service";
@@ -1724,6 +1726,11 @@ const safeProviders: SafeProvider[] = [
useClass: DefaultNewDeviceVerificationComponentService,
deps: [],
}),
safeProvider({
provide: PremiumInterestStateService,
useClass: NoopPremiumInterestStateService,
deps: [],
}),
];
@NgModule({