Skip to content

add questionnaire to onboarding#28119

Closed
michellescripts wants to merge 3 commits intomasterfrom
michelle/onboard-q-flow
Closed

add questionnaire to onboarding#28119
michellescripts wants to merge 3 commits intomasterfrom
michelle/onboard-q-flow

Conversation

@michellescripts
Copy link
Copy Markdown
Contributor

@michellescripts michellescripts commented Jun 21, 2023

This PR adds the questionnaire survey to the onboarding flow. On save, the full survey results are sent to Sales Center, Resources are saved to cluster state (user preferences) and a Posthog event is triggered.

This does not include:

  • final design
  • showing partial surveys (full is hardcoded as true)
  • showing the survey after login if registered before the release of this feature

blocked by: https://github.com/gravitational/teleport.e/pull/1713
supports: https://github.com/gravitational/cloud/issues/4802

@michellescripts michellescripts force-pushed the michelle/onboarding-questions branch from 6ded613 to 6a4dbd0 Compare June 22, 2023 16:57
@michellescripts michellescripts force-pushed the michelle/onboard-q-flow branch from d3fe3c7 to 0301db7 Compare June 22, 2023 17:05
@michellescripts michellescripts force-pushed the michelle/onboarding-questions branch from 6a4dbd0 to 1c7225e Compare June 23, 2023 16:34
@michellescripts michellescripts force-pushed the michelle/onboard-q-flow branch from 0301db7 to 36be9c3 Compare June 23, 2023 16:45
@michellescripts michellescripts force-pushed the michelle/onboarding-questions branch from 1c7225e to 0147c30 Compare June 23, 2023 18:56
@michellescripts michellescripts force-pushed the michelle/onboard-q-flow branch from 36be9c3 to 4b76789 Compare June 26, 2023 15:20
@michellescripts michellescripts force-pushed the michelle/onboarding-questions branch 3 times, most recently from 33527b4 to 03ea22f Compare June 26, 2023 15:43
@michellescripts michellescripts force-pushed the michelle/onboard-q-flow branch from 2bf7b46 to 763b140 Compare June 26, 2023 15:54
Base automatically changed from michelle/onboarding-questions to master June 26, 2023 16:09
@michellescripts michellescripts force-pushed the michelle/onboard-q-flow branch 6 times, most recently from 2550b52 to cbd398f Compare June 30, 2023 17:55
@michellescripts michellescripts changed the base branch from master to michelle/onboard-user-preferences June 30, 2023 17:55
@michellescripts michellescripts force-pushed the michelle/onboard-q-flow branch from cbd398f to 4135e64 Compare June 30, 2023 18:19
@michellescripts michellescripts force-pushed the michelle/onboard-user-preferences branch 7 times, most recently from 75ea1f5 to b803712 Compare July 3, 2023 17:25
@michellescripts michellescripts force-pushed the michelle/onboard-q-flow branch from ae75e1c to 2c40f65 Compare July 3, 2023 17:56
Base automatically changed from michelle/onboard-user-preferences to master July 3, 2023 18:01
@michellescripts michellescripts force-pushed the michelle/onboard-q-flow branch from 2c40f65 to d446b9f Compare July 3, 2023 19:14
@michellescripts michellescripts force-pushed the michelle/onboard-q-flow branch 3 times, most recently from 0915391 to 37ebc1d Compare July 3, 2023 21:40
Comment thread lib/web/apiserver.go Outdated
Comment on lines 809 to 812
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I would love thoughts on this change. Are we still secure if leveraging WithAuthCookieAndCSRF?

We set a bearer token on redirect to /web at the end of the registration. Until then, there is no bearer token to check.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tbh, i'm not sure either... i would love to know a definite answer though, because i have questions, like why not all protected endpoints use that too then? (perhaps these endpoints where it's used, the consequence aren't as high?) and also why didn't we pass the access token instead of the csrf token in the form? (this form is located where user was already authenticated)

but i took a look at WithAuthCookieAndCSRF and it's intended for non-ajax request (forms) so I would generally stay away from it.

i wonder if we can use local storage to temporarily store the user preference, then on init, we can update user preference there, and then delete that storage key?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Follow up PR

@michellescripts michellescripts force-pushed the michelle/onboard-q-flow branch 3 times, most recently from f913506 to 427074e Compare July 3, 2023 21:49
@michellescripts michellescripts marked this pull request as ready for review July 3, 2023 21:50
@github-actions github-actions Bot requested a review from gzdunek July 3, 2023 21:50
@github-actions github-actions Bot added the ui label Jul 3, 2023
Comment thread web/packages/teleport/src/Welcome/Questionnaire/Role.tsx Outdated
Comment thread web/packages/teleport/src/Welcome/Questionnaire/types.ts Outdated
Comment thread web/packages/teleport/src/config.ts Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

shoot... idk how strict we want to be with enterprise endpoints not being in enterprise config

if you already got an ok from someone to do it like this, i'm okay with it. Otherwise, we might need to create an enterprise version of Welcome and move questionaire comps into enterprise (this would've been the direction I would've taken).

though tbh, this feature is mostly a data collection for us, so i'm inclined to say it's okay to be in OS? but i'd get a third opinion

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There is a plan to add this survey to the OSS onboarding flow as well; we wouldn't submit OSS responses to Sales Center... but that's why I built it out in Teleport vs. Teleport.e. We could duplicate this down to E, and have essentially duplicate onboarding flows with the exception of one making an additional call... but I don't like the maintenance of keeping them in sync.

I'm thinking about this; I don't have a solid answer yet. I'm going to brainstorm a bit more.

Comment thread lib/web/apiserver.go Outdated
Comment on lines 809 to 812
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tbh, i'm not sure either... i would love to know a definite answer though, because i have questions, like why not all protected endpoints use that too then? (perhaps these endpoints where it's used, the consequence aren't as high?) and also why didn't we pass the access token instead of the csrf token in the form? (this form is located where user was already authenticated)

but i took a look at WithAuthCookieAndCSRF and it's intended for non-ajax request (forms) so I would generally stay away from it.

i wonder if we can use local storage to temporarily store the user preference, then on init, we can update user preference there, and then delete that storage key?

Comment thread web/packages/teleport/src/services/survey/index.ts Outdated
Comment thread web/packages/teleport/src/Welcome/NewCredentials/NewCredentials.test.tsx Outdated
Comment thread web/packages/teleport/src/Welcome/NewCredentials/NewCredentials.test.tsx Outdated
Comment thread web/packages/teleport/src/Welcome/NewCredentials/NewCredentials.tsx Outdated
Comment thread web/packages/teleport/src/Welcome/NewCredentials/NewPassword.tsx Outdated
Comment thread web/packages/teleport/src/Welcome/NewCredentials/NewPasswordlessDevice.tsx Outdated
Comment thread web/packages/teleport/src/Welcome/NewCredentials/Success.tsx Outdated
Comment thread web/packages/teleport/src/Welcome/Questionnaire/Role.test.tsx Outdated
Comment thread web/packages/teleport/src/Welcome/Questionnaire/Role.test.tsx Outdated
@michellescripts michellescripts force-pushed the michelle/onboard-q-flow branch from 427074e to d3a55f3 Compare July 5, 2023 19:04
- Adds user context wrapper to the Welcome flow in order to update preferences
- Sets selected resources on user preferences
@michellescripts michellescripts force-pushed the michelle/onboard-q-flow branch from 820b79b to daf802b Compare July 6, 2023 15:16
@michellescripts michellescripts marked this pull request as draft July 6, 2023 23:57
@michellescripts
Copy link
Copy Markdown
Contributor Author

Closing this PR, moving survey to E.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants