mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 00:03:56 +00:00
[PM-24985][PM-24986][PM-25211][PM-24987] - [Vault] Migrate components to use Premium badge component (#16227)
* migrate all components to use PremiumBadgeComponent * move badge component to vault * move premium badge to vault * move premium badge to billing * fix import * use premium badge in tools new send dropdown * remove badge module import * remove module
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { Component, Input } from "@angular/core";
|
||||
import { Router } from "@angular/router";
|
||||
import { firstValueFrom, Observable, of, switchMap } from "rxjs";
|
||||
|
||||
import { PremiumBadgeComponent } from "@bitwarden/angular/billing/components/premium-badge";
|
||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions";
|
||||
import { SendType } from "@bitwarden/common/tools/send/enums/send-type";
|
||||
import { BadgeModule, ButtonModule, DialogService, MenuModule } from "@bitwarden/components";
|
||||
import { ButtonModule, DialogService, MenuModule } from "@bitwarden/components";
|
||||
import { DefaultSendFormConfigService, SendAddEditDialogComponent } from "@bitwarden/send-ui";
|
||||
|
||||
@Component({
|
||||
selector: "tools-new-send-dropdown",
|
||||
templateUrl: "new-send-dropdown.component.html",
|
||||
imports: [JslibModule, CommonModule, ButtonModule, MenuModule, BadgeModule],
|
||||
imports: [JslibModule, CommonModule, ButtonModule, MenuModule, PremiumBadgeComponent],
|
||||
providers: [DefaultSendFormConfigService],
|
||||
})
|
||||
/**
|
||||
@@ -30,7 +30,6 @@ export class NewSendDropdownComponent {
|
||||
protected canAccessPremium$: Observable<boolean>;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private billingAccountProfileStateService: BillingAccountProfileStateService,
|
||||
private accountService: AccountService,
|
||||
private dialogService: DialogService,
|
||||
@@ -47,16 +46,16 @@ export class NewSendDropdownComponent {
|
||||
|
||||
/**
|
||||
* Opens the SendAddEditComponent for a new Send with the provided type.
|
||||
* If has user does not have premium access and the type is File, the user will be redirected to the premium settings page.
|
||||
* If has user does not have premium access and the type is File do nothing the PremiumBadgeComponent will handle the flow.
|
||||
* @param type The type of Send to create.
|
||||
*/
|
||||
async createSend(type: SendType) {
|
||||
if (!(await firstValueFrom(this.canAccessPremium$)) && type === SendType.File) {
|
||||
return await this.router.navigate(["settings/subscription/premium"]);
|
||||
return;
|
||||
}
|
||||
|
||||
const formConfig = await this.addEditFormConfigService.buildConfig("add", undefined, type);
|
||||
|
||||
await SendAddEditDialogComponent.open(this.dialogService, { formConfig });
|
||||
SendAddEditDialogComponent.open(this.dialogService, { formConfig });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user