cta: buildEnrichedCta()

in dotcom-rendering/src/components/marketing/banners/common/BannerWrapper.tsx [196:309]


						cta: buildEnrichedCta(secondaryCta.cta),
					};
				}

				return {
					type: SecondaryCtaType.ContributionsReminder,
					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) {
					submitComponentEvent(componentClickEvent);
				}
				if (close) {
					onClose();
				}
			};
		};

		const onCtaClick = clickHandlerFor(componentIds.cta, true);
		const onSecondaryCtaClick = clickHandlerFor(
			componentIds.secondaryCta,
			true,
		);
		const onReminderCtaClick = clickHandlerFor(
			componentIds.reminderCta,
			false,
		);
		const onReminderSetClick = clickHandlerFor(
			componentIds.reminderSet,
			false,
		);
		const onReminderCloseClick = clickHandlerFor(
			componentIds.reminderClose,
			false,
		);
		const onCloseClick = clickHandlerFor(componentIds.close, true);
		const onNotNowClick = clickHandlerFor(componentIds.notNow, true);
		const onSignInClick = clickHandlerFor(componentIds.signIn, false);

		try {
			const renderedContent = content && buildRenderedContent(content);
			const renderedMobileContent =
				mobileContent && buildRenderedContent(mobileContent);

			if (renderedContent) {
				const props: BannerRenderProps = {
					onCtaClick,
					onSecondaryCtaClick,
					reminderTracking: {