Skip to content

Commit 02a7653

Browse files
author
“LAKSHMIRPILLAI”
committed
Changes to update the CTA and the choice cards to annual if there is a discount
1 parent 2c93e78 commit 02a7653

File tree

5 files changed

+19
-21
lines changed

5 files changed

+19
-21
lines changed

dotcom-rendering/src/components/marketing/epics/ContributionsEpic.stories.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,8 @@ export const WithThreeTierDiscountChoiceCardsNonUS: Story = {
361361
showChoiceCards: true,
362362
cta: {
363363
text: 'Support the Guardian',
364-
baseUrl: 'https://support.theguardian.com/contribute',
364+
baseUrl:
365+
'https://support.theguardian.com/uk/contribute?promoCode=30OFF3APRIL',
365366
},
366367
},
367368
},

dotcom-rendering/src/components/marketing/epics/ThreeTierChoiceCardData.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ export const ChoiceCardTestData_REGULAR = (
88
{
99
supportTier: 'Contribution',
1010
label: (amount: number, currencySymbol: string): string =>
11-
`Support ${currencySymbol}${amount}/month`,
11+
isDiscountActive
12+
? `Support ${currencySymbol}${amount}/year`
13+
: `Support ${currencySymbol}${amount}/month`,
1214
benefitsLabel: 'Support',
1315
benefits: () => [
1416
'Exclusive newsletter for supporters, sent every week from the Guardian newsroom',

dotcom-rendering/src/components/marketing/epics/ThreeTierChoiceCards.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,9 @@ export const ThreeTierChoiceCards = ({
233233

234234
const radioId = `choicecard-${id}-${supportTier}`;
235235

236-
const finalChoiceAmount =
237-
isDiscountActive && hasDiscount
238-
? choiceAmountYearly
239-
: choiceAmount;
240-
console.log('finalChoiceAmount', finalChoiceAmount);
236+
const finalChoiceAmount = isDiscountActive
237+
? choiceAmountYearly
238+
: choiceAmount;
241239

242240
return (
243241
<div

dotcom-rendering/src/components/marketing/epics/ctas/ContributionsEpicButtons.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
OPHAN_COMPONENT_EVENT_REMINDER_OPEN,
3232
} from '../utils/ophan';
3333
import {
34+
SupportRatePlan,
3435
type SupportTier,
3536
threeTierChoiceCardAmounts,
3637
} from '../utils/threeTierChoiceCardAmounts';
@@ -189,19 +190,15 @@ export const ContributionsEpicButtons = ({
189190
}
190191

191192
const getChoiceCardCta = (cta: Cta): Cta => {
193+
const countryGroupId = countryCodeToCountryGroupId(countryCode);
192194
if (showChoiceCards) {
193195
if (threeTierChoiceCardSelectedProduct === 'OneOff') {
194196
return {
195197
text: cta.text,
196198
baseUrl: addChoiceCardsOneTimeParams(cta.baseUrl),
197199
};
198200
}
199-
if (
200-
threeTierChoiceCardSelectedProduct === 'SupporterPlus' &&
201-
isDiscountActive &&
202-
countryCode !== 'US'
203-
) {
204-
const countryGroupId = countryCodeToCountryGroupId(countryCode);
201+
if (isDiscountActive) {
205202
const contributionAmount =
206203
threeTierChoiceCardSelectedProduct === 'SupporterPlus'
207204
? threeTierChoiceCardAmounts['Annual'][countryGroupId]
@@ -220,7 +217,6 @@ export const ContributionsEpicButtons = ({
220217
}
221218

222219
/** Contribution amount is variable, unlike the SupporterPlus amount which is fixed */
223-
const countryGroupId = countryCodeToCountryGroupId(countryCode);
224220
const contributionAmount =
225221
threeTierChoiceCardSelectedProduct === 'Contribution'
226222
? threeTierChoiceCardAmounts['Monthly'][countryGroupId]

dotcom-rendering/src/components/marketing/epics/ctas/ContributionsEpicCtasContainer.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,16 @@ export const ContributionsEpicCtasContainer: ReactComponent<Props> = ({
5555
setThreeTierChoiceCardSelectedProduct,
5656
] = useState<SupportTier>('SupporterPlus');
5757

58-
//Check the dates
58+
const hasPromoCodeInUrl =
59+
variant.cta?.baseUrl.includes('30OFF3APRIL') ?? false;
60+
61+
// Check the dates
5962
const isDiscountActive =
60-
(now >= new Date('2025-04-10T00:00:01') &&
61-
now < new Date('2025-04-21T23:59:59') &&
62-
countryCode !== 'US') ??
63+
(hasPromoCodeInUrl &&
64+
now >= new Date('2025-04-11T00:00:01') &&
65+
now < new Date('2025-04-21T23:59:59')) ??
6366
false;
64-
// const isDiscountActive = (true && countryCode !=='US') ?? false;
65-
console.log('currentDate', now);
66-
console.log('activeDate', isDiscountActive);
67+
6768
return (
6869
<>
6970
{showChoiceCards && (

0 commit comments

Comments
 (0)