Newsletter Signup Form - signed in and out#15747
Conversation
12262f4 to
ac85def
Compare
…d theme integration
172c794 to
de508c3
Compare
mgosz-guardian
left a comment
There was a problem hiding this comment.
2 comments. One v minor, other possibly worth looking at.
| 'captcha-not-passed', | ||
| renderingTarget, | ||
| ); | ||
| setIsWaitingForResponse(false); |
There was a problem hiding this comment.
This flag is set to false in the happy path. I think we might have a possible edge case when the recaptcha fails (due network issue for example) and the user could be stuck due to this flag not switched to false.
7738832 to
de18733
Compare
| }; | ||
|
|
||
| const containerStyles = css` | ||
| clear: left; |
There was a problem hiding this comment.
Hey, I'm curious about the use of clear here. I guess traditionally this would have been paired with floated elements. But nowadays we tend to use flex box to handle similar layouts. It looks like we are using flex and not float, I"ve never seen clear used with flex before.
There was a problem hiding this comment.
It's needed to clear a floated element from the previous block in dynamic content in an article page - EmailSignup.tsx does it. However it's not needed on the container actually as it's on the divider above which was added recently. I've removed it from the container and kept it on the divider styles.
|
Seen on PROD (merged by @georgerichmond 10 minutes and 17 seconds ago) Please check your changes! |
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.