Skip to content
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

CSAT survey for Petition banner experiment(MNTOR-3224) #4775

Merged
merged 17 commits into from
Jul 11, 2024
Merged

Conversation

flozia
Copy link
Collaborator

@flozia flozia commented Jul 8, 2024

References:

Jira: MNTOR-3224

Description

Adds the CSAT banner for the “Petition banner experiment” introduced by PR #4711.

How to test

  1. (Re)build experiments: npm run build-nimbus
  2. Navigate to the dashboard
  3. US users should see the petition banner locally: Free users on the “action needed” and Plus users on the “fixed” tab.
  4. After dismissing the petition banner and revisiting the respective dashboard tab the follow-up CSAT survey should show.

Checklist (Definition of Done)

  • Commits in this PR are minimal and have descriptive commit messages.
  • I've added or updated the relevant sections in readme and/or code comments
  • I've added a unit test to test for potential regressions of this bug.
  • If this PR implements a feature flag or experimentation, the Ship Behind Feature Flag status in Jira has been set
  • Product Owner accepted the User Story (demo of functionality completed) or waived the privilege.
  • All acceptance criteria are met.
@flozia flozia requested review from Vinnl and codemist July 8, 2024 21:00
@flozia flozia self-assigned this Jul 9, 2024
Copy link
Collaborator

@Vinnl Vinnl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I follow the entire survey data logic yet, but nothing weird jumps out, and the rest looks good, and it works as intended, so :shipit:

config/nimbus.yaml Outdated Show resolved Hide resolved
Comment on lines 87 to 90
const hasDismissedDataPrivacyPetitionBanner =
typeof Object.keys(cookies.getAll()).find((cookieName) =>
cookieName.includes("data_privacy_petition_banner"),
) !== "undefined";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels a bit fragile to me, in that it would break if either <PetitionBanner> changes the key it passes to useLocalDismissal, or if useLocalDismissal changes the structure of the cookie name.

An alternative solution, I think, could be for <PetitionBanner> to export a small wrapper hook:

export const usePetitionBannerDismissal = () => useLocalDismissal("data_privacy_petition_banner");

and then this component could re-use that hook and check its isDismissed property?

Only if it's easy to do though, since I don't expect the above breakage to happen - it's just that I wouldn't dare rule it out either 😅

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other question: should the local dismissal ID maybe include the user's subscriber ID? So that if multiple users use Monitor on the same device, one user dismissing it won't dismiss it for the other user? Edge case, but still.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a custom useLocalDismissal hook here makes sense. Good point about including the subscriber ID to not run into the edge case described by you also. I’ve refactored this in 8c7888f and 8d7f3b4.

src/app/components/client/csat_survey/CsatSurvey.tsx Outdated Show resolved Hide resolved
): RelevantSurveyWithMetric | null => {
const surveys = getRelevantSurveys({ ...surveyData, ...props });

if (!surveys || surveys?.length === 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh nit, but the first leg already covers the ?:

Suggested change
if (!surveys || surveys?.length === 0) {
if (!surveys || surveys.length === 0) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes!

@flozia flozia requested a review from Vinnl July 11, 2024 12:40
Copy link
Collaborator

@Vinnl Vinnl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

// so the user is not being flashed directly with a second banner after the
// petition banner is being hidden.
rerender(<ComposedDashboardComponent />);
// The petition CSAT survey is only shown on the next visit of the dashboard
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, this was also confusing me a bit, so thanks for clarifying!

@flozia flozia merged commit 2c7d969 into main Jul 11, 2024
15 checks passed
@flozia flozia deleted the mntor-3224 branch July 11, 2024 14:09
Copy link

Cleanup completed - database 'blurts-server-pr-4775' destroyed, cloud run service 'blurts-server-pr-4775' destroyed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants