Skip to content

Conversation

@panteliselef
Copy link
Contributor

@panteliselef panteliselef commented Jul 14, 2025

Description

UIs with the past_due status

image image image image

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

    • Subscriptions with a "past due" status are now clearly displayed, including the date they became past due.
    • Added a dedicated badge and detail row for past due subscriptions in subscription lists and details.
    • Actions such as switching or canceling are now disabled for past due subscriptions.
  • Localization

    • Added new English-language labels for "past due" badges and details.
  • Bug Fixes

    • Ensured accurate display and handling of subscriptions that are past due.
  • Tests

    • Added tests to verify correct UI behavior for past due subscriptions.

panteliselef and others added 30 commits June 17, 2025 15:28
…-and-subscriptiondetails

# Conflicts:
#	packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
…-and-subscriptiondetails

# Conflicts:
#	packages/clerk-js/src/core/resources/CommerceSubscription.ts
#	packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
#	packages/clerk-js/src/ui/contexts/components/Plans.tsx
#	packages/types/src/commerce.ts
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This reverts commit 587f2b8.
…-properly

# Conflicts:
#	packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
#	packages/clerk-js/src/ui/components/SubscriptionDetails/__tests__/SubscriptionDetails.test.tsx
#	packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx
#	packages/clerk-js/src/ui/customizables/elementDescriptors.ts
#	packages/localizations/src/en-US.ts
#	packages/types/src/appearance.ts
#	packages/types/src/localization.ts
@panteliselef panteliselef requested a review from a team July 14, 2025 16:46
@panteliselef panteliselef self-assigned this Jul 14, 2025
@changeset-bot
Copy link

changeset-bot bot commented Jul 14, 2025

🦋 Changeset detected

Latest commit: 522a357

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

@vercel
Copy link

vercel bot commented Jul 14, 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 14, 2025 6:15pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 14, 2025

📝 Walkthrough

Walkthrough

This change introduces explicit support for handling "past due" subscription states across multiple packages. A new past_due status is added to the subscription types, along with a corresponding pastDueAt date property. The UI components are updated to recognize and display the "past due" status using a new SubscriptionBadge component and to adjust available actions accordingly. Localization resources and types are extended to include new keys and strings for "past due" badges and labels. Test coverage is expanded with a case for the "past due" scenario. No breaking changes to public APIs are made, but the internal logic and display for subscriptions now consistently account for the "past due" state.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4c75e78 and 522a357.

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

🪧 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: 3

🔭 Outside diff range comments (1)
packages/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx (1)

131-131: Remove unused variable.

The isPlanActive variable is declared but never used in the component.

 const subscription = React.useMemo(
   () => activeOrUpcomingSubscriptionBasedOnPlanPeriod(plan, planPeriod),
   [plan, planPeriod, activeOrUpcomingSubscriptionBasedOnPlanPeriod],
 );
-const isPlanActive = subscription?.status === 'active';
 const hasFeatures = plan.features.length > 0;
 const showStatusRow = !!subscription;
🧹 Nitpick comments (1)
packages/clerk-js/src/ui/components/Subscriptions/SubscriptionsList.tsx (1)

119-119: Remove leftover comment.

The comment // here appears to be a leftover from development and should be removed.

-                    // here
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b96114e and 639e180.

📒 Files selected for processing (12)
  • .changeset/salty-spiders-end.md (1 hunks)
  • packages/clerk-js/src/core/resources/CommerceSubscription.ts (2 hunks)
  • packages/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx (2 hunks)
  • packages/clerk-js/src/ui/components/SubscriptionDetails/__tests__/SubscriptionDetails.test.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx (11 hunks)
  • packages/clerk-js/src/ui/components/Subscriptions/SubscriptionsList.tsx (2 hunks)
  • packages/clerk-js/src/ui/components/Subscriptions/badge.tsx (1 hunks)
  • packages/clerk-js/src/ui/contexts/components/Plans.tsx (1 hunks)
  • packages/localizations/src/en-US.ts (2 hunks)
  • packages/types/src/commerce.ts (2 hunks)
  • packages/types/src/json.ts (1 hunks)
  • packages/types/src/localization.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (14)
**/*.{js,jsx,ts,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/development.mdc
packages/**/*.ts

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/development.mdc
packages/**/*.{ts,tsx,d.ts}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/development.mdc
**/*.{ts,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/development.mdc
  • .cursor/rules/typescript.mdc
**/*

Instructions used from:

Sources:
⚙️ CodeRabbit Configuration File

**/*.{tsx,jsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/development.mdc
packages/{clerk-js,elements,themes}/**/*

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/monorepo.mdc
**/*.{jsx,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/react.mdc
**/*.tsx

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/react.mdc
packages/localizations/**/*

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/monorepo.mdc
**/{__tests__,**/__tests__}/**/*.{js,jsx,ts,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/development.mdc
**/*.{test,spec}.{js,ts,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/monorepo.mdc
**/*.test.{jsx,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/react.mdc
**/__tests__/**/*.{ts,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/typescript.mdc
🧠 Learnings (10)
📓 Common learnings
Learnt from: dstaley
PR: clerk/javascript#6116
File: .changeset/tangy-garlics-say.md:1-2
Timestamp: 2025-06-13T16:09:53.061Z
Learning: In the Clerk JavaScript repository, contributors create intentionally empty changeset files (containing only the YAML delimiters) when a PR touches only non-published parts of the codebase (e.g., sandbox assets). This signals that no package release is required, so such changesets should not be flagged as missing content.
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.{jsx,tsx} : Implement proper subscription cleanup
.changeset/salty-spiders-end.md (9)
Learnt from: dstaley
PR: clerk/javascript#6116
File: .changeset/tangy-garlics-say.md:1-2
Timestamp: 2025-06-13T16:09:53.061Z
Learning: In the Clerk JavaScript repository, contributors create intentionally empty changeset files (containing only the YAML delimiters) when a PR touches only non-published parts of the codebase (e.g., sandbox assets). This signals that no package release is required, so such changesets should not be flagged as missing content.
Learnt from: jacekradko
PR: clerk/javascript#5905
File: .changeset/six-ears-wash.md:1-3
Timestamp: 2025-06-26T03:27:05.535Z
Learning: In the Clerk JavaScript repository, changeset headers support single quotes syntax (e.g., '@clerk/backend': minor) and work fine with their current changesets integration, so there's no need to change them to double quotes.
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-06-30T10:30:56.197Z
Learning: Applies to packages/{clerk-js,elements,themes}/**/* : Visual regression testing should be performed for UI components.
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-06-30T10:30:56.197Z
Learning: Applies to packages/@clerk/*/package.json : Framework packages must depend on '@clerk/clerk-js' for core functionality.
Learnt from: dstaley
PR: clerk/javascript#6100
File: packages/clerk-js/src/ui/components/OAuthConsent/OAuthConsent.tsx:121-124
Timestamp: 2025-06-16T17:08:58.414Z
Learning: The @clerk/clerk-js package only supports browsers released in the last two years (since May 8, 2023), so modern CSS features like color-mix() are fully supported across all target browsers without requiring fallbacks.
Learnt from: panteliselef
PR: clerk/javascript#6285
File: packages/types/src/commerce.ts:1305-1305
Timestamp: 2025-07-11T18:08:14.697Z
Learning: In the Clerk JavaScript repository, when there's a conflict between naming consistency (camelCase) and avoiding breaking changes, the team prioritizes maintaining backward compatibility over enforcing naming conventions, even for experimental APIs.
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-06-30T10:30:56.197Z
Learning: Applies to packages/*/package.json : All packages must be published under the @clerk namespace on npm.
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/global.mdc:0-0
Timestamp: 2025-06-30T10:30:13.397Z
Learning: Applies to packages/*/package.json : All packages must be published under the @clerk namespace
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.{jsx,tsx} : Implement proper subscription cleanup
packages/clerk-js/src/ui/contexts/components/Plans.tsx (3)
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.{jsx,tsx} : Implement proper subscription cleanup
Learnt from: LauraBeatris
PR: clerk/javascript#6117
File: packages/clerk-js/src/ui/components/SessionTasks/index.tsx:64-83
Timestamp: 2025-06-18T16:33:36.764Z
Learning: In SessionTasks component at packages/clerk-js/src/ui/components/SessionTasks/index.tsx, the useEffect that checks for pending tasks should only run on mount (not react to currentTask/status changes) to handle browser back navigation edge cases without interfering with normal task completion flow managed by nextTask().
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.{jsx,tsx} : Use proper state updates with callbacks
packages/clerk-js/src/ui/components/Subscriptions/badge.tsx (2)
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.{jsx,tsx} : Implement proper subscription cleanup
Learnt from: panteliselef
PR: clerk/javascript#6097
File: packages/clerk-js/src/ui/elements/LineItems.tsx:89-89
Timestamp: 2025-06-10T09:38:56.214Z
Learning: In packages/clerk-js/src/ui/elements/LineItems.tsx, the Title component's React.forwardRef should use HTMLTableCellElement as the generic type parameter, even though it renders a Dt element. This is the correct implementation according to the codebase maintainer.
packages/types/src/commerce.ts (2)
Learnt from: dstaley
PR: clerk/javascript#6100
File: packages/clerk-js/src/ui/components/OAuthConsent/OAuthConsent.tsx:121-124
Timestamp: 2025-06-16T17:08:58.414Z
Learning: The @clerk/clerk-js package only supports browsers released in the last two years (since May 8, 2023), so modern CSS features like color-mix() are fully supported across all target browsers without requiring fallbacks.
Learnt from: panteliselef
PR: clerk/javascript#6285
File: packages/types/src/commerce.ts:1305-1305
Timestamp: 2025-07-11T18:08:14.697Z
Learning: In the Clerk JavaScript repository, when there's a conflict between naming consistency (camelCase) and avoiding breaking changes, the team prioritizes maintaining backward compatibility over enforcing naming conventions, even for experimental APIs.
packages/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx (6)
Learnt from: panteliselef
PR: clerk/javascript#6097
File: packages/clerk-js/src/ui/elements/LineItems.tsx:89-89
Timestamp: 2025-06-10T09:38:56.214Z
Learning: In packages/clerk-js/src/ui/elements/LineItems.tsx, the Title component's React.forwardRef should use HTMLTableCellElement as the generic type parameter, even though it renders a Dt element. This is the correct implementation according to the codebase maintainer.
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-06-30T10:30:56.197Z
Learning: Applies to packages/clerk-react/**/*.{test,spec}.{js,ts,tsx} : Component testing should use React Testing Library.
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.{jsx,tsx} : Implement proper subscription cleanup
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-06-30T10:30:56.197Z
Learning: Applies to packages/{clerk-js,elements,themes}/**/* : Visual regression testing should be performed for UI components.
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.{jsx,tsx} : Use Context API for theme/authentication
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.{jsx,tsx} : Use proper button types
packages/clerk-js/src/ui/components/Subscriptions/SubscriptionsList.tsx (6)
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.{jsx,tsx} : Implement proper subscription cleanup
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-06-30T10:30:56.197Z
Learning: Applies to packages/clerk-react/**/*.{test,spec}.{js,ts,tsx} : Component testing should use React Testing Library.
Learnt from: panteliselef
PR: clerk/javascript#6097
File: packages/clerk-js/src/ui/elements/LineItems.tsx:89-89
Timestamp: 2025-06-10T09:38:56.214Z
Learning: In packages/clerk-js/src/ui/elements/LineItems.tsx, the Title component's React.forwardRef should use HTMLTableCellElement as the generic type parameter, even though it renders a Dt element. This is the correct implementation according to the codebase maintainer.
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-06-30T10:30:56.197Z
Learning: Applies to packages/{clerk-js,elements,themes}/**/* : Visual regression testing should be performed for UI components.
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.{jsx,tsx} : Use proper button types
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.{jsx,tsx} : Use Context API for theme/authentication
packages/clerk-js/src/core/resources/CommerceSubscription.ts (1)
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.{jsx,tsx} : Implement proper subscription cleanup
packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx (6)
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.{jsx,tsx} : Implement proper subscription cleanup
Learnt from: LauraBeatris
PR: clerk/javascript#6117
File: packages/clerk-js/src/ui/components/SessionTasks/index.tsx:64-83
Timestamp: 2025-06-18T16:33:36.764Z
Learning: In SessionTasks component at packages/clerk-js/src/ui/components/SessionTasks/index.tsx, the useEffect that checks for pending tasks should only run on mount (not react to currentTask/status changes) to handle browser back navigation edge cases without interfering with normal task completion flow managed by nextTask().
Learnt from: panteliselef
PR: clerk/javascript#6097
File: packages/clerk-js/src/ui/elements/LineItems.tsx:89-89
Timestamp: 2025-06-10T09:38:56.214Z
Learning: In packages/clerk-js/src/ui/elements/LineItems.tsx, the Title component's React.forwardRef should use HTMLTableCellElement as the generic type parameter, even though it renders a Dt element. This is the correct implementation according to the codebase maintainer.
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.{jsx,tsx} : Use proper state updates with callbacks
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.{jsx,tsx} : Use Context API for theme/authentication
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.{jsx,tsx} : Implement proper virtualization for lists
packages/clerk-js/src/ui/components/SubscriptionDetails/__tests__/SubscriptionDetails.test.tsx (13)
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-06-30T10:30:56.197Z
Learning: Applies to packages/{clerk-js,elements,themes}/**/* : Visual regression testing should be performed for UI components.
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-06-30T10:30:56.197Z
Learning: Applies to packages/clerk-react/**/*.{test,spec}.{js,ts,tsx} : Component testing should use React Testing Library.
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.test.{jsx,tsx} : Test component interactions
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.test.{jsx,tsx} : Test component behavior, not implementation
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.test.{jsx,tsx} : Implement proper test assertions
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.{jsx,tsx} : Implement proper subscription cleanup
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.test.{jsx,tsx} : Use proper test data
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.test.{jsx,tsx} : Use proper test queries
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/typescript.mdc:0-0
Timestamp: 2025-06-30T10:33:45.961Z
Learning: Applies to **/__tests__/**/*.{ts,tsx} : Use branded types for test isolation
Learnt from: LauraBeatris
PR: clerk/javascript#6117
File: packages/clerk-js/src/ui/components/SessionTasks/index.tsx:64-83
Timestamp: 2025-06-18T16:33:36.764Z
Learning: In SessionTasks component at packages/clerk-js/src/ui/components/SessionTasks/index.tsx, the useEffect that checks for pending tasks should only run on mount (not react to currentTask/status changes) to handle browser back navigation edge cases without interfering with normal task completion flow managed by nextTask().
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/development.mdc:0-0
Timestamp: 2025-06-30T10:29:42.997Z
Learning: React Testing Library for component testing
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/react.mdc:0-0
Timestamp: 2025-06-30T10:32:37.848Z
Learning: Applies to **/*.test.{jsx,tsx} : Implement proper test setup
Learnt from: CR
PR: clerk/javascript#0
File: .cursor/rules/development.mdc:0-0
Timestamp: 2025-06-30T10:29:42.997Z
Learning: Integration tests using Playwright for E2E scenarios
🧬 Code Graph Analysis (4)
packages/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx (1)
packages/clerk-js/src/ui/components/Subscriptions/badge.tsx (1)
  • SubscriptionBadge (18-38)
packages/clerk-js/src/ui/components/Subscriptions/SubscriptionsList.tsx (1)
packages/clerk-js/src/ui/components/Subscriptions/badge.tsx (1)
  • SubscriptionBadge (18-38)
packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx (3)
packages/types/src/commerce.ts (1)
  • CommerceSubscriptionResource (930-1062)
packages/clerk-js/src/ui/components/Subscriptions/badge.tsx (1)
  • SubscriptionBadge (18-38)
packages/clerk-js/src/ui/utils/formatDate.ts (1)
  • formatDate (1-13)
packages/clerk-js/src/ui/components/SubscriptionDetails/__tests__/SubscriptionDetails.test.tsx (3)
packages/clerk-js/src/ui/elements/Drawer.tsx (1)
  • Drawer (556-565)
packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx (1)
  • SubscriptionDetails (58-68)
packages/clerk-js/src/ui/lazyModules/components.ts (1)
  • SubscriptionDetails (110-112)
🪛 GitHub Actions: CI
packages/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx

[error] 131-131: TypeScript error TS6133: 'isPlanActive' is declared but its value is never read.

🪛 ESLint
packages/clerk-js/src/ui/components/SubscriptionDetails/index.tsx

[error] 38-38: 'Span' is defined but never used. Allowed unused vars must match /^_/u.

(@typescript-eslint/no-unused-vars)


[error] 38-38: 'Span' is defined but never used.

(unused-imports/no-unused-imports)


[error] 282-282: 't' is assigned a value but never used. Allowed unused vars must match /^_/u.

(@typescript-eslint/no-unused-vars)

⏰ 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). (2)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (15)
.changeset/salty-spiders-end.md (1)

1-8: LGTM! Well-structured changeset.

The changeset properly documents the packages affected by the past due subscription feature with appropriate minor version bumps. The description clearly states the purpose of the changes.

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

796-796: LGTM! Consistent type addition.

The new past_due_at property follows the established pattern for timestamp fields in the JSON interface, with proper null handling for optional values.

packages/clerk-js/src/ui/contexts/components/Plans.tsx (1)

283-285: LGTM! Proper prioritization of past due state.

The new condition correctly prioritizes the past due state by checking it first, and follows the established pattern of early returns with proper localization key usage.

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

98-98: LGTM! Proper type extension.

The addition of 'past_due' to the subscription status type is appropriate and follows the established pattern for status enums.


977-985: LGTM! Consistent property addition.

The new pastDueAt property follows the established pattern for date properties in the interface, with proper experimental API documentation and appropriate nullable type.

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

23-23: LGTM! Consistent property declaration.

The property declaration follows the established pattern for nullable date properties in the resource class.


55-55: LGTM! Proper timestamp conversion.

The initialization logic correctly handles the optional timestamp, using the established unixEpochToDate utility function when the value is present and defaulting to null otherwise.

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

28-28: LGTM! Good refactoring to centralize badge logic.

The change from inline Badge usage to the SubscriptionBadge component is a solid improvement that centralizes status-based badge rendering logic, making it easier to maintain and ensuring consistency across the application.

Also applies to: 116-116

packages/localizations/src/en-US.ts (1)

51-51: LGTM! Consistent localization support for past due subscriptions.

The new localization strings follow established naming conventions and formatting patterns. The date formatting in badge__pastDueAt is consistent with other date-related strings in the codebase.

Also applies to: 55-55, 134-134

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

733-801: LGTM! Comprehensive test coverage for past due subscription status.

The new test case properly validates the UI behavior for past due subscriptions, covering all key aspects:

  • Status display and badge rendering
  • Date formatting and field visibility
  • Action button state (disabled menu)
  • Proper use of test data and React Testing Library patterns

The test follows the established patterns in the file and provides good coverage for the new functionality.

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

149-151: LGTM! Localization keys properly support the new past due subscription status.

The additions follow the existing patterns:

  • badge__pastDuePlan aligns with other plan status badges
  • badge__pastDueAt correctly accepts a date parameter like other date badges
  • pastDueAt is appropriately placed in the subscription details section

Also applies to: 212-212

packages/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx (1)

27-27: Good refactoring to centralize subscription badge rendering.

The change from inline Badge rendering to the dedicated SubscriptionBadge component improves code reusability and maintains consistency across the UI.

Also applies to: 189-189

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

70-105: Well-implemented support for past due subscriptions in the hook.

The useGuessableSubscription hook properly handles the new past due subscription state:

  • Correctly extends the return type
  • Updates the error condition to accept either active or past due subscriptions
  • Includes past due subscriptions in the anySubscription fallback

209-209: Appropriate action restrictions for past due subscriptions.

The implementation correctly:

  • Disables plan switching and cancellation for past due subscriptions
  • Displays the past due date when available
  • Maintains proper UI state for subscriptions with payment issues

Also applies to: 338-342, 512-517


512-517: No changes needed for pastDueAt null-safety

The pastDueAt property is declared as Date | null in CommerceSubscriptionResource, and the existing

{subscription.pastDueAt ? (
  <DetailRow
    label={localizationKeys('commerce.subscriptionDetails.pastDueAt')}
    value={formatDate(subscription.pastDueAt)}
  />
) : null}

guard ensures formatDate only ever receives a non-null Date. Approved as-is.

@panteliselef panteliselef force-pushed the elef/com-1036-display-past-due-subscriptions-properly branch from 4c245c2 to 497df84 Compare July 14, 2025 17:10
@panteliselef panteliselef changed the title chore(clerk-js): Display past due subscriptions properly fix(clerk-js): Display past due subscriptions properly Jul 14, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jul 14, 2025

Open in StackBlitz

@clerk/agent-toolkit

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

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/elements

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

@clerk/clerk-expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/clerk-react

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

@clerk/react-router

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

@clerk/remix

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/themes

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

@clerk/types

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

@clerk/upgrade

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

@clerk/vue

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

commit: 522a357

@panteliselef panteliselef merged commit dedf487 into main Jul 14, 2025
36 checks passed
@panteliselef panteliselef deleted the elef/com-1036-display-past-due-subscriptions-properly branch July 14, 2025 18:23
jacekradko pushed a commit that referenced this pull request Jul 24, 2025
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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.

4 participants