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(schemas, console): remove deprecated ReservedPlanIds #6820

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

simeng-li
Copy link
Contributor

Summary

Remove deprecated ReservedPlanIds and refactor the skuId usage in the console. Enterprise is not a valid skuId in the Logto system, and should not define a ReservedPlanIds.Enterprise .

Testing

Checklist

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

remove deprecated ReservedPlanIds and refactor the skuId usage in console
Copy link

COMPARE TO master

Total Size Diff 📉 -2.16 KB

Diff by File
Name Diff
packages/console/src/components/ApplicationCreation/CreateForm/Footer/index.tsx 📉 -36 Bytes
packages/console/src/components/CreateConnectorForm/Footer/index.tsx 📉 -36 Bytes
packages/console/src/components/CreateTenantModal/SelectTenantPlanModal/SkuCardItem/index.tsx 📉 -15 Bytes
packages/console/src/components/MauExceededModal/index.tsx 📉 -70 Bytes
packages/console/src/components/PlanDescription/index.tsx 📉 -86 Bytes
packages/console/src/components/SkuName/index.tsx 📉 -94 Bytes
packages/console/src/components/Topbar/TenantSelector/TenantDropdownItem/index.tsx 📉 -62 Bytes
packages/console/src/pages/ApiResourceDetails/ApiResourcePermissions/components/CreatePermissionModal/index.tsx 📉 -36 Bytes
packages/console/src/pages/ApiResources/components/CreateForm/Footer.tsx 📉 -36 Bytes
packages/console/src/pages/Applications/components/ProtectedAppForm/index.tsx 📉 -36 Bytes
packages/console/src/pages/RoleDetails/RolePermissions/components/AssignPermissionsModal/index.tsx 📉 -36 Bytes
packages/console/src/pages/Roles/components/CreateRoleForm/Footer.tsx 📉 -36 Bytes
packages/console/src/pages/TenantSettings/BillingHistory/index.tsx 📉 -709 Bytes
packages/console/src/pages/TenantSettings/Subscription/CurrentPlan/index.tsx 📉 -150 Bytes
packages/console/src/pages/TenantSettings/Subscription/SwitchPlanActionBar/index.tsx 📉 -12 Bytes
packages/console/src/pages/Webhooks/CreateFormModal/CreateForm.tsx 📉 -36 Bytes
packages/console/src/types/subscriptions.ts 📉 -248 Bytes
packages/schemas/src/consts/subscriptions.ts 📉 -669 Bytes

const description =
conditional(skuId && registeredPlanDescriptionPhrasesMap[skuId]) ??
registeredPlanDescriptionPhrasesMap[planId];
function PlanDescription({ skuId, isEnterprisePlan = false }: Props) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Want to double check the usage scenarios of the component <PlanDescription />, if this component is used NOT only when displaying the "current plan description," the passed parameters might be problematic: isEnterprisePlan indicates whether "the current plan" is an enterprise plan. If the component is used to display "past plan descriptions," this parameter could lead to incorrect display content.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This component is used in two places: SelectTenantPlanModel and CurrentPlan.

The isEnterprisePlan parameter doesn’t inherently indicate whether it applies to the current plan. Regardless of whether the provided skuId represents the current plan or a past plan, it should still be able to indicate if it’s an enterprise plan with isEnterprisePlan.

@@ -52,7 +52,7 @@ function SkuCardItem({ sku, onSelect, buttonProps }: Props) {
</div>
</div>
<div className={styles.description}>
<PlanDescription skuId={skuId} planId={skuId} />
<PlanDescription skuId={skuId} />
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that the component is intended to display comparisons of quota for three different plans: dev, free, and pro. From the definition of the component, it appears that the isEnterprisePlan input parameter might influence the displayed content. We may need to determine within the component whether the tenant is an enterprise plan based on the skuId.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Always rely on isEnterprisePlan as the single source of truth to determine whether the provided skuId corresponds to an enterprise plan in the frontend.
For example, legacy plans may not be included in the currently publicly available SKUs, but they should not be treated as enterprise plans either.

Pro = 'pro',
Development = 'dev',
Admin = 'admin',
Enterprise = 'enterprise',
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove ReservedSkuId since is was not used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

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.

2 participants