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

Add plan changes to Subscriptions #52588

Open
garrettmknight opened this issue Nov 14, 2024 · 16 comments
Open

Add plan changes to Subscriptions #52588

garrettmknight opened this issue Nov 14, 2024 · 16 comments
Assignees
Labels
Daily KSv2 NewFeature Something to build that is a new item.

Comments

@garrettmknight
Copy link
Contributor

garrettmknight commented Nov 14, 2024

Part of the Workspace Downgrades project

Main issue: https://github.com/Expensify/Expensify/issues/399936
Project: Workspace Downgrades

Feature Description

  1. Update the Your plan section of the Subscriptions page to show both plan types with the current, highest plan type the account is an admin of highlighted/selected.
  2. If the user selects the other plan type, we'll check whether they're an admin on one or more workspaces:
  • If they're only an admin of one workspace we can just upgrade or downgrade that workspace from here we'll:
    • If the user is on Collect and selects Control, we'll launch the Upgrade RHP
    • If the user is on Control and selects Collect, we'll launch the Downgrade RHP
  • If they're an admin on multiple workspaces, they'll need to upgrade or downgrade their workspaces individually:
    • If the user is on Collect and selects Control, we'll launch an RHP directing the user to workspaces to upgrade
    • If the user is on Control and selects Collect, we'll launch an RHP directing the user to workspaces to downgrade

Copy for options above in this Figma here

Manual Test Steps

Single Workspace Upgrade

  1. Create a new account
  2. Create a workspace
  3. Navigate to subscriptions
  4. Click on 'Control'
  5. Confirm Upgrade RHP opens
  6. Click 'Upgrade'
  7. Confirm your workspace has been upgraded

Single Workspace Downgrade (follow Single Workspace Upgrade steps first)

  1. Navigate to subscriptions
  2. Click on 'Collect'
  3. Confirm Downgrade RHP opens
  4. Click 'Downgrade'
  5. Confirm your workspace has been downgraded

Multi Workspace Upgrade (follow Single Workspace Upgrade + Downgrade steps first)

  1. Create an additional workspace
  2. Navigate to subscriptions
  3. Click on 'Control'
  4. Confirm Upgrade RHP opens for multi workspaces
  5. Click 'Go to Workspaces'
  6. Confirm you're sent to workspace page
  7. Upgrade a workspace
  8. Navigate back to Subscriptions and confirm 'Control' is selected

Multi Workspace Upgrade (follow Multi Workspace Upgrade steps first)

  1. Navigate to subscriptions
  2. Click on 'Collect'
  3. Confirm Downgrade RHP opens for multi workspaces
  4. Click 'Go to Workspaces'
  5. Confirm you're sent to workspace page
  6. Downgrade the Control workspace
  7. Navigate back to Subscriptions and confirm 'Collect' is selected

Automated Tests

N/A

@garrettmknight garrettmknight added NewFeature Something to build that is a new item. Weekly KSv2 labels Nov 14, 2024
@garrettmknight garrettmknight self-assigned this Nov 14, 2024
Copy link

melvin-bot bot commented Nov 14, 2024

Triggered auto assignment to @joekaufmanexpensify (NewFeature), see https://stackoverflowteams.com/c/expensify/questions/14418#:~:text=BugZero%20process%20steps%20for%20feature%20requests for more details. Please add this Feature request to a GH project, as outlined in the SO.

@JmillsExpensify
Copy link

Still very excited for this one.

@melvin-bot melvin-bot bot added the Overdue label Nov 25, 2024
@garrettmknight
Copy link
Contributor Author

Hoping to prioritize this week while things are quiet.

@melvin-bot melvin-bot bot removed the Overdue label Nov 26, 2024
@garrettmknight
Copy link
Contributor Author

garrettmknight commented Nov 28, 2024

Sweet - got a minute to work through some copy options for when the user is an admin on multiple workspaces here.

@garrettmknight garrettmknight moved this to In Progress in [#whatsnext] #convert Nov 28, 2024
@garrettmknight
Copy link
Contributor Author

Alright - OP is updated, now we're just waiting for the main issue to complete to open this one up.

@garrettmknight
Copy link
Contributor Author

Quick clarification about the HOLD here:

  • We already have the upgrade command in ND
  • We're working on the downgrade command in https://github.com/Expensify/Expensify/issues/399936
  • Once we have the downgrade command, we should be able to open this up externally since it's more of a FE change that just calls our BE command.

@carlosmiceli carlosmiceli self-assigned this Dec 11, 2024
@carlosmiceli carlosmiceli changed the title [Hold for E/E #399936] Add plan changes to Subscriptions Add plan changes to Subscriptions Dec 11, 2024
@carlosmiceli
Copy link
Contributor

@jayeshmangwani Hey Jayesh, here's another issue we need to work on to really complete the full upgrades/downgrades project. Seems like a natural progression for you to take over this issue too, let me know if there are any questions.

I do have one question for you: we need to implement a check for whether the admin manages multiple workspaces or not. Do we have a way to check for that in the FE? Probably not, but thought I'd ask. If not, what kind of changes would you need from the BE (as in, what command or response would you like to see changed and how)?

@carlosmiceli carlosmiceli added Daily KSv2 and removed Weekly KSv2 labels Dec 11, 2024
@jayeshmangwani
Copy link
Contributor

Seems like a natural progression for you to take over this issue too, let me know if there are any questions.

Yes, that sounds good. I will start working on this issue once we merge PR for the downgrade workspace UI and new downgrade API.

@carlosmiceli @garrettmknight I will also need access to Figma, as I cannot find this section in the design doc.

@jayeshmangwani
Copy link
Contributor

@carlosmiceli For the multiple workspaces admin front-end check, I think we already have a function that can be used here. The getOwnedPaidPolicies function takes all policies and a user ID, then returns all the collect and control workspaces (paid workspaces) where the user is an admin.

App/src/libs/PolicyUtils.ts

Lines 391 to 393 in ec76adc

function getOwnedPaidPolicies(policies: OnyxCollection<Policy> | null, currentUserAccountID: number): Policy[] {
return Object.values(policies ?? {}).filter((policy): policy is Policy => isPolicyOwner(policy, currentUserAccountID ?? -1) && isPaidGroupPolicy(policy));
}

@carlosmiceli
Copy link
Contributor

Boom! Looks like we're good here @garrettmknight 💪
@jayeshmangwani great news, we're waiting for the final BE review and we're good to go, will report as soon as it's merged 👍

@jayeshmangwani
Copy link
Contributor

will report as soon as it's merged 👍

Thanks 🙌

@carlosmiceli
Copy link
Contributor

BE is merged 🙌

@melvin-bot melvin-bot bot added the Overdue label Dec 16, 2024
@carlosmiceli
Copy link
Contributor

Small BE change requested by our contributors has both PRs in review, which should completely unblock @jayeshmangwani from completing the plan page work.

@melvin-bot melvin-bot bot removed the Overdue label Dec 16, 2024
@carlosmiceli
Copy link
Contributor

Both BE PRs have been merged.

@melvin-bot melvin-bot bot added the Overdue label Dec 20, 2024
@jayeshmangwani
Copy link
Contributor

Not Overdue, we will handle it after this PR

@melvin-bot melvin-bot bot removed the Overdue label Dec 20, 2024
@jayeshmangwani
Copy link
Contributor

@garrettmknight Whenever you get a chance, please help in get access to the Figma design/ Screenshots here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Daily KSv2 NewFeature Something to build that is a new item.
Projects
Status: In Progress
Development

No branches or pull requests

5 participants