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, core): refactor console to support new pro plan #6874

Conversation

simeng-li
Copy link
Contributor

Summary

This PR refactors the console and core code to support our new Pro plan migration.

Refactord

  1. Add some missing comments to make the context clear
  2. Refactor the PlanUsage component. Make the periodicUsage props required.
    • For MauExceededModel we should use the usage data from the tenant context.
    • For Subscription/CurrentPlan we should always fetch the latest usage data.
  3. Extract the SKU sorting logic from formatLogtoSkusResponses method to the pickupFeaturedLogtoSkus method. We only need those SKUs to be ordered in the subscription plan table. No need to sort the data on every Logto SKU request.
  4. Extract a new SkuButton child component, to avoid complicated inline element display logic.

New Pro plan support

  1. Update the featuredPlanIds list. Once the new plan is launched, the latest Pro202411 ID should replace the current Pro ID.
  2. Refactor the featuredPlanIdOrder to a map instead of a list. So we can support multiple plans that share the same order, e.g grandfathered Pro and Pro202411.
  3. Update the PlanComparisonTable content to pick up the latest quota updates.
  4. Introduce a new isEquivalentPlan util method. If the given planId is not equal to the target planId, but they both share the same plan order, we treat them as equivalent plans. New Pro202411 and grandfather Pro. We display a Contact Us button for such a case.
image

Testing

test locally

Checklist

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

@simeng-li simeng-li requested review from a team December 11, 2024 04:22
@github-actions github-actions bot added the enhancement Make it better label Dec 11, 2024
Copy link

github-actions bot commented Dec 11, 2024

COMPARE TO master

Total Size Diff 📈 +3.37 KB

Diff by File
Name Diff
packages/console/src/components/CreateTenantModal/SelectTenantPlanModal/SkuCardItem/FeaturedSkuContent/use-featured-sku-content.ts 📈 +521 Bytes
packages/console/src/components/MauExceededModal/index.tsx 📈 +266 Bytes
packages/console/src/components/PlanUsage/index.tsx 📈 +360 Bytes
packages/console/src/consts/subscriptions.ts 📈 +548 Bytes
packages/console/src/pages/TenantSettings/Subscription/CurrentPlan/index.tsx 📈 +488 Bytes
packages/console/src/pages/TenantSettings/Subscription/PlanComparisonTable/index.tsx 📈 +444 Bytes
packages/console/src/pages/TenantSettings/Subscription/SwitchPlanActionBar/index.tsx 📈 +545 Bytes
packages/console/src/utils/subscription.ts 📈 +445 Bytes
packages/core/src/libraries/quota.ts 📈 +91 Bytes
packages/phrases/src/locales/ar/translation/admin-console/subscription/quota-table.ts 📈 +96 Bytes
packages/phrases/src/locales/de/translation/admin-console/subscription/quota-table.ts 📈 +86 Bytes
packages/phrases/src/locales/en/translation/admin-console/subscription/quota-table.ts 📈 +82 Bytes
packages/phrases/src/locales/es/translation/admin-console/subscription/quota-table.ts 📈 +87 Bytes
packages/phrases/src/locales/fr/translation/admin-console/subscription/quota-table.ts 📈 +88 Bytes
packages/phrases/src/locales/it/translation/admin-console/subscription/quota-table.ts 📈 +84 Bytes
packages/phrases/src/locales/ja/translation/admin-console/subscription/quota-table.ts 📈 +93 Bytes
packages/phrases/src/locales/ko/translation/admin-console/subscription/quota-table.ts 📈 +89 Bytes
packages/phrases/src/locales/pl-pl/translation/admin-console/subscription/quota-table.ts 📈 +90 Bytes
packages/phrases/src/locales/pt-br/translation/admin-console/subscription/quota-table.ts 📈 +87 Bytes
packages/phrases/src/locales/pt-pt/translation/admin-console/subscription/quota-table.ts 📈 +87 Bytes
packages/phrases/src/locales/ru/translation/admin-console/subscription/quota-table.ts 📈 +119 Bytes
packages/phrases/src/locales/tr-tr/translation/admin-console/subscription/quota-table.ts 📈 +86 Bytes
packages/phrases/src/locales/zh-cn/translation/admin-console/subscription/quota-table.ts 📈 +88 Bytes
packages/phrases/src/locales/zh-hk/translation/admin-console/subscription/quota-table.ts 📈 +88 Bytes
packages/phrases/src/locales/zh-tw/translation/admin-console/subscription/quota-table.ts 📈 +88 Bytes

Copy link
Contributor

@xiaoyijun xiaoyijun left a comment

Choose a reason for hiding this comment

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

Overall LGTM.

@simeng-li simeng-li force-pushed the simeng-log-10503-console-deprecate-legacy-pro-and-update-pricing-table branch from cedcb2c to 95565ed Compare December 12, 2024 06:23
Base automatically changed from simeng-log-10570-console-update-console-paywall-to-support-new-pro-plan to master December 12, 2024 06:26
@simeng-li simeng-li force-pushed the simeng-log-10503-console-deprecate-legacy-pro-and-update-pricing-table branch from 95565ed to b76d0ba Compare December 12, 2024 07:15
@simeng-li simeng-li enabled auto-merge (squash) December 12, 2024 08:17
@simeng-li simeng-li merged commit 96fd7ba into master Dec 12, 2024
35 checks passed
@simeng-li simeng-li deleted the simeng-log-10503-console-deprecate-legacy-pro-and-update-pricing-table branch December 12, 2024 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Make it better size/l
Development

Successfully merging this pull request may close these issues.

4 participants