-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
ref(project): use hasFlags flag for CTA check #83282
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
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
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.
Per @antonpirker's comment we can no longer rely on the context being present. getsentry/sentry-python#3917 (comment)
cmanallen
left a comment
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.
After offline discussion, we need the flags context check.
use the newly implemented `hasFlags` project flag as the final layer to
determine whether the CTA should be shown.
## TLDR: the CTA only shows up if... project has never sent flags
before, `event.contexts.flags` is undefined, the platform is correct, &
the org is under the cta flag.
```
const showCTA =
!project.hasFlags &&
!hasFlagContext &&
featureFlagOnboardingPlatforms.includes(project.platform ?? 'other') &&
organization.features.includes('feature-flag-cta');
```
here are the following possible code paths (all are tested)
## `event.contexts.flags = [ ... ]` -> flag table rendered
<img width="870" alt="SCR-20250110-nkne"
src="https://github.com/user-attachments/assets/595d0e2e-8c5f-42f6-aa16-2ee5bcead68d"
/>
## `event.contexts.flags = [ ]` -> empty state
<img width="849" alt="SCR-20250110-nlkr"
src="https://github.com/user-attachments/assets/af07507e-e177-4c73-979b-4ea652eb73c2"
/>
## `event.contexts.flags = undefined` and `hasFlags = true` -> empty
state
<img width="849" alt="SCR-20250110-nlkr"
src="https://github.com/user-attachments/assets/af07507e-e177-4c73-979b-4ea652eb73c2"
/>
## `event.contexts.flags = undefined` and `hasFlags = false` and
`feature-flag-cta = true` and `platform in [javascript, python]` -> CTA
shown
<img width="846" alt="SCR-20250110-nkul"
src="https://github.com/user-attachments/assets/07e123a3-fcab-48da-acd0-62d89a9d6a6b"
/>
## `event.contexts.flags = undefined` and `feature-flag-cta = true` and
`platform !in [javascript, python]` -> section hidden
## `event.contexts.flags = undefined` and `feature-flag-cta = false` ->
section hidden
Closes getsentry/team-replay#529
use the newly implemented
hasFlagsproject flag as the final layer to determine whether the CTA should be shown.TLDR: the CTA only shows up if... project has never sent flags before,
event.contexts.flagsis undefined, the platform is correct, & the org is under the cta flag.here are the following possible code paths (all are tested)
event.contexts.flags = [ ... ]-> flag table renderedevent.contexts.flags = [ ]-> empty stateevent.contexts.flags = undefinedandhasFlags = true-> empty stateevent.contexts.flags = undefinedandhasFlags = falseandfeature-flag-cta = trueandplatform in [javascript, python]-> CTA shownevent.contexts.flags = undefinedandfeature-flag-cta = trueandplatform !in [javascript, python]-> section hiddenevent.contexts.flags = undefinedandfeature-flag-cta = false-> section hiddenCloses https://github.com/getsentry/team-replay/issues/529