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

Make sure user lands on PatternAssembler after select blank-canvas #71852

Closed
wants to merge 4 commits into from

Conversation

bangank36
Copy link
Contributor

@bangank36 bangank36 commented Jan 10, 2023

Proposed Changes

  • This PR will address the solution to pre-select blank-canvas design for users that come from the logged-out theme showcase ( after they selected blank-canvas-3 theme )
  • Also make sure user will be landed on /site-editor after PA step completed

Testing Instructions

  • Checkout this branch, if you are using calypso live link, open the browser console and run this to make sure the feature flag is enabled document.cookie = 'flags=pattern-assembler/logged-out-showcase;max-age=1209600;path=/'
  • Log out from your wp account
  • Access theme showcase via /themes
  • Select blank-canvas-3 theme and confirm that /patternAssembler step is shown after finishing site creation
  • Select other theme and confirm that the end of flow is /home
  • Recording
    ero26H.mp4

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

Related to #71706

@bangank36 bangank36 self-assigned this Jan 10, 2023
@github-actions
Copy link

github-actions bot commented Jan 10, 2023

@matticbot
Copy link
Contributor

matticbot commented Jan 10, 2023

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

Sections (~346 bytes added 📈 [gzipped])

name                     parsed_size           gzip_size
site-setup-flow              +1395 B  (+0.1%)     +402 B  (+0.1%)
import-flow                   +388 B  (+0.0%)     +131 B  (+0.0%)
signup                        +166 B  (+0.1%)      +47 B  (+0.1%)
trial-wooexpress-flow         +149 B  (+0.5%)      +34 B  (+0.3%)
tailored-ecommerce-flow       +149 B  (+0.0%)      +32 B  (+0.0%)
sites-dashboard               +149 B  (+0.0%)      +33 B  (+0.0%)
settings                      +149 B  (+0.0%)      +33 B  (+0.0%)
link-in-bio-tld-flow          +149 B  (+0.0%)      +32 B  (+0.0%)
link-in-bio-flow              +149 B  (+0.0%)      +32 B  (+0.0%)
free-flow                     +149 B  (+0.1%)      +34 B  (+0.1%)
copy-site                     +149 B  (+0.0%)      +32 B  (+0.0%)
checkout                      +149 B  (+0.0%)      +35 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 (~135 bytes added 📈 [gzipped])

name                                              parsed_size           gzip_size
async-load-design                                      +149 B  (+0.0%)      +33 B  (+0.0%)
async-load-calypso-my-sites-checkout-modal             +149 B  (+0.0%)      +35 B  (+0.0%)
async-load-calypso-layout-masterbar-checkout-tsx       +149 B  (+0.1%)      +33 B  (+0.1%)
async-load-calypso-layout-masterbar-checkout           +149 B  (+0.2%)      +34 B  (+0.2%)
async-load-calypso-blocks-editor-checkout-modal        +149 B  (+0.0%)      +35 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.

@bangank36 bangank36 force-pushed the add/preselect-design-pa branch from 5fbc0db to d22b600 Compare January 17, 2023 08:45
@bangank36 bangank36 marked this pull request as ready for review January 17, 2023 08:57
@bangank36 bangank36 requested a review from a team January 17, 2023 09:02
@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 17, 2023
@bangank36
Copy link
Contributor Author

Update: for some reason, the change only work on localhost but not Calypso Live, will need to figuring why...

@bangank36
Copy link
Contributor Author

bangank36 commented Jan 17, 2023

Update: the Calypso Live URL require the flag to be persisted on URL, but since the theme showcase requires a redirect, we need to enable the feature via cookie p1673950877830519/1673944921.451349-slack-CRWCHQGUB

document.cookie = 'flags=pattern-assembler/logged-out-showcase;max-age=1209600;path=/'

JLFccP.mp4

Copy link
Contributor

@miksansegundo miksansegundo left a comment

Choose a reason for hiding this comment

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

Maybe it's my environment, but It didn't work on the first attempt. I'll try again.

@@ -64,7 +79,11 @@ const PatternAssembler: Step = ( { navigation, flow } ) => {
useEffect( () => {
// Require to start the flow from the first step
if ( ! selectedDesign ) {
goToStep?.( 'goals' );
if ( signupSelectedThemeSlug !== 'blank-canvas-3' ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We can use isBlankCanvasDesign( signupSelectedThemeSlug ) from @automattic/design-picker.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@miksansegundo signupSelectedThemeSlug is a string while isBlankCanvasDesign expects a Design object, so I don't think we can use it like suggested

@@ -295,6 +296,11 @@ export default {
if ( ! isEmpty( additionalDependencies ) ) {
context.store.dispatch( updateDependencies( additionalDependencies ) );
}
if ( themeParameter ) {
setSignupSelectedThemeSlug( query.theme );
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd use an empty string '' instead of null because the sessionStorage saves a string but in your case that works too.

Screenshot 2566-01-17 at 17 27 05

To save some characters:

setSignupSelectedThemeSlug( themeParameter || '' )

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be better to set the query string via the getChecklistThemeDestination function because that's why we store the themeParameter in additionalDependencies (L290 - L294)

See

return `/setup/site-setup/patternAssembler?siteSlug=${ siteSlug }`;

Copy link
Contributor

Choose a reason for hiding this comment

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

Besides, I think it would be better to create a new flow and include only the PA step. It's a bit weird to redirect the user to a certain step of the flow after the signup. What do you think?

For example, podcast flow, free flow, etc

Copy link
Member

Choose a reason for hiding this comment

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

create a new flow and include only the PA step

That would be extremely helpful for #72286 too!

@@ -295,6 +296,11 @@ export default {
if ( ! isEmpty( additionalDependencies ) ) {
context.store.dispatch( updateDependencies( additionalDependencies ) );
}
if ( themeParameter ) {
setSignupSelectedThemeSlug( query.theme );
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be better to set the query string via the getChecklistThemeDestination function because that's why we store the themeParameter in additionalDependencies (L290 - L294)

See

return `/setup/site-setup/patternAssembler?siteSlug=${ siteSlug }`;

@@ -295,6 +296,11 @@ export default {
if ( ! isEmpty( additionalDependencies ) ) {
context.store.dispatch( updateDependencies( additionalDependencies ) );
}
if ( themeParameter ) {
setSignupSelectedThemeSlug( query.theme );
Copy link
Contributor

Choose a reason for hiding this comment

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

Besides, I think it would be better to create a new flow and include only the PA step. It's a bit weird to redirect the user to a certain step of the flow after the signup. What do you think?

For example, podcast flow, free flow, etc

goToStep?.( 'goals' );
}
// User has selected blank-canvas-3 theme from theme showcase
setSelectedDesign( blankCanvasDesign as Design );
Copy link
Contributor

Choose a reason for hiding this comment

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

this has to be wrapped inside the else condition to ensure we won't save the blank canvas design after goToStep executed

@miksansegundo
Copy link
Contributor

Just noting here that team T-Rex is working on adding a direct link from the theme research results to access the assembler directly. See https://github.com/Automattic/dotcom-forge/issues/1453

Screenshot 2566-01-23 at 10 07 40

Let's keep in mind that the assembler flow won't be not only a site creation flow but also a theme creation flow to design a new homepage on existing sites and creating a new flow with only the assembler step will help to skip tweaks that are only for the site creation use case like the redirection to ensure users have an intent saved in the goals step. cc: @autumnfjeld

@bangank36
Copy link
Contributor Author

Besides, I think it would be better to create a new flow and include only the PA step. It's a bit weird to redirect the user to a certain step of the flow after the signup. What do you think?

For example, podcast flow, free flow, etc

This is brilliant idea, let's see what I can do

@bangank36 bangank36 force-pushed the add/preselect-design-pa branch from d22b600 to 1dcf389 Compare January 27, 2023 07:46
@bangank36 bangank36 mentioned this pull request Jan 29, 2023
7 tasks
@bangank36
Copy link
Contributor Author

The issues of this PR will be addressed on #72747

@bangank36 bangank36 closed this Jan 29, 2023
@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 29, 2023
@sirreal sirreal deleted the add/preselect-design-pa branch January 14, 2025 18:05
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.

5 participants