From 88e04dabe7ff5103895ebb9ed8b5a2c1f48f704f Mon Sep 17 00:00:00 2001 From: Florian Zia Date: Tue, 12 Mar 2024 13:59:27 +0100 Subject: [PATCH] chore: Remove deprecated directory --- .eslintrc.json | 2 - .stylelintignore | 1 - src/app/(migration_remnants)/layout.tsx | 1 - .../HighRiskBreachLayout.tsx | 6 +- .../leaked-passwords/leakedPasswordsData.tsx | 6 +- .../SecurityRecommendationsLayout.tsx | 6 +- src/app/api/v1/scan/route.ts | 2 +- .../v1/user/breaches/bulk-resolve/route.ts | 2 +- src/app/api/v1/user/breaches/route.ts | 2 +- .../exposure_card/ExposureCardDataClass.tsx | 2 +- .../admin/emails/[template]/page.tsx | 172 ------------ .../(authenticated)/admin/emails/page.tsx | 24 -- .../(authenticated)/admin/layout.tsx | 28 -- .../deprecated/(authenticated)/admin/page.tsx | 20 -- .../admin/send-test-email/route.ts | 121 -------- .../user/breaches/breaches.d.ts | 139 ---------- .../(authenticated)/user/breaches/page.tsx | 187 ------------- .../(authenticated)/user/dashboard/page.tsx | 9 - .../(authenticated)/user/layout.tsx | 152 ---------- .../(authenticated)/user/settings/page.tsx | 262 ------------------ .../(dialogs)/user/dialog/addEmail/route.ts | 20 -- src/app/deprecated/(guest)/layout.tsx | 121 -------- src/app/deprecated/(guest)/page.tsx | 168 ----------- src/app/deprecated/(guest)/scan/page.tsx | 214 -------------- .../(guest)/user/unsubscribe-monthly/page.tsx | 34 --- .../client/FalseDoorBanner.module.scss | 116 -------- .../client/FalseDoorBanner.stories.ts | 28 -- .../client/FalseDoorBanner.test.tsx | 33 --- .../components/client/FalseDoorBanner.tsx | 138 --------- .../components/client/SignInButton.tsx | 44 --- .../components/client/SiteNavigation.tsx | 110 -------- .../deprecated/components/client/UserMenu.tsx | 104 ------- .../components/client/assets/shield-icon.svg | 5 - .../client/assets/shield-outline-icon.svg | 4 - .../components/server/AddEmailDialog.tsx | 63 ----- .../components/server/BreachesTable.tsx | 228 --------------- .../functions/server/getComponentAsString.ts | 16 -- .../deprecated/functions/server/getNonce.ts | 11 - src/app/deprecated/layout.tsx | 61 ---- src/app/functions/server/getBreaches.ts | 2 +- src/app/functions/universal/breach.ts | 36 ++- src/app/layout.tsx | 4 +- 42 files changed, 53 insertions(+), 2651 deletions(-) delete mode 100644 src/app/deprecated/(authenticated)/admin/emails/[template]/page.tsx delete mode 100644 src/app/deprecated/(authenticated)/admin/emails/page.tsx delete mode 100644 src/app/deprecated/(authenticated)/admin/layout.tsx delete mode 100644 src/app/deprecated/(authenticated)/admin/page.tsx delete mode 100644 src/app/deprecated/(authenticated)/admin/send-test-email/route.ts delete mode 100644 src/app/deprecated/(authenticated)/user/breaches/breaches.d.ts delete mode 100644 src/app/deprecated/(authenticated)/user/breaches/page.tsx delete mode 100644 src/app/deprecated/(authenticated)/user/dashboard/page.tsx delete mode 100644 src/app/deprecated/(authenticated)/user/layout.tsx delete mode 100644 src/app/deprecated/(authenticated)/user/settings/page.tsx delete mode 100644 src/app/deprecated/(dialogs)/user/dialog/addEmail/route.ts delete mode 100644 src/app/deprecated/(guest)/layout.tsx delete mode 100644 src/app/deprecated/(guest)/page.tsx delete mode 100644 src/app/deprecated/(guest)/scan/page.tsx delete mode 100644 src/app/deprecated/(guest)/user/unsubscribe-monthly/page.tsx delete mode 100644 src/app/deprecated/components/client/FalseDoorBanner.module.scss delete mode 100644 src/app/deprecated/components/client/FalseDoorBanner.stories.ts delete mode 100644 src/app/deprecated/components/client/FalseDoorBanner.test.tsx delete mode 100644 src/app/deprecated/components/client/FalseDoorBanner.tsx delete mode 100644 src/app/deprecated/components/client/SignInButton.tsx delete mode 100644 src/app/deprecated/components/client/SiteNavigation.tsx delete mode 100644 src/app/deprecated/components/client/UserMenu.tsx delete mode 100644 src/app/deprecated/components/client/assets/shield-icon.svg delete mode 100644 src/app/deprecated/components/client/assets/shield-outline-icon.svg delete mode 100644 src/app/deprecated/components/server/AddEmailDialog.tsx delete mode 100644 src/app/deprecated/components/server/BreachesTable.tsx delete mode 100644 src/app/deprecated/functions/server/getComponentAsString.ts delete mode 100644 src/app/deprecated/functions/server/getNonce.ts delete mode 100644 src/app/deprecated/layout.tsx diff --git a/.eslintrc.json b/.eslintrc.json index cebc0bf3b..9102782ed 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -129,7 +129,6 @@ "src/views/**/*.js", "src/middleware/**/*.js", "src/controllers/**/*.js", - "src/app/deprecated/**/*", "src/app/(migration_remnants)/**/*", "src/app/functions/server/breachResolution.ts" ], @@ -149,7 +148,6 @@ // to avoid a barrage of warnings for older code: "files": ["**/*.{ts,tsx}"], "excludedFiles": [ - "./src/app/deprecated/**/*", "./src/app/(migration_remnants)/**/*" ], "extends": [ diff --git a/.stylelintignore b/.stylelintignore index 5aaf7d3f9..dafb5e1bb 100644 --- a/.stylelintignore +++ b/.stylelintignore @@ -1,3 +1,2 @@ src/client/ src/app/(nextjs_migration)/ -src/app/deprecated/ diff --git a/src/app/(migration_remnants)/layout.tsx b/src/app/(migration_remnants)/layout.tsx index 20a36bcf4..6085ddf0f 100644 --- a/src/app/(migration_remnants)/layout.tsx +++ b/src/app/(migration_remnants)/layout.tsx @@ -10,7 +10,6 @@ import { HandleFalseDoorTest } from "../deprecated/components/client/FalseDoorBa import { getCountryCode } from "../functions/server/getCountryCode"; import { headers } from "next/headers"; import AppConstants from "../../appConstants"; -import { getNonce } from "../deprecated/functions/server/getNonce"; import { getEnabledFeatureFlags } from "../../db/tables/featureFlags"; export default async function MigrationLayout({ diff --git a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/high-risk-data-breaches/HighRiskBreachLayout.tsx b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/high-risk-data-breaches/HighRiskBreachLayout.tsx index ea8902fc7..4d3c57753 100644 --- a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/high-risk-data-breaches/HighRiskBreachLayout.tsx +++ b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/high-risk-data-breaches/HighRiskBreachLayout.tsx @@ -22,8 +22,10 @@ import { } from "../../../../../../../../functions/server/getRelevantGuidedSteps"; import { getGuidedExperienceBreaches } from "../../../../../../../../functions/universal/guidedExperienceBreaches"; import { hasPremium } from "../../../../../../../../functions/universal/user"; -import { HighRiskDataTypes } from "../../../../../../../../functions/universal/breach"; -import { BreachBulkResolutionRequest } from "../../../../../../../../deprecated/(authenticated)/user/breaches/breaches"; +import { + BreachBulkResolutionRequest, + HighRiskDataTypes, +} from "../../../../../../../../functions/universal/breach"; import { TelemetryButton } from "../../../../../../../../components/client/TelemetryButton"; import { TelemetryLink } from "../../../../../../../../components/client/TelemetryLink"; diff --git a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/leaked-passwords/leakedPasswordsData.tsx b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/leaked-passwords/leakedPasswordsData.tsx index 760294a28..4ac7e93ab 100644 --- a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/leaked-passwords/leakedPasswordsData.tsx +++ b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/leaked-passwords/leakedPasswordsData.tsx @@ -10,12 +10,12 @@ import { GuidedExperienceBreaches } from "../../../../../../../../functions/serv import { ExtendedReactLocalization } from "../../../../../../../../hooks/l10n"; import { Button } from "../../../../../../../../components/client/Button"; import { StepLink } from "../../../../../../../../functions/server/getRelevantGuidedSteps"; +import { getLocale } from "../../../../../../../../functions/universal/getLocale"; +import { TelemetryButton } from "../../../../../../../../components/client/TelemetryButton"; import { BreachResolutionRequest, HibpBreachDataTypes, -} from "../../../../../../../../deprecated/(authenticated)/user/breaches/breaches"; -import { getLocale } from "../../../../../../../../functions/universal/getLocale"; -import { TelemetryButton } from "../../../../../../../../components/client/TelemetryButton"; +} from "../../../../../../../../functions/universal/breach"; export const leakedPasswordTypes = [ "passwords", diff --git a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/security-recommendations/SecurityRecommendationsLayout.tsx b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/security-recommendations/SecurityRecommendationsLayout.tsx index fefb5d3ef..f70a32caf 100644 --- a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/security-recommendations/SecurityRecommendationsLayout.tsx +++ b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/security-recommendations/SecurityRecommendationsLayout.tsx @@ -23,8 +23,10 @@ import { } from "../../../../../../../../functions/server/getRelevantGuidedSteps"; import { getGuidedExperienceBreaches } from "../../../../../../../../functions/universal/guidedExperienceBreaches"; import { hasPremium } from "../../../../../../../../functions/universal/user"; -import { SecurityRecommendationDataTypes } from "../../../../../../../../functions/universal/breach"; -import { BreachBulkResolutionRequest } from "../../../../../../../../deprecated/(authenticated)/user/breaches/breaches"; +import { + BreachBulkResolutionRequest, + SecurityRecommendationDataTypes, +} from "../../../../../../../../functions/universal/breach"; export interface SecurityRecommendationsLayoutProps { type: SecurityRecommendationTypes; diff --git a/src/app/api/v1/scan/route.ts b/src/app/api/v1/scan/route.ts index 1291a47fd..7f5458a5a 100644 --- a/src/app/api/v1/scan/route.ts +++ b/src/app/api/v1/scan/route.ts @@ -9,7 +9,7 @@ import { getBreachesForEmail } from "../../../../utils/hibp"; import { getSha1 } from "../../../../utils/fxa"; import { getL10n } from "../../../functions/server/l10n"; import { getBreachLogo } from "../../../../utils/breachLogo"; -import { Breach } from "../../../deprecated/(authenticated)/user/breaches/breaches"; +import { Breach } from "../../../functions/universal/breach"; export interface RequestBreachScanErrorResponse { success: false; diff --git a/src/app/api/v1/user/breaches/bulk-resolve/route.ts b/src/app/api/v1/user/breaches/bulk-resolve/route.ts index 5bf9d5972..a8cea2cf7 100644 --- a/src/app/api/v1/user/breaches/bulk-resolve/route.ts +++ b/src/app/api/v1/user/breaches/bulk-resolve/route.ts @@ -5,13 +5,13 @@ import { NextRequest, NextResponse } from "next/server"; import { getServerSession } from "../../../../../functions/server/getServerSession"; import { logger } from "../../../../../functions/server/logging"; -import { BreachBulkResolutionRequest } from "../../../../../deprecated/(authenticated)/user/breaches/breaches.js"; import { getBreaches } from "../../../../../functions/server/getBreaches"; import { getAllEmailsAndBreaches } from "../../../../../../utils/breaches"; import { getSubscriberByFxaUid, setBreachResolution, } from "../../../../../../db/tables/subscribers"; +import { BreachBulkResolutionRequest } from "../../../../../functions/universal/breach"; export async function PUT(req: NextRequest): Promise { const session = await getServerSession(); diff --git a/src/app/api/v1/user/breaches/route.ts b/src/app/api/v1/user/breaches/route.ts index 88daf3493..9d02cd19d 100644 --- a/src/app/api/v1/user/breaches/route.ts +++ b/src/app/api/v1/user/breaches/route.ts @@ -6,7 +6,6 @@ import { NextRequest, NextResponse } from "next/server"; import { getToken } from "next-auth/jwt"; import { logger } from "../../../../functions/server/logging"; -import { BreachResolutionRequest } from "../../../../deprecated/(authenticated)/user/breaches/breaches.js"; import { getBreaches } from "../../../../functions/server/getBreaches"; import { getAllEmailsAndBreaches } from "../../../../../utils/breaches"; import { @@ -14,6 +13,7 @@ import { setBreachResolution, } from "../../../../../db/tables/subscribers"; import appConstants from "../../../../../appConstants"; +import { BreachResolutionRequest } from "../../../../functions/universal/breach"; // Get breaches data export async function GET(req: NextRequest) { diff --git a/src/app/components/client/exposure_card/ExposureCardDataClass.tsx b/src/app/components/client/exposure_card/ExposureCardDataClass.tsx index 4006aa6de..bb970ae7e 100644 --- a/src/app/components/client/exposure_card/ExposureCardDataClass.tsx +++ b/src/app/components/client/exposure_card/ExposureCardDataClass.tsx @@ -9,7 +9,7 @@ import { OnerepScanResultRow } from "knex/types/tables"; import styles from "./ExposureCard.module.scss"; import { useL10n } from "../../../hooks/l10n"; import { Exposure, isScanResult } from "./ExposureCard"; -import { HibpBreachDataTypes } from "../../../deprecated/(authenticated)/user/breaches/breaches"; +import { HibpBreachDataTypes } from "../../../functions/universal/breach"; type OnerepScanResultSerializedColumns = Extract< keyof OnerepScanResultRow, diff --git a/src/app/deprecated/(authenticated)/admin/emails/[template]/page.tsx b/src/app/deprecated/(authenticated)/admin/emails/[template]/page.tsx deleted file mode 100644 index ccdd5f406..000000000 --- a/src/app/deprecated/(authenticated)/admin/emails/[template]/page.tsx +++ /dev/null @@ -1,172 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -import { redirect } from "next/navigation"; -import Script from "next/script"; -import appConstants from "../../../../../../appConstants"; -import { - EmailTemplateType, - getMonthlyDummyData, - getNotificationDummyData, - getSignupReportDummyData, - getVerificationDummyData, -} from "../../../../../../utils/email"; -import { getPreviewTemplate } from "../../../../../../views/emails/email2022"; -import { verifyPartial } from "../../../../../../views/emails/emailVerify"; -import { breachAlertEmailPartial } from "../../../../../../views/emails/emailBreachAlert"; -import { monthlyUnresolvedEmailPartial } from "../../../../../../views/emails/emailMonthlyUnresolved"; -import { signupReportEmailPartial } from "../../../../../../views/emails/emailSignupReport"; -import { getL10n } from "../../../../../functions/server/l10n"; -import { ReactLocalization } from "@fluent/react"; -import { getNonce } from "../../../../functions/server/getNonce"; -import { getServerSession } from "../../../../../functions/server/getServerSession"; - -declare global { - // eslint-disable-next-line @typescript-eslint/no-namespace - namespace JSX { - interface IntrinsicElements { - "custom-select": { - name: string; - dangerouslySetInnerHTML: { __html: string }; - }; - } - } -} - -export default async function EmailTemplatePage(props: { - params: { template: string }; -}) { - const session = await getServerSession(); - - if (!session?.user.email) { - return redirect("/"); - } - - const admins = process.env.ADMINS?.split(",") ?? []; - // Note: ../layout.tsx currently hides this page for non-admins. - // Not sure if we actually want to have this available to non-admins as well. - const isAdminPreview = admins.includes(session.user.email); - const chosenTemplate = - Object.values(EmailTemplateType).find((t) => t === props.params.template) ?? - EmailTemplateType.Verification; - const l10n = getL10n(); - const templates = getTemplatesData(l10n); - const selectedPreviewTemplate = templates[chosenTemplate].template; - const recipients = [session.user.email]; - if (appConstants.EMAIL_TEST_RECIPIENT) { - recipients.push(appConstants.EMAIL_TEST_RECIPIENT); - } - - return ( -
-