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" ;
98import { usePathname } from "next/navigation" ;
109import Image from "next/image" ;
1110import { Session } from "next-auth" ;
@@ -24,55 +23,32 @@ import { TabList } from "../../../../../../components/client/TabList";
2423import { filterExposures } from "./filterExposures" ;
2524import { SubscriberBreach } from "../../../../../../../utils/subscriberBreaches" ;
2625import { hasPremium } from "../../../../../../functions/universal/user" ;
27- import type { LatestOnerepScanData } from "../../../../../../../db/tables/onerep_scans" ;
2826import { getLocale } from "../../../../../../functions/universal/getLocale" ;
2927import { Button } from "../../../../../../components/client/Button" ;
3028
3129import NoExposuresIllustration from "./images/dashboard-no-exposures.svg" ;
3230import { CountryCodeContext } from "../../../../../../../contextProviders/country-code" ;
3331import { FeatureFlagName } from "../../../../../../../db/tables/featureFlags" ;
3432import { 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" ;
3933import { useTelemetry } from "../../../../../../hooks/useTelemetry" ;
40- import {
41- CONST_ONEREP_DATA_BROKER_COUNT ,
42- CONST_ONEREP_MAX_SCANS_THRESHOLD ,
43- } from "../../../../../../../constants" ;
4434import { ExperimentData } from "../../../../../../../telemetry/generated/nimbus/experiments" ;
45- import { DataBrokerRemovalTime } from "../../../../../../functions/server/getDataBrokerRemovalTimeEstimates" ;
4635import { UserAnnouncementWithDetails } from "../../../../../../../db/tables/user_announcements" ;
47- import { parseIso8601Datetime } from "../../../../../../../utils/parse" ;
4836import { PlusShutdownBanner } from "../../../../../../components/client/PlusShutdownBanner" ;
4937import { ShutdownState } from "../../../../../../functions/server/getPlusShutdownState" ;
5038
5139export type TabType = "action-needed" | "fixed" ;
5240
5341export 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