Skip to content

Commit 059d5e3

Browse files
committed
Use rest-of-world version on public pages
1 parent e6dffc2 commit 059d5e3

File tree

8 files changed

+41
-27
lines changed

8 files changed

+41
-27
lines changed

src/app/(proper_react)/(redesign)/(public)/PublicShell.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ export const PublicShell = (props: Props) => {
9191
<SignInButton variant="secondary" />
9292
</nav>
9393
<div className={styles.content}>{props.children}</div>
94-
<Footer l10n={props.l10n} countryCode={props.countryCode} />
94+
<Footer
95+
l10n={props.l10n}
96+
countryCode={props.countryCode}
97+
enabledFeatureFlags={props.enabledFeatureFlags}
98+
/>
9599
</div>
96100
</PublicMobileShell>
97101
);

src/app/(proper_react)/(redesign)/(public)/how-it-works/page.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ export default async function Page() {
2222
const headersList = await headers();
2323
const countryCode = getCountryCode(headersList);
2424

25-
if (countryCode !== "us") {
25+
const enabledFeatureFlags = await getEnabledFeatureFlags({
26+
isSignedOut: true,
27+
});
28+
29+
if (countryCode !== "us" || enabledFeatureFlags.includes("FreeOnly")) {
2630
return redirect("/");
2731
}
2832

2933
const eligibleForPremium = isEligibleForPremium(countryCode);
3034
const l10n = getL10n(await getAcceptLangHeaderInServerComponents());
3135

32-
const enabledFeatureFlags = await getEnabledFeatureFlags({
33-
isSignedOut: true,
34-
});
35-
3636
// request the profile stats for the last 30 days
3737
const profileStats = await getProfilesStats(
3838
new Date(Date.now() - 30 * CONST_DAY_MILLISECONDS),

src/app/(proper_react)/(redesign)/(public)/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ export default async function Page() {
114114
/>
115115
) : (
116116
<LandingView
117-
eligibleForPremium={eligibleForPremium}
117+
eligibleForPremium={
118+
eligibleForPremium && !enabledFeatureFlags.includes("FreeOnly")
119+
}
118120
l10n={l10n}
119121
countryCode={countryCode}
120122
scanLimitReached={scanLimitReached}

src/app/(proper_react)/(redesign)/(public)/subscription-plans/page.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@ export default async function Page() {
3030
const session = await getServerSession();
3131
const headersList = await headers();
3232
const countryCode = getCountryCode(headersList);
33-
34-
if (countryCode !== "us") {
35-
return redirect("/");
36-
}
37-
38-
const l10n = getL10n(await getAcceptLangHeaderInServerComponents());
39-
const eligibleForPremium = isEligibleForPremium(countryCode);
4033
const enabledFeatureFlags = await getEnabledFeatureFlags(
4134
typeof session?.user.subscriber?.fxa_uid === "string"
4235
? {
@@ -46,6 +39,13 @@ export default async function Page() {
4639
: { isSignedOut: true },
4740
);
4841

42+
if (countryCode !== "us" || enabledFeatureFlags.includes("FreeOnly")) {
43+
return redirect("/");
44+
}
45+
46+
const l10n = getL10n(await getAcceptLangHeaderInServerComponents());
47+
const eligibleForPremium = isEligibleForPremium(countryCode);
48+
4949
if (!eligibleForPremium) {
5050
return redirect("/");
5151
}

src/app/(proper_react)/(redesign)/Footer.tsx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@ import {
1515
} from "../../../constants";
1616
import { Session } from "next-auth";
1717
import { TelemetryLink } from "../../components/client/TelemetryLink";
18+
import { FeatureFlagName } from "../../../db/tables/featureFlags";
1819

1920
export const Footer = ({
2021
l10n,
2122
session,
2223
countryCode,
24+
enabledFeatureFlags,
2325
}: {
2426
l10n: ExtendedReactLocalization;
2527
session?: Session;
2628
countryCode: string;
29+
enabledFeatureFlags: FeatureFlagName[];
2730
}) => {
2831
return (
2932
<footer className={styles.footer}>
@@ -45,19 +48,21 @@ export const Footer = ({
4548
{l10n.getString("footer-nav-recent-breaches")}
4649
</TelemetryLink>
4750
</li>
48-
{countryCode === "us" && !session && (
49-
<li>
50-
<TelemetryLink
51-
href="/how-it-works"
52-
target="_blank"
53-
eventData={{
54-
link_id: "how_it_works_footer",
55-
}}
56-
>
57-
{l10n.getString("footer-external-link-how-it-works-label")}
58-
</TelemetryLink>
59-
</li>
60-
)}
51+
{countryCode === "us" &&
52+
!enabledFeatureFlags.includes("FreeOnly") &&
53+
!session && (
54+
<li>
55+
<TelemetryLink
56+
href="/how-it-works"
57+
target="_blank"
58+
eventData={{
59+
link_id: "how_it_works_footer",
60+
}}
61+
>
62+
{l10n.getString("footer-external-link-how-it-works-label")}
63+
</TelemetryLink>
64+
</li>
65+
)}
6166
<li>
6267
<TelemetryLink
6368
href={CONST_URL_SUMO_MONITOR_FAQ}

src/app/(proper_react)/(redesign)/Shell/Shell.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export const Shell = (props: Props) => {
137137
l10n={props.l10n}
138138
session={props.session}
139139
countryCode={props.countryCode}
140+
enabledFeatureFlags={props.enabledFeatureFlags}
140141
/>
141142
</div>
142143
</div>

src/app/(proper_react)/(redesign)/Shell/ShellRedesign.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export const ShellRedesign = (props: Props) => {
7070
l10n={props.l10n}
7171
session={props.session}
7272
countryCode={props.countryCode}
73+
enabledFeatureFlags={props.enabledFeatureFlags}
7374
/>
7475
</div>
7576
</MobileShell>

src/db/tables/featureFlags.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export const featureFlagNames = [
7272
"DisableLandingToDashboardRedirect",
7373
"MaskDataBrokerCount",
7474
"IncreasedFreeMaxBreachEmails",
75+
"FreeOnly",
7576
] as const;
7677

7778
export const adminOnlyFlags: FeatureFlagName[] = [

0 commit comments

Comments
 (0)