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

Focused Launch: Add persistent success view after launch #47808

Merged

Conversation

razvanpapadopol
Copy link

@razvanpapadopol razvanpapadopol commented Nov 26, 2020

Changes proposed in this Pull Request

There are two special cases after launching a site from the editor using Focused Launch:

  • the user completes a purchase (eg: Premium plan) and they get redirected to Thank you page
  • the user navigates away from the editor without dismissing the Success View by pressing one of the action buttons.

In these cases, when returning to the editor, Success View is displayed.

Testing instructions

Run the project locally

  • Make sure you're connected to your sandbox, and that your sandbox is clean and up to date
  • Check out the branch on your machine and run in two parallel terminal windows:
    • yarn && yarn start
    • cd apps/editing-toolkit && yarn dev --sync

Open the Focused Launch modal

  1. Add a new, unlaunched site created with /start to your sandbox (for convenience, SITE_ID)
  2. Visit calypso.localhost:3000/page/SITE_ID/home?flags=create/focused-launch-flow and click on the "Launch" button. The Focused Launch modal should appear.

Focused launch — selecting the free options

  1. Follow instructions from the previous Run the project locally and Open the Focused Launch modal sections
  2. Select free domain and plan and click "Launch your site" at the bottom
    • The loading view and then Success view should appear.

Focused launch — selecting paid options, but exiting checkout without paying

  1. Follow instructions from the previous Run the project locally and Open the Focused Launch modal sections
  2. Select a paid domain and a paid plan
    • The loading view and then checkout overlay should be displayed
  3. Close the checkout overlay without completing the purchase
    • The Success view should be shown, giving you the option to continue editing (no redirect)

Focused launch — selecting paid options, with successful payment

  1. Follow instructions from the previous Run the project locally and Open the Focused Launch modal sections
  2. Select a paid domain and a paid plan
    • The loading view and then checkout overlay should be displayed
  3. Complete the plan purchase
    • You should be redirected to Thank you page (depending on the plan)
    • After skipping the upsell you should be redirected back to block editor. The Focused Launch modal should open automatically and show the Success view (with some delay, as discussed in this comment)

Fixes #47392

(it fixes #47392 only partially, but it is the last spec left in that issue)

@razvanpapadopol razvanpapadopol added this to the Focused Launch: MVP milestone Nov 26, 2020
@razvanpapadopol razvanpapadopol self-assigned this Nov 26, 2020
@matticbot
Copy link
Contributor

@matticbot
Copy link
Contributor

matticbot commented Nov 26, 2020

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

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

name                                           parsed_size           gzip_size
async-load-calypso-blocks-editor-launch-modal        +31 B  (+0.0%)      +83 B  (+0.2%)

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.

@razvanpapadopol
Copy link
Author

@ollierozdarz
Here is a demo of how this currently works: https://cloudup.com/cEGZnSLCDiP
Around the second 12, you'll see a sudden transition from editor to Success view. Is this fine, should we try to remove the transition or should we delay the Success view appearance with 1-2 seconds?

Another open point is when to use this behaviour:

  • only after a redirect to checkout thank you page (point 1 in description)
  • only in a certain time interval after site launch (eg: the following 5 minutes)

@ollierozdarz
Copy link

@razvanpapadopol I think we should try delay this by a couple of seconds (let's say 2 seconds) once a user enters the editor - that way it doesn't feel like a bug or so jarring. If we can add some CSS easing (ease-out) to the Thank you page/modal as well then it'll also take the edge off.

@razvanpapadopol razvanpapadopol force-pushed the update/focused-launch-persistent-success-view branch from 91ec62b to b51e1b8 Compare November 27, 2020 14:08
Base automatically changed from add/focused-launch/launch-button to trunk November 30, 2020 13:56
@ciampo ciampo self-assigned this Dec 1, 2020
@ciampo ciampo force-pushed the update/focused-launch-persistent-success-view branch from b51e1b8 to 3c435ce Compare December 1, 2020 13:22
@ciampo
Copy link
Contributor

ciampo commented Dec 1, 2020

It took a while, but I should have correctly rebased this branch on top of trunk, leaving only the actual changes that this PR makes in the diff.
While in the process, I also fixed the build issue by renaming a few instances of the hideSuccessView() that were missed in previous commits.

All checks should pass now — I'll start addressing the remaining feedback

@@ -35,6 +35,9 @@ const FocusedLaunchModal: React.FunctionComponent< Props > = ( {
const isModalTitleVisible = useSelect( ( select ) =>
select( LAUNCH_STORE ).isModalTitleVisible()
);
const shouldDisplaySuccessView = useSelect( ( select ) =>
select( LAUNCH_STORE ).shouldDisplaySuccessView()
);
Copy link
Contributor

Choose a reason for hiding this comment

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

More of a curiosity of mine, but I wonder if it'd be more efficient to select from the Launch Store only once:

const { isModalDismissible, isModalTitleVisible, shouldDisplaySuccessView } = useSelect(
	( select ) => {
		const launchSelect = select( LAUNCH_STORE );
		return {
			isModalDismissible: launchSelect.isModalDismissible(),
			isModalTitleVisible: launchSelect.isModalTitleVisible(),
			shouldDisplaySuccessView: launchSelect.shouldDisplaySuccessView(),
		};
	}
);

Copy link
Author

Choose a reason for hiding this comment

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

Ideally I think we should call useSelect only once in a component if the dependencies Array (second argument of useSelect) is the same and in this case is undefined.

Example with deps: https://github.com/Automattic/wp-calypso/blob/trunk/client/landing/gutenboarding/hooks/use-free-domain-suggestion.ts#L15-L26
Example with multiple stores accessed in one call: https://github.com/Automattic/wp-calypso/blob/trunk/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nav-sidebar/src/components/nav-sidebar/index.tsx#L47-L57

Copy link
Author

Choose a reason for hiding this comment

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

Added the change in 9fc3bc7

I'm not going to create a janitorial issue for this but let's keep in mind and use this pattern at least until we have something better from readability & performance PoV.

FYI @Automattic/luna

@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 Dec 1, 2020
@ciampo
Copy link
Contributor

ciampo commented Dec 1, 2020

I think we should try delay this by a couple of seconds (let's say 2 seconds) once a user enters the editor - that way it doesn't feel like a bug or so jarring.

This part should be addressed (needs to be reviewed / tested)

If we can add some CSS easing (ease-out) to the Thank you page/modal as well then it'll also take the edge off.

@ollierozdarz Just to make sure, what do you mean by "Thank you page/modal"?

@ollierozdarz
Copy link

Hey @ciampo, sorry, confusing wording 🙂 This is the page I'm talking about:

Screen Shot 2020-12-02 at 7 16 07 am

// @TODO:
// - if this is a block editor specific feature, move to the LaunchContext
// and only specify when including Focused Launch thorugh Editing Toolkit
// - think about a less hacky way to achieve this (e.g. @wordpress/hooks?)
Copy link
Author

Choose a reason for hiding this comment

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

Good catch! Let's move this to Editing Toolkit for now since this side effect is applied only inside the editor (hiding the Launch button).

Copy link
Author

Choose a reason for hiding this comment

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

Done in 1a7836f

Copy link
Contributor

@ciampo ciampo Dec 2, 2020

Choose a reason for hiding this comment

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

Wonder if we should still add a janitorial issue to implement this functionality in a less hacky way? Adding a class to the body works for now but it's not very robust

Copy link
Author

Choose a reason for hiding this comment

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

Here it is 👉 #47988
It's not assigned to any milestone since this more a general [editor - launch] integration issue.

@ciampo
Copy link
Contributor

ciampo commented Dec 2, 2020

Hey @ciampo, sorry, confusing wording 🙂 This is the page I'm talking about:

Tracked separately in #47962

@matticbot
Copy link
Contributor

Caution: This PR affects files in the Editing Toolkit Plugin on WordPress.com
Please ensure your changes work on WordPress.com before merging.

D53663-code has been created so you can easily test it on your sandbox. See this FieldGuide page about developing the Editing Toolkit Plugin for more info: PCYsg-ly5-p2

@razvanpapadopol razvanpapadopol force-pushed the update/focused-launch-persistent-success-view branch from d5b58b6 to 9fc3bc7 Compare December 2, 2020 19:05
Razvan Papadopol and others added 8 commits December 3, 2020 08:37
* Update isFocusedLaunchOpen to use shouldDisplaySuccessView
* Use shouldDisplaySuccessView to render Success view as the initial route when opening Focused Launch
* Dispatch hideSuccessView when interacting with action buttons on the Success view
…tSuccessView and disablePersistentSuccessView
@razvanpapadopol razvanpapadopol force-pushed the update/focused-launch-persistent-success-view branch from 9fc3bc7 to dcae170 Compare December 3, 2020 06:38
@razvanpapadopol razvanpapadopol requested review from a team and ciampo and removed request for ciampo December 3, 2020 06:43
Copy link
Contributor

@ciampo ciampo left a comment

Choose a reason for hiding this comment

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

The first round of feedback has been addressed. Probably better if someone who hasn't worked on this PR has a look too

@yansern
Copy link
Contributor

yansern commented Dec 3, 2020

Alright, all the test instructions have been tested and works as described.

Although I have to say, that upsell copy after making the purchase is rather tacky & wordy, it's a bit of a buzzkill after that whole sleek experience of launching a site.

image

Copy link
Contributor

@yansern yansern left a comment

Choose a reason for hiding this comment

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

The success view is truly persistent, even after refreshing the block editor, it shows up until user clicks on one of the buttons.

Code wise, in a nutshell, everything revolves around these 3 things:

  • shouldDisplaySuccessView
  • enablePersistentSuccessView
  • disablePersistentSuccessView

LGTM. Tested. Good to go.

@razvanpapadopol razvanpapadopol merged commit 268ea23 into trunk Dec 3, 2020
@razvanpapadopol razvanpapadopol deleted the update/focused-launch-persistent-success-view branch December 3, 2020 14:02
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Dec 3, 2020
@rickybanister
Copy link

@donlair should the interstitial offer above be shown during the launch flow as well as signup? Is it supposed to be seen after all checkout experiences? I agree that it deflates the launch flow a bit, but wanted to confirm the intention.

@razvanpapadopol
Copy link
Author

@rickybanister we'll prevent any redirect from Focused Launch after completing checkout and display the Success View which was designed by @ollierozdarz exactly for this purpose. More details in #48081

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

Successfully merging this pull request may close these issues.

Focused Launch: "Launch your site" button
6 participants