Merge branch 'main' of https://github.com/bitwarden/clients into PM-5025-Migrate-update-license-component

This commit is contained in:
vinith-kovan 2024-04-09 16:28:35 +05:30
commit 49b44b3dc8
No known key found for this signature in database
GPG Key ID: 9E663946A0AE5089
65 changed files with 660 additions and 338 deletions

View File

@ -38,9 +38,7 @@ const config: StorybookConfig = {
},
env: (config) => ({
...config,
FLAGS: JSON.stringify({
secretsManager: true,
}),
FLAGS: JSON.stringify({}),
}),
webpackFinal: async (config, { configType }) => {
if (config.resolve) {

View File

@ -95,10 +95,10 @@
"message": "Auto-fill login"
},
"autoFillCard": {
"message": "Auto-fill card"
"message": "Auto-bete txartela"
},
"autoFillIdentity": {
"message": "Auto-fill identity"
"message": "Auto-bete nortasuna"
},
"generatePasswordCopied": {
"message": "Sortu pasahitza (kopiatuta)"
@ -110,19 +110,19 @@
"message": "Bat datozen saio-hasierarik gabe"
},
"noCards": {
"message": "No cards"
"message": "Txartelik ez"
},
"noIdentities": {
"message": "No identities"
"message": "Nortasunik ez"
},
"addLoginMenu": {
"message": "Add login"
},
"addCardMenu": {
"message": "Add card"
"message": "Gehitu txartela"
},
"addIdentityMenu": {
"message": "Add identity"
"message": "Gehitu nortasuna"
},
"unlockVaultMenu": {
"message": "Desblokeatu kutxa gotorra"
@ -223,10 +223,10 @@
"message": "Bitwarden Laguntza zentroa"
},
"communityForums": {
"message": "Explore Bitwarden community forums"
"message": "Esploratu Bitwarden komunitatearen foroak"
},
"contactSupport": {
"message": "Contact Bitwarden support"
"message": "Jarri harremanetan Bitwardeneko laguntza taldearekin"
},
"sync": {
"message": "Sinkronizatu"
@ -269,7 +269,7 @@
"message": "Luzera"
},
"passwordMinLength": {
"message": "Minimum password length"
"message": "Pasahitzaren gutxieneko luzera"
},
"uppercase": {
"message": "Letra larria (A-Z)"
@ -1064,7 +1064,7 @@
"message": "Edit browser settings."
},
"autofillOverlayVisibilityOff": {
"message": "Off",
"message": "Itzalita",
"description": "Overlay setting select option for disabling autofill overlay"
},
"autofillOverlayVisibilityOnFieldFocus": {
@ -1592,10 +1592,10 @@
"message": "Ezarri pasahitz nagusia"
},
"currentMasterPass": {
"message": "Current master password"
"message": "Oraingo pasahitz nagusia"
},
"newMasterPass": {
"message": "New master password"
"message": "Pasahitz nagusi berria"
},
"confirmNewMasterPass": {
"message": "Confirm new master password"
@ -2266,10 +2266,10 @@
"message": "Please make sure your vault is unlocked and the Fingerprint phrase matches on the other device."
},
"resendNotification": {
"message": "Resend notification"
"message": "Berbidali jakinarazpena"
},
"viewAllLoginOptions": {
"message": "View all log in options"
"message": "Ikusi erregistro guztiak ezarpenetan"
},
"notificationSentDevice": {
"message": "A notification has been sent to your device."
@ -2293,13 +2293,13 @@
"message": "Check known data breaches for this password"
},
"important": {
"message": "Important:"
"message": "Garrantzitsua:"
},
"masterPasswordHint": {
"message": "Your master password cannot be recovered if you forget it!"
},
"characterMinimum": {
"message": "$LENGTH$ character minimum",
"message": "$LENGTH$ karaktere gutxienez",
"placeholders": {
"length": {
"content": "$1",
@ -2326,7 +2326,7 @@
"message": "Select an item from this screen, or explore other options in settings."
},
"gotIt": {
"message": "Got it"
"message": "Ulertuta"
},
"autofillSettings": {
"message": "Auto-fill settings"
@ -2359,25 +2359,25 @@
"message": "Logging in on"
},
"opensInANewWindow": {
"message": "Opens in a new window"
"message": "Leiho berri batean irekitzen da"
},
"deviceApprovalRequired": {
"message": "Device approval required. Select an approval option below:"
},
"rememberThisDevice": {
"message": "Remember this device"
"message": "Gogoratu gailu hau"
},
"uncheckIfPublicDevice": {
"message": "Uncheck if using a public device"
},
"approveFromYourOtherDevice": {
"message": "Approve from your other device"
"message": "Onartu zure beste gailutik"
},
"requestAdminApproval": {
"message": "Request admin approval"
"message": "Eskatu administratzailearen onarpena"
},
"approveWithMasterPassword": {
"message": "Approve with master password"
"message": "Onartu pasahitz nagusiarekin"
},
"ssoIdentifierRequired": {
"message": "Organization SSO identifier is required."
@ -2390,31 +2390,31 @@
"message": "Access denied. You do not have permission to view this page."
},
"general": {
"message": "General"
"message": "Orokorra"
},
"display": {
"message": "Display"
"message": "Bistaratzea"
},
"accountSuccessfullyCreated": {
"message": "Account successfully created!"
"message": "Kontua zuzen sortu da!"
},
"adminApprovalRequested": {
"message": "Admin approval requested"
"message": "Administratzailearen onarpena eskatuta"
},
"adminApprovalRequestSentToAdmins": {
"message": "Your request has been sent to your admin."
"message": "Zure eskaera zure administratzaileari bidali zaio."
},
"youWillBeNotifiedOnceApproved": {
"message": "You will be notified once approved."
"message": "Jakinaraziko zaizu onartzen denean."
},
"troubleLoggingIn": {
"message": "Trouble logging in?"
"message": "Arazoak saioa hasterakoan?"
},
"loginApproved": {
"message": "Login approved"
},
"userEmailMissing": {
"message": "User email missing"
"message": "Erabiltzailearen emaila falta da"
},
"deviceTrusted": {
"message": "Device trusted"
@ -2540,19 +2540,19 @@
"description": "Notification button text for starting a fileless import."
},
"importing": {
"message": "Importing...",
"message": "Inportatzen...",
"description": "Notification message for when an import is in progress."
},
"dataSuccessfullyImported": {
"message": "Data successfully imported!",
"message": "Datuak zuzen inportatu dira!",
"description": "Notification message for when an import has completed successfully."
},
"dataImportFailed": {
"message": "Error importing. Check console for details.",
"message": "Errorea gertatu da inportatzean. Begiratu xehetasunak kontsolan.",
"description": "Notification message for when an import has failed."
},
"importNetworkError": {
"message": "Network error encountered during import.",
"message": "Sareko errorea gertatu da inportatzerakoan.",
"description": "Notification message for when an import has failed due to a network error."
},
"aliasDomain": {
@ -2602,11 +2602,11 @@
"description": "Screen reader text for when a login item is focused where a partial username is displayed. SR will announce this phrase before reading the text of the partial username"
},
"noItemsToShow": {
"message": "No items to show",
"message": "Ez dago elementurik erakusteko",
"description": "Text to show in overlay if there are no matching items"
},
"newItem": {
"message": "New item",
"message": "Elementu berria",
"description": "Button text to display in overlay when there are no matching items"
},
"addNewVaultItem": {
@ -2618,32 +2618,32 @@
"description": "Screen reader text for announcing when the overlay opens on the page"
},
"turnOn": {
"message": "Turn on"
"message": "Piztu"
},
"ignore": {
"message": "Ignore"
"message": "Ezikusi"
},
"importData": {
"message": "Import data",
"message": "Inportatu datuak",
"description": "Used for the header of the import dialog, the import button and within the file-password-prompt"
},
"importError": {
"message": "Import error"
"message": "Errorea inportatzerakoan"
},
"importErrorDesc": {
"message": "There was a problem with the data you tried to import. Please resolve the errors listed below in your source file and try again."
"message": "Inportatzen saiatu zaren datuekin arazo bat egon da. Mesedez, konpondu ondoren adierazten diren akatsak eta saiatu berriro."
},
"resolveTheErrorsBelowAndTryAgain": {
"message": "Resolve the errors below and try again."
"message": "Konpondu beheko akatsak eta saiatu berriro."
},
"description": {
"message": "Description"
"message": "Deskribapena"
},
"importSuccess": {
"message": "Data successfully imported"
"message": "Datuak zuzen inportatu dira"
},
"importSuccessNumberOfItems": {
"message": "A total of $AMOUNT$ items were imported.",
"message": "Guztira $AMOUNT$ elementu inportatu dira.",
"placeholders": {
"amount": {
"content": "$1",
@ -2652,7 +2652,7 @@
}
},
"tryAgain": {
"message": "Try again"
"message": "Saiatu berriro"
},
"verificationRequiredForActionSetPinToContinue": {
"message": "Verification required for this action. Set a PIN to continue."
@ -2661,10 +2661,10 @@
"message": "Set PIN"
},
"verifyWithBiometrics": {
"message": "Verify with biometrics"
"message": "Egiaztatu biometria erabiliz"
},
"awaitingConfirmation": {
"message": "Awaiting confirmation"
"message": "Baieztapenaren zain"
},
"couldNotCompleteBiometrics": {
"message": "Could not complete biometrics."
@ -2673,13 +2673,13 @@
"message": "Need a different method?"
},
"useMasterPassword": {
"message": "Use master password"
"message": "Erabili pasahitz nagusia"
},
"usePin": {
"message": "Use PIN"
"message": "Erabili PIN kodea"
},
"useBiometrics": {
"message": "Use biometrics"
"message": "Erabili biometria"
},
"enterVerificationCodeSentToEmail": {
"message": "Enter the verification code that was sent to your email."
@ -2688,10 +2688,10 @@
"message": "Resend code"
},
"total": {
"message": "Total"
"message": "Guztira"
},
"importWarning": {
"message": "You are importing data to $ORGANIZATION$. Your data may be shared with members of this organization. Do you want to proceed?",
"message": "$ORGANIZATION$(e)ra datuak inportatzen ari zara. Zure datuak erakunde horretako kideekin parteka daitezke. Jarraitu nahi duzu?",
"placeholders": {
"organization": {
"content": "$1",
@ -2810,7 +2810,7 @@
"message": "You do not have a matching login for this site."
},
"confirm": {
"message": "Confirm"
"message": "Berretsi"
},
"savePasskey": {
"message": "Save passkey"

View File

@ -11,7 +11,7 @@
"description": "Extension description"
},
"loginOrCreateNewAccount": {
"message": "Käytä salattua holviasi kirjautumalla sisään tai tai luo uusi tili."
"message": "Käytä salattua holviasi kirjautumalla sisään tai luo uusi tili."
},
"createAccount": {
"message": "Luo tili"
@ -802,7 +802,7 @@
"message": "Lue lisää"
},
"authenticatorKeyTotp": {
"message": "Todennusaavain (TOTP)"
"message": "Todennusavain (TOTP)"
},
"verificationCodeTotp": {
"message": "Todennuskoodi (TOTP)"

View File

@ -17,7 +17,7 @@ import { CipherService } from "@bitwarden/common/vault/services/cipher.service";
import { FolderService } from "@bitwarden/common/vault/services/folder/folder.service";
import { BrowserApi } from "../../platform/browser/browser-api";
import { BrowserStateService } from "../../platform/services/browser-state.service";
import { DefaultBrowserStateService } from "../../platform/services/default-browser-state.service";
import { NotificationQueueMessageType } from "../enums/notification-queue-message-type.enum";
import { FormData } from "../services/abstractions/autofill.service";
import AutofillService from "../services/autofill.service";
@ -49,7 +49,7 @@ describe("NotificationBackground", () => {
const authService = mock<AuthService>();
const policyService = mock<PolicyService>();
const folderService = mock<FolderService>();
const stateService = mock<BrowserStateService>();
const stateService = mock<DefaultBrowserStateService>();
const userNotificationSettingsService = mock<UserNotificationSettingsService>();
const domainSettingsService = mock<DomainSettingsService>();
const environmentService = mock<EnvironmentService>();

View File

@ -33,7 +33,7 @@ import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { CipherService } from "@bitwarden/common/vault/services/cipher.service";
import { BrowserApi } from "../../platform/browser/browser-api";
import { BrowserStateService } from "../../platform/services/browser-state.service";
import { DefaultBrowserStateService } from "../../platform/services/default-browser-state.service";
import { BrowserPlatformUtilsService } from "../../platform/services/platform-utils/browser-platform-utils.service";
import { AutofillService } from "../services/abstractions/autofill.service";
import {
@ -72,7 +72,7 @@ describe("OverlayBackground", () => {
urls: { icons: "https://icons.bitwarden.com/" },
}),
);
const stateService = mock<BrowserStateService>();
const stateService = mock<DefaultBrowserStateService>();
const autofillSettingsService = mock<AutofillSettingsService>();
const i18nService = mock<I18nService>();
const platformUtilsService = mock<BrowserPlatformUtilsService>();

View File

@ -211,7 +211,7 @@ import BrowserLocalStorageService from "../platform/services/browser-local-stora
import BrowserMemoryStorageService from "../platform/services/browser-memory-storage.service";
import BrowserMessagingPrivateModeBackgroundService from "../platform/services/browser-messaging-private-mode-background.service";
import BrowserMessagingService from "../platform/services/browser-messaging.service";
import { BrowserStateService } from "../platform/services/browser-state.service";
import { DefaultBrowserStateService } from "../platform/services/default-browser-state.service";
import I18nService from "../platform/services/i18n.service";
import { LocalBackedSessionStorageService } from "../platform/services/local-backed-session-storage.service";
import { BackgroundPlatformUtilsService } from "../platform/services/platform-utils/background-platform-utils.service";
@ -466,7 +466,7 @@ export default class MainBackground {
new MigrationBuilderService(),
);
this.stateService = new BrowserStateService(
this.stateService = new DefaultBrowserStateService(
this.storageService,
this.secureStorageService,
this.memoryStorageService,

View File

@ -10,7 +10,7 @@ import {
TokenServiceInitOptions,
} from "../../../auth/background/service-factories/token-service.factory";
import { Account } from "../../../models/account";
import { BrowserStateService } from "../../services/browser-state.service";
import { DefaultBrowserStateService } from "../../services/default-browser-state.service";
import {
environmentServiceFactory,
@ -46,15 +46,15 @@ export type StateServiceInitOptions = StateServiceFactoryOptions &
MigrationRunnerInitOptions;
export async function stateServiceFactory(
cache: { stateService?: BrowserStateService } & CachedServices,
cache: { stateService?: DefaultBrowserStateService } & CachedServices,
opts: StateServiceInitOptions,
): Promise<BrowserStateService> {
): Promise<DefaultBrowserStateService> {
const service = await factory(
cache,
"stateService",
opts,
async () =>
new BrowserStateService(
new DefaultBrowserStateService(
await diskStorageServiceFactory(cache, opts),
await secureStorageServiceFactory(cache, opts),
await memoryStorageServiceFactory(cache, opts),

View File

@ -3,7 +3,7 @@ import { BehaviorSubject } from "rxjs";
import { AbstractMemoryStorageService } from "@bitwarden/common/platform/abstractions/storage.service";
import { MemoryStorageService } from "@bitwarden/common/platform/services/memory-storage.service";
import { BrowserStateService } from "../../services/browser-state.service";
import { DefaultBrowserStateService } from "../../services/default-browser-state.service";
import { browserSession } from "./browser-session.decorator";
import { SessionStorable } from "./session-storable";
@ -25,7 +25,7 @@ describe("browserSession decorator", () => {
});
it("should create if StateService is a constructor argument", () => {
const stateService = Object.create(BrowserStateService.prototype, {
const stateService = Object.create(DefaultBrowserStateService.prototype, {
memoryStorageService: {
value: Object.create(MemoryStorageService.prototype, {
type: { value: MemoryStorageService.TYPE },
@ -35,7 +35,7 @@ describe("browserSession decorator", () => {
@browserSession
class TestClass {
constructor(private stateService: BrowserStateService) {}
constructor(private stateService: DefaultBrowserStateService) {}
}
expect(new TestClass(stateService)).toBeDefined();

View File

@ -11,13 +11,13 @@ import { GroupPolicyEnvironment } from "../admin-console/types/group-policy-envi
import { BrowserApi } from "./browser/browser-api";
// required to avoid linting errors when there are no flags
/* eslint-disable-next-line @typescript-eslint/ban-types */
// eslint-disable-next-line @typescript-eslint/ban-types
export type Flags = {
accountSwitching?: boolean;
} & SharedFlags;
// required to avoid linting errors when there are no flags
/* eslint-disable-next-line @typescript-eslint/ban-types */
// eslint-disable-next-line @typescript-eslint/ban-types
export type DevFlags = {
storeSessionDecrypted?: boolean;
managedEnvironment?: GroupPolicyEnvironment;

View File

@ -8,6 +8,23 @@ import {
import { fromChromeEvent } from "../../browser/from-chrome-event";
export const serializationIndicator = "__json__";
export const objToStore = (obj: any) => {
if (obj == null) {
return null;
}
if (obj instanceof Set) {
obj = Array.from(obj);
}
return {
[serializationIndicator]: true,
value: JSON.stringify(obj),
};
};
export default abstract class AbstractChromeStorageService
implements AbstractStorageService, ObservableStorageService
{
@ -44,7 +61,11 @@ export default abstract class AbstractChromeStorageService
return new Promise((resolve) => {
this.chromeStorageApi.get(key, (obj: any) => {
if (obj != null && obj[key] != null) {
resolve(obj[key] as T);
let value = obj[key];
if (value[serializationIndicator] && typeof value.value === "string") {
value = JSON.parse(value.value);
}
resolve(value as T);
return;
}
resolve(null);
@ -57,14 +78,7 @@ export default abstract class AbstractChromeStorageService
}
async save(key: string, obj: any): Promise<void> {
if (obj == null) {
// Fix safari not liking null in set
return this.remove(key);
}
if (obj instanceof Set) {
obj = Array.from(obj);
}
obj = objToStore(obj);
const keyedObj = { [key]: obj };
return new Promise<void>((resolve) => {

View File

@ -1,19 +1,5 @@
import { StateService as BaseStateServiceAbstraction } from "@bitwarden/common/platform/abstractions/state.service";
import { StorageOptions } from "@bitwarden/common/platform/models/domain/storage-options";
import { Account } from "../../../models/account";
import { BrowserComponentState } from "../../../models/browserComponentState";
import { BrowserSendComponentState } from "../../../models/browserSendComponentState";
export abstract class BrowserStateService extends BaseStateServiceAbstraction<Account> {
getBrowserSendComponentState: (options?: StorageOptions) => Promise<BrowserSendComponentState>;
setBrowserSendComponentState: (
value: BrowserSendComponentState,
options?: StorageOptions,
) => Promise<void>;
getBrowserSendTypeComponentState: (options?: StorageOptions) => Promise<BrowserComponentState>;
setBrowserSendTypeComponentState: (
value: BrowserComponentState,
options?: StorageOptions,
) => Promise<void>;
}
export abstract class BrowserStateService extends BaseStateServiceAbstraction<Account> {}

View File

@ -0,0 +1,99 @@
import AbstractChromeStorageService, {
objToStore,
serializationIndicator,
} from "./abstract-chrome-storage-api.service";
class TestChromeStorageApiService extends AbstractChromeStorageService {}
describe("objectToStore", () => {
it("converts an object to a tagged string", () => {
const obj = { key: "value" };
const result = objToStore(obj);
expect(result).toEqual({
[serializationIndicator]: true,
value: JSON.stringify(obj),
});
});
it("converts a set to an array prior to serialization", () => {
const obj = new Set(["value"]);
const result = objToStore(obj);
expect(result).toEqual({
[serializationIndicator]: true,
value: JSON.stringify(Array.from(obj)),
});
});
it("does nothing to null", () => {
expect(objToStore(null)).toEqual(null);
});
});
describe("ChromeStorageApiService", () => {
let service: TestChromeStorageApiService;
let store: Record<any, any>;
beforeEach(() => {
store = {};
service = new TestChromeStorageApiService(chrome.storage.local);
});
describe("save", () => {
let setMock: jest.Mock;
beforeEach(() => {
// setup save
setMock = chrome.storage.local.set as jest.Mock;
setMock.mockImplementation((data, callback) => {
Object.assign(store, data);
callback();
});
});
it("uses `objToStore` to prepare a value for set", async () => {
const key = "key";
const value = { key: "value" };
await service.save(key, value);
expect(setMock).toHaveBeenCalledWith(
{
[key]: objToStore(value),
},
expect.any(Function),
);
});
});
describe("get", () => {
let getMock: jest.Mock;
beforeEach(() => {
// setup get
getMock = chrome.storage.local.get as jest.Mock;
getMock.mockImplementation((key, callback) => {
callback({ [key]: store[key] });
});
});
it("returns a stored value when it is serialized", async () => {
const key = "key";
const value = { key: "value" };
store[key] = objToStore(value);
const result = await service.get(key);
expect(result).toEqual(value);
});
it("returns a stored value when it is not serialized", async () => {
const key = "key";
const value = "value";
store[key] = value;
const result = await service.get(key);
expect(result).toEqual(value);
});
it("returns null when the key does not exist", async () => {
const result = await service.get("key");
expect(result).toBeNull();
});
});
});

View File

@ -1,4 +1,5 @@
import { mock, MockProxy } from "jest-mock-extended";
import { firstValueFrom } from "rxjs";
import { TokenService } from "@bitwarden/common/auth/abstractions/token.service";
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
@ -12,15 +13,11 @@ import { GlobalState } from "@bitwarden/common/platform/models/domain/global-sta
import { State } from "@bitwarden/common/platform/models/domain/state";
import { MigrationRunner } from "@bitwarden/common/platform/services/migration-runner";
import { mockAccountServiceWith } from "@bitwarden/common/spec";
import { SendType } from "@bitwarden/common/tools/send/enums/send-type";
import { SendView } from "@bitwarden/common/tools/send/models/view/send.view";
import { UserId } from "@bitwarden/common/types/guid";
import { Account } from "../../models/account";
import { BrowserComponentState } from "../../models/browserComponentState";
import { BrowserSendComponentState } from "../../models/browserSendComponentState";
import { BrowserStateService } from "./browser-state.service";
import { DefaultBrowserStateService } from "./default-browser-state.service";
// disable session syncing to just test class
jest.mock("../decorators/session-sync-observable/");
@ -39,7 +36,7 @@ describe("Browser State Service", () => {
const userId = "userId" as UserId;
const accountService = mockAccountServiceWith(userId);
let sut: BrowserStateService;
let sut: DefaultBrowserStateService;
beforeEach(() => {
secureStorageService = mock();
@ -71,7 +68,7 @@ describe("Browser State Service", () => {
const stateGetter = (key: string) => Promise.resolve(state);
memoryStorageService.get.mockImplementation(stateGetter);
sut = new BrowserStateService(
sut = new DefaultBrowserStateService(
diskStorageService,
secureStorageService,
memoryStorageService,
@ -85,32 +82,17 @@ describe("Browser State Service", () => {
);
});
describe("getBrowserSendComponentState", () => {
it("should return a BrowserSendComponentState", async () => {
const sendState = new BrowserSendComponentState();
sendState.sends = [new SendView(), new SendView()];
sendState.typeCounts = new Map<SendType, number>([
[SendType.File, 3],
[SendType.Text, 5],
]);
state.accounts[userId].send = sendState;
(global as any)["watch"] = state;
describe("add Account", () => {
it("should add account", async () => {
const newUserId = "newUserId" as UserId;
const newAcct = new Account({
profile: { userId: newUserId },
});
const actual = await sut.getBrowserSendComponentState();
expect(actual).toBeInstanceOf(BrowserSendComponentState);
expect(actual).toMatchObject(sendState);
});
});
await sut.addAccount(newAcct);
describe("getBrowserSendTypeComponentState", () => {
it("should return a BrowserComponentState", async () => {
const componentState = new BrowserComponentState();
componentState.scrollY = 0;
componentState.searchText = "test";
state.accounts[userId].sendType = componentState;
const actual = await sut.getBrowserSendTypeComponentState();
expect(actual).toStrictEqual(componentState);
const accts = await firstValueFrom(sut.accounts$);
expect(accts[newUserId]).toBeDefined();
});
});
});

View File

@ -15,17 +15,15 @@ import { MigrationRunner } from "@bitwarden/common/platform/services/migration-r
import { StateService as BaseStateService } from "@bitwarden/common/platform/services/state.service";
import { Account } from "../../models/account";
import { BrowserComponentState } from "../../models/browserComponentState";
import { BrowserSendComponentState } from "../../models/browserSendComponentState";
import { BrowserApi } from "../browser/browser-api";
import { browserSession, sessionSync } from "../decorators/session-sync-observable";
import { BrowserStateService as StateServiceAbstraction } from "./abstractions/browser-state.service";
import { BrowserStateService } from "./abstractions/browser-state.service";
@browserSession
export class BrowserStateService
export class DefaultBrowserStateService
extends BaseStateService<GlobalState, Account>
implements StateServiceAbstraction
implements BrowserStateService
{
@sessionSync({
initializer: Account.fromJSON as any, // TODO: Remove this any when all any types are removed from Account
@ -115,46 +113,6 @@ export class BrowserStateService
);
}
async getBrowserSendComponentState(options?: StorageOptions): Promise<BrowserSendComponentState> {
return (
await this.getAccount(this.reconcileOptions(options, await this.defaultInMemoryOptions()))
)?.send;
}
async setBrowserSendComponentState(
value: BrowserSendComponentState,
options?: StorageOptions,
): Promise<void> {
const account = await this.getAccount(
this.reconcileOptions(options, await this.defaultInMemoryOptions()),
);
account.send = value;
await this.saveAccount(
account,
this.reconcileOptions(options, await this.defaultInMemoryOptions()),
);
}
async getBrowserSendTypeComponentState(options?: StorageOptions): Promise<BrowserComponentState> {
return (
await this.getAccount(this.reconcileOptions(options, await this.defaultInMemoryOptions()))
)?.sendType;
}
async setBrowserSendTypeComponentState(
value: BrowserComponentState,
options?: StorageOptions,
): Promise<void> {
const account = await this.getAccount(
this.reconcileOptions(options, await this.defaultInMemoryOptions()),
);
account.sendType = value;
await this.saveAccount(
account,
this.reconcileOptions(options, await this.defaultInMemoryOptions()),
);
}
// Overriding the base class to prevent deleting the cache on save. We register a storage listener
// to delete the cache in the constructor above.
protected override async saveAccountToDisk(

View File

@ -12,6 +12,7 @@ import { BrowserApi } from "../platform/browser/browser-api";
import { ZonedMessageListenerService } from "../platform/browser/zoned-message-listener.service";
import { BrowserStateService } from "../platform/services/abstractions/browser-state.service";
import { ForegroundPlatformUtilsService } from "../platform/services/platform-utils/foreground-platform-utils.service";
import { BrowserSendStateService } from "../tools/popup/services/browser-send-state.service";
import { VaultBrowserStateService } from "../vault/services/vault-browser-state.service";
import { routerTransition } from "./app-routing.animations";
@ -38,6 +39,7 @@ export class AppComponent implements OnInit, OnDestroy {
private i18nService: I18nService,
private router: Router,
private stateService: BrowserStateService,
private browserSendStateService: BrowserSendStateService,
private vaultBrowserStateService: VaultBrowserStateService,
private changeDetectorRef: ChangeDetectorRef,
private ngZone: NgZone,
@ -231,8 +233,8 @@ export class AppComponent implements OnInit, OnDestroy {
await Promise.all([
this.vaultBrowserStateService.setBrowserGroupingsComponentState(null),
this.vaultBrowserStateService.setBrowserVaultItemsComponentState(null),
this.stateService.setBrowserSendComponentState(null),
this.stateService.setBrowserSendTypeComponentState(null),
this.browserSendStateService.setBrowserSendComponentState(null),
this.browserSendStateService.setBrowserSendTypeComponentState(null),
]);
}
}

View File

@ -99,11 +99,12 @@ import { BrowserEnvironmentService } from "../../platform/services/browser-envir
import BrowserLocalStorageService from "../../platform/services/browser-local-storage.service";
import BrowserMessagingPrivateModePopupService from "../../platform/services/browser-messaging-private-mode-popup.service";
import BrowserMessagingService from "../../platform/services/browser-messaging.service";
import { BrowserStateService } from "../../platform/services/browser-state.service";
import { DefaultBrowserStateService } from "../../platform/services/default-browser-state.service";
import I18nService from "../../platform/services/i18n.service";
import { ForegroundPlatformUtilsService } from "../../platform/services/platform-utils/foreground-platform-utils.service";
import { ForegroundDerivedStateProvider } from "../../platform/state/foreground-derived-state.provider";
import { ForegroundMemoryStorageService } from "../../platform/storage/foreground-memory-storage.service";
import { BrowserSendStateService } from "../../tools/popup/services/browser-send-state.service";
import { FilePopoutUtilsService } from "../../tools/popup/services/file-popout-utils.service";
import { VaultBrowserStateService } from "../../vault/services/vault-browser-state.service";
import { VaultFilterService } from "../../vault/services/vault-filter.service";
@ -412,7 +413,7 @@ const safeProviders: SafeProvider[] = [
tokenService: TokenService,
migrationRunner: MigrationRunner,
) => {
return new BrowserStateService(
return new DefaultBrowserStateService(
storageService,
secureStorageService,
memoryStorageService,
@ -487,6 +488,11 @@ const safeProviders: SafeProvider[] = [
useClass: UserNotificationSettingsService,
deps: [StateProvider],
}),
safeProvider({
provide: BrowserSendStateService,
useClass: BrowserSendStateService,
deps: [StateProvider],
}),
];
@NgModule({

View File

@ -18,7 +18,7 @@ import { DialogService } from "@bitwarden/components";
import { BrowserSendComponentState } from "../../../models/browserSendComponentState";
import BrowserPopupUtils from "../../../platform/popup/browser-popup-utils";
import { BrowserStateService } from "../../../platform/services/abstractions/browser-state.service";
import { BrowserSendStateService } from "../services/browser-send-state.service";
const ComponentId = "SendComponent";
@ -43,7 +43,7 @@ export class SendGroupingsComponent extends BaseSendComponent {
ngZone: NgZone,
policyService: PolicyService,
searchService: SearchService,
private stateService: BrowserStateService,
private stateService: BrowserSendStateService,
private router: Router,
private syncService: SyncService,
private changeDetectorRef: ChangeDetectorRef,

View File

@ -19,7 +19,7 @@ import { DialogService } from "@bitwarden/components";
import { BrowserComponentState } from "../../../models/browserComponentState";
import BrowserPopupUtils from "../../../platform/popup/browser-popup-utils";
import { BrowserStateService } from "../../../platform/services/abstractions/browser-state.service";
import { BrowserSendStateService } from "../services/browser-send-state.service";
const ComponentId = "SendTypeComponent";
@ -42,7 +42,7 @@ export class SendTypeComponent extends BaseSendComponent {
ngZone: NgZone,
policyService: PolicyService,
searchService: SearchService,
private stateService: BrowserStateService,
private stateService: BrowserSendStateService,
private route: ActivatedRoute,
private location: Location,
private changeDetectorRef: ChangeDetectorRef,

View File

@ -0,0 +1,61 @@
import {
FakeAccountService,
mockAccountServiceWith,
} from "@bitwarden/common/../spec/fake-account-service";
import { FakeStateProvider } from "@bitwarden/common/../spec/fake-state-provider";
import { awaitAsync } from "@bitwarden/common/../spec/utils";
import { Utils } from "@bitwarden/common/platform/misc/utils";
import { SendType } from "@bitwarden/common/tools/send/enums/send-type";
import { UserId } from "@bitwarden/common/types/guid";
import { BrowserComponentState } from "../../../models/browserComponentState";
import { BrowserSendComponentState } from "../../../models/browserSendComponentState";
import { BrowserSendStateService } from "./browser-send-state.service";
describe("Browser Send State Service", () => {
let stateProvider: FakeStateProvider;
let accountService: FakeAccountService;
let stateService: BrowserSendStateService;
const mockUserId = Utils.newGuid() as UserId;
beforeEach(() => {
accountService = mockAccountServiceWith(mockUserId);
stateProvider = new FakeStateProvider(accountService);
stateService = new BrowserSendStateService(stateProvider);
});
describe("getBrowserSendComponentState", () => {
it("should return BrowserSendComponentState", async () => {
const state = new BrowserSendComponentState();
state.scrollY = 0;
state.searchText = "test";
state.typeCounts = new Map<SendType, number>().set(SendType.File, 1);
await stateService.setBrowserSendComponentState(state);
await awaitAsync();
const actual = await stateService.getBrowserSendComponentState();
expect(actual).toStrictEqual(state);
});
});
describe("getBrowserSendTypeComponentState", () => {
it("should return BrowserComponentState", async () => {
const state = new BrowserComponentState();
state.scrollY = 0;
state.searchText = "test";
await stateService.setBrowserSendTypeComponentState(state);
await awaitAsync();
const actual = await stateService.getBrowserSendTypeComponentState();
expect(actual).toStrictEqual(state);
});
});
});

View File

@ -0,0 +1,65 @@
import { Observable, firstValueFrom } from "rxjs";
import { ActiveUserState, StateProvider } from "@bitwarden/common/platform/state";
import { BrowserComponentState } from "../../../models/browserComponentState";
import { BrowserSendComponentState } from "../../../models/browserSendComponentState";
import { BROWSER_SEND_COMPONENT, BROWSER_SEND_TYPE_COMPONENT } from "./key-definitions";
/** Get or set the active user's component state for the Send browser component
*/
export class BrowserSendStateService {
/** Observable that contains the current state for active user Sends including the send data and type counts
* along with the search text and scroll position
*/
browserSendComponentState$: Observable<BrowserSendComponentState>;
/** Observable that contains the current state for active user Sends that only includes the search text
* and scroll position
*/
browserSendTypeComponentState$: Observable<BrowserComponentState>;
private activeUserBrowserSendComponentState: ActiveUserState<BrowserSendComponentState>;
private activeUserBrowserSendTypeComponentState: ActiveUserState<BrowserComponentState>;
constructor(protected stateProvider: StateProvider) {
this.activeUserBrowserSendComponentState = this.stateProvider.getActive(BROWSER_SEND_COMPONENT);
this.browserSendComponentState$ = this.activeUserBrowserSendComponentState.state$;
this.activeUserBrowserSendTypeComponentState = this.stateProvider.getActive(
BROWSER_SEND_TYPE_COMPONENT,
);
this.browserSendTypeComponentState$ = this.activeUserBrowserSendTypeComponentState.state$;
}
/** Get the active user's browser send component state
* @returns { BrowserSendComponentState } contains the sends and type counts along with the scroll position and search text for the
* send component on the browser
*/
async getBrowserSendComponentState(): Promise<BrowserSendComponentState> {
return await firstValueFrom(this.browserSendComponentState$);
}
/** Set the active user's browser send component state
* @param { BrowserSendComponentState } value sets the sends and type counts along with the scroll position and search text for
* the send component on the browser
*/
async setBrowserSendComponentState(value: BrowserSendComponentState): Promise<void> {
await this.activeUserBrowserSendComponentState.update(() => value);
}
/** Get the active user's browser component state
* @returns { BrowserComponentState } contains the scroll position and search text for the sends menu on the browser
*/
async getBrowserSendTypeComponentState(): Promise<BrowserComponentState> {
return await firstValueFrom(this.browserSendTypeComponentState$);
}
/** Set the active user's browser component state
* @param { BrowserComponentState } value set the scroll position and search text for the send component on the browser
*/
async setBrowserSendTypeComponentState(value: BrowserComponentState): Promise<void> {
await this.activeUserBrowserSendTypeComponentState.update(() => value);
}
}

View File

@ -0,0 +1,40 @@
import { Jsonify } from "type-fest";
import { SendType } from "@bitwarden/common/tools/send/enums/send-type";
import { BrowserSendComponentState } from "../../../models/browserSendComponentState";
import { BROWSER_SEND_COMPONENT, BROWSER_SEND_TYPE_COMPONENT } from "./key-definitions";
describe("Key definitions", () => {
describe("BROWSER_SEND_COMPONENT", () => {
it("should deserialize BrowserSendComponentState", () => {
const keyDef = BROWSER_SEND_COMPONENT;
const expectedState = {
typeCounts: new Map<SendType, number>(),
};
const result = keyDef.deserializer(
JSON.parse(JSON.stringify(expectedState)) as Jsonify<BrowserSendComponentState>,
);
expect(result).toEqual(expectedState);
});
});
describe("BROWSER_SEND_TYPE_COMPONENT", () => {
it("should deserialize BrowserComponentState", () => {
const keyDef = BROWSER_SEND_TYPE_COMPONENT;
const expectedState = {
scrollY: 0,
searchText: "test",
};
const result = keyDef.deserializer(JSON.parse(JSON.stringify(expectedState)));
expect(result).toEqual(expectedState);
});
});
});

View File

@ -0,0 +1,23 @@
import { Jsonify } from "type-fest";
import { BROWSER_SEND_MEMORY, KeyDefinition } from "@bitwarden/common/platform/state";
import { BrowserComponentState } from "../../../models/browserComponentState";
import { BrowserSendComponentState } from "../../../models/browserSendComponentState";
export const BROWSER_SEND_COMPONENT = new KeyDefinition<BrowserSendComponentState>(
BROWSER_SEND_MEMORY,
"browser_send_component",
{
deserializer: (obj: Jsonify<BrowserSendComponentState>) =>
BrowserSendComponentState.fromJSON(obj),
},
);
export const BROWSER_SEND_TYPE_COMPONENT = new KeyDefinition<BrowserComponentState>(
BROWSER_SEND_MEMORY,
"browser_send_type_component",
{
deserializer: (obj: Jsonify<BrowserComponentState>) => BrowserComponentState.fromJSON(obj),
},
);

View File

@ -7,11 +7,11 @@ import {
} from "@bitwarden/common/platform/misc/flags";
// required to avoid linting errors when there are no flags
/* eslint-disable-next-line @typescript-eslint/ban-types */
// eslint-disable-next-line @typescript-eslint/ban-types
export type Flags = {} & SharedFlags;
// required to avoid linting errors when there are no flags
/* eslint-disable-next-line @typescript-eslint/ban-types */
// eslint-disable-next-line @typescript-eslint/ban-types
export type DevFlags = {} & SharedDevFlags;
export function flagEnabled(flag: keyof Flags): boolean {

View File

@ -1,7 +1,6 @@
{
"devFlags": {},
"flags": {
"showDDGSetting": true,
"enableCipherKeyEncryption": false
}
}

View File

@ -1,6 +1,5 @@
{
"flags": {
"showDDGSetting": true,
"enableCipherKeyEncryption": false
}
}

View File

@ -1237,18 +1237,18 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.51"
version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f11c217e1416d6f036b870f14e0413d480dbf28edbee1f877abaf0206af43bb7"
checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.51"
version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df"
checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7"
dependencies = [
"proc-macro2",
"quote",

View File

@ -24,7 +24,7 @@ rand = "=0.8.5"
retry = "=2.0.0"
scopeguard = "=1.2.0"
sha2 = "=0.10.8"
thiserror = "=1.0.51"
thiserror = "=1.0.58"
typenum = "=1.17.0"
[build-dependencies]

View File

@ -24,7 +24,6 @@ import { DialogService } from "@bitwarden/components";
import { SetPinComponent } from "../../auth/components/set-pin.component";
import { DesktopAutofillSettingsService } from "../../autofill/services/desktop-autofill-settings.service";
import { flagEnabled } from "../../platform/flags";
import { DesktopSettingsService } from "../../platform/services/desktop-settings.service";
@Component({
@ -146,7 +145,7 @@ export class SettingsComponent implements OnInit {
this.startToTrayDescText = this.i18nService.t(startToTrayKey + "Desc");
// DuckDuckGo browser is only for macos initially
this.showDuckDuckGoIntegrationOption = flagEnabled("showDDGSetting") && isMac;
this.showDuckDuckGoIntegrationOption = isMac;
this.vaultTimeoutOptions = [
// { name: i18nService.t('immediately'), value: 0 },

View File

@ -494,7 +494,7 @@
"message": "Kansio poistettiin"
},
"loginOrCreateNewAccount": {
"message": "Käytä salattua holviasi kirjautumalla sisään tai tai luo uusi tili."
"message": "Käytä salattua holviasi kirjautumalla sisään tai luo uusi tili."
},
"createAccount": {
"message": "Luo tili"
@ -2689,7 +2689,7 @@
"description": "Label indicating the most common import formats"
},
"troubleshooting": {
"message": "Vianmääritys"
"message": "Vianselvitys"
},
"disableHardwareAccelerationRestart": {
"message": "Poista laitteistokiihdytys käytöstä ja käynnistä sovellus uudelleen"

View File

@ -404,7 +404,7 @@
"message": "長度"
},
"passwordMinLength": {
"message": "Minimum password length"
"message": "最小密碼長度"
},
"uppercase": {
"message": "大寫 (A-Z)"
@ -561,10 +561,10 @@
"message": "帳戶已建立!現在可以登入了。"
},
"youSuccessfullyLoggedIn": {
"message": "You successfully logged in"
"message": "你已成功登入"
},
"youMayCloseThisWindow": {
"message": "You may close this window"
"message": "你可以關閉此視窗"
},
"masterPassSent": {
"message": "已寄出包含您主密碼提示的電子郵件。"
@ -1546,15 +1546,15 @@
"message": "設定主密碼"
},
"orgPermissionsUpdatedMustSetPassword": {
"message": "Your organization permissions were updated, requiring you to set a master password.",
"message": "你的組織權限已更新,要求你設定一個主密碼。",
"description": "Used as a card title description on the set password page to explain why the user is there"
},
"orgRequiresYouToSetPassword": {
"message": "Your organization requires you to set a master password.",
"message": "你的組織要求你設定一個主密碼。",
"description": "Used as a card title description on the set password page to explain why the user is there"
},
"verificationRequired": {
"message": "Verification required",
"message": "需要驗證",
"description": "Default title for the user verification dialog."
},
"currentMasterPass": {
@ -1645,10 +1645,10 @@
"message": "在您的桌面和瀏覽器閒建立連綫時,透過要求指紋短語確認,以添加一個額外的安全層。每次建立連綫都需要使用者干預和驗證。"
},
"enableHardwareAcceleration": {
"message": "Use hardware acceleration"
"message": "使用硬體加速"
},
"enableHardwareAccelerationDesc": {
"message": "By default this setting is ON. Turn OFF only if you experience graphical issues. Restart is required."
"message": "此設定預設為開啟。僅當你遇到圖形問題時才關閉。需要重新啟動。"
},
"approve": {
"message": "核准"
@ -1889,40 +1889,40 @@
"message": "您的主密碼不符合一個或多個組織原則要求。您必須立即更新您的主密碼才能存取密碼庫。進行此動作將登出您目前的工作階段,需要您重新登入。其他裝置上的工作階段可能繼續長達一小時。"
},
"tryAgain": {
"message": "Try again"
"message": "再試一次"
},
"verificationRequiredForActionSetPinToContinue": {
"message": "Verification required for this action. Set a PIN to continue."
"message": "此操作需要驗證。設定 PIN 碼以繼續。"
},
"setPin": {
"message": "Set PIN"
"message": "設定 PIN 碼"
},
"verifyWithBiometrics": {
"message": "Verify with biometrics"
"message": "使用生物辨識進行驗證"
},
"awaitingConfirmation": {
"message": "Awaiting confirmation"
"message": "正在等待確認"
},
"couldNotCompleteBiometrics": {
"message": "Could not complete biometrics."
"message": "無法完成生物辨識。"
},
"needADifferentMethod": {
"message": "Need a different method?"
"message": "需要不同的方法嗎?"
},
"useMasterPassword": {
"message": "Use master password"
"message": "使用主密碼"
},
"usePin": {
"message": "Use PIN"
"message": "使用 PIN 碼"
},
"useBiometrics": {
"message": "Use biometrics"
"message": "使用生物辨識"
},
"enterVerificationCodeSentToEmail": {
"message": "Enter the verification code that was sent to your email."
},
"resendCode": {
"message": "Resend code"
"message": "重新傳送驗證碼"
},
"hours": {
"message": "小時"
@ -2465,7 +2465,7 @@
"message": "全部清除"
},
"plusNMore": {
"message": "+ $QUANTITY$ more",
"message": "+ $QUANTITY$ 個更多",
"placeholders": {
"quantity": {
"content": "$1",
@ -2477,7 +2477,7 @@
"message": "子選單"
},
"skipToContent": {
"message": "Skip to content"
"message": "跳至內容"
},
"typePasskey": {
"message": "密碼金鑰"
@ -2621,13 +2621,13 @@
"message": "使用者名稱或密碼不正確"
},
"incorrectPassword": {
"message": "Incorrect password"
"message": "密碼不正確"
},
"incorrectCode": {
"message": "Incorrect code"
"message": "驗證碼不正確"
},
"incorrectPin": {
"message": "Incorrect PIN"
"message": "PIN 碼不正確"
},
"multifactorAuthenticationFailed": {
"message": "多因素驗證失敗"
@ -2685,22 +2685,22 @@
"message": "將與您的 LastPass 帳戶關聯的 YubiKey 插入電腦的 USB 連接埠,然後觸摸其按鈕。"
},
"commonImportFormats": {
"message": "Common formats",
"message": "常見格式",
"description": "Label indicating the most common import formats"
},
"troubleshooting": {
"message": "Troubleshooting"
"message": "疑難排解"
},
"disableHardwareAccelerationRestart": {
"message": "Disable hardware acceleration and restart"
"message": "停用硬體加速並重新啟動"
},
"enableHardwareAccelerationRestart": {
"message": "Enable hardware acceleration and restart"
"message": "啟用硬體加速並重新啟動"
},
"removePasskey": {
"message": "Remove passkey"
"message": "移除金鑰"
},
"passkeyRemoved": {
"message": "Passkey removed"
"message": "金鑰已移除"
}
}

View File

@ -7,13 +7,11 @@ import {
} from "@bitwarden/common/platform/misc/flags";
// required to avoid linting errors when there are no flags
/* eslint-disable-next-line @typescript-eslint/ban-types */
export type Flags = {
showDDGSetting?: boolean;
} & SharedFlags;
// eslint-disable-next-line @typescript-eslint/ban-types
export type Flags = {} & SharedFlags;
// required to avoid linting errors when there are no flags
/* eslint-disable-next-line @typescript-eslint/ban-types */
// eslint-disable-next-line @typescript-eslint/ban-types
export type DevFlags = {} & SharedDevFlags;
export function flagEnabled(flag: keyof Flags): boolean {

View File

@ -11,7 +11,6 @@
"allowedHosts": "auto"
},
"flags": {
"secretsManager": false,
"showPasswordless": false,
"enableCipherKeyEncryption": false
}

View File

@ -17,7 +17,6 @@
"proxyNotifications": "https://notifications.bitwarden.com"
},
"flags": {
"secretsManager": true,
"showPasswordless": true,
"enableCipherKeyEncryption": false
}

View File

@ -20,7 +20,6 @@
}
],
"flags": {
"secretsManager": true,
"showPasswordless": true,
"enableCipherKeyEncryption": false
},

View File

@ -11,7 +11,6 @@
"buttonAction": "https://www.paypal.com/cgi-bin/webscr"
},
"flags": {
"secretsManager": true,
"showPasswordless": true,
"enableCipherKeyEncryption": false
}

View File

@ -21,7 +21,6 @@
}
],
"flags": {
"secretsManager": true,
"showPasswordless": true
}
}

View File

@ -27,7 +27,6 @@
}
],
"flags": {
"secretsManager": true,
"showPasswordless": true,
"enableCipherKeyEncryption": false
}

View File

@ -7,7 +7,6 @@
"port": 8081
},
"flags": {
"secretsManager": true,
"showPasswordless": true,
"enableCipherKeyEncryption": false
}

View File

@ -5,7 +5,6 @@
"scim": "https://scim.usdev.bitwarden.pw"
},
"flags": {
"secretsManager": true,
"showPasswordless": true
}
}

View File

@ -1,6 +1,6 @@
{
"name": "@bitwarden/web-vault",
"version": "2024.3.1",
"version": "2024.4.0",
"scripts": {
"build:oss": "webpack",
"build:bit": "webpack -c ../../bitwarden_license/bit-web/webpack.config.js",
@ -8,7 +8,7 @@
"build:bit:watch": "webpack serve -c ../../bitwarden_license/bit-web/webpack.config.js",
"build:bit:dev": "cross-env ENV=development npm run build:bit",
"build:bit:dev:analyze": "cross-env LOGGING=false webpack -c ../../bitwarden_license/bit-web/webpack.config.js --profile --json > stats.json && npx webpack-bundle-analyzer stats.json build/",
"build:bit:dev:watch": "cross-env ENV=development npm run build:bit:watch",
"build:bit:dev:watch": "cross-env ENV=development NODE_OPTIONS=\"--max-old-space-size=8192\" npm run build:bit:watch",
"build:bit:qa": "cross-env NODE_ENV=production ENV=qa npm run build:bit",
"build:bit:euprd": "cross-env NODE_ENV=production ENV=euprd npm run build:bit",
"build:bit:euqa": "cross-env NODE_ENV=production ENV=euqa npm run build:bit",

View File

@ -52,7 +52,6 @@ import { Collection } from "@bitwarden/common/vault/models/domain/collection";
import { CollectionDetailsResponse } from "@bitwarden/common/vault/models/response/collection.response";
import { DialogService, SimpleDialogOptions } from "@bitwarden/components";
import { flagEnabled } from "../../../../utils/flags";
import { openEntityEventsDialog } from "../../../admin-console/organizations/manage/entity-events.component";
import { BasePeopleComponent } from "../../common/base.people.component";
import { GroupService } from "../core";
@ -148,9 +147,7 @@ export class PeopleComponent
shareReplay({ refCount: true, bufferSize: 1 }),
);
this.canUseSecretsManager$ = organization$.pipe(
map((org) => org.useSecretsManager && flagEnabled("secretsManager")),
);
this.canUseSecretsManager$ = organization$.pipe(map((org) => org.useSecretsManager));
const policies$ = organization$.pipe(
switchMap((organization) => {

View File

@ -22,7 +22,7 @@
</select>
</bit-form-field>
<bit-form-field class="tw-grow">
<bit-form-field class="tw-grow" *ngIf="!disabled">
<bit-label>{{ selectorLabelText }}</bit-label>
<bit-multi-select
class="tw-w-full"
@ -120,7 +120,7 @@
</div>
<div
*ngIf="item.readonly"
*ngIf="item.readonly || disabled"
class="tw-max-w-40 tw-overflow-hidden tw-overflow-ellipsis tw-whitespace-nowrap tw-font-bold tw-text-muted"
[title]="permissionLabelId(item.readonlyPermission) | i18n"
>
@ -139,7 +139,7 @@
<td bitCell class="tw-text-right">
<button
*ngIf="!item.readonly"
*ngIf="!disabled && !item.readonly"
type="button"
bitIconButton="bwi-close"
buttonType="muted"

View File

@ -121,6 +121,13 @@ export class AccessSelectorComponent implements ControlValueAccessor, OnInit, On
protected permissionList: Permission[];
protected initialPermission = CollectionPermission.View;
/**
* When disabled, the access selector will make the assumption that a readonly state is desired.
* The PermissionMode will be set to Readonly
* The Multi-Select control will be hidden
* The delete action on each row item will be hidden
* The readonly permission label/property needs to configured on the access item views being passed into the component
*/
disabled: boolean;
/**
@ -225,6 +232,7 @@ export class AccessSelectorComponent implements ControlValueAccessor, OnInit, On
// Keep the internal FormGroup in sync
if (this.disabled) {
this.permissionMode = PermissionMode.Readonly;
this.formGroup.disable();
} else {
this.formGroup.enable();

View File

@ -47,7 +47,11 @@ interface OnSuccessArgs {
organizationId: string;
}
const Allowed2020PlanTypes = [
const AllowedLegacyPlanTypes = [
PlanType.TeamsMonthly2023,
PlanType.TeamsAnnually2023,
PlanType.EnterpriseAnnually2023,
PlanType.EnterpriseMonthly2023,
PlanType.TeamsMonthly2020,
PlanType.TeamsAnnually2020,
PlanType.EnterpriseAnnually2020,
@ -278,7 +282,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
(!this.currentPlan || this.currentPlan.upgradeSortOrder < plan.upgradeSortOrder) &&
(!this.hasProvider || plan.product !== ProductType.TeamsStarter) &&
((!this.isProviderQualifiedFor2020Plan() && this.planIsEnabled(plan)) ||
(this.isProviderQualifiedFor2020Plan() && Allowed2020PlanTypes.includes(plan.type))),
(this.isProviderQualifiedFor2020Plan() && AllowedLegacyPlanTypes.includes(plan.type))),
);
result.sort((planA, planB) => planA.displaySortOrder - planB.displaySortOrder);
@ -293,7 +297,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
(plan) =>
plan.product === selectedProductType &&
((!this.isProviderQualifiedFor2020Plan() && this.planIsEnabled(plan)) ||
(this.isProviderQualifiedFor2020Plan() && Allowed2020PlanTypes.includes(plan.type))),
(this.isProviderQualifiedFor2020Plan() && AllowedLegacyPlanTypes.includes(plan.type))),
) || [];
result.sort((planA, planB) => planA.displaySortOrder - planB.displaySortOrder);

View File

@ -241,6 +241,8 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
return (
this.sub.planType === PlanType.EnterpriseAnnually ||
this.sub.planType === PlanType.EnterpriseMonthly ||
this.sub.planType === PlanType.EnterpriseAnnually2023 ||
this.sub.planType === PlanType.EnterpriseMonthly2023 ||
this.sub.planType === PlanType.EnterpriseAnnually2020 ||
this.sub.planType === PlanType.EnterpriseMonthly2020 ||
this.sub.planType === PlanType.EnterpriseAnnually2019 ||
@ -254,6 +256,7 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
} else if (
this.sub.planType === PlanType.FamiliesAnnually ||
this.sub.planType === PlanType.FamiliesAnnually2019 ||
this.sub.planType === PlanType.TeamsStarter2023 ||
this.sub.planType === PlanType.TeamsStarter
) {
if (this.isSponsoredSubscription) {

View File

@ -1,10 +1,8 @@
<ng-template [ngIf]="isEnabled">
<button
type="button"
bitIconButton="bwi bwi-fw bwi-filter"
[bitMenuTriggerFor]="content?.menu"
[buttonType]="buttonType"
[attr.aria-label]="'switchProducts' | i18n"
></button>
<product-switcher-content #content></product-switcher-content>
</ng-template>
<button
type="button"
bitIconButton="bwi bwi-fw bwi-filter"
[bitMenuTriggerFor]="content?.menu"
[buttonType]="buttonType"
[attr.aria-label]="'switchProducts' | i18n"
></button>
<product-switcher-content #content></product-switcher-content>

View File

@ -1,16 +1,11 @@
import { AfterViewInit, ChangeDetectorRef, Component, Input } from "@angular/core";
import { IconButtonType } from "@bitwarden/components/src/icon-button/icon-button.component";
import { flagEnabled } from "../../../utils/flags";
@Component({
selector: "product-switcher",
templateUrl: "./product-switcher.component.html",
})
export class ProductSwitcherComponent implements AfterViewInit {
protected isEnabled = flagEnabled("secretsManager");
/**
* Passed to the product switcher's `bitIconButton`
*/

View File

@ -65,17 +65,22 @@
</bit-tab>
<bit-tab label="{{ 'access' | i18n }}">
<div class="tw-mb-3" *ngIf="organization.flexibleCollections">
<span *ngIf="organization.useGroups">{{ "grantCollectionAccess" | i18n }}</span>
<span *ngIf="!organization.useGroups">{{
"grantCollectionAccessMembersOnly" | i18n
}}</span>
<span
*ngIf="
(flexibleCollectionsV1Enabled$ | async) &&
organization.allowAdminAccessToAllCollectionItems
"
>{{ " " + ("adminCollectionAccess" | i18n) }}</span
>
<ng-container *ngIf="dialogReadonly">
<span>{{ "readOnlyCollectionAccess" | i18n }}</span>
</ng-container>
<ng-container *ngIf="!dialogReadonly">
<span *ngIf="organization.useGroups">{{ "grantCollectionAccess" | i18n }}</span>
<span *ngIf="!organization.useGroups">{{
"grantCollectionAccessMembersOnly" | i18n
}}</span>
<span
*ngIf="
(flexibleCollectionsV1Enabled$ | async) &&
organization.allowAdminAccessToAllCollectionItems
"
>{{ " " + ("adminCollectionAccess" | i18n) }}</span
>
</ng-container>
</div>
<div
class="tw-mb-3 tw-text-danger"
@ -85,7 +90,7 @@
</div>
<bit-access-selector
*ngIf="organization.useGroups"
[permissionMode]="PermissionMode.Edit"
[permissionMode]="dialogReadonly ? PermissionMode.Readonly : PermissionMode.Edit"
formControlName="access"
[items]="accessItems"
[columnHeader]="'groupSlashMemberColumnHeader' | i18n"
@ -96,7 +101,7 @@
></bit-access-selector>
<bit-access-selector
*ngIf="!organization.useGroups"
[permissionMode]="PermissionMode.Edit"
[permissionMode]="dialogReadonly ? PermissionMode.Readonly : PermissionMode.Edit"
formControlName="access"
[items]="accessItems"
[columnHeader]="'memberColumnHeader' | i18n"
@ -108,7 +113,13 @@
</bit-tab-group>
</div>
<ng-container bitDialogFooter>
<button type="submit" bitButton bitFormButton buttonType="primary" [disabled]="loading">
<button
type="submit"
bitButton
bitFormButton
buttonType="primary"
[disabled]="loading || dialogReadonly"
>
{{ "save" | i18n }}
</button>
<button

View File

@ -16,6 +16,7 @@ import { first } from "rxjs/operators";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { OrganizationUserService } from "@bitwarden/common/admin-console/abstractions/organization-user/organization-user.service";
import { OrganizationUserUserDetailsResponse } from "@bitwarden/common/admin-console/abstractions/organization-user/responses/organization-user.response";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
@ -27,7 +28,11 @@ import { CollectionResponse } from "@bitwarden/common/vault/models/response/coll
import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view";
import { BitValidators, DialogService } from "@bitwarden/components";
import { GroupService, GroupView } from "../../../admin-console/organizations/core";
import {
GroupService,
GroupView,
CollectionAccessSelectionView,
} from "../../../admin-console/organizations/core";
import { PermissionMode } from "../../../admin-console/organizations/shared/components/access-selector/access-selector.component";
import {
AccessItemType,
@ -36,8 +41,6 @@ import {
CollectionPermission,
convertToPermission,
convertToSelectionView,
mapGroupToAccessItemView,
mapUserToAccessItemView,
} from "../../../admin-console/organizations/shared/components/access-selector/access-selector.models";
import { CollectionAdminService } from "../../core/collection-admin.service";
import { CollectionAdminView } from "../../core/views/collection-admin.view";
@ -54,6 +57,7 @@ export interface CollectionDialogParams {
parentCollectionId?: string;
showOrgSelector?: boolean;
collectionIds?: string[];
readonly?: boolean;
}
export interface CollectionDialogResult {
@ -158,7 +162,8 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
? from(this.collectionAdminService.get(orgId, this.params.collectionId))
: of(null),
groups: groups$,
users: this.organizationUserService.getAllUsers(orgId),
// Collection(s) needed to map readonlypermission for (potential) access selector disabled state
users: this.organizationUserService.getAllUsers(orgId, { includeCollections: true }),
collection: this.params.collectionId
? this.collectionService.get(this.params.collectionId)
: of(null),
@ -177,8 +182,8 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
}) => {
this.organization = organization;
this.accessItems = [].concat(
groups.map(mapGroupToAccessItemView),
users.data.map(mapUserToAccessItemView),
groups.map((group) => mapGroupToAccessItemView(group, this.collectionId)),
users.data.map((user) => mapUserToAccessItemView(user, this.collectionId)),
);
// Force change detection to update the access selector's items
@ -209,7 +214,7 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
access: accessSelections,
});
this.collection.manage = collection?.manage ?? false; // Get manage flag from sync data collection
this.showDeleteButton = this.collection.canDelete(organization);
this.showDeleteButton = !this.dialogReadonly && this.collection.canDelete(organization);
} else {
this.nestOptions = collections;
const parent = collections.find((c) => c.id === this.params.parentCollectionId);
@ -244,6 +249,8 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
}
this.formGroup.controls.access.updateValueAndValidity();
this.handleFormGroupReadonly(this.dialogReadonly);
this.loading = false;
},
);
@ -257,11 +264,20 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
return this.params.collectionId != undefined;
}
protected get dialogReadonly() {
return this.params.readonly === true;
}
protected async cancel() {
this.close(CollectionDialogAction.Canceled);
}
protected submit = async () => {
// Saving a collection is prohibited while in read only mode
if (this.dialogReadonly) {
return;
}
this.formGroup.markAllAsTouched();
if (this.formGroup.invalid) {
@ -316,6 +332,11 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
};
protected delete = async () => {
// Deleting a collection is prohibited while in read only mode
if (this.dialogReadonly) {
return;
}
const confirmed = await this.dialogService.openSimpleDialog({
title: this.collection?.name,
content: { key: "deleteCollectionConfirmation" },
@ -342,6 +363,20 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
this.destroy$.complete();
}
private handleFormGroupReadonly(readonly: boolean) {
if (readonly) {
this.formGroup.controls.name.disable();
this.formGroup.controls.externalId.disable();
this.formGroup.controls.parent.disable();
this.formGroup.controls.access.disable();
} else {
this.formGroup.controls.name.enable();
this.formGroup.controls.externalId.enable();
this.formGroup.controls.parent.enable();
this.formGroup.controls.access.enable();
}
}
private close(action: CollectionDialogAction, collection?: CollectionResponse | CollectionView) {
this.dialogRef.close({ action, collection } as CollectionDialogResult);
}
@ -383,6 +418,50 @@ function validateCanManagePermission(control: AbstractControl) {
return hasManagePermission ? null : { managePermissionRequired: true };
}
/**
*
* @param group Current group being used to translate object into AccessItemView
* @param collectionId Current collection being viewed/edited
* @returns AccessItemView customized to set a readonlyPermission to be displayed if the access selector is in a disabled state
*/
function mapGroupToAccessItemView(group: GroupView, collectionId: string): AccessItemView {
return {
id: group.id,
type: AccessItemType.Group,
listName: group.name,
labelName: group.name,
accessAllItems: group.accessAll,
readonly: group.accessAll,
readonlyPermission: convertToPermission(group.collections.find((gc) => gc.id == collectionId)),
};
}
/**
*
* @param user Current user being used to translate object into AccessItemView
* @param collectionId Current collection being viewed/edited
* @returns AccessItemView customized to set a readonlyPermission to be displayed if the access selector is in a disabled state
*/
function mapUserToAccessItemView(
user: OrganizationUserUserDetailsResponse,
collectionId: string,
): AccessItemView {
return {
id: user.id,
type: AccessItemType.Member,
email: user.email,
role: user.type,
listName: user.name?.length > 0 ? `${user.name} (${user.email})` : user.email,
labelName: user.name ?? user.email,
status: user.status,
accessAllItems: user.accessAll,
readonly: user.accessAll,
readonlyPermission: convertToPermission(
new CollectionAccessSelectionView(user.collections.find((uc) => uc.id == collectionId)),
),
};
}
/**
* Strongly typed helper to open a CollectionDialog
* @param dialogService Instance of the dialog service that will be used to open the dialog

View File

@ -1,4 +1,4 @@
import { Component, EventEmitter, Input, Output } from "@angular/core";
import { Component, EventEmitter, Output } from "@angular/core";
import { ButtonModule, NoItemsModule, svgIcon } from "@bitwarden/components";
@ -16,21 +16,18 @@ const icon = svgIcon`<svg xmlns="http://www.w3.org/2000/svg" width="120" height=
template: `<bit-no-items [icon]="icon" class="tw-mt-2 tw-block">
<span slot="title" class="tw-mt-4 tw-block">{{ "collectionAccessRestricted" | i18n }}</span>
<button
*ngIf="canEdit"
slot="button"
bitButton
(click)="editInfoClicked.emit()"
(click)="viewCollectionClicked.emit()"
buttonType="secondary"
type="button"
>
<i aria-hidden="true" class="bwi bwi-pencil-square"></i> {{ "editInfo" | i18n }}
<i aria-hidden="true" class="bwi bwi-pencil-square"></i> {{ "viewCollection" | i18n }}
</button>
</bit-no-items>`,
})
export class CollectionAccessRestrictedComponent {
protected icon = icon;
@Input() canEdit = false;
@Output() editInfoClicked = new EventEmitter<void>();
@Output() viewCollectionClicked = new EventEmitter<void>();
}

View File

@ -99,11 +99,9 @@
</bit-no-items>
<collection-access-restricted
*ngIf="showCollectionAccessRestricted"
[canEdit]="
selectedCollection != null &&
selectedCollection.node.canEdit(organization, flexibleCollectionsV1Enabled)
(viewCollectionClicked)="
editCollection(selectedCollection.node, CollectionDialogTabType.Info, true)
"
(editInfoClicked)="editCollection(selectedCollection.node, CollectionDialogTabType.Info)"
>
</collection-access-restricted>
</ng-container>

View File

@ -1058,9 +1058,18 @@ export class VaultComponent implements OnInit, OnDestroy {
}
}
async editCollection(c: CollectionView, tab: CollectionDialogTabType): Promise<void> {
async editCollection(
c: CollectionView,
tab: CollectionDialogTabType,
readonly: boolean = false,
): Promise<void> {
const dialog = openCollectionDialog(this.dialogService, {
data: { collectionId: c?.id, organizationId: this.organization?.id, initialTab: tab },
data: {
collectionId: c?.id,
organizationId: this.organization?.id,
initialTab: tab,
readonly: readonly,
},
});
const result = await lastValueFrom(dialog.closed);

View File

@ -7501,6 +7501,9 @@
"collectionAccessRestricted": {
"message": "Collection access is restricted"
},
"readOnlyCollectionAccess": {
"message": "You do not have access to manage this collection."
},
"grantCollectionAccess": {
"message": "Grant groups or members access to this collection."
},
@ -7603,6 +7606,9 @@
"providerPortal": {
"message": "Provider Portal"
},
"viewCollection": {
"message": "View collection"
},
"restrictedGroupAccess": {
"message": "You cannot add yourself to groups."
},

View File

@ -7,14 +7,13 @@ import {
} from "@bitwarden/common/platform/misc/flags";
// required to avoid linting errors when there are no flags
/* eslint-disable-next-line @typescript-eslint/ban-types */
// eslint-disable-next-line @typescript-eslint/ban-types
export type Flags = {
secretsManager?: boolean;
showPasswordless?: boolean;
} & SharedFlags;
// required to avoid linting errors when there are no flags
/* eslint-disable-next-line @typescript-eslint/ban-types */
// eslint-disable-next-line @typescript-eslint/ban-types
export type DevFlags = {} & SharedDevFlags;
export function flagEnabled(flag: keyof Flags): boolean {

View File

@ -26,7 +26,7 @@
<bit-hint>{{ "domainNameInputHint" | i18n }}</bit-hint>
</bit-form-field>
<bit-form-field>
<bit-form-field *ngIf="data?.orgDomain">
<bit-label>{{ "dnsTxtRecord" | i18n }}</bit-label>
<input bitInput formControlName="txt" />
<bit-hint>{{ "dnsTxtRecordInputHint" | i18n }}</bit-hint>
@ -42,7 +42,7 @@
</bit-form-field>
<bit-callout
*ngIf="!data?.orgDomain?.verifiedDate"
*ngIf="data?.orgDomain && !data?.orgDomain?.verifiedDate"
type="info"
title="{{ 'automaticDomainVerification' | i18n }}"
>
@ -51,7 +51,10 @@
</div>
<ng-container bitDialogFooter>
<button type="submit" bitButton bitFormButton buttonType="primary">
<span *ngIf="!data?.orgDomain?.verifiedDate">{{ "verifyDomain" | i18n }}</span>
<span *ngIf="!data?.orgDomain">{{ "next" | i18n }}</span>
<span *ngIf="data?.orgDomain && !data?.orgDomain?.verifiedDate">{{
"verifyDomain" | i18n
}}</span>
<span *ngIf="data?.orgDomain?.verifiedDate">{{ "reverifyDomain" | i18n }}</span>
</button>
<button bitButton buttonType="secondary" (click)="dialogRef.close()" type="button">

View File

@ -13,7 +13,6 @@ import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "@bitw
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service";
import { Utils } from "@bitwarden/common/platform/misc/utils";
import { DialogService } from "@bitwarden/components";
import { domainNameValidator } from "./validators/domain-name.validator";
@ -90,17 +89,6 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
// Edit
this.domainForm.patchValue(this.data.orgDomain);
this.domainForm.disable();
} else {
// Add
// Figuring out the proper length of our DNS TXT Record value was fun.
// DNS-Based Service Discovery RFC: https://www.ietf.org/rfc/rfc6763.txt; see section 6.1
// Google uses 43 chars for their TXT record value: https://support.google.com/a/answer/2716802
// So, chose a magic # of 33 bytes to achieve at least that once converted to base 64 (47 char length).
const generatedTxt = `bw=${Utils.fromBufferToB64(
await this.cryptoFunctionService.randomBytes(33),
)}`;
this.txtCtrl.setValue(generatedTxt);
}
this.setupFormListeners();
@ -121,6 +109,7 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
// End Form methods
// Async Form Actions
// Creates a new domain record. The DNS TXT Record will be generated server-side and returned in the response.
saveDomain = async (): Promise<void> => {
if (this.domainForm.invalid) {
this.platformUtilsService.showToast("error", null, this.i18nService.t("domainFormInvalid"));
@ -130,14 +119,14 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
this.domainNameCtrl.disable();
const request: OrganizationDomainRequest = new OrganizationDomainRequest(
this.txtCtrl.value,
this.domainNameCtrl.value,
);
try {
this.data.orgDomain = await this.orgDomainApiService.post(this.data.organizationId, request);
// Patch the DNS TXT Record that was generated server-side
this.domainForm.controls.txt.patchValue(this.data.orgDomain.txt);
this.platformUtilsService.showToast("success", null, this.i18nService.t("domainSaved"));
await this.verifyDomain();
} catch (e) {
this.handleDomainSaveError(e);
}

View File

@ -29,6 +29,7 @@ const DisallowedPlanTypes = [
PlanType.Free,
PlanType.FamiliesAnnually2019,
PlanType.FamiliesAnnually,
PlanType.TeamsStarter2023,
PlanType.TeamsStarter,
];

View File

@ -2,7 +2,6 @@ import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";
import { AuthGuard } from "@bitwarden/angular/auth/guards";
import { buildFlaggedRoute } from "@bitwarden/web-vault/app/oss-routing.module";
import { organizationEnabledGuard } from "./guards/sm-org-enabled.guard";
import { canActivateSM } from "./guards/sm.guard";
@ -17,7 +16,7 @@ import { OrgSuspendedComponent } from "./shared/org-suspended.component";
import { TrashModule } from "./trash/trash.module";
const routes: Routes = [
buildFlaggedRoute("secretsManager", {
{
path: "",
children: [
{
@ -86,7 +85,7 @@ const routes: Routes = [
],
},
],
}),
},
];
@NgModule({

View File

@ -1,9 +1,7 @@
export class OrganizationDomainRequest {
txt: string;
domainName: string;
constructor(txt: string, domainName: string) {
this.txt = txt;
constructor(domainName: string) {
this.domainName = domainName;
}
}

View File

@ -11,9 +11,14 @@ export enum PlanType {
TeamsAnnually2020 = 9,
EnterpriseMonthly2020 = 10,
EnterpriseAnnually2020 = 11,
TeamsMonthly = 12,
TeamsAnnually = 13,
EnterpriseMonthly = 14,
EnterpriseAnnually = 15,
TeamsStarter = 16,
TeamsMonthly2023 = 12,
TeamsAnnually2023 = 13,
EnterpriseMonthly2023 = 14,
EnterpriseAnnually2023 = 15,
TeamsStarter2023 = 16,
TeamsMonthly = 17,
TeamsAnnually = 18,
EnterpriseMonthly = 19,
EnterpriseAnnually = 20,
TeamsStarter = 21,
}

View File

@ -81,6 +81,7 @@ export class OrganizationBillingService implements OrganizationBillingServiceAbs
case PlanType.Free:
case PlanType.FamiliesAnnually:
case PlanType.FamiliesAnnually2019:
case PlanType.TeamsStarter2023:
case PlanType.TeamsStarter:
return true;
default:

View File

@ -1,5 +1,5 @@
// required to avoid linting errors when there are no flags
/* eslint-disable @typescript-eslint/ban-types */
// eslint-disable-next-line @typescript-eslint/ban-types
export type SharedFlags = {
multithreadDecryption: boolean;
showPasswordless?: boolean;
@ -7,7 +7,7 @@ export type SharedFlags = {
};
// required to avoid linting errors when there are no flags
/* eslint-disable @typescript-eslint/ban-types */
// eslint-disable-next-line @typescript-eslint/ban-types
export type SharedDevFlags = {
noopNotifications: boolean;
};

View File

@ -102,6 +102,7 @@ export const SM_ONBOARDING_DISK = new StateDefinition("smOnboarding", "disk", {
export const GENERATOR_DISK = new StateDefinition("generator", "disk");
export const GENERATOR_MEMORY = new StateDefinition("generator", "memory");
export const BROWSER_SEND_MEMORY = new StateDefinition("sendBrowser", "memory");
export const EVENT_COLLECTION_DISK = new StateDefinition("eventCollection", "disk");
export const SEND_DISK = new StateDefinition("encryptedSend", "disk", {
web: "memory",

10
package-lock.json generated
View File

@ -168,7 +168,7 @@
"regedit": "^3.0.3",
"remark-gfm": "3.0.1",
"rimraf": "5.0.5",
"sass": "1.69.5",
"sass": "1.74.1",
"sass-loader": "13.3.3",
"storybook": "7.6.17",
"style-loader": "3.3.4",
@ -247,7 +247,7 @@
},
"apps/web": {
"name": "@bitwarden/web-vault",
"version": "2024.3.1"
"version": "2024.4.0"
},
"libs/admin-console": {
"name": "@bitwarden/admin-console",
@ -33467,9 +33467,9 @@
}
},
"node_modules/sass": {
"version": "1.69.5",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.69.5.tgz",
"integrity": "sha512-qg2+UCJibLr2LCVOt3OlPhr/dqVHWOa9XtZf2OjbLs/T4VPSJ00udtgJxH3neXZm+QqX8B+3cU7RaLqp1iVfcQ==",
"version": "1.74.1",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.74.1.tgz",
"integrity": "sha512-w0Z9p/rWZWelb88ISOLyvqTWGmtmu2QJICqDBGyNnfG4OUnPX9BBjjYIXUpXCMOOg5MQWNpqzt876la1fsTvUA==",
"dev": true,
"dependencies": {
"chokidar": ">=3.0.0 <4.0.0",

View File

@ -129,7 +129,7 @@
"regedit": "^3.0.3",
"remark-gfm": "3.0.1",
"rimraf": "5.0.5",
"sass": "1.69.5",
"sass": "1.74.1",
"sass-loader": "13.3.3",
"storybook": "7.6.17",
"style-loader": "3.3.4",