Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,11 @@ <h3 slot="title" bitTypography="h3" class="tw-m-0">{{ "families" | i18n }}</h3>
</a>
</div>
</bit-section>

<!-- Self-hosted license upload section -->
<bit-section *ngIf="isSelfHost">
<individual-self-hosting-license-uploader
(onLicenseFileUploaded)="onLicenseFileSelectedChanged()"
/>
</bit-section>
</div>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { CommonModule } from "@angular/common";
import { Component, DestroyRef, inject } from "@angular/core";
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
import { ActivatedRoute, Router } from "@angular/router";
import { combineLatest, firstValueFrom, map, Observable, of, shareReplay, switchMap } from "rxjs";

import { ApiService } from "@bitwarden/common/abstractions/api.service";
Expand All @@ -21,6 +22,7 @@ import { PricingCardComponent } from "@bitwarden/pricing";
import { I18nPipe } from "@bitwarden/ui-common";

import { SubscriptionPricingService } from "../../services/subscription-pricing.service";
import { BillingSharedModule } from "../../shared/billing-shared.module";
import { BitwardenSubscriber, mapAccountToSubscriber } from "../../types";
import {
PersonalSubscriptionPricingTier,
Expand All @@ -45,6 +47,7 @@ import {
LinkModule,
I18nPipe,
PricingCardComponent,
BillingSharedModule,
],
})
export class PremiumVNextComponent {
Expand Down Expand Up @@ -77,6 +80,8 @@ export class PremiumVNextComponent {
private toastService: ToastService,
private billingAccountProfileStateService: BillingAccountProfileStateService,
private subscriptionPricingService: SubscriptionPricingService,
private router: Router,
private activatedRoute: ActivatedRoute,
) {
this.isSelfHost = this.platformUtilsService.isSelfHost();

Expand Down Expand Up @@ -146,6 +151,18 @@ export class PremiumVNextComponent {
await this.syncService.fullSync(true);
};

protected async onLicenseFileSelectedChanged(): Promise<void> {
this.toastService.showToast({
variant: "success",
title: null,
message: this.i18nService.t("premiumUpdated"),
});
await this.navigateToSubscriptionPage();
}

navigateToSubscriptionPage = (): Promise<boolean> =>
this.router.navigate(["../user-subscription"], { relativeTo: this.activatedRoute });

protected async openUpgradeDialog(planType: "Premium" | "Families"): Promise<void> {
const account = await firstValueFrom(this.accountService.activeAccount$);
if (!account) {
Expand Down
Loading