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

Copy Site: Prototype flow to copy an existing site #71913

Merged
merged 13 commits into from
Jan 13, 2023
Merged

Conversation

sejas
Copy link
Member

@sejas sejas commented Jan 11, 2023

Proposed Changes

  • Add a new Copy Site item on SMP site actions for atomic sites that you own.
  • Create a new rough Copy Site flow to create a new site, buy a plan and migrate it to Atomic.

Testing Instructions

  • If It's not yet deployed, Apply and sandbox D97450-code.
  • Go to /sites.
  • On an atomic site you own, Click on the ellipsis action menu.
  • Click on Create a copy of this site.
  • Observe a new flow is open.
  • Follow the steps, pay the plan, and observe a Success message after copying your site.

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-ajp-p2)?

@github-actions
Copy link

github-actions bot commented Jan 11, 2023

@matticbot
Copy link
Contributor

matticbot commented Jan 11, 2023

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

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

name                   parsed_size           gzip_size
entry-stepper              +1426 B  (+0.1%)     +870 B  (+0.1%)
entry-main                  +768 B  (+0.1%)     +266 B  (+0.1%)
entry-gutenboarding         +401 B  (+0.0%)     +214 B  (+0.0%)
entry-login                 +336 B  (+0.0%)     +121 B  (+0.0%)
entry-domains-landing       +336 B  (+0.1%)     +121 B  (+0.1%)
entry-browsehappy           +336 B  (+0.3%)     +121 B  (+0.4%)

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

Sections (~526 bytes added 📈 [gzipped])

name                     parsed_size            gzip_size
sites-dashboard             +41767 B  (+14.6%)   +12224 B  (+13.3%)
copy-site                   +28678 B     (new)    +9471 B     (new)
link-in-bio-flow              +328 B   (+0.0%)      +98 B   (+0.1%)
free-flow                     +328 B   (+0.1%)      +90 B   (+0.1%)
videopress-flow               +315 B   (+0.1%)      +81 B   (+0.1%)
newsletter-flow               +315 B   (+0.1%)      +83 B   (+0.1%)
devdocs                       +216 B   (+0.1%)      +91 B   (+0.2%)
signup                        +157 B   (+0.1%)      +64 B   (+0.1%)
settings                       +80 B   (+0.0%)    +1559 B   (+0.8%)
plugins                        +78 B   (+0.0%)      -42 B   (-0.0%)
stats                          +65 B   (+0.0%)      +27 B   (+0.0%)
plans                          +65 B   (+0.0%)      +25 B   (+0.0%)
marketplace                    +65 B   (+0.0%)      +26 B   (+0.0%)
jetpack-connect                +65 B   (+0.0%)      +25 B   (+0.0%)
domains                        +65 B   (+0.0%)      +25 B   (+0.0%)
checkout                       +65 B   (+0.0%)      +27 B   (+0.0%)
accept-invite                  +65 B   (+0.0%)      +25 B   (+0.0%)
trial-wooexpress-flow          +13 B   (+0.0%)       +5 B   (+0.1%)
tailored-ecommerce-flow        +13 B   (+0.0%)       +5 B   (+0.0%)
link-in-bio-tld-flow           +13 B   (+0.0%)       +5 B   (+0.0%)
import-flow                    +13 B   (+0.0%)       +6 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 (~13197 bytes added 📈 [gzipped])

name                                              parsed_size           gzip_size
async-load-design                                    +41754 B  (+2.1%)   +12242 B  (+2.5%)
async-load-design-blocks                                +65 B  (+0.0%)      +27 B  (+0.0%)
async-load-calypso-layout-masterbar-checkout-tsx        +65 B  (+0.1%)      +23 B  (+0.1%)
async-load-calypso-layout-masterbar-checkout            +65 B  (+0.1%)      +28 B  (+0.1%)
async-load-calypso-blocks-editor-checkout-modal         +65 B  (+0.0%)      +23 B  (+0.0%)
async-load-design-playground                            -13 B  (-0.0%)     +238 B  (+0.1%)

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.

@sejas sejas self-assigned this Jan 11, 2023
@sejas sejas added [Feature] Copy Site The copy site tool. [Feature] Tailored Onboarding Flows All onbaording flows targeted to a specific marketshare / audience. Stepper labels Jan 11, 2023
client/landing/stepper/declarative-flow/copy-site.tsx Outdated Show resolved Hide resolved
href={ copySiteHref }
onClick={ () => recordTracks( 'calypso_sites_dashboard_site_action_copy_site' ) }
>
{ __( 'Create a copy of this site' ) }
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{ __( 'Create a copy of this site' ) }
{ __( 'Copy site' ) }

Can we shorten this?

Copy link
Member Author

@sejas sejas Jan 13, 2023

Choose a reason for hiding this comment

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

Done here 3306167
Don't you think that Copy site is a vague description?
Users may be confused and think they will copy the site URL to the clipboard to paste it somewhere.
I suggest using Duplicate site or Clone site.

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't you think that Copy site is a vague description?
Users may be confused and think they will copy the site URL to the clipboard to paste it somewhere.

That's a good point. We can iterate on it.

client/sites-dashboard/components/sites-ellipsis-menu.tsx Outdated Show resolved Hide resolved
@danielbachhuber danielbachhuber changed the title CopySite: add a new flow to copy an existing site Copy Site: add a new flow to copy an existing site Jan 12, 2023
@@ -244,6 +274,7 @@ export const SitesEllipsisMenu = ( {
<ManagePluginsItem { ...props } />
{ ! isNotAtomicJetpack( site ) && <HostingConfigItem { ...props } /> }
{ site.is_coming_soon && <PreviewSiteModalItem { ...props } /> }
{ isEnabled( 'sites/copy-site' ) && <CopySiteItem { ...props } /> }
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make sure this is only present for the site owner too?

Copy link
Member Author

Choose a reason for hiding this comment

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

The check is inside the component.

if ( ! hasAtomicFeature || ! isSiteOwner || ! plan ) {
return null;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, cool. I think it'd be easier to read if it was outside of the component, but not a strong opinion on my end.

@danielbachhuber danielbachhuber changed the title Copy Site: add a new flow to copy an existing site Copy Site: Prototype flow to copy an existing site Jan 12, 2023
sejas and others added 9 commits January 13, 2023 11:15
* CopySite: Auto-add used plan to the cart and trigger the site copy-transfer

* CopySite: increase the progress bar flow
* fix: Remove adding product to cart before submit to avoid race conditions of dispatch and window.assign

* fix: Move setting the cart item inside the submit to avoid console errors

* add: Refactor automated copy site component and use a progress bar to show the copy of the site
…te` feature flag (#72056)

* CopySite: use hyphens in step urls

* CopySite: reduce the text in Copy Site SMP CTA Action

* CopySite: fix siteDetails type

* CopySite: add guard to make sourceSlug a required param

* CopySite: enable flow only if feature flag sites/copy-site is enabled

* CopySite: restore global.scss unwanted changes
@sejas sejas marked this pull request as ready for review January 13, 2023 11:18
@sejas sejas requested a review from a team January 13, 2023 11:18
@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 Jan 13, 2023
* fix: Remove product_slug from copy site parameters

* fix: Rename dispatch to use useReduxDispatch
Copy link
Contributor

@wojtekn wojtekn left a comment

Choose a reason for hiding this comment

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

Looks great, and works as expected. Good job on adding a new onboarding flow 🙂

client/sites-dashboard/components/sites-ellipsis-menu.tsx Outdated Show resolved Hide resolved
title: __( 'Copy Site' ),
text: createInterpolateElement(
__(
'You’re 5 minutes away from<br />creating a new copy site from <SourceUrl/>.<br />Ready?'
Copy link
Contributor

@wojtekn wojtekn Jan 13, 2023

Choose a reason for hiding this comment

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

Should we validate sourceSlug at this point? I can replace it with a simple site URL, and the page renders saying it will copy my simple site.

The flow will end up with the error as REST API doesn't allow for that, but it makes sense to validate it early.

Copy link
Contributor

Choose a reason for hiding this comment

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

I've added 1503-gh-Automattic/dotcom-forge for that.

client/landing/stepper/declarative-flow/copy-site.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@danielbachhuber danielbachhuber left a comment

Choose a reason for hiding this comment

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

Seems to work fine 👍 Just a few small nits remaining

@@ -244,6 +274,7 @@ export const SitesEllipsisMenu = ( {
<ManagePluginsItem { ...props } />
{ ! isNotAtomicJetpack( site ) && <HostingConfigItem { ...props } /> }
{ site.is_coming_soon && <PreviewSiteModalItem { ...props } /> }
{ isEnabled( 'sites/copy-site' ) && <CopySiteItem { ...props } /> }
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, cool. I think it'd be easier to read if it was outside of the component, but not a strong opinion on my end.

case 'processing': {
const destination = addQueryArgs( `/setup/${ this.name }/automated-copy`, {
sourceSlug: urlQueryParams.get( 'sourceSlug' ),
siteSlug: providedDependencies?.siteSlug,
Copy link
Contributor

Choose a reason for hiding this comment

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

siteSlug is a little ambiguous here. Should it be destinationSlug ?

Copy link
Contributor

Choose a reason for hiding this comment

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

siteSlug is used as a convention in some steps to refer to the site we are creating. However I find it confusing as well, and in this particular scenario I guess it makes sense to rename it to destinationSlug.
I also would like the opinion of @sejas as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's keep siteSlug for now. That param name makes it easier to grab the site using the useSite hook.

client/sites-dashboard/components/sites-ellipsis-menu.tsx Outdated Show resolved Hide resolved
kozer and others added 2 commits January 13, 2023 17:32
…72081)

* fix: Change the theme to the default for WP Sites at copy site flow

* update: Move default theme to a constant
@sejas sejas merged commit 0110af4 into trunk Jan 13, 2023
@sejas sejas deleted the add/copy-site-rough-flow branch January 13, 2023 17:31
@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 Jan 13, 2023
@a8ci18n
Copy link

a8ci18n commented Jan 13, 2023

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

Hi @sejas, 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:

  • Copy Site
  • Copy site

Thank you in advance!

@a8ci18n
Copy link

a8ci18n commented Jan 23, 2023

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
[Feature] Copy Site The copy site tool. [Feature] Tailored Onboarding Flows All onbaording flows targeted to a specific marketshare / audience. Stepper
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants