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

Refactor Pricing Plan block to use variants #70629

Merged
merged 1 commit into from
Dec 1, 2022

Conversation

msurdi-a8c
Copy link
Contributor

Proposed Changes

This Pull Request refactors the previously multiple times registered Pricing Plan block to use the variations API which greatly simplifies the code and prevents some issues we have found regarding inconsistent titles and description in the editor settings UI after plans configurations are changed.

Testing Instructions

  • Run yarn dev --sync in apps/happy-blocks to sync code to your sandbox
  • On your sandbox, edit wp-content/themes/a8c/supportforums/editor/gutenberg-wpcom.php and add to the function supportforums_gutenberg_setup_frontend before return $settings; line:
$settings['iso']['blocks']['allowBlocks'][] = 'happy-blocks/pricing-plans';
  • On that same file, remove all other Pricing Plans registrations (lines starting with $settings['iso']['blocks']['allowBlocks'][] = 'happy-blocks/*... leaving just the new one.
  • Create a new topic, in the editor press / and search for "Upgrade" block.
  • Focus the block, and in the block settings pane (gear icon) pre-select one of the available plans. Ensure the block updates to the selected plan in the editor, then pre-select a billing option (yearly/monthly) for the user.
  • Submit the post, ensure the block loads in the Post view and shows the correct plan and the pre-selected billing option.
  • Repeat the previous steps for the four pricing plans to check all of them render correctly in the view.

Pre-merge Checklist

  • 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 #

@msurdi-a8c msurdi-a8c requested review from a team and naxoc December 1, 2022 06:49
@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 Dec 1, 2022
@github-actions
Copy link

github-actions bot commented Dec 1, 2022

@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.

Copy link
Contributor

@lezama lezama left a comment

Choose a reason for hiding this comment

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

looks much cleaner 🙌

@msurdi-a8c msurdi-a8c merged commit 0fc5b46 into trunk Dec 1, 2022
@msurdi-a8c msurdi-a8c deleted the change/refactor-pricing-plans-to-variants branch December 1, 2022 11:17
@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 Dec 1, 2022
@a8ci18n
Copy link

a8ci18n commented Dec 1, 2022

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

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

  • Upgrade Personal
  • Upgrade Pricing Plan
  • Pricing Plan upgrade block
  • Upgrade to Personal pricing plan
  • Upgrade to Premium pricing plan
  • Upgrade to Business pricing plan
  • Upgrade to eCommerce pricing plan

Thank you in advance!

@a8ci18n
Copy link

a8ci18n commented Dec 11, 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.

None yet

4 participants