Skip to content

Use destination field in choice cards#14621

Merged
tomrf1 merged 5 commits intomainfrom
tf-cc-tracking
Oct 8, 2025
Merged

Use destination field in choice cards#14621
tomrf1 merged 5 commits intomainfrom
tf-cc-tracking

Conversation

@tomrf1
Copy link
Member

@tomrf1 tomrf1 commented Oct 6, 2025

What does this change?

The choice cards config from SDC now includes a destination field instead of destinationUrl: guardian/support-dotcom-components#1431
The destination field will simply be LandingPage or Checkout, and DCR builds the url.

This is because we've changed our mind about how this should be configured from the tool. It simplifies things for MRR users of the tool, and also in the client (DCR).

The main change here is to the getChoiceCardUrl function, which no longer takes a baseUrl parameter. It builds the right Support site url based on the given choice card settings.

Testing

In addition to the new unit tests, I configured some choice cards in the CODE RRCP and tested both landing page and checkout links work

)}
<div css={styles.ctaContainer(isCollapsed)}>
<LinkButton
href={getChoiceCardUrl(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously we were not adding tracking params to the url if the choice card had destinationUrl set. This is fixed here, because we now call enrichSupportUrl as well

@github-actions
Copy link

github-actions bot commented Oct 6, 2025

tracking: Tracking;
submitComponentEvent?: (componentEvent: ComponentEvent) => void;
design?: ConfigurableDesign;
promoCodes?: string[];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we now have to pass this field through to the banner component for use by enrichSupportUrl

@tomrf1 tomrf1 marked this pull request as ready for review October 8, 2025 13:10
@tomrf1 tomrf1 requested review from a team as code owners October 8, 2025 13:10
@github-actions
Copy link

github-actions bot commented Oct 8, 2025

Hello 👋! When you're ready to run Chromatic, please apply the run_chromatic label to this PR.

You will need to reapply the label each time you want to run Chromatic.

Click here to see the Chromatic project.

)}`;
};

export const addChoiceCardsParams = (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused function

import type { Tracking } from '@guardian/support-dotcom-components/dist/shared/types';
import { addChoiceCardsParams, enrichSupportUrl } from './tracking';

describe('addChoiceCardsParams', () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed tests for an unused function

@tomrf1 tomrf1 added the run_chromatic Runs chromatic when label is applied label Oct 8, 2025
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Oct 8, 2025
@tomrf1 tomrf1 merged commit e244e09 into main Oct 8, 2025
32 checks passed
@tomrf1 tomrf1 deleted the tf-cc-tracking branch October 8, 2025 13:50
@gu-prout
Copy link

gu-prout bot commented Oct 8, 2025

Seen on PROD (merged by @tomrf1 7 minutes and 9 seconds ago) Please check your changes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants