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

Add platform Identification step site-creation processing #93327

Merged
merged 18 commits into from
Aug 8, 2024

Conversation

gabrielcaires
Copy link
Contributor

@gabrielcaires gabrielcaires commented Aug 7, 2024

closes #93298
closes #93296
closes #93259

Proposed Changes

  • Extend the current Import Step to accept a new title and subtitle
  • Introduce the Platform identification step.
  • Introduce the PICK_SOURCE, SITE_CREATION, PROCESSING and a temporary PLAN Upgrade
  • Redirect to the import step when the platform is not wordpress
  • Redirect to the upgrade page when the platform is wordpres
  • Add new test helpers and custom matcher to simplify the test writing.

Note

No logic related to the back button was added in this PR.

Testing Instructions

Scenario: Platform WordPress

  • Go to /setup/hosted-site-migration-v2.
  • Select wordpress
  • Check if a site was created
  • Check if you have been redirecting to the temporary upgrade plan step

Scenario: Other Platform
Scenario: Platform WordPress

  • Go to /setup/hosted-site-migration-v2.
  • Select any other platform
  • Check if a site was created
  • Check if you have been redirecting to the correct import file page

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
Copy link
Contributor

matticbot commented Aug 7, 2024

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

App Entrypoints (~67 bytes added 📈 [gzipped])

name                   parsed_size           gzip_size
entry-stepper                239 B  ( 0.0%)       67 B  ( 0.0%)
entry-subscriptions          224 B  ( 0.0%)       60 B  ( 0.0%)
entry-main                   224 B  ( 0.0%)       60 B  ( 0.0%)
entry-login                  224 B  ( 0.0%)       60 B  ( 0.0%)
entry-domains-landing        224 B  ( 0.0%)       60 B  ( 0.0%)
entry-browsehappy            224 B  ( 0.1%)       60 B  ( 0.1%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Sections (~811 bytes added 📈 [gzipped])

name                               parsed_size           gzip_size
hosted-site-migration-flow-v2            992 B  ( 2.1%)      350 B  ( 6.5%)
with-theme-assembler-flow                301 B  ( 0.5%)       20 B  ( 0.2%)
update-options-flow                      301 B  ( 0.6%)       22 B  ( 0.4%)
update-design-flow                       301 B  ( 0.0%)       22 B  ( 0.0%)
trial-wooexpress-flow                    301 B  ( 0.6%)       22 B  ( 0.3%)
tailored-ecommerce-flow                  301 B  ( 0.6%)       26 B  ( 0.4%)
site-setup-wg                            301 B  ( 0.4%)       21 B  ( 0.1%)
site-setup-flow                          301 B  ( 0.4%)       22 B  ( 0.2%)
site-migration-flow                      301 B  ( 0.5%)       14 B  ( 0.1%)
readymade-template-flow                  301 B  ( 0.2%)       17 B  ( 0.1%)
migration-signup                         301 B  ( 0.6%)       16 B  ( 0.2%)
import-flow                              301 B  ( 0.5%)       21 B  ( 0.2%)
hosted-site-migration-flow               301 B  ( 0.5%)       14 B  ( 0.1%)
free-post-setup-flow                     301 B  ( 0.6%)       22 B  ( 0.4%)
free-flow                                301 B  ( 0.5%)       23 B  ( 0.3%)
entrepreneur-flow                        301 B  ( 0.2%)       24 B  ( 0.1%)
assembler-first-flow                     301 B  ( 0.4%)       19 B  ( 0.1%)
ai-assembler-flow                        301 B  ( 0.4%)       18 B  ( 0.1%)
import                                    49 B  ( 0.0%)       36 B  ( 0.0%)
themes                                    15 B  ( 0.0%)        9 B  ( 0.0%)
theme                                     15 B  ( 0.0%)        9 B  ( 0.0%)
staging-site                              15 B  ( 0.0%)        8 B  ( 0.0%)
sites-dashboard                           15 B  ( 0.0%)        8 B  ( 0.0%)
site-purchases                            15 B  ( 0.0%)        9 B  ( 0.0%)
site-monitoring                           15 B  ( 0.0%)        8 B  ( 0.0%)
site-logs                                 15 B  ( 0.0%)        8 B  ( 0.0%)
site-blocks                               15 B  ( 0.0%)        8 B  ( 0.0%)
signup                                    15 B  ( 0.0%)        7 B  ( 0.0%)
settings                                  15 B  ( 0.0%)        8 B  ( 0.0%)
security                                  15 B  ( 0.0%)        8 B  ( 0.0%)
purchases                                 15 B  ( 0.0%)        8 B  ( 0.0%)
privacy                                   15 B  ( 0.0%)        8 B  ( 0.0%)
plugins                                   15 B  ( 0.0%)        6 B  ( 0.0%)
plans                                     15 B  ( 0.0%)        7 B  ( 0.0%)
notification-settings                     15 B  ( 0.0%)        8 B  ( 0.0%)
me                                        15 B  ( 0.0%)        8 B  ( 0.0%)
marketplace                               15 B  ( 0.0%)        8 B  ( 0.0%)
jetpack-connect                           15 B  ( 0.0%)        7 B  ( 0.0%)
jetpack-cloud-pricing                     15 B  ( 0.0%)        7 B  ( 0.0%)
jetpack-cloud-features-comparison         15 B  ( 0.0%)        5 B  ( 0.0%)
jetpack-app                               15 B  ( 0.0%)        8 B  ( 0.0%)
hosting-features                          15 B  ( 0.0%)        8 B  ( 0.0%)
hosting                                   15 B  ( 0.0%)        8 B  ( 0.0%)
home                                      15 B  ( 0.0%)        8 B  ( 0.0%)
help                                      15 B  ( 0.0%)        8 B  ( 0.0%)
github-deployments                        15 B  ( 0.0%)        8 B  ( 0.0%)
email                                     15 B  ( 0.0%)        7 B  ( 0.0%)
domains                                   15 B  ( 0.0%)        7 B  ( 0.0%)
developer                                 15 B  ( 0.0%)        8 B  ( 0.0%)
checkout                                  15 B  ( 0.0%)        7 B  ( 0.0%)
account-close                             15 B  ( 0.0%)        8 B  ( 0.0%)
account                                   15 B  ( 0.0%)        8 B  ( 0.0%)

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

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

name                                                                              parsed_size           gzip_size
async-load-purchase-modal-wrapper                                                        15 B  ( 0.0%)        8 B  ( 0.0%)
async-load-my-sites-checkout-purchase-modal-is-eligible-for-one-click-checkou...         15 B  ( 0.0%)        8 B  ( 0.0%)
async-load-design-blocks                                                                 15 B  ( 0.0%)        6 B  ( 0.0%)
async-load-design                                                                        15 B  ( 0.0%)        6 B  ( 0.0%)
async-load-calypso-my-sites-current-site-stale-cart-items-notice                         15 B  ( 0.1%)        7 B  ( 0.1%)
async-load-calypso-layout-masterbar-checkout-tsx                                         15 B  ( 0.0%)        7 B  ( 0.0%)
async-load-calypso-layout-masterbar-checkout                                             15 B  ( 0.0%)        7 B  ( 0.0%)
async-load-calypso-blocks-editor-checkout-modal                                          15 B  ( 0.0%)        4 B  ( 0.0%)

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.

@gabrielcaires gabrielcaires changed the title Add/platform Identification Add platform Identification step site-creation processing Aug 7, 2024
@gabrielcaires gabrielcaires marked this pull request as ready for review August 7, 2024 17:23
@gabrielcaires gabrielcaires requested review from a team as code owners August 7, 2024 17:23
@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 Aug 7, 2024
@gabrielcaires gabrielcaires requested review from renatho and removed request for a team August 7, 2024 17:23
@matticbot
Copy link
Contributor

matticbot commented Aug 7, 2024

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

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

  • notifications
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug add/platform-indetification on your sandbox.

@renatho renatho mentioned this pull request Aug 7, 2024
2 tasks
Copy link
Contributor

@renatho renatho left a comment

Choose a reason for hiding this comment

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

In general, it looks great! Just adding a few comments that I noticed and some questions.

@@ -64,7 70,10 @@ export default function ListStep( props: Props ) {
};

const recordImportList = () => {
recordTracksEvent( trackEventName, trackEventParams );
if ( ! skipTracking ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I created an issue for this: #93352

Do you have some more references about this? How to identify the issue and how to verify it's already fixed to remove this check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This step probably needs to be updated.
Stepper already triggers the calypso_signup_step_start automatically.
If you check the network tab on developer tools and search for calypso_signup_step_start you can see two calls to the same event as one of them is using a hardcode value on the "flow" attribute.

const trackEventParams = {

I just don't removed it because we can have reports using it.


if ( currentStep === PROCESSING.slug ) {
if ( data?.next ) {
return window.location.assign(
Copy link
Contributor

Choose a reason for hiding this comment

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

I see that the hosted-site-migration also does the same, redirecting the flow to the /setup/site-setup. Just for my understanding, is there a special reason we do this instead of adding all the steps in this 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.

Although the steps are very reusable the logic to continue on each user interaction (site-setup.ts) is not easy to reuse. In these cases we are redirecting the users to the more appropriate flow.

}

expect.extend( {
toMatchDestination: ( destination, expected: MatchDestinationParams ) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! =)

jest.mock( '@automattic/data-stores/src/user/selectors' );
jest.mock( 'calypso/landing/stepper/hooks/use-is-site-owner' );

describe( `${ flow.name }`, () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice tests! =)

@gabrielcaires gabrielcaires self-assigned this Aug 8, 2024
Copy link
Contributor

@renatho renatho left a comment

Choose a reason for hiding this comment

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

There's just one last thing to fix. So I'm already approving this to be merged after the fix! Nice work! =)

@gabrielcaires gabrielcaires merged commit 763438c into trunk Aug 8, 2024
11 checks passed
@gabrielcaires gabrielcaires deleted the add/platform-indetification branch August 8, 2024 16:10
@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 Aug 8, 2024
@a8ci18n
Copy link

a8ci18n commented Aug 8, 2024

This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/16465157

Some locales (Hebrew, Japanese) have been temporarily machine-translated due to translator availability. All other translations are usually ready within a few days. Untranslated and machine-translated strings will be sent for translation next Monday and are expected to be completed by the following Friday.

Hi @gabrielcaires, could you please edit the description of this PR and add a screenshot for our translators? Ideally it'd include all of the following strings:

  • Site Migration
  • Move your site to WordPress.com
  • Tell us which platform your site is built with so we can get started.

Thank you in advance!

gabrielcaires added a commit that referenced this pull request Aug 8, 2024
* Add new migration-flow

* Rename step to import-or-migrate

* Rename flow

* Add platform identification step

* Remove lint conflicts

* Revert "Remove lint conflicts"

This reverts commit d581ce4.

* Remove

* Fix lint issues

* Redirect to import or upgrade

* Add test suite

* Improve tests

* Adjust the title

* Fix type

* Update client/landing/stepper/declarative-flow/internals/steps-repository/platform-identification/index.tsx

Co-authored-by: Renatho De Carli Rosa <[email protected]>

* Update description

* Fix next url when user select wordpress as platform

* Fix wrong query param

---------

Co-authored-by: Renatho De Carli Rosa <[email protected]>
@gabrielcaires gabrielcaires mentioned this pull request Aug 12, 2024
1 task
@a8ci18n
Copy link

a8ci18n commented Aug 14, 2024

Translation for this Pull Request has now been finished.

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.

Step: Import Step: Create new site Step: Pick a source
4 participants