Skip to content

Conversation

@jacekradko
Copy link
Member

@jacekradko jacekradko commented Jan 27, 2026

Summary

  • Renames useBillingHookEnabled to useBillingIsEnabled
  • Updates semantics: calling without for param now returns true if either user or organization billing is enabled (previously defaulted to user billing only)

New API

// returns true if either user or org billing is enabled
useBillingIsEnabled()

// check specific billing type
useBillingIsEnabled({ for: 'user' })
useBillingIsEnabled({ for: 'organization' })

Test plan

  • Verify type checking passes
  • Manual testing with billing features

Summary by CodeRabbit

  • Refactor
    • Improved billing eligibility logic to distinguish organization vs. user contexts; internal API renamed with no change to user-facing behavior.
  • Chores
    • Added a changeset entry for the update.
  • Tests
    • Updated tests to cover scenarios where billing is disabled for user and/or organization.

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

Update semantics so calling without 'for' param returns true if either
user or organization billing is enabled, rather than defaulting to user.
@changeset-bot
Copy link

changeset-bot bot commented Jan 27, 2026

🦋 Changeset detected

Latest commit: bc50c7c

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

This PR includes changesets to release 20 packages
Name Type
@clerk/shared Major
@clerk/agent-toolkit Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/chrome-extension Patch
@clerk/clerk-js Patch
@clerk/expo-passkeys Patch
@clerk/expo Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/localizations Patch
@clerk/msw Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/react Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch
@clerk/ui 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

@vercel
Copy link

vercel bot commented Jan 27, 2026

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

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Jan 30, 2026 9:06pm

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 27, 2026

📝 Walkthrough

Walkthrough

The pull request renames the billing hook from useBillingHookEnabled to useBillingIsEnabled and refactors it to compute separate orgBillingEnabled and userBillingEnabled flags, then derive billingEnabled based on the for parameter (organization, user, or both when unspecified). Multiple files under packages/shared/src/react/ were updated to import and call the renamed hook. A new changeset file .changeset/fiery-carrots-call.md was added. No other public API signatures were changed.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change: renaming a billing hook and updating its semantics. It directly reflects the primary objective of the pull request.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/shared/src/react/hooks/useStatementQuery.tsx (1)

12-30: Align billing gate with default forType to avoid incorrect enablement.

Line 13 defaults forType to 'user', but Line 28 passes raw params into useBillingIsEnabled. With the new hook semantics, omitting for means “user OR org,” which can enable user-scoped statement queries when only org billing is enabled. This is a functional gating bug.

✅ Proposed fix
-  const billingEnabled = useBillingIsEnabled(params);
+  const billingEnabled = useBillingIsEnabled({ ...params, for: forType });

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 27, 2026

Open in StackBlitz

@clerk/agent-toolkit

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

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@7687

@clerk/upgrade

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

@clerk/vue

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

commit: bc50c7c

@jacekradko jacekradko changed the title refactor(shared): rename useBillingHookEnabled to useBillingIsEnabled refactor(shared): rename billing hook and update semantics Jan 27, 2026
@jacekradko
Copy link
Member Author

!allow-major

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants