Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MPP-3589 - Show news item for the holiday discount promo #4144

Merged
merged 14 commits into from
Nov 22, 2023
Merged
5 changes: 5 additions & 0 deletions frontend/pendingTranslations.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ profile-free-onboarding--addon-item-description-2 = Whenever you see an email ad

## 2023 Holiday promo

whatsnew-holiday-promo-2023-news-snippet = This holiday season, get 20% off the price of 1 year of { -brand-name-relay-premium }.
whatsnew-holiday-promo-2023-news-heading = Get 20% off { -brand-name-relay-premium }
whatsnew-holiday-promo-2023-news-content-description = This holiday season, get 20% off the price of 1 year of { -brand-name-relay-premium }. Just enter the promo code “HOLIDAY20” at checkout. Offer ends Dec 31, 2023.
whatsnew-holiday-promo-2023-cta = Get 1 year of { -brand-name-relay-premium }

holiday-promo-banner-protect-inbox = Protect your inbox for less
holiday-promo-banner-code-desc = Take 20% off { -brand-name-relay-premium }
# Variables:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}

.content {
padding: $spacing-lg;
padding: $spacing-lg 0;

h2 {
@include text-title-2xs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@
padding: $spacing-xs 0;
cursor: pointer;

// Forces news icon to be the same size regardless of image size
img {
max-width: 50px;
max-height: 50px;
}

h3 {
@include text-body-sm;
font-weight: 500;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import PremiumFinlandHero from "./images/premium-expansion-finland-hero.svg";
import PremiumFinlandIcon from "./images/premium-expansion-finland-icon.svg";
import PhoneMaskingHero from "./images/phone-masking-hero.svg";
import PhoneMaskingIcon from "./images/phone-masking-icon.svg";
import HolidayPromo2023Icon from "./images/holiday-promo-2023-news-icon.svg";
import HolidayPromo2023Hero from "./images/holiday-promo-2023-news-hero.svg";
import BundleHero from "./images/bundle-promo-hero.svg";
import BundleIcon from "./images/bundle-promo-icon.svg";
import OfferCountdownIcon from "./images/offer-countdown-icon.svg";
Expand All @@ -60,6 +62,7 @@ import { RuntimeData } from "../../../../hooks/api/runtimeData";
import { isFlagActive } from "../../../../functions/waffle";
import {
getBundlePrice,
getPeriodicalPremiumSubscribeLink,
isBundleAvailableInCountry,
isPeriodicalPremiumAvailableInCountry,
isPhonesAvailableInCountry,
Expand Down Expand Up @@ -334,6 +337,53 @@ export const WhatsNewMenu = (props: Props) => {
entries.push(premiumInFinland);
}

// Check if yearlyPlanLink should be generated based on runtimeData and availability
const yearlyPlanLink =
props.runtimeData &&
isPeriodicalPremiumAvailableInCountry(props.runtimeData)
? getPeriodicalPremiumSubscribeLink(props.runtimeData, "yearly")
: undefined;

const yearlyPlanRefWithCoupon = `${yearlyPlanLink}&coupon=HOLIDAY20`;

const holidayPromo2023: WhatsNewEntry = {
title: l10n.getString("whatsnew-holiday-promo-2023-news-heading"),
snippet: l10n.getString("whatsnew-holiday-promo-2023-news-snippet"),
content: (
<WhatsNewContent
description={l10n.getString(
"whatsnew-holiday-promo-2023-news-content-description",
)}
heading={l10n.getString("whatsnew-holiday-promo-2023-news-heading")}
image={HolidayPromo2023Hero}
cta={
<Link href={yearlyPlanRefWithCoupon} legacyBehavior>
<span className={styles.cta}>
{l10n.getString("whatsnew-holiday-promo-2023-cta")}
</span>
</Link>
}
/>
),
icon: HolidayPromo2023Icon,
dismissal: useLocalDismissal(
`whatsnew-holiday_promo_2023_${props.profile.id}`,
),
announcementDate: {
year: 2023,
month: 11,
day: 29,
},
};

// Check if the holiday promotion entry should be added to the entries array
if (
isFlagActive(props.runtimeData, "holiday_promo_2023") &&
lloan marked this conversation as resolved.
Show resolved Hide resolved
isPeriodicalPremiumAvailableInCountry(props.runtimeData)
) {
entries.push(holidayPromo2023);
}

const premiumEuExpansion: WhatsNewEntry = {
title: l10n.getString("whatsnew-feature-premium-expansion-eu-heading"),
snippet: l10n.getString("whatsnew-feature-premium-expansion-eu-snippet"),
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.