Skip to content

chore(clerk-js,types,localizations): Refactor statement page and payment attempt page #6420

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

Merged
merged 6 commits into from
Jul 29, 2025

Conversation

aeliox
Copy link
Contributor

@aeliox aeliox commented Jul 29, 2025

Description

Reworks statement page and payment attempt page to fetch appropriate resource by id instead of looping through paginated cached data. Also adds View Payment button to statement detail, now that it's available.

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

    • Added support for viewing individual billing statements and payment attempts, including direct navigation between statements and payment attempts.
    • Introduced a "View payment" button for easier access to payment attempt details from the statement page.
  • Refactor

    • Improved data loading for billing statement and payment attempt pages, resulting in more reliable and responsive data fetching.
    • Updated components to fetch data asynchronously with error handling and loading states.
    • Removed context-based hooks for payment attempts and statements, streamlining data access.
  • Localization

    • Added a new localization string for "View payment" in multiple languages.
  • Style

    • Enhanced the payment attempt link to a styled, interactive button for better user experience.
    • Allowed rendering of React elements as values in statement details for richer content display.

Copy link

changeset-bot bot commented Jul 29, 2025

🦋 Changeset detected

Latest commit: 56352ec

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 Patch
@clerk/clerk-js Patch
@clerk/types Patch
@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

Copy link

vercel bot commented Jul 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 29, 2025 6:19pm

@aeliox aeliox changed the title chore(clerk-js,types,localization): Refactor statement page and payment attempt page chore(clerk-js,types,localizations): Refactor statement page and payment attempt page Jul 29, 2025
Copy link

pkg-pr-new bot commented Jul 29, 2025

Open in StackBlitz

@clerk/agent-toolkit

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

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/elements

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

@clerk/clerk-expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/clerk-react

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

@clerk/react-router

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

@clerk/remix

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/themes

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

@clerk/types

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

@clerk/upgrade

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

@clerk/vue

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

commit: 56352ec

Copy link
Contributor

coderabbitai bot commented Jul 29, 2025

📝 Walkthrough

Walkthrough

This change set refactors the data loading logic for the billing statement and payment attempt pages by introducing new asynchronous methods (getStatement and getPaymentAttempt) in the billing module. These methods are exposed in both the implementation and type declarations. The affected UI components (StatementPage and PaymentAttemptPage) now use these methods with SWR hooks for data fetching, replacing previous context-based approaches. UI enhancements include rendering payment attempt links as interactive buttons. Localization resources and types are updated to support a new "View payment" string across multiple languages. Two context hooks (usePaymentAttemptsContext and useStatementsContext) were removed. Bundle size limits are slightly increased in the configuration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0bdd0df and 78592e8.

📒 Files selected for processing (9)
  • .changeset/slow-foxes-lay.md (1 hunks)
  • packages/clerk-js/bundlewatch.config.json (2 hunks)
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts (2 hunks)
  • packages/clerk-js/src/ui/components/PaymentAttempts/PaymentAttemptPage.tsx (2 hunks)
  • packages/clerk-js/src/ui/components/Statements/Statement.tsx (3 hunks)
  • packages/clerk-js/src/ui/components/Statements/StatementPage.tsx (2 hunks)
  • packages/localizations/src/en-US.ts (1 hunks)
  • packages/types/src/commerce.ts (2 hunks)
  • packages/types/src/localization.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (13)
**/*.{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/localization.ts
  • packages/localizations/src/en-US.ts
  • packages/types/src/commerce.ts
  • packages/clerk-js/src/ui/components/PaymentAttempts/PaymentAttemptPage.tsx
  • packages/clerk-js/src/ui/components/Statements/StatementPage.tsx
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts
  • packages/clerk-js/src/ui/components/Statements/Statement.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/localization.ts
  • packages/clerk-js/bundlewatch.config.json
  • packages/localizations/src/en-US.ts
  • packages/types/src/commerce.ts
  • packages/clerk-js/src/ui/components/PaymentAttempts/PaymentAttemptPage.tsx
  • packages/clerk-js/src/ui/components/Statements/StatementPage.tsx
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts
  • packages/clerk-js/src/ui/components/Statements/Statement.tsx
packages/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/types/src/localization.ts
  • packages/localizations/src/en-US.ts
  • packages/types/src/commerce.ts
  • packages/clerk-js/src/ui/components/PaymentAttempts/PaymentAttemptPage.tsx
  • packages/clerk-js/src/ui/components/Statements/StatementPage.tsx
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts
  • packages/clerk-js/src/ui/components/Statements/Statement.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/localization.ts
  • packages/localizations/src/en-US.ts
  • packages/types/src/commerce.ts
  • packages/clerk-js/src/ui/components/PaymentAttempts/PaymentAttemptPage.tsx
  • packages/clerk-js/src/ui/components/Statements/StatementPage.tsx
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts
  • packages/clerk-js/src/ui/components/Statements/Statement.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/types/src/localization.ts
  • packages/localizations/src/en-US.ts
  • packages/types/src/commerce.ts
  • packages/clerk-js/src/ui/components/PaymentAttempts/PaymentAttemptPage.tsx
  • packages/clerk-js/src/ui/components/Statements/StatementPage.tsx
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts
  • packages/clerk-js/src/ui/components/Statements/Statement.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/localization.ts
  • packages/localizations/src/en-US.ts
  • packages/types/src/commerce.ts
  • packages/clerk-js/src/ui/components/PaymentAttempts/PaymentAttemptPage.tsx
  • packages/clerk-js/src/ui/components/Statements/StatementPage.tsx
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts
  • packages/clerk-js/src/ui/components/Statements/Statement.tsx
**/*

⚙️ CodeRabbit Configuration File

**/*: If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.

Whenever reviewing a pull request, if there are any changes that could impact security, always tag @clerk/security in the PR.

Security-impacting changes include, but are not limited to:

  • Changes to authentication logic or mechanisms (e.g. login, session handling, token issuance)
  • Any modification to access control, authorization checks, or role-based permissions
  • Introduction or modification of hashing algorithms, signature verification, or cryptographic primitives
  • Handling of sensitive data (e.g. passwords, tokens, secrets, PII)
  • Integration with external identity providers (e.g. SSO, OAuth, OpenID Connect)
  • Modifications to security headers, cookie flags, CORS policies, or CSRF protections
  • Bypass mechanisms (e.g. feature flags, testing overrides) that could weaken protections
  • Changes to rate limiting, abuse prevention, or input validation

If you're unsure whether a change is security-relevant, err on the side of caution and tag @clerk/security.

Any time that you tag @clerk/security, please do so explicitly in a code comment, rather than within a collapsed section in a coderabbit comment, such as the "recent review details" section. If you do use the team name in any thinking or non-direct-code-comment content, it can be referred to as "clerk security team" to avoid accidentally printing the tag which sends a notification to the team.

Files:

  • packages/types/src/localization.ts
  • packages/clerk-js/bundlewatch.config.json
  • packages/localizations/src/en-US.ts
  • packages/types/src/commerce.ts
  • packages/clerk-js/src/ui/components/PaymentAttempts/PaymentAttemptPage.tsx
  • packages/clerk-js/src/ui/components/Statements/StatementPage.tsx
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts
  • packages/clerk-js/src/ui/components/Statements/Statement.tsx
packages/localizations/**/*

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

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

Files:

  • packages/localizations/src/en-US.ts
**/localizations/**/*.ts

⚙️ CodeRabbit Configuration File

**/localizations/**/*.ts: Review the changes to localization files with the following guidelines:

  • Ensure that no existing translations are accidentally removed unless they are being replaced or fixed. If a string is removed, verify that it is intentional and justified.
  • Check that all translations are friendly, formal, or semi-formal. Explicit, offensive, or inappropriate language is not allowed. If you find any potentially offensive language or are unsure, tag the @clerk/sdk-infra team in a separate comment. If you do not intend to tag the team, refer to it as "Clerk SDK Infra team" instead.
  • Use the most up-to-date base localization file (https://github.com/clerk/javascript/blob/main/packages/localizations/src/en-US.ts) to validate changes, ensuring consistency and completeness.
  • Confirm that new translations are accurate, contextually appropriate, and match the intent of the original English strings.
  • Check for formatting issues, such as missing placeholders, incorrect variable usage, or syntax errors.
  • Ensure that all keys are unique and that there are no duplicate or conflicting entries.
  • If you notice missing translations for new keys, flag them for completion.

Files:

  • packages/localizations/src/en-US.ts
.changeset/**

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

Automated releases must use Changesets.

Files:

  • .changeset/slow-foxes-lay.md
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/PaymentAttempts/PaymentAttemptPage.tsx
  • packages/clerk-js/src/ui/components/Statements/StatementPage.tsx
  • packages/clerk-js/src/ui/components/Statements/Statement.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/PaymentAttempts/PaymentAttemptPage.tsx
  • packages/clerk-js/src/ui/components/Statements/StatementPage.tsx
  • packages/clerk-js/src/ui/components/Statements/Statement.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/PaymentAttempts/PaymentAttemptPage.tsx
  • packages/clerk-js/src/ui/components/Statements/StatementPage.tsx
  • packages/clerk-js/src/ui/components/Statements/Statement.tsx
🧬 Code Graph Analysis (2)
packages/clerk-js/src/ui/components/PaymentAttempts/PaymentAttemptPage.tsx (2)
packages/clerk-js/src/ui/contexts/components/SubscriberType.ts (2)
  • useSubscriberTypeContext (7-7)
  • useSubscriberTypeLocalizationRoot (9-12)
packages/react/src/isomorphicClerk.ts (1)
  • organization (680-686)
packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts (1)
packages/types/src/commerce.ts (2)
  • CommerceStatementResource (857-895)
  • CommercePaymentResource (732-816)
⏰ 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). (7)
  • GitHub Check: pr-title-lint
  • GitHub Check: pr-title-lint
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Build Packages
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (15)
packages/localizations/src/en-US.ts (1)

150-151: Add viewPayment copy looks good – ensure parity across locales

String is concise, capitalisation matches neighbouring keys (‘View features’).
Please confirm the new key has been added (even as a placeholder) to every other locale file to avoid runtime fall-backs.

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

187-190: Type addition is correct and consistent

viewPayment: LocalizationValue; is correctly inserted in the commerce block and keeps the semi-colon style used throughout. No further action required.

packages/clerk-js/bundlewatch.config.json (1)

4-7: Raising bundle limits – double-check the actual size delta

The thresholds for three bundles were bumped by ~0.2 KB each.
Before merging, please verify the current build indeed needs this head-room and that tree-shaking hasn’t regressed unexpectedly.

Also applies to: 26-26

.changeset/slow-foxes-lay.md (1)

1-8: Changeset valid

Packages and bump type are declared correctly; summary is clear. ✅

packages/clerk-js/src/ui/components/Statements/Statement.tsx (2)

1-1: LGTM: React import added for React.isValidElement()

The explicit React import is correctly added to support the new React.isValidElement() check in the rendering logic.


284-284: LGTM: Well-implemented type extension to support React elements

The changes correctly extend the value prop to accept React elements while maintaining backward compatibility. The rendering logic properly uses React.isValidElement() to handle the different value types, and the type assertion is safe given the conditional checks.

This enhancement supports the PR's objective of adding interactive elements like the "View Payment" button in statement details.

Also applies to: 353-355, 360-360

packages/types/src/commerce.ts (2)

29-37: LGTM: Consistent type definition for new payment attempt method

The getPaymentAttempt method signature is well-defined with appropriate parameter types and return type. The experimental API documentation follows the established pattern and provides clear guidance for users.


92-100: LGTM: Consistent type definition for new statement method

The getStatement method signature mirrors the pattern established by getPaymentAttempt with consistent parameter types and return type. The experimental API documentation is appropriately included.

packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts (2)

106-116: LGTM: Consistent implementation following established patterns

The getStatement method correctly implements the expected functionality:

  • Proper conditional path logic for organization vs user context
  • Consistent API request structure with other methods in the class
  • Appropriate response casting and resource wrapping

137-145: LGTM: Consistent implementation mirroring the statement method

The getPaymentAttempt method follows the same reliable pattern as getStatement with appropriate API endpoint paths for payment attempts and consistent response handling.

packages/clerk-js/src/ui/components/PaymentAttempts/PaymentAttemptPage.tsx (2)

1-2: LGTM: Appropriate imports and hooks for SWR-based data fetching

The import changes correctly bring in the necessary dependencies for the new data fetching approach:

  • useClerk and useOrganization for accessing the billing API and organization context
  • useSWR for the new data fetching pattern
  • Context imports were appropriately cleaned up

The hook usage follows established patterns and correctly provides the needed data and functions.

Also applies to: 9-9, 28-31


33-40: LGTM: Well-structured SWR implementation for direct API fetching

The SWR implementation effectively replaces the context-based data fetching:

  • Proper conditional key structure prevents unnecessary requests
  • Correct usage of the new clerk.billing.getPaymentAttempt method
  • Appropriate organization context handling based on subscriber type
  • Clean separation of data fetching from component logic

This refactor aligns well with the PR's objective to fetch resources directly by ID rather than iterating through paginated cached data.

packages/clerk-js/src/ui/components/Statements/StatementPage.tsx (3)

1-3: LGTM! Import statements align with refactoring objectives.

The new imports properly support the data fetching refactoring (useClerk, useOrganization, useSWR) and UI enhancements (SimpleButton, Icon, ArrowRightIcon). The imports are well-organized and follow the project's conventions.

Also applies to: 7-19


40-50: LGTM! Loading state follows established patterns.

The loading state implementation correctly uses useSWR's isLoading flag, follows the project's design system with element descriptors, and provides appropriate visual feedback with a centered spinner.


116-133: Excellent UX improvement with proper implementation!

The replacement of static text with an interactive button significantly improves user experience by making payment attempts actionable. The implementation demonstrates several best practices:

  • Uses SimpleButton with appropriate link variant for navigation
  • Includes proper localization with localizationKeys('commerce.viewPayment')
  • Follows accessibility guidelines with aria-hidden on decorative icon
  • Uses theme tokens for consistent spacing via sx prop
  • Implements proper navigation pattern with void async handling

This change aligns perfectly with the refactoring objectives and enhances the overall user interface.

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 (1)
packages/clerk-js/src/ui/components/Statements/StatementPage.tsx (1)

59-70: Proper error handling implementation addressing previous feedback

The error handling correctly addresses the previous review comment by:

  • Extracting the error from useSWR
  • Using the translateError utility for proper localization
  • Displaying errors with consistent styling using the Alert component
  • Maintaining the same layout structure as the loading state

This properly implements the error handling that was suggested in the previous review.

🧹 Nitpick comments (1)
packages/clerk-js/src/ui/components/Statements/StatementPage.tsx (1)

4-4: Import path inconsistency

The Alert component is imported using an absolute path @/ui/elements/Alert while other similar components use relative paths. This inconsistency could indicate a path mapping issue or inconsistent import patterns.

Consider using a consistent import pattern:

-import { Alert } from '@/ui/elements/Alert';
+import { Alert } from '@/ui/elements';

Or verify if the path mapping is correctly configured for this specific import.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 78592e8 and 3b5b4bd.

📒 Files selected for processing (7)
  • packages/clerk-js/bundlewatch.config.json (2 hunks)
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts (2 hunks)
  • packages/clerk-js/src/ui/components/PaymentAttempts/PaymentAttemptPage.tsx (3 hunks)
  • packages/clerk-js/src/ui/components/Statements/StatementPage.tsx (3 hunks)
  • packages/clerk-js/src/ui/contexts/components/PaymentAttempts.tsx (0 hunks)
  • packages/clerk-js/src/ui/contexts/components/Statements.tsx (0 hunks)
  • packages/types/src/commerce.ts (2 hunks)
💤 Files with no reviewable changes (2)
  • packages/clerk-js/src/ui/contexts/components/Statements.tsx
  • packages/clerk-js/src/ui/contexts/components/PaymentAttempts.tsx
✅ Files skipped from review due to trivial changes (1)
  • packages/clerk-js/bundlewatch.config.json
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts
  • packages/types/src/commerce.ts
  • packages/clerk-js/src/ui/components/PaymentAttempts/PaymentAttemptPage.tsx
🧰 Additional context used
📓 Path-based instructions (10)
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/Statements/StatementPage.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/Statements/StatementPage.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/Statements/StatementPage.tsx
packages/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/clerk-js/src/ui/components/Statements/StatementPage.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/Statements/StatementPage.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/Statements/StatementPage.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/Statements/StatementPage.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/Statements/StatementPage.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/Statements/StatementPage.tsx
**/*

⚙️ CodeRabbit Configuration File

**/*: If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.

Whenever reviewing a pull request, if there are any changes that could impact security, always tag @clerk/security in the PR.

Security-impacting changes include, but are not limited to:

  • Changes to authentication logic or mechanisms (e.g. login, session handling, token issuance)
  • Any modification to access control, authorization checks, or role-based permissions
  • Introduction or modification of hashing algorithms, signature verification, or cryptographic primitives
  • Handling of sensitive data (e.g. passwords, tokens, secrets, PII)
  • Integration with external identity providers (e.g. SSO, OAuth, OpenID Connect)
  • Modifications to security headers, cookie flags, CORS policies, or CSRF protections
  • Bypass mechanisms (e.g. feature flags, testing overrides) that could weaken protections
  • Changes to rate limiting, abuse prevention, or input validation

If you're unsure whether a change is security-relevant, err on the side of caution and tag @clerk/security.

Any time that you tag @clerk/security, please do so explicitly in a code comment, rather than within a collapsed section in a coderabbit comment, such as the "recent review details" section. If you do use the team name in any thinking or non-direct-code-comment content, it can be referred to as "clerk security team" to avoid accidentally printing the tag which sends a notification to the team.

Files:

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

1-2: LGTM: Clean import additions for new functionality

The addition of useClerk, useOrganization from React hooks and useSWR for data fetching aligns well with the refactoring objectives to move away from context-based data fetching.


8-20: Well-organized imports following project patterns

The imports are properly structured with clear separation between contexts, customizables, and icons. The additions support the new functionality while maintaining consistency with existing patterns.


26-30: Good hook organization and localization setup

The hooks are well-organized and the addition of translateError from useLocalizations properly supports the error handling functionality introduced later in the component.


32-45: Excellent data fetching implementation with proper conditional logic

The useSWR implementation correctly:

  • Uses conditional fetching with a proper key structure
  • Includes organization ID when subscriber type is 'org'
  • Maintains consistency between the SWR key and the fetcher function parameters
  • Extracts error for proper error handling

The refactor successfully replaces context-based data fetching with direct API calls, improving data freshness and reducing complexity.


136-153: Excellent UI enhancement with proper accessibility and localization

The payment button implementation is well-crafted:

  • Uses SimpleButton with appropriate variant and color scheme
  • Includes proper navigation functionality
  • Has proper spacing with theme tokens (t.space.$1)
  • Uses localized text with localizationKeys('commerce.viewPayment')
  • Includes an accessible arrow icon with aria-hidden
  • Follows the coding guidelines for element descriptors and localization

This is a significant improvement over the previous truncated ID display, providing better user experience.

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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3856df9 and 56352ec.

📒 Files selected for processing (48)
  • packages/localizations/src/ar-SA.ts (1 hunks)
  • packages/localizations/src/be-BY.ts (1 hunks)
  • packages/localizations/src/bg-BG.ts (1 hunks)
  • packages/localizations/src/bn-IN.ts (1 hunks)
  • packages/localizations/src/ca-ES.ts (1 hunks)
  • packages/localizations/src/cs-CZ.ts (1 hunks)
  • packages/localizations/src/da-DK.ts (1 hunks)
  • packages/localizations/src/de-DE.ts (1 hunks)
  • packages/localizations/src/el-GR.ts (1 hunks)
  • packages/localizations/src/en-GB.ts (1 hunks)
  • packages/localizations/src/es-CR.ts (1 hunks)
  • packages/localizations/src/es-ES.ts (1 hunks)
  • packages/localizations/src/es-MX.ts (1 hunks)
  • packages/localizations/src/es-UY.ts (1 hunks)
  • packages/localizations/src/fa-IR.ts (1 hunks)
  • packages/localizations/src/fi-FI.ts (1 hunks)
  • packages/localizations/src/fr-FR.ts (1 hunks)
  • packages/localizations/src/he-IL.ts (1 hunks)
  • packages/localizations/src/hi-IN.ts (1 hunks)
  • packages/localizations/src/hr-HR.ts (1 hunks)
  • packages/localizations/src/hu-HU.ts (1 hunks)
  • packages/localizations/src/id-ID.ts (1 hunks)
  • packages/localizations/src/is-IS.ts (1 hunks)
  • packages/localizations/src/it-IT.ts (1 hunks)
  • packages/localizations/src/ja-JP.ts (1 hunks)
  • packages/localizations/src/kk-KZ.ts (1 hunks)
  • packages/localizations/src/ko-KR.ts (1 hunks)
  • packages/localizations/src/mn-MN.ts (1 hunks)
  • packages/localizations/src/ms-MY.ts (1 hunks)
  • packages/localizations/src/nb-NO.ts (1 hunks)
  • packages/localizations/src/nl-BE.ts (1 hunks)
  • packages/localizations/src/nl-NL.ts (1 hunks)
  • packages/localizations/src/pl-PL.ts (1 hunks)
  • packages/localizations/src/pt-BR.ts (1 hunks)
  • packages/localizations/src/pt-PT.ts (1 hunks)
  • packages/localizations/src/ro-RO.ts (1 hunks)
  • packages/localizations/src/ru-RU.ts (1 hunks)
  • packages/localizations/src/sk-SK.ts (1 hunks)
  • packages/localizations/src/sr-RS.ts (1 hunks)
  • packages/localizations/src/sv-SE.ts (1 hunks)
  • packages/localizations/src/ta-IN.ts (1 hunks)
  • packages/localizations/src/te-IN.ts (1 hunks)
  • packages/localizations/src/th-TH.ts (1 hunks)
  • packages/localizations/src/tr-TR.ts (1 hunks)
  • packages/localizations/src/uk-UA.ts (1 hunks)
  • packages/localizations/src/vi-VN.ts (1 hunks)
  • packages/localizations/src/zh-CN.ts (1 hunks)
  • packages/localizations/src/zh-TW.ts (1 hunks)
✅ Files skipped from review due to trivial changes (46)
  • packages/localizations/src/de-DE.ts
  • packages/localizations/src/ar-SA.ts
  • packages/localizations/src/bg-BG.ts
  • packages/localizations/src/be-BY.ts
  • packages/localizations/src/te-IN.ts
  • packages/localizations/src/pl-PL.ts
  • packages/localizations/src/hu-HU.ts
  • packages/localizations/src/kk-KZ.ts
  • packages/localizations/src/nb-NO.ts
  • packages/localizations/src/ca-ES.ts
  • packages/localizations/src/it-IT.ts
  • packages/localizations/src/sv-SE.ts
  • packages/localizations/src/es-MX.ts
  • packages/localizations/src/pt-BR.ts
  • packages/localizations/src/ms-MY.ts
  • packages/localizations/src/ko-KR.ts
  • packages/localizations/src/es-ES.ts
  • packages/localizations/src/fi-FI.ts
  • packages/localizations/src/uk-UA.ts
  • packages/localizations/src/hi-IN.ts
  • packages/localizations/src/es-CR.ts
  • packages/localizations/src/da-DK.ts
  • packages/localizations/src/ja-JP.ts
  • packages/localizations/src/en-GB.ts
  • packages/localizations/src/fr-FR.ts
  • packages/localizations/src/ta-IN.ts
  • packages/localizations/src/bn-IN.ts
  • packages/localizations/src/he-IL.ts
  • packages/localizations/src/tr-TR.ts
  • packages/localizations/src/mn-MN.ts
  • packages/localizations/src/th-TH.ts
  • packages/localizations/src/pt-PT.ts
  • packages/localizations/src/vi-VN.ts
  • packages/localizations/src/ru-RU.ts
  • packages/localizations/src/is-IS.ts
  • packages/localizations/src/fa-IR.ts
  • packages/localizations/src/sr-RS.ts
  • packages/localizations/src/nl-BE.ts
  • packages/localizations/src/zh-CN.ts
  • packages/localizations/src/nl-NL.ts
  • packages/localizations/src/sk-SK.ts
  • packages/localizations/src/zh-TW.ts
  • packages/localizations/src/el-GR.ts
  • packages/localizations/src/cs-CZ.ts
  • packages/localizations/src/es-UY.ts
  • packages/localizations/src/hr-HR.ts
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{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/id-ID.ts
  • packages/localizations/src/ro-RO.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/id-ID.ts
  • packages/localizations/src/ro-RO.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/localizations/src/id-ID.ts
  • packages/localizations/src/ro-RO.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/id-ID.ts
  • packages/localizations/src/ro-RO.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/id-ID.ts
  • packages/localizations/src/ro-RO.ts
packages/localizations/**/*

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

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

Files:

  • packages/localizations/src/id-ID.ts
  • packages/localizations/src/ro-RO.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/id-ID.ts
  • packages/localizations/src/ro-RO.ts
**/*

⚙️ CodeRabbit Configuration File

**/*: If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.

Whenever reviewing a pull request, if there are any changes that could impact security, always tag @clerk/security in the PR.

Security-impacting changes include, but are not limited to:

  • Changes to authentication logic or mechanisms (e.g. login, session handling, token issuance)
  • Any modification to access control, authorization checks, or role-based permissions
  • Introduction or modification of hashing algorithms, signature verification, or cryptographic primitives
  • Handling of sensitive data (e.g. passwords, tokens, secrets, PII)
  • Integration with external identity providers (e.g. SSO, OAuth, OpenID Connect)
  • Modifications to security headers, cookie flags, CORS policies, or CSRF protections
  • Bypass mechanisms (e.g. feature flags, testing overrides) that could weaken protections
  • Changes to rate limiting, abuse prevention, or input validation

If you're unsure whether a change is security-relevant, err on the side of caution and tag @clerk/security.

Any time that you tag @clerk/security, please do so explicitly in a code comment, rather than within a collapsed section in a coderabbit comment, such as the "recent review details" section. If you do use the team name in any thinking or non-direct-code-comment content, it can be referred to as "clerk security team" to avoid accidentally printing the tag which sends a notification to the team.

Files:

  • packages/localizations/src/id-ID.ts
  • packages/localizations/src/ro-RO.ts
**/localizations/**/*.ts

⚙️ CodeRabbit Configuration File

**/localizations/**/*.ts: Review the changes to localization files with the following guidelines:

  • Ensure that no existing translations are accidentally removed unless they are being replaced or fixed. If a string is removed, verify that it is intentional and justified.
  • Check that all translations are friendly, formal, or semi-formal. Explicit, offensive, or inappropriate language is not allowed. If you find any potentially offensive language or are unsure, tag the @clerk/sdk-infra team in a separate comment. If you do not intend to tag the team, refer to it as "Clerk SDK Infra team" instead.
  • Use the most up-to-date base localization file (https://github.com/clerk/javascript/blob/main/packages/localizations/src/en-US.ts) to validate changes, ensuring consistency and completeness.
  • Confirm that new translations are accurate, contextually appropriate, and match the intent of the original English strings.
  • Check for formatting issues, such as missing placeholders, incorrect variable usage, or syntax errors.
  • Ensure that all keys are unique and that there are no duplicate or conflicting entries.
  • If you notice missing translations for new keys, flag them for completion.

Files:

  • packages/localizations/src/id-ID.ts
  • packages/localizations/src/ro-RO.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: Formatting | Dedupe | Changeset
  • GitHub Check: Build Packages
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
packages/localizations/src/id-ID.ts (1)

157-157: LGTM! New localization key added correctly.

The addition of the viewPayment key under the commerce section is appropriate and follows the established pattern in this community-contributed localization file. The undefined value is consistent with other untranslated keys in this file.

This change aligns with the broader update to support new payment viewing functionality in the commerce billing system.

@@ -154,6 +154,7 @@ export const roRO: LocalizationResource = {
totalDue: undefined,
totalDueToday: undefined,
viewFeatures: undefined,
viewPayment: undefined,
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Missing Romanian translation for new viewPayment key.

The new viewPayment localization key has an undefined value, meaning the Romanian translation is incomplete. Based on the English base localization, this should be translated to an appropriate Romanian equivalent of "View payment".

Consider providing a Romanian translation such as:

-    viewPayment: undefined,
+    viewPayment: 'Vezi plata',

Or alternatively:

  • 'Vizualizează plata' (more formal)
  • 'Afișează plata' (display payment)

Please verify with native Romanian speakers to ensure the most appropriate translation for the payment context.

📝 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
viewPayment: undefined,
- viewPayment: undefined,
+ viewPayment: 'Vezi plata',
🤖 Prompt for AI Agents
In packages/localizations/src/ro-RO.ts at line 157, the viewPayment key is set
to undefined, indicating a missing Romanian translation. Replace undefined with
an appropriate Romanian translation for "View payment," such as 'Vizualizează
plata' or 'Afișează plata', after confirming the best choice with native
speakers for accuracy in the payment context.

@aeliox aeliox enabled auto-merge (squash) July 29, 2025 18:27
@aeliox aeliox merged commit af0e123 into main Jul 29, 2025
38 checks passed
@aeliox aeliox deleted the keiran/com-967 branch July 29, 2025 18:27
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