-
Notifications
You must be signed in to change notification settings - Fork 392
chore(clerk-js): Rename payment source to method internally #6952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 34a99d1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen 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 |
WalkthroughRenames "payment source(s)" to "payment method(s)" across core billing mapping, UI components, contexts, and tests. Updates imports, props, contexts, component names, and exports; switches billing pages to render PaymentMethods and adjusts getPaymentMethods data destructuring and revalidation naming. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User
participant CF as CheckoutForm
participant PM as usePaymentMethods
participant API as Billing API
U->>CF: Open checkout page
CF->>PM: request payment methods
PM->>API: GET /payment_methods
API-->>PM: { data: [PaymentMethod...] }
PM-->>CF: paymentMethods
CF->>U: Render payment method options
U->>CF: Select existing method or add new
alt existing
CF->>API: submit with payment_method_id
else add new
CF->>CF: AddPaymentMethod flow (form → submit)
CF->>API: create & submit
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
Comment |
d5d26ff
to
1b0eeb0
Compare
There was a problem hiding this 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 (2)
packages/clerk-js/src/ui/components/Checkout/__tests__/Checkout.test.tsx (1)
369-369
: Update missed reference topaymentSource
.Line 369 still uses
paymentSource: undefined
instead ofpaymentMethod: undefined
. This should be updated to maintain consistency with the rest of the codebase.Apply this diff:
- paymentSource: undefined, + paymentMethod: undefined,packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethods.tsx (1)
107-190
: Rename lingeringpaymentSource
identifiers
Found non-i18n occurrences still usingpaymentSource
—update them topaymentMethod
:
- packages/shared/src/react/hooks/useCheckout.ts: initial state property (
paymentSource: null
)- packages/clerk-js/src/ui/components/Checkout/tests/Checkout.test.tsx: test prop (
paymentSource: undefined
)- packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethods.tsx: formatting placeholder (
{ paymentSource: ref.current }
)
🧹 Nitpick comments (6)
packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx (4)
217-220
: Guard against undefineddata
from usePaymentMethodsDefault
paymentMethods
to an empty array to avoid.length
onundefined
during loading.As per coding guidelines
- const { data: paymentMethods } = usePaymentMethods(); + const { data: paymentMethods = [] } = usePaymentMethods();
236-244
: Localize the SegmentedControl aria-labelAvoid hard-coded strings; use localization for a11y labels.
As per coding guidelines
-<SegmentedControl.Root - aria-label='Payment method source' +<SegmentedControl.Root + aria-label={t(localizationKeys('commerce.checkout.paymentMethodSource'))} value={paymentMethodSource} onChange={value => setPaymentMethodSource(value as PaymentMethodSource)} size='lg' fullWidth >Add
useLocalizations
andt
:-import { __experimental_useCheckout as useCheckout } from '@clerk/shared/react'; +import { __experimental_useCheckout as useCheckout, useLocalizations } from '@clerk/shared/react';const CheckoutFormElementsInternal = () => { const { checkout } = useCheckout(); + const { t } = useLocalizations();
381-397
: Avoid duplicating label logic; localize labelsOption labels are hand-built and not localized. Prefer rendering a shared label (e.g., reuse PaymentMethodRow or extract a helper used by both the select and the row) and localize payment type/card brand.
As per coding guidelines
Also applies to: 433-433
415-417
: Rename local var for clarityUse domain-consistent naming to avoid confusion.
- const paymentMethod = paymentMethods.find(source => source.id === option.value); - setSelectedPaymentMethod(paymentMethod); + const method = paymentMethods.find(m => m.id === option.value); + setSelectedPaymentMethod(method);packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethods.tsx (2)
27-33
: Remove redundant return in async function
onAddPaymentMethodSuccess
isasync
;return Promise.resolve()
is unnecessary.- close(); - return Promise.resolve(); + close();
115-118
: Avoid in-place sort of hook data
paymentMethods.sort(...)
mutates the array returned by the hook; copy before sorting to prevent side effects.- const sortedPaymentMethods = useMemo( - () => paymentMethods.sort((a, b) => (a.isDefault && !b.isDefault ? -1 : 1)), + const sortedPaymentMethods = useMemo( + () => [...paymentMethods].sort((a, b) => (a.isDefault && !b.isDefault ? -1 : 1)), [paymentMethods], );
📜 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.
📒 Files selected for processing (13)
packages/clerk-js/src/core/modules/billing/payment-source-methods.ts
(1 hunks)packages/clerk-js/src/core/modules/checkout/__tests__/manager.test.ts
(1 hunks)packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
(8 hunks)packages/clerk-js/src/ui/components/Checkout/__tests__/Checkout.test.tsx
(7 hunks)packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
(2 hunks)packages/clerk-js/src/ui/components/PaymentMethods/AddPaymentMethod.tsx
(8 hunks)packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethodRow.tsx
(3 hunks)packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethods.tsx
(8 hunks)packages/clerk-js/src/ui/components/PaymentMethods/TestPaymentMethod.tsx
(1 hunks)packages/clerk-js/src/ui/components/PaymentMethods/index.ts
(1 hunks)packages/clerk-js/src/ui/components/PaymentSources/index.ts
(0 hunks)packages/clerk-js/src/ui/components/UserProfile/BillingPage.tsx
(2 hunks)packages/clerk-js/src/ui/contexts/components/Plans.tsx
(1 hunks)
💤 Files with no reviewable changes (1)
- packages/clerk-js/src/ui/components/PaymentSources/index.ts
🧰 Additional context used
📓 Path-based instructions (15)
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/PaymentMethods/TestPaymentMethod.tsx
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethodRow.tsx
packages/clerk-js/src/ui/components/UserProfile/BillingPage.tsx
packages/clerk-js/src/ui/components/Checkout/__tests__/Checkout.test.tsx
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethods.tsx
packages/clerk-js/src/ui/contexts/components/Plans.tsx
packages/clerk-js/src/ui/components/PaymentMethods/index.ts
packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
packages/clerk-js/src/ui/components/PaymentMethods/AddPaymentMethod.tsx
packages/clerk-js/src/ui/components/Checkout/CheckoutForm.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/PaymentMethods/TestPaymentMethod.tsx
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethodRow.tsx
packages/clerk-js/src/ui/components/UserProfile/BillingPage.tsx
packages/clerk-js/src/ui/components/Checkout/__tests__/Checkout.test.tsx
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethods.tsx
packages/clerk-js/src/core/modules/billing/payment-source-methods.ts
packages/clerk-js/src/ui/contexts/components/Plans.tsx
packages/clerk-js/src/ui/components/PaymentMethods/index.ts
packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
packages/clerk-js/src/ui/components/PaymentMethods/AddPaymentMethod.tsx
packages/clerk-js/src/core/modules/checkout/__tests__/manager.test.ts
packages/clerk-js/src/ui/components/Checkout/CheckoutForm.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/PaymentMethods/TestPaymentMethod.tsx
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethodRow.tsx
packages/clerk-js/src/ui/components/UserProfile/BillingPage.tsx
packages/clerk-js/src/ui/components/Checkout/__tests__/Checkout.test.tsx
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethods.tsx
packages/clerk-js/src/core/modules/billing/payment-source-methods.ts
packages/clerk-js/src/ui/contexts/components/Plans.tsx
packages/clerk-js/src/ui/components/PaymentMethods/index.ts
packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
packages/clerk-js/src/ui/components/PaymentMethods/AddPaymentMethod.tsx
packages/clerk-js/src/core/modules/checkout/__tests__/manager.test.ts
packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx
packages/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
packages/clerk-js/src/ui/components/PaymentMethods/TestPaymentMethod.tsx
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethodRow.tsx
packages/clerk-js/src/ui/components/UserProfile/BillingPage.tsx
packages/clerk-js/src/ui/components/Checkout/__tests__/Checkout.test.tsx
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethods.tsx
packages/clerk-js/src/core/modules/billing/payment-source-methods.ts
packages/clerk-js/src/ui/contexts/components/Plans.tsx
packages/clerk-js/src/ui/components/PaymentMethods/index.ts
packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
packages/clerk-js/src/ui/components/PaymentMethods/AddPaymentMethod.tsx
packages/clerk-js/src/core/modules/checkout/__tests__/manager.test.ts
packages/clerk-js/src/ui/components/Checkout/CheckoutForm.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/PaymentMethods/TestPaymentMethod.tsx
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethodRow.tsx
packages/clerk-js/src/ui/components/UserProfile/BillingPage.tsx
packages/clerk-js/src/ui/components/Checkout/__tests__/Checkout.test.tsx
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethods.tsx
packages/clerk-js/src/core/modules/billing/payment-source-methods.ts
packages/clerk-js/src/ui/contexts/components/Plans.tsx
packages/clerk-js/src/ui/components/PaymentMethods/index.ts
packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
packages/clerk-js/src/ui/components/PaymentMethods/AddPaymentMethod.tsx
packages/clerk-js/src/core/modules/checkout/__tests__/manager.test.ts
packages/clerk-js/src/ui/components/Checkout/CheckoutForm.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
Avoidany
type - preferunknown
when type is uncertain, then narrow with type guards
Useinterface
for object shapes that might be extended
Usetype
for unions, primitives, and computed types
Preferreadonly
properties for immutable data structures
Useprivate
for internal implementation details
Useprotected
for inheritance hierarchies
Usepublic
explicitly for clarity in public APIs
Preferreadonly
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
Useconst assertions
for literal types:as const
Usesatisfies
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 ...
Noany
types without justification
Proper error handling with typed errors
Consistent use ofreadonly
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/PaymentMethods/TestPaymentMethod.tsx
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethodRow.tsx
packages/clerk-js/src/ui/components/UserProfile/BillingPage.tsx
packages/clerk-js/src/ui/components/Checkout/__tests__/Checkout.test.tsx
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethods.tsx
packages/clerk-js/src/core/modules/billing/payment-source-methods.ts
packages/clerk-js/src/ui/contexts/components/Plans.tsx
packages/clerk-js/src/ui/components/PaymentMethods/index.ts
packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
packages/clerk-js/src/ui/components/PaymentMethods/AddPaymentMethod.tsx
packages/clerk-js/src/core/modules/checkout/__tests__/manager.test.ts
packages/clerk-js/src/ui/components/Checkout/CheckoutForm.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/PaymentMethods/TestPaymentMethod.tsx
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethodRow.tsx
packages/clerk-js/src/ui/components/UserProfile/BillingPage.tsx
packages/clerk-js/src/ui/components/Checkout/__tests__/Checkout.test.tsx
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethods.tsx
packages/clerk-js/src/ui/contexts/components/Plans.tsx
packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
packages/clerk-js/src/ui/components/PaymentMethods/AddPaymentMethod.tsx
packages/clerk-js/src/ui/components/Checkout/CheckoutForm.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/PaymentMethods/TestPaymentMethod.tsx
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethodRow.tsx
packages/clerk-js/src/ui/components/UserProfile/BillingPage.tsx
packages/clerk-js/src/ui/components/Checkout/__tests__/Checkout.test.tsx
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethods.tsx
packages/clerk-js/src/core/modules/billing/payment-source-methods.ts
packages/clerk-js/src/ui/contexts/components/Plans.tsx
packages/clerk-js/src/ui/components/PaymentMethods/index.ts
packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
packages/clerk-js/src/ui/components/PaymentMethods/AddPaymentMethod.tsx
packages/clerk-js/src/core/modules/checkout/__tests__/manager.test.ts
packages/clerk-js/src/ui/components/Checkout/CheckoutForm.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/PaymentMethods/TestPaymentMethod.tsx
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethodRow.tsx
packages/clerk-js/src/ui/components/UserProfile/BillingPage.tsx
packages/clerk-js/src/ui/components/Checkout/__tests__/Checkout.test.tsx
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethods.tsx
packages/clerk-js/src/ui/contexts/components/Plans.tsx
packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx
packages/clerk-js/src/ui/components/PaymentMethods/AddPaymentMethod.tsx
packages/clerk-js/src/ui/components/Checkout/CheckoutForm.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/src/core/modules/checkout/__tests__/manager.test.ts
packages/{clerk-js,elements,themes}/**/*.{test,spec}.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Visual regression testing should be performed for UI components.
Files:
packages/clerk-js/src/ui/components/Checkout/__tests__/Checkout.test.tsx
packages/clerk-js/src/core/modules/checkout/__tests__/manager.test.ts
**/*.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
packages/clerk-js/src/core/modules/checkout/__tests__/manager.test.ts
packages/**/index.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Use tree-shaking friendly exports
Files:
packages/clerk-js/src/ui/components/PaymentMethods/index.ts
**/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/clerk-js/src/ui/components/PaymentMethods/index.ts
🧬 Code graph analysis (7)
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethodRow.tsx (1)
packages/types/src/billing.ts (1)
BillingPaymentMethodResource
(277-332)
packages/clerk-js/src/ui/components/UserProfile/BillingPage.tsx (1)
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethods.tsx (1)
PaymentMethods
(107-190)
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethods.tsx (8)
packages/clerk-js/src/ui/elements/contexts/index.tsx (1)
withCardStateProvider
(72-81)packages/clerk-js/src/ui/contexts/components/SubscriberType.ts (2)
useSubscriberTypeContext
(7-7)useSubscriberTypeLocalizationRoot
(9-12)packages/clerk-js/src/ui/common/DevOnly.tsx (1)
DevOnly
(4-11)packages/clerk-js/src/ui/components/PaymentMethods/TestPaymentMethod.tsx (1)
TestPaymentMethod
(5-68)packages/types/src/billing.ts (1)
BillingPaymentMethodResource
(277-332)packages/clerk-js/src/ui/contexts/components/Plans.tsx (1)
usePaymentMethods
(32-40)packages/clerk-js/src/ui/elements/Section.tsx (1)
ProfileSection
(335-344)packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethodRow.tsx (1)
PaymentMethodRow
(6-52)
packages/clerk-js/src/core/modules/billing/payment-source-methods.ts (2)
packages/types/src/pagination.ts (1)
ClerkPaginatedResponse
(22-31)packages/clerk-js/src/core/resources/BillingPaymentSource.ts (1)
BillingPaymentMethod
(14-72)
packages/clerk-js/src/ui/contexts/components/Plans.tsx (2)
packages/shared/src/react/hooks/usePaymentMethods.tsx (1)
usePaymentMethods
(9-21)packages/shared/src/react/hooks/index.ts (1)
usePaymentMethods
(13-13)
packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx (1)
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethods.tsx (1)
PaymentMethods
(107-190)
packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx (6)
packages/clerk-js/src/ui/contexts/components/Plans.tsx (1)
usePaymentMethods
(32-40)packages/shared/src/react/hooks/usePaymentMethods.tsx (1)
usePaymentMethods
(9-21)packages/shared/src/react/hooks/index.ts (1)
usePaymentMethods
(13-13)packages/clerk-js/src/ui/elements/contexts/index.tsx (1)
withCardStateProvider
(72-81)packages/types/src/billing.ts (1)
BillingPaymentMethodResource
(277-332)packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethodRow.tsx (1)
PaymentMethodRow
(6-52)
🔇 Additional comments (13)
packages/clerk-js/src/ui/contexts/components/Plans.tsx (1)
126-134
: LGTM! Consistent internal renaming.The variable renaming from
revalidatePaymentSources
torevalidatePaymentMethods
is correctly applied across the destructuring (line 126), invocation (line 133), and useCallback dependency array (line 134). The refactoring maintains the existing logic while aligning with the PR's objective of internal naming consistency.packages/clerk-js/src/core/modules/billing/payment-source-methods.ts (1)
41-55
: LGTM! Refactoring simplifies the code.The removal of the
paymentSources
alias in favor of usingdata
directly is a good simplification that aligns with the PR's goal of internal renaming. The changes are functionally equivalent and make the code more straightforward.packages/clerk-js/src/ui/components/UserProfile/BillingPage.tsx (1)
10-10
: LGTM!The component swap from
PaymentSources
toPaymentMethods
is clean and consistent with the rename.Also applies to: 66-66
packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationBillingPage.tsx (1)
11-11
: LGTM!The component swap from
PaymentSources
toPaymentMethods
is clean and consistent with the rename.Also applies to: 71-71
packages/clerk-js/src/ui/components/PaymentMethods/TestPaymentMethod.tsx (1)
41-63
: Verify localization keys align with the rename.The component has been renamed to
TestPaymentMethod
, but all localization keys still referencepaymentSource
(e.g.,commerce.paymentSource.dev.testCardInfo
,commerce.paymentSource.dev.developmentMode
, etc.). While this may be intentional to preserve existing translations, this inconsistency should be documented or addressed in a follow-up.packages/clerk-js/src/core/modules/checkout/__tests__/manager.test.ts (1)
55-55
: LGTM!The test mock field has been correctly updated from
paymentSource
topaymentMethod
, aligning with the type changes inBillingCheckoutResource
.packages/clerk-js/src/ui/components/PaymentMethods/index.ts (1)
1-3
: LGTM!Clean barrel export pattern that provides a consolidated public API for the PaymentMethods module. This follows tree-shaking friendly practices.
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethodRow.tsx (1)
6-51
: LGTM!The component and prop renaming from
PaymentSourceRow
toPaymentMethodRow
is complete and consistent. Element descriptors follow the camelCase convention as required by the coding guidelines.packages/clerk-js/src/ui/components/Checkout/__tests__/Checkout.test.tsx (1)
453-453
: LGTM!Test fixtures and assertions have been correctly updated from
paymentSource
topaymentMethod
throughout the test file, maintaining consistency with the rename.Also applies to: 533-546, 625-638, 750-750, 889-889, 1028-1028
packages/clerk-js/src/ui/components/PaymentMethods/AddPaymentMethod.tsx (1)
104-108
: Review localization keys referencingpaymentSource
Localization keys still usecommerce.paymentSource…
across multiple components (e.g. AddPaymentMethod.tsx:241, TestPaymentMethod.tsx, PaymentMethods.tsx). Either update them topaymentMethod
or document/track the intentional retention for backward-compatibility.packages/clerk-js/src/ui/components/Checkout/CheckoutForm.tsx (1)
18-19
: Renamed imports: LGTMImports now consistently reference PaymentMethod components.
packages/clerk-js/src/ui/components/PaymentMethods/PaymentMethods.tsx (2)
17-19
: Renamed modules: LGTMSwitched to AddPaymentMethod, PaymentMethodRow, TestPaymentMethod consistently.
149-168
: Rendering list and actions: LGTMRows, menus, and remove actions are wired correctly against the renamed API.
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/elements
@clerk/clerk-expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/clerk-react
@clerk/react-router
@clerk/remix
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/themes
@clerk/types
@clerk/upgrade
@clerk/vue
commit: |
Description
Checklist
pnpm test
runs as expected.pnpm build
runs as expected.Type of change
Summary by CodeRabbit
Refactor
Tests