Skip to content

Commit 0307ea8

Browse files
authored
chore(clerk-js): Add API keys and Billing routes as valid reorder labels (#7383)
1 parent 1bb6a46 commit 0307ea8

File tree

9 files changed

+33
-12
lines changed

9 files changed

+33
-12
lines changed

.changeset/little-buttons-try.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
"@clerk/astro": patch
3+
"@clerk/clerk-js": patch
4+
"@clerk/clerk-react": patch
5+
"@clerk/vue": patch
6+
---
7+
8+
Allow reordering API Keys and Billing pages in `<UserProfile />` and `<OrganizationProfile />`.
9+
10+
Example:
11+
12+
```tsx
13+
export function CustomUserProfile() {
14+
return (
15+
<UserProfile>
16+
<UserProfile.Page label="apiKeys" />
17+
<UserProfile.Page label="billing" />
18+
</UserProfile>
19+
)
20+
}
21+
```

packages/astro/src/astro-components/interactive/OrganizationProfile/OrganizationProfilePage.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
import CustomProfilePageRenderer from '../CustomProfilePageRenderer.astro';
33
4-
const reorderItemsLabels = ['general', 'members'] as const;
4+
const reorderItemsLabels = ['general', 'members', 'billing', 'apiKeys'] as const;
55
type ReorderItemsLabels = (typeof reorderItemsLabels)[number];
66
77
type Props<Label extends string> = {

packages/astro/src/astro-components/interactive/OrganizationSwitcher/OrganizationProfilePage.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
import CustomProfilePageRenderer from '../CustomProfilePageRenderer.astro';
33
4-
const reorderItemsLabels = ['general', 'members'] as const;
4+
const reorderItemsLabels = ['general', 'members', 'billing', 'apiKeys'] as const;
55
type ReorderItemsLabels = (typeof reorderItemsLabels)[number];
66
77
type Props<Label extends string> = {

packages/astro/src/astro-components/interactive/UserProfile/UserProfilePage.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
import CustomProfilePageRenderer from '../CustomProfilePageRenderer.astro';
33
4-
const reorderItemsLabels = ['account', 'security'] as const;
4+
const reorderItemsLabels = ['account', 'security', 'billing', 'apiKeys'] as const;
55
type ReorderItemsLabels = (typeof reorderItemsLabels)[number];
66
77
type Props<Label extends string> = {

packages/clerk-js/src/ui/utils/createCustomPages.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export type CustomPageContent = {
2222
};
2323

2424
type ProfileReorderItem = {
25-
label: 'account' | 'security' | 'members' | 'general';
25+
label: 'account' | 'security' | 'members' | 'general' | 'billing' | 'apiKeys';
2626
};
2727

2828
type ProfileCustomPage = {

packages/react/src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,15 @@ type PageProps<T extends string> =
131131
labelIcon?: never;
132132
};
133133

134-
export type UserProfilePageProps = PageProps<'account' | 'security'>;
134+
export type UserProfilePageProps = PageProps<'account' | 'security' | 'billing' | 'apiKeys'>;
135135

136136
export type UserProfileLinkProps = {
137137
url: string;
138138
label: string;
139139
labelIcon: React.ReactNode;
140140
};
141141

142-
export type OrganizationProfilePageProps = PageProps<'general' | 'members'>;
142+
export type OrganizationProfilePageProps = PageProps<'general' | 'members' | 'billing' | 'apiKeys'>;
143143
export type OrganizationProfileLinkProps = UserProfileLinkProps;
144144

145145
type ButtonActionProps<T extends string> =

packages/react/src/utils/useCustomPages.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const useUserProfileCustomPages = (
2020
children: React.ReactNode | React.ReactNode[],
2121
options?: UseCustomPagesOptions,
2222
) => {
23-
const reorderItemsLabels = ['account', 'security'];
23+
const reorderItemsLabels = ['account', 'security', 'billing', 'apiKeys'];
2424
return useCustomPages(
2525
{
2626
children,
@@ -38,7 +38,7 @@ export const useOrganizationProfileCustomPages = (
3838
children: React.ReactNode | React.ReactNode[],
3939
options?: UseCustomPagesOptions,
4040
) => {
41-
const reorderItemsLabels = ['general', 'members'];
41+
const reorderItemsLabels = ['general', 'members', 'billing', 'apiKeys'];
4242
return useCustomPages(
4343
{
4444
children,

packages/vue/src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ type PageProps<T extends string> =
8383
url?: never;
8484
};
8585

86-
export type UserProfilePageProps = PageProps<'account' | 'security'>;
86+
export type UserProfilePageProps = PageProps<'account' | 'security' | 'billing' | 'apiKeys'>;
8787

8888
export type UserProfileLinkProps = {
8989
url: string;
9090
label: string;
9191
};
9292

93-
export type OrganizationProfilePageProps = PageProps<'general' | 'members'>;
93+
export type OrganizationProfilePageProps = PageProps<'general' | 'members' | 'billing' | 'apiKeys'>;
9494

9595
export type OrganizationLinkProps = {
9696
url: string;

packages/vue/src/utils/useCustomPages.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { useCustomElementPortal } from './useCustomElementPortal';
1212

1313
export const useUserProfileCustomPages = () => {
1414
const { customPages, customPagesPortals, addCustomPage } = useCustomPages({
15-
reorderItemsLabels: ['account', 'security'],
15+
reorderItemsLabels: ['account', 'security', 'billing', 'apiKeys'],
1616
PageComponent: UserProfilePage,
1717
LinkComponent: UserProfileLink,
1818
componentName: 'UserProfile',
@@ -31,7 +31,7 @@ export const useUserProfileCustomPages = () => {
3131

3232
export const useOrganizationProfileCustomPages = () => {
3333
const { customPages, customPagesPortals, addCustomPage } = useCustomPages({
34-
reorderItemsLabels: ['general', 'members'],
34+
reorderItemsLabels: ['general', 'members', 'billing', 'apiKeys'],
3535
PageComponent: OrganizationProfilePage,
3636
LinkComponent: OrganizationProfileLink,
3737
componentName: 'OrganizationProfile',

0 commit comments

Comments
 (0)