Merge branch 'main' of https://github.com/bitwarden/clients into PM-5025-Migrate-update-license-component
This commit is contained in:
commit
49b44b3dc8
|
@ -38,9 +38,7 @@ const config: StorybookConfig = {
|
||||||
},
|
},
|
||||||
env: (config) => ({
|
env: (config) => ({
|
||||||
...config,
|
...config,
|
||||||
FLAGS: JSON.stringify({
|
FLAGS: JSON.stringify({}),
|
||||||
secretsManager: true,
|
|
||||||
}),
|
|
||||||
}),
|
}),
|
||||||
webpackFinal: async (config, { configType }) => {
|
webpackFinal: async (config, { configType }) => {
|
||||||
if (config.resolve) {
|
if (config.resolve) {
|
||||||
|
|
|
@ -95,10 +95,10 @@
|
||||||
"message": "Auto-fill login"
|
"message": "Auto-fill login"
|
||||||
},
|
},
|
||||||
"autoFillCard": {
|
"autoFillCard": {
|
||||||
"message": "Auto-fill card"
|
"message": "Auto-bete txartela"
|
||||||
},
|
},
|
||||||
"autoFillIdentity": {
|
"autoFillIdentity": {
|
||||||
"message": "Auto-fill identity"
|
"message": "Auto-bete nortasuna"
|
||||||
},
|
},
|
||||||
"generatePasswordCopied": {
|
"generatePasswordCopied": {
|
||||||
"message": "Sortu pasahitza (kopiatuta)"
|
"message": "Sortu pasahitza (kopiatuta)"
|
||||||
|
@ -110,19 +110,19 @@
|
||||||
"message": "Bat datozen saio-hasierarik gabe"
|
"message": "Bat datozen saio-hasierarik gabe"
|
||||||
},
|
},
|
||||||
"noCards": {
|
"noCards": {
|
||||||
"message": "No cards"
|
"message": "Txartelik ez"
|
||||||
},
|
},
|
||||||
"noIdentities": {
|
"noIdentities": {
|
||||||
"message": "No identities"
|
"message": "Nortasunik ez"
|
||||||
},
|
},
|
||||||
"addLoginMenu": {
|
"addLoginMenu": {
|
||||||
"message": "Add login"
|
"message": "Add login"
|
||||||
},
|
},
|
||||||
"addCardMenu": {
|
"addCardMenu": {
|
||||||
"message": "Add card"
|
"message": "Gehitu txartela"
|
||||||
},
|
},
|
||||||
"addIdentityMenu": {
|
"addIdentityMenu": {
|
||||||
"message": "Add identity"
|
"message": "Gehitu nortasuna"
|
||||||
},
|
},
|
||||||
"unlockVaultMenu": {
|
"unlockVaultMenu": {
|
||||||
"message": "Desblokeatu kutxa gotorra"
|
"message": "Desblokeatu kutxa gotorra"
|
||||||
|
@ -223,10 +223,10 @@
|
||||||
"message": "Bitwarden Laguntza zentroa"
|
"message": "Bitwarden Laguntza zentroa"
|
||||||
},
|
},
|
||||||
"communityForums": {
|
"communityForums": {
|
||||||
"message": "Explore Bitwarden community forums"
|
"message": "Esploratu Bitwarden komunitatearen foroak"
|
||||||
},
|
},
|
||||||
"contactSupport": {
|
"contactSupport": {
|
||||||
"message": "Contact Bitwarden support"
|
"message": "Jarri harremanetan Bitwardeneko laguntza taldearekin"
|
||||||
},
|
},
|
||||||
"sync": {
|
"sync": {
|
||||||
"message": "Sinkronizatu"
|
"message": "Sinkronizatu"
|
||||||
|
@ -269,7 +269,7 @@
|
||||||
"message": "Luzera"
|
"message": "Luzera"
|
||||||
},
|
},
|
||||||
"passwordMinLength": {
|
"passwordMinLength": {
|
||||||
"message": "Minimum password length"
|
"message": "Pasahitzaren gutxieneko luzera"
|
||||||
},
|
},
|
||||||
"uppercase": {
|
"uppercase": {
|
||||||
"message": "Letra larria (A-Z)"
|
"message": "Letra larria (A-Z)"
|
||||||
|
@ -1064,7 +1064,7 @@
|
||||||
"message": "Edit browser settings."
|
"message": "Edit browser settings."
|
||||||
},
|
},
|
||||||
"autofillOverlayVisibilityOff": {
|
"autofillOverlayVisibilityOff": {
|
||||||
"message": "Off",
|
"message": "Itzalita",
|
||||||
"description": "Overlay setting select option for disabling autofill overlay"
|
"description": "Overlay setting select option for disabling autofill overlay"
|
||||||
},
|
},
|
||||||
"autofillOverlayVisibilityOnFieldFocus": {
|
"autofillOverlayVisibilityOnFieldFocus": {
|
||||||
|
@ -1592,10 +1592,10 @@
|
||||||
"message": "Ezarri pasahitz nagusia"
|
"message": "Ezarri pasahitz nagusia"
|
||||||
},
|
},
|
||||||
"currentMasterPass": {
|
"currentMasterPass": {
|
||||||
"message": "Current master password"
|
"message": "Oraingo pasahitz nagusia"
|
||||||
},
|
},
|
||||||
"newMasterPass": {
|
"newMasterPass": {
|
||||||
"message": "New master password"
|
"message": "Pasahitz nagusi berria"
|
||||||
},
|
},
|
||||||
"confirmNewMasterPass": {
|
"confirmNewMasterPass": {
|
||||||
"message": "Confirm new master password"
|
"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."
|
"message": "Please make sure your vault is unlocked and the Fingerprint phrase matches on the other device."
|
||||||
},
|
},
|
||||||
"resendNotification": {
|
"resendNotification": {
|
||||||
"message": "Resend notification"
|
"message": "Berbidali jakinarazpena"
|
||||||
},
|
},
|
||||||
"viewAllLoginOptions": {
|
"viewAllLoginOptions": {
|
||||||
"message": "View all log in options"
|
"message": "Ikusi erregistro guztiak ezarpenetan"
|
||||||
},
|
},
|
||||||
"notificationSentDevice": {
|
"notificationSentDevice": {
|
||||||
"message": "A notification has been sent to your device."
|
"message": "A notification has been sent to your device."
|
||||||
|
@ -2293,13 +2293,13 @@
|
||||||
"message": "Check known data breaches for this password"
|
"message": "Check known data breaches for this password"
|
||||||
},
|
},
|
||||||
"important": {
|
"important": {
|
||||||
"message": "Important:"
|
"message": "Garrantzitsua:"
|
||||||
},
|
},
|
||||||
"masterPasswordHint": {
|
"masterPasswordHint": {
|
||||||
"message": "Your master password cannot be recovered if you forget it!"
|
"message": "Your master password cannot be recovered if you forget it!"
|
||||||
},
|
},
|
||||||
"characterMinimum": {
|
"characterMinimum": {
|
||||||
"message": "$LENGTH$ character minimum",
|
"message": "$LENGTH$ karaktere gutxienez",
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
"length": {
|
"length": {
|
||||||
"content": "$1",
|
"content": "$1",
|
||||||
|
@ -2326,7 +2326,7 @@
|
||||||
"message": "Select an item from this screen, or explore other options in settings."
|
"message": "Select an item from this screen, or explore other options in settings."
|
||||||
},
|
},
|
||||||
"gotIt": {
|
"gotIt": {
|
||||||
"message": "Got it"
|
"message": "Ulertuta"
|
||||||
},
|
},
|
||||||
"autofillSettings": {
|
"autofillSettings": {
|
||||||
"message": "Auto-fill settings"
|
"message": "Auto-fill settings"
|
||||||
|
@ -2359,25 +2359,25 @@
|
||||||
"message": "Logging in on"
|
"message": "Logging in on"
|
||||||
},
|
},
|
||||||
"opensInANewWindow": {
|
"opensInANewWindow": {
|
||||||
"message": "Opens in a new window"
|
"message": "Leiho berri batean irekitzen da"
|
||||||
},
|
},
|
||||||
"deviceApprovalRequired": {
|
"deviceApprovalRequired": {
|
||||||
"message": "Device approval required. Select an approval option below:"
|
"message": "Device approval required. Select an approval option below:"
|
||||||
},
|
},
|
||||||
"rememberThisDevice": {
|
"rememberThisDevice": {
|
||||||
"message": "Remember this device"
|
"message": "Gogoratu gailu hau"
|
||||||
},
|
},
|
||||||
"uncheckIfPublicDevice": {
|
"uncheckIfPublicDevice": {
|
||||||
"message": "Uncheck if using a public device"
|
"message": "Uncheck if using a public device"
|
||||||
},
|
},
|
||||||
"approveFromYourOtherDevice": {
|
"approveFromYourOtherDevice": {
|
||||||
"message": "Approve from your other device"
|
"message": "Onartu zure beste gailutik"
|
||||||
},
|
},
|
||||||
"requestAdminApproval": {
|
"requestAdminApproval": {
|
||||||
"message": "Request admin approval"
|
"message": "Eskatu administratzailearen onarpena"
|
||||||
},
|
},
|
||||||
"approveWithMasterPassword": {
|
"approveWithMasterPassword": {
|
||||||
"message": "Approve with master password"
|
"message": "Onartu pasahitz nagusiarekin"
|
||||||
},
|
},
|
||||||
"ssoIdentifierRequired": {
|
"ssoIdentifierRequired": {
|
||||||
"message": "Organization SSO identifier is required."
|
"message": "Organization SSO identifier is required."
|
||||||
|
@ -2390,31 +2390,31 @@
|
||||||
"message": "Access denied. You do not have permission to view this page."
|
"message": "Access denied. You do not have permission to view this page."
|
||||||
},
|
},
|
||||||
"general": {
|
"general": {
|
||||||
"message": "General"
|
"message": "Orokorra"
|
||||||
},
|
},
|
||||||
"display": {
|
"display": {
|
||||||
"message": "Display"
|
"message": "Bistaratzea"
|
||||||
},
|
},
|
||||||
"accountSuccessfullyCreated": {
|
"accountSuccessfullyCreated": {
|
||||||
"message": "Account successfully created!"
|
"message": "Kontua zuzen sortu da!"
|
||||||
},
|
},
|
||||||
"adminApprovalRequested": {
|
"adminApprovalRequested": {
|
||||||
"message": "Admin approval requested"
|
"message": "Administratzailearen onarpena eskatuta"
|
||||||
},
|
},
|
||||||
"adminApprovalRequestSentToAdmins": {
|
"adminApprovalRequestSentToAdmins": {
|
||||||
"message": "Your request has been sent to your admin."
|
"message": "Zure eskaera zure administratzaileari bidali zaio."
|
||||||
},
|
},
|
||||||
"youWillBeNotifiedOnceApproved": {
|
"youWillBeNotifiedOnceApproved": {
|
||||||
"message": "You will be notified once approved."
|
"message": "Jakinaraziko zaizu onartzen denean."
|
||||||
},
|
},
|
||||||
"troubleLoggingIn": {
|
"troubleLoggingIn": {
|
||||||
"message": "Trouble logging in?"
|
"message": "Arazoak saioa hasterakoan?"
|
||||||
},
|
},
|
||||||
"loginApproved": {
|
"loginApproved": {
|
||||||
"message": "Login approved"
|
"message": "Login approved"
|
||||||
},
|
},
|
||||||
"userEmailMissing": {
|
"userEmailMissing": {
|
||||||
"message": "User email missing"
|
"message": "Erabiltzailearen emaila falta da"
|
||||||
},
|
},
|
||||||
"deviceTrusted": {
|
"deviceTrusted": {
|
||||||
"message": "Device trusted"
|
"message": "Device trusted"
|
||||||
|
@ -2540,19 +2540,19 @@
|
||||||
"description": "Notification button text for starting a fileless import."
|
"description": "Notification button text for starting a fileless import."
|
||||||
},
|
},
|
||||||
"importing": {
|
"importing": {
|
||||||
"message": "Importing...",
|
"message": "Inportatzen...",
|
||||||
"description": "Notification message for when an import is in progress."
|
"description": "Notification message for when an import is in progress."
|
||||||
},
|
},
|
||||||
"dataSuccessfullyImported": {
|
"dataSuccessfullyImported": {
|
||||||
"message": "Data successfully imported!",
|
"message": "Datuak zuzen inportatu dira!",
|
||||||
"description": "Notification message for when an import has completed successfully."
|
"description": "Notification message for when an import has completed successfully."
|
||||||
},
|
},
|
||||||
"dataImportFailed": {
|
"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."
|
"description": "Notification message for when an import has failed."
|
||||||
},
|
},
|
||||||
"importNetworkError": {
|
"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."
|
"description": "Notification message for when an import has failed due to a network error."
|
||||||
},
|
},
|
||||||
"aliasDomain": {
|
"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"
|
"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": {
|
"noItemsToShow": {
|
||||||
"message": "No items to show",
|
"message": "Ez dago elementurik erakusteko",
|
||||||
"description": "Text to show in overlay if there are no matching items"
|
"description": "Text to show in overlay if there are no matching items"
|
||||||
},
|
},
|
||||||
"newItem": {
|
"newItem": {
|
||||||
"message": "New item",
|
"message": "Elementu berria",
|
||||||
"description": "Button text to display in overlay when there are no matching items"
|
"description": "Button text to display in overlay when there are no matching items"
|
||||||
},
|
},
|
||||||
"addNewVaultItem": {
|
"addNewVaultItem": {
|
||||||
|
@ -2618,32 +2618,32 @@
|
||||||
"description": "Screen reader text for announcing when the overlay opens on the page"
|
"description": "Screen reader text for announcing when the overlay opens on the page"
|
||||||
},
|
},
|
||||||
"turnOn": {
|
"turnOn": {
|
||||||
"message": "Turn on"
|
"message": "Piztu"
|
||||||
},
|
},
|
||||||
"ignore": {
|
"ignore": {
|
||||||
"message": "Ignore"
|
"message": "Ezikusi"
|
||||||
},
|
},
|
||||||
"importData": {
|
"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"
|
"description": "Used for the header of the import dialog, the import button and within the file-password-prompt"
|
||||||
},
|
},
|
||||||
"importError": {
|
"importError": {
|
||||||
"message": "Import error"
|
"message": "Errorea inportatzerakoan"
|
||||||
},
|
},
|
||||||
"importErrorDesc": {
|
"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": {
|
"resolveTheErrorsBelowAndTryAgain": {
|
||||||
"message": "Resolve the errors below and try again."
|
"message": "Konpondu beheko akatsak eta saiatu berriro."
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"message": "Description"
|
"message": "Deskribapena"
|
||||||
},
|
},
|
||||||
"importSuccess": {
|
"importSuccess": {
|
||||||
"message": "Data successfully imported"
|
"message": "Datuak zuzen inportatu dira"
|
||||||
},
|
},
|
||||||
"importSuccessNumberOfItems": {
|
"importSuccessNumberOfItems": {
|
||||||
"message": "A total of $AMOUNT$ items were imported.",
|
"message": "Guztira $AMOUNT$ elementu inportatu dira.",
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
"amount": {
|
"amount": {
|
||||||
"content": "$1",
|
"content": "$1",
|
||||||
|
@ -2652,7 +2652,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tryAgain": {
|
"tryAgain": {
|
||||||
"message": "Try again"
|
"message": "Saiatu berriro"
|
||||||
},
|
},
|
||||||
"verificationRequiredForActionSetPinToContinue": {
|
"verificationRequiredForActionSetPinToContinue": {
|
||||||
"message": "Verification required for this action. Set a PIN to continue."
|
"message": "Verification required for this action. Set a PIN to continue."
|
||||||
|
@ -2661,10 +2661,10 @@
|
||||||
"message": "Set PIN"
|
"message": "Set PIN"
|
||||||
},
|
},
|
||||||
"verifyWithBiometrics": {
|
"verifyWithBiometrics": {
|
||||||
"message": "Verify with biometrics"
|
"message": "Egiaztatu biometria erabiliz"
|
||||||
},
|
},
|
||||||
"awaitingConfirmation": {
|
"awaitingConfirmation": {
|
||||||
"message": "Awaiting confirmation"
|
"message": "Baieztapenaren zain"
|
||||||
},
|
},
|
||||||
"couldNotCompleteBiometrics": {
|
"couldNotCompleteBiometrics": {
|
||||||
"message": "Could not complete biometrics."
|
"message": "Could not complete biometrics."
|
||||||
|
@ -2673,13 +2673,13 @@
|
||||||
"message": "Need a different method?"
|
"message": "Need a different method?"
|
||||||
},
|
},
|
||||||
"useMasterPassword": {
|
"useMasterPassword": {
|
||||||
"message": "Use master password"
|
"message": "Erabili pasahitz nagusia"
|
||||||
},
|
},
|
||||||
"usePin": {
|
"usePin": {
|
||||||
"message": "Use PIN"
|
"message": "Erabili PIN kodea"
|
||||||
},
|
},
|
||||||
"useBiometrics": {
|
"useBiometrics": {
|
||||||
"message": "Use biometrics"
|
"message": "Erabili biometria"
|
||||||
},
|
},
|
||||||
"enterVerificationCodeSentToEmail": {
|
"enterVerificationCodeSentToEmail": {
|
||||||
"message": "Enter the verification code that was sent to your email."
|
"message": "Enter the verification code that was sent to your email."
|
||||||
|
@ -2688,10 +2688,10 @@
|
||||||
"message": "Resend code"
|
"message": "Resend code"
|
||||||
},
|
},
|
||||||
"total": {
|
"total": {
|
||||||
"message": "Total"
|
"message": "Guztira"
|
||||||
},
|
},
|
||||||
"importWarning": {
|
"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": {
|
"placeholders": {
|
||||||
"organization": {
|
"organization": {
|
||||||
"content": "$1",
|
"content": "$1",
|
||||||
|
@ -2810,7 +2810,7 @@
|
||||||
"message": "You do not have a matching login for this site."
|
"message": "You do not have a matching login for this site."
|
||||||
},
|
},
|
||||||
"confirm": {
|
"confirm": {
|
||||||
"message": "Confirm"
|
"message": "Berretsi"
|
||||||
},
|
},
|
||||||
"savePasskey": {
|
"savePasskey": {
|
||||||
"message": "Save passkey"
|
"message": "Save passkey"
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
"description": "Extension description"
|
"description": "Extension description"
|
||||||
},
|
},
|
||||||
"loginOrCreateNewAccount": {
|
"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": {
|
"createAccount": {
|
||||||
"message": "Luo tili"
|
"message": "Luo tili"
|
||||||
|
@ -802,7 +802,7 @@
|
||||||
"message": "Lue lisää"
|
"message": "Lue lisää"
|
||||||
},
|
},
|
||||||
"authenticatorKeyTotp": {
|
"authenticatorKeyTotp": {
|
||||||
"message": "Todennusaavain (TOTP)"
|
"message": "Todennusavain (TOTP)"
|
||||||
},
|
},
|
||||||
"verificationCodeTotp": {
|
"verificationCodeTotp": {
|
||||||
"message": "Todennuskoodi (TOTP)"
|
"message": "Todennuskoodi (TOTP)"
|
||||||
|
|
|
@ -17,7 +17,7 @@ import { CipherService } from "@bitwarden/common/vault/services/cipher.service";
|
||||||
import { FolderService } from "@bitwarden/common/vault/services/folder/folder.service";
|
import { FolderService } from "@bitwarden/common/vault/services/folder/folder.service";
|
||||||
|
|
||||||
import { BrowserApi } from "../../platform/browser/browser-api";
|
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 { NotificationQueueMessageType } from "../enums/notification-queue-message-type.enum";
|
||||||
import { FormData } from "../services/abstractions/autofill.service";
|
import { FormData } from "../services/abstractions/autofill.service";
|
||||||
import AutofillService from "../services/autofill.service";
|
import AutofillService from "../services/autofill.service";
|
||||||
|
@ -49,7 +49,7 @@ describe("NotificationBackground", () => {
|
||||||
const authService = mock<AuthService>();
|
const authService = mock<AuthService>();
|
||||||
const policyService = mock<PolicyService>();
|
const policyService = mock<PolicyService>();
|
||||||
const folderService = mock<FolderService>();
|
const folderService = mock<FolderService>();
|
||||||
const stateService = mock<BrowserStateService>();
|
const stateService = mock<DefaultBrowserStateService>();
|
||||||
const userNotificationSettingsService = mock<UserNotificationSettingsService>();
|
const userNotificationSettingsService = mock<UserNotificationSettingsService>();
|
||||||
const domainSettingsService = mock<DomainSettingsService>();
|
const domainSettingsService = mock<DomainSettingsService>();
|
||||||
const environmentService = mock<EnvironmentService>();
|
const environmentService = mock<EnvironmentService>();
|
||||||
|
|
|
@ -33,7 +33,7 @@ import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
||||||
import { CipherService } from "@bitwarden/common/vault/services/cipher.service";
|
import { CipherService } from "@bitwarden/common/vault/services/cipher.service";
|
||||||
|
|
||||||
import { BrowserApi } from "../../platform/browser/browser-api";
|
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 { BrowserPlatformUtilsService } from "../../platform/services/platform-utils/browser-platform-utils.service";
|
||||||
import { AutofillService } from "../services/abstractions/autofill.service";
|
import { AutofillService } from "../services/abstractions/autofill.service";
|
||||||
import {
|
import {
|
||||||
|
@ -72,7 +72,7 @@ describe("OverlayBackground", () => {
|
||||||
urls: { icons: "https://icons.bitwarden.com/" },
|
urls: { icons: "https://icons.bitwarden.com/" },
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
const stateService = mock<BrowserStateService>();
|
const stateService = mock<DefaultBrowserStateService>();
|
||||||
const autofillSettingsService = mock<AutofillSettingsService>();
|
const autofillSettingsService = mock<AutofillSettingsService>();
|
||||||
const i18nService = mock<I18nService>();
|
const i18nService = mock<I18nService>();
|
||||||
const platformUtilsService = mock<BrowserPlatformUtilsService>();
|
const platformUtilsService = mock<BrowserPlatformUtilsService>();
|
||||||
|
|
|
@ -211,7 +211,7 @@ import BrowserLocalStorageService from "../platform/services/browser-local-stora
|
||||||
import BrowserMemoryStorageService from "../platform/services/browser-memory-storage.service";
|
import BrowserMemoryStorageService from "../platform/services/browser-memory-storage.service";
|
||||||
import BrowserMessagingPrivateModeBackgroundService from "../platform/services/browser-messaging-private-mode-background.service";
|
import BrowserMessagingPrivateModeBackgroundService from "../platform/services/browser-messaging-private-mode-background.service";
|
||||||
import BrowserMessagingService from "../platform/services/browser-messaging.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 I18nService from "../platform/services/i18n.service";
|
||||||
import { LocalBackedSessionStorageService } from "../platform/services/local-backed-session-storage.service";
|
import { LocalBackedSessionStorageService } from "../platform/services/local-backed-session-storage.service";
|
||||||
import { BackgroundPlatformUtilsService } from "../platform/services/platform-utils/background-platform-utils.service";
|
import { BackgroundPlatformUtilsService } from "../platform/services/platform-utils/background-platform-utils.service";
|
||||||
|
@ -466,7 +466,7 @@ export default class MainBackground {
|
||||||
new MigrationBuilderService(),
|
new MigrationBuilderService(),
|
||||||
);
|
);
|
||||||
|
|
||||||
this.stateService = new BrowserStateService(
|
this.stateService = new DefaultBrowserStateService(
|
||||||
this.storageService,
|
this.storageService,
|
||||||
this.secureStorageService,
|
this.secureStorageService,
|
||||||
this.memoryStorageService,
|
this.memoryStorageService,
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
TokenServiceInitOptions,
|
TokenServiceInitOptions,
|
||||||
} from "../../../auth/background/service-factories/token-service.factory";
|
} from "../../../auth/background/service-factories/token-service.factory";
|
||||||
import { Account } from "../../../models/account";
|
import { Account } from "../../../models/account";
|
||||||
import { BrowserStateService } from "../../services/browser-state.service";
|
import { DefaultBrowserStateService } from "../../services/default-browser-state.service";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
environmentServiceFactory,
|
environmentServiceFactory,
|
||||||
|
@ -46,15 +46,15 @@ export type StateServiceInitOptions = StateServiceFactoryOptions &
|
||||||
MigrationRunnerInitOptions;
|
MigrationRunnerInitOptions;
|
||||||
|
|
||||||
export async function stateServiceFactory(
|
export async function stateServiceFactory(
|
||||||
cache: { stateService?: BrowserStateService } & CachedServices,
|
cache: { stateService?: DefaultBrowserStateService } & CachedServices,
|
||||||
opts: StateServiceInitOptions,
|
opts: StateServiceInitOptions,
|
||||||
): Promise<BrowserStateService> {
|
): Promise<DefaultBrowserStateService> {
|
||||||
const service = await factory(
|
const service = await factory(
|
||||||
cache,
|
cache,
|
||||||
"stateService",
|
"stateService",
|
||||||
opts,
|
opts,
|
||||||
async () =>
|
async () =>
|
||||||
new BrowserStateService(
|
new DefaultBrowserStateService(
|
||||||
await diskStorageServiceFactory(cache, opts),
|
await diskStorageServiceFactory(cache, opts),
|
||||||
await secureStorageServiceFactory(cache, opts),
|
await secureStorageServiceFactory(cache, opts),
|
||||||
await memoryStorageServiceFactory(cache, opts),
|
await memoryStorageServiceFactory(cache, opts),
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { BehaviorSubject } from "rxjs";
|
||||||
import { AbstractMemoryStorageService } from "@bitwarden/common/platform/abstractions/storage.service";
|
import { AbstractMemoryStorageService } from "@bitwarden/common/platform/abstractions/storage.service";
|
||||||
import { MemoryStorageService } from "@bitwarden/common/platform/services/memory-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 { browserSession } from "./browser-session.decorator";
|
||||||
import { SessionStorable } from "./session-storable";
|
import { SessionStorable } from "./session-storable";
|
||||||
|
@ -25,7 +25,7 @@ describe("browserSession decorator", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should create if StateService is a constructor argument", () => {
|
it("should create if StateService is a constructor argument", () => {
|
||||||
const stateService = Object.create(BrowserStateService.prototype, {
|
const stateService = Object.create(DefaultBrowserStateService.prototype, {
|
||||||
memoryStorageService: {
|
memoryStorageService: {
|
||||||
value: Object.create(MemoryStorageService.prototype, {
|
value: Object.create(MemoryStorageService.prototype, {
|
||||||
type: { value: MemoryStorageService.TYPE },
|
type: { value: MemoryStorageService.TYPE },
|
||||||
|
@ -35,7 +35,7 @@ describe("browserSession decorator", () => {
|
||||||
|
|
||||||
@browserSession
|
@browserSession
|
||||||
class TestClass {
|
class TestClass {
|
||||||
constructor(private stateService: BrowserStateService) {}
|
constructor(private stateService: DefaultBrowserStateService) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(new TestClass(stateService)).toBeDefined();
|
expect(new TestClass(stateService)).toBeDefined();
|
||||||
|
|
|
@ -11,13 +11,13 @@ import { GroupPolicyEnvironment } from "../admin-console/types/group-policy-envi
|
||||||
import { BrowserApi } from "./browser/browser-api";
|
import { BrowserApi } from "./browser/browser-api";
|
||||||
|
|
||||||
// required to avoid linting errors when there are no 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 = {
|
export type Flags = {
|
||||||
accountSwitching?: boolean;
|
accountSwitching?: boolean;
|
||||||
} & SharedFlags;
|
} & SharedFlags;
|
||||||
|
|
||||||
// required to avoid linting errors when there are no 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 DevFlags = {
|
export type DevFlags = {
|
||||||
storeSessionDecrypted?: boolean;
|
storeSessionDecrypted?: boolean;
|
||||||
managedEnvironment?: GroupPolicyEnvironment;
|
managedEnvironment?: GroupPolicyEnvironment;
|
||||||
|
|
|
@ -8,6 +8,23 @@ import {
|
||||||
|
|
||||||
import { fromChromeEvent } from "../../browser/from-chrome-event";
|
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
|
export default abstract class AbstractChromeStorageService
|
||||||
implements AbstractStorageService, ObservableStorageService
|
implements AbstractStorageService, ObservableStorageService
|
||||||
{
|
{
|
||||||
|
@ -44,7 +61,11 @@ export default abstract class AbstractChromeStorageService
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
this.chromeStorageApi.get(key, (obj: any) => {
|
this.chromeStorageApi.get(key, (obj: any) => {
|
||||||
if (obj != null && obj[key] != null) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
resolve(null);
|
resolve(null);
|
||||||
|
@ -57,14 +78,7 @@ export default abstract class AbstractChromeStorageService
|
||||||
}
|
}
|
||||||
|
|
||||||
async save(key: string, obj: any): Promise<void> {
|
async save(key: string, obj: any): Promise<void> {
|
||||||
if (obj == null) {
|
obj = objToStore(obj);
|
||||||
// Fix safari not liking null in set
|
|
||||||
return this.remove(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obj instanceof Set) {
|
|
||||||
obj = Array.from(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
const keyedObj = { [key]: obj };
|
const keyedObj = { [key]: obj };
|
||||||
return new Promise<void>((resolve) => {
|
return new Promise<void>((resolve) => {
|
||||||
|
|
|
@ -1,19 +1,5 @@
|
||||||
import { StateService as BaseStateServiceAbstraction } from "@bitwarden/common/platform/abstractions/state.service";
|
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 { Account } from "../../../models/account";
|
||||||
import { BrowserComponentState } from "../../../models/browserComponentState";
|
|
||||||
import { BrowserSendComponentState } from "../../../models/browserSendComponentState";
|
|
||||||
|
|
||||||
export abstract class BrowserStateService extends BaseStateServiceAbstraction<Account> {
|
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>;
|
|
||||||
}
|
|
||||||
|
|
|
@ -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();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,4 +1,5 @@
|
||||||
import { mock, MockProxy } from "jest-mock-extended";
|
import { mock, MockProxy } from "jest-mock-extended";
|
||||||
|
import { firstValueFrom } from "rxjs";
|
||||||
|
|
||||||
import { TokenService } from "@bitwarden/common/auth/abstractions/token.service";
|
import { TokenService } from "@bitwarden/common/auth/abstractions/token.service";
|
||||||
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.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 { State } from "@bitwarden/common/platform/models/domain/state";
|
||||||
import { MigrationRunner } from "@bitwarden/common/platform/services/migration-runner";
|
import { MigrationRunner } from "@bitwarden/common/platform/services/migration-runner";
|
||||||
import { mockAccountServiceWith } from "@bitwarden/common/spec";
|
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 { UserId } from "@bitwarden/common/types/guid";
|
||||||
|
|
||||||
import { Account } from "../../models/account";
|
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
|
// disable session syncing to just test class
|
||||||
jest.mock("../decorators/session-sync-observable/");
|
jest.mock("../decorators/session-sync-observable/");
|
||||||
|
@ -39,7 +36,7 @@ describe("Browser State Service", () => {
|
||||||
const userId = "userId" as UserId;
|
const userId = "userId" as UserId;
|
||||||
const accountService = mockAccountServiceWith(userId);
|
const accountService = mockAccountServiceWith(userId);
|
||||||
|
|
||||||
let sut: BrowserStateService;
|
let sut: DefaultBrowserStateService;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
secureStorageService = mock();
|
secureStorageService = mock();
|
||||||
|
@ -71,7 +68,7 @@ describe("Browser State Service", () => {
|
||||||
const stateGetter = (key: string) => Promise.resolve(state);
|
const stateGetter = (key: string) => Promise.resolve(state);
|
||||||
memoryStorageService.get.mockImplementation(stateGetter);
|
memoryStorageService.get.mockImplementation(stateGetter);
|
||||||
|
|
||||||
sut = new BrowserStateService(
|
sut = new DefaultBrowserStateService(
|
||||||
diskStorageService,
|
diskStorageService,
|
||||||
secureStorageService,
|
secureStorageService,
|
||||||
memoryStorageService,
|
memoryStorageService,
|
||||||
|
@ -85,32 +82,17 @@ describe("Browser State Service", () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("getBrowserSendComponentState", () => {
|
describe("add Account", () => {
|
||||||
it("should return a BrowserSendComponentState", async () => {
|
it("should add account", async () => {
|
||||||
const sendState = new BrowserSendComponentState();
|
const newUserId = "newUserId" as UserId;
|
||||||
sendState.sends = [new SendView(), new SendView()];
|
const newAcct = new Account({
|
||||||
sendState.typeCounts = new Map<SendType, number>([
|
profile: { userId: newUserId },
|
||||||
[SendType.File, 3],
|
});
|
||||||
[SendType.Text, 5],
|
|
||||||
]);
|
|
||||||
state.accounts[userId].send = sendState;
|
|
||||||
(global as any)["watch"] = state;
|
|
||||||
|
|
||||||
const actual = await sut.getBrowserSendComponentState();
|
await sut.addAccount(newAcct);
|
||||||
expect(actual).toBeInstanceOf(BrowserSendComponentState);
|
|
||||||
expect(actual).toMatchObject(sendState);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("getBrowserSendTypeComponentState", () => {
|
const accts = await firstValueFrom(sut.accounts$);
|
||||||
it("should return a BrowserComponentState", async () => {
|
expect(accts[newUserId]).toBeDefined();
|
||||||
const componentState = new BrowserComponentState();
|
|
||||||
componentState.scrollY = 0;
|
|
||||||
componentState.searchText = "test";
|
|
||||||
state.accounts[userId].sendType = componentState;
|
|
||||||
|
|
||||||
const actual = await sut.getBrowserSendTypeComponentState();
|
|
||||||
expect(actual).toStrictEqual(componentState);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -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 { StateService as BaseStateService } from "@bitwarden/common/platform/services/state.service";
|
||||||
|
|
||||||
import { Account } from "../../models/account";
|
import { Account } from "../../models/account";
|
||||||
import { BrowserComponentState } from "../../models/browserComponentState";
|
|
||||||
import { BrowserSendComponentState } from "../../models/browserSendComponentState";
|
|
||||||
import { BrowserApi } from "../browser/browser-api";
|
import { BrowserApi } from "../browser/browser-api";
|
||||||
import { browserSession, sessionSync } from "../decorators/session-sync-observable";
|
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
|
@browserSession
|
||||||
export class BrowserStateService
|
export class DefaultBrowserStateService
|
||||||
extends BaseStateService<GlobalState, Account>
|
extends BaseStateService<GlobalState, Account>
|
||||||
implements StateServiceAbstraction
|
implements BrowserStateService
|
||||||
{
|
{
|
||||||
@sessionSync({
|
@sessionSync({
|
||||||
initializer: Account.fromJSON as any, // TODO: Remove this any when all any types are removed from Account
|
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
|
// Overriding the base class to prevent deleting the cache on save. We register a storage listener
|
||||||
// to delete the cache in the constructor above.
|
// to delete the cache in the constructor above.
|
||||||
protected override async saveAccountToDisk(
|
protected override async saveAccountToDisk(
|
|
@ -12,6 +12,7 @@ import { BrowserApi } from "../platform/browser/browser-api";
|
||||||
import { ZonedMessageListenerService } from "../platform/browser/zoned-message-listener.service";
|
import { ZonedMessageListenerService } from "../platform/browser/zoned-message-listener.service";
|
||||||
import { BrowserStateService } from "../platform/services/abstractions/browser-state.service";
|
import { BrowserStateService } from "../platform/services/abstractions/browser-state.service";
|
||||||
import { ForegroundPlatformUtilsService } from "../platform/services/platform-utils/foreground-platform-utils.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 { VaultBrowserStateService } from "../vault/services/vault-browser-state.service";
|
||||||
|
|
||||||
import { routerTransition } from "./app-routing.animations";
|
import { routerTransition } from "./app-routing.animations";
|
||||||
|
@ -38,6 +39,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
private i18nService: I18nService,
|
private i18nService: I18nService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private stateService: BrowserStateService,
|
private stateService: BrowserStateService,
|
||||||
|
private browserSendStateService: BrowserSendStateService,
|
||||||
private vaultBrowserStateService: VaultBrowserStateService,
|
private vaultBrowserStateService: VaultBrowserStateService,
|
||||||
private changeDetectorRef: ChangeDetectorRef,
|
private changeDetectorRef: ChangeDetectorRef,
|
||||||
private ngZone: NgZone,
|
private ngZone: NgZone,
|
||||||
|
@ -231,8 +233,8 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.vaultBrowserStateService.setBrowserGroupingsComponentState(null),
|
this.vaultBrowserStateService.setBrowserGroupingsComponentState(null),
|
||||||
this.vaultBrowserStateService.setBrowserVaultItemsComponentState(null),
|
this.vaultBrowserStateService.setBrowserVaultItemsComponentState(null),
|
||||||
this.stateService.setBrowserSendComponentState(null),
|
this.browserSendStateService.setBrowserSendComponentState(null),
|
||||||
this.stateService.setBrowserSendTypeComponentState(null),
|
this.browserSendStateService.setBrowserSendTypeComponentState(null),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,11 +99,12 @@ import { BrowserEnvironmentService } from "../../platform/services/browser-envir
|
||||||
import BrowserLocalStorageService from "../../platform/services/browser-local-storage.service";
|
import BrowserLocalStorageService from "../../platform/services/browser-local-storage.service";
|
||||||
import BrowserMessagingPrivateModePopupService from "../../platform/services/browser-messaging-private-mode-popup.service";
|
import BrowserMessagingPrivateModePopupService from "../../platform/services/browser-messaging-private-mode-popup.service";
|
||||||
import BrowserMessagingService from "../../platform/services/browser-messaging.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 I18nService from "../../platform/services/i18n.service";
|
||||||
import { ForegroundPlatformUtilsService } from "../../platform/services/platform-utils/foreground-platform-utils.service";
|
import { ForegroundPlatformUtilsService } from "../../platform/services/platform-utils/foreground-platform-utils.service";
|
||||||
import { ForegroundDerivedStateProvider } from "../../platform/state/foreground-derived-state.provider";
|
import { ForegroundDerivedStateProvider } from "../../platform/state/foreground-derived-state.provider";
|
||||||
import { ForegroundMemoryStorageService } from "../../platform/storage/foreground-memory-storage.service";
|
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 { FilePopoutUtilsService } from "../../tools/popup/services/file-popout-utils.service";
|
||||||
import { VaultBrowserStateService } from "../../vault/services/vault-browser-state.service";
|
import { VaultBrowserStateService } from "../../vault/services/vault-browser-state.service";
|
||||||
import { VaultFilterService } from "../../vault/services/vault-filter.service";
|
import { VaultFilterService } from "../../vault/services/vault-filter.service";
|
||||||
|
@ -412,7 +413,7 @@ const safeProviders: SafeProvider[] = [
|
||||||
tokenService: TokenService,
|
tokenService: TokenService,
|
||||||
migrationRunner: MigrationRunner,
|
migrationRunner: MigrationRunner,
|
||||||
) => {
|
) => {
|
||||||
return new BrowserStateService(
|
return new DefaultBrowserStateService(
|
||||||
storageService,
|
storageService,
|
||||||
secureStorageService,
|
secureStorageService,
|
||||||
memoryStorageService,
|
memoryStorageService,
|
||||||
|
@ -487,6 +488,11 @@ const safeProviders: SafeProvider[] = [
|
||||||
useClass: UserNotificationSettingsService,
|
useClass: UserNotificationSettingsService,
|
||||||
deps: [StateProvider],
|
deps: [StateProvider],
|
||||||
}),
|
}),
|
||||||
|
safeProvider({
|
||||||
|
provide: BrowserSendStateService,
|
||||||
|
useClass: BrowserSendStateService,
|
||||||
|
deps: [StateProvider],
|
||||||
|
}),
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
|
|
@ -18,7 +18,7 @@ import { DialogService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { BrowserSendComponentState } from "../../../models/browserSendComponentState";
|
import { BrowserSendComponentState } from "../../../models/browserSendComponentState";
|
||||||
import BrowserPopupUtils from "../../../platform/popup/browser-popup-utils";
|
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";
|
const ComponentId = "SendComponent";
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ export class SendGroupingsComponent extends BaseSendComponent {
|
||||||
ngZone: NgZone,
|
ngZone: NgZone,
|
||||||
policyService: PolicyService,
|
policyService: PolicyService,
|
||||||
searchService: SearchService,
|
searchService: SearchService,
|
||||||
private stateService: BrowserStateService,
|
private stateService: BrowserSendStateService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private syncService: SyncService,
|
private syncService: SyncService,
|
||||||
private changeDetectorRef: ChangeDetectorRef,
|
private changeDetectorRef: ChangeDetectorRef,
|
||||||
|
|
|
@ -19,7 +19,7 @@ import { DialogService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { BrowserComponentState } from "../../../models/browserComponentState";
|
import { BrowserComponentState } from "../../../models/browserComponentState";
|
||||||
import BrowserPopupUtils from "../../../platform/popup/browser-popup-utils";
|
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";
|
const ComponentId = "SendTypeComponent";
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ export class SendTypeComponent extends BaseSendComponent {
|
||||||
ngZone: NgZone,
|
ngZone: NgZone,
|
||||||
policyService: PolicyService,
|
policyService: PolicyService,
|
||||||
searchService: SearchService,
|
searchService: SearchService,
|
||||||
private stateService: BrowserStateService,
|
private stateService: BrowserSendStateService,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private location: Location,
|
private location: Location,
|
||||||
private changeDetectorRef: ChangeDetectorRef,
|
private changeDetectorRef: ChangeDetectorRef,
|
||||||
|
|
|
@ -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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -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),
|
||||||
|
},
|
||||||
|
);
|
|
@ -7,11 +7,11 @@ import {
|
||||||
} from "@bitwarden/common/platform/misc/flags";
|
} from "@bitwarden/common/platform/misc/flags";
|
||||||
|
|
||||||
// required to avoid linting errors when there are no 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;
|
export type Flags = {} & SharedFlags;
|
||||||
|
|
||||||
// required to avoid linting errors when there are no 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 DevFlags = {} & SharedDevFlags;
|
export type DevFlags = {} & SharedDevFlags;
|
||||||
|
|
||||||
export function flagEnabled(flag: keyof Flags): boolean {
|
export function flagEnabled(flag: keyof Flags): boolean {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"devFlags": {},
|
"devFlags": {},
|
||||||
"flags": {
|
"flags": {
|
||||||
"showDDGSetting": true,
|
|
||||||
"enableCipherKeyEncryption": false
|
"enableCipherKeyEncryption": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
{
|
{
|
||||||
"flags": {
|
"flags": {
|
||||||
"showDDGSetting": true,
|
|
||||||
"enableCipherKeyEncryption": false
|
"enableCipherKeyEncryption": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1237,18 +1237,18 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "1.0.51"
|
version = "1.0.58"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f11c217e1416d6f036b870f14e0413d480dbf28edbee1f877abaf0206af43bb7"
|
checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl",
|
"thiserror-impl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror-impl"
|
name = "thiserror-impl"
|
||||||
version = "1.0.51"
|
version = "1.0.58"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df"
|
checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
|
@ -24,7 +24,7 @@ rand = "=0.8.5"
|
||||||
retry = "=2.0.0"
|
retry = "=2.0.0"
|
||||||
scopeguard = "=1.2.0"
|
scopeguard = "=1.2.0"
|
||||||
sha2 = "=0.10.8"
|
sha2 = "=0.10.8"
|
||||||
thiserror = "=1.0.51"
|
thiserror = "=1.0.58"
|
||||||
typenum = "=1.17.0"
|
typenum = "=1.17.0"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
|
|
@ -24,7 +24,6 @@ import { DialogService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { SetPinComponent } from "../../auth/components/set-pin.component";
|
import { SetPinComponent } from "../../auth/components/set-pin.component";
|
||||||
import { DesktopAutofillSettingsService } from "../../autofill/services/desktop-autofill-settings.service";
|
import { DesktopAutofillSettingsService } from "../../autofill/services/desktop-autofill-settings.service";
|
||||||
import { flagEnabled } from "../../platform/flags";
|
|
||||||
import { DesktopSettingsService } from "../../platform/services/desktop-settings.service";
|
import { DesktopSettingsService } from "../../platform/services/desktop-settings.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -146,7 +145,7 @@ export class SettingsComponent implements OnInit {
|
||||||
this.startToTrayDescText = this.i18nService.t(startToTrayKey + "Desc");
|
this.startToTrayDescText = this.i18nService.t(startToTrayKey + "Desc");
|
||||||
|
|
||||||
// DuckDuckGo browser is only for macos initially
|
// DuckDuckGo browser is only for macos initially
|
||||||
this.showDuckDuckGoIntegrationOption = flagEnabled("showDDGSetting") && isMac;
|
this.showDuckDuckGoIntegrationOption = isMac;
|
||||||
|
|
||||||
this.vaultTimeoutOptions = [
|
this.vaultTimeoutOptions = [
|
||||||
// { name: i18nService.t('immediately'), value: 0 },
|
// { name: i18nService.t('immediately'), value: 0 },
|
||||||
|
|
|
@ -494,7 +494,7 @@
|
||||||
"message": "Kansio poistettiin"
|
"message": "Kansio poistettiin"
|
||||||
},
|
},
|
||||||
"loginOrCreateNewAccount": {
|
"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": {
|
"createAccount": {
|
||||||
"message": "Luo tili"
|
"message": "Luo tili"
|
||||||
|
@ -2689,7 +2689,7 @@
|
||||||
"description": "Label indicating the most common import formats"
|
"description": "Label indicating the most common import formats"
|
||||||
},
|
},
|
||||||
"troubleshooting": {
|
"troubleshooting": {
|
||||||
"message": "Vianmääritys"
|
"message": "Vianselvitys"
|
||||||
},
|
},
|
||||||
"disableHardwareAccelerationRestart": {
|
"disableHardwareAccelerationRestart": {
|
||||||
"message": "Poista laitteistokiihdytys käytöstä ja käynnistä sovellus uudelleen"
|
"message": "Poista laitteistokiihdytys käytöstä ja käynnistä sovellus uudelleen"
|
||||||
|
|
|
@ -404,7 +404,7 @@
|
||||||
"message": "長度"
|
"message": "長度"
|
||||||
},
|
},
|
||||||
"passwordMinLength": {
|
"passwordMinLength": {
|
||||||
"message": "Minimum password length"
|
"message": "最小密碼長度"
|
||||||
},
|
},
|
||||||
"uppercase": {
|
"uppercase": {
|
||||||
"message": "大寫 (A-Z)"
|
"message": "大寫 (A-Z)"
|
||||||
|
@ -561,10 +561,10 @@
|
||||||
"message": "帳戶已建立!現在可以登入了。"
|
"message": "帳戶已建立!現在可以登入了。"
|
||||||
},
|
},
|
||||||
"youSuccessfullyLoggedIn": {
|
"youSuccessfullyLoggedIn": {
|
||||||
"message": "You successfully logged in"
|
"message": "你已成功登入"
|
||||||
},
|
},
|
||||||
"youMayCloseThisWindow": {
|
"youMayCloseThisWindow": {
|
||||||
"message": "You may close this window"
|
"message": "你可以關閉此視窗"
|
||||||
},
|
},
|
||||||
"masterPassSent": {
|
"masterPassSent": {
|
||||||
"message": "已寄出包含您主密碼提示的電子郵件。"
|
"message": "已寄出包含您主密碼提示的電子郵件。"
|
||||||
|
@ -1546,15 +1546,15 @@
|
||||||
"message": "設定主密碼"
|
"message": "設定主密碼"
|
||||||
},
|
},
|
||||||
"orgPermissionsUpdatedMustSetPassword": {
|
"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"
|
"description": "Used as a card title description on the set password page to explain why the user is there"
|
||||||
},
|
},
|
||||||
"orgRequiresYouToSetPassword": {
|
"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"
|
"description": "Used as a card title description on the set password page to explain why the user is there"
|
||||||
},
|
},
|
||||||
"verificationRequired": {
|
"verificationRequired": {
|
||||||
"message": "Verification required",
|
"message": "需要驗證",
|
||||||
"description": "Default title for the user verification dialog."
|
"description": "Default title for the user verification dialog."
|
||||||
},
|
},
|
||||||
"currentMasterPass": {
|
"currentMasterPass": {
|
||||||
|
@ -1645,10 +1645,10 @@
|
||||||
"message": "在您的桌面和瀏覽器閒建立連綫時,透過要求指紋短語確認,以添加一個額外的安全層。每次建立連綫都需要使用者干預和驗證。"
|
"message": "在您的桌面和瀏覽器閒建立連綫時,透過要求指紋短語確認,以添加一個額外的安全層。每次建立連綫都需要使用者干預和驗證。"
|
||||||
},
|
},
|
||||||
"enableHardwareAcceleration": {
|
"enableHardwareAcceleration": {
|
||||||
"message": "Use hardware acceleration"
|
"message": "使用硬體加速"
|
||||||
},
|
},
|
||||||
"enableHardwareAccelerationDesc": {
|
"enableHardwareAccelerationDesc": {
|
||||||
"message": "By default this setting is ON. Turn OFF only if you experience graphical issues. Restart is required."
|
"message": "此設定預設為開啟。僅當你遇到圖形問題時才關閉。需要重新啟動。"
|
||||||
},
|
},
|
||||||
"approve": {
|
"approve": {
|
||||||
"message": "核准"
|
"message": "核准"
|
||||||
|
@ -1889,40 +1889,40 @@
|
||||||
"message": "您的主密碼不符合一個或多個組織原則要求。您必須立即更新您的主密碼才能存取密碼庫。進行此動作將登出您目前的工作階段,需要您重新登入。其他裝置上的工作階段可能繼續長達一小時。"
|
"message": "您的主密碼不符合一個或多個組織原則要求。您必須立即更新您的主密碼才能存取密碼庫。進行此動作將登出您目前的工作階段,需要您重新登入。其他裝置上的工作階段可能繼續長達一小時。"
|
||||||
},
|
},
|
||||||
"tryAgain": {
|
"tryAgain": {
|
||||||
"message": "Try again"
|
"message": "再試一次"
|
||||||
},
|
},
|
||||||
"verificationRequiredForActionSetPinToContinue": {
|
"verificationRequiredForActionSetPinToContinue": {
|
||||||
"message": "Verification required for this action. Set a PIN to continue."
|
"message": "此操作需要驗證。設定 PIN 碼以繼續。"
|
||||||
},
|
},
|
||||||
"setPin": {
|
"setPin": {
|
||||||
"message": "Set PIN"
|
"message": "設定 PIN 碼"
|
||||||
},
|
},
|
||||||
"verifyWithBiometrics": {
|
"verifyWithBiometrics": {
|
||||||
"message": "Verify with biometrics"
|
"message": "使用生物辨識進行驗證"
|
||||||
},
|
},
|
||||||
"awaitingConfirmation": {
|
"awaitingConfirmation": {
|
||||||
"message": "Awaiting confirmation"
|
"message": "正在等待確認"
|
||||||
},
|
},
|
||||||
"couldNotCompleteBiometrics": {
|
"couldNotCompleteBiometrics": {
|
||||||
"message": "Could not complete biometrics."
|
"message": "無法完成生物辨識。"
|
||||||
},
|
},
|
||||||
"needADifferentMethod": {
|
"needADifferentMethod": {
|
||||||
"message": "Need a different method?"
|
"message": "需要不同的方法嗎?"
|
||||||
},
|
},
|
||||||
"useMasterPassword": {
|
"useMasterPassword": {
|
||||||
"message": "Use master password"
|
"message": "使用主密碼"
|
||||||
},
|
},
|
||||||
"usePin": {
|
"usePin": {
|
||||||
"message": "Use PIN"
|
"message": "使用 PIN 碼"
|
||||||
},
|
},
|
||||||
"useBiometrics": {
|
"useBiometrics": {
|
||||||
"message": "Use biometrics"
|
"message": "使用生物辨識"
|
||||||
},
|
},
|
||||||
"enterVerificationCodeSentToEmail": {
|
"enterVerificationCodeSentToEmail": {
|
||||||
"message": "Enter the verification code that was sent to your email."
|
"message": "Enter the verification code that was sent to your email."
|
||||||
},
|
},
|
||||||
"resendCode": {
|
"resendCode": {
|
||||||
"message": "Resend code"
|
"message": "重新傳送驗證碼"
|
||||||
},
|
},
|
||||||
"hours": {
|
"hours": {
|
||||||
"message": "小時"
|
"message": "小時"
|
||||||
|
@ -2465,7 +2465,7 @@
|
||||||
"message": "全部清除"
|
"message": "全部清除"
|
||||||
},
|
},
|
||||||
"plusNMore": {
|
"plusNMore": {
|
||||||
"message": "+ $QUANTITY$ more",
|
"message": "+ $QUANTITY$ 個更多",
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
"quantity": {
|
"quantity": {
|
||||||
"content": "$1",
|
"content": "$1",
|
||||||
|
@ -2477,7 +2477,7 @@
|
||||||
"message": "子選單"
|
"message": "子選單"
|
||||||
},
|
},
|
||||||
"skipToContent": {
|
"skipToContent": {
|
||||||
"message": "Skip to content"
|
"message": "跳至內容"
|
||||||
},
|
},
|
||||||
"typePasskey": {
|
"typePasskey": {
|
||||||
"message": "密碼金鑰"
|
"message": "密碼金鑰"
|
||||||
|
@ -2621,13 +2621,13 @@
|
||||||
"message": "使用者名稱或密碼不正確"
|
"message": "使用者名稱或密碼不正確"
|
||||||
},
|
},
|
||||||
"incorrectPassword": {
|
"incorrectPassword": {
|
||||||
"message": "Incorrect password"
|
"message": "密碼不正確"
|
||||||
},
|
},
|
||||||
"incorrectCode": {
|
"incorrectCode": {
|
||||||
"message": "Incorrect code"
|
"message": "驗證碼不正確"
|
||||||
},
|
},
|
||||||
"incorrectPin": {
|
"incorrectPin": {
|
||||||
"message": "Incorrect PIN"
|
"message": "PIN 碼不正確"
|
||||||
},
|
},
|
||||||
"multifactorAuthenticationFailed": {
|
"multifactorAuthenticationFailed": {
|
||||||
"message": "多因素驗證失敗"
|
"message": "多因素驗證失敗"
|
||||||
|
@ -2685,22 +2685,22 @@
|
||||||
"message": "將與您的 LastPass 帳戶關聯的 YubiKey 插入電腦的 USB 連接埠,然後觸摸其按鈕。"
|
"message": "將與您的 LastPass 帳戶關聯的 YubiKey 插入電腦的 USB 連接埠,然後觸摸其按鈕。"
|
||||||
},
|
},
|
||||||
"commonImportFormats": {
|
"commonImportFormats": {
|
||||||
"message": "Common formats",
|
"message": "常見格式",
|
||||||
"description": "Label indicating the most common import formats"
|
"description": "Label indicating the most common import formats"
|
||||||
},
|
},
|
||||||
"troubleshooting": {
|
"troubleshooting": {
|
||||||
"message": "Troubleshooting"
|
"message": "疑難排解"
|
||||||
},
|
},
|
||||||
"disableHardwareAccelerationRestart": {
|
"disableHardwareAccelerationRestart": {
|
||||||
"message": "Disable hardware acceleration and restart"
|
"message": "停用硬體加速並重新啟動"
|
||||||
},
|
},
|
||||||
"enableHardwareAccelerationRestart": {
|
"enableHardwareAccelerationRestart": {
|
||||||
"message": "Enable hardware acceleration and restart"
|
"message": "啟用硬體加速並重新啟動"
|
||||||
},
|
},
|
||||||
"removePasskey": {
|
"removePasskey": {
|
||||||
"message": "Remove passkey"
|
"message": "移除金鑰"
|
||||||
},
|
},
|
||||||
"passkeyRemoved": {
|
"passkeyRemoved": {
|
||||||
"message": "Passkey removed"
|
"message": "金鑰已移除"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,13 +7,11 @@ import {
|
||||||
} from "@bitwarden/common/platform/misc/flags";
|
} from "@bitwarden/common/platform/misc/flags";
|
||||||
|
|
||||||
// required to avoid linting errors when there are no 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 = {
|
export type Flags = {} & SharedFlags;
|
||||||
showDDGSetting?: boolean;
|
|
||||||
} & SharedFlags;
|
|
||||||
|
|
||||||
// required to avoid linting errors when there are no 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 DevFlags = {} & SharedDevFlags;
|
export type DevFlags = {} & SharedDevFlags;
|
||||||
|
|
||||||
export function flagEnabled(flag: keyof Flags): boolean {
|
export function flagEnabled(flag: keyof Flags): boolean {
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
"allowedHosts": "auto"
|
"allowedHosts": "auto"
|
||||||
},
|
},
|
||||||
"flags": {
|
"flags": {
|
||||||
"secretsManager": false,
|
|
||||||
"showPasswordless": false,
|
"showPasswordless": false,
|
||||||
"enableCipherKeyEncryption": false
|
"enableCipherKeyEncryption": false
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
"proxyNotifications": "https://notifications.bitwarden.com"
|
"proxyNotifications": "https://notifications.bitwarden.com"
|
||||||
},
|
},
|
||||||
"flags": {
|
"flags": {
|
||||||
"secretsManager": true,
|
|
||||||
"showPasswordless": true,
|
"showPasswordless": true,
|
||||||
"enableCipherKeyEncryption": false
|
"enableCipherKeyEncryption": false
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"flags": {
|
"flags": {
|
||||||
"secretsManager": true,
|
|
||||||
"showPasswordless": true,
|
"showPasswordless": true,
|
||||||
"enableCipherKeyEncryption": false
|
"enableCipherKeyEncryption": false
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
"buttonAction": "https://www.paypal.com/cgi-bin/webscr"
|
"buttonAction": "https://www.paypal.com/cgi-bin/webscr"
|
||||||
},
|
},
|
||||||
"flags": {
|
"flags": {
|
||||||
"secretsManager": true,
|
|
||||||
"showPasswordless": true,
|
"showPasswordless": true,
|
||||||
"enableCipherKeyEncryption": false
|
"enableCipherKeyEncryption": false
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"flags": {
|
"flags": {
|
||||||
"secretsManager": true,
|
|
||||||
"showPasswordless": true
|
"showPasswordless": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"flags": {
|
"flags": {
|
||||||
"secretsManager": true,
|
|
||||||
"showPasswordless": true,
|
"showPasswordless": true,
|
||||||
"enableCipherKeyEncryption": false
|
"enableCipherKeyEncryption": false
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
"port": 8081
|
"port": 8081
|
||||||
},
|
},
|
||||||
"flags": {
|
"flags": {
|
||||||
"secretsManager": true,
|
|
||||||
"showPasswordless": true,
|
"showPasswordless": true,
|
||||||
"enableCipherKeyEncryption": false
|
"enableCipherKeyEncryption": false
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
"scim": "https://scim.usdev.bitwarden.pw"
|
"scim": "https://scim.usdev.bitwarden.pw"
|
||||||
},
|
},
|
||||||
"flags": {
|
"flags": {
|
||||||
"secretsManager": true,
|
|
||||||
"showPasswordless": true
|
"showPasswordless": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@bitwarden/web-vault",
|
"name": "@bitwarden/web-vault",
|
||||||
"version": "2024.3.1",
|
"version": "2024.4.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:oss": "webpack",
|
"build:oss": "webpack",
|
||||||
"build:bit": "webpack -c ../../bitwarden_license/bit-web/webpack.config.js",
|
"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: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": "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: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: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: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",
|
"build:bit:euqa": "cross-env NODE_ENV=production ENV=euqa npm run build:bit",
|
||||||
|
|
|
@ -52,7 +52,6 @@ import { Collection } from "@bitwarden/common/vault/models/domain/collection";
|
||||||
import { CollectionDetailsResponse } from "@bitwarden/common/vault/models/response/collection.response";
|
import { CollectionDetailsResponse } from "@bitwarden/common/vault/models/response/collection.response";
|
||||||
import { DialogService, SimpleDialogOptions } from "@bitwarden/components";
|
import { DialogService, SimpleDialogOptions } from "@bitwarden/components";
|
||||||
|
|
||||||
import { flagEnabled } from "../../../../utils/flags";
|
|
||||||
import { openEntityEventsDialog } from "../../../admin-console/organizations/manage/entity-events.component";
|
import { openEntityEventsDialog } from "../../../admin-console/organizations/manage/entity-events.component";
|
||||||
import { BasePeopleComponent } from "../../common/base.people.component";
|
import { BasePeopleComponent } from "../../common/base.people.component";
|
||||||
import { GroupService } from "../core";
|
import { GroupService } from "../core";
|
||||||
|
@ -148,9 +147,7 @@ export class PeopleComponent
|
||||||
shareReplay({ refCount: true, bufferSize: 1 }),
|
shareReplay({ refCount: true, bufferSize: 1 }),
|
||||||
);
|
);
|
||||||
|
|
||||||
this.canUseSecretsManager$ = organization$.pipe(
|
this.canUseSecretsManager$ = organization$.pipe(map((org) => org.useSecretsManager));
|
||||||
map((org) => org.useSecretsManager && flagEnabled("secretsManager")),
|
|
||||||
);
|
|
||||||
|
|
||||||
const policies$ = organization$.pipe(
|
const policies$ = organization$.pipe(
|
||||||
switchMap((organization) => {
|
switchMap((organization) => {
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
</select>
|
</select>
|
||||||
</bit-form-field>
|
</bit-form-field>
|
||||||
|
|
||||||
<bit-form-field class="tw-grow">
|
<bit-form-field class="tw-grow" *ngIf="!disabled">
|
||||||
<bit-label>{{ selectorLabelText }}</bit-label>
|
<bit-label>{{ selectorLabelText }}</bit-label>
|
||||||
<bit-multi-select
|
<bit-multi-select
|
||||||
class="tw-w-full"
|
class="tw-w-full"
|
||||||
|
@ -120,7 +120,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<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"
|
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"
|
[title]="permissionLabelId(item.readonlyPermission) | i18n"
|
||||||
>
|
>
|
||||||
|
@ -139,7 +139,7 @@
|
||||||
|
|
||||||
<td bitCell class="tw-text-right">
|
<td bitCell class="tw-text-right">
|
||||||
<button
|
<button
|
||||||
*ngIf="!item.readonly"
|
*ngIf="!disabled && !item.readonly"
|
||||||
type="button"
|
type="button"
|
||||||
bitIconButton="bwi-close"
|
bitIconButton="bwi-close"
|
||||||
buttonType="muted"
|
buttonType="muted"
|
||||||
|
|
|
@ -121,6 +121,13 @@ export class AccessSelectorComponent implements ControlValueAccessor, OnInit, On
|
||||||
protected permissionList: Permission[];
|
protected permissionList: Permission[];
|
||||||
protected initialPermission = CollectionPermission.View;
|
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;
|
disabled: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -225,6 +232,7 @@ export class AccessSelectorComponent implements ControlValueAccessor, OnInit, On
|
||||||
|
|
||||||
// Keep the internal FormGroup in sync
|
// Keep the internal FormGroup in sync
|
||||||
if (this.disabled) {
|
if (this.disabled) {
|
||||||
|
this.permissionMode = PermissionMode.Readonly;
|
||||||
this.formGroup.disable();
|
this.formGroup.disable();
|
||||||
} else {
|
} else {
|
||||||
this.formGroup.enable();
|
this.formGroup.enable();
|
||||||
|
|
|
@ -47,7 +47,11 @@ interface OnSuccessArgs {
|
||||||
organizationId: string;
|
organizationId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Allowed2020PlanTypes = [
|
const AllowedLegacyPlanTypes = [
|
||||||
|
PlanType.TeamsMonthly2023,
|
||||||
|
PlanType.TeamsAnnually2023,
|
||||||
|
PlanType.EnterpriseAnnually2023,
|
||||||
|
PlanType.EnterpriseMonthly2023,
|
||||||
PlanType.TeamsMonthly2020,
|
PlanType.TeamsMonthly2020,
|
||||||
PlanType.TeamsAnnually2020,
|
PlanType.TeamsAnnually2020,
|
||||||
PlanType.EnterpriseAnnually2020,
|
PlanType.EnterpriseAnnually2020,
|
||||||
|
@ -278,7 +282,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
|
||||||
(!this.currentPlan || this.currentPlan.upgradeSortOrder < plan.upgradeSortOrder) &&
|
(!this.currentPlan || this.currentPlan.upgradeSortOrder < plan.upgradeSortOrder) &&
|
||||||
(!this.hasProvider || plan.product !== ProductType.TeamsStarter) &&
|
(!this.hasProvider || plan.product !== ProductType.TeamsStarter) &&
|
||||||
((!this.isProviderQualifiedFor2020Plan() && this.planIsEnabled(plan)) ||
|
((!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);
|
result.sort((planA, planB) => planA.displaySortOrder - planB.displaySortOrder);
|
||||||
|
@ -293,7 +297,7 @@ export class OrganizationPlansComponent implements OnInit, OnDestroy {
|
||||||
(plan) =>
|
(plan) =>
|
||||||
plan.product === selectedProductType &&
|
plan.product === selectedProductType &&
|
||||||
((!this.isProviderQualifiedFor2020Plan() && this.planIsEnabled(plan)) ||
|
((!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);
|
result.sort((planA, planB) => planA.displaySortOrder - planB.displaySortOrder);
|
||||||
|
|
|
@ -241,6 +241,8 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
|
||||||
return (
|
return (
|
||||||
this.sub.planType === PlanType.EnterpriseAnnually ||
|
this.sub.planType === PlanType.EnterpriseAnnually ||
|
||||||
this.sub.planType === PlanType.EnterpriseMonthly ||
|
this.sub.planType === PlanType.EnterpriseMonthly ||
|
||||||
|
this.sub.planType === PlanType.EnterpriseAnnually2023 ||
|
||||||
|
this.sub.planType === PlanType.EnterpriseMonthly2023 ||
|
||||||
this.sub.planType === PlanType.EnterpriseAnnually2020 ||
|
this.sub.planType === PlanType.EnterpriseAnnually2020 ||
|
||||||
this.sub.planType === PlanType.EnterpriseMonthly2020 ||
|
this.sub.planType === PlanType.EnterpriseMonthly2020 ||
|
||||||
this.sub.planType === PlanType.EnterpriseAnnually2019 ||
|
this.sub.planType === PlanType.EnterpriseAnnually2019 ||
|
||||||
|
@ -254,6 +256,7 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
|
||||||
} else if (
|
} else if (
|
||||||
this.sub.planType === PlanType.FamiliesAnnually ||
|
this.sub.planType === PlanType.FamiliesAnnually ||
|
||||||
this.sub.planType === PlanType.FamiliesAnnually2019 ||
|
this.sub.planType === PlanType.FamiliesAnnually2019 ||
|
||||||
|
this.sub.planType === PlanType.TeamsStarter2023 ||
|
||||||
this.sub.planType === PlanType.TeamsStarter
|
this.sub.planType === PlanType.TeamsStarter
|
||||||
) {
|
) {
|
||||||
if (this.isSponsoredSubscription) {
|
if (this.isSponsoredSubscription) {
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<ng-template [ngIf]="isEnabled">
|
<button
|
||||||
<button
|
type="button"
|
||||||
type="button"
|
bitIconButton="bwi bwi-fw bwi-filter"
|
||||||
bitIconButton="bwi bwi-fw bwi-filter"
|
[bitMenuTriggerFor]="content?.menu"
|
||||||
[bitMenuTriggerFor]="content?.menu"
|
[buttonType]="buttonType"
|
||||||
[buttonType]="buttonType"
|
[attr.aria-label]="'switchProducts' | i18n"
|
||||||
[attr.aria-label]="'switchProducts' | i18n"
|
></button>
|
||||||
></button>
|
<product-switcher-content #content></product-switcher-content>
|
||||||
<product-switcher-content #content></product-switcher-content>
|
|
||||||
</ng-template>
|
|
||||||
|
|
|
@ -1,16 +1,11 @@
|
||||||
import { AfterViewInit, ChangeDetectorRef, Component, Input } from "@angular/core";
|
import { AfterViewInit, ChangeDetectorRef, Component, Input } from "@angular/core";
|
||||||
|
|
||||||
import { IconButtonType } from "@bitwarden/components/src/icon-button/icon-button.component";
|
import { IconButtonType } from "@bitwarden/components/src/icon-button/icon-button.component";
|
||||||
|
|
||||||
import { flagEnabled } from "../../../utils/flags";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "product-switcher",
|
selector: "product-switcher",
|
||||||
templateUrl: "./product-switcher.component.html",
|
templateUrl: "./product-switcher.component.html",
|
||||||
})
|
})
|
||||||
export class ProductSwitcherComponent implements AfterViewInit {
|
export class ProductSwitcherComponent implements AfterViewInit {
|
||||||
protected isEnabled = flagEnabled("secretsManager");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Passed to the product switcher's `bitIconButton`
|
* Passed to the product switcher's `bitIconButton`
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -65,17 +65,22 @@
|
||||||
</bit-tab>
|
</bit-tab>
|
||||||
<bit-tab label="{{ 'access' | i18n }}">
|
<bit-tab label="{{ 'access' | i18n }}">
|
||||||
<div class="tw-mb-3" *ngIf="organization.flexibleCollections">
|
<div class="tw-mb-3" *ngIf="organization.flexibleCollections">
|
||||||
<span *ngIf="organization.useGroups">{{ "grantCollectionAccess" | i18n }}</span>
|
<ng-container *ngIf="dialogReadonly">
|
||||||
<span *ngIf="!organization.useGroups">{{
|
<span>{{ "readOnlyCollectionAccess" | i18n }}</span>
|
||||||
"grantCollectionAccessMembersOnly" | i18n
|
</ng-container>
|
||||||
}}</span>
|
<ng-container *ngIf="!dialogReadonly">
|
||||||
<span
|
<span *ngIf="organization.useGroups">{{ "grantCollectionAccess" | i18n }}</span>
|
||||||
*ngIf="
|
<span *ngIf="!organization.useGroups">{{
|
||||||
(flexibleCollectionsV1Enabled$ | async) &&
|
"grantCollectionAccessMembersOnly" | i18n
|
||||||
organization.allowAdminAccessToAllCollectionItems
|
}}</span>
|
||||||
"
|
<span
|
||||||
>{{ " " + ("adminCollectionAccess" | i18n) }}</span
|
*ngIf="
|
||||||
>
|
(flexibleCollectionsV1Enabled$ | async) &&
|
||||||
|
organization.allowAdminAccessToAllCollectionItems
|
||||||
|
"
|
||||||
|
>{{ " " + ("adminCollectionAccess" | i18n) }}</span
|
||||||
|
>
|
||||||
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="tw-mb-3 tw-text-danger"
|
class="tw-mb-3 tw-text-danger"
|
||||||
|
@ -85,7 +90,7 @@
|
||||||
</div>
|
</div>
|
||||||
<bit-access-selector
|
<bit-access-selector
|
||||||
*ngIf="organization.useGroups"
|
*ngIf="organization.useGroups"
|
||||||
[permissionMode]="PermissionMode.Edit"
|
[permissionMode]="dialogReadonly ? PermissionMode.Readonly : PermissionMode.Edit"
|
||||||
formControlName="access"
|
formControlName="access"
|
||||||
[items]="accessItems"
|
[items]="accessItems"
|
||||||
[columnHeader]="'groupSlashMemberColumnHeader' | i18n"
|
[columnHeader]="'groupSlashMemberColumnHeader' | i18n"
|
||||||
|
@ -96,7 +101,7 @@
|
||||||
></bit-access-selector>
|
></bit-access-selector>
|
||||||
<bit-access-selector
|
<bit-access-selector
|
||||||
*ngIf="!organization.useGroups"
|
*ngIf="!organization.useGroups"
|
||||||
[permissionMode]="PermissionMode.Edit"
|
[permissionMode]="dialogReadonly ? PermissionMode.Readonly : PermissionMode.Edit"
|
||||||
formControlName="access"
|
formControlName="access"
|
||||||
[items]="accessItems"
|
[items]="accessItems"
|
||||||
[columnHeader]="'memberColumnHeader' | i18n"
|
[columnHeader]="'memberColumnHeader' | i18n"
|
||||||
|
@ -108,7 +113,13 @@
|
||||||
</bit-tab-group>
|
</bit-tab-group>
|
||||||
</div>
|
</div>
|
||||||
<ng-container bitDialogFooter>
|
<ng-container bitDialogFooter>
|
||||||
<button type="submit" bitButton bitFormButton buttonType="primary" [disabled]="loading">
|
<button
|
||||||
|
type="submit"
|
||||||
|
bitButton
|
||||||
|
bitFormButton
|
||||||
|
buttonType="primary"
|
||||||
|
[disabled]="loading || dialogReadonly"
|
||||||
|
>
|
||||||
{{ "save" | i18n }}
|
{{ "save" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
|
|
|
@ -16,6 +16,7 @@ import { first } from "rxjs/operators";
|
||||||
|
|
||||||
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
|
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 { 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 { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
|
||||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
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 { CollectionView } from "@bitwarden/common/vault/models/view/collection.view";
|
||||||
import { BitValidators, DialogService } from "@bitwarden/components";
|
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 { PermissionMode } from "../../../admin-console/organizations/shared/components/access-selector/access-selector.component";
|
||||||
import {
|
import {
|
||||||
AccessItemType,
|
AccessItemType,
|
||||||
|
@ -36,8 +41,6 @@ import {
|
||||||
CollectionPermission,
|
CollectionPermission,
|
||||||
convertToPermission,
|
convertToPermission,
|
||||||
convertToSelectionView,
|
convertToSelectionView,
|
||||||
mapGroupToAccessItemView,
|
|
||||||
mapUserToAccessItemView,
|
|
||||||
} from "../../../admin-console/organizations/shared/components/access-selector/access-selector.models";
|
} from "../../../admin-console/organizations/shared/components/access-selector/access-selector.models";
|
||||||
import { CollectionAdminService } from "../../core/collection-admin.service";
|
import { CollectionAdminService } from "../../core/collection-admin.service";
|
||||||
import { CollectionAdminView } from "../../core/views/collection-admin.view";
|
import { CollectionAdminView } from "../../core/views/collection-admin.view";
|
||||||
|
@ -54,6 +57,7 @@ export interface CollectionDialogParams {
|
||||||
parentCollectionId?: string;
|
parentCollectionId?: string;
|
||||||
showOrgSelector?: boolean;
|
showOrgSelector?: boolean;
|
||||||
collectionIds?: string[];
|
collectionIds?: string[];
|
||||||
|
readonly?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CollectionDialogResult {
|
export interface CollectionDialogResult {
|
||||||
|
@ -158,7 +162,8 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
||||||
? from(this.collectionAdminService.get(orgId, this.params.collectionId))
|
? from(this.collectionAdminService.get(orgId, this.params.collectionId))
|
||||||
: of(null),
|
: of(null),
|
||||||
groups: groups$,
|
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
|
collection: this.params.collectionId
|
||||||
? this.collectionService.get(this.params.collectionId)
|
? this.collectionService.get(this.params.collectionId)
|
||||||
: of(null),
|
: of(null),
|
||||||
|
@ -177,8 +182,8 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
||||||
}) => {
|
}) => {
|
||||||
this.organization = organization;
|
this.organization = organization;
|
||||||
this.accessItems = [].concat(
|
this.accessItems = [].concat(
|
||||||
groups.map(mapGroupToAccessItemView),
|
groups.map((group) => mapGroupToAccessItemView(group, this.collectionId)),
|
||||||
users.data.map(mapUserToAccessItemView),
|
users.data.map((user) => mapUserToAccessItemView(user, this.collectionId)),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Force change detection to update the access selector's items
|
// Force change detection to update the access selector's items
|
||||||
|
@ -209,7 +214,7 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
||||||
access: accessSelections,
|
access: accessSelections,
|
||||||
});
|
});
|
||||||
this.collection.manage = collection?.manage ?? false; // Get manage flag from sync data collection
|
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 {
|
} else {
|
||||||
this.nestOptions = collections;
|
this.nestOptions = collections;
|
||||||
const parent = collections.find((c) => c.id === this.params.parentCollectionId);
|
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.formGroup.controls.access.updateValueAndValidity();
|
||||||
|
|
||||||
|
this.handleFormGroupReadonly(this.dialogReadonly);
|
||||||
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -257,11 +264,20 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
||||||
return this.params.collectionId != undefined;
|
return this.params.collectionId != undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected get dialogReadonly() {
|
||||||
|
return this.params.readonly === true;
|
||||||
|
}
|
||||||
|
|
||||||
protected async cancel() {
|
protected async cancel() {
|
||||||
this.close(CollectionDialogAction.Canceled);
|
this.close(CollectionDialogAction.Canceled);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected submit = async () => {
|
protected submit = async () => {
|
||||||
|
// Saving a collection is prohibited while in read only mode
|
||||||
|
if (this.dialogReadonly) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.formGroup.markAllAsTouched();
|
this.formGroup.markAllAsTouched();
|
||||||
|
|
||||||
if (this.formGroup.invalid) {
|
if (this.formGroup.invalid) {
|
||||||
|
@ -316,6 +332,11 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
||||||
};
|
};
|
||||||
|
|
||||||
protected delete = async () => {
|
protected delete = async () => {
|
||||||
|
// Deleting a collection is prohibited while in read only mode
|
||||||
|
if (this.dialogReadonly) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const confirmed = await this.dialogService.openSimpleDialog({
|
const confirmed = await this.dialogService.openSimpleDialog({
|
||||||
title: this.collection?.name,
|
title: this.collection?.name,
|
||||||
content: { key: "deleteCollectionConfirmation" },
|
content: { key: "deleteCollectionConfirmation" },
|
||||||
|
@ -342,6 +363,20 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
||||||
this.destroy$.complete();
|
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) {
|
private close(action: CollectionDialogAction, collection?: CollectionResponse | CollectionView) {
|
||||||
this.dialogRef.close({ action, collection } as CollectionDialogResult);
|
this.dialogRef.close({ action, collection } as CollectionDialogResult);
|
||||||
}
|
}
|
||||||
|
@ -383,6 +418,50 @@ function validateCanManagePermission(control: AbstractControl) {
|
||||||
return hasManagePermission ? null : { managePermissionRequired: true };
|
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
|
* Strongly typed helper to open a CollectionDialog
|
||||||
* @param dialogService Instance of the dialog service that will be used to open the dialog
|
* @param dialogService Instance of the dialog service that will be used to open the dialog
|
||||||
|
|
|
@ -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";
|
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">
|
template: `<bit-no-items [icon]="icon" class="tw-mt-2 tw-block">
|
||||||
<span slot="title" class="tw-mt-4 tw-block">{{ "collectionAccessRestricted" | i18n }}</span>
|
<span slot="title" class="tw-mt-4 tw-block">{{ "collectionAccessRestricted" | i18n }}</span>
|
||||||
<button
|
<button
|
||||||
*ngIf="canEdit"
|
|
||||||
slot="button"
|
slot="button"
|
||||||
bitButton
|
bitButton
|
||||||
(click)="editInfoClicked.emit()"
|
(click)="viewCollectionClicked.emit()"
|
||||||
buttonType="secondary"
|
buttonType="secondary"
|
||||||
type="button"
|
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>
|
</button>
|
||||||
</bit-no-items>`,
|
</bit-no-items>`,
|
||||||
})
|
})
|
||||||
export class CollectionAccessRestrictedComponent {
|
export class CollectionAccessRestrictedComponent {
|
||||||
protected icon = icon;
|
protected icon = icon;
|
||||||
|
|
||||||
@Input() canEdit = false;
|
@Output() viewCollectionClicked = new EventEmitter<void>();
|
||||||
|
|
||||||
@Output() editInfoClicked = new EventEmitter<void>();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,11 +99,9 @@
|
||||||
</bit-no-items>
|
</bit-no-items>
|
||||||
<collection-access-restricted
|
<collection-access-restricted
|
||||||
*ngIf="showCollectionAccessRestricted"
|
*ngIf="showCollectionAccessRestricted"
|
||||||
[canEdit]="
|
(viewCollectionClicked)="
|
||||||
selectedCollection != null &&
|
editCollection(selectedCollection.node, CollectionDialogTabType.Info, true)
|
||||||
selectedCollection.node.canEdit(organization, flexibleCollectionsV1Enabled)
|
|
||||||
"
|
"
|
||||||
(editInfoClicked)="editCollection(selectedCollection.node, CollectionDialogTabType.Info)"
|
|
||||||
>
|
>
|
||||||
</collection-access-restricted>
|
</collection-access-restricted>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
|
@ -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, {
|
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);
|
const result = await lastValueFrom(dialog.closed);
|
||||||
|
|
|
@ -7501,6 +7501,9 @@
|
||||||
"collectionAccessRestricted": {
|
"collectionAccessRestricted": {
|
||||||
"message": "Collection access is restricted"
|
"message": "Collection access is restricted"
|
||||||
},
|
},
|
||||||
|
"readOnlyCollectionAccess": {
|
||||||
|
"message": "You do not have access to manage this collection."
|
||||||
|
},
|
||||||
"grantCollectionAccess": {
|
"grantCollectionAccess": {
|
||||||
"message": "Grant groups or members access to this collection."
|
"message": "Grant groups or members access to this collection."
|
||||||
},
|
},
|
||||||
|
@ -7603,6 +7606,9 @@
|
||||||
"providerPortal": {
|
"providerPortal": {
|
||||||
"message": "Provider Portal"
|
"message": "Provider Portal"
|
||||||
},
|
},
|
||||||
|
"viewCollection": {
|
||||||
|
"message": "View collection"
|
||||||
|
},
|
||||||
"restrictedGroupAccess": {
|
"restrictedGroupAccess": {
|
||||||
"message": "You cannot add yourself to groups."
|
"message": "You cannot add yourself to groups."
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,14 +7,13 @@ import {
|
||||||
} from "@bitwarden/common/platform/misc/flags";
|
} from "@bitwarden/common/platform/misc/flags";
|
||||||
|
|
||||||
// required to avoid linting errors when there are no 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 = {
|
export type Flags = {
|
||||||
secretsManager?: boolean;
|
|
||||||
showPasswordless?: boolean;
|
showPasswordless?: boolean;
|
||||||
} & SharedFlags;
|
} & SharedFlags;
|
||||||
|
|
||||||
// required to avoid linting errors when there are no 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 DevFlags = {} & SharedDevFlags;
|
export type DevFlags = {} & SharedDevFlags;
|
||||||
|
|
||||||
export function flagEnabled(flag: keyof Flags): boolean {
|
export function flagEnabled(flag: keyof Flags): boolean {
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<bit-hint>{{ "domainNameInputHint" | i18n }}</bit-hint>
|
<bit-hint>{{ "domainNameInputHint" | i18n }}</bit-hint>
|
||||||
</bit-form-field>
|
</bit-form-field>
|
||||||
|
|
||||||
<bit-form-field>
|
<bit-form-field *ngIf="data?.orgDomain">
|
||||||
<bit-label>{{ "dnsTxtRecord" | i18n }}</bit-label>
|
<bit-label>{{ "dnsTxtRecord" | i18n }}</bit-label>
|
||||||
<input bitInput formControlName="txt" />
|
<input bitInput formControlName="txt" />
|
||||||
<bit-hint>{{ "dnsTxtRecordInputHint" | i18n }}</bit-hint>
|
<bit-hint>{{ "dnsTxtRecordInputHint" | i18n }}</bit-hint>
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
</bit-form-field>
|
</bit-form-field>
|
||||||
|
|
||||||
<bit-callout
|
<bit-callout
|
||||||
*ngIf="!data?.orgDomain?.verifiedDate"
|
*ngIf="data?.orgDomain && !data?.orgDomain?.verifiedDate"
|
||||||
type="info"
|
type="info"
|
||||||
title="{{ 'automaticDomainVerification' | i18n }}"
|
title="{{ 'automaticDomainVerification' | i18n }}"
|
||||||
>
|
>
|
||||||
|
@ -51,7 +51,10 @@
|
||||||
</div>
|
</div>
|
||||||
<ng-container bitDialogFooter>
|
<ng-container bitDialogFooter>
|
||||||
<button type="submit" bitButton bitFormButton buttonType="primary">
|
<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>
|
<span *ngIf="data?.orgDomain?.verifiedDate">{{ "reverifyDomain" | i18n }}</span>
|
||||||
</button>
|
</button>
|
||||||
<button bitButton buttonType="secondary" (click)="dialogRef.close()" type="button">
|
<button bitButton buttonType="secondary" (click)="dialogRef.close()" type="button">
|
||||||
|
|
|
@ -13,7 +13,6 @@ import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "@bitw
|
||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service";
|
import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service";
|
||||||
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { domainNameValidator } from "./validators/domain-name.validator";
|
import { domainNameValidator } from "./validators/domain-name.validator";
|
||||||
|
@ -90,17 +89,6 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
|
||||||
// Edit
|
// Edit
|
||||||
this.domainForm.patchValue(this.data.orgDomain);
|
this.domainForm.patchValue(this.data.orgDomain);
|
||||||
this.domainForm.disable();
|
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();
|
this.setupFormListeners();
|
||||||
|
@ -121,6 +109,7 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
|
||||||
// End Form methods
|
// End Form methods
|
||||||
|
|
||||||
// Async Form Actions
|
// 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> => {
|
saveDomain = async (): Promise<void> => {
|
||||||
if (this.domainForm.invalid) {
|
if (this.domainForm.invalid) {
|
||||||
this.platformUtilsService.showToast("error", null, this.i18nService.t("domainFormInvalid"));
|
this.platformUtilsService.showToast("error", null, this.i18nService.t("domainFormInvalid"));
|
||||||
|
@ -130,14 +119,14 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
|
||||||
this.domainNameCtrl.disable();
|
this.domainNameCtrl.disable();
|
||||||
|
|
||||||
const request: OrganizationDomainRequest = new OrganizationDomainRequest(
|
const request: OrganizationDomainRequest = new OrganizationDomainRequest(
|
||||||
this.txtCtrl.value,
|
|
||||||
this.domainNameCtrl.value,
|
this.domainNameCtrl.value,
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.data.orgDomain = await this.orgDomainApiService.post(this.data.organizationId, request);
|
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"));
|
this.platformUtilsService.showToast("success", null, this.i18nService.t("domainSaved"));
|
||||||
await this.verifyDomain();
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.handleDomainSaveError(e);
|
this.handleDomainSaveError(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ const DisallowedPlanTypes = [
|
||||||
PlanType.Free,
|
PlanType.Free,
|
||||||
PlanType.FamiliesAnnually2019,
|
PlanType.FamiliesAnnually2019,
|
||||||
PlanType.FamiliesAnnually,
|
PlanType.FamiliesAnnually,
|
||||||
|
PlanType.TeamsStarter2023,
|
||||||
PlanType.TeamsStarter,
|
PlanType.TeamsStarter,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { NgModule } from "@angular/core";
|
||||||
import { RouterModule, Routes } from "@angular/router";
|
import { RouterModule, Routes } from "@angular/router";
|
||||||
|
|
||||||
import { AuthGuard } from "@bitwarden/angular/auth/guards";
|
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 { organizationEnabledGuard } from "./guards/sm-org-enabled.guard";
|
||||||
import { canActivateSM } from "./guards/sm.guard";
|
import { canActivateSM } from "./guards/sm.guard";
|
||||||
|
@ -17,7 +16,7 @@ import { OrgSuspendedComponent } from "./shared/org-suspended.component";
|
||||||
import { TrashModule } from "./trash/trash.module";
|
import { TrashModule } from "./trash/trash.module";
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
buildFlaggedRoute("secretsManager", {
|
{
|
||||||
path: "",
|
path: "",
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
@ -86,7 +85,7 @@ const routes: Routes = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}),
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
export class OrganizationDomainRequest {
|
export class OrganizationDomainRequest {
|
||||||
txt: string;
|
|
||||||
domainName: string;
|
domainName: string;
|
||||||
|
|
||||||
constructor(txt: string, domainName: string) {
|
constructor(domainName: string) {
|
||||||
this.txt = txt;
|
|
||||||
this.domainName = domainName;
|
this.domainName = domainName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,14 @@ export enum PlanType {
|
||||||
TeamsAnnually2020 = 9,
|
TeamsAnnually2020 = 9,
|
||||||
EnterpriseMonthly2020 = 10,
|
EnterpriseMonthly2020 = 10,
|
||||||
EnterpriseAnnually2020 = 11,
|
EnterpriseAnnually2020 = 11,
|
||||||
TeamsMonthly = 12,
|
TeamsMonthly2023 = 12,
|
||||||
TeamsAnnually = 13,
|
TeamsAnnually2023 = 13,
|
||||||
EnterpriseMonthly = 14,
|
EnterpriseMonthly2023 = 14,
|
||||||
EnterpriseAnnually = 15,
|
EnterpriseAnnually2023 = 15,
|
||||||
TeamsStarter = 16,
|
TeamsStarter2023 = 16,
|
||||||
|
TeamsMonthly = 17,
|
||||||
|
TeamsAnnually = 18,
|
||||||
|
EnterpriseMonthly = 19,
|
||||||
|
EnterpriseAnnually = 20,
|
||||||
|
TeamsStarter = 21,
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,7 @@ export class OrganizationBillingService implements OrganizationBillingServiceAbs
|
||||||
case PlanType.Free:
|
case PlanType.Free:
|
||||||
case PlanType.FamiliesAnnually:
|
case PlanType.FamiliesAnnually:
|
||||||
case PlanType.FamiliesAnnually2019:
|
case PlanType.FamiliesAnnually2019:
|
||||||
|
case PlanType.TeamsStarter2023:
|
||||||
case PlanType.TeamsStarter:
|
case PlanType.TeamsStarter:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// required to avoid linting errors when there are no flags
|
// 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 = {
|
export type SharedFlags = {
|
||||||
multithreadDecryption: boolean;
|
multithreadDecryption: boolean;
|
||||||
showPasswordless?: boolean;
|
showPasswordless?: boolean;
|
||||||
|
@ -7,7 +7,7 @@ export type SharedFlags = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// required to avoid linting errors when there are no flags
|
// 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 = {
|
export type SharedDevFlags = {
|
||||||
noopNotifications: boolean;
|
noopNotifications: boolean;
|
||||||
};
|
};
|
||||||
|
|
|
@ -102,6 +102,7 @@ export const SM_ONBOARDING_DISK = new StateDefinition("smOnboarding", "disk", {
|
||||||
|
|
||||||
export const GENERATOR_DISK = new StateDefinition("generator", "disk");
|
export const GENERATOR_DISK = new StateDefinition("generator", "disk");
|
||||||
export const GENERATOR_MEMORY = new StateDefinition("generator", "memory");
|
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 EVENT_COLLECTION_DISK = new StateDefinition("eventCollection", "disk");
|
||||||
export const SEND_DISK = new StateDefinition("encryptedSend", "disk", {
|
export const SEND_DISK = new StateDefinition("encryptedSend", "disk", {
|
||||||
web: "memory",
|
web: "memory",
|
||||||
|
|
|
@ -168,7 +168,7 @@
|
||||||
"regedit": "^3.0.3",
|
"regedit": "^3.0.3",
|
||||||
"remark-gfm": "3.0.1",
|
"remark-gfm": "3.0.1",
|
||||||
"rimraf": "5.0.5",
|
"rimraf": "5.0.5",
|
||||||
"sass": "1.69.5",
|
"sass": "1.74.1",
|
||||||
"sass-loader": "13.3.3",
|
"sass-loader": "13.3.3",
|
||||||
"storybook": "7.6.17",
|
"storybook": "7.6.17",
|
||||||
"style-loader": "3.3.4",
|
"style-loader": "3.3.4",
|
||||||
|
@ -247,7 +247,7 @@
|
||||||
},
|
},
|
||||||
"apps/web": {
|
"apps/web": {
|
||||||
"name": "@bitwarden/web-vault",
|
"name": "@bitwarden/web-vault",
|
||||||
"version": "2024.3.1"
|
"version": "2024.4.0"
|
||||||
},
|
},
|
||||||
"libs/admin-console": {
|
"libs/admin-console": {
|
||||||
"name": "@bitwarden/admin-console",
|
"name": "@bitwarden/admin-console",
|
||||||
|
@ -33467,9 +33467,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/sass": {
|
"node_modules/sass": {
|
||||||
"version": "1.69.5",
|
"version": "1.74.1",
|
||||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.69.5.tgz",
|
"resolved": "https://registry.npmjs.org/sass/-/sass-1.74.1.tgz",
|
||||||
"integrity": "sha512-qg2+UCJibLr2LCVOt3OlPhr/dqVHWOa9XtZf2OjbLs/T4VPSJ00udtgJxH3neXZm+QqX8B+3cU7RaLqp1iVfcQ==",
|
"integrity": "sha512-w0Z9p/rWZWelb88ISOLyvqTWGmtmu2QJICqDBGyNnfG4OUnPX9BBjjYIXUpXCMOOg5MQWNpqzt876la1fsTvUA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chokidar": ">=3.0.0 <4.0.0",
|
"chokidar": ">=3.0.0 <4.0.0",
|
||||||
|
|
|
@ -129,7 +129,7 @@
|
||||||
"regedit": "^3.0.3",
|
"regedit": "^3.0.3",
|
||||||
"remark-gfm": "3.0.1",
|
"remark-gfm": "3.0.1",
|
||||||
"rimraf": "5.0.5",
|
"rimraf": "5.0.5",
|
||||||
"sass": "1.69.5",
|
"sass": "1.74.1",
|
||||||
"sass-loader": "13.3.3",
|
"sass-loader": "13.3.3",
|
||||||
"storybook": "7.6.17",
|
"storybook": "7.6.17",
|
||||||
"style-loader": "3.3.4",
|
"style-loader": "3.3.4",
|
||||||
|
|
Loading…
Reference in New Issue