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 billing status; user-facing behavior remains unchanged.
  • Chores
    • Added an internal changeset entry.
  • Tests
    • Updated tests to align with the new billing eligibility handling and validate behavior when billing is disabled.

✏️ 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: ff4f524

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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 Review Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Jan 29, 2026 4:02am

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 clearly and concisely summarizes the main changes: renaming the billing hook and updating its semantics to handle both user and organization billing.
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: ff4f524

@jacekradko jacekradko changed the title refactor(shared): rename useBillingHookEnabled to useBillingIsEnabled refactor(shared): rename billing hook and update semantics Jan 27, 2026
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.

3 participants