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

Site Setup Design Picker: Recognize individual theme purchases #66279

Merged
merged 2 commits into from
Aug 5, 2022

Conversation

mreishus
Copy link
Contributor

@mreishus mreishus commented Aug 4, 2022

Proposed Changes

Premium themes can be acquired by purchasing a plan that provides all premium themes, or by buying an individual premium theme directly. The design picker isn't aware of individual purchases yet, this PR adds it.

For example, I have a free plan site where I have purchased the premium theme skivers.

Before PR:
2022-08-04_14-10
2022-08-04_14-11

After PR:
2022-08-04_14-09
2022-08-04_14-09_1

Note: Interaction with other changes

This will need further update once #66048 + D84731-code is merged.

I'll have to change the format of purchasedThemes. It's currently an array of theme names, [ 'skivers', 'payton' ], but it will need to contain both the name and the period. Maybe [ {name: 'skivers', period: 'yearly'}, ... ] ?

Note: Duplication of wasThemePurchased()

I tried putting this in client/landing/stepper/declarative-flow/internals/steps-repository/design-setup/utils, and importing it from the design-picker, but an eslint rule was triggered saying I shouldn't import from there (no-restricted-imports). I guess there has to be one copy in the design picker package, and one in stepper, unless I'm missing something.

Testing Instructions

Part 1

  • Have a free site with an individual premium theme purchased
  • Go to http://calypso.localhost:3000/setup/designSetup?siteSlug=SITE_SLUG_HERE&flags=-signup/design-picker-unified (note turning the flag off)
  • Find Premium themes you have and have not purchased, and note the pricing information below the theme's name.

Part 2

  • Find a Premium theme you have purchased, and click on it to preview
  • The top right button should say "Start with ThemeName" and not "Unlock"
  • Click back, and this time click on a Premium theme you have not purchased
  • The top right button should continue to say "Unlock"

Related to #65704 #65857

@mreishus mreishus self-assigned this Aug 4, 2022
@github-actions
Copy link

github-actions bot commented Aug 4, 2022

@mreishus mreishus marked this pull request as ready for review August 4, 2022 19:32
@mreishus mreishus requested a review from a team August 4, 2022 19:32
@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 4, 2022
@matticbot
Copy link
Contributor

matticbot commented Aug 4, 2022

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

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

name                 parsed_size           gzip_size
entry-stepper             +391 B  (+0.0%)     +183 B  (+0.0%)
entry-gutenboarding       +242 B  (+0.0%)     +109 B  (+0.0%)

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

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

name                                   parsed_size           gzip_size
async-load-signup-steps-design-picker       +242 B  (+0.2%)     +114 B  (+0.3%)

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.

);
} else if ( hasPurchasedTheme ) {
// Premium, does not need upgrade
// TODO: How to figure out if it's annual or monthly?
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like this is not going to be a problem for the time being: paYKcK-1XV-p2

Copy link
Contributor

@andres-blanco andres-blanco left a comment

Choose a reason for hiding this comment

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

This is looking good!

Purchased theme card:
image
Purchased theme preview:
image

@mreishus mreishus merged commit 346222f into trunk Aug 5, 2022
@mreishus mreishus deleted the improve/design-picker-theme-purchase branch August 5, 2022 20:03
@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 5, 2022
@a8ci18n
Copy link

a8ci18n commented Aug 5, 2022

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

Thank you @mreishus for including a screenshot in the description! This is really helpful for our translators.

@a8ci18n
Copy link

a8ci18n commented Aug 12, 2022

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.

4 participants