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

DT-979: Add Appcues Support #2722

Merged
merged 10 commits into from
Nov 15, 2024
Merged

DT-979: Add Appcues Support #2722

merged 10 commits into from
Nov 15, 2024

Conversation

rushtong
Copy link
Contributor

@rushtong rushtong commented Nov 12, 2024

Addresses

https://broadworkbench.atlassian.net/browse/DT-979

Summary

This PR adds Appcues support to DUOS. This borrows heavily from Terra's implementation, similarly to how we borrow our Metrics implementation. See how Terra does this:

See also: https://github.com/broadinstitute/terra-helmfile/pull/5951

Notable Features

  • Typescriptify Metrics
    • Related to that, we needed a custom type for @databiosphere/bard-client since there is only a js client.
  • Typescriptify events
  • We now register an Appcues user on any sign-in or registration
  • We now register an Appcues tracking event on any tracked Metrics event

Local Testing

If you have an account in Appcues, you can log in and see events in the "Events Explorer" page. The examples I have here are from signing in locally with a dev account.

Note that when I was testing locally, I was sending the Sam subject id. Since that time, I've updated the code to send the same OIDC user profile sub value that Terra uses.

Screenshot 2024-11-12 at 12 48 57 PM

Screenshot 2024-11-12 at 12 52 05 PM


Have you read Terra's Contributing Guide lately? If not, do that first.

  • Label PR with a Jira ticket number and include a link to the ticket
  • Label PR with a security risk modifier [no, low, medium, high]
  • PR describes scope of changes
  • Get a minimum of one thumbs worth of review, preferably two if enough team members are available
  • Get PO sign-off for all non-trivial UI or workflow changes
  • Verify all tests go green
  • Test this change deployed correctly and works on dev environment after deployment

@@ -22,7 +22,6 @@
<link rel="icon" type="image/png" href="%PUBLIC_URL%/images/favicon/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="%PUBLIC_URL%/images/favicon/favicon-16x16.png" sizes="16x16" />
<link rel="mask-icon" href="%PUBLIC_URL%/images/favicon/safari-pinned-tab.svg">
<script src="https://accounts.google.com/gsi/client" async defer id="gsiClient"></script>
Copy link
Contributor Author

@rushtong rushtong Nov 12, 2024

Choose a reason for hiding this comment

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

Drive by fix - we removed "google sign in" in #2667

Comment on lines +9 to +10
// Set default timeout for all metrics calls to 30 seconds
const defaultSignal: AbortSignal = AbortSignal.timeout(30000);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that this was necessary for typescriptification to make all the axios calls compile. I'm open to alternative suggestions here but this seems like a safe timeout for bard & appcues calls.

@rushtong rushtong marked this pull request as ready for review November 13, 2024 16:19
@rushtong rushtong requested a review from a team as a code owner November 13, 2024 16:19
@rushtong rushtong requested review from snf2ye and s-rubenstein and removed request for a team November 13, 2024 16:19
Copy link
Contributor

@s-rubenstein s-rubenstein left a comment

Choose a reason for hiding this comment

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

Nothing here looks unreasonable!

src/components/SignInButton.tsx Outdated Show resolved Hide resolved
src/libs/ajax/Metrics.ts Outdated Show resolved Hide resolved
@@ -5,8 +5,11 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<script src="https://accounts.google.com/gsi/client" async defer id="gsiClient"></script>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Another drive by fix - we removed "google sign in" in #2667

Comment on lines +9 to +12
<!-- AppCues Requirements -->
<script type="text/javascript">
window.AppcuesSettings = { enableURLDetection: true };
</script>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm open to testing suggestions here. I was unable to figure out a way to unit test the global Appcues window object.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think at some point it is worth trusting the library. We could add tests that verify we're setting the right values, but as far as appcues itself, I think that's probably out of our purview to test? But happy to have that contested

Copy link
Contributor

@fboulnois fboulnois left a comment

Choose a reason for hiding this comment

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

looks good 👍

@rushtong rushtong merged commit 32a96aa into develop Nov 15, 2024
9 checks passed
@rushtong rushtong deleted the gr-DT-979-appcues branch November 15, 2024 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants