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

A4A: Fix has Pressable existing plan logic #98272

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

jkguidaven
Copy link
Contributor

@jkguidaven jkguidaven commented Jan 13, 2025

This PR resolves the logic for identifying the current Pressable plan. At present, users cannot upgrade through the UI if the current agency has existing Pressable account.

Screenshot 2025-01-13 at 9 22 54 PM

Proposed Changes

  • Update the usePressableOwnershipType hook logic so it checks for existing pressable plan with an existing account.

Why are these changes being made?

  • If an agency already has a Pressable account, you cannot buy a plan through A4A.

Testing Instructions

  • Create a Pressable account and using the same email create an agency user.
  • Go to the /marketplace/hosting/pressable page.
  • Confirm you can purchase a plan.

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 UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • 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-aUh-p2)?

@jkguidaven jkguidaven self-assigned this Jan 13, 2025
@matticbot
Copy link
Contributor

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

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

  • notifications
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug fix/a4a/logic-for-has-pressable-plan on your sandbox.

@matticbot
Copy link
Contributor

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

Sections (~37 bytes removed 📉 [gzipped])

name                          parsed_size           gzip_size
a8c-for-agencies-sites              -37 B  (-0.0%)      -16 B  (-0.0%)
a8c-for-agencies-overview           -37 B  (-0.0%)      -13 B  (-0.0%)
a8c-for-agencies-marketplace        -37 B  (-0.0%)       -8 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.

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.

@cleacos
Copy link
Contributor

cleacos commented Jan 14, 2025

Test 1: It works well for the typical scenario, an agency with a Pressable account, already connected to A4A.

@cleacos
Copy link
Contributor

cleacos commented Jan 17, 2025

The fix requirements:

These are the different states we have to handle:

  • Agency without a Pressable account (with a4a_id = null)=> allow buy Pressable plans
  • Agency with a connected Pressable account (with a4a_id) => allow buy Pressable plans
  • Agency with a Pressable account not connected to A4A (with a4a_id = null) => not allowed to buy Pressable plans, it requires a manual migration.
  • Agency with a Pressable account as collaborator not connected to A4A (with a4a_id = null) => it's this case, we have to determine if the Pressable account is a collaborator and Pressable system should allow us to use the register endpoint for this case. We need a new field, is_collaborator to detect this case.

*Note that maybe we could use the switch endpoint instead of the register endpoint if we detect the is_collaborator case instead of asking Pressable to allow it with the register endpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants