diff --git a/apps/browser/src/autofill/background/overlay.background.spec.ts b/apps/browser/src/autofill/background/overlay.background.spec.ts index 02f99667112..988e1c11f78 100644 --- a/apps/browser/src/autofill/background/overlay.background.spec.ts +++ b/apps/browser/src/autofill/background/overlay.background.spec.ts @@ -236,7 +236,7 @@ describe("OverlayBackground", () => { expect(overlayBackground["getOverlayCipherData"]).toHaveBeenCalled(); }); - it("posts an `updateOverlayListCiphers` message to the overlay list port with the updated ciphers", async () => { + it("posts an `updateAutofillInlineMenuListCiphers` message to the overlay list port with the updated ciphers", async () => { overlayBackground["inlineMenuListPort"] = mock(); cipherService.getAllDecryptedForUrl.mockResolvedValue([cipher1, cipher2]); cipherService.sortCiphersByLastUsedThenName.mockReturnValue(-1); @@ -246,7 +246,7 @@ describe("OverlayBackground", () => { await overlayBackground.updateOverlayCiphers(); expect(overlayBackground["inlineMenuListPort"].postMessage).toHaveBeenCalledWith({ - command: "updateOverlayListCiphers", + command: "updateAutofillInlineMenuListCiphers", ciphers: [ { card: null, diff --git a/apps/browser/src/autofill/background/overlay.background.ts b/apps/browser/src/autofill/background/overlay.background.ts index edb0fff174c..46bcef8538f 100644 --- a/apps/browser/src/autofill/background/overlay.background.ts +++ b/apps/browser/src/autofill/background/overlay.background.ts @@ -190,7 +190,10 @@ class OverlayBackground implements OverlayBackgroundInterface { } const ciphers = await this.getOverlayCipherData(); - this.inlineMenuListPort?.postMessage({ command: "updateOverlayListCiphers", ciphers }); + this.inlineMenuListPort?.postMessage({ + command: "updateAutofillInlineMenuListCiphers", + ciphers, + }); } /** diff --git a/apps/browser/src/autofill/enums/autofill-overlay.enum.ts b/apps/browser/src/autofill/enums/autofill-overlay.enum.ts index 9afca4c41e4..761b393d11f 100644 --- a/apps/browser/src/autofill/enums/autofill-overlay.enum.ts +++ b/apps/browser/src/autofill/enums/autofill-overlay.enum.ts @@ -1,13 +1,13 @@ const AutofillOverlayElement = { Button: "autofill-inline-menu-button", - List: "autofill-overlay-list", + List: "autofill-inline-menu-list", } as const; const AutofillOverlayPort = { Button: "autofill-inline-menu-button-port", ButtonMessageConnector: "autofill-inline-menu-button-message-connector", - List: "autofill-overlay-list-port", - ListMessageConnector: "autofill-overlay-list-message-connector", + List: "autofill-inline-menu-list-port", + ListMessageConnector: "autofill-inline-menu-list-message-connector", } as const; const RedirectFocusDirection = { diff --git a/apps/browser/src/autofill/overlay/inline-menu/abstractions/autofill-inline-menu-button.ts b/apps/browser/src/autofill/overlay/inline-menu/abstractions/autofill-inline-menu-button.ts index 32fb7200ca1..642e7dd24e9 100644 --- a/apps/browser/src/autofill/overlay/inline-menu/abstractions/autofill-inline-menu-button.ts +++ b/apps/browser/src/autofill/overlay/inline-menu/abstractions/autofill-inline-menu-button.ts @@ -1,18 +1,18 @@ import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status"; -type AutofillInlineMenuButtonMessage = { command: string; colorScheme?: string }; +export type AutofillInlineMenuButtonMessage = { command: string; colorScheme?: string }; -type UpdateAuthStatusMessage = AutofillInlineMenuButtonMessage & { +export type UpdateAuthStatusMessage = AutofillInlineMenuButtonMessage & { authStatus: AuthenticationStatus; }; -type InitAutofillInlineMenuButtonMessage = UpdateAuthStatusMessage & { +export type InitAutofillInlineMenuButtonMessage = UpdateAuthStatusMessage & { styleSheetUrl: string; translations: Record; portKey: string; }; -type AutofillInlineMenuButtonWindowMessageHandlers = { +export type AutofillInlineMenuButtonWindowMessageHandlers = { [key: string]: CallableFunction; initAutofillInlineMenuButton: ({ message, @@ -31,10 +31,3 @@ type AutofillInlineMenuButtonWindowMessageHandlers = { message: AutofillInlineMenuButtonMessage; }) => void; }; - -export { - UpdateAuthStatusMessage, - AutofillInlineMenuButtonMessage, - InitAutofillInlineMenuButtonMessage, - AutofillInlineMenuButtonWindowMessageHandlers, -}; diff --git a/apps/browser/src/autofill/overlay/inline-menu/abstractions/autofill-inline-menu-container.ts b/apps/browser/src/autofill/overlay/inline-menu/abstractions/autofill-inline-menu-container.ts index 986ccc7a6f0..2afa742b348 100644 --- a/apps/browser/src/autofill/overlay/inline-menu/abstractions/autofill-inline-menu-container.ts +++ b/apps/browser/src/autofill/overlay/inline-menu/abstractions/autofill-inline-menu-container.ts @@ -2,12 +2,12 @@ import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authenticatio import { OverlayCipherData } from "../../../background/abstractions/overlay.background"; -type AutofillOverlayMenuContainerMessage = { +type AutofillInlineMenuMenuContainerMessage = { command: string; portKey: string; }; -export type InitOverlayElementMessage = AutofillOverlayMenuContainerMessage & { +export type InitInlineMenuElementMessage = AutofillInlineMenuMenuContainerMessage & { iframeUrl?: string; pageTitle?: string; authStatus?: AuthenticationStatus; @@ -18,8 +18,8 @@ export type InitOverlayElementMessage = AutofillOverlayMenuContainerMessage & { portName?: string; }; -export type AutofillOverlayMenuContainerWindowMessageHandlers = { +export type AutofillInlineMenuMenuContainerWindowMessageHandlers = { [key: string]: CallableFunction; - initAutofillInlineMenuList: (message: InitOverlayElementMessage) => void; - initAutofillInlineMenuButton: (message: InitOverlayElementMessage) => void; + initAutofillInlineMenuList: (message: InitInlineMenuElementMessage) => void; + initAutofillInlineMenuButton: (message: InitInlineMenuElementMessage) => void; }; diff --git a/apps/browser/src/autofill/overlay/inline-menu/abstractions/autofill-inline-menu-iframe.service.ts b/apps/browser/src/autofill/overlay/inline-menu/abstractions/autofill-inline-menu-iframe.service.ts index fed573021dd..3914baaf0f9 100644 --- a/apps/browser/src/autofill/overlay/inline-menu/abstractions/autofill-inline-menu-iframe.service.ts +++ b/apps/browser/src/autofill/overlay/inline-menu/abstractions/autofill-inline-menu-iframe.service.ts @@ -1,35 +1,25 @@ -type AutofillOverlayIframeExtensionMessage = { +export type AutofillInlineMenuIframeExtensionMessage = { command: string; styles?: Partial; theme?: string; portKey?: string; }; -type AutofillOverlayIframeWindowMessageHandlers = { - [key: string]: CallableFunction; - updateAutofillInlineMenuListHeight: (message: AutofillOverlayIframeExtensionMessage) => void; +export type AutofillInlineMenuIframeExtensionMessageParam = { + message: AutofillInlineMenuIframeExtensionMessage; }; -type AutofillOverlayIframeExtensionMessageParam = { - message: AutofillOverlayIframeExtensionMessage; -}; - -type BackgroundPortMessageHandlers = { +export type BackgroundPortMessageHandlers = { [key: string]: CallableFunction; - initAutofillInlineMenuButton: ({ message }: AutofillOverlayIframeExtensionMessageParam) => void; - initAutofillInlineMenuList: ({ message }: AutofillOverlayIframeExtensionMessageParam) => void; - updateIframePosition: ({ message }: AutofillOverlayIframeExtensionMessageParam) => void; - updateInlineMenuHidden: ({ message }: AutofillOverlayIframeExtensionMessageParam) => void; + initAutofillInlineMenuButton: ({ + message, + }: AutofillInlineMenuIframeExtensionMessageParam) => void; + initAutofillInlineMenuList: ({ message }: AutofillInlineMenuIframeExtensionMessageParam) => void; + updateIframePosition: ({ message }: AutofillInlineMenuIframeExtensionMessageParam) => void; + updateInlineMenuHidden: ({ message }: AutofillInlineMenuIframeExtensionMessageParam) => void; updateAutofillInlineMenuColorScheme: () => void; }; -interface AutofillInlineMenuIframeService { +export interface AutofillInlineMenuIframeService { initMenuIframe(): void; } - -export { - AutofillOverlayIframeExtensionMessage, - AutofillOverlayIframeWindowMessageHandlers, - BackgroundPortMessageHandlers, - AutofillInlineMenuIframeService, -}; diff --git a/apps/browser/src/autofill/overlay/inline-menu/abstractions/autofill-inline-menu-list.ts b/apps/browser/src/autofill/overlay/inline-menu/abstractions/autofill-inline-menu-list.ts index 0d01e702b1a..42b0a388657 100644 --- a/apps/browser/src/autofill/overlay/inline-menu/abstractions/autofill-inline-menu-list.ts +++ b/apps/browser/src/autofill/overlay/inline-menu/abstractions/autofill-inline-menu-list.ts @@ -2,13 +2,13 @@ import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authenticatio import { OverlayCipherData } from "../../../background/abstractions/overlay.background"; -type OverlayListMessage = { command: string }; +type AutofillInlineMenuListMessage = { command: string }; -type UpdateOverlayListCiphersMessage = OverlayListMessage & { +export type UpdateAutofillInlineMenuListCiphersMessage = AutofillInlineMenuListMessage & { ciphers: OverlayCipherData[]; }; -type InitAutofillOverlayListMessage = OverlayListMessage & { +export type InitAutofillInlineMenuListMessage = AutofillInlineMenuListMessage & { authStatus: AuthenticationStatus; styleSheetUrl: string; theme: string; @@ -17,16 +17,14 @@ type InitAutofillOverlayListMessage = OverlayListMessage & { portKey: string; }; -type OverlayListWindowMessageHandlers = { +export type AutofillInlineMenuListWindowMessageHandlers = { [key: string]: CallableFunction; - initAutofillInlineMenuList: ({ message }: { message: InitAutofillOverlayListMessage }) => void; + initAutofillInlineMenuList: ({ message }: { message: InitAutofillInlineMenuListMessage }) => void; checkAutofillInlineMenuListFocused: () => void; - updateOverlayListCiphers: ({ message }: { message: UpdateOverlayListCiphersMessage }) => void; + updateAutofillInlineMenuListCiphers: ({ + message, + }: { + message: UpdateAutofillInlineMenuListCiphersMessage; + }) => void; focusInlineMenuList: () => void; }; - -export { - UpdateOverlayListCiphersMessage, - InitAutofillOverlayListMessage, - OverlayListWindowMessageHandlers, -}; diff --git a/apps/browser/src/autofill/overlay/inline-menu/abstractions/autofill-inline-menu-page-element.ts b/apps/browser/src/autofill/overlay/inline-menu/abstractions/autofill-inline-menu-page-element.ts index 64273b4a462..4f34d3a7a2b 100644 --- a/apps/browser/src/autofill/overlay/inline-menu/abstractions/autofill-inline-menu-page-element.ts +++ b/apps/browser/src/autofill/overlay/inline-menu/abstractions/autofill-inline-menu-page-element.ts @@ -1,18 +1,13 @@ import { AutofillInlineMenuButtonWindowMessageHandlers } from "./autofill-inline-menu-button"; -import { OverlayListWindowMessageHandlers } from "./autofill-inline-menu-list"; +import { AutofillInlineMenuListWindowMessageHandlers } from "./autofill-inline-menu-list"; -type AutofillInlineMenuPageElementWindowMessageHandlers = +export type AutofillInlineMenuPageElementWindowMessageHandlers = | AutofillInlineMenuButtonWindowMessageHandlers - | OverlayListWindowMessageHandlers; + | AutofillInlineMenuListWindowMessageHandlers; -type AutofillInlineMenuPageElementWindowMessage = { +export type AutofillInlineMenuPageElementWindowMessage = { [key: string]: any; command: string; overlayCipherId?: string; height?: number; }; - -export { - AutofillInlineMenuPageElementWindowMessageHandlers, - AutofillInlineMenuPageElementWindowMessage, -}; diff --git a/apps/browser/src/autofill/overlay/inline-menu/content/autofill-inline-menu-content.service.ts b/apps/browser/src/autofill/overlay/inline-menu/content/autofill-inline-menu-content.service.ts index c136924bdc5..193f4052c41 100644 --- a/apps/browser/src/autofill/overlay/inline-menu/content/autofill-inline-menu-content.service.ts +++ b/apps/browser/src/autofill/overlay/inline-menu/content/autofill-inline-menu-content.service.ts @@ -10,7 +10,7 @@ import { AutofillInlineMenuContentService as AutofillInlineMenuContentServiceInterface, } from "../abstractions/autofill-inline-menu-content.service"; import { AutofillInlineMenuButtonIframe } from "../iframe-content/autofill-inline-menu-button-iframe"; -import AutofillInlineMenuListIframe from "../iframe-content/autofill-inline-menu-list-iframe"; +import { AutofillInlineMenuListIframe } from "../iframe-content/autofill-inline-menu-list-iframe"; export class AutofillInlineMenuContentService implements AutofillInlineMenuContentServiceInterface { private readonly sendExtensionMessage = sendExtensionMessage; diff --git a/apps/browser/src/autofill/overlay/inline-menu/iframe-content/__snapshots__/autofill-inline-menu-iframe.service.spec.ts.snap b/apps/browser/src/autofill/overlay/inline-menu/iframe-content/__snapshots__/autofill-inline-menu-iframe.service.spec.ts.snap index 2baa56c0151..dd151e4e83d 100644 --- a/apps/browser/src/autofill/overlay/inline-menu/iframe-content/__snapshots__/autofill-inline-menu-iframe.service.spec.ts.snap +++ b/apps/browser/src/autofill/overlay/inline-menu/iframe-content/__snapshots__/autofill-inline-menu-iframe.service.spec.ts.snap @@ -1,5 +1,15 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`AutofillInlineMenuIframeService initMenuIframe sets up the iframe's attributes 1`] = ` +