remove-newsletter-signup-ab-branching-and-clean-up-component-id-tracking#16232
Open
georgerichmond wants to merge 10 commits into
Open
remove-newsletter-signup-ab-branching-and-clean-up-component-id-tracking#16232georgerichmond wants to merge 10 commits into
georgerichmond wants to merge 10 commits into
Conversation
…fy rendering logic
…nd simplify component structure
|
Hello 👋! When you're ready to run Chromatic, please apply the You will need to reapply the label each time you want to run Chromatic. |
…ean-up-component-id-tracking
There was a problem hiding this comment.
Pull request overview
Refactors newsletter signup rendering/tracking to remove concluded A/B-test scaffolding, standardise component IDs, and explicitly thread the tracking component ID into the signup form/hook so tracking is no longer coupled to test state.
Changes:
- Removes newsletter signup A/B branching and legacy component paths, consolidating on
NewsletterSignupCardContainer+NewsletterSignupForm. - Introduces stable, context-based component ID helpers (
inArticleSignupForm,secureSignup,highlightsCard) and updates tracking/tests accordingly. - Updates
useNewsletterSignupForm/NewsletterSignupFormto accept an explicitcomponentIdand forwards it into all tracking events.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| dotcom-rendering/src/lib/useNewsletterSignupForm.ts | Removes derived component-id logic; requires explicit componentId for tracking. |
| dotcom-rendering/src/lib/renderElement.tsx | Simplifies NewsletterSignup element props; removes some feature-flag/legacy fields. |
| dotcom-rendering/src/lib/newsletterSignupTracking.ts | Removes AB test constant; replaces variant-based IDs with stable IDs. |
| dotcom-rendering/src/lib/newsletterSignupTracking.test.ts | Updates ID expectations and abTest assertions after refactor. |
| dotcom-rendering/src/components/SecureSignup.island.tsx | Uses a stable secureSignup component ID regardless of abTest variant. |
| dotcom-rendering/src/components/SecureSignup.island.test.tsx | Updates expectations for stable SecureSignup tracking ID. |
| dotcom-rendering/src/components/NewsletterSignupForm.island.tsx | Adds required componentId prop and threads into hook. |
| dotcom-rendering/src/components/NewsletterSignupForm.island.test.tsx | Updates test render helper to pass componentId. |
| dotcom-rendering/src/components/NewsletterSignupForm.island.stories.tsx | Adds componentId to story args. |
| dotcom-rendering/src/components/NewsletterSignupCardContainer.tsx | Updates preview tracking to use the stable in-article component ID. |
| dotcom-rendering/src/components/NewsletterSignupCardContainer.test.tsx | Updates tracking assertions for new component ID helper. |
| dotcom-rendering/src/components/Masthead/Newsletter/HighlightsNewsletterSignupModal.tsx | Passes explicit highlights component ID into NewsletterSignupForm. |
| dotcom-rendering/src/components/EmailSignUpWrapper.stories.tsx | Removes AB scaffolding stories/mocks; updates scenarios for consolidated component. |
| dotcom-rendering/src/components/EmailSignUpWrapper.island.tsx | Removes AB branching; always renders card + form and uses stable component ID. |
| dotcom-rendering/src/components/EmailSignUpWrapper.island.test.tsx | Updates rendering/tracking assertions to reflect consolidated behavior and IDs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ean-up-component-id-tracking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
Refactors
EmailSignUpWrapperand related newsletter signup components to remove AB test scaffolding and simplify the component structure:EmailSignUpWrapper— the component now unconditionally rendersNewsletterSignupCardContainerrather than switching between legacyEmailSignup/SecureSignupand the new card designEmailSignUpWrapper— dropsuseNewsletterSubscription,listId,idApiUrl,successDescription,hideNewsletterSignupComponentForSubscribers, andshowNewNewsletterSignupCardpropsinArticleSignupForm,secureSignup,highlightsCard) rather than named after AB variants (control,variantIllustratedCard,variantNewField)componentIdexplicitly intoNewsletterSignupFormanduseNewsletterSignupFormrather than deriving it fromabTest.variant, decoupling tracking from test stateWhy?
The
newsletters-signup-card-country-illustrationAB test has concluded. The illustrated card design (variantIllustratedCard) is now the permanent behaviour, so the legacyEmailSignup/SecureSignuprendering path and all the AB test branching logic can be deleted.The explicit
componentIdprop onNewsletterSignupFormresolves a TODO left inuseNewsletterSignupForm— callers have the context to know which component ID to use, so the form itself shouldn't need to derive it from test metadata.Screenshots
This is a refactor with no visual change — the rendered output is identical to the
variantIllustratedCardbranch that was already live.