Skip to content

Conversation

panteliselef
Copy link
Member

@panteliselef panteliselef commented Jul 29, 2025

Description

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

  • Refactor
    • Standardized payer type terminology by replacing "org" with "organization" across billing, subscription, checkout, and payment interfaces.
    • Updated UI components, hooks, context providers, and type definitions to use the new naming convention, improving clarity in subscription and payment flows.
    • Renamed related props and parameters to align with the updated terminology, ensuring consistent user context representation throughout the application.

@panteliselef panteliselef requested review from aeliox and a team July 29, 2025 10:58
@panteliselef panteliselef self-assigned this Jul 29, 2025
Copy link

changeset-bot bot commented Jul 29, 2025

🦋 Changeset detected

Latest commit: 01fc05c

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

This PR includes changesets to release 22 packages
Name Type
@clerk/clerk-js Minor
@clerk/shared Minor
@clerk/types Minor
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch
@clerk/agent-toolkit Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/elements Patch
@clerk/expo-passkeys Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/clerk-react Patch
@clerk/remix Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch
@clerk/vue Patch
@clerk/localizations Patch
@clerk/themes 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

Copy link

vercel bot commented Jul 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 29, 2025 0:01am

Copy link
Contributor

coderabbitai bot commented Jul 29, 2025

📝 Walkthrough

Walkthrough

This change updates the terminology and type system for payer types across multiple packages. The string literal 'org' is replaced by 'organization' when referring to payer types in billing APIs, except in resource classes that represent data from the Frontend API, which retain the original value 'org'. New type aliases ForPayerType (with values 'organization' | 'user') and CommercePayerResourceType (with values 'org' | 'user') are introduced and used to replace previous types. The update modifies type annotations, prop names, context providers, hooks, components, and type declarations to ensure consistent usage of the new payer type naming convention throughout the codebase.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

Suggested labels

types, clerk-js

Suggested reviewers

  • aeliox

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1b5a997 and 4f125ce.

📒 Files selected for processing (33)
  • .changeset/some-parents-begin.md (1 hunks)
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts (1 hunks)
  • packages/clerk-js/src/core/resources/CommercePlan.ts (2 hunks)
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx (2 hunks)
  • packages/clerk-js/src/ui/components/Checkout/CheckoutPage.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/Checkout/index.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPaymentAttemptPage.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPlansPage.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationStatementPage.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/PaymentSources/PaymentSources.tsx (4 hunks)
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx (3 hunks)
  • packages/clerk-js/src/ui/components/Subscriptions/SubscriptionsList.tsx (1 hunks)
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx (1 hunks)
  • packages/clerk-js/src/ui/contexts/components/Checkout.ts (0 hunks)
  • packages/clerk-js/src/ui/contexts/components/Plans.tsx (6 hunks)
  • packages/clerk-js/src/ui/contexts/components/SubscriberType.ts (1 hunks)
  • packages/clerk-js/src/ui/lazyModules/MountedCheckoutDrawer.tsx (1 hunks)
  • packages/react/src/components/CheckoutButton.tsx (3 hunks)
  • packages/react/src/components/SubscriptionDetailsButton.tsx (3 hunks)
  • packages/react/src/components/__tests__/CheckoutButton.test.tsx (2 hunks)
  • packages/react/src/components/__tests__/PlanDetailsButton.test.tsx (2 hunks)
  • packages/react/src/components/__tests__/SubscriptionDetailsButton.test.tsx (2 hunks)
  • packages/shared/src/react/commerce.tsx (6 hunks)
  • packages/shared/src/react/contexts.tsx (2 hunks)
  • packages/shared/src/react/hooks/createCommerceHook.tsx (3 hunks)
  • packages/shared/src/react/hooks/useCheckout.ts (2 hunks)
  • packages/shared/src/react/hooks/usePlans.tsx (1 hunks)
  • packages/shared/src/react/hooks/useSubscription.tsx (2 hunks)
  • packages/types/src/clerk.ts (6 hunks)
  • packages/types/src/commerce.ts (3 hunks)
  • packages/types/src/json.ts (2 hunks)
💤 Files with no reviewable changes (1)
  • packages/clerk-js/src/ui/contexts/components/Checkout.ts
✅ Files skipped from review due to trivial changes (2)
  • packages/react/src/components/tests/PlanDetailsButton.test.tsx
  • packages/types/src/json.ts
🚧 Files skipped from review as they are similar to previous changes (30)
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPlansPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationStatementPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
  • packages/clerk-js/src/ui/lazyModules/MountedCheckoutDrawer.tsx
  • packages/clerk-js/src/ui/components/Checkout/index.tsx
  • packages/react/src/components/tests/CheckoutButton.test.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPaymentAttemptPage.tsx
  • packages/clerk-js/src/ui/components/Subscriptions/SubscriptionsList.tsx
  • packages/shared/src/react/contexts.tsx
  • packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
  • packages/clerk-js/src/core/resources/CommercePlan.ts
  • packages/shared/src/react/hooks/useSubscription.tsx
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutPage.tsx
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts
  • packages/react/src/components/tests/SubscriptionDetailsButton.test.tsx
  • packages/shared/src/react/hooks/usePlans.tsx
  • .changeset/some-parents-begin.md
  • packages/clerk-js/src/ui/components/PaymentSources/PaymentSources.tsx
  • packages/react/src/components/CheckoutButton.tsx
  • packages/clerk-js/src/ui/contexts/components/Plans.tsx
  • packages/react/src/components/SubscriptionDetailsButton.tsx
  • packages/clerk-js/src/ui/contexts/components/SubscriberType.ts
  • packages/shared/src/react/hooks/useCheckout.ts
  • packages/shared/src/react/hooks/createCommerceHook.tsx
  • packages/shared/src/react/commerce.tsx
  • packages/types/src/clerk.ts
  • packages/types/src/commerce.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). (5)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Build Packages
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0bdd0df and 0b5dfd6.

📒 Files selected for processing (28)
  • .changeset/some-parents-begin.md (1 hunks)
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts (1 hunks)
  • packages/clerk-js/src/core/resources/CommercePlan.ts (2 hunks)
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx (2 hunks)
  • packages/clerk-js/src/ui/components/Checkout/CheckoutPage.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/Checkout/index.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPaymentAttemptPage.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPlansPage.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationStatementPage.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/PaymentSources/PaymentSources.tsx (4 hunks)
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx (3 hunks)
  • packages/clerk-js/src/ui/components/Subscriptions/SubscriptionsList.tsx (1 hunks)
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx (1 hunks)
  • packages/clerk-js/src/ui/contexts/components/Checkout.ts (0 hunks)
  • packages/clerk-js/src/ui/contexts/components/Plans.tsx (6 hunks)
  • packages/clerk-js/src/ui/contexts/components/SubscriberType.ts (1 hunks)
  • packages/clerk-js/src/ui/lazyModules/MountedCheckoutDrawer.tsx (1 hunks)
  • packages/shared/src/react/commerce.tsx (6 hunks)
  • packages/shared/src/react/contexts.tsx (2 hunks)
  • packages/shared/src/react/hooks/createCommerceHook.tsx (3 hunks)
  • packages/shared/src/react/hooks/useCheckout.ts (2 hunks)
  • packages/shared/src/react/hooks/usePlans.tsx (1 hunks)
  • packages/shared/src/react/hooks/useSubscription.tsx (2 hunks)
  • packages/types/src/clerk.ts (6 hunks)
  • packages/types/src/commerce.ts (3 hunks)
  • packages/types/src/json.ts (2 hunks)
💤 Files with no reviewable changes (1)
  • packages/clerk-js/src/ui/contexts/components/Checkout.ts
🧰 Additional context used
📓 Path-based instructions (11)
packages/clerk-js/src/ui/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/clerk-js-ui.mdc)

packages/clerk-js/src/ui/**/*.{ts,tsx}: Element descriptors should always be camelCase
Use element descriptors in UI components to enable consistent theming and styling via appearance.elements
Element descriptors should generate unique, stable CSS classes for theming
Element descriptors should handle state classes (e.g., cl-loading, cl-active, cl-error, cl-open) automatically based on component state
Do not render hard-coded values; all user-facing strings must be localized using provided localization methods
Use the useLocalizations hook and localizationKeys utility for all text and error messages
Use the styled system (sx prop, theme tokens, responsive values) for custom component styling
Use useCardState for card-level state, useFormState for form-level state, and useLoadingStatus for loading states
Always use handleError utility for API errors and use translateError for localized error messages
Use useFormControl for form field state, implement proper validation, and handle loading and error states in forms
Use localization keys for all form labels and placeholders
Use element descriptors for consistent styling and follow the theme token system
Use the Card and FormContainer patterns for consistent UI structure

Files:

  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationStatementPage.tsx
  • packages/clerk-js/src/ui/components/Checkout/index.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPlansPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPaymentAttemptPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
  • packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx
  • packages/clerk-js/src/ui/lazyModules/MountedCheckoutDrawer.tsx
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
  • packages/clerk-js/src/ui/components/Subscriptions/SubscriptionsList.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutPage.tsx
  • packages/clerk-js/src/ui/contexts/components/Plans.tsx
  • packages/clerk-js/src/ui/components/PaymentSources/PaymentSources.tsx
  • packages/clerk-js/src/ui/contexts/components/SubscriberType.ts
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

**/*.{js,jsx,ts,tsx}: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
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
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels

Files:

  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationStatementPage.tsx
  • packages/clerk-js/src/ui/components/Checkout/index.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPlansPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPaymentAttemptPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
  • packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx
  • packages/shared/src/react/contexts.tsx
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts
  • packages/clerk-js/src/ui/lazyModules/MountedCheckoutDrawer.tsx
  • packages/clerk-js/src/core/resources/CommercePlan.ts
  • packages/types/src/json.ts
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/shared/src/react/hooks/useSubscription.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
  • packages/shared/src/react/hooks/usePlans.tsx
  • packages/clerk-js/src/ui/components/Subscriptions/SubscriptionsList.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutPage.tsx
  • packages/clerk-js/src/ui/contexts/components/Plans.tsx
  • packages/clerk-js/src/ui/components/PaymentSources/PaymentSources.tsx
  • packages/shared/src/react/hooks/useCheckout.ts
  • packages/shared/src/react/hooks/createCommerceHook.tsx
  • packages/types/src/commerce.ts
  • packages/clerk-js/src/ui/contexts/components/SubscriberType.ts
  • packages/shared/src/react/commerce.tsx
  • packages/types/src/clerk.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationStatementPage.tsx
  • packages/clerk-js/src/ui/components/Checkout/index.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPlansPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPaymentAttemptPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
  • packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx
  • packages/shared/src/react/contexts.tsx
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts
  • packages/clerk-js/src/ui/lazyModules/MountedCheckoutDrawer.tsx
  • packages/clerk-js/src/core/resources/CommercePlan.ts
  • packages/types/src/json.ts
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/shared/src/react/hooks/useSubscription.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
  • packages/shared/src/react/hooks/usePlans.tsx
  • packages/clerk-js/src/ui/components/Subscriptions/SubscriptionsList.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutPage.tsx
  • packages/clerk-js/src/ui/contexts/components/Plans.tsx
  • packages/clerk-js/src/ui/components/PaymentSources/PaymentSources.tsx
  • packages/shared/src/react/hooks/useCheckout.ts
  • packages/shared/src/react/hooks/createCommerceHook.tsx
  • packages/types/src/commerce.ts
  • packages/clerk-js/src/ui/contexts/components/SubscriberType.ts
  • packages/shared/src/react/commerce.tsx
  • packages/types/src/clerk.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationStatementPage.tsx
  • packages/clerk-js/src/ui/components/Checkout/index.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPlansPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPaymentAttemptPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
  • packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx
  • packages/shared/src/react/contexts.tsx
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts
  • packages/clerk-js/src/ui/lazyModules/MountedCheckoutDrawer.tsx
  • packages/clerk-js/src/core/resources/CommercePlan.ts
  • packages/types/src/json.ts
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/shared/src/react/hooks/useSubscription.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
  • packages/shared/src/react/hooks/usePlans.tsx
  • packages/clerk-js/src/ui/components/Subscriptions/SubscriptionsList.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutPage.tsx
  • packages/clerk-js/src/ui/contexts/components/Plans.tsx
  • packages/clerk-js/src/ui/components/PaymentSources/PaymentSources.tsx
  • packages/shared/src/react/hooks/useCheckout.ts
  • packages/shared/src/react/hooks/createCommerceHook.tsx
  • packages/types/src/commerce.ts
  • packages/clerk-js/src/ui/contexts/components/SubscriberType.ts
  • packages/shared/src/react/commerce.tsx
  • packages/types/src/clerk.ts
packages/**/*.{ts,tsx,d.ts}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Packages should export TypeScript types alongside runtime code

Files:

  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationStatementPage.tsx
  • packages/clerk-js/src/ui/components/Checkout/index.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPlansPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPaymentAttemptPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
  • packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx
  • packages/shared/src/react/contexts.tsx
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts
  • packages/clerk-js/src/ui/lazyModules/MountedCheckoutDrawer.tsx
  • packages/clerk-js/src/core/resources/CommercePlan.ts
  • packages/types/src/json.ts
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/shared/src/react/hooks/useSubscription.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
  • packages/shared/src/react/hooks/usePlans.tsx
  • packages/clerk-js/src/ui/components/Subscriptions/SubscriptionsList.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutPage.tsx
  • packages/clerk-js/src/ui/contexts/components/Plans.tsx
  • packages/clerk-js/src/ui/components/PaymentSources/PaymentSources.tsx
  • packages/shared/src/react/hooks/useCheckout.ts
  • packages/shared/src/react/hooks/createCommerceHook.tsx
  • packages/types/src/commerce.ts
  • packages/clerk-js/src/ui/contexts/components/SubscriberType.ts
  • packages/shared/src/react/commerce.tsx
  • packages/types/src/clerk.ts
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

**/*.{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
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
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Prefer readonly for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Use const assertions for literal types: as const
Use satisfies operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports: import type { ... } from ...
No any types without justification
Proper error handling with typed errors
Consistent use of readonly for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)

Files:

  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationStatementPage.tsx
  • packages/clerk-js/src/ui/components/Checkout/index.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPlansPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPaymentAttemptPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
  • packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx
  • packages/shared/src/react/contexts.tsx
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts
  • packages/clerk-js/src/ui/lazyModules/MountedCheckoutDrawer.tsx
  • packages/clerk-js/src/core/resources/CommercePlan.ts
  • packages/types/src/json.ts
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/shared/src/react/hooks/useSubscription.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
  • packages/shared/src/react/hooks/usePlans.tsx
  • packages/clerk-js/src/ui/components/Subscriptions/SubscriptionsList.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutPage.tsx
  • packages/clerk-js/src/ui/contexts/components/Plans.tsx
  • packages/clerk-js/src/ui/components/PaymentSources/PaymentSources.tsx
  • packages/shared/src/react/hooks/useCheckout.ts
  • packages/shared/src/react/hooks/createCommerceHook.tsx
  • packages/types/src/commerce.ts
  • packages/clerk-js/src/ui/contexts/components/SubscriberType.ts
  • packages/shared/src/react/commerce.tsx
  • packages/types/src/clerk.ts
**/*.{jsx,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

**/*.{jsx,tsx}: Use error boundaries in React components
Minimize re-renders in React components

**/*.{jsx,tsx}: Always use functional components with hooks instead of class components
Follow PascalCase naming for components: UserProfile, NavigationMenu
Keep components focused on a single responsibility - split large components
Limit component size to 150-200 lines; extract logic into custom hooks
Use composition over inheritance - prefer smaller, composable components
Export components as named exports for better tree-shaking
One component per file with matching filename and component name
Use useState for simple state management
Use useReducer for complex state logic
Implement proper state initialization
Use proper state updates with callbacks
Implement proper state cleanup
Use Context API for theme/authentication
Implement proper state selectors
Use proper state normalization
Implement proper state persistence
Use React.memo for expensive components
Implement proper useCallback for handlers
Use proper useMemo for expensive computations
Implement proper virtualization for lists
Use proper code splitting with React.lazy
Implement proper cleanup in useEffect
Use proper refs for DOM access
Implement proper event listener cleanup
Use proper abort controllers for fetch
Implement proper subscription cleanup
Use proper HTML elements
Implement proper ARIA attributes
Use proper heading hierarchy
Implement proper form labels
Use proper button types
Implement proper focus management
Use proper keyboard shortcuts
Implement proper tab order
Use proper skip links
Implement proper focus traps
Implement proper error boundaries
Use proper error logging
Implement proper error recovery
Use proper error messages
Implement proper error fallbacks
Use proper form validation
Implement proper error states
Use proper error messages
Implement proper form submission
Use proper form reset
Use proper component naming
Implement proper file naming
Use proper prop naming
Implement proper...

Files:

  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationStatementPage.tsx
  • packages/clerk-js/src/ui/components/Checkout/index.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPlansPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPaymentAttemptPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
  • packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx
  • packages/shared/src/react/contexts.tsx
  • packages/clerk-js/src/ui/lazyModules/MountedCheckoutDrawer.tsx
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/shared/src/react/hooks/useSubscription.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
  • packages/shared/src/react/hooks/usePlans.tsx
  • packages/clerk-js/src/ui/components/Subscriptions/SubscriptionsList.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutPage.tsx
  • packages/clerk-js/src/ui/contexts/components/Plans.tsx
  • packages/clerk-js/src/ui/components/PaymentSources/PaymentSources.tsx
  • packages/shared/src/react/hooks/createCommerceHook.tsx
  • packages/shared/src/react/commerce.tsx
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.

Files:

  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationStatementPage.tsx
  • packages/clerk-js/src/ui/components/Checkout/index.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPlansPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPaymentAttemptPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
  • packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx
  • packages/shared/src/react/contexts.tsx
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts
  • packages/clerk-js/src/ui/lazyModules/MountedCheckoutDrawer.tsx
  • packages/clerk-js/src/core/resources/CommercePlan.ts
  • packages/types/src/json.ts
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/shared/src/react/hooks/useSubscription.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
  • packages/shared/src/react/hooks/usePlans.tsx
  • packages/clerk-js/src/ui/components/Subscriptions/SubscriptionsList.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutPage.tsx
  • packages/clerk-js/src/ui/contexts/components/Plans.tsx
  • packages/clerk-js/src/ui/components/PaymentSources/PaymentSources.tsx
  • packages/shared/src/react/hooks/useCheckout.ts
  • packages/shared/src/react/hooks/createCommerceHook.tsx
  • packages/types/src/commerce.ts
  • packages/clerk-js/src/ui/contexts/components/SubscriberType.ts
  • packages/shared/src/react/commerce.tsx
  • packages/types/src/clerk.ts
**/*.tsx

📄 CodeRabbit Inference Engine (.cursor/rules/react.mdc)

**/*.tsx: Use proper type definitions for props and state
Leverage TypeScript's type inference where possible
Use proper event types for handlers
Implement proper generic types for reusable components
Use proper type guards for conditional rendering

Files:

  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationStatementPage.tsx
  • packages/clerk-js/src/ui/components/Checkout/index.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPlansPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPaymentAttemptPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
  • packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx
  • packages/shared/src/react/contexts.tsx
  • packages/clerk-js/src/ui/lazyModules/MountedCheckoutDrawer.tsx
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/shared/src/react/hooks/useSubscription.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
  • packages/shared/src/react/hooks/usePlans.tsx
  • packages/clerk-js/src/ui/components/Subscriptions/SubscriptionsList.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutPage.tsx
  • packages/clerk-js/src/ui/contexts/components/Plans.tsx
  • packages/clerk-js/src/ui/components/PaymentSources/PaymentSources.tsx
  • packages/shared/src/react/hooks/createCommerceHook.tsx
  • packages/shared/src/react/commerce.tsx
**/*

⚙️ CodeRabbit Configuration File

**/*: If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.

Whenever reviewing a pull request, if there are any changes that could impact security, always tag @clerk/security in the PR.

Security-impacting changes include, but are not limited to:

  • Changes to authentication logic or mechanisms (e.g. login, session handling, token issuance)
  • Any modification to access control, authorization checks, or role-based permissions
  • Introduction or modification of hashing algorithms, signature verification, or cryptographic primitives
  • Handling of sensitive data (e.g. passwords, tokens, secrets, PII)
  • Integration with external identity providers (e.g. SSO, OAuth, OpenID Connect)
  • Modifications to security headers, cookie flags, CORS policies, or CSRF protections
  • Bypass mechanisms (e.g. feature flags, testing overrides) that could weaken protections
  • Changes to rate limiting, abuse prevention, or input validation

If you're unsure whether a change is security-relevant, err on the side of caution and tag @clerk/security.

Any time that you tag @clerk/security, please do so explicitly in a code comment, rather than within a collapsed section in a coderabbit comment, such as the "recent review details" section. If you do use the team name in any thinking or non-direct-code-comment content, it can be referred to as "clerk security team" to avoid accidentally printing the tag which sends a notification to the team.

Files:

  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationStatementPage.tsx
  • packages/clerk-js/src/ui/components/Checkout/index.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPlansPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPaymentAttemptPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
  • packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx
  • packages/shared/src/react/contexts.tsx
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts
  • packages/clerk-js/src/ui/lazyModules/MountedCheckoutDrawer.tsx
  • packages/clerk-js/src/core/resources/CommercePlan.ts
  • packages/types/src/json.ts
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/shared/src/react/hooks/useSubscription.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
  • packages/shared/src/react/hooks/usePlans.tsx
  • packages/clerk-js/src/ui/components/Subscriptions/SubscriptionsList.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutPage.tsx
  • packages/clerk-js/src/ui/contexts/components/Plans.tsx
  • packages/clerk-js/src/ui/components/PaymentSources/PaymentSources.tsx
  • packages/shared/src/react/hooks/useCheckout.ts
  • packages/shared/src/react/hooks/createCommerceHook.tsx
  • packages/types/src/commerce.ts
  • packages/clerk-js/src/ui/contexts/components/SubscriberType.ts
  • packages/shared/src/react/commerce.tsx
  • packages/types/src/clerk.ts
.changeset/**

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

Automated releases must use Changesets.

Files:

  • .changeset/some-parents-begin.md
🧬 Code Graph Analysis (18)
packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationStatementPage.tsx (1)
packages/clerk-js/src/ui/contexts/components/SubscriberType.ts (1)
  • SubscriberTypeContext (5-5)
packages/clerk-js/src/ui/components/Checkout/index.tsx (1)
packages/clerk-js/src/ui/contexts/components/SubscriberType.ts (1)
  • SubscriberTypeContext (5-5)
packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPlansPage.tsx (1)
packages/clerk-js/src/ui/contexts/components/SubscriberType.ts (1)
  • SubscriberTypeContext (5-5)
packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPaymentAttemptPage.tsx (1)
packages/clerk-js/src/ui/contexts/components/SubscriberType.ts (1)
  • SubscriberTypeContext (5-5)
packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx (1)
packages/clerk-js/src/ui/contexts/components/SubscriberType.ts (1)
  • SubscriberTypeContext (5-5)
packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx (1)
packages/react/src/isomorphicClerk.ts (1)
  • organization (680-686)
packages/shared/src/react/contexts.tsx (1)
packages/types/src/commerce.ts (1)
  • ForPayerType (111-111)
packages/clerk-js/src/core/resources/CommercePlan.ts (1)
packages/types/src/commerce.ts (1)
  • CommercePayerResourceType (101-101)
packages/types/src/json.ts (1)
packages/types/src/commerce.ts (1)
  • CommercePayerResourceType (101-101)
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx (2)
packages/clerk-js/src/ui/contexts/components/SubscriberType.ts (1)
  • SubscriberTypeContext (5-5)
packages/types/src/clerk.ts (1)
  • PricingTableProps (1781-1781)
packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx (1)
packages/clerk-js/src/ui/contexts/components/SubscriberType.ts (1)
  • SubscriberTypeContext (5-5)
packages/shared/src/react/hooks/useSubscription.tsx (1)
packages/types/src/commerce.ts (1)
  • ForPayerType (111-111)
packages/clerk-js/src/ui/components/PaymentSources/PaymentSources.tsx (1)
packages/react/src/isomorphicClerk.ts (1)
  • organization (680-686)
packages/shared/src/react/hooks/useCheckout.ts (1)
packages/shared/src/react/contexts.tsx (1)
  • __experimental_CheckoutProvider (119-119)
packages/shared/src/react/hooks/createCommerceHook.tsx (3)
packages/types/src/commerce.ts (1)
  • ForPayerType (111-111)
packages/types/src/pagination.ts (1)
  • ClerkPaginatedResponse (21-30)
packages/shared/src/react/types.ts (1)
  • PaginatedResources (14-80)
packages/clerk-js/src/ui/contexts/components/SubscriberType.ts (1)
packages/types/src/commerce.ts (1)
  • ForPayerType (111-111)
packages/shared/src/react/commerce.tsx (3)
packages/types/src/commerce.ts (1)
  • ForPayerType (111-111)
packages/shared/src/react/hooks/index.ts (2)
  • useOrganization (2-2)
  • useUser (7-7)
packages/react/src/isomorphicClerk.ts (2)
  • organization (680-686)
  • user (672-678)
packages/types/src/clerk.ts (1)
packages/types/src/commerce.ts (1)
  • ForPayerType (111-111)
🪛 ESLint
packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx

[error] 134-134: Unexpected constant truthiness on the left-hand side of a || expression.

(no-constant-binary-expression)

⏰ 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). (5)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Build Packages
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (47)
packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationStatementPage.tsx (1)

6-6: LGTM: Consistent terminology update

The change from 'org' to 'organization' aligns with the broader refactor to standardize payer type terminology across billing APIs. The component structure remains clean and follows React best practices.

packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPaymentAttemptPage.tsx (1)

6-6: LGTM: Consistent with refactor pattern

The terminology update from 'org' to 'organization' is consistent with the standardization effort across all organization profile components.

packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx (1)

86-86: LGTM: Terminology standardization maintained

The change from 'org' to 'organization' is consistent with the refactor objectives. The component maintains its well-structured architecture with proper element descriptors, localization, and permission-based access control.

packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPlansPage.tsx (1)

56-56: LGTM: Consistent refactor implementation

The terminology update maintains consistency with the other organization profile components. The component structure demonstrates good practices with proper permission checking and context management.

.changeset/some-parents-begin.md (1)

1-10: Approve: No remaining 'org' references found in billing code

I ran a targeted search across all billing-related files in packages/clerk-js and confirmed there are no lingering 'org' strings.

• Changeset correctly documents replacing orgorganization and lists all affected packages.
• Minor version bump is appropriate; the exception for Frontend API resource classes is clearly noted.

Next steps (non-blocking):

  • Add or update tests to cover the new organization terminology in your billing APIs.
  • Tag @clerk/security for a quick review of any payment/billing implications.
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx (1)

95-95: All SubscriberTypeContext consumers in clerk-js now use “organization”

I’ve verified across packages/clerk-js/src/ui that there are no remaining === 'org' or != 'org' checks—every consumer now handles the 'organization' value correctly. No further changes are needed in this package.

packages/clerk-js/src/ui/components/Checkout/index.tsx (1)

16-16: LGTM! Proper prop name alignment and fallback handling.

The change correctly updates the prop name from subscriberType to for and provides a sensible fallback to 'user'. This aligns with the broader refactor to standardize payer type naming and ensures the context always receives a valid ForPayerType value.

packages/shared/src/react/contexts.tsx (1)

7-7: LGTM! Improved type safety with ForPayerType.

The change from a hardcoded string literal 'organization' to the ForPayerType type alias improves type safety and consistency with the broader refactor. This ensures that only valid payer type values ('organization' | 'user') can be used in checkout options.

Also applies to: 29-29

packages/clerk-js/src/ui/lazyModules/MountedCheckoutDrawer.tsx (1)

43-43: LGTM! Prop name standardization aligned with refactor.

The change from subscriberType to for correctly aligns with the broader refactor to standardize prop naming across the checkout components. This maintains the same functionality while using the updated prop interface.

packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx (1)

61-61: LGTM! Proper mapping from resource to UI context values.

The conditional mapping correctly translates the resource's 'org' value to the UI context's standardized 'organization' value, while providing a sensible fallback to 'user'. This approach maintains backward compatibility with existing resource data while ensuring the UI context uses the standardized payer type naming.

packages/types/src/json.ts (1)

7-7: LGTM! Type import and usage properly aligned with the refactor.

The changes correctly update the import from CommercePayerType to CommercePayerResourceType and apply it consistently to the for_payer_type property. This maintains the same string literal values ('org' | 'user') while using the new semantic type name that distinguishes resource-level types from external API types.

Also applies to: 647-647

packages/clerk-js/src/core/resources/CommercePlan.ts (1)

1-6: LGTM! Resource class correctly uses the resource-level type.

The changes properly update the import and property type from CommercePayerType to CommercePayerResourceType. This is appropriate for a resource class that represents data from the Frontend API, maintaining the original 'org' | 'user' string literals while using the semantically correct type name.

Also applies to: 25-25

packages/shared/src/react/hooks/useSubscription.tsx (1)

1-1: LGTM! Type consolidation improves consistency.

The changes correctly replace the inline string literal union 'organization' | 'user' with the centralized ForPayerType type. This improves type safety and maintains consistency across the codebase while preserving the same string literal values.

Also applies to: 16-16

packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts (1)

36-37: LGTM! Proper mapping between external and internal payer types.

The changes correctly implement the mapping from the external-facing 'organization' parameter to the internal API's 'org' value, while defaulting to 'user'. This maintains backward compatibility with the existing backend API while supporting the new standardized terminology in the UI layer.

packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx (2)

192-192: LGTM! Condition updated to use standardized payer type.

The change correctly updates the condition from subscriberType === 'org' to subscriberType === 'organization', aligning with the new standardized payer type naming convention throughout the codebase.


384-384: LGTM! Parameter naming aligned with API conventions.

The changes correctly update the parameter name from subscriberType to for when calling openCheckout, which aligns with the standardized parameter naming convention established across the billing APIs and components.

Also applies to: 406-406

packages/clerk-js/src/ui/components/Subscriptions/SubscriptionsList.tsx (1)

200-200: LGTM: Consistent payer type alignment

The change from 'org' to 'organization' correctly aligns with the PR objective to standardize payer type naming across billing APIs.

packages/shared/src/react/hooks/usePlans.tsx (1)

14-17: LGTM: Simplified parameter handling

Good refactoring that:

  • Explicitly excludes orgId from forwarded parameters
  • Removes conditional mapping logic, delegating conversion to the API layer
  • Directly passes the _for value, simplifying the implementation
packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx (1)

118-118: LGTM: Variable naming alignment

The renaming from subscriberType to for: _for correctly aligns with the standardized parameter naming across the codebase.

packages/clerk-js/src/ui/components/Checkout/CheckoutPage.tsx (2)

13-13: Consider error handling for checkout.start()

Removing error handling from checkout.start().catch(() => null) to void checkout.start() means errors will no longer be caught. This could lead to unhandled promise rejections.

Consider if error handling is needed or if errors are handled elsewhere in the checkout flow.


20-20: LGTM: Simplified context usage

The changes correctly:

  • Rename subscriberType to for: _for for consistency
  • Pass _for directly instead of using conditional logic

Also applies to: 24-24

packages/clerk-js/src/ui/contexts/components/SubscriberType.ts (1)

1-1: LGTM: Type system alignment

The type changes from CommercePayerType to ForPayerType correctly align with the codebase refactor. The new ForPayerType supports 'organization' | 'user' values as seen in the type definition, maintaining the same functionality while standardizing naming.

Also applies to: 5-5, 7-7

packages/clerk-js/src/ui/contexts/components/Plans.tsx (2)

28-28: LGTM! Simplified parameter passing.

The removal of conditional mapping logic in favor of direct pass-through of subscriberType as the for parameter is a good simplification. This aligns with the broader refactor where the subscriber type context now directly provides the appropriate values ('organization' or 'user') that can be passed directly to the billing hooks.

Also applies to: 38-38, 48-48, 59-59, 77-77


306-306: LGTM! Consistent parameter naming.

The property name change from subscriberType to for maintains consistency with the updated billing API parameter naming conventions throughout the codebase.

packages/shared/src/react/hooks/useCheckout.ts (2)

9-9: LGTM! Improved type alignment.

Importing the __experimental_CheckoutProvider type instead of CommerceSubscriptionPlanPeriod allows the hook to derive its parameter type directly from the context provider, ensuring better type consistency.


48-50: LGTM! Type consistency improvement.

Using Parameters<typeof __experimental_CheckoutProvider>[0] to derive the Params type ensures that the useCheckout hook's parameters stay in sync with the __experimental_CheckoutProvider context. This is a robust approach that prevents type mismatches.

packages/clerk-js/src/ui/components/PaymentSources/PaymentSources.tsx (1)

28-28: LGTM! Consistent string literal updates.

All subscriber type checks have been consistently updated from 'org' to 'organization', aligning with the new ForPayerType values. The conditional logic remains functionally identical while using the standardized terminology.

Also applies to: 75-75, 111-111, 212-212

packages/types/src/commerce.ts (4)

101-101: LGTM! Clear type rename.

Renaming CommercePayerType to CommercePayerResourceType clearly indicates this type is used for resource representations that come from the Frontend API, maintaining the original 'org' | 'user' values.


103-111: LGTM! Well-documented new type.

The new ForPayerType with 'organization' | 'user' values is properly documented and serves as the external-facing type for billing API parameters. The experimental annotation and documentation are consistent with the existing codebase standards.


240-240: LGTM! Correct type usage for external API.

Using ForPayerType for the GetPlansParams.for property is appropriate since this is an external-facing API parameter that should accept 'organization' rather than the internal 'org' representation.


383-383: LGTM! Appropriate type usage for resource property.

Using CommercePayerResourceType for the CommercePlanResource.forPayerType property is correct since this represents data from the Frontend API that uses the 'org' representation internally.

packages/shared/src/react/commerce.tsx (6)

2-2: LGTM: Import addition is correct.

The addition of ForPayerType to the import statement follows TypeScript best practices and is necessary for the type standardization changes throughout the file.


66-69: LGTM: Hook parameter and logic updates are correct.

The changes improve type safety by:

  • Using ForPayerType instead of inline string union type
  • Providing a sensible default value of 'user'
  • Updating the comparison logic to use 'organization' instead of 'org'

The conditional resource selection logic remains clear and correct.


141-146: LGTM: Well-documented prop with clear defaults.

The JSDoc documentation clearly explains the for prop's purpose and default behavior. The type annotation using ForPayerType is consistent with the broader refactoring effort.


236-236: LGTM: Appropriate variable renaming to avoid shadowing.

Renaming the destructured for prop to _for is a good practice to avoid potential shadowing issues with the for keyword while maintaining clear variable naming.


249-249: LGTM: String literal updated for consistency.

The comparison logic correctly uses 'organization' instead of 'org', aligning with the new ForPayerType definition and maintaining consistency across the codebase.


259-259: LGTM: Dependency array properly updated.

The useMemo dependency array correctly references the renamed _for variable, ensuring proper memoization behavior.

packages/shared/src/react/hooks/createCommerceHook.tsx (4)

1-1: LGTM: Import addition is necessary and correct.

The ForPayerType import is properly added to support the type standardization throughout the hook factory.


20-20: LGTM: Type consistency improvement.

Using ForPayerType instead of an inline union type improves maintainability and ensures consistency with the centralized type definition.


48-48: LGTM: Type property updated consistently.

The for property type update to ForPayerType maintains consistency with the other type changes in the hook factory.


52-54: LGTM: API improvement with optional parameters and sensible defaults.

Making the parameters optional while providing a sensible default value ({ for: 'user' }) improves the developer experience and maintains backward compatibility. The destructuring pattern properly handles both provided and default values.

packages/types/src/clerk.ts (6)

30-30: LGTM: Import updated for type standardization.

The import change from CommercePayerType to ForPayerType is consistent with the broader refactoring effort to standardize payer type naming.


75-75: LGTM: Type property updated consistently.

The for property type update to ForPayerType maintains the optional nature while using the standardized type definition.


1839-1839: LGTM: Checkout props type updated consistently.

The for property type update to ForPayerType in __internal_CheckoutProps maintains consistency with the standardized type system.


1864-1864: LGTM: Checkout button props type updated consistently.

The for property type update to ForPayerType in __experimental_CheckoutButtonProps aligns with the broader type standardization effort.


1932-1935: LGTM: Documentation and type updates are consistent.

The JSDoc comment correctly uses "organization" instead of "org" to match the new string literal values, and the type update to ForPayerType maintains consistency with the standardization effort.


1955-1958: LGTM: Consistent documentation and type updates.

The documentation and type changes mirror the pattern established in the previous subscription details props, maintaining consistency across the codebase.

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: 0

♻️ Duplicate comments (1)
packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx (1)

133-135: Critical: Remove hardcoded organization ID

The hardcoded organization ID 'org_30Xtae0Ptea60PvylFEIJi5LvXm' will always be used instead of the actual organization?.id due to JavaScript's truthy evaluation. This is a critical bug that will cause checkout to use the wrong organization.

-      // TODO(@COMMERCE): Come back to this, this should not be needed
-      ...(_for === 'organization' ? { orgId: 'org_30Xtae0Ptea60PvylFEIJi5LvXm' || organization?.id } : {}),
+      ...(_for === 'organization' ? { orgId: organization?.id } : {}),

The TODO comment suggests this shouldn't be needed - consider investigating if the orgId parameter is actually required.

🧹 Nitpick comments (2)
packages/react/src/components/CheckoutButton.tsx (1)

34-45: Update JSDoc examples to reflect new API.

The documentation examples still reference the old subscriberType="org" prop, which should be updated to for="organization" to match the new API.

-         subscriberType="org"
+         for="organization"
- * @throws {Error} When `subscriberType="org"` is used without an active organization context
+ * @throws {Error} When `for="organization"` is used without an active organization context
packages/react/src/components/SubscriptionDetailsButton.tsx (1)

29-39: Update JSDoc examples to reflect new API.

The documentation examples still reference for="org" which should be updated to for="organization" to match the new API.

-       for="org"
+       for="organization"
- * @throws {Error} When `for="org"` is used without an active organization context
+ * @throws {Error} When `for="organization"` is used without an active organization context
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b5dfd6 and 1b5a997.

📒 Files selected for processing (33)
  • .changeset/some-parents-begin.md (1 hunks)
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts (1 hunks)
  • packages/clerk-js/src/core/resources/CommercePlan.ts (2 hunks)
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx (2 hunks)
  • packages/clerk-js/src/ui/components/Checkout/CheckoutPage.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/Checkout/index.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPaymentAttemptPage.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPlansPage.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationStatementPage.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/PaymentSources/PaymentSources.tsx (4 hunks)
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx (3 hunks)
  • packages/clerk-js/src/ui/components/Subscriptions/SubscriptionsList.tsx (1 hunks)
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx (1 hunks)
  • packages/clerk-js/src/ui/contexts/components/Checkout.ts (0 hunks)
  • packages/clerk-js/src/ui/contexts/components/Plans.tsx (6 hunks)
  • packages/clerk-js/src/ui/contexts/components/SubscriberType.ts (1 hunks)
  • packages/clerk-js/src/ui/lazyModules/MountedCheckoutDrawer.tsx (1 hunks)
  • packages/react/src/components/CheckoutButton.tsx (3 hunks)
  • packages/react/src/components/SubscriptionDetailsButton.tsx (3 hunks)
  • packages/react/src/components/__tests__/CheckoutButton.test.tsx (2 hunks)
  • packages/react/src/components/__tests__/PlanDetailsButton.test.tsx (2 hunks)
  • packages/react/src/components/__tests__/SubscriptionDetailsButton.test.tsx (2 hunks)
  • packages/shared/src/react/commerce.tsx (6 hunks)
  • packages/shared/src/react/contexts.tsx (2 hunks)
  • packages/shared/src/react/hooks/createCommerceHook.tsx (3 hunks)
  • packages/shared/src/react/hooks/useCheckout.ts (2 hunks)
  • packages/shared/src/react/hooks/usePlans.tsx (1 hunks)
  • packages/shared/src/react/hooks/useSubscription.tsx (2 hunks)
  • packages/types/src/clerk.ts (6 hunks)
  • packages/types/src/commerce.ts (3 hunks)
  • packages/types/src/json.ts (2 hunks)
💤 Files with no reviewable changes (1)
  • packages/clerk-js/src/ui/contexts/components/Checkout.ts
✅ Files skipped from review due to trivial changes (3)
  • packages/types/src/json.ts
  • packages/react/src/components/tests/SubscriptionDetailsButton.test.tsx
  • packages/react/src/components/tests/PlanDetailsButton.test.tsx
🚧 Files skipped from review as they are similar to previous changes (25)
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPlansPage.tsx
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationStatementPage.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationPaymentAttemptPage.tsx
  • .changeset/some-parents-begin.md
  • packages/clerk-js/src/ui/lazyModules/MountedCheckoutDrawer.tsx
  • packages/shared/src/react/contexts.tsx
  • packages/clerk-js/src/ui/components/Subscriptions/SubscriptionsList.tsx
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutPage.tsx
  • packages/shared/src/react/hooks/useSubscription.tsx
  • packages/clerk-js/src/ui/contexts/components/SubscriberType.ts
  • packages/clerk-js/src/ui/components/Checkout/index.tsx
  • packages/clerk-js/src/core/resources/CommercePlan.ts
  • packages/types/src/commerce.ts
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts
  • packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx
  • packages/shared/src/react/hooks/useCheckout.ts
  • packages/shared/src/react/hooks/usePlans.tsx
  • packages/clerk-js/src/ui/contexts/components/Plans.tsx
  • packages/shared/src/react/commerce.tsx
  • packages/clerk-js/src/ui/components/PaymentSources/PaymentSources.tsx
  • packages/shared/src/react/hooks/createCommerceHook.tsx
  • packages/types/src/clerk.ts
🧰 Additional context used
📓 Path-based instructions (13)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

**/*.{js,jsx,ts,tsx}: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
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
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels

Files:

  • packages/react/src/components/SubscriptionDetailsButton.tsx
  • packages/react/src/components/__tests__/CheckoutButton.test.tsx
  • packages/react/src/components/CheckoutButton.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • packages/react/src/components/SubscriptionDetailsButton.tsx
  • packages/react/src/components/__tests__/CheckoutButton.test.tsx
  • packages/react/src/components/CheckoutButton.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
packages/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/react/src/components/SubscriptionDetailsButton.tsx
  • packages/react/src/components/__tests__/CheckoutButton.test.tsx
  • packages/react/src/components/CheckoutButton.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
packages/**/*.{ts,tsx,d.ts}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Packages should export TypeScript types alongside runtime code

Files:

  • packages/react/src/components/SubscriptionDetailsButton.tsx
  • packages/react/src/components/__tests__/CheckoutButton.test.tsx
  • packages/react/src/components/CheckoutButton.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

**/*.{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
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
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Prefer readonly for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Use const assertions for literal types: as const
Use satisfies operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports: import type { ... } from ...
No any types without justification
Proper error handling with typed errors
Consistent use of readonly for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)

Files:

  • packages/react/src/components/SubscriptionDetailsButton.tsx
  • packages/react/src/components/__tests__/CheckoutButton.test.tsx
  • packages/react/src/components/CheckoutButton.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
**/*.{jsx,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

**/*.{jsx,tsx}: Use error boundaries in React components
Minimize re-renders in React components

**/*.{jsx,tsx}: Always use functional components with hooks instead of class components
Follow PascalCase naming for components: UserProfile, NavigationMenu
Keep components focused on a single responsibility - split large components
Limit component size to 150-200 lines; extract logic into custom hooks
Use composition over inheritance - prefer smaller, composable components
Export components as named exports for better tree-shaking
One component per file with matching filename and component name
Use useState for simple state management
Use useReducer for complex state logic
Implement proper state initialization
Use proper state updates with callbacks
Implement proper state cleanup
Use Context API for theme/authentication
Implement proper state selectors
Use proper state normalization
Implement proper state persistence
Use React.memo for expensive components
Implement proper useCallback for handlers
Use proper useMemo for expensive computations
Implement proper virtualization for lists
Use proper code splitting with React.lazy
Implement proper cleanup in useEffect
Use proper refs for DOM access
Implement proper event listener cleanup
Use proper abort controllers for fetch
Implement proper subscription cleanup
Use proper HTML elements
Implement proper ARIA attributes
Use proper heading hierarchy
Implement proper form labels
Use proper button types
Implement proper focus management
Use proper keyboard shortcuts
Implement proper tab order
Use proper skip links
Implement proper focus traps
Implement proper error boundaries
Use proper error logging
Implement proper error recovery
Use proper error messages
Implement proper error fallbacks
Use proper form validation
Implement proper error states
Use proper error messages
Implement proper form submission
Use proper form reset
Use proper component naming
Implement proper file naming
Use proper prop naming
Implement proper...

Files:

  • packages/react/src/components/SubscriptionDetailsButton.tsx
  • packages/react/src/components/__tests__/CheckoutButton.test.tsx
  • packages/react/src/components/CheckoutButton.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.

Files:

  • packages/react/src/components/SubscriptionDetailsButton.tsx
  • packages/react/src/components/__tests__/CheckoutButton.test.tsx
  • packages/react/src/components/CheckoutButton.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
**/*.tsx

📄 CodeRabbit Inference Engine (.cursor/rules/react.mdc)

**/*.tsx: Use proper type definitions for props and state
Leverage TypeScript's type inference where possible
Use proper event types for handlers
Implement proper generic types for reusable components
Use proper type guards for conditional rendering

Files:

  • packages/react/src/components/SubscriptionDetailsButton.tsx
  • packages/react/src/components/__tests__/CheckoutButton.test.tsx
  • packages/react/src/components/CheckoutButton.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
**/*

⚙️ CodeRabbit Configuration File

**/*: If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.

Whenever reviewing a pull request, if there are any changes that could impact security, always tag @clerk/security in the PR.

Security-impacting changes include, but are not limited to:

  • Changes to authentication logic or mechanisms (e.g. login, session handling, token issuance)
  • Any modification to access control, authorization checks, or role-based permissions
  • Introduction or modification of hashing algorithms, signature verification, or cryptographic primitives
  • Handling of sensitive data (e.g. passwords, tokens, secrets, PII)
  • Integration with external identity providers (e.g. SSO, OAuth, OpenID Connect)
  • Modifications to security headers, cookie flags, CORS policies, or CSRF protections
  • Bypass mechanisms (e.g. feature flags, testing overrides) that could weaken protections
  • Changes to rate limiting, abuse prevention, or input validation

If you're unsure whether a change is security-relevant, err on the side of caution and tag @clerk/security.

Any time that you tag @clerk/security, please do so explicitly in a code comment, rather than within a collapsed section in a coderabbit comment, such as the "recent review details" section. If you do use the team name in any thinking or non-direct-code-comment content, it can be referred to as "clerk security team" to avoid accidentally printing the tag which sends a notification to the team.

Files:

  • packages/react/src/components/SubscriptionDetailsButton.tsx
  • packages/react/src/components/__tests__/CheckoutButton.test.tsx
  • packages/react/src/components/CheckoutButton.tsx
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
packages/**/*.{test,spec}.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

Unit tests should use Jest or Vitest as the test runner.

Files:

  • packages/react/src/components/__tests__/CheckoutButton.test.tsx
**/*.test.{jsx,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/react.mdc)

**/*.test.{jsx,tsx}: Use React Testing Library
Test component behavior, not implementation
Use proper test queries
Implement proper test isolation
Use proper test coverage
Test component interactions
Use proper test data
Implement proper test setup
Use proper test cleanup
Implement proper test assertions
Use proper test structure

Files:

  • packages/react/src/components/__tests__/CheckoutButton.test.tsx
**/__tests__/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/typescript.mdc)

**/__tests__/**/*.{ts,tsx}: Create type-safe test builders/factories
Use branded types for test isolation
Implement proper mock types that match interfaces

Files:

  • packages/react/src/components/__tests__/CheckoutButton.test.tsx
packages/clerk-js/src/ui/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/clerk-js-ui.mdc)

packages/clerk-js/src/ui/**/*.{ts,tsx}: Element descriptors should always be camelCase
Use element descriptors in UI components to enable consistent theming and styling via appearance.elements
Element descriptors should generate unique, stable CSS classes for theming
Element descriptors should handle state classes (e.g., cl-loading, cl-active, cl-error, cl-open) automatically based on component state
Do not render hard-coded values; all user-facing strings must be localized using provided localization methods
Use the useLocalizations hook and localizationKeys utility for all text and error messages
Use the styled system (sx prop, theme tokens, responsive values) for custom component styling
Use useCardState for card-level state, useFormState for form-level state, and useLoadingStatus for loading states
Always use handleError utility for API errors and use translateError for localized error messages
Use useFormControl for form field state, implement proper validation, and handle loading and error states in forms
Use localization keys for all form labels and placeholders
Use element descriptors for consistent styling and follow the theme token system
Use the Card and FormContainer patterns for consistent UI structure

Files:

  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
🧬 Code Graph Analysis (1)
packages/react/src/components/__tests__/CheckoutButton.test.tsx (1)
packages/react/src/components/CheckoutButton.tsx (1)
  • CheckoutButton (47-98)
🪛 ESLint
packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx

[error] 134-134: Unexpected constant truthiness on the left-hand side of a || expression.

(no-constant-binary-expression)

⏰ 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). (5)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Build Packages
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (9)
packages/react/src/components/__tests__/CheckoutButton.test.tsx (2)

57-67: LGTM! Test updates align with API changes.

The test correctly updates the prop name from subscriberType to for and the value from 'org' to 'organization', matching the component API changes. The error message assertion is also properly updated.


84-86: LGTM! Consistent test coverage for organization subscription.

The test properly validates that the component renders successfully when both userId and orgId are present, using the updated for='organization' prop.

packages/react/src/components/CheckoutButton.tsx (3)

52-52: LGTM! Proper prop destructuring with alias.

Using for: _for correctly avoids the reserved keyword for while maintaining clear intent.


65-67: LGTM! Conditional logic updated correctly.

The check now properly validates organization context when _for === 'organization', and the error message reflects the new API.


80-80: LGTM! API call updated correctly.

The clerk function call now receives the correct for parameter with the aliased value.

packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx (1)

118-118: LGTM! Context destructuring updated correctly.

The prop is now correctly destructured as for: _for to align with the API changes.

packages/react/src/components/SubscriptionDetailsButton.tsx (3)

49-49: LGTM! Prop destructuring updated correctly.

The destructuring now uses for: _for alias consistently with other components in this refactor.


59-63: LGTM! Organization validation updated correctly.

The conditional check and error message now properly reference the new 'organization' value and updated prop name.


71-71: LGTM! API call updated correctly.

The clerk function now receives the correct for parameter.

Copy link

pkg-pr-new bot commented Jul 29, 2025

Open in StackBlitz

@clerk/agent-toolkit

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

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/elements

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

@clerk/clerk-expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/clerk-react

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

@clerk/react-router

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

@clerk/remix

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/themes

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

@clerk/types

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

@clerk/upgrade

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

@clerk/vue

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

commit: 01fc05c

@panteliselef panteliselef merged commit 822ba1f into main Jul 29, 2025
59 of 60 checks passed
@panteliselef panteliselef deleted the elef/align-billing-apis branch July 29, 2025 15:39
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.

3 participants