-
Notifications
You must be signed in to change notification settings - Fork 30
Sign-in gate: emit events for ad slots #14605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds event emission for ad slots to signal when the sign-in gate popup is viewed or dismissed, enabling suspension of ad refreshing during popup display.
- Emits new events:
article:sign-in-gate-${signInGateVersion}-viewed
andarticle:sign-in-gate-${signInGateVersion}-dismissed
- Refactors gate version determination to use treatment type instead of prop-based configuration
- Moves
getAuxiaGateVersion
call to top level for consistent version handling across components
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
SignInGatePortal.tsx | Updates auxiaGateDisplayData type to be required and simplifies getAuxiaGateVersion call |
SignInGateSelector.importable.tsx | Removes signInGateVersion prop, moves version determination to top level, adds event emission logic |
types.ts | Adds clarifying comment about gate versions |
SignInGate.stories.tsx | Updates stories to use treatmentType instead of signInGateVersion prop |
Comments suppressed due to low confidence (1)
dotcom-rendering/src/components/SignInGateSelector.importable.tsx:1
- The call to getAuxiaGateVersion is missing the first parameter after removing the signInGateVersion parameter. The function signature expects userTreatment as the first parameter, but this is passing it as the second.
import { getCookie, isUndefined, storage } from '@guardian/libs';
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
dotcom-rendering/src/components/SignInGateSelector.importable.tsx
Outdated
Show resolved
Hide resolved
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. |
We need to signal to the ad slots when the popup gate is being viewed, and when it has been dismissed. This is so that ad refreshing can be suspended.
This PR does this by emitting new CustomEvents for tracking modals:
modal:open
modal:close
In the
detail
object it also specifiesmodalType: 'sign-in-gate-v2'
The PR also makes some small improvements:
signInGateVersion
prop from the top-levelSignInGateSelector
component. This was only added for storybook, but it's simpler if we only use thetreatmentType
field for determining the version.getAuxiaGateVersion
up to the top level, so that we can use the version for these new events