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

Jetpack Connect: abstract an HoC that handles connection redirects for JP sites. #42621

Merged
merged 8 commits into from
Jun 22, 2020

Conversation

AnnaMag
Copy link
Contributor

@AnnaMag AnnaMag commented May 25, 2020

Changes proposed in this Pull Request

  • move the Jetpack connection functionality to an HoC avoid code duplication.

This is a preparation for the WP.com/JP Jetpack Search purchase integration
to handle non-Jetpack sites and move away from the jetpack/connect route. Purchasing a product for the Jetpack sites includes connection checks, shared with the Jetpack Connect Flow.

The change is substantial, so for ease of review, this PR avoids major re-writes e.g. introducing Redux. Any further improvements can be handled separately.

Testing instructions

Connection Flow should change for none of the Jetpack statuses.

  • For any Jetpack plan, start the connection flow, e.g. /jetpack/connect/premium and verify that form copy, footer, input box, redirects are correct and functional, and that the flow leads to checkout. In order to verify that the plugin was correctly setup, to be tested with a Jetpack site that is unconnected, plugin deleted, or inactive.
  • the flow starting at /jetpack/connect without plan specified should end at the canonical plans page.

@AnnaMag AnnaMag added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it Jetpack labels May 25, 2020
@AnnaMag AnnaMag self-assigned this May 25, 2020
@matticbot
Copy link
Contributor

@matticbot
Copy link
Contributor

matticbot commented May 25, 2020

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

Sections (~171 bytes added 📈 [gzipped])

name             parsed_size           gzip_size
jetpack-connect       +286 B  (+0.0%)     +171 B  (+0.1%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

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.

@AnnaMag AnnaMag added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label May 25, 2020
@AnnaMag AnnaMag requested a review from a team May 25, 2020 12:26
@AnnaMag AnnaMag added [Status] Needs Author Reply and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels May 25, 2020
@AnnaMag AnnaMag force-pushed the add/refactor-jp-connection branch 5 times, most recently from 634a604 to a7507e4 Compare May 28, 2020 17:42
@gibrown
Copy link
Member

gibrown commented Jun 3, 2020

Tested this a bit and everything I was (kinda randomly) testing seemed to work fine. Should we get a code review from someone in Jetpack on this refactor though?

@AnnaMag AnnaMag force-pushed the add/refactor-jp-connection branch from a7507e4 to d0f7727 Compare June 8, 2020 00:15
@AnnaMag AnnaMag force-pushed the add/refactor-jp-connection branch 2 times, most recently from 2ea9816 to 1492b8f Compare June 16, 2020 22:51
@AnnaMag AnnaMag requested a review from a team June 17, 2020 20:37
@AnnaMag AnnaMag added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] Needs Author Reply labels Jun 17, 2020
@AnnaMag AnnaMag force-pushed the add/refactor-jp-connection branch from 1492b8f to 730eac8 Compare June 17, 2020 21:54
@AnnaMag
Copy link
Contributor Author

AnnaMag commented Jun 18, 2020

unrelated test failures after most recent rebase.

Copy link
Contributor

@mattgawarecki mattgawarecki left a comment

Choose a reason for hiding this comment

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

I ran through the connect flow several times. All the copy looks as I would expect, and I didn't notice anything broken. Going through flows for a specific plan ended up at checkout, and without a plan ended up at the Plans page.

I thoroughly reviewed the code as well, and other than one possible stray semi-colon in a render function, I think it's good to go. 👍

client/jetpack-connect/main.jsx Outdated Show resolved Hide resolved
@AnnaMag AnnaMag added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jun 20, 2020
@AnnaMag AnnaMag removed the request for review from a team June 20, 2020 08:49
@AnnaMag AnnaMag force-pushed the add/refactor-jp-connection branch from 730eac8 to 1bd9d2b Compare June 20, 2020 10:16
We extract functionality to be reused in product purchase flows,
for Jetpack sites that need to be activated/connected.
@AnnaMag AnnaMag force-pushed the add/refactor-jp-connection branch from 1bd9d2b to 9b92710 Compare June 22, 2020 10:08
@AnnaMag AnnaMag merged commit abac1e3 into master Jun 22, 2020
@AnnaMag AnnaMag deleted the add/refactor-jp-connection branch June 22, 2020 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Jetpack [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants