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(console): refactor console paywall guards #6863

Conversation

simeng-li
Copy link
Contributor

@simeng-li simeng-li commented Dec 9, 2024

Summary

Refactor all the paywall guard logic to support the latest Pro plan migrations. This PR includes the following changes:

Add new Pro202411 plan support

  • Since we are going to have both the grandfathered ReservedPlanId.Pro plan and the new ReservedPlanId.Pro202411 plan co-exist online, introduce a new isProPlan util function that maps both planId as a pro plan.
  • Refactor the FeatureTag component display logic. Currently, there is no mapping logic applied. We display the plain planId as the text for the FeatureTag. This is not friendly for the new ReservedPlanId.Pro202411 pro plan ID. Thus we create a planId to tag map. So we may control the displayed text for each given plan.
  • Create a latestProPlanId constant to replace all the current ReservedPlanId.Pro reference. Use the dev feature guard to indicate the returned pro plan ID. Once the new pro plan is launched. Should replace all the ReservedPlanId.Pro references with ReservedPlanId.Pro202411.

Paywall logic refactor

  • Refactor all the paywall tag display logic. Keep it simple and straightforward, show the Pro feature tag if the current tenant plan is not a paid plan free or `dev. Regardless of other tweak logic.
  • Redesign the paywall type for the FeatureTag component. So far we only support using the pro plan as a paywall guard. Should limit the input value of the paywall plan ID to pro only. (Previously, the Admin value is also accepted. )

Online bug fix

  • ApplicationCreation/CreateForm: Fix the pro tag not shown for the free and dev tenant bug.
  • EnterpriseSso/SsoCreationModal: Fix the enterprise plan not able to create SSO bug.
  • MfaForm/UpsellNotive: Fix the add-on upsell notice not shown to the enterprise plan bug.
  • Organizations/CreateOrganizationModal: Fix the enterprise plan not able to create organization bug.
  • Organizations/index.tsx: Fix the enterprise plan not able to create organization bug.
  • OrganizationTemplate: Fix the enterprise plan not able to create organization roles and permissions bug.
  • AddOnUsageChangesNotification/index.tsx: Fix the add-on changes notification not shown to enterprise plan bug.

Testing

test locally

Checklist

  • .changeset
  • unit tests
  • integration tests
  • necessary TSDoc comments

Copy link

github-actions bot commented Dec 9, 2024

COMPARE TO master

Total Size Diff 📈 +1.33 KB

Diff by File
Name Diff
packages/console/src/components/ApplicationCreation/CreateForm/index.tsx 📈 +29 Bytes
packages/console/src/components/CreateTenantModal/SelectTenantPlanModal/SkuCardItem/index.tsx 📈 +20 Bytes
packages/console/src/components/FeatureTag/index.tsx 📈 +609 Bytes
packages/console/src/components/Guide/GuideCard/index.tsx 📈 +39 Bytes
packages/console/src/components/PlanDescription/index.tsx 📈 +54 Bytes
packages/console/src/components/PlanUsage/index.tsx 📈 +1 Bytes
packages/console/src/consts/plan-quotas.ts 📈 +34 Bytes
packages/console/src/consts/subscriptions.ts 📈 +257 Bytes
packages/console/src/ds-components/CardTitle/index.tsx 📈 +99 Bytes
packages/console/src/pages/ApiResources/components/CreateForm/index.tsx 📈 +60 Bytes
packages/console/src/pages/Applications/components/GuideLibrary/index.tsx 📈 +6 Bytes
packages/console/src/pages/CustomizeJwt/index.tsx 📈 +64 Bytes
packages/console/src/pages/EnterpriseSso/SsoCreationModal/index.tsx 📈 +5 Bytes
packages/console/src/pages/EnterpriseSso/index.tsx 📈 +250 Bytes
packages/console/src/pages/Mfa/MfaForm/UpsellNotice/index.tsx 📈 +66 Bytes
packages/console/src/pages/Mfa/PageWrapper/index.tsx 📈 +184 Bytes
packages/console/src/pages/OrganizationTemplate/index.tsx 📈 +121 Bytes
packages/console/src/pages/Organizations/CreateOrganizationModal/index.tsx 📈 +130 Bytes
packages/console/src/pages/Organizations/index.tsx 📈 +17 Bytes
packages/console/src/pages/SignInExperience/PageContent/Branding/CustomUiForm/index.tsx 📈 +6 Bytes
packages/console/src/pages/TenantSettings/Subscription/CurrentPlan/AddOnUsageChangesNotification/index.tsx 📈 +66 Bytes
packages/console/src/pages/TenantSettings/Subscription/CurrentPlan/MauLimitExceededNotification/index.tsx 📈 +6 Bytes
packages/console/src/pages/TenantSettings/TenantMembers/InviteMemberModal/index.tsx 📈 +18 Bytes
packages/console/src/pages/TenantSettings/components/NotEligibleSwitchPlanModalContent/index.tsx 📈 +11 Bytes
packages/console/src/utils/subscription.ts 📈 +401 Bytes

@github-actions github-actions bot added the size/m label Dec 9, 2024
@simeng-li simeng-li requested review from darcyYe and a team December 9, 2024 10:21
@simeng-li simeng-li force-pushed the simeng-log-10570-console-update-console-paywall-to-support-new-pro-plan branch 2 times, most recently from 70e19b8 to 191b470 Compare December 10, 2024 08:45
@github-actions github-actions bot added size/l and removed size/m labels Dec 10, 2024
@simeng-li simeng-li force-pushed the simeng-log-10570-console-update-console-paywall-to-support-new-pro-plan branch from 191b470 to 14e116e Compare December 11, 2024 03:57
@github-actions github-actions bot added size/m and removed size/l labels Dec 11, 2024
@simeng-li simeng-li self-assigned this Dec 11, 2024
@simeng-li simeng-li enabled auto-merge (squash) December 12, 2024 06:08
@simeng-li simeng-li merged commit 69986bc into master Dec 12, 2024
35 checks passed
@simeng-li simeng-li deleted the simeng-log-10570-console-update-console-paywall-to-support-new-pro-plan branch December 12, 2024 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Make it better size/m
Development

Successfully merging this pull request may close these issues.

3 participants