Skip to content

Conversation

panteliselef
Copy link
Member

@panteliselef panteliselef commented Sep 19, 2025

Description

🧹 cleaning up references to commerce

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
    • Rebranded commerce-related APIs to billing across the SDK: exports, hooks, and types now use Billing-prefixed names and billing equivalents; legacy commerce re-exports/aliases removed.
    • React hooks switched to the new paginated billing factory.
    • Utility exports moved to billing.
    • Internal billing totals check simplified without behavioral change.
  • Chores
    • Added placeholder changeset entry.

Copy link

changeset-bot bot commented Sep 19, 2025

🦋 Changeset detected

Latest commit: 6c5e6a4

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

Copy link

vercel bot commented Sep 19, 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 Sep 19, 2025 9:27am

Copy link
Contributor

coderabbitai bot commented Sep 19, 2025

Walkthrough

Systematically replaces Commerce-prefixed modules, types, and utilities with Billing equivalents across core, resources, utils, shared React hooks, and types packages. Adjusts re-exports and import sources, removes a type guard in utils in favor of an in-operator check, and adds a changeset metadata file. No new features introduced.

Changes

Cohort / File(s) Summary of changes
Changeset metadata
./.changeset/all-papers-call.md
Added placeholder changeset file; no code impact.
Core module wiring
packages/clerk-js/src/core/clerk.ts, packages/clerk-js/src/core/modules/billing/index.ts
Redirected Billing import to ./modules/billing; re-export source switched from ./CommerceBilling to ./namespace.
Resources import/source swap
packages/clerk-js/src/core/resources/BillingCheckout.ts, packages/clerk-js/src/core/resources/BillingPlan.ts, packages/clerk-js/src/core/resources/Organization.ts, packages/clerk-js/src/core/resources/User.ts
Updated imports from Commerce to Billing equivalents and from @/utils/commerce to @/utils/billing; no logic changes.
Resources API re-exports
packages/clerk-js/src/core/resources/internal.ts
Replaced Commerce* re-exports with Billing* re-exports; added export * from './Feature'; removed CommerceFeature.
Utils migration
packages/clerk-js/src/utils/billing.ts, packages/clerk-js/src/utils/index.ts
Removed hasPastDue type guard and inlined 'past_due' in data check; switched barrel export from ./commerce to ./billing.
React hooks factory rename
packages/shared/src/react/hooks/createBillingPaginatedHook.tsx
Renamed factory and config types from Commerce→Billing; removed backward-compat alias export.
React hooks using new factory
packages/shared/src/react/hooks/usePaymentAttempts.tsx, packages/shared/src/react/hooks/usePaymentMethods.tsx, packages/shared/src/react/hooks/usePlans.tsx, packages/shared/src/react/hooks/useStatements.tsx
Switched from createCommercePaginatedHook to createBillingPaginatedHook; hook configs and fetchers unchanged.
Types: import/export realignment
packages/types/src/index.ts, packages/types/src/clerk.ts, packages/types/src/json.ts, packages/types/src/organization.ts, packages/types/src/user.ts
Moved several type imports and re-exports from ./commerce to ./billing; added export * from './billing' and removed export * from './commerce'; no signature changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • aeliox
  • wobsoriano

Poem

A rabbit hops through code so spry,
Commerce signs swapped under Billing sky.
Hooks rebloom, types realign,
Past-due checks now small and fine.
Carrots counted, packages sigh 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly and concisely summarizes the primary change: renaming commerce files to billing within the clerk-js and types areas. It is a single, specific sentence that matches the file-level changes and updated exports/imports described in the PR summary.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch elef/bill-1249-js-paths

📜 Recent 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 9aa2f3c and 6c5e6a4.

📒 Files selected for processing (1)
  • packages/clerk-js/src/core/clerk.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/clerk-js/src/core/clerk.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: Build Packages
  • GitHub Check: semgrep/ci
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan

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

Copy link

pkg-pr-new bot commented Sep 19, 2025

Open in StackBlitz

@clerk/agent-toolkit

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

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/elements

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

@clerk/clerk-expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/clerk-react

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

@clerk/react-router

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

@clerk/remix

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/themes

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

@clerk/types

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

@clerk/upgrade

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

@clerk/vue

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

commit: 6c5e6a4

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

🧹 Nitpick comments (3)
.changeset/all-papers-call.md (1)

1-2: Changeset file is effectively empty.

This changeset contains only the required separator lines but no actual change description or version bump specification. A proper changeset should include:

  • Package names affected by the changes
  • Version bump type (patch, minor, major)
  • Description of the changes

Since this appears to be a systematic refactoring from Commerce to Billing across multiple packages, consider adding content like:

---
+"@clerk/clerk-js": minor
+"@clerk/types": minor
+"@clerk/shared": minor
---
+
+Rename commerce files and types to billing. This is part of rebranding the Commerce feature to Billing while maintaining backward compatibility.
packages/shared/src/react/hooks/createBillingPaginatedHook.tsx (1)

28-40: Update JSDoc comment to reflect the "billing" terminology.

The JSDoc comment still references "commerce-related resources" which is outdated after the migration to billing terminology.

Apply this diff to update the comment:

 /**
- * A hook factory that creates paginated data fetching hooks for commerce-related resources.
+ * A hook factory that creates paginated data fetching hooks for billing-related resources.
  * It provides a standardized way to create hooks that can fetch either user or organization resources
  * with built-in pagination support.
  *
  * The generated hooks handle:
  * - Clerk authentication context
  * - Resource-specific data fetching
  * - Pagination (both traditional and infinite scroll)
  * - Telemetry tracking
  * - Type safety for the specific resource.
  *
  * @internal
  */
packages/shared/src/react/hooks/usePaymentMethods.tsx (1)

11-11: Consider updating resourceType to reflect billing terminology.

The resourceType: 'commerce-payment-methods' still uses the old "commerce" prefix. For consistency with the billing migration, consider updating this to 'billing-payment-methods'.

Apply this diff if you want to maintain naming consistency:

 export const usePaymentMethods = createBillingPaginatedHook<BillingPaymentSourceResource, GetPaymentSourcesParams>({
   hookName: 'usePaymentMethods',
-  resourceType: 'commerce-payment-methods',
+  resourceType: 'billing-payment-methods',
   useFetcher: resource => {

Note: Only apply this change if the backend expects this new resourceType identifier.

📜 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 99922ec and 9aa2f3c.

📒 Files selected for processing (20)
  • .changeset/all-papers-call.md (1 hunks)
  • packages/clerk-js/src/core/clerk.ts (1 hunks)
  • packages/clerk-js/src/core/modules/billing/index.ts (1 hunks)
  • packages/clerk-js/src/core/resources/BillingCheckout.ts (1 hunks)
  • packages/clerk-js/src/core/resources/BillingPlan.ts (1 hunks)
  • packages/clerk-js/src/core/resources/Organization.ts (1 hunks)
  • packages/clerk-js/src/core/resources/User.ts (1 hunks)
  • packages/clerk-js/src/core/resources/internal.ts (1 hunks)
  • packages/clerk-js/src/utils/billing.ts (1 hunks)
  • packages/clerk-js/src/utils/index.ts (1 hunks)
  • packages/shared/src/react/hooks/createBillingPaginatedHook.tsx (2 hunks)
  • packages/shared/src/react/hooks/usePaymentAttempts.tsx (1 hunks)
  • packages/shared/src/react/hooks/usePaymentMethods.tsx (1 hunks)
  • packages/shared/src/react/hooks/usePlans.tsx (1 hunks)
  • packages/shared/src/react/hooks/useStatements.tsx (1 hunks)
  • packages/types/src/clerk.ts (1 hunks)
  • packages/types/src/index.ts (1 hunks)
  • packages/types/src/json.ts (1 hunks)
  • packages/types/src/organization.ts (1 hunks)
  • packages/types/src/user.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (11)
**/*.{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/types/src/index.ts
  • packages/clerk-js/src/core/resources/BillingCheckout.ts
  • packages/clerk-js/src/core/modules/billing/index.ts
  • packages/types/src/user.ts
  • packages/clerk-js/src/utils/index.ts
  • packages/clerk-js/src/core/resources/BillingPlan.ts
  • packages/types/src/json.ts
  • packages/clerk-js/src/core/clerk.ts
  • packages/clerk-js/src/core/resources/User.ts
  • packages/clerk-js/src/core/resources/Organization.ts
  • packages/types/src/clerk.ts
  • packages/shared/src/react/hooks/usePaymentMethods.tsx
  • packages/clerk-js/src/utils/billing.ts
  • packages/clerk-js/src/core/resources/internal.ts
  • packages/shared/src/react/hooks/useStatements.tsx
  • packages/shared/src/react/hooks/usePaymentAttempts.tsx
  • packages/shared/src/react/hooks/usePlans.tsx
  • packages/types/src/organization.ts
  • packages/shared/src/react/hooks/createBillingPaginatedHook.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/types/src/index.ts
  • packages/clerk-js/src/core/resources/BillingCheckout.ts
  • packages/clerk-js/src/core/modules/billing/index.ts
  • packages/types/src/user.ts
  • packages/clerk-js/src/utils/index.ts
  • packages/clerk-js/src/core/resources/BillingPlan.ts
  • packages/types/src/json.ts
  • packages/clerk-js/src/core/clerk.ts
  • packages/clerk-js/src/core/resources/User.ts
  • packages/clerk-js/src/core/resources/Organization.ts
  • packages/types/src/clerk.ts
  • packages/shared/src/react/hooks/usePaymentMethods.tsx
  • packages/clerk-js/src/utils/billing.ts
  • packages/clerk-js/src/core/resources/internal.ts
  • packages/shared/src/react/hooks/useStatements.tsx
  • packages/shared/src/react/hooks/usePaymentAttempts.tsx
  • packages/shared/src/react/hooks/usePlans.tsx
  • packages/types/src/organization.ts
  • packages/shared/src/react/hooks/createBillingPaginatedHook.tsx
packages/**/*.{ts,tsx}

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

TypeScript is required for all packages

Files:

  • packages/types/src/index.ts
  • packages/clerk-js/src/core/resources/BillingCheckout.ts
  • packages/clerk-js/src/core/modules/billing/index.ts
  • packages/types/src/user.ts
  • packages/clerk-js/src/utils/index.ts
  • packages/clerk-js/src/core/resources/BillingPlan.ts
  • packages/types/src/json.ts
  • packages/clerk-js/src/core/clerk.ts
  • packages/clerk-js/src/core/resources/User.ts
  • packages/clerk-js/src/core/resources/Organization.ts
  • packages/types/src/clerk.ts
  • packages/shared/src/react/hooks/usePaymentMethods.tsx
  • packages/clerk-js/src/utils/billing.ts
  • packages/clerk-js/src/core/resources/internal.ts
  • packages/shared/src/react/hooks/useStatements.tsx
  • packages/shared/src/react/hooks/usePaymentAttempts.tsx
  • packages/shared/src/react/hooks/usePlans.tsx
  • packages/types/src/organization.ts
  • packages/shared/src/react/hooks/createBillingPaginatedHook.tsx
packages/**/*.{ts,tsx,d.ts}

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

Packages should export TypeScript types alongside runtime code

Files:

  • packages/types/src/index.ts
  • packages/clerk-js/src/core/resources/BillingCheckout.ts
  • packages/clerk-js/src/core/modules/billing/index.ts
  • packages/types/src/user.ts
  • packages/clerk-js/src/utils/index.ts
  • packages/clerk-js/src/core/resources/BillingPlan.ts
  • packages/types/src/json.ts
  • packages/clerk-js/src/core/clerk.ts
  • packages/clerk-js/src/core/resources/User.ts
  • packages/clerk-js/src/core/resources/Organization.ts
  • packages/types/src/clerk.ts
  • packages/shared/src/react/hooks/usePaymentMethods.tsx
  • packages/clerk-js/src/utils/billing.ts
  • packages/clerk-js/src/core/resources/internal.ts
  • packages/shared/src/react/hooks/useStatements.tsx
  • packages/shared/src/react/hooks/usePaymentAttempts.tsx
  • packages/shared/src/react/hooks/usePlans.tsx
  • packages/types/src/organization.ts
  • packages/shared/src/react/hooks/createBillingPaginatedHook.tsx
packages/**/index.{js,ts}

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

Use tree-shaking friendly exports

Files:

  • packages/types/src/index.ts
  • packages/clerk-js/src/core/modules/billing/index.ts
  • packages/clerk-js/src/utils/index.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/types/src/index.ts
  • packages/clerk-js/src/core/resources/BillingCheckout.ts
  • packages/clerk-js/src/core/modules/billing/index.ts
  • packages/types/src/user.ts
  • packages/clerk-js/src/utils/index.ts
  • packages/clerk-js/src/core/resources/BillingPlan.ts
  • packages/types/src/json.ts
  • packages/clerk-js/src/core/clerk.ts
  • packages/clerk-js/src/core/resources/User.ts
  • packages/clerk-js/src/core/resources/Organization.ts
  • packages/types/src/clerk.ts
  • packages/shared/src/react/hooks/usePaymentMethods.tsx
  • packages/clerk-js/src/utils/billing.ts
  • packages/clerk-js/src/core/resources/internal.ts
  • packages/shared/src/react/hooks/useStatements.tsx
  • packages/shared/src/react/hooks/usePaymentAttempts.tsx
  • packages/shared/src/react/hooks/usePlans.tsx
  • packages/types/src/organization.ts
  • packages/shared/src/react/hooks/createBillingPaginatedHook.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/types/src/index.ts
  • packages/clerk-js/src/core/resources/BillingCheckout.ts
  • packages/clerk-js/src/core/modules/billing/index.ts
  • packages/types/src/user.ts
  • packages/clerk-js/src/utils/index.ts
  • packages/clerk-js/src/core/resources/BillingPlan.ts
  • packages/types/src/json.ts
  • packages/clerk-js/src/core/clerk.ts
  • packages/clerk-js/src/core/resources/User.ts
  • packages/clerk-js/src/core/resources/Organization.ts
  • packages/types/src/clerk.ts
  • packages/shared/src/react/hooks/usePaymentMethods.tsx
  • packages/clerk-js/src/utils/billing.ts
  • packages/clerk-js/src/core/resources/internal.ts
  • packages/shared/src/react/hooks/useStatements.tsx
  • packages/shared/src/react/hooks/usePaymentAttempts.tsx
  • packages/shared/src/react/hooks/usePlans.tsx
  • packages/types/src/organization.ts
  • packages/shared/src/react/hooks/createBillingPaginatedHook.tsx
**/index.ts

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

Use index.ts files for clean imports but avoid deep barrel exports

Avoid barrel files (index.ts re-exports) as they can cause circular dependencies

Files:

  • packages/types/src/index.ts
  • packages/clerk-js/src/core/modules/billing/index.ts
  • packages/clerk-js/src/utils/index.ts
.changeset/**

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

Automated releases must use Changesets.

Files:

  • .changeset/all-papers-call.md
**/*.{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/shared/src/react/hooks/usePaymentMethods.tsx
  • packages/shared/src/react/hooks/useStatements.tsx
  • packages/shared/src/react/hooks/usePaymentAttempts.tsx
  • packages/shared/src/react/hooks/usePlans.tsx
  • packages/shared/src/react/hooks/createBillingPaginatedHook.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/shared/src/react/hooks/usePaymentMethods.tsx
  • packages/shared/src/react/hooks/useStatements.tsx
  • packages/shared/src/react/hooks/usePaymentAttempts.tsx
  • packages/shared/src/react/hooks/usePlans.tsx
  • packages/shared/src/react/hooks/createBillingPaginatedHook.tsx
🧬 Code graph analysis (5)
packages/shared/src/react/hooks/usePaymentMethods.tsx (2)
packages/shared/src/react/hooks/createBillingPaginatedHook.tsx (1)
  • createBillingPaginatedHook (41-112)
packages/types/src/billing.ts (2)
  • BillingPaymentSourceResource (276-329)
  • GetPaymentSourcesParams (228-228)
packages/shared/src/react/hooks/useStatements.tsx (4)
packages/clerk-js/src/ui/contexts/components/Plans.tsx (1)
  • useStatements (52-61)
packages/shared/src/react/hooks/index.ts (1)
  • useStatements (11-11)
packages/shared/src/react/hooks/createBillingPaginatedHook.tsx (1)
  • createBillingPaginatedHook (41-112)
packages/types/src/billing.ts (2)
  • BillingStatementResource (430-451)
  • GetStatementsParams (415-415)
packages/shared/src/react/hooks/usePaymentAttempts.tsx (4)
packages/clerk-js/src/ui/contexts/components/Plans.tsx (1)
  • usePaymentAttempts (42-50)
packages/shared/src/react/hooks/index.ts (1)
  • usePaymentAttempts (12-12)
packages/shared/src/react/hooks/createBillingPaginatedHook.tsx (1)
  • createBillingPaginatedHook (41-112)
packages/types/src/billing.ts (2)
  • BillingPaymentResource (368-405)
  • GetPaymentAttemptsParams (410-410)
packages/shared/src/react/hooks/usePlans.tsx (4)
packages/clerk-js/src/ui/contexts/components/Plans.tsx (1)
  • usePlans (80-90)
packages/shared/src/react/hooks/index.ts (1)
  • usePlans (14-14)
packages/shared/src/react/hooks/createBillingPaginatedHook.tsx (1)
  • createBillingPaginatedHook (41-112)
packages/types/src/billing.ts (2)
  • BillingPlanResource (122-189)
  • GetPlansParams (110-115)
packages/shared/src/react/hooks/createBillingPaginatedHook.tsx (3)
packages/types/src/resource.ts (1)
  • ClerkResource (8-21)
packages/shared/src/react/types.ts (2)
  • PagesOrInfiniteOptions (133-156)
  • PaginatedHookConfig (90-103)
packages/types/src/billing.ts (1)
  • ForPayerType (69-69)
⏰ 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). (26)
  • GitHub Check: pr-title-lint
  • GitHub Check: Integration Tests (custom, chrome)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (nextjs, chrome, 14)
  • GitHub Check: Integration Tests (elements, chrome)
  • GitHub Check: Integration Tests (machine, chrome)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (tanstack-react-router, chrome)
  • GitHub Check: Integration Tests (expo-web, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome)
  • GitHub Check: Publish with pkg-pr-new
  • GitHub Check: Static analysis
  • GitHub Check: Unit Tests (18, --filter=@clerk/astro --filter=@clerk/backend --filter=@clerk/express --filter=@c...
  • GitHub Check: Unit Tests (22, **)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (22)
packages/types/src/json.ts (1)

14-14: LGTM! Import source updated correctly.

The billing-related types are now properly imported from the ./billing module, aligning with the broader migration from commerce to billing terminology.

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

2-2: LGTM! Import source migrated to billing module.

The BillingPaymentSourceMethods import has been correctly updated to reference the new billing module location while maintaining the same interface contract.

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

30-31: LGTM! Billing imports migrated correctly.

The import reorganization properly moves all billing-related types from ./commerce to ./billing while maintaining clean separation between billing imports and other imports. The ClientResource import positioning is also appropriate.

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

1-1: LGTM! Import source updated to billing module.

The BillingPaymentSourceMethods import has been correctly migrated from ./commerce to ./billing, aligning with the broader refactoring while preserving the interface contract.

packages/clerk-js/src/utils/billing.ts (1)

34-36: LGTM! Type guard replaced with inline property check.

The replacement of the hasPastDue type guard with a direct in operator check is appropriate and simpler. This change maintains the same runtime behavior while reducing code complexity by inlining the property existence check.

packages/clerk-js/src/utils/index.ts (1)

3-3: LGTM! Utils export switched to billing module.

The export statement correctly references the new ./billing module, completing the migration from commerce to billing terminology in the utilities layer.

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

9-9: LGTM — billing exported; no './commerce' export remains. export * from './billing' is present in packages/types/src/index.ts; there is no export * from './commerce' (only export * from './commerceSettings' remains) and no other './commerce' exports were found in packages/types/src.

packages/shared/src/react/hooks/createBillingPaginatedHook.tsx (3)

16-25: LGTM! The type rename is consistent with the broader migration.

The BillingHookConfig type correctly replaces the previous CommerceHookConfig and maintains the same generic structure and properties.


41-46: LGTM! Function and internal hook naming is consistent.

Both createBillingPaginatedHook and useBillingHook follow the established billing nomenclature correctly.

Also applies to: 51-51


87-89: Verify commerceSettings path still exists after billing migration

packages/shared/src/react/hooks/createBillingPaginatedHook.tsx (≈lines 87–89) references environment?.commerceSettings.billing.{organization|user}.enabled. Automated search returned no matches and rg reported "unrecognized file type: tsx" — unable to confirm the config shape. Verify the billing settings path still exists or update usage; run locally:

rg -n --hidden "commerceSettings|billing\.organization\.enabled|billing\.user\.enabled|environment.*billing.*enabled" -g '!node_modules'
packages/shared/src/react/hooks/usePlans.tsx (1)

4-4: LGTM! Import and hook factory usage correctly updated.

The change from importing a re-export alias to directly importing createBillingPaginatedHook is correct and maintains the same functionality.

Also applies to: 9-9

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

4-4: LGTM! Consistent migration to billing hook factory.

The import and usage changes align with the broader billing migration and maintain functional consistency.

Also applies to: 9-9

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

4-4: LGTM! Payment methods hook correctly migrated.

The change is consistent with other hook migrations in this PR.

Also applies to: 9-9

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

4-4: LGTM! Statements hook correctly migrated.

The import and usage changes are consistent with the billing migration.

Also applies to: 9-9

packages/clerk-js/src/core/resources/BillingCheckout.ts (2)

14-14: LGTM! Import updated correctly for billing migration.

The change from ./CommercePayer to ./BillingPayer is consistent with the file renaming pattern.


64-65: Do not rename endpoints — /commerce/ is the intended billing path

CHANGELOG and multiple billing modules use /commerce/ (e.g. packages/clerk-js/CHANGELOG.md; packages/clerk-js/src/core/resources/BillingCheckout.ts:64-65), so the original suggestion to switch to /billing/ is incorrect.

Likely an incorrect or invalid review comment.

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

151-151: LGTM! Import path correctly updated for billing module.

The import change from ./modules/commerce to ./modules/billing is consistent with the module restructuring.

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

31-31: LGTM! Import path updated correctly for billing helpers.

The import change from ../modules/commerce to ../modules/billing aligns with the module reorganization.

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

39-39: Import path updated correctly from commerce to billing module.

The change updates the import source from ../modules/commerce to ../modules/billing, which aligns with the PR's objective to rename commerce-related files to billing. The imported functions addPaymentSource, getPaymentSources, and initializePaymentSource remain unchanged, maintaining backward compatibility at the function level.

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

3-3: Import path updated correctly from commerce to billing utilities.

The change updates the import source from @/utils/commerce to @/utils/billing, which aligns with the broader migration from Commerce to Billing terminology. The imported function billingMoneyAmountFromJSON remains functionally unchanged.

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

7-13: Verified — Billing exports present; no Commerce references remain

All Billing resource files and Feature.ts exist in packages/clerk-js/src/core/resources, and no Commerce imports or references were detected in packages/clerk-js/src/.

packages/clerk-js/src/core/modules/billing/index.ts (1)

1-1: Approve — namespace module present and exports expected Billing API

packages/clerk-js/src/core/modules/billing/namespace.ts exports class Billing implements BillingNamespace with methods getPlans, getPlan, getSubscription, getStatements, getStatement, getPaymentAttempts, getPaymentAttempt, and startCheckout; no remaining references to CommerceBilling were found.

@panteliselef panteliselef merged commit ef501a7 into main Sep 19, 2025
40 checks passed
@panteliselef panteliselef deleted the elef/bill-1249-js-paths branch September 19, 2025 14:12
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