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

Setup guided flow redirects #91094

Merged
merged 5 commits into from
May 28, 2024
Merged

Setup guided flow redirects #91094

merged 5 commits into from
May 28, 2024

Conversation

heavyweight
Copy link
Contributor

@heavyweight heavyweight commented May 24, 2024

Related to 7365-gh-Automattic/dotcom-forge

Proposed Changes

The guided flow has a few cases where we want to redirect the users to another flow.

  1. If the user answers Migrating or importing an existing site we redirect to /setup/import-hosted-site
  2. If the user answer Create newsletter we redirect to /setup/newsletter
  3. If the user answers Sell something and Get a website built quickly we redirect to /start/do-it-for-me-store
  4. If the user answers Get a website built quickly we redirect to /start/do-it-for-me

image

Why are these changes being made?

  • The SegmentationSurvey didn't offer a way to bypass the navigation to the next page. To avoid navigation issues after redirection I extended it to have skipNextNavigation which is called with the question key and answers. This will easily allow us to customize how the navigation happens and avoid issues with history.

Testing Instructions

  • Visit /start/guided
  • Verify that selecting Migrating or importing an existing site will redirect to /setup/import-hosted-site
  • Verify that selecting Create newsletter will redirect to /setup/newsletter
  • Verify that by selecting Sell something and Get a website built quickly we redirect to /start/do-it-for-me-store
  • Verify that by selecting Get a website built quickly we redirect to /start/do-it-for-me

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label May 24, 2024
}

if ( _answerKeys.includes( 'client' ) ) {
// return `/setup/${ IMPORT_HOSTED_SITE_FLOW }`;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@escapemanuele for some reason I thought that we needed to redirect to a separate flow for agencies. Will delete it

Copy link
Contributor

Choose a reason for hiding this comment

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

No, only migration, difm and newsletter!

@matticbot
Copy link
Contributor

matticbot commented May 24, 2024

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Async-loaded Components (~190 bytes added 📈 [gzipped])

name                                    parsed_size           gzip_size
async-load-signup-steps-initial-intent       +437 B  (+0.4%)     +190 B  (+0.6%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@escapemanuele escapemanuele marked this pull request as ready for review May 24, 2024 14:27
@heavyweight heavyweight requested a review from phcp May 24, 2024 14:34
@agrullon95 agrullon95 self-requested a review May 24, 2024 14:52
@matticbot
Copy link
Contributor

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • odyssey-stats

To test WordPress.com changes, run install-plugin.sh $pluginSlug setup/guided-flow-redirects on your sandbox.

@@ -79,6 +81,11 @@ const useSegmentationSurveyNavigation = ( {
recordContinueEvent( currentQuestion, answers );

await onContinue?.( currentQuestion );

if ( skipNextNavigation?.( currentQuestion.key, answers?.[ currentQuestion.key ] ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

cc. @phcp incase you have any thoughts on these changes inside the segmentation survey.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for pinging, it looks good to me. 😄

@@ -40,7 +41,38 @@ export default function InitialIntentStep( props: Props ) {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [] );

const getRedirectForAnswers = ( _answerKeys: string[] ): string => {
if ( _answerKeys.includes( 'migrate-or-import-site' ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The redirection changes are working well!

Adding a reminder that we need to handle the scenario when the user selects the Create a site for a client option for the first question. It does not need to be done in this PR.

CleanShot 2024-05-24 at 16 02 51@2x

Based on the segment for that option, the user should not be redirected to any of these custom flows. We have to add logic to skip the second goal question if the user selects Create a site for a client. (@wongasy - Correct me if this is inaccurate).

Copy link
Contributor

Choose a reason for hiding this comment

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

We have to add logic to skip the second goal question if the user selects Create a site for a client

Yes, we shouldn't show the second question in that case nor the user be redirected. We should go on and show the appropriate plans.

The only doubt I have is that in Figma https://www.figma.com/design/3u71fUJraClkRQiLrAORPf/Trail-Map-Project?node-id=3981-1577&m=dev there is Hosting Flow (Developers / Agencies). Is that something we don't need? @nuriapenya @wongasy

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, https://github.com/Automattic/dotcom-forge/issues/7433, as Q1 is not skippable for now

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @escapemanuele for reaching out for clarification!

The requirements have evolved and the design we have in Figma doesn't necessarily match up with what we landed on for the solution.

If users answered "Create a site for a client", they should not see question 2, but instead be taken to the plans page. We also need to add a link to A4A sign up in the plans page (which wasn't mentioned in the PT). Looks like we'll also need a design from @nuriapenya for that. Let's also ensure we gate the A4A link such that it only shows up for users in the developer segment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Opened https://github.com/Automattic/dotcom-forge/issues/7434 to keep track of the A4A link.

Choose a reason for hiding this comment

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

Updated i2 designs in Figma and added more context on Slack: p1716831873951849/1716813332.564069-slack-C0347E545HR

Copy link
Contributor

@phcp phcp left a comment

Choose a reason for hiding this comment

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

Nice work! The PR looks good, I also tested on the Entrepreneur Trial flow and I haven't spotted any regression.

@@ -79,6 +81,11 @@ const useSegmentationSurveyNavigation = ( {
recordContinueEvent( currentQuestion, answers );

await onContinue?.( currentQuestion );

if ( skipNextNavigation?.( currentQuestion.key, answers?.[ currentQuestion.key ] ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for pinging, it looks good to me. 😄

@heavyweight heavyweight merged commit 489ec8e into trunk May 28, 2024
11 checks passed
@heavyweight heavyweight deleted the setup/guided-flow-redirects branch May 28, 2024 08:55
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

7 participants