diff --git a/src/app/(proper_react)/redesign/(authenticated)/user/dashboard/DashboardTopBanner.tsx b/src/app/(proper_react)/redesign/(authenticated)/user/dashboard/DashboardTopBanner.tsx index 9cefd5aa3bd..da481ec71dd 100644 --- a/src/app/(proper_react)/redesign/(authenticated)/user/dashboard/DashboardTopBanner.tsx +++ b/src/app/(proper_react)/redesign/(authenticated)/user/dashboard/DashboardTopBanner.tsx @@ -29,12 +29,6 @@ export const DashboardTopBanner = (props: DashboardTopBannerProps) => { } ); - const breachChartData: [string, number][] = - props.bannerData.sanitizedBreachExposures.map((obj) => { - const [key, value] = Object.entries(obj)[0]; - return [l10n.getString(key), value]; - }); - const contentData = { LetsFixDataContent: { headline: l10n.getString("dashboard-top-banner-protect-your-data-title"), @@ -130,6 +124,7 @@ export const DashboardTopBanner = (props: DashboardTopBannerProps) => { }; const content = contentData[props.type]; + console.log(props.hasRunScan); return (
@@ -147,7 +142,7 @@ export const DashboardTopBanner = (props: DashboardTopBannerProps) => { )}
- +
); diff --git a/src/app/(proper_react)/redesign/(authenticated)/user/dashboard/View.tsx b/src/app/(proper_react)/redesign/(authenticated)/user/dashboard/View.tsx index d6c1e2b9651..c8fd0d39117 100644 --- a/src/app/(proper_react)/redesign/(authenticated)/user/dashboard/View.tsx +++ b/src/app/(proper_react)/redesign/(authenticated)/user/dashboard/View.tsx @@ -226,6 +226,7 @@ export const View = (props: Props) => { ? "DataBrokerScanUpsellContent" : "LetsFixDataContent" } + hasRunScan={!isScanResultItemsEmpty} />

diff --git a/src/app/components/client/Chart.tsx b/src/app/components/client/Chart.tsx index c6a4506f646..25f35711b7a 100644 --- a/src/app/components/client/Chart.tsx +++ b/src/app/components/client/Chart.tsx @@ -19,6 +19,7 @@ import Link from "next/link"; export type Props = { data: Array<[string, number]>; + hasRunScan: boolean; }; export const DoughnutChart = (props: Props) => { @@ -96,6 +97,15 @@ export const DoughnutChart = (props: Props) => { ); + const prompt = ( +
+

{l10n.getString("exposure-chart-returning-user-upgrade-prompt")}

+ + {l10n.getString("exposure-chart-returning-user-upgrade-prompt-cta")} + +
+ ); + return ( <>
@@ -178,16 +188,7 @@ export const DoughnutChart = (props: Props) => { ))} -
-

- {l10n.getString("exposure-chart-returning-user-upgrade-prompt")} -

- - {l10n.getString( - "exposure-chart-returning-user-upgrade-prompt-cta" - )} - -
+ {!props.hasRunScan ? prompt : null}
diff --git a/src/app/functions/server/dashboard.ts b/src/app/functions/server/dashboard.ts index c770d3e886f..4067896d6f9 100644 --- a/src/app/functions/server/dashboard.ts +++ b/src/app/functions/server/dashboard.ts @@ -28,7 +28,6 @@ export interface DashboardSummary { securityQuestions: number; }; sanitizedExposures: Array>; - sanitizedBreachExposures: Array>; } const exposureKeyMap: Record = { @@ -73,7 +72,6 @@ export function dashboardSummary( securityQuestions: 0, }, sanitizedExposures: [], - sanitizedBreachExposures: [], }; // calculate broker summary from scanned results @@ -112,7 +110,7 @@ export function dashboardSummary( uniqueBreaches.add(b.Name); const dataClasses = b.DataClasses ?? []; - // TODO: add email addresses count from data breach after MNTOR-1947 tech debt + // TODO: add count email addresses from data breach after MNTOR-1947 tech debt // count password if (dataClasses.includes(BreachDataTypes.Passwords)) { @@ -169,9 +167,7 @@ export function dashboardSummary( function sanitizeExposures(summary: DashboardSummary): DashboardSummary { const NUM_OF_TOP_EXPOSURES = 4; - const NUM_OF_EXPOSURES_BEFORE_SCAN = 2; const { allExposures } = summary; - const sanitizedExposures = Object.entries(allExposures) .sort((a, b) => b[1] - a[1]) .map((e) => { @@ -179,30 +175,13 @@ function sanitizeExposures(summary: DashboardSummary): DashboardSummary { return { [key]: e[1] }; }) .splice(0, NUM_OF_TOP_EXPOSURES); - - // Returning user who hasn't run a scan - const breachSanitizedExposures = Object.entries(allExposures) - .sort((a, b) => b[1] - a[1]) - .map((e) => { - const key = exposureKeyMap[e[0]]; - if (key === "email-addresses" || key === "phone-numbers") { - return { [key]: e[1] }; - } - return null; - }) - .filter((entry): entry is Record => entry !== null) - .splice(0, NUM_OF_EXPOSURES_BEFORE_SCAN); - const other = sanitizedExposures.reduce( (total, cur) => total - (Object.values(cur).pop() || 0), summary.totalExposures ); - sanitizedExposures.push({ ["other-data-class"]: other }); - breachSanitizedExposures.push({ ["other-data-class"]: other }); summary.sanitizedExposures = sanitizedExposures; - summary.sanitizedBreachExposures = breachSanitizedExposures; - + console.debug({ sanitizedExposures }); return summary; }