1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-09 05:00:10 +00:00

Merge branch 'main' into PM-19741

This commit is contained in:
Miles Blackwood
2025-04-28 16:58:48 -04:00
9 changed files with 16 additions and 219 deletions

View File

@@ -801,7 +801,7 @@ export default class NotificationBackground {
message: NotificationBackgroundExtensionMessage,
senderTab: chrome.tabs.Tab,
) {
const { cipherId, organizationId } = message;
const { cipherId, organizationId, folder } = message;
const userId = await firstValueFrom(this.accountService.activeAccount$.pipe(getOptionalUserId));
if (cipherId) {
await this.openAddEditVaultItemPopout(senderTab, { cipherId });
@@ -813,6 +813,7 @@ export default class NotificationBackground {
if (queueItem?.type === NotificationQueueMessageType.AddLogin) {
const cipherView = this.convertAddLoginQueueMessageToCipherView(queueItem);
cipherView.organizationId = organizationId;
cipherView.folderId = folder;
if (userId) {
await this.cipherService.setAddEditCipherInfo({ cipher: cipherView }, userId);

View File

@@ -263,16 +263,16 @@ function handleCloseNotification(e: Event) {
function handleSaveAction(e: Event) {
const selectedVault = selectedVaultSignal.get();
const selectedFolder = selectedFolderSignal.get();
if (selectedVault.length > 1) {
openAddEditVaultItemPopout(e, { organizationId: selectedVault });
openAddEditVaultItemPopout(e, { organizationId: selectedVault, folder: selectedFolder });
handleCloseNotification(e);
return;
}
e.preventDefault();
const selectedFolder = selectedFolderSignal.get();
sendSaveCipherMessage(removeIndividualVault(), selectedFolder);
if (removeIndividualVault()) {
return;
@@ -370,7 +370,7 @@ function handleSaveCipherAttemptCompletedMessage(message: NotificationBarWindowM
function openAddEditVaultItemPopout(
e: Event,
options: { cipherId?: string; organizationId?: string },
options: { cipherId?: string; organizationId?: string; folder?: string },
) {
e.preventDefault();
sendPlatformMessage({

View File

@@ -983,7 +983,7 @@
</div>
<ng-container bitDialogFooter>
<button bitButton bitFormButton buttonType="primary" type="submit">
{{ "upgrade" | i18n }}
{{ sub.subscription.status === "canceled" ? ("restart" | i18n) : ("upgrade" | i18n) }}
</button>
<button bitButton buttonType="secondary" type="button" [bitDialogClose]="ResultType.Closed">
{{ "cancel" | i18n }}

View File

@@ -744,7 +744,7 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
const doSubmit = async (): Promise<string> => {
let orgId: string = null;
if (this.isSubscriptionCanceled) {
if (this.sub.subscription.status === "canceled") {
await this.restartSubscription();
orgId = this.organizationId;
} else {

View File

@@ -494,7 +494,11 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
};
get showChangePlanButton() {
return this.sub.plan.productTier !== ProductTierType.Enterprise && !this.showChangePlan;
return (
!this.showChangePlan &&
this.sub.plan.productTier !== ProductTierType.Enterprise &&
!this.sub.subscription.cancelled
);
}
get canUseBillingSync() {

View File

@@ -56,7 +56,6 @@ import { UnsecuredWebsitesReportComponent as OrgUnsecuredWebsitesReportComponent
import { WeakPasswordsReportComponent as OrgWeakPasswordsReportComponent } from "../tools/reports/pages/organizations/weak-passwords-report.component";
/* eslint no-restricted-imports: "error" */
import { PremiumBadgeComponent } from "../vault/components/premium-badge.component";
import { AddEditCustomFieldsComponent } from "../vault/individual-vault/add-edit-custom-fields.component";
import { FolderAddEditComponent } from "../vault/individual-vault/folder-add-edit.component";
import { OrganizationBadgeModule } from "../vault/individual-vault/organization-badge/organization-badge.module";
import { PipesModule } from "../vault/individual-vault/pipes/pipes.module";
@@ -96,8 +95,6 @@ import { SharedModule } from "./shared.module";
declarations: [
AcceptFamilySponsorshipComponent,
AccountComponent,
AddEditCustomFieldsComponent,
AddEditCustomFieldsComponent,
ApiKeyComponent,
ChangeEmailComponent,
DeauthorizeSessionsComponent,
@@ -144,8 +141,6 @@ import { SharedModule } from "./shared.module";
UserVerificationModule,
PremiumBadgeComponent,
AccountComponent,
AddEditCustomFieldsComponent,
AddEditCustomFieldsComponent,
ApiKeyComponent,
ChangeEmailComponent,
DeauthorizeSessionsComponent,

View File

@@ -1,177 +0,0 @@
<ng-container>
<h3 class="mt-4">{{ "customFields" | i18n }}</h3>
<div cdkDropList (cdkDropListDropped)="drop($event)" *ngIf="cipher.hasFields">
<div
role="group"
class="row"
cdkDrag
*ngFor="let f of cipher.fields; let i = index; trackBy: trackByFunction"
attr.aria-label="{{ f.name }}"
>
<div class="col-5 form-group">
<div class="d-flex">
<label for="fieldName{{ i }}">{{ "name" | i18n }}</label>
<a
class="ml-auto"
href="https://bitwarden.com/help/custom-fields/"
target="_blank"
rel="noreferrer"
appA11yTitle="{{ 'learnMore' | i18n }}"
>
<i class="bwi bwi-question-circle" aria-hidden="true"></i>
</a>
</div>
<input
id="fieldName{{ i }}"
type="text"
name="Field.Name{{ i }}"
[(ngModel)]="f.name"
class="form-control"
appInputVerbatim
[disabled]="cipher.isDeleted || viewOnly"
[readonly]="!cipher.edit && editMode"
/>
</div>
<div class="col-7 form-group">
<label for="fieldValue{{ i }}">{{ "value" | i18n }}</label>
<div class="d-flex align-items-center">
<!-- Text -->
<div class="input-group" *ngIf="f.type === fieldType.Text">
<input
id="fieldValue{{ i }}"
class="form-control"
type="text"
name="Field.Value{{ i }}"
[(ngModel)]="f.value"
appInputVerbatim
[disabled]="cipher.isDeleted || viewOnly"
[readonly]="!cipher.edit && editMode"
attr.aria-describedby="fieldName{{ i }}"
/>
<div class="input-group-append">
<button
type="button"
class="btn btn-outline-secondary"
appA11yTitle="{{ 'copyValue' | i18n }}"
(click)="copy(f.value, 'value', 'Field')"
>
<i class="bwi bwi-lg bwi-clone" aria-hidden="true"></i>
</button>
</div>
</div>
<!-- Hidden -->
<div class="input-group" *ngIf="f.type === fieldType.Hidden">
<input
id="fieldValue{{ i }}"
type="{{ f.showValue ? 'text' : 'password' }}"
name="Field.Value{{ i }}"
[(ngModel)]="f.value"
class="form-control text-monospace"
appInputVerbatim
autocomplete="new-password"
[disabled]="cipher.isDeleted || viewOnly || (!cipher.viewPassword && !f.newField)"
[readonly]="!cipher.edit && editMode"
attr.aria-describedby="fieldName{{ i }}"
/>
<div class="input-group-append">
<button
type="button"
class="btn btn-outline-secondary"
appA11yTitle="{{ 'toggleVisibility' | i18n }}"
(click)="toggleFieldValue(f)"
[disabled]="!cipher.viewPassword && !f.newField"
>
<i
class="bwi bwi-lg"
aria-hidden="true"
[ngClass]="{ 'bwi-eye': !f.showValue, 'bwi-eye-slash': f.showValue }"
>
</i>
</button>
<button
type="button"
class="btn btn-outline-secondary"
appA11yTitle="{{ 'copyValue' | i18n }}"
(click)="copy(f.value, 'value', f.type === fieldType.Hidden ? 'H_Field' : 'Field')"
[disabled]="!cipher.viewPassword && !f.newField"
>
<i class="bwi bwi-lg bwi-clone" aria-hidden="true"></i>
</button>
</div>
</div>
<!-- Linked -->
<div class="input-group" *ngIf="f.type === fieldType.Linked">
<select
id="fieldValue{{ i }}"
name="Field.Value{{ i }}"
class="form-control"
[(ngModel)]="f.linkedId"
*ngIf="f.type === fieldType.Linked && cipher.linkedFieldOptions != null"
[disabled]="cipher.isDeleted || viewOnly"
attr.aria-describedby="fieldName{{ i }}"
>
<option *ngFor="let o of linkedFieldOptions" [ngValue]="o.value">{{ o.name }}</option>
</select>
</div>
<div class="flex-fill">
<!-- Boolean -->
<input
id="fieldValue{{ i }}"
name="Field.Value{{ i }}"
type="checkbox"
[(ngModel)]="f.value"
*ngIf="f.type === fieldType.Boolean"
appTrueFalseValue
trueValue="true"
falseValue="false"
[disabled]="cipher.isDeleted || viewOnly"
attr.aria-describedby="fieldName{{ i }}"
/>
</div>
<button
type="button"
class="btn btn-link text-danger ml-2"
(click)="removeField(f)"
appA11yTitle="{{ 'remove' | i18n }}"
*ngIf="!cipher.isDeleted && !viewOnly && !(!cipher.edit && editMode)"
>
<i class="bwi bwi-minus-circle bwi-lg" aria-hidden="true"></i>
</button>
<button
type="button"
class="btn btn-link text-muted cursor-move"
appA11yTitle="{{ 'dragToSort' | i18n }}"
*ngIf="!cipher.isDeleted && !viewOnly && !(!cipher.edit && editMode)"
>
<i class="bwi bwi-hamburger bwi-lg" aria-hidden="true"></i>
</button>
</div>
</div>
</div>
</div>
<!-- Add new custom field -->
<a
bitLink
href="#"
appStopClick
(click)="addField()"
class="d-inline-block mb-2"
*ngIf="!cipher.isDeleted && !viewOnly && !(!cipher.edit && editMode)"
>
<i class="bwi bwi-plus-circle bwi-fw" aria-hidden="true"></i> {{ "newCustomField" | i18n }}
</a>
<div class="row" *ngIf="!cipher.isDeleted && !viewOnly && !(!cipher.edit && editMode)">
<div class="col-5">
<label for="addFieldType" class="tw-sr-only">{{ "type" | i18n }}</label>
<select id="addFieldType" class="form-control" name="AddFieldType" [(ngModel)]="addFieldType">
<option *ngFor="let o of addFieldTypeOptions" [ngValue]="o.value">{{ o.name }}</option>
<option
*ngIf="cipher.linkedFieldOptions != null"
[ngValue]="addFieldLinkedTypeOption.value"
>
{{ addFieldLinkedTypeOption.name }}
</option>
</select>
</div>
</div>
</ng-container>

View File

@@ -1,20 +0,0 @@
// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
import { Component, Input } from "@angular/core";
import { AddEditCustomFieldsComponent as BaseAddEditCustomFieldsComponent } from "@bitwarden/angular/vault/components/add-edit-custom-fields.component";
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
@Component({
selector: "app-vault-add-edit-custom-fields",
templateUrl: "add-edit-custom-fields.component.html",
})
export class AddEditCustomFieldsComponent extends BaseAddEditCustomFieldsComponent {
@Input() viewOnly: boolean;
@Input() copy: (value: string, typeI18nKey: string, aType: string) => void;
constructor(i18nService: I18nService, eventCollectionService: EventCollectionService) {
super(i18nService, eventCollectionService);
}
}

View File

@@ -422,18 +422,9 @@
"folder": {
"message": "Folder"
},
"newCustomField": {
"message": "New custom field"
},
"value": {
"message": "Value"
},
"dragToSort": {
"message": "Drag to sort"
},
"dragToReorder": {
"message": "Drag to reorder"
},
"cfTypeText": {
"message": "Text"
},
@@ -10637,5 +10628,8 @@
},
"newBusinessUnit": {
"message": "New business unit"
},
"restart": {
"message": "Restart"
}
}