From 55dcf6fe840f9d9b883e1979e86810519f92a43b Mon Sep 17 00:00:00 2001
From: Florian Dieminger
Date: Wed, 23 Oct 2024 15:19:37 +0200
Subject: [PATCH] fix(placement): hide ad-free link if plus isn't available
(#12010)
* fix(pong): hode no-pong if plus isn't available
---
client/src/placement-context.tsx | 8 +-
.../offer-overview-feature/index.tsx | 44 +++------
client/src/ui/organisms/placement/index.tsx | 91 +++++++++++--------
.../src/handlers/handle-stripe-plans.ts | 3 +-
cloud-function/src/handlers/proxy-bsa.ts | 10 +-
cloud-function/src/handlers/proxy-kevel.ts | 10 +-
libs/pong/pong.d.ts | 2 +-
libs/pong/pong2.d.ts | 2 +-
8 files changed, 94 insertions(+), 76 deletions(-)
diff --git a/client/src/placement-context.tsx b/client/src/placement-context.tsx
index 847b86e6e330..ed5eeb288bbb 100644
--- a/client/src/placement-context.tsx
+++ b/client/src/placement-context.tsx
@@ -17,6 +17,7 @@ export enum Status {
type PlacementType = "side" | "top" | "hpMain" | "hpFooter" | "bottom";
export interface PlacementContextData
extends Partial> {
+ plusAvailable?: boolean;
status: Status;
}
@@ -89,14 +90,17 @@ export function PlacementProvider(props: { children: React.ReactNode }) {
}
try {
- const placementResponse: PlacementContextData = await response.json();
+ const {
+ plusAvailable = true, // Fall back to true for seamless migration.
+ ...placementResponse
+ }: PlacementContextData = await response.json();
const typs = Object.entries(PLACEMENT_MAP)
.filter(([key]) => key in placementResponse)
.map(([, { typ }]) => typ);
if (typs.length) {
gleanClick(`pong: pong->served ${typs.join()}`);
}
- return placementResponse;
+ return { plusAvailable, ...placementResponse };
} catch (e) {
throw Error(response.statusText);
}
diff --git a/client/src/plus/offer-overview/offer-overview-feature/index.tsx b/client/src/plus/offer-overview/offer-overview-feature/index.tsx
index e6294a270fd0..a646964a2e9f 100644
--- a/client/src/plus/offer-overview/offer-overview-feature/index.tsx
+++ b/client/src/plus/offer-overview/offer-overview-feature/index.tsx
@@ -24,6 +24,21 @@ function OfferOverviewFeature({ id, img, imgAlt, children }) {
export default function OfferOverviewFeatures() {
return (
+
+
+
Go ads free
+
Enjoy MDN ads-free with an MDN Plus subscription.
+
+ Support MDN and enjoy a focused, ad-free experience alongside other
+ features such as curated collections, custom web platform updates,
+ offline access, and more. Subscribers to paid tiers of MDN Plus have
+ the option to browse MDN without ads.
+
- Taking your projects beyond the nearest wifi signal? Say goodbye to
- inaccessible pages or cluttered tabs. With MDN Plus, have the fully
- navigable resources of MDN at your disposal even when offline.
-
-
-
-
-
-
-
Go ads free
-
Enjoy MDN ads-free with an MDN Plus subscription.
-
- Support MDN and enjoy a focused, ad-free experience alongside other
- features such as curated collections, custom web platform updates,
- offline access, and more. Subscribers to paid tiers of MDN Plus have
- the option to browse MDN without ads.
-