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

Live Preview: Add the upgrade notice for Premium and Woo themes #83630

Merged
merged 12 commits into from
Nov 30, 2023

Conversation

okmttdhr
Copy link
Member

@okmttdhr okmttdhr commented Oct 30, 2023

Related to #79223, #82629

Proposed Changes

This PR adds the upgrade-needed notice on the Site Editor canvas when live-previewing Premium and WooCommerce themes.

The latest copy:
Screenshot 2023-11-28 at 16 21 17
Screenshot 2023-11-28 at 16 20 12

The flow:

Screen.Recording.2023-11-06.at.14.55.06.mov

I'll create a follow-up PR for the following (See #79223 for more details).

Testing Instructions

  • Run install-plugin.sh wpcom-block-editor add/live-preview-upgrade-notice on your sandbox.
  • Sandbox widgets.wp.com and your site.
  • Upgrade Notice for Premium themes
    • Prepare a site with the Personal plan or lower plan.
    • Access https://<your-site>/wp-admin/site-editor.php?wp_theme_preview=<premium-theme> to preview a premium theme (e.g., premium/outland).
    • Try to edit the homepage and see the upgrade notice.
    • Click Upgrade now.
    • Verify the Premium plan is in the cart and complete checkout.
    • Verify it redirects to the Site Editor.
    • Verify you don't see the upgrade notice and the plan is upgraded.
  • Upgrade Notice for WooCommerce themes
    • Prepare a site with the Premium plan or lower plan.
    • Access https://<your-site>/wp-admin/site-editor.php?wp_theme_preview=<woo-theme> to preview a woo commerce theme (e.g. premium/tsubaki).
    • Try to edit the homepage and see the upgrade notice.
    • Click Upgrade now.
    • Verify the Business plan is in the cart and complete checkout.
    • Verify it redirects to the Site Editor.
    • Verify you don't see the upgrade notice and the plan is upgraded.
  • No Upgrade Notices
    • Prepare a site with the Business plan or higher plan.
    • Access https://<your-site>/wp-admin/site-editor.php?wp_theme_preview=<premium-theme> to preview a premium theme (e.g., premium/outland).
      • If your site is on Atomic, you need to install the theme before previewing it.
    • Verify you don't see the upgrade notice.

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • https://wpcalypso.wordpress.com/devdocs/docs/testing/index.md for your changes?
    • I didn't write tests, as most logic is from existing functions and I don’t think it’s a good idea to make it more complicated. I extracted functions and wrote types as much as possible.
  • 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 Oct 30, 2023

@matticbot
Copy link
Contributor

matticbot commented Oct 30, 2023

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

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

  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug add/live-preview-upgrade-notice on your sandbox.

@matticbot
Copy link
Contributor

This PR does not affect the size of JS and CSS bundles shipped to the user's browser.

Generated by performance advisor bot at iscalypsofastyet.com.

@okmttdhr okmttdhr force-pushed the add/live-preview-upgrade-notice branch 2 times, most recently from b52f20a to 5cbf249 Compare November 2, 2023 01:54
@okmttdhr okmttdhr added the [Status] String Freeze Add the [Status] String Freeze label to your PR to ensure new strings are translated before merging label Nov 2, 2023
@okmttdhr okmttdhr force-pushed the add/live-preview-upgrade-notice branch from 5cbf249 to 87eb5ee Compare November 2, 2023 02:08
@a8ci18n
Copy link

a8ci18n commented Nov 2, 2023

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

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

@okmttdhr okmttdhr self-assigned this Nov 2, 2023
@okmttdhr okmttdhr requested a review from a team November 2, 2023 05:05
@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 Nov 2, 2023
@okmttdhr okmttdhr marked this pull request as ready for review November 2, 2023 05:06
@okmttdhr okmttdhr changed the title Live Preview: upgrade-needed notices Live Preview: Add the upgrade-needed notice for Premium and Woo themes Nov 2, 2023
@taipeicoder

This comment was marked as resolved.

@okmttdhr okmttdhr force-pushed the add/live-preview-upgrade-notice branch from ec67d77 to 0453764 Compare November 6, 2023 05:50
@@ -0,0 +1,101 @@
import { useDispatch, useSelect } from '@wordpress/data';
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 contents of this file were originally implemented in live-preview.tsx, which was renamed to index.tsx.

@@ -0,0 +1,48 @@
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';
Copy link
Member Author

Choose a reason for hiding this comment

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

I just extracted some util functions.

@okmttdhr
Copy link
Member Author

okmttdhr commented Nov 6, 2023

#83630 (comment)

Thanks for your comment. I addressed this copy/UI issue 🙂 c2f9565, 0453764 @Automattic/lego

@autumnfjeld
Copy link
Contributor

This banner is now conveying two pieces of information

  1. Style customizations will only be saved if the theme is activated.
  2. The theme is premium and requires an upgrade to the premium plan.

Let's start with messaging about the upgrade. And could we put it on two lines? Like this:

You are previewing {themename}, a premium theme. To unlock this theme upgrade to the Premium plan.
You can try out your own style customization, which will only be saved if you activate this theme.

Also mentioned in slack: p1699255475276019/1698902224.244089-slack-C048CUFRGFQ

@okmttdhr
Copy link
Member Author

okmttdhr commented Nov 6, 2023

You are previewing {themename}, a premium theme. To unlock this theme upgrade to the Premium plan. You can try out your own style customization, which will only be saved if you activate this theme.

This copy sounds more gentle and concise! And it makes sense to start with messaging about the upgrade. Thanks for your feedback, @autumnfjeld. I'll address it.

@taipeicoder
Copy link
Contributor

This banner is now conveying two pieces of information

  1. Style customizations will only be saved if the theme is activated.
  2. The theme is premium and requires an upgrade to the premium plan.

Let's start with messaging about the upgrade. And could we put it on two lines? Like this:

You are previewing {themename}, a premium theme. To unlock this theme upgrade to the Premium plan. You can try out your own style customization, which will only be saved if you activate this theme.

Also mentioned in slack: p1699255475276019/1698902224.244089-slack-C048CUFRGFQ

We'll need to consider copy variation for WooCommerce, which is a WooCommerce theme and requires upgrading to the Business plan.

@okmttdhr
Copy link
Member Author

okmttdhr commented Nov 6, 2023

We'll need to consider copy variation for WooCommerce, which is a WooCommerce theme and requires upgrading to the Business plan.

For this, I was going to do the similar way as it is currently doing;

			const requiredPlan = previewingTheme.type === WOOCOMMERCE_THEME ? 'Business' : 'Premium';
			createWarningNotice(
				sprintf(
					// translators: %1$s: The previewing theme name, %2$s: The required plan name ('Business' or 'Premium')
					__(
						'You are previewing the %1$s theme. You can try out your own style customizations, which will only be saved if you activate this theme. This theme can be activated after upgrading to the %2$s plan or higher.',
						'wpcom-live-preview'
					),
					previewingTheme.name,
					requiredPlan
				),

@okmttdhr okmttdhr force-pushed the add/live-preview-upgrade-notice branch from 0453764 to 51accd9 Compare November 7, 2023 06:24
@okmttdhr
Copy link
Member Author

okmttdhr commented Nov 7, 2023

I updated the copy 📝 @autumnfjeld @taipeicoder @Automattic/lego
Screenshot 2023-11-07 at 15 25 17
Screenshot 2023-11-07 at 15 27 08

@taipeicoder
Copy link
Contributor

GENERAL FEEDBACK

The banner UI feels off, maybe it's the equal spacing between the copy and the buttons? cc: @lucasmendes-design
Screenshot 2023-11-07 at 2 50 29 PM

WooCommerce should be one word.
Screenshot 2023-11-07 at 2 52 06 PM

TEST CASES

  • Prepare a site without a plan.
    • ✅ Access https:///wp-admin/site-editor.php?wp_theme_preview= to preview a premium theme (e.g., premium/outland).
    • ✅ Try to edit the homepage and see the upgrade notice.
    • ✅ Click Upgrade now.
    • ✅ Verify the Premium plan is in the cart and complete checkout.
    • ❌ Verify it redirects to the Site Editor.
    • ❌ Verify the theme is activated.

What I experienced:
After the checkout, I got the Congratulation screen and I clicked the "Let's work on the site" button which took me back to the dashboard.

Screen.Capture.on.2023-11-07.at.15-15-47.mov
  • Prepare a site with the Premium plan.
    • ✅ Access https:///wp-admin/site-editor.php?wp_theme_preview= to preview a woo commerce theme (e.g. premium/tsubaki).
    • ✅ Try to edit the homepage and see the upgrade notice.
    • ✅ Click Upgrade now.
    • ✅ Verify the Business plan is in the cart and complete checkout.
    • ❌ Verify it redirects to the Site Editor.
    • ❌ Verify the theme is activated.

What I experienced:
Same as above. Also note that the WooCommerce blocks doesn't work in the Live Preview.

Screen.Capture.on.2023-11-07.at.15-12-09.mp4
  • Prepare an Atomic site
    • ❓Access https:///wp-admin/site-editor.php?wp_theme_preview= to preview a premium theme (e.g., premium/outland).

I'm not sure how to test this. In an Atomic site I should be able to install both Premium and WooCommerce themes. When installing a WooCommerce theme, some blocks will be unavailable:
Screenshot 2023-11-07 at 3 33 53 PM

@autumnfjeld
Copy link
Contributor

autumnfjeld commented Nov 7, 2023

The banner UI feels off.

I think that is an understatement @taipeicoder 😉 . I asked Ian if we could put effort into a visual redesign. The whole banner is well.....no bueno. Everywhere it appears (e.g. GS too), not just here.

But for this PR, are there any easy fixes that don't required Lucas input?

Could the button & link be move the right side, where there is space?

Or should we get rid of the line break after the first sentence? (I suggested the line break but open to other opinions.)

@okmttdhr okmttdhr force-pushed the add/live-preview-upgrade-notice branch from 48ab0a2 to 2f9b04b Compare November 29, 2023 01:45
@okmttdhr okmttdhr merged commit 575d080 into trunk Nov 30, 2023
12 checks passed
@okmttdhr okmttdhr deleted the add/live-preview-upgrade-notice branch November 30, 2023 03:40
@github-actions github-actions bot removed [Status] String Freeze Add the [Status] String Freeze label to your PR to ensure new strings are translated before merging [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Nov 30, 2023
@a8ci18n
Copy link

a8ci18n commented Nov 30, 2023

Translation for this Pull Request has now been finished.

@okmttdhr okmttdhr changed the title Live Preview: Add the upgrade-needed notice for Premium and Woo themes Live Preview: Add the upgrade notice for Premium and Woo themes Nov 30, 2023
@fushar
Copy link
Contributor

fushar commented Dec 4, 2023

@Automattic/lego I just realized that currently we will show two notices when we are previewing a Premium theme and then apply a style variation. See below screenshot:

image

We need to fix this... I think we can just hide the GS one (?), since the "Remove premium styles" button won't make the theme free 😄

@dsas
Copy link
Contributor

dsas commented Dec 4, 2023

I think we can just hide the GS one (?), since the "Remove premium styles" button won't make the theme free 😄

Yep, that's what we do in the showcase and onboarding when looking at the theme details; supress the premium styles notice because it's superfluous with the theme notice.

@okmttdhr
Copy link
Member Author

okmttdhr commented Dec 5, 2023

@Automattic/lego I just realized that currently we will show two notices when we are previewing a Premium theme and then apply a style variation. See below screenshot:

image We need to fix this... I think we can just hide the GS one (?), since the "Remove premium styles" button won't make the theme free 😄

Yes, I was going to address this (mentioned in #84799) 🙂
I just filed it in #79223.

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.

9 participants