diff --git a/apps/browser/src/autofill/background/abstractions/overlay.background.ts b/apps/browser/src/autofill/background/abstractions/overlay.background.ts index 5c902314cce..947307a7537 100644 --- a/apps/browser/src/autofill/background/abstractions/overlay.background.ts +++ b/apps/browser/src/autofill/background/abstractions/overlay.background.ts @@ -6,31 +6,31 @@ import { PageDetail } from "../../services/abstractions/autofill.service"; import { LockedVaultPendingNotificationsData } from "./notification.background"; -type PageDetailsForTab = Record< +export type PageDetailsForTab = Record< chrome.runtime.MessageSender["tab"]["id"], Map >; -type SubFrameOffsetData = { +export type SubFrameOffsetData = { frameId?: number; url?: string; top: number; left: number; } | null; -type SubFrameOffsetsForTab = Record< +export type SubFrameOffsetsForTab = Record< chrome.runtime.MessageSender["tab"]["id"], Map >; -type WebsiteIconData = { +export type WebsiteIconData = { imageEnabled: boolean; image: string; fallbackImage: string; icon: string; }; -type OverlayAddNewItemMessage = { +export type OverlayAddNewItemMessage = { login?: { uri?: string; hostname: string; @@ -39,14 +39,14 @@ type OverlayAddNewItemMessage = { }; }; -type FocusedFieldData = { +export type FocusedFieldData = { focusedFieldStyles: Partial; focusedFieldRects: Partial; tabId?: number; frameId?: number; }; -type OverlayBackgroundExtensionMessage = { +export type OverlayBackgroundExtensionMessage = { command: string; portKey?: string; tab?: chrome.tabs.Tab; @@ -64,14 +64,14 @@ type OverlayBackgroundExtensionMessage = { data?: LockedVaultPendingNotificationsData; } & OverlayAddNewItemMessage; -type OverlayPortMessage = { +export type OverlayPortMessage = { [key: string]: any; command: string; direction?: string; overlayCipherId?: string; }; -type OverlayCipherData = { +export type OverlayCipherData = { id: string; name: string; type: CipherType; @@ -82,15 +82,15 @@ type OverlayCipherData = { card?: string; }; -type BackgroundMessageParam = { +export type BackgroundMessageParam = { message: OverlayBackgroundExtensionMessage; }; -type BackgroundSenderParam = { +export type BackgroundSenderParam = { sender: chrome.runtime.MessageSender; }; -type BackgroundOnMessageHandlerParams = BackgroundMessageParam & BackgroundSenderParam; +export type BackgroundOnMessageHandlerParams = BackgroundMessageParam & BackgroundSenderParam; -type OverlayBackgroundExtensionMessageHandlers = { +export type OverlayBackgroundExtensionMessageHandlers = { [key: string]: CallableFunction; openAutofillInlineMenu: () => void; closeAutofillInlineMenu: ({ message, sender }: BackgroundOnMessageHandlerParams) => void; @@ -120,15 +120,15 @@ type OverlayBackgroundExtensionMessageHandlers = { deletedCipher: () => void; }; -type PortMessageParam = { +export type PortMessageParam = { message: OverlayPortMessage; }; -type PortConnectionParam = { +export type PortConnectionParam = { port: chrome.runtime.Port; }; -type PortOnMessageHandlerParams = PortMessageParam & PortConnectionParam; +export type PortOnMessageHandlerParams = PortMessageParam & PortConnectionParam; -type InlineMenuButtonPortMessageHandlers = { +export type InlineMenuButtonPortMessageHandlers = { [key: string]: CallableFunction; autofillInlineMenuButtonClicked: ({ port }: PortConnectionParam) => void; closeAutofillInlineMenu: ({ port }: PortConnectionParam) => void; @@ -138,7 +138,7 @@ type InlineMenuButtonPortMessageHandlers = { updateAutofillInlineMenuColorScheme: () => void; }; -type InlineMenuListPortMessageHandlers = { +export type InlineMenuListPortMessageHandlers = { [key: string]: CallableFunction; checkAutofillInlineMenuButtonFocused: () => void; forceCloseAutofillInlineMenu: ({ port }: PortConnectionParam) => void; @@ -151,24 +151,8 @@ type InlineMenuListPortMessageHandlers = { updateAutofillInlineMenuListHeight: ({ message, port }: PortOnMessageHandlerParams) => void; }; -interface OverlayBackground { +export interface OverlayBackground { init(): Promise; removePageDetails(tabId: number): void; updateOverlayCiphers(): void; } - -export { - PageDetailsForTab, - SubFrameOffsetData, - SubFrameOffsetsForTab, - WebsiteIconData, - OverlayBackgroundExtensionMessage, - OverlayPortMessage, - FocusedFieldData, - OverlayCipherData, - OverlayAddNewItemMessage, - OverlayBackgroundExtensionMessageHandlers, - InlineMenuButtonPortMessageHandlers, - InlineMenuListPortMessageHandlers, - OverlayBackground, -}; diff --git a/apps/browser/src/autofill/background/overlay.background.spec.ts b/apps/browser/src/autofill/background/overlay.background.spec.ts index 11786f9df3b..f117a8a0130 100644 --- a/apps/browser/src/autofill/background/overlay.background.spec.ts +++ b/apps/browser/src/autofill/background/overlay.background.spec.ts @@ -51,7 +51,7 @@ import { } from "../spec/autofill-mocks"; import { flushPromises, sendMockExtensionMessage, sendPortMessage } from "../spec/testing-utils"; -import OverlayBackground from "./overlay.background"; +import { OverlayBackground } from "./overlay.background"; describe("OverlayBackground", () => { const mockUserId = Utils.newGuid() as UserId; diff --git a/apps/browser/src/autofill/background/overlay.background.ts b/apps/browser/src/autofill/background/overlay.background.ts index 1d9723a5bb3..b0ee30a7662 100644 --- a/apps/browser/src/autofill/background/overlay.background.ts +++ b/apps/browser/src/autofill/background/overlay.background.ts @@ -46,7 +46,7 @@ import { SubFrameOffsetsForTab, } from "./abstractions/overlay.background"; -class OverlayBackground implements OverlayBackgroundInterface { +export class OverlayBackground implements OverlayBackgroundInterface { private readonly openUnlockPopout = openUnlockPopout; private readonly openViewVaultItemPopout = openViewVaultItemPopout; private readonly openAddEditVaultItemPopout = openAddEditVaultItemPopout; @@ -1047,5 +1047,3 @@ class OverlayBackground implements OverlayBackgroundInterface { } }; } - -export default OverlayBackground; diff --git a/apps/browser/src/autofill/background/tabs.background.spec.ts b/apps/browser/src/autofill/background/tabs.background.spec.ts index b95e303f17e..e29d6720e16 100644 --- a/apps/browser/src/autofill/background/tabs.background.spec.ts +++ b/apps/browser/src/autofill/background/tabs.background.spec.ts @@ -11,7 +11,7 @@ import { } from "../spec/testing-utils"; import NotificationBackground from "./notification.background"; -import OverlayBackground from "./overlay.background"; +import { OverlayBackground } from "./overlay.background"; import TabsBackground from "./tabs.background"; describe("TabsBackground", () => { diff --git a/apps/browser/src/autofill/background/tabs.background.ts b/apps/browser/src/autofill/background/tabs.background.ts index 53c801ff7bc..c1d9fddefee 100644 --- a/apps/browser/src/autofill/background/tabs.background.ts +++ b/apps/browser/src/autofill/background/tabs.background.ts @@ -1,7 +1,7 @@ import MainBackground from "../../background/main.background"; +import { OverlayBackground } from "./abstractions/overlay.background"; import NotificationBackground from "./notification.background"; -import OverlayBackground from "./overlay.background"; export default class TabsBackground { constructor( diff --git a/apps/browser/src/background/main.background.ts b/apps/browser/src/background/main.background.ts index 7cc2739f39f..c9da6defbf9 100644 --- a/apps/browser/src/background/main.background.ts +++ b/apps/browser/src/background/main.background.ts @@ -195,7 +195,7 @@ import { import ContextMenusBackground from "../autofill/background/context-menus.background"; import NotificationBackground from "../autofill/background/notification.background"; -import OverlayBackground from "../autofill/background/overlay.background"; +import { OverlayBackground } from "../autofill/background/overlay.background"; import TabsBackground from "../autofill/background/tabs.background"; import WebRequestBackground from "../autofill/background/web-request.background"; import { CipherContextMenuHandler } from "../autofill/browser/cipher-context-menu-handler";