mirror of
https://github.com/bitwarden/browser
synced 2025-12-10 05:13:29 +00:00
[PM-22178] Add WebBrowserInteractionService (#15261)
* add `WebBrowserInteractionService` and check for the extension observable * update checkForExtension to use observables rather than window timeouts * add open extension to WebBrowserInteractionService * add at-risk-passwords to `PopupPageUrls` * refactor `PopupPageUrls` to `ExtensionPageUrls` * add test for passing a page * refactor `Default` to `Index` * clean up complete/next issue using `race` * refactor page to url * continue listening for messages from the extension after subscribed * mark risk passwords a deprecated * remove takeUntilDestroyed * add back `takeUntilDestroyed` for internal `messages` * removed null filter - unneeded * add tap to send message for extension installation * add check for accepted urls to prevent any bad actors from opening the extension
This commit is contained in:
12
libs/common/src/vault/enums/extension-page-urls.enum.ts
Normal file
12
libs/common/src/vault/enums/extension-page-urls.enum.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { UnionOfValues } from "../types/union-of-values";
|
||||
|
||||
/**
|
||||
* Available pages within the extension by their URL.
|
||||
* Useful when opening a specific page within the popup.
|
||||
*/
|
||||
export const ExtensionPageUrls: Record<string, `popup/index.html#/${string}`> = {
|
||||
Index: "popup/index.html#/",
|
||||
AtRiskPasswords: "popup/index.html#/at-risk-passwords",
|
||||
} as const;
|
||||
|
||||
export type ExtensionPageUrls = UnionOfValues<typeof ExtensionPageUrls>;
|
||||
@@ -3,3 +3,4 @@ export * from "./cipher-type";
|
||||
export * from "./field-type.enum";
|
||||
export * from "./linked-id-type.enum";
|
||||
export * from "./secure-note-type.enum";
|
||||
export * from "./extension-page-urls.enum";
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
const VaultMessages = {
|
||||
HasBwInstalled: "hasBwInstalled",
|
||||
checkBwInstalled: "checkIfBWExtensionInstalled",
|
||||
/** @deprecated use {@link OpenBrowserExtensionToUrl} */
|
||||
OpenAtRiskPasswords: "openAtRiskPasswords",
|
||||
OpenBrowserExtensionToUrl: "openBrowserExtensionToUrl",
|
||||
PopupOpened: "popupOpened",
|
||||
} as const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user