in dotcom-rendering/src/components/marketing/banners/common/BannerWrapper.tsx [202:270]
reminderFields: getReminderFields(countryCode),
};
};
const primaryCta = bannerContent.cta
? buildEnrichedCta(bannerContent.cta)
: null;
const secondaryCta = bannerContent.secondaryCta
? buildEnrichedSecondaryCta(bannerContent.secondaryCta)
: null;
const cleanHighlightedText =
bannerContent.highlightedText &&
replaceNonArticleCountPlaceholders(
bannerContent.highlightedText,
countryCode,
prices,
).trim();
const cleanHeading = replaceNonArticleCountPlaceholders(
bannerContent.heading,
countryCode,
prices,
).trim();
const cleanParagraphs = cleanParagraphsOrMessageText(
bannerContent.paragraphs,
bannerContent.messageText,
);
const copyHasPlaceholder =
paragraphsContainNonArticleCountPlaceholder(cleanParagraphs) ||
(!!cleanHighlightedText &&
containsNonArticleCountPlaceholder(cleanHighlightedText)) ||
(!!cleanHeading &&
containsNonArticleCountPlaceholder(cleanHeading));
const headingWithArticleCount = cleanHeading
? replaceArticleCount(cleanHeading, numArticles, 'banner')
: null;
const highlightedTextWithArticleCount = cleanHighlightedText
? replaceArticleCount(
cleanHighlightedText,
numArticles,
'banner',
)
: null;
if (copyHasPlaceholder) {
throw Error('Banner copy contains placeholders, abandoning.');
}
return {
highlightedText: highlightedTextWithArticleCount,
paragraphs: finaliseParagraphs(cleanParagraphs),
heading: headingWithArticleCount,
primaryCta,
secondaryCta,
};
};
const clickHandlerFor = (componentId: string, close: boolean) => {
return (): void => {
const componentClickEvent = createClickEventFromTracking(
tracking,
componentId,
);
if (submitComponentEvent) {