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

Earn: Add a plans check to the Donations block. #43088

Merged
merged 5 commits into from
Jun 11, 2020

Conversation

kwight
Copy link
Contributor

@kwight kwight commented Jun 9, 2020

This PR adds a check for a valid plan when inserting the Donations block, and displays a prompt to upgrade if the user is required to do so. Based on the Premium Content block process.

Screen Shot 2020-06-10 at 3 35 51 PM

Screen Shot 2020-06-10 at 3 34 42 PM

See: #42856

Testing instructions

  • On this branch locally, run yarn dev --sync to sync the changes to your sandbox.
  • Sandbox the API, and a test site that has no plan.
  • On that test site, start a new post at /wp-admin/post-new.php.
  • Add a Donations block.
  • Verify the Donations block loads with a spinner while making a call to https://public-api.wordpress.com/wpcom/v2/sites/:site_id/memberships/status.
  • When the API call completes, the block should display the upgrade prompt.
  • Check the API error state by misspelling the endpoint – this should trigger it properly.
  • Click the upgrade button and complete the upgrade process for a Personal plan.
  • Back in the editor tab, reload the editor.
  • Verify the empty Donations tabs display after the network call/spinner display.

@matticbot
Copy link
Contributor

@kwight
Copy link
Contributor Author

kwight commented Jun 9, 2020

This doesn't work yet.

@matticbot
Copy link
Contributor

Caution: This PR affects files in the FSE Plugin on WordPress.com
Please ensure your changes work on WordPress.com before merging.

D44610-code has been created so you can easily test it on your sandbox. See this FieldGuide page about developing in the FSE Plugin for more info: PCYsg-ly5-p2

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

@kwight kwight force-pushed the add/donations-block-plan-upgrade branch from 30f34d9 to ef280b4 Compare June 10, 2020 22:26
@kwight kwight added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Jun 10, 2020
@kwight kwight changed the title Earn: Add a plans check to the Donations block. [WIP] Earn: Add a plans check to the Donations block. Jun 10, 2020
@kwight
Copy link
Contributor Author

kwight commented Jun 10, 2020

This should be ready to go. The Stripe prompt and full Donations block functionality will be handled in later PRs.

@gwwar
Copy link
Contributor

gwwar commented Jun 10, 2020

Whoops I ran out of time Kirk, the misc notes I added aren't important, I'll go through manual testing steps tomorrow if folks don't beat me to it

Copy link
Member

@mmtr mmtr left a comment

Choose a reason for hiding this comment

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

I'm not sure if I'm missing any step, but the upgrade nudge doesn't show up for me when testing on a site not having a paid plan.

Scratch that, I didn't have the branch updated. It works great!

Screen Shot 2020-06-11 at 12 41 29

Verified that blocking the request from the dev tools shows a proper message.

Screen Shot 2020-06-11 at 12 43 34

Once upgraded, the tabs are displayed as expected.

Screen Shot 2020-06-11 at 12 46 35

Also noted multiple requests are fired, likely because we run the effect on every component update. Feel free to land if folks tidy the case, no need for re-review.

Screen Shot 2020-06-11 at 12 37 55

Copy link
Contributor

@gwwar gwwar left a comment

Choose a reason for hiding this comment

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

This tests well for me @kwight and should be safe to land. Overall we might want to think about how to make the upgrade flow a little easier for folks, but this is an existing issue for other blocks as well.

@kwight kwight merged commit d0d944c into master Jun 11, 2020
@kwight kwight deleted the add/donations-block-plan-upgrade branch June 11, 2020 22:41
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jun 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants