mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 13:53:34 +00:00
[PM-25633] - [Defect] Fix premium badge in totp (#16373)
* fixes to premium upgrade * revert change to dialog * handle premium upgrade prompt redirect in AC * use new input/output api
This commit is contained in:
@@ -61,7 +61,7 @@
|
|||||||
>
|
>
|
||||||
<b>{{ "premiumPurchase" | i18n }}</b>
|
<b>{{ "premiumPurchase" | i18n }}</b>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" bitDialogClose>{{ "close" | i18n }}</button>
|
<button type="button" data-dismiss="modal">{{ "close" | i18n }}</button>
|
||||||
<div class="right" *ngIf="!(isPremium$ | async)">
|
<div class="right" *ngIf="!(isPremium$ | async)">
|
||||||
<button
|
<button
|
||||||
#refreshBtn
|
#refreshBtn
|
||||||
|
|||||||
@@ -1033,6 +1033,12 @@ export class vNextVaultComponent implements OnInit, OnDestroy {
|
|||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When the dialog is closed for a premium upgrade, return early as the user
|
||||||
|
// should be navigated to the subscription settings elsewhere
|
||||||
|
if (result === VaultItemDialogResult.PremiumUpgrade) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Clear the query params when the dialog closes
|
// Clear the query params when the dialog closes
|
||||||
await this.go({ cipherId: null, itemId: null, action: null });
|
await this.go({ cipherId: null, itemId: null, action: null });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Component } from "@angular/core";
|
import { Component, input, output } from "@angular/core";
|
||||||
|
|
||||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||||
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
|
||||||
@@ -8,16 +8,24 @@ import { BadgeModule } from "@bitwarden/components";
|
|||||||
selector: "app-premium-badge",
|
selector: "app-premium-badge",
|
||||||
standalone: true,
|
standalone: true,
|
||||||
template: `
|
template: `
|
||||||
<button type="button" *appNotPremium bitBadge variant="success" (click)="premiumRequired()">
|
<button type="button" *appNotPremium bitBadge variant="success" (click)="promptForPremium()">
|
||||||
{{ "premium" | i18n }}
|
{{ "premium" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
`,
|
`,
|
||||||
imports: [BadgeModule, JslibModule],
|
imports: [BadgeModule, JslibModule],
|
||||||
})
|
})
|
||||||
export class PremiumBadgeComponent {
|
export class PremiumBadgeComponent {
|
||||||
|
/** Skip sending the premiumRequired message (default: false). */
|
||||||
|
skipMessaging = input(false);
|
||||||
|
onClick = output();
|
||||||
|
|
||||||
constructor(private messagingService: MessagingService) {}
|
constructor(private messagingService: MessagingService) {}
|
||||||
|
|
||||||
premiumRequired() {
|
async promptForPremium() {
|
||||||
|
this.onClick.emit();
|
||||||
|
if (this.skipMessaging()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.messagingService.send("premiumRequired");
|
this.messagingService.send("premiumRequired");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,7 @@
|
|||||||
<bit-label [appTextDrag]="totpCodeCopyObj?.totpCode">
|
<bit-label [appTextDrag]="totpCodeCopyObj?.totpCode">
|
||||||
<div class="tw-flex tw-items-center tw-gap-3">
|
<div class="tw-flex tw-items-center tw-gap-3">
|
||||||
{{ "verificationCodeTotp" | i18n }}
|
{{ "verificationCodeTotp" | i18n }}
|
||||||
<app-premium-badge></app-premium-badge>
|
<app-premium-badge [skipMessaging]="true" (onClick)="getPremium()"></app-premium-badge>
|
||||||
</div>
|
</div>
|
||||||
</bit-label>
|
</bit-label>
|
||||||
<input
|
<input
|
||||||
|
|||||||
@@ -107,8 +107,8 @@ export class LoginCredentialsViewComponent implements OnChanges {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getPremium(organizationId?: string) {
|
async getPremium() {
|
||||||
await this.premiumUpgradeService.promptForPremium(organizationId);
|
await this.premiumUpgradeService.promptForPremium(this.cipher.organizationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
async pwToggleValue(passwordVisible: boolean) {
|
async pwToggleValue(passwordVisible: boolean) {
|
||||||
|
|||||||
Reference in New Issue
Block a user