Skip to content

Conversation

@wobsoriano
Copy link
Member

@wobsoriano wobsoriano commented Dec 5, 2025

Description

Adds apiKeys and billing as valid reorder labels for <UserProfile.Page /> and <OrganizationProfile.Page /> components.

No new tests added here. The underlying reordering logic is already covered by existing tests. The apiKeys and billing routes require per-instance feature flags to be enabled.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • New Features
    • You can now reorder Billing and API Keys pages in User and Organization profiles. This update makes Billing and API Keys available as reorderable profile sections across supported frameworks and custom pages, so you can arrange profile navigation to match your needs.

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Dec 5, 2025

🦋 Changeset detected

Latest commit: 97d9623

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@clerk/astro Patch
@clerk/clerk-js Patch
@clerk/clerk-react Patch
@clerk/vue Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch
@clerk/elements Patch
@clerk/nextjs Patch
@clerk/react-router Patch
@clerk/remix Patch
@clerk/tanstack-react-start Patch
@clerk/nuxt Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Dec 5, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
clerk-js-sandbox Ready Ready Preview Comment Dec 5, 2025 10:20pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 5, 2025

Walkthrough

This pull request adds 'billing' and 'apiKeys' to reorderable page labels across Astro, React, Vue, and Clerk JS packages, updating configuration arrays and public type signatures to include the new labels.

Changes

Cohort / File(s) Summary
Changeset Documentation
.changeset/little-buttons-try.md
Adds a changeset documenting the ability to reorder billing and apiKeys pages within UserProfile and OrganizationProfile, with a usage example.
Astro components
packages/astro/src/astro-components/.../OrganizationProfile/OrganizationProfilePage.astro, packages/astro/src/astro-components/.../OrganizationSwitcher/OrganizationProfilePage.astro, packages/astro/src/astro-components/interactive/UserProfile/UserProfilePage.astro
Expanded reorderItemsLabels arrays to include 'billing' and 'apiKeys', widening the derived ReorderItemsLabels type and adjusting Props typing so url becomes optional for the added labels.
Clerk JS utils
packages/clerk-js/src/ui/utils/createCustomPages.tsx
Extended ProfileReorderItem label union to include 'billing' and 'apiKeys'.
React utils & types
packages/react/src/utils/useCustomPages.tsx, packages/react/src/types.ts
Appended 'billing' and 'apiKeys' to reorderable label lists and widened UserProfilePageProps / OrganizationProfilePageProps PageProps generics to include the new labels.
Vue types & utils
packages/vue/src/types.ts, packages/vue/src/utils/useCustomPages.ts
Updated UserProfilePageProps and OrganizationProfilePageProps type signatures to include 'billing' and 'apiKeys'; expanded reorderItemsLabels in custom page utilities.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Consistent, repeated pattern across multiple packages but touches public type signatures in React and Vue which merit verification.
  • Pay attention to:
    • Consistency of label spelling (billing, apiKeys) across all files.
    • Public type exports in packages/react/src/types.ts and packages/vue/src/types.ts.
    • Any downstream consumers relying on narrower unions.

Poem

🐰 I hopped through types and labels today,
Billing and API keys joined the play,
Across frameworks I nudged each line,
Profiles now shuffle in order fine,
A happy rabbit, code in sway ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding 'apiKeys' and 'billing' as valid reorder labels across multiple profile components.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch rob/add-api-keys-billing-reorder

Comment @coderabbitai help to get the list of available commands and usage tips.

@wobsoriano wobsoriano marked this pull request as ready for review December 5, 2025 22:02
@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 5, 2025

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7383

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7383

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7383

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7383

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7383

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7383

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@7383

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@7383

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7383

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7383

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7383

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7383

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7383

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7383

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@7383

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7383

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@7383

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7383

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7383

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7383

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@7383

@clerk/types

npm i https://pkg.pr.new/@clerk/types@7383

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7383

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7383

commit: 97d9623

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3af6b56 and 97d9623.

📒 Files selected for processing (1)
  • packages/react/src/types.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

All code must pass ESLint checks with the project's configuration

Files:

  • packages/react/src/types.ts
**/*.{js,jsx,ts,tsx,json,md,yml,yaml}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • packages/react/src/types.ts
packages/**/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/react/src/types.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Follow established naming conventions (PascalCase for components, camelCase for variables)

Prefer importing types from @clerk/shared/types instead of the deprecated @clerk/types alias

Files:

  • packages/react/src/types.ts
packages/**/src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

packages/**/src/**/*.{ts,tsx,js,jsx}: Maintain comprehensive JSDoc comments for public APIs
Use tree-shaking friendly exports
Validate all inputs and sanitize outputs
All public APIs must be documented with JSDoc
Use dynamic imports for optional features
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Implement proper logging with different levels

Files:

  • packages/react/src/types.ts
**/*.ts?(x)

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

Files:

  • packages/react/src/types.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)

**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Implement type guards for unknown types using the pattern function isType(value: unknown): value is Type
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details in classes
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Use mixins for shared behavior across unrelated classes in TypeScript
Use generic constraints with bounded type parameters like <T extends { id: string }>
Use utility types like Omit, Partial, and Pick for data transformation instead of manual type construction
Use discriminated unions instead of boolean flags for state management and API responses
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation at the type level
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Document functions with JSDoc comments including @param, @returns, @throws, and @example tags
Create custom error classes that extend Error for specific error types
Use the Result pattern for error handling instead of throwing exceptions
Use optional chaining (?.) and nullish coalescing (??) operators for safe property access
Let TypeScript infer obvious types to reduce verbosity
Use const assertions with as const for literal types
Use satisfies operator for type checking without widening types
Declare readonly arrays and objects for immutable data structures
Use spread operator and array spread for immutable updates instead of mutations
Use lazy loading for large types...

Files:

  • packages/react/src/types.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Publish with pkg-pr-new
  • GitHub Check: Unit Tests (22, shared, clerk-js, RQ)
  • GitHub Check: Unit Tests (22, **)
  • GitHub Check: Static analysis
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (1)
packages/react/src/types.ts (1)

134-134: React and Vue type definitions are consistent; Astro and Clerk JS don't require these profile page props.

The 'billing' and 'apiKeys' labels are correctly defined in UserProfilePageProps and OrganizationProfilePageProps across React and Vue packages. The reorder logic in React's useCustomPages.tsx properly includes both labels. Astro does not implement profile page customization types (uses a different architecture), and Clerk JS is not a UI component package. No issues found with label handling.

};

export type UserProfilePageProps = PageProps<'account' | 'security'>;
export type UserProfilePageProps = PageProps<'account' | 'security' | 'billing' | 'apiKeys'>;
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Add JSDoc documentation for the new page labels.

As per coding guidelines, all public APIs must be documented with JSDoc. These type definitions should include comments explaining what the 'billing' and 'apiKeys' labels represent and mention that they require per-instance feature flags to be enabled.

Apply this diff to add JSDoc documentation:

+/**
+ * Props for custom pages in the UserProfile component.
+ * Use 'account', 'security', 'billing', or 'apiKeys' for built-in pages.
+ * Note: 'billing' and 'apiKeys' require per-instance feature flags to be enabled.
+ */
 export type UserProfilePageProps = PageProps<'account' | 'security' | 'billing' | 'apiKeys'>;

 export type UserProfileLinkProps = {
   url: string;
   label: string;
   labelIcon: React.ReactNode;
 };

+/**
+ * Props for custom pages in the OrganizationProfile component.
+ * Use 'general', 'members', 'billing', or 'apiKeys' for built-in pages.
+ * Note: 'billing' and 'apiKeys' require per-instance feature flags to be enabled.
+ */
 export type OrganizationProfilePageProps = PageProps<'general' | 'members' | 'billing' | 'apiKeys'>;

Based on coding guidelines: "Maintain comprehensive JSDoc comments for public APIs" and "All public APIs must be documented with JSDoc."

Also applies to: 142-142

🤖 Prompt for AI Agents
In packages/react/src/types.ts around lines 134 and 142, add JSDoc comments for
the exported PageProps type labels: document what the 'billing' label represents
(the user billing management page) and what the 'apiKeys' label represents (API
key management page), and explicitly state that both 'billing' and 'apiKeys'
require per-instance feature flags to be enabled; place concise JSDoc blocks
immediately above the type declarations so the comments are included in the
public API docs and follow existing JSDoc style in the file.

@wobsoriano wobsoriano enabled auto-merge (squash) December 5, 2025 22:26
@wobsoriano wobsoriano merged commit 0307ea8 into main Dec 5, 2025
45 of 46 checks passed
@wobsoriano wobsoriano deleted the rob/add-api-keys-billing-reorder branch December 5, 2025 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants