-
Notifications
You must be signed in to change notification settings - Fork 368
feat(clerk-js,types): Update logic for showing Billing nav within profiles #6315
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@clerk/clerk-js': patch | ||
'@clerk/types': patch | ||
--- | ||
|
||
Adjust the cases in which the Billing item shows within the `UserProfile` and `OrgProfile` components |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,7 +83,7 @@ export const OrganizationProfileRoutes = () => { | |
</Route> | ||
</Switch> | ||
</Route> | ||
{commerceSettings.billing.enabled && commerceSettings.billing.hasPaidOrgPlans && ( | ||
{commerceSettings.billing.organization.enabled ? ( | ||
<Protect | ||
condition={has => | ||
has({ permission: 'org:sys_billing:read' }) || has({ permission: 'org:sys_billing:manage' }) | ||
|
@@ -96,11 +96,13 @@ export const OrganizationProfileRoutes = () => { | |
<OrganizationBillingPage /> | ||
</Suspense> | ||
</Route> | ||
<Route path='plans'> | ||
<Suspense fallback={''}> | ||
<OrganizationPlansPage /> | ||
</Suspense> | ||
</Route> | ||
{commerceSettings.billing.organization.hasPaidPlans ? ( | ||
<Route path='plans'> | ||
<Suspense fallback={''}> | ||
<OrganizationPlansPage /> | ||
</Suspense> | ||
</Route> | ||
) : null} | ||
Comment on lines
+99
to
+105
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Fix type safety and approve the conditional plans route logic. The logic to conditionally render the plans route based on available paid plans is excellent and aligns with the PR objectives. However, the same type safety issue exists here with nested property access. Apply this diff to use optional chaining: - {commerceSettings.billing.organization.hasPaidPlans ? (
+ {commerceSettings.billing.organization?.hasPaidPlans ? ( 🤖 Prompt for AI Agents
|
||
<Route path='statement/:statementId'> | ||
<Suspense fallback={''}> | ||
<OrganizationStatementPage /> | ||
|
@@ -114,7 +116,7 @@ export const OrganizationProfileRoutes = () => { | |
</Switch> | ||
</Route> | ||
</Protect> | ||
)} | ||
) : null} | ||
{apiKeysSettings.enabled && ( | ||
<Protect | ||
condition={has => | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thought process on these is that since we don't necessarily know the subscriberType in these functions (right?) we will just check if all billing is disabled.