Skip to content

Commit e969858

Browse files
committed
big sweep
1 parent 3f486ce commit e969858

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+87
-3511
lines changed

src/TestComponentWrapper.tsx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { SessionProvider } from "next-auth/react";
88
import { ReactAriaI18nProvider } from "./contextProviders/react-aria";
99
import { getL10nBundles } from "./app/functions/l10n/storybookAndJest";
1010
import { CookiesProvider } from "./contextProviders/cookies";
11-
import { SubscriptionBillingProvider } from "./contextProviders/subscription-billing-context";
1211

1312
const l10nBundles = getL10nBundles();
1413

@@ -17,19 +16,7 @@ export const TestComponentWrapper = (props: { children: ReactNode }) => {
1716
<L10nProvider bundleSources={l10nBundles}>
1817
<SessionProvider session={null}>
1918
<ReactAriaI18nProvider locale="en">
20-
<CookiesProvider>
21-
<SubscriptionBillingProvider
22-
value={{
23-
monthly: 0,
24-
bundle: {
25-
monthly: 0,
26-
individual: 0,
27-
},
28-
}}
29-
>
30-
{props.children}
31-
</SubscriptionBillingProvider>
32-
</CookiesProvider>
19+
<CookiesProvider>{props.children}</CookiesProvider>
3320
</ReactAriaI18nProvider>
3421
</SessionProvider>
3522
</L10nProvider>

src/app/(proper_react)/(redesign)/(authenticated)/admin/announcements/page.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@ import { notFound, redirect } from "next/navigation";
77
import { isAdmin } from "../../../../../api/utils/auth";
88
import { getAllAnnouncements } from "../../../../../../db/tables/announcements";
99
import { AnnouncementsAdmin } from "./AnnouncementsAdmin";
10-
import { SubscriptionBillingProvider } from "../../../../../../contextProviders/subscription-billing-context";
11-
import { getSubscriptionBillingAmount } from "../../../../../functions/server/getPremiumSubscriptionInfo";
1210
import { getFluentStrings } from "./getFluentStrings";
1311

1412
export default async function DevPage() {
1513
const session = await getServerSession();
16-
const billing = getSubscriptionBillingAmount();
1714

1815
if (!session?.user?.email || !session.user.subscriber?.id) {
1916
return redirect("/");
@@ -27,11 +24,9 @@ export default async function DevPage() {
2724
const fluentStrings = await getFluentStrings();
2825

2926
return (
30-
<SubscriptionBillingProvider value={billing}>
31-
<AnnouncementsAdmin
32-
announcements={announcements}
33-
fluentStrings={fluentStrings}
34-
/>
35-
</SubscriptionBillingProvider>
27+
<AnnouncementsAdmin
28+
announcements={announcements}
29+
fluentStrings={fluentStrings}
30+
/>
3631
);
3732
}

src/app/(proper_react)/(redesign)/(authenticated)/admin/feature-flags/page.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ import {
1313
import { isAdmin } from "../../../../../api/utils/auth";
1414
import { Toolbar } from "../../../../../components/client/toolbar/Toolbar";
1515
import styles from "./page.module.scss";
16-
import {
17-
getSubscriptionBillingAmount,
18-
getPremiumSubscriptionUrl,
19-
} from "../../../../../functions/server/getPremiumSubscriptionInfo";
2016
import { defaultExperimentData } from "../../../../../../telemetry/generated/nimbus/experiments";
2117
import { ExistingFlagEditor, NewFlagEditor } from "./components/FlagEditor";
2218

@@ -26,11 +22,6 @@ export const metadata = {
2622

2723
export default async function FeatureFlagPage() {
2824
const session = await getServerSession();
29-
30-
const monthlySubscriptionUrl = getPremiumSubscriptionUrl({
31-
type: "monthly",
32-
enabledFeatureFlags: [],
33-
});
3425
const fxaSettingsUrl = process.env.FXA_SETTINGS_URL!;
3526

3627
if (!session?.user?.email || !session.user.subscriber?.id) {
@@ -81,8 +72,6 @@ export default async function FeatureFlagPage() {
8172
<div className={styles.end}>
8273
<Toolbar
8374
user={session.user}
84-
monthlySubscriptionUrl={monthlySubscriptionUrl}
85-
subscriptionBillingAmount={getSubscriptionBillingAmount()}
8675
fxaSettingsUrl={fxaSettingsUrl}
8776
// Since this page is only accessed by contributors, no need to load
8877
// their latest scan date from the DB:

src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/View.tsx

Lines changed: 4 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
"use client";
66

7-
import { useContext, useEffect, useRef, useState } from "react";
8-
import Link from "next/link";
7+
import { useContext, useEffect, useState } from "react";
98
import { usePathname } from "next/navigation";
109
import Image from "next/image";
1110
import { Session } from "next-auth";
@@ -24,55 +23,32 @@ import { TabList } from "../../../../../../components/client/TabList";
2423
import { filterExposures } from "./filterExposures";
2524
import { SubscriberBreach } from "../../../../../../../utils/subscriberBreaches";
2625
import { hasPremium } from "../../../../../../functions/universal/user";
27-
import type { LatestOnerepScanData } from "../../../../../../../db/tables/onerep_scans";
2826
import { getLocale } from "../../../../../../functions/universal/getLocale";
2927
import { Button } from "../../../../../../components/client/Button";
3028

3129
import NoExposuresIllustration from "./images/dashboard-no-exposures.svg";
3230
import { CountryCodeContext } from "../../../../../../../contextProviders/country-code";
3331
import { FeatureFlagName } from "../../../../../../../db/tables/featureFlags";
3432
import { getNextGuidedStep } from "../../../../../../functions/server/getRelevantGuidedSteps";
35-
import { CsatSurvey } from "../../../../../../components/client/csat_survey/CsatSurvey";
36-
import { WaitlistDialog } from "../../../../../../components/client/SubscriberWaitlistDialog";
37-
import { useOverlayTriggerState } from "react-stately";
38-
import { useOverlayTrigger } from "react-aria";
3933
import { useTelemetry } from "../../../../../../hooks/useTelemetry";
40-
import {
41-
CONST_ONEREP_DATA_BROKER_COUNT,
42-
CONST_ONEREP_MAX_SCANS_THRESHOLD,
43-
} from "../../../../../../../constants";
4434
import { ExperimentData } from "../../../../../../../telemetry/generated/nimbus/experiments";
45-
import { DataBrokerRemovalTime } from "../../../../../../functions/server/getDataBrokerRemovalTimeEstimates";
4635
import { UserAnnouncementWithDetails } from "../../../../../../../db/tables/user_announcements";
47-
import { parseIso8601Datetime } from "../../../../../../../utils/parse";
4836
import { PlusShutdownBanner } from "../../../../../../components/client/PlusShutdownBanner";
4937
import { ShutdownState } from "../../../../../../functions/server/getPlusShutdownState";
5038

5139
export type TabType = "action-needed" | "fixed";
5240

5341
export type Props = {
42+
shutdownState: ShutdownState;
5443
enabledFeatureFlags: FeatureFlagName[];
5544
experimentData: ExperimentData["Features"];
5645
user: Session["user"];
5746
userBreaches: SubscriberBreach[];
58-
userScanData: LatestOnerepScanData;
5947
countryCode: string;
60-
isEligibleForFreeScan: boolean;
61-
isEligibleForPremium: boolean;
62-
monthlySubscriptionUrl: string;
63-
subscriptionBillingAmount: {
64-
monthly: number;
65-
};
66-
shutdownState: ShutdownState;
6748
fxaSettingsUrl: string;
68-
scanCount: number;
6949
isNewUser: boolean;
70-
hasFirstMonitoringScan: boolean;
71-
elapsedTimeInDaysSinceInitialScan?: number;
72-
totalNumberOfPerformedScans?: number;
7350
activeTab: TabType;
7451
signInCount: number | null;
75-
removalTimeEstimates: DataBrokerRemovalTime[];
7652
userAnnouncements: UserAnnouncementWithDetails[];
7753
};
7854

@@ -174,8 +150,6 @@ export const View = (props: Props) => {
174150
}
175151
}}
176152
locale={getLocale(l10n)}
177-
isPremiumUser={hasPremium(props.user)}
178-
isEligibleForPremium={props.isEligibleForPremium}
179153
resolutionCta={
180154
<Button
181155
variant="primary"
@@ -246,104 +220,15 @@ export const View = (props: Props) => {
246220
const TabContentFixed = () => (
247221
<>
248222
<h2 className={styles.exposuresAreaHeadline}>
249-
{l10n.getString(
250-
props.isEligibleForPremium
251-
? "dashboard-fixed-area-headline-premium"
252-
: "dashboard-fixed-area-headline-all",
253-
)}
223+
{l10n.getString("dashboard-fixed-area-headline-all")}
254224
</h2>
255225
</>
256226
);
257-
258-
const waitlistTriggerRef = useRef<HTMLAnchorElement>(null);
259-
const dialogTriggerState = useOverlayTriggerState({});
260-
const overlayTrigger = useOverlayTrigger(
261-
{ type: "dialog" },
262-
dialogTriggerState,
263-
waitlistTriggerRef,
264-
);
265-
266-
const freeScanCta = props.isEligibleForFreeScan && (
267-
<>
268-
<WaitlistDialog
269-
dialogTriggerState={dialogTriggerState}
270-
{...overlayTrigger.overlayProps}
271-
/>
272-
<p>
273-
{
274-
/* c8 ignore start */
275-
props.enabledFeatureFlags.includes("MaskDataBrokerCount")
276-
? l10n.getFragment(
277-
"dashboard-exposures-all-fixed-free-scan-masked",
278-
{
279-
elems: {
280-
a:
281-
!props.enabledFeatureFlags.includes(
282-
"DisableOneRepScans",
283-
) &&
284-
(typeof props.totalNumberOfPerformedScans ===
285-
"undefined" ||
286-
props.totalNumberOfPerformedScans <
287-
CONST_ONEREP_MAX_SCANS_THRESHOLD) ? (
288-
<Link
289-
ref={waitlistTriggerRef}
290-
href="/user/welcome/free-scan?referrer=dashboard"
291-
onClick={() => {
292-
recordTelemetry("link", "click", {
293-
link_id: "exposures_all_fixed_free_scan",
294-
});
295-
}}
296-
/>
297-
) : (
298-
<Button
299-
variant="link"
300-
buttonRef={waitlistTriggerRef}
301-
{...overlayTrigger.triggerProps}
302-
/>
303-
),
304-
},
305-
},
306-
)
307-
: l10n.getFragment("dashboard-exposures-all-fixed-free-scan", {
308-
vars: {
309-
data_broker_total_num: CONST_ONEREP_DATA_BROKER_COUNT,
310-
},
311-
elems: {
312-
a:
313-
!props.enabledFeatureFlags.includes("DisableOneRepScans") &&
314-
(typeof props.totalNumberOfPerformedScans === "undefined" ||
315-
props.totalNumberOfPerformedScans <
316-
CONST_ONEREP_MAX_SCANS_THRESHOLD) ? (
317-
<Link
318-
ref={waitlistTriggerRef}
319-
href="/user/welcome/free-scan?referrer=dashboard"
320-
onClick={() => {
321-
recordTelemetry("link", "click", {
322-
link_id: "exposures_all_fixed_free_scan",
323-
});
324-
}}
325-
/>
326-
) : (
327-
<Button
328-
variant="link"
329-
buttonRef={waitlistTriggerRef}
330-
{...overlayTrigger.triggerProps}
331-
/>
332-
),
333-
},
334-
})
335-
/* c8 ignore stop */
336-
}
337-
</p>
338-
</>
339-
);
340-
341227
const getZeroStateIndicator = () => {
342228
return (
343229
<>
344230
<Image src={NoExposuresIllustration} alt="" />
345231
<strong>{l10n.getString("dashboard-no-exposures-label")}</strong>
346-
{freeScanCta}
347232
</>
348233
);
349234
};
@@ -352,14 +237,7 @@ export const View = (props: Props) => {
352237
<div className={styles.wrapper}>
353238
<Toolbar
354239
user={props.user}
355-
monthlySubscriptionUrl={props.monthlySubscriptionUrl}
356-
subscriptionBillingAmount={props.subscriptionBillingAmount}
357240
fxaSettingsUrl={props.fxaSettingsUrl}
358-
lastScanDate={
359-
props.userScanData.scan
360-
? parseIso8601Datetime(props.userScanData.scan.created_at)
361-
: null
362-
}
363241
experimentData={props.experimentData}
364242
enabledFeatureFlags={props.enabledFeatureFlags}
365243
announcements={announcements}
@@ -381,23 +259,7 @@ export const View = (props: Props) => {
381259
countryCode={props.countryCode}
382260
shutdownState={props.shutdownState}
383261
/>
384-
<CsatSurvey
385-
user={props.user}
386-
activeTab={activeTab}
387-
enabledFeatureFlags={props.enabledFeatureFlags}
388-
experimentData={props.experimentData}
389-
elapsedTimeInDaysSinceInitialScan={
390-
props.elapsedTimeInDaysSinceInitialScan ?? null
391-
}
392-
hasFirstMonitoringScan={props.hasFirstMonitoringScan}
393-
lastScanDate={
394-
props.userScanData.scan
395-
? parseIso8601Datetime(props.userScanData.scan.created_at)
396-
: null
397-
}
398-
signInCount={props.signInCount}
399-
isEligibleForPremium={props.isEligibleForPremium}
400-
/>
262+
401263
<div className={styles.dashboardContent}>
402264
<DashboardTopBanner
403265
tabType={activeTab}
@@ -437,8 +299,6 @@ export const View = (props: Props) => {
437299
initialFilterValues={initialFilterState}
438300
filterValues={filters}
439301
setFilterValues={setFilters}
440-
isEligibleForPremium={props.isEligibleForPremium}
441-
isPlusSubscriber={hasPremium(props.user)}
442302
/>
443303
</div>
444304
{noUnresolvedExposures ? (

0 commit comments

Comments
 (0)