From 9cf82edc6f9928b9785910dc8b873e154d7b7b07 Mon Sep 17 00:00:00 2001 From: Cesar Gonzalez Date: Tue, 16 Apr 2024 09:35:57 -0500 Subject: [PATCH] [PM-5189] Refactoring implementation --- .../src/autofill/background/overlay.background.spec.ts | 10 +++++----- .../src/autofill/background/overlay.background.ts | 2 +- .../autofill/{utils => enums}/autofill-overlay.enum.ts | 0 .../{autofill-port.enums.ts => autofill-port.enum.ts} | 0 .../content/autofill-overlay-inline-menu-elements.ts | 2 +- .../iframe-content/autofill-overlay-button-iframe.ts | 2 +- .../autofill-overlay-iframe-element.spec.ts | 2 +- .../autofill-overlay-iframe.service.spec.ts | 2 +- .../iframe-content/autofill-overlay-list-iframe.ts | 2 +- .../pages/button/bootstrap-autofill-overlay-button.ts | 2 +- .../pages/list/bootstrap-autofill-overlay-list.ts | 2 +- .../pages/shared/autofill-overlay-page-element.ts | 2 +- .../services/autofill-overlay-content.service.spec.ts | 2 +- .../services/autofill-overlay-content.service.ts | 2 +- .../src/autofill/services/autofill.service.spec.ts | 2 +- apps/browser/src/autofill/services/autofill.service.ts | 2 +- apps/browser/src/autofill/utils/index.spec.ts | 2 +- apps/browser/src/autofill/utils/index.ts | 2 +- 18 files changed, 20 insertions(+), 20 deletions(-) rename apps/browser/src/autofill/{utils => enums}/autofill-overlay.enum.ts (100%) rename apps/browser/src/autofill/enums/{autofill-port.enums.ts => autofill-port.enum.ts} (100%) diff --git a/apps/browser/src/autofill/background/overlay.background.spec.ts b/apps/browser/src/autofill/background/overlay.background.spec.ts index ef2dc878528..99813f1b9be 100644 --- a/apps/browser/src/autofill/background/overlay.background.spec.ts +++ b/apps/browser/src/autofill/background/overlay.background.spec.ts @@ -36,6 +36,11 @@ import { CipherService } from "@bitwarden/common/vault/services/cipher.service"; import { BrowserApi } from "../../platform/browser/browser-api"; import { DefaultBrowserStateService } from "../../platform/services/default-browser-state.service"; import { BrowserPlatformUtilsService } from "../../platform/services/platform-utils/browser-platform-utils.service"; +import { + AutofillOverlayElement, + AutofillOverlayPort, + RedirectFocusDirection, +} from "../enums/autofill-overlay.enum"; import { AutofillService } from "../services/abstractions/autofill.service"; import { createAutofillPageDetailsMock, @@ -45,11 +50,6 @@ import { createPortSpyMock, } from "../spec/autofill-mocks"; import { flushPromises, sendMockExtensionMessage, sendPortMessage } from "../spec/testing-utils"; -import { - AutofillOverlayElement, - AutofillOverlayPort, - RedirectFocusDirection, -} from "../utils/autofill-overlay.enum"; import OverlayBackground from "./overlay.background"; diff --git a/apps/browser/src/autofill/background/overlay.background.ts b/apps/browser/src/autofill/background/overlay.background.ts index dfb7daf32cb..c7a9beba68e 100644 --- a/apps/browser/src/autofill/background/overlay.background.ts +++ b/apps/browser/src/autofill/background/overlay.background.ts @@ -26,9 +26,9 @@ import { openAddEditVaultItemPopout, openViewVaultItemPopout, } from "../../vault/popup/utils/vault-popout-window"; +import { AutofillOverlayElement, AutofillOverlayPort } from "../enums/autofill-overlay.enum"; import { AutofillService } from "../services/abstractions/autofill.service"; import { generateRandomChars } from "../utils"; -import { AutofillOverlayElement, AutofillOverlayPort } from "../utils/autofill-overlay.enum"; import { LockedVaultPendingNotificationsData } from "./abstractions/notification.background"; import { diff --git a/apps/browser/src/autofill/utils/autofill-overlay.enum.ts b/apps/browser/src/autofill/enums/autofill-overlay.enum.ts similarity index 100% rename from apps/browser/src/autofill/utils/autofill-overlay.enum.ts rename to apps/browser/src/autofill/enums/autofill-overlay.enum.ts diff --git a/apps/browser/src/autofill/enums/autofill-port.enums.ts b/apps/browser/src/autofill/enums/autofill-port.enum.ts similarity index 100% rename from apps/browser/src/autofill/enums/autofill-port.enums.ts rename to apps/browser/src/autofill/enums/autofill-port.enum.ts diff --git a/apps/browser/src/autofill/overlay/content/autofill-overlay-inline-menu-elements.ts b/apps/browser/src/autofill/overlay/content/autofill-overlay-inline-menu-elements.ts index 41350adc697..cec2f569948 100644 --- a/apps/browser/src/autofill/overlay/content/autofill-overlay-inline-menu-elements.ts +++ b/apps/browser/src/autofill/overlay/content/autofill-overlay-inline-menu-elements.ts @@ -1,10 +1,10 @@ import { AutofillExtensionMessage } from "../../content/abstractions/autofill-init"; +import { AutofillOverlayElement } from "../../enums/autofill-overlay.enum"; import { sendExtensionMessage, generateRandomCustomElementName, setElementStyles, } from "../../utils"; -import { AutofillOverlayElement } from "../../utils/autofill-overlay.enum"; import { InlineMenuExtensionMessageHandlers, AutofillOverlayInlineMenuElements as InlineMenuElementsInterface, diff --git a/apps/browser/src/autofill/overlay/iframe-content/autofill-overlay-button-iframe.ts b/apps/browser/src/autofill/overlay/iframe-content/autofill-overlay-button-iframe.ts index 9d4f415ecfd..3fd28e7a02b 100644 --- a/apps/browser/src/autofill/overlay/iframe-content/autofill-overlay-button-iframe.ts +++ b/apps/browser/src/autofill/overlay/iframe-content/autofill-overlay-button-iframe.ts @@ -1,4 +1,4 @@ -import { AutofillOverlayPort } from "../../utils/autofill-overlay.enum"; +import { AutofillOverlayPort } from "../../enums/autofill-overlay.enum"; import AutofillOverlayIframeElement from "./autofill-overlay-iframe-element"; diff --git a/apps/browser/src/autofill/overlay/iframe-content/autofill-overlay-iframe-element.spec.ts b/apps/browser/src/autofill/overlay/iframe-content/autofill-overlay-iframe-element.spec.ts index 43c69532752..3aaf6e36b84 100644 --- a/apps/browser/src/autofill/overlay/iframe-content/autofill-overlay-iframe-element.spec.ts +++ b/apps/browser/src/autofill/overlay/iframe-content/autofill-overlay-iframe-element.spec.ts @@ -1,4 +1,4 @@ -import { AutofillOverlayPort } from "../../utils/autofill-overlay.enum"; +import { AutofillOverlayPort } from "../../enums/autofill-overlay.enum"; import AutofillOverlayIframeElement from "./autofill-overlay-iframe-element"; import AutofillOverlayIframeService from "./autofill-overlay-iframe.service"; diff --git a/apps/browser/src/autofill/overlay/iframe-content/autofill-overlay-iframe.service.spec.ts b/apps/browser/src/autofill/overlay/iframe-content/autofill-overlay-iframe.service.spec.ts index cd0f2c59f36..95664500401 100644 --- a/apps/browser/src/autofill/overlay/iframe-content/autofill-overlay-iframe.service.spec.ts +++ b/apps/browser/src/autofill/overlay/iframe-content/autofill-overlay-iframe.service.spec.ts @@ -3,13 +3,13 @@ import { mock } from "jest-mock-extended"; import { EVENTS } from "@bitwarden/common/autofill/constants"; import { ThemeType } from "@bitwarden/common/platform/enums"; +import { AutofillOverlayPort } from "../../enums/autofill-overlay.enum"; import { createPortSpyMock } from "../../spec/autofill-mocks"; import { flushPromises, sendPortMessage, triggerPortOnDisconnectEvent, } from "../../spec/testing-utils"; -import { AutofillOverlayPort } from "../../utils/autofill-overlay.enum"; import AutofillOverlayIframeService from "./autofill-overlay-iframe.service"; diff --git a/apps/browser/src/autofill/overlay/iframe-content/autofill-overlay-list-iframe.ts b/apps/browser/src/autofill/overlay/iframe-content/autofill-overlay-list-iframe.ts index 8136bd9a580..d73cc9e18ec 100644 --- a/apps/browser/src/autofill/overlay/iframe-content/autofill-overlay-list-iframe.ts +++ b/apps/browser/src/autofill/overlay/iframe-content/autofill-overlay-list-iframe.ts @@ -1,4 +1,4 @@ -import { AutofillOverlayPort } from "../../utils/autofill-overlay.enum"; +import { AutofillOverlayPort } from "../../enums/autofill-overlay.enum"; import AutofillOverlayIframeElement from "./autofill-overlay-iframe-element"; diff --git a/apps/browser/src/autofill/overlay/pages/button/bootstrap-autofill-overlay-button.ts b/apps/browser/src/autofill/overlay/pages/button/bootstrap-autofill-overlay-button.ts index f7e98cbd1eb..507073892c8 100644 --- a/apps/browser/src/autofill/overlay/pages/button/bootstrap-autofill-overlay-button.ts +++ b/apps/browser/src/autofill/overlay/pages/button/bootstrap-autofill-overlay-button.ts @@ -1,4 +1,4 @@ -import { AutofillOverlayElement } from "../../../utils/autofill-overlay.enum"; +import { AutofillOverlayElement } from "../../../enums/autofill-overlay.enum"; import AutofillOverlayButton from "./autofill-overlay-button"; diff --git a/apps/browser/src/autofill/overlay/pages/list/bootstrap-autofill-overlay-list.ts b/apps/browser/src/autofill/overlay/pages/list/bootstrap-autofill-overlay-list.ts index b0832e7e518..f02e4d57627 100644 --- a/apps/browser/src/autofill/overlay/pages/list/bootstrap-autofill-overlay-list.ts +++ b/apps/browser/src/autofill/overlay/pages/list/bootstrap-autofill-overlay-list.ts @@ -1,4 +1,4 @@ -import { AutofillOverlayElement } from "../../../utils/autofill-overlay.enum"; +import { AutofillOverlayElement } from "../../../enums/autofill-overlay.enum"; import AutofillOverlayList from "./autofill-overlay-list"; diff --git a/apps/browser/src/autofill/overlay/pages/shared/autofill-overlay-page-element.ts b/apps/browser/src/autofill/overlay/pages/shared/autofill-overlay-page-element.ts index 10ecd591f6f..3af65483379 100644 --- a/apps/browser/src/autofill/overlay/pages/shared/autofill-overlay-page-element.ts +++ b/apps/browser/src/autofill/overlay/pages/shared/autofill-overlay-page-element.ts @@ -1,6 +1,6 @@ import { EVENTS } from "@bitwarden/common/autofill/constants"; -import { RedirectFocusDirection } from "../../../utils/autofill-overlay.enum"; +import { RedirectFocusDirection } from "../../../enums/autofill-overlay.enum"; import { AutofillOverlayPageElementWindowMessage, WindowMessageHandlers, diff --git a/apps/browser/src/autofill/services/autofill-overlay-content.service.spec.ts b/apps/browser/src/autofill/services/autofill-overlay-content.service.spec.ts index 9e7d92350c1..532c4c61b79 100644 --- a/apps/browser/src/autofill/services/autofill-overlay-content.service.spec.ts +++ b/apps/browser/src/autofill/services/autofill-overlay-content.service.spec.ts @@ -3,11 +3,11 @@ import { mock } from "jest-mock-extended"; import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status"; import { EVENTS, AutofillOverlayVisibility } from "@bitwarden/common/autofill/constants"; +import { AutofillOverlayElement, RedirectFocusDirection } from "../enums/autofill-overlay.enum"; import AutofillField from "../models/autofill-field"; import { createAutofillFieldMock } from "../spec/autofill-mocks"; import { flushPromises } from "../spec/testing-utils"; import { ElementWithOpId, FormFieldElement } from "../types"; -import { AutofillOverlayElement, RedirectFocusDirection } from "../utils/autofill-overlay.enum"; import { AutoFillConstants } from "./autofill-constants"; import AutofillOverlayContentService from "./autofill-overlay-content.service"; diff --git a/apps/browser/src/autofill/services/autofill-overlay-content.service.ts b/apps/browser/src/autofill/services/autofill-overlay-content.service.ts index 9fd192d95ab..52070ef94fc 100644 --- a/apps/browser/src/autofill/services/autofill-overlay-content.service.ts +++ b/apps/browser/src/autofill/services/autofill-overlay-content.service.ts @@ -10,10 +10,10 @@ import { SubFrameOffsetData, } from "../background/abstractions/overlay.background"; import { AutofillExtensionMessage } from "../content/abstractions/autofill-init"; +import { AutofillOverlayElement, RedirectFocusDirection } from "../enums/autofill-overlay.enum"; import AutofillField from "../models/autofill-field"; import { ElementWithOpId, FillableFormFieldElement, FormFieldElement } from "../types"; import { elementIsFillableFormField, getAttributeBoolean, sendExtensionMessage } from "../utils"; -import { AutofillOverlayElement, RedirectFocusDirection } from "../utils/autofill-overlay.enum"; import { AutofillOverlayContentExtensionMessageHandlers, diff --git a/apps/browser/src/autofill/services/autofill.service.spec.ts b/apps/browser/src/autofill/services/autofill.service.spec.ts index 7353a4a8da8..9618beccba3 100644 --- a/apps/browser/src/autofill/services/autofill.service.spec.ts +++ b/apps/browser/src/autofill/services/autofill.service.spec.ts @@ -32,7 +32,7 @@ import { CipherService } from "@bitwarden/common/vault/services/cipher.service"; import { TotpService } from "@bitwarden/common/vault/services/totp.service"; import { BrowserApi } from "../../platform/browser/browser-api"; -import { AutofillPort } from "../enums/autofill-port.enums"; +import { AutofillPort } from "../enums/autofill-port.enum"; import AutofillField from "../models/autofill-field"; import AutofillPageDetails from "../models/autofill-page-details"; import AutofillScript from "../models/autofill-script"; diff --git a/apps/browser/src/autofill/services/autofill.service.ts b/apps/browser/src/autofill/services/autofill.service.ts index 4ae5f06a8d5..654e08b4aa4 100644 --- a/apps/browser/src/autofill/services/autofill.service.ts +++ b/apps/browser/src/autofill/services/autofill.service.ts @@ -21,7 +21,7 @@ import { FieldView } from "@bitwarden/common/vault/models/view/field.view"; import { BrowserApi } from "../../platform/browser/browser-api"; import { openVaultItemPasswordRepromptPopout } from "../../vault/popup/utils/vault-popout-window"; -import { AutofillPort } from "../enums/autofill-port.enums"; +import { AutofillPort } from "../enums/autofill-port.enum"; import AutofillField from "../models/autofill-field"; import AutofillPageDetails from "../models/autofill-page-details"; import AutofillScript from "../models/autofill-script"; diff --git a/apps/browser/src/autofill/utils/index.spec.ts b/apps/browser/src/autofill/utils/index.spec.ts index af67d416015..5dbb514b3f9 100644 --- a/apps/browser/src/autofill/utils/index.spec.ts +++ b/apps/browser/src/autofill/utils/index.spec.ts @@ -1,4 +1,4 @@ -import { AutofillPort } from "../enums/autofill-port.enums"; +import { AutofillPort } from "../enums/autofill-port.enum"; import { triggerPortOnDisconnectEvent } from "../spec/testing-utils"; import { logoIcon, logoLockedIcon } from "./svg-icons"; diff --git a/apps/browser/src/autofill/utils/index.ts b/apps/browser/src/autofill/utils/index.ts index a890dd20335..35310eb1d23 100644 --- a/apps/browser/src/autofill/utils/index.ts +++ b/apps/browser/src/autofill/utils/index.ts @@ -1,4 +1,4 @@ -import { AutofillPort } from "../enums/autofill-port.enums"; +import { AutofillPort } from "../enums/autofill-port.enum"; import { FillableFormFieldElement, FormElementWithAttribute, FormFieldElement } from "../types"; export function generateRandomChars(length: number): string {