Skip to content

Conversation

panteliselef
Copy link
Member

@panteliselef panteliselef commented Oct 10, 2025

Description

This PR introduces breaking changes to localization keys that relate to billing, previously known as commerce. It also renames payment sources to payment methods.

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

    • Unified Billing: UI now uses “payment methods” (replacing “payment sources”) across checkout, payment methods, pricing, subscriptions, and statements.
  • Localization

    • Migrated keys from commerce.* to billing.* and updated translations across many locales; added new billing labels and messages.
  • Chores

    • Minor version bumps for Clerk packages.
  • Tests

    • Updated test descriptions and assertions to match new wording.

Copy link

changeset-bot bot commented Oct 10, 2025

🦋 Changeset detected

Latest commit: 32eaab3

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

This PR includes changesets to release 22 packages
Name Type
@clerk/localizations Minor
@clerk/clerk-js Minor
@clerk/types Minor
@clerk/clerk-react Patch
@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/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

@panteliselef panteliselef self-assigned this Oct 10, 2025
Copy link

vercel bot commented Oct 10, 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 10, 2025 9:09pm

@panteliselef panteliselef requested a review from a team October 10, 2025 18:56
Copy link
Contributor

coderabbitai bot commented Oct 10, 2025

Walkthrough

Renames payment "source(s)" to "method(s)" across types, exports, UI components, tests, and all localization files; moves localization namespace from commerce.* to billing.*; re-exports BillingPaymentMethod instead of BillingPaymentSource; bumps minor versions for related packages.

Changes

Cohort / File(s) Summary of changes
Dependency & changeset
\.changeset/sad-bikes-tan.md
Changeset updated for minor bumps and Billing Beta note: payment sources → payment methods; commerce.*billing.*.
Tests
integration/tests/pricing-table.test.ts, packages/clerk-js/src/ui/components/Checkout/__tests__/Checkout.test.tsx
Test descriptions updated to use "payment method"; Checkout tests switched to role-based heading queries (getByRole) instead of data-localization-key selectors.
Core export surface
packages/clerk-js/src/core/resources/internal.ts
Re-export changed: removed BillingPaymentSource export and now re-exports BillingPaymentMethod.
UI — Checkout
packages/clerk-js/src/ui/components/Checkout/* (CheckoutComplete.tsx, CheckoutForm.tsx, index.tsx, parts.tsx)
Localization keys migrated from commerce.*billing.* for checkout texts; no control-flow changes.
UI — Payment Methods
packages/clerk-js/src/ui/components/PaymentMethods/* (AddPaymentMethod.tsx, PaymentMethods.tsx, TestPaymentMethod.tsx)
Localization keys and placeholders renamed: paymentSource(s)paymentMethod(s) and paymentSourcesSectionpaymentMethodsSection; templates updated to reference paymentMethod.
UI — Pricing / Plans / Matrix
packages/clerk-js/src/ui/components/PricingTable/*, packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx, packages/clerk-js/src/ui/contexts/components/Plans.tsx
Localization keys switched from commerce.*billing.* (month/year labels, billedAnnually, seeAllFeatures, trial/subscribe text). One comment updated; behavior unchanged.
UI — Subscriptions / SubscriptionDetails
packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx, packages/clerk-js/src/ui/components/Subscriptions/SubscriptionsList.tsx
Keys moved to billing.* for titles, detail rows, and period labels; internal SubscriptionCard component introduced/used; logic unchanged.
UI — Statements & Payment Attempts
packages/clerk-js/src/ui/components/Statements/StatementPage.tsx, packages/clerk-js/src/ui/components/PaymentAttempts/PaymentAttemptPage.tsx
Localization keys updated commerce.*billing.* (subtotal, credit, totalDue, viewPayment). No control-flow changes.
Types & localization schema
packages/types/src/billing.ts, packages/types/src/localization.ts
Docstrings updated to "payment method"; internal localization type renamed: commercebilling; added addPaymentMethod__label, paymentMethods__label, paymentMethod object; paymentSourcesSectionpaymentMethodsSection; removeResourceremoveMethod; template types updated.
Localization resources (many locales)
packages/localizations/src/* (ar-SA, be-BY, bg-BG, bn-IN, ca-ES, cs-CZ, da-DK, de-DE, el-GR, en-GB, en-US, es-CR, es-ES, es-MX, es-UY, fa-IR, fi-FI, fr-FR, he-IL, hi-IN, hr-HR, hu-HU, id-ID, is-IS, it-IT, ja-JP, kk-KZ, ko-KR, mn-MN, ms-MY, nb-NO, nl-BE, nl-NL, pl-PL, pt-BR, pt-PT, ro-RO, ru-RU, sk-SK, sr-RS, sv-SE, ta-IN, te-IN, th-TH, tr-TR, uk-UA, vi-VN, zh-CN, zh-TW)
Namespace rename commercebilling. Key renames/shape changes: addPaymentMethodaddPaymentMethod__label, paymentMethodspaymentMethods__label, paymentSourcepaymentMethod, paymentSourcesSectionpaymentMethodsSection, removeResourceremoveMethod; templates updated to use {{paymentMethod}}. Content strings preserved.
Minor/comment-only
packages/clerk-js/src/ui/components/PricingTable/PricingTable.tsx
Comment updated from "Pre-fetch payment sources" → "Pre-fetch payment methods"; behavior unchanged.

Sequence Diagram(s)

No sequence diagram — changes are key/localization renames and a re-export; control flow unchanged.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

I hop through keys from commerce to billing,
I swap "source" for "method" with nimble willing.
Strings now point where payments are found,
No logic broken, just labels unbound.
Thump-thump! — a rabbit's tidy refactor sound. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The title is confusing and contains a redundancy (“method methods”) which obscures the primary change of renaming payment sources to payment methods, so it does not clearly and concisely summarize the main change. Rename the title to clearly state “Rename payment sources to payment methods” (for example: “chore(types, localizations): Rename payment sources to payment methods”).
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ 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-1264-rename-sources-methods-localization

📜 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 04dddd9 and 32eaab3.

📒 Files selected for processing (4)
  • packages/localizations/src/bn-IN.ts (6 hunks)
  • packages/localizations/src/cs-CZ.ts (6 hunks)
  • packages/localizations/src/it-IT.ts (6 hunks)
  • packages/localizations/src/kk-KZ.ts (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/localizations/src/kk-KZ.ts
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{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/localizations/src/cs-CZ.ts
  • packages/localizations/src/it-IT.ts
  • packages/localizations/src/bn-IN.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/localizations/src/cs-CZ.ts
  • packages/localizations/src/it-IT.ts
  • packages/localizations/src/bn-IN.ts
packages/**/*.{ts,tsx}

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

TypeScript is required for all packages

Files:

  • packages/localizations/src/cs-CZ.ts
  • packages/localizations/src/it-IT.ts
  • packages/localizations/src/bn-IN.ts
packages/**/*.{ts,tsx,d.ts}

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

Packages should export TypeScript types alongside runtime code

Files:

  • packages/localizations/src/cs-CZ.ts
  • packages/localizations/src/it-IT.ts
  • packages/localizations/src/bn-IN.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/localizations/src/cs-CZ.ts
  • packages/localizations/src/it-IT.ts
  • packages/localizations/src/bn-IN.ts
packages/localizations/**/*

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

Localization files must be placed in 'packages/localizations/'.

Files:

  • packages/localizations/src/cs-CZ.ts
  • packages/localizations/src/it-IT.ts
  • packages/localizations/src/bn-IN.ts
**/*.{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/localizations/src/cs-CZ.ts
  • packages/localizations/src/it-IT.ts
  • packages/localizations/src/bn-IN.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). (4)
  • GitHub Check: Build Packages
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (4)
packages/localizations/src/cs-CZ.ts (1)

72-142: LGTM! Billing namespace and payment method labels correctly implemented.

The introduction of the billing namespace and the new payment method localization keys (addPaymentMethod__label, paymentMethods__label, and the paymentMethod object) aligns with the PR objectives. The Czech translations are grammatically correct and appropriate for the context.

packages/localizations/src/it-IT.ts (3)

72-181: LGTM! Well-structured billing localization.

The billing namespace is correctly structured with all the payment method-related keys properly translated to Italian. The translations are grammatically correct and consistent with the rest of the file.


975-992: Good consistency between organizationProfile and userProfile sections.

The userProfile.billingPage.paymentMethodsSection maintains the same structure and terminology as the organizationProfile.billingPage.paymentMethodsSection, which ensures a consistent user experience. The Italian translations are accurate.


293-310: Legacy payment localization keys fully replaced — no references to commerce.paymentSources, paymentSourcesSection, or removeResource in billing/payment contexts remain.


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

@panteliselef panteliselef changed the title chore(types,localization): Rename payment sources to method methods chore(types, localizations): Rename payment sources to method methods Oct 10, 2025
Copy link

pkg-pr-new bot commented Oct 10, 2025

Open in StackBlitz

@clerk/agent-toolkit

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

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/elements

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

@clerk/clerk-expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/clerk-react

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

@clerk/react-router

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

@clerk/remix

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/themes

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

@clerk/types

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

@clerk/upgrade

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

@clerk/vue

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

commit: 32eaab3

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

Caution

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

⚠️ Outside diff range comments (25)
packages/localizations/src/kk-KZ.ts (1)

295-299: Rename the leftover {{paymentSource}} placeholder.

removeMethod.successMessage still interpolates {{paymentSource}}, so the UI will either show an empty value or a stale token after the rename. Update it to {{paymentMethod}} to stay aligned with the new terminology.

-          successMessage: '{{paymentSource}} жойылды.',
+          successMessage: '{{paymentMethod}} жойылды.',
packages/localizations/src/it-IT.ts (1)

302-308: Fix variable name inconsistency in success message.

Line 306 uses {{paymentSource}} instead of {{paymentMethod}}, which is inconsistent with the PR's objective to rename payment sources to payment methods. The userProfile section (line 988) correctly uses {{paymentMethod}}.

Apply this diff:

         removeMethod: {
           messageLine1: '{{identifier}} verrà rimosso da questo account.',
           messageLine2:
             'Non potrai più utilizzare questo metodo di pagamento e gli abbonamenti ricorrenti che dipendono da esso non funzioneranno più.',
-          successMessage: '{{paymentSource}} è stato rimosso dal tuo account.',
+          successMessage: '{{paymentMethod}} è stato rimosso dal tuo account.',
           title: 'Rimuovi metodo di pagamento',
         },
packages/localizations/src/ta-IN.ts (2)

287-303: Update Tamil strings to reflect “payment method” terminology.

These entries still reference “கட்டண மூலத்தை” (“payment source”), undermining the rename to “payment method”. Please refresh the wording accordingly.

       paymentMethodsSection: {
         actionLabel__default: 'இயல்புநிலையாக்கு',
         actionLabel__remove: 'நீக்கு',
-        add: 'புதிய கட்டண மூலத்தைச் சேர்க்கவும்',
-        addSubtitle: 'உங்கள் கணக்கில் புதிய கட்டண மூலத்தைச் சேர்க்கவும்.',
+        add: 'புதிய கட்டண முறையைச் சேர்க்கவும்',
+        addSubtitle: 'உங்கள் கணக்கில் புதிய கட்டண முறையைச் சேர்க்கவும்.',
         cancelButton: 'ரத்து செய்',
         formButtonPrimary__add: 'கட்டண முறையைச் சேர்',
         formButtonPrimary__pay: '{{amount}} செலுத்து',
         payWithTestCardButton: undefined,
         removeMethod: {
           messageLine1: '{{identifier}} இந்த கணக்கிலிருந்து நீக்கப்படும்.',
           messageLine2:
-            'இந்த கட்டண மூலத்தை இனி பயன்படுத்த முடியாது மற்றும் அதைச் சார்ந்த எந்த தொடர் சந்தாக்களும் இனி செயல்படாது.',
+            'இந்த கட்டண முறையை இனி பயன்படுத்த முடியாது மற்றும் அதைச் சார்ந்த எந்த தொடர் சந்தாக்களும் இனி செயல்படாது.',
           successMessage: '{{paymentMethod}} உங்கள் கணக்கிலிருந்து நீக்கப்பட்டது.',
-          title: 'கட்டண மூலத்தை நீக்கு',
+          title: 'கட்டண முறையை நீக்கு',
         },
         title: 'கிடைக்கும் விருப்பங்கள்',
       },

983-999: Align user profile billing strings with the new terminology.

The user-profile billing section still says “கட்டண மூலத்தை”. Please update these to “கட்டண முறையை” so the UI matches the renamed keys.

       paymentMethodsSection: {
         actionLabel__default: 'இயல்புநிலையாக்கு',
         actionLabel__remove: 'நீக்கு',
-        add: 'புதிய கட்டண மூலத்தைச் சேர்க்கவும்',
-        addSubtitle: 'உங்கள் கணக்கில் புதிய கட்டண மூலத்தைச் சேர்க்கவும்.',
+        add: 'புதிய கட்டண முறையைச் சேர்க்கவும்',
+        addSubtitle: 'உங்கள் கணக்கில் புதிய கட்டண முறையைச் சேர்க்கவும்.',
         cancelButton: 'ரத்து செய்',
         formButtonPrimary__add: 'கட்டண முறையைச் சேர்',
         formButtonPrimary__pay: '{{amount}} செலுத்து',
         payWithTestCardButton: undefined,
         removeMethod: {
           messageLine1: '{{identifier}} இந்த கணக்கிலிருந்து நீக்கப்படும்.',
           messageLine2:
-            'இந்த கட்டண மூலத்தை இனி பயன்படுத்த முடியாது மற்றும் அதைச் சார்ந்த எந்த தொடர் சந்தாக்களும் இனி செயல்படாது.',
+            'இந்த கட்டண முறையை இனி பயன்படுத்த முடியாது மற்றும் அதைச் சார்ந்த எந்த தொடர் சந்தாக்களும் இனி செயல்படாது.',
           successMessage: '{{paymentMethod}} உங்கள் கணக்கிலிருந்து நீக்கப்பட்டது.',
-          title: 'கட்டண மூலத்தை நீக்கு',
+          title: 'கட்டண முறையை நீக்கு',
         },
         title: 'கிடைக்கும் விருப்பங்கள்',
       },
packages/localizations/src/vi-VN.ts (2)

290-307: Update Vietnamese translation to match the terminology change.

The key has been correctly renamed from paymentSourcesSection to paymentMethodsSection and the interpolation variable in line 303 correctly uses {{paymentMethod}}. However, line 302 still contains the Vietnamese text "nguồn thanh toán" (payment source) which is inconsistent with the rename initiative. For consistency with the new "payment method" terminology used throughout the rest of the file (e.g., lines 73, 128, 293, 296, 304, 306), this should be updated to "phương thức thanh toán" (payment method).

Apply this diff to update the Vietnamese translation:

         messageLine1: '{{identifier}} sẽ bị xóa khỏi tài khoản này.',
         messageLine2:
-          'Bạn sẽ không còn thể sử dụng nguồn thanh toán này và bất kỳ đăng ký lặp lại nào phụ thuộc vào nó sẽ không còn hoạt động.',
+          'Bạn sẽ không còn thể sử dụng phương thức thanh toán này và bất kỳ đăng ký lặp lại nào phụ thuộc vào nó sẽ không còn hoạt động.',
         successMessage: '{{paymentMethod}} đã bị xóa khỏi tài khoản của bạn.',

973-990: Update Vietnamese translation to match the terminology change.

Similar to the organizationProfile section, line 985 still contains "nguồn thanh toán" (payment source) in the Vietnamese text, which is inconsistent with the rename from "payment source" to "payment method". This should be updated to "phương thức thanh toán" to maintain consistency.

Apply this diff to update the Vietnamese translation:

         messageLine1: '{{identifier}} sẽ bị xóa khỏi tài khoản này.',
         messageLine2:
-          'Bạn sẽ không còn thể sử dụng nguồn thanh toán này và bất kỳ đăng ký lặp lại nào phụ thuộc vào nó sẽ không còn hoạt động.',
+          'Bạn sẽ không còn thể sử dụng phương thức thanh toán này và bất kỳ đăng ký lặp lại nào phụ thuộc vào nó sẽ không còn hoạt động.',
         successMessage: '{{paymentMethod}} đã bị xóa khỏi tài khoản của bạn.',
packages/localizations/src/bn-IN.ts (2)

289-290: Bengali translations need updating to match new terminology.

The Bengali translations still reference "পেমেন্ট উৎস" (payment source) instead of "পেমেন্ট পদ্ধতি" (payment method), which is inconsistent with the structural changes renaming "sources" to "methods".

Apply this diff to update the translations:

-        add: 'নতুন পেমেন্ট উৎস যোগ করুন',
-        addSubtitle: 'আপনার অ্যাকাউন্টে একটি নতুন পেমেন্ট উৎস যোগ করুন।',
+        add: 'নতুন পেমেন্ট পদ্ধতি যোগ করুন',
+        addSubtitle: 'আপনার অ্যাকাউন্টে একটি নতুন পেমেন্ট পদ্ধতি যোগ করুন।',

295-301: Bengali translations need updating to match new terminology.

The Bengali translations in the removeMethod section still reference "পেমেন্ট উৎস" (payment source) instead of "পেমেন্ট পদ্ধতি" (payment method).

Apply this diff to update the translations:

         removeMethod: {
           messageLine1: '{{identifier}} এই অ্যাকাউন্ট থেকে সরানো হবে।',
           messageLine2:
-            'আপনি আর এই পেমেন্ট উৎস ব্যবহার করতে পারবেন না এবং এর উপর নির্ভরশীল যেকোনো আবর্তক সাবস্ক্রিপশন আর কাজ করবে না।',
+            'আপনি আর এই পেমেন্ট পদ্ধতি ব্যবহার করতে পারবেন না এবং এর উপর নির্ভরশীল যেকোনো আবর্তক সাবস্ক্রিপশন আর কাজ করবে না।',
           successMessage: '{{paymentSource}} আপনার অ্যাকাউন্ট থেকে সরানো হয়েছে।',
-          title: 'পেমেন্ট উৎস সরান',
+          title: 'পেমেন্ট পদ্ধতি সরান',
         },

Note: Line 299 uses the interpolation variable {{paymentSource}} which might need updating in the calling code to use {{paymentMethod}} instead, but that's outside the scope of this localization file.

packages/localizations/src/ms-MY.ts (2)

286-303: Update Malay translations to match the new "payment method" terminology.

The structural changes from paymentSourcesSection to paymentMethodsSection and removeResource to removeMethod are correct. However, the Malay translations still reference the old terminology "sumber pembayaran" (payment source) instead of "kaedah pembayaran" (payment method).

Apply this diff to update the translations:

       paymentMethodsSection: {
         actionLabel__default: 'Jadikan lalai',
         actionLabel__remove: 'Keluarkan',
-        add: 'Tambah sumber pembayaran baharu',
-        addSubtitle: 'Tambah sumber pembayaran baharu ke akaun anda.',
+        add: 'Tambah kaedah pembayaran baharu',
+        addSubtitle: 'Tambah kaedah pembayaran baharu ke akaun anda.',
         cancelButton: 'Batal',
         formButtonPrimary__add: 'Tambah Kaedah Pembayaran',
         formButtonPrimary__pay: 'Bayar {{amount}}',
         payWithTestCardButton: undefined,
         removeMethod: {
           messageLine1: '{{identifier}} akan dikeluarkan dari akaun ini.',
           messageLine2:
-            'Anda tidak akan dapat menggunakan sumber pembayaran ini lagi dan langganan berulang yang bergantung padanya tidak akan berfungsi lagi.',
+            'Anda tidak akan dapat menggunakan kaedah pembayaran ini lagi dan langganan berulang yang bergantung padanya tidak akan berfungsi lagi.',
           successMessage: '{{paymentMethod}} telah dikeluarkan dari akaun anda.',
-          title: 'Keluarkan sumber pembayaran',
+          title: 'Keluarkan kaedah pembayaran',
         },
         title: 'Pilihan tersedia',
       },

981-998: Update Malay translations in userProfile to match the new "payment method" terminology.

Similar to the organizationProfile section, the userProfile billingPage translations still use "sumber pembayaran" (payment source) instead of "kaedah pembayaran" (payment method).

Apply this diff to update the translations:

       paymentMethodsSection: {
         actionLabel__default: 'Jadikan lalai',
         actionLabel__remove: 'Keluarkan',
-        add: 'Tambah sumber pembayaran baharu',
-        addSubtitle: 'Tambah sumber pembayaran baharu ke akaun anda.',
+        add: 'Tambah kaedah pembayaran baharu',
+        addSubtitle: 'Tambah kaedah pembayaran baharu ke akaun anda.',
         cancelButton: 'Batal',
         formButtonPrimary__add: 'Tambah Kaedah Pembayaran',
         formButtonPrimary__pay: 'Bayar {{amount}}',
         payWithTestCardButton: undefined,
         removeMethod: {
           messageLine1: '{{identifier}} akan dikeluarkan dari akaun ini.',
           messageLine2:
-            'Anda tidak akan dapat menggunakan sumber pembayaran ini lagi dan langganan berulang yang bergantung padanya tidak akan berfungsi lagi.',
+            'Anda tidak akan dapat menggunakan kaedah pembayaran ini lagi dan langganan berulang yang bergantung padanya tidak akan berfungsi lagi.',
           successMessage: '{{paymentMethod}} telah dikeluarkan dari akaun anda.',
-          title: 'Keluarkan sumber pembayaran',
+          title: 'Keluarkan kaedah pembayaran',
         },
         title: 'Pilihan tersedia',
       },
packages/localizations/src/te-IN.ts (2)

285-302: Telugu translations still use "payment source" terminology.

While the key names have been correctly renamed from paymentSourcesSection to paymentMethodsSection and from removeResource to removeMethod, the actual Telugu translations still reference "చెల్లింపు మూలాన్ని" (payment source) on lines 288, 289, 297, and 299.

Update these translations to use "చెల్లింపు పద్ధతి" (payment method) for consistency with the renamed keys.

Apply this diff to update the Telugu translations:

-        add: 'కొత్త చెల్లింపు మూలాన్ని జోడించండి',
-        addSubtitle: 'మీ ఖాతాకు కొత్త చెల్లింపు మూలాన్ని జోడించండి.',
+        add: 'కొత్త చెల్లింపు పద్ధతిని జోడించండి',
+        addSubtitle: 'మీ ఖాతాకు కొత్త చెల్లింపు పద్ధతిని జోడించండి.',
         cancelButton: 'రద్దు చేయండి',
         formButtonPrimary__add: 'చెల్లింపు పద్ధతిని జోడించండి',
         formButtonPrimary__pay: '{{amount}} చెల్లించండి',
         payWithTestCardButton: undefined,
         removeMethod: {
           messageLine1: '{{identifier}} ఈ ఖాతా నుండి తొలగించబడుతుంది.',
           messageLine2:
-            'మీరు ఇకపై ఈ చెల్లింపు మూలాన్ని ఉపయోగించలేరు మరియు దానిపై ఆధారపడిన పునరావృత సబ్‌స్క్రిప్షన్‌లు ఇకపై పనిచేయవు.',
+            'మీరు ఇకపై ఈ చెల్లింపు పద్ధతిని ఉపయోగించలేరు మరియు దానిపై ఆధారపడిన పునరావృత సబ్‌స్క్రిప్షన్‌లు ఇకపై పనిచేయవు.',
           successMessage: '{{paymentMethod}} మీ ఖాతా నుండి తొలగించబడింది.',
-          title: 'చెల్లింపు మూలాన్ని తొలగించండి',
+          title: 'చెల్లింపు పద్ధతిని తొలగించండి',
         },

978-995: Telugu translations still use "payment source" terminology (userProfile section).

Similar to the organizationProfile.billingPage section, the userProfile.billingPage.paymentMethodsSection has the same inconsistency. The Telugu translations on lines 981, 982, 990, and 992 still reference "చెల్లింపు మూలాన్ని" (payment source) instead of "చెల్లింపు పద్ధతి" (payment method).

Apply this diff to update the Telugu translations:

-        add: 'కొత్త చెల్లింపు మూలాన్ని జోడించండి',
-        addSubtitle: 'మీ ఖాతాకు కొత్త చెల్లింపు మూలాన్ని జోడించండి.',
+        add: 'కొత్త చెల్లింపు పద్ధతిని జోడించండి',
+        addSubtitle: 'మీ ఖాతాకు కొత్త చెల్లింపు పద్ధతిని జోడించండి.',
         cancelButton: 'రద్దు చేయండి',
         formButtonPrimary__add: 'చెల్లింపు పద్ధతిని జోడించండి',
         formButtonPrimary__pay: '{{amount}} చెల్లించండి',
         payWithTestCardButton: undefined,
         removeMethod: {
           messageLine1: '{{identifier}} ఈ ఖాతా నుండి తొలగించబడుతుంది.',
           messageLine2:
-            'మీరు ఇకపై ఈ చెల్లింపు మూలాన్ని ఉపయోగించలేరు మరియు దానిపై ఆధారపడిన పునరావృత సబ్‌స్క్రిప్షన్‌లు ఇకపై పనిచేయవు.',
+            'మీరు ఇకపై ఈ చెల్లింపు పద్ధతిని ఉపయోగించలేరు మరియు దానిపై ఆధారపడిన పునరావృత సబ్‌స్క్రిప్షన్‌లు ఇకపై పనిచేయవు.',
           successMessage: '{{paymentMethod}} మీ ఖాతా నుండి తొలగించబడింది.',
-          title: 'చెల్లింపు మూలాన్ని తొలగించండి',
+          title: 'చెల్లింపు పద్ధతిని తొలగించండి',
         },
packages/localizations/src/sr-RS.ts (1)

71-982: Ensure all locale files use the new paymentMethod keys
Old paymentSource references remain in:

  • packages/localizations/src/kk-KZ.ts
  • packages/localizations/src/it-IT.ts
  • packages/localizations/src/cs-CZ.ts
  • packages/localizations/src/bn-IN.ts
    Rename those to match the new billing.paymentMethod structure in every locale.
packages/localizations/src/es-UY.ts (1)

978-994: Replace remaining {{paymentSource}} references in localization files

  • kk-KZ.ts:297
  • it-IT.ts:306
  • bn-IN.ts:299
  • cs-CZ.ts:303, 990

Update these placeholders to use {{paymentMethod}}.

packages/localizations/src/nb-NO.ts (1)

71-175: Rename leftover paymentSource references to paymentMethod
Several code and localization files still use the old “paymentSource” terminology and must be updated to match your renames:

  • packages/types/src/billing.ts: paymentSourceIdpaymentMethodId (and update JSDoc).
  • packages/shared/src/react/hooks/useCheckout.ts: state and props named paymentSource.
  • Localization files (kk-KZ.ts, it-IT.ts, cs-CZ.ts, bn-IN.ts): replace {{paymentSource}} and keys like title: 'Odebrat platební metodu' to use “method” nomenclature.
  • packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx & its tests: rename paymentSourceId and related props/parameters to paymentMethodId.
packages/localizations/src/bg-BG.ts (1)

965-981: Replace ‘paymentSource’ with ‘paymentMethod’ in locale success messages
The following locale files still use {{paymentSource}} and should be updated to {{paymentMethod}} for consistency:

  • it-IT.ts:306
  • kk-KZ.ts:297
  • cs-CZ.ts:303, 990
  • bn-IN.ts:299
packages/localizations/src/fa-IR.ts (3)

291-308: Fix inconsistent terminology in Persian translation.

Line 303 still uses the old term "منبع پرداخت" (payment source) instead of the updated "روش پرداخت" (payment method). This is inconsistent with the PR's objective to rename payment sources to payment methods throughout the codebase.

Apply this diff to fix the terminology:

         removeMethod: {
           messageLine1: '{{identifier}} از این حساب حذف خواهد شد.',
           messageLine2:
-            'شما دیگر نمی‌توانید از این منبع پرداخت استفاده کنید و هرگونه اشتراک دوره‌ای وابسته به آن دیگر کار نخواهد کرد.',
+            'شما دیگر نمی‌توانید از این روش پرداخت استفاده کنید و هرگونه اشتراک دوره‌ای وابسته به آن دیگر کار نخواهد کرد.',
           successMessage: '{{paymentMethod}} از حساب شما حذف شده است.',
           title: 'حذف روش پرداخت',
         },

976-993: Fix inconsistent terminology in Persian translation (duplicate issue).

Line 988 has the same issue as line 303 - it still uses "منبع پرداخت" (payment source) instead of "روش پرداخت" (payment method).

Apply this diff to fix the terminology:

         removeMethod: {
           messageLine1: '{{identifier}} از این حساب حذف خواهد شد.',
           messageLine2:
-            'شما دیگر نمی‌توانید از این منبع پرداخت استفاده کنید و هرگونه اشتراک دوره‌ای وابسته به آن دیگر کار نخواهد کرد.',
+            'شما دیگر نمی‌توانید از این روش پرداخت استفاده کنید و هرگونه اشتراک دوره‌ای وابسته به آن دیگر کار نخواهد کرد.',
           successMessage: '{{paymentMethod}} از حساب شما حذف شده است.',
           title: 'حذف روش پرداخت',
         },

291-308: Replace remaining paymentSource references in localization files
Occurrences of paymentSource remain in several locale files (e.g., kk-KZ.ts:297, it-IT.ts:306, bn-IN.ts:299, cs-CZ.ts:303/990). Update them to paymentMethod for consistency.

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

53-68: Fix the sorting comparator to return 0 for equal elements.

The sorting logic returns 1 for all cases where both subscriptions have the same status (both active or both inactive). This violates the comparator contract and can lead to unstable sorting behavior. It should return 0 when elements are equal.

Apply this diff to fix the sorting logic:

 const sortedSubscriptions = useMemo(
   () =>
     subscriptionItems.sort((a, b) => {
       // always put active subscriptions first
       if (a.status === 'active' && b.status !== 'active') {
         return -1;
       }

       if (b.status === 'active' && a.status !== 'active') {
         return 1;
       }

-      return 1;
+      return 0;
     }),
   [subscriptionItems],
 );
packages/localizations/src/cs-CZ.ts (3)

299-305: Critical: Inconsistent terminology in removeMethod dialog.

Lines 302-303 still reference "payment source" instead of "payment method":

  • Line 302: Czech text says "platební zdroj" (payment source)
  • Line 303: Variable {{paymentSource}} should be {{paymentMethod}}

This contradicts the PR's objective to rename sources to methods.

Apply this diff:

         removeMethod: {
           messageLine1: '{{identifier}} bude odstraněn z tohoto účtu.',
           messageLine2:
-            'Tento platební zdroj již nebudete moci používat a veškerá opakující se předplatná, která na něm závisí, přestanou fungovat.',
-          successMessage: '{{paymentSource}} byl odstraněn z vašeho účtu.',
+            'Tuto platební metodu již nebudete moci používat a veškerá opakující se předplatná, která na ní závisí, přestanou fungovat.',
+          successMessage: '{{paymentMethod}} byla odstraněna z vašeho účtu.',
           title: 'Odebrat platební metodu',
         },

Note: Czech grammar adjustments made for gender agreement (payment method is feminine in Czech, so "která" and "odstraněna" instead of "který" and "odstraněn").


986-992: Critical: Inconsistent terminology in user profile removeMethod dialog.

Lines 989-990 have the same issue as the organization profile section—they still reference "payment source" instead of "payment method":

  • Line 989: Czech text says "platební zdroj" (payment source)
  • Line 990: Variable {{paymentSource}} should be {{paymentMethod}}

Apply this diff:

         removeMethod: {
           messageLine1: '{{identifier}} bude odstraněn z tohoto účtu.',
           messageLine2:
-            'Tento platební zdroj již nebudete moci používat a veškerá opakující se předplatná, která na něm závisí, přestanou fungovat.',
-          successMessage: '{{paymentSource}} byl odstraněn z vašeho účtu.',
+            'Tuto platební metodu již nebudete moci používat a veškerá opakující se předplatná, která na ní závisí, přestanou fungovat.',
+          successMessage: '{{paymentMethod}} byla odstraněna z vašeho účtu.',
           title: 'Odebrat platební metodu',
         },

Note: Czech grammar adjustments made for gender agreement (payment method is feminine in Czech).


290-307: Replace “zdroj” with “metodu” in cs-CZ removeMethod dialogs
In packages/localizations/src/cs-CZ.ts (lines 300–304 and 987–991), update messageLine2 from
'Tento platební zdroj již nebudete…'
to
'Tuto platební metodu již nebudete…'

packages/localizations/src/hi-IN.ts (1)

289-301: Update Hindi strings to say “भुगतान विधि”, not “भुगतान स्रोत”.

We renamed the feature from “payment source” to “payment method”, but the Hindi copy here still says “भुगतान स्रोत” (in add, addSubtitle, title, removeMethod.*, etc.). This reintroduces the old terminology and will surface the wrong phrasing in both the org and user billing pages. Please swap these occurrences to the updated term (e.g., “भुगतान विधि”) so the UI matches the new naming.

Also applies to: 978-991

packages/localizations/src/zh-CN.ts (1)

71-175: Rename legacy removeResource keys and verify commerce. references

  • Replace all removeResource entries in packages/localizations/src/* with removeMethod to match the new billing namespace.
  • Re-run the legacy key scan for commerce. using both .ts and .tsx files (e.g., rg -nP --type=ts --type-add 'tsx:*.tsx' --type=tsx "localizationKeys\(['\"]commerce\.") to ensure no leftover references.
🧹 Nitpick comments (3)
packages/localizations/src/te-IN.ts (1)

71-125: Translation values are undefined for new payment method keys.

The new billing.addPaymentMethod__label and billing.paymentMethods__label keys have undefined values. While this is acceptable for initial structural changes, ensure these Telugu translations are provided before the PR is merged.

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

548-551: Consider localizing the "/" separator for consistency.

While the "/" separator is a common symbol, for complete localization consistency, consider extracting it to a localization key or using a locale-aware formatting approach.

Example:

-            {fee.amountFormatted} /{' '}
-            {t(localizationKeys(`billing.${subscription.planPeriod === 'month' ? 'month' : 'year'}`))}
+            {t(localizationKeys('billing.pricePerPeriod', {
+              price: fee.amountFormatted,
+              period: subscription.planPeriod === 'month' ? 'month' : 'year'
+            }))}
packages/clerk-js/src/ui/components/PaymentMethods/TestPaymentMethod.tsx (1)

41-64: Localization keys updated to billing.paymentMethod. — good*

Add an explicit return type to comply with TS guidelines.

As per coding guidelines, add an explicit return type:

-export const TestPaymentMethod = () => {
+export const TestPaymentMethod = (): JSX.Element => {

Optional: For full i18n compliance, consider localizing the sample card number and expiry (e.g., add keys under billing.paymentMethod.dev.sampleCardNumber / sampleExpiry) instead of hard-coded strings.

'@clerk/types': minor
---

[Billing Beta] Rename payment sources to method methods.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix typo in changeset description.

"method methods" should be "payment methods".

Apply this diff:

-[Billing Beta] Rename payment sources to method methods.
+[Billing Beta] Rename payment sources to payment methods.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[Billing Beta] Rename payment sources to method methods.
[Billing Beta] Rename payment sources to payment methods.
🤖 Prompt for AI Agents
.changeset/sad-bikes-tan.md around line 7: the changeset description contains a
typo "method methods" instead of "payment methods"; update that line to read
"[Billing Beta] Rename payment sources to payment methods." so the description
is correct and consistent.

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 (2)
packages/clerk-js/src/ui/components/Checkout/__tests__/Checkout.test.tsx (2)

127-127: LGTM! Consistent use of role-based queries.

This continues the pattern of using accessible role-based queries established in other tests, which is a best practice for React Testing Library.


192-192: LGTM! Maintaining consistent role-based query pattern.

The use of getByRole('heading', { name: 'Checkout' }) is consistent with the approach used throughout this test file, following React Testing Library best practices.

🧹 Nitpick comments (1)
packages/clerk-js/src/ui/components/Checkout/__tests__/Checkout.test.tsx (1)

111-111: Inconsistent destructuring order.

The destructuring order here is getByRole, baseElement, while other tests in this file (lines 38, 72, 172) use baseElement, getByRole. Consider maintaining consistent destructuring order for better code readability.

Apply this diff to align with the pattern used elsewhere in the file:

-    const { getByRole, baseElement } = render(
+    const { baseElement, getByRole } = render(
📜 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 8feb0eb and 04dddd9.

📒 Files selected for processing (1)
  • packages/clerk-js/src/ui/components/Checkout/__tests__/Checkout.test.tsx (6 hunks)
🧰 Additional context used
📓 Path-based instructions (13)
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/__tests__/Checkout.test.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/Checkout/__tests__/Checkout.test.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/Checkout/__tests__/Checkout.test.tsx
packages/**/*.{ts,tsx}

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

TypeScript is required for all packages

Files:

  • packages/clerk-js/src/ui/components/Checkout/__tests__/Checkout.test.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/Checkout/__tests__/Checkout.test.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/Checkout/__tests__/Checkout.test.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/Checkout/__tests__/Checkout.test.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/Checkout/__tests__/Checkout.test.tsx
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/Checkout/__tests__/Checkout.test.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/Checkout/__tests__/Checkout.test.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/Checkout/__tests__/Checkout.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/clerk-js/src/ui/components/Checkout/__tests__/Checkout.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/clerk-js/src/ui/components/Checkout/__tests__/Checkout.test.tsx
⏰ 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: Formatting | Dedupe | Changeset
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (3)
packages/clerk-js/src/ui/components/Checkout/__tests__/Checkout.test.tsx (3)

38-38: LGTM! Extracting getByRole for role-based queries.

Extracting getByRole from the render result is a best practice for React Testing Library, enabling more accessible and semantic test queries.


56-56: Role-based heading query improves accessibility testing.

Using getByRole('heading', { name: 'Checkout' }) follows React Testing Library best practices by querying elements based on their accessible role and name rather than implementation details like data attributes. This approach is more resilient to structural changes and better reflects how users interact with the component.

Note: The test is now coupled to the English translation "Checkout". If tests run with different locales or if the translation changes, this assertion would need updating.


172-172: LGTM! Consistent destructuring pattern.

The destructuring order is consistent with other tests in this file, maintaining good code style.

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.

2 participants