Newsletter Signup Form - signed in and out#15747
Open
georgerichmond wants to merge 4 commits intomainfrom
Open
Newsletter Signup Form - signed in and out#15747georgerichmond wants to merge 4 commits intomainfrom
georgerichmond wants to merge 4 commits intomainfrom
Conversation
12262f4 to
ac85def
Compare
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?
Implements the signed-in and signed-out flows for the new
NewsletterSignupFormcomponent, closing issues #15678 and #15686.New components & files
NewsletterSignupForm.island.tsx— the new auth-aware signup form, replacingSecureSignupas the inner content of the newsletter signup card whenshowNewNewsletterSignupCardis enabled. Supports both signed-in (email pre-filled from Identity, email input hidden) and signed-out (email input visible) states in a single component.useNewsletterSignupForm.ts— a custom hook that encapsulates all form state and side-effects (email resolution, reCAPTCHA, Ophan tracking, form submission). Extracted from the component so that every visual state is trivially reproducible in Storybook by mocking a single hook, and to keep the component itself as a pure rendering layer.Signed-in flow (closes #15678)
<input>is hiddenSecureSignupSigned-out flow (closes #15686)
SecureSignupWhy a custom hook?
All form logic (email fetch, reCAPTCHA, marketing opt-in, Ophan tracking, submission, validation) lives in
useNewsletterSignupForm. This separation means:NewsletterSignupFormActiveis purely a rendering layer, making it straightforward to review and maintain.Refactored from
SecureSignupThe submission and tracking logic (
buildFormData,postFormData,sendTracking) has been lifted fromSecureSignup.island.tsxand consolidated intouseNewsletterSignupForm.SecureSignupwas previously used as an intermediate placeholder inside the new card; it is now replaced byNewsletterSignupForm.Other changes
NewsletterSignupCardContainerupdated to accept a render-propchildren(so it can passopenPreviewdown), and now renders the privacy message outside the card when the user is signed inEmailSignUpWrapperwired up to passisSignedInand the new form props through toNewsletterSignupCardContainerrenderElement.tsxprop name corrected (showNewsletterSignupCard→showNewNewsletterSignupCard)NewsletterSignupCardstyle tweaks (illustration size, spacing)Why?
Part of the rollout of the new newsletter signup card design. This PR delivers the complete signup experience for both signed-in and signed-out readers.