Skip to content

Conversation

panteliselef
Copy link
Member

@panteliselef panteliselef commented Oct 13, 2025

Description

Replaces forOrganizations: true with for: "organization" in <PricingTable/>

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

    • PricingTable adds a new for option ('user' | 'organization') to explicitly target who plans apply to; defaults to 'user'.
  • Improvements

    • More consistent plan display and footer behavior depending on the selected target (user or organization).
  • Documentation

    • Examples and notes updated to use the new for option instead of the previous organization flag.

Copy link

changeset-bot bot commented Oct 13, 2025

🦋 Changeset detected

Latest commit: 2b745b9

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/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/localizations Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/clerk-react Patch
@clerk/remix Patch
@clerk/shared Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch
@clerk/themes Patch
@clerk/vue 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 Oct 13, 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 Oct 13, 2025 10:38am

Copy link
Contributor

coderabbitai bot commented Oct 13, 2025

Walkthrough

The PR replaces the PricingTable audience selector from a boolean forOrganizations to a string union for: 'user' | 'organization' across types, context, component calls, and footer-state logic; tests and a changeset were updated accordingly.

Changes

Cohort / File(s) Change Summary
Pricing footer state logic
packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.ts, packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.spec.ts
Replace forOrganizations?: boolean with for?: 'user' | 'organization'; rename destructured field and update conditionals and tests to use for: 'user' / 'organization'.
PricingTable component usage
packages/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx
Update Card to pass for: pricingTableProps.for into getPricingFooterState instead of forOrganizations.
UI context propagation
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
Derive SubscriberTypeContext from `(props as PricingTableProps).for
Public types
packages/types/src/clerk.ts
In PricingTableBaseProps, remove forOrganizations?: boolean; add for?: ForPayerType with updated JSDoc and default 'user'.
Repo metadata / Changeset
.changeset/weak-ways-agree.md
Add changeset marking minor bumps for @clerk/clerk-js and @clerk/types; update Billing Beta note to use for: "organization".

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant App
  participant PricingTable
  participant UIContext as ClerkUIComponentsContext
  participant FooterState as getPricingFooterState
  participant UI as PricingTable UI

  App->>PricingTable: render({ for: 'user'|'organization', ... })
  PricingTable->>UIContext: provide subscriberType = for || 'user'
  PricingTable->>FooterState: getPricingFooterState({ for, ... })
  alt for == 'organization'
    FooterState-->>PricingTable: footer state for organization
  else for == 'user'
    FooterState-->>PricingTable: footer state for user
  end
  PricingTable->>UI: render footer per returned state
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I swapped a bool for words that sing,
user or org — a clearer spring.
Tests hopped along, contexts align,
Footer knows which plans to sign.
A tiny change, a tidy cheer, 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title follows conventional commit style and succinctly captures the main change of switching from a boolean flag to using the for prop in the PricingTable component across both clerk-js and types, without including extraneous details.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ 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 elef/bill-1292-rename-fororganizations-to-follow-established-patterns

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

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 277a0f7 and 9d3b411.

📒 Files selected for processing (6)
  • .changeset/weak-ways-agree.md (1 hunks)
  • packages/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.spec.ts (1 hunks)
  • packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.ts (2 hunks)
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx (1 hunks)
  • packages/types/src/clerk.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (12)
.changeset/**

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

Automated releases must use Changesets.

Files:

  • .changeset/weak-ways-agree.md
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/PricingTable/PricingTableDefault.tsx
  • packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.spec.ts
  • packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.ts
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
**/*.{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/PricingTable/PricingTableDefault.tsx
  • packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.spec.ts
  • packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.ts
  • packages/types/src/clerk.ts
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.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/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx
  • packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.spec.ts
  • packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.ts
  • packages/types/src/clerk.ts
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
packages/**/*.{ts,tsx}

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

TypeScript is required for all packages

Files:

  • packages/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx
  • packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.spec.ts
  • packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.ts
  • packages/types/src/clerk.ts
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
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/PricingTable/PricingTableDefault.tsx
  • packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.spec.ts
  • packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.ts
  • packages/types/src/clerk.ts
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.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/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx
  • packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.spec.ts
  • packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.ts
  • packages/types/src/clerk.ts
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.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/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.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/PricingTable/PricingTableDefault.tsx
  • packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.spec.ts
  • packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.ts
  • packages/types/src/clerk.ts
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.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/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx
  • packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.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/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.spec.ts
packages/{clerk-js,elements,themes}/**/*.{test,spec}.{js,jsx,ts,tsx}

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

Visual regression testing should be performed for UI components.

Files:

  • packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.spec.ts
🧬 Code graph analysis (3)
packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.spec.ts (1)
packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.ts (1)
  • getPricingFooterState (53-58)
packages/types/src/clerk.ts (1)
packages/types/src/billing.ts (1)
  • ForPayerType (69-69)
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 (1852-1852)
⏰ 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: Build Packages
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (7)
packages/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx (1)

135-141: LGTM!

The call to getPricingFooterState correctly uses the new for property instead of the deprecated forOrganizations property, aligning with the broader refactoring across PricingTable components.

packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.ts (2)

3-9: LGTM!

The parameter type change from forOrganizations?: boolean to for?: 'user' | 'organization' makes the API more explicit and self-documenting.


15-27: LGTM!

The logic correctly handles the new explicit discriminator. When for is 'organization' and there's no active organization, the footer is hidden as expected. The default behavior (when for is undefined or 'user') shows the footer, which maintains backward compatibility.

packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx (1)

96-103: LGTM!

The context value derivation correctly uses the new for property with a default of 'user', replacing the previous boolean-to-string conversion logic. This aligns with the broader refactoring and maintains the correct default behavior.

packages/clerk-js/src/ui/components/PricingTable/utils/pricing-footer-state.spec.ts (2)

45-58: LGTM!

The test helper function correctly updated to accept and pass the new for?: 'user' | 'organization' parameter instead of forOrganizations?: boolean, aligning with the refactored API.


60-126: LGTM!

All test cases have been updated to use the new for property with explicit 'organization' or 'user' values. The test coverage remains comprehensive, validating the footer visibility logic for various subscription states and payer types.

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

1830-1836: LGTM—no residual forOrganizations code references. Search only returned changelog entries under packages/types and packages/clerk-js.

Copy link

pkg-pr-new bot commented Oct 13, 2025

Open in StackBlitz

@clerk/agent-toolkit

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

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/elements

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

@clerk/clerk-expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/clerk-react

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

@clerk/react-router

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

@clerk/remix

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/themes

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

@clerk/types

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

@clerk/upgrade

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

@clerk/vue

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

commit: 2b745b9

@panteliselef panteliselef merged commit dacc1af into main Oct 14, 2025
43 checks passed
@panteliselef panteliselef deleted the elef/bill-1292-rename-fororganizations-to-follow-established-patterns branch October 14, 2025 16:00
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