1
0
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:
Nick Krantz
2025-06-27 12:55:20 -05:00
committed by GitHub
parent 4e3d83147e
commit cb36b96855
9 changed files with 250 additions and 2 deletions

View 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>;

View File

@@ -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";

View File

@@ -1,7 +1,9 @@
const VaultMessages = {
HasBwInstalled: "hasBwInstalled",
checkBwInstalled: "checkIfBWExtensionInstalled",
/** @deprecated use {@link OpenBrowserExtensionToUrl} */
OpenAtRiskPasswords: "openAtRiskPasswords",
OpenBrowserExtensionToUrl: "openBrowserExtensionToUrl",
PopupOpened: "popupOpened",
} as const;