diff --git a/libs/tools/send/send-ui/src/new-send-dropdown/new-send-dropdown.component.html b/libs/tools/send/send-ui/src/new-send-dropdown/new-send-dropdown.component.html index 0766435e1ce..f1f0363c999 100644 --- a/libs/tools/send/send-ui/src/new-send-dropdown/new-send-dropdown.component.html +++ b/libs/tools/send/send-ui/src/new-send-dropdown/new-send-dropdown.component.html @@ -10,5 +10,8 @@ {{ "sendTypeFile" | i18n }} + diff --git a/libs/tools/send/send-ui/src/new-send-dropdown/new-send-dropdown.component.ts b/libs/tools/send/send-ui/src/new-send-dropdown/new-send-dropdown.component.ts index 1463b448a6a..620dc77c995 100644 --- a/libs/tools/send/send-ui/src/new-send-dropdown/new-send-dropdown.component.ts +++ b/libs/tools/send/send-ui/src/new-send-dropdown/new-send-dropdown.component.ts @@ -1,23 +1,39 @@ import { CommonModule } from "@angular/common"; -import { Component } from "@angular/core"; +import { Component, OnInit } from "@angular/core"; import { Router, RouterLink } from "@angular/router"; +import { firstValueFrom } from "rxjs"; import { JslibModule } from "@bitwarden/angular/jslib.module"; +import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions"; import { SendType } from "@bitwarden/common/tools/send/enums/send-type"; -import { ButtonModule, MenuModule } from "@bitwarden/components"; +import { BadgeModule, ButtonModule, MenuModule } from "@bitwarden/components"; @Component({ selector: "tools-new-send-dropdown", templateUrl: "new-send-dropdown.component.html", standalone: true, - imports: [JslibModule, CommonModule, ButtonModule, RouterLink, MenuModule], + imports: [JslibModule, CommonModule, ButtonModule, RouterLink, MenuModule, BadgeModule], }) -export class NewSendDropdownComponent { +export class NewSendDropdownComponent implements OnInit { sendType = SendType; - constructor(private router: Router) {} + hasNoPremium = false; + + constructor( + private router: Router, + private billingAccountProfileStateService: BillingAccountProfileStateService, + ) {} + + async ngOnInit() { + this.hasNoPremium = !(await firstValueFrom( + this.billingAccountProfileStateService.hasPremiumFromAnySource$, + )); + } newItemNavigate(type: SendType) { + if (this.hasNoPremium && type === SendType.File) { + return this.router.navigate(["/premium"]); + } void this.router.navigate(["/add-send"], { queryParams: { type: type, isNew: true } }); } }