mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 06:13:38 +00:00
[PM-23713] always append query param to premium redirect (#17240)
This commit is contained in:
@@ -158,12 +158,7 @@ describe("PremiumUpgradeDialogComponent", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("upgrade()", () => {
|
describe("upgrade()", () => {
|
||||||
it("should launch URI with query parameter for cloud-hosted environments", async () => {
|
it("should launch URI with query parameter", async () => {
|
||||||
mockEnvironmentService.environment$ = of({
|
|
||||||
getWebVaultUrl: () => "https://vault.bitwarden.com",
|
|
||||||
getRegion: () => Region.US,
|
|
||||||
} as any);
|
|
||||||
|
|
||||||
await component["upgrade"]();
|
await component["upgrade"]();
|
||||||
|
|
||||||
expect(mockPlatformUtilsService.launchUri).toHaveBeenCalledWith(
|
expect(mockPlatformUtilsService.launchUri).toHaveBeenCalledWith(
|
||||||
@@ -171,34 +166,6 @@ describe("PremiumUpgradeDialogComponent", () => {
|
|||||||
);
|
);
|
||||||
expect(mockDialogRef.close).toHaveBeenCalled();
|
expect(mockDialogRef.close).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should launch URI without query parameter for self-hosted environments", async () => {
|
|
||||||
mockEnvironmentService.environment$ = of({
|
|
||||||
getWebVaultUrl: () => "https://self-hosted.example.com",
|
|
||||||
getRegion: () => Region.SelfHosted,
|
|
||||||
} as any);
|
|
||||||
|
|
||||||
await component["upgrade"]();
|
|
||||||
|
|
||||||
expect(mockPlatformUtilsService.launchUri).toHaveBeenCalledWith(
|
|
||||||
"https://self-hosted.example.com/#/settings/subscription/premium",
|
|
||||||
);
|
|
||||||
expect(mockDialogRef.close).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should launch URI with query parameter for EU cloud region", async () => {
|
|
||||||
mockEnvironmentService.environment$ = of({
|
|
||||||
getWebVaultUrl: () => "https://vault.bitwarden.eu",
|
|
||||||
getRegion: () => Region.EU,
|
|
||||||
} as any);
|
|
||||||
|
|
||||||
await component["upgrade"]();
|
|
||||||
|
|
||||||
expect(mockPlatformUtilsService.launchUri).toHaveBeenCalledWith(
|
|
||||||
"https://vault.bitwarden.eu/#/settings/subscription/premium?callToAction=upgradeToPremium",
|
|
||||||
);
|
|
||||||
expect(mockDialogRef.close).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should close dialog when close button clicked", () => {
|
it("should close dialog when close button clicked", () => {
|
||||||
|
|||||||
@@ -11,10 +11,7 @@ import {
|
|||||||
SubscriptionCadence,
|
SubscriptionCadence,
|
||||||
SubscriptionCadenceIds,
|
SubscriptionCadenceIds,
|
||||||
} from "@bitwarden/common/billing/types/subscription-pricing-tier";
|
} from "@bitwarden/common/billing/types/subscription-pricing-tier";
|
||||||
import {
|
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
|
||||||
EnvironmentService,
|
|
||||||
Region,
|
|
||||||
} from "@bitwarden/common/platform/abstractions/environment.service";
|
|
||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import {
|
import {
|
||||||
@@ -82,10 +79,9 @@ export class PremiumUpgradeDialogComponent {
|
|||||||
|
|
||||||
protected async upgrade(): Promise<void> {
|
protected async upgrade(): Promise<void> {
|
||||||
const environment = await firstValueFrom(this.environmentService.environment$);
|
const environment = await firstValueFrom(this.environmentService.environment$);
|
||||||
let vaultUrl = environment.getWebVaultUrl() + "/#/settings/subscription/premium";
|
const vaultUrl =
|
||||||
if (environment.getRegion() !== Region.SelfHosted) {
|
environment.getWebVaultUrl() +
|
||||||
vaultUrl += "?callToAction=upgradeToPremium";
|
"/#/settings/subscription/premium?callToAction=upgradeToPremium";
|
||||||
}
|
|
||||||
this.platformUtilsService.launchUri(vaultUrl);
|
this.platformUtilsService.launchUri(vaultUrl);
|
||||||
this.dialogRef.close();
|
this.dialogRef.close();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user