-
Notifications
You must be signed in to change notification settings - Fork 382
chore(clerk-js,shared): Removal of experimental getSubscriptions
#6738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
`organization.getSubscriptions()` and `billing.getSubscriptions()`
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 84b3675 The changes in this PR will be included in the next version bump. This PR includes changesets to release 22 packages
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 |
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the WalkthroughRemoves experimental billing subscriptions listing across runtime, hooks, and public types: deletes Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant UI as useOrganization (hook)
participant Org as Organization resource
participant Billing as CommerceBilling
participant API as /commerce/subscriptions
rect rgba(200,230,201,0.45)
Note left of UI: Before — subscription listing flow
UI->>Org: getSubscriptions(params)
Org->>Billing: getSubscriptions(params)
Billing->>API: GET /organizations/{id}/commerce/subscriptions
API-->>Billing: 200 paginated JSON
Billing-->>Org: mapped CommerceSubscriptionItems
Org-->>UI: paginated subscriptions
end
rect rgba(255,224,178,0.35)
Note left of UI: After — flow removed
UI-xOrg: no getSubscriptions call
Org-xBilling: no getSubscriptions call
Billing-xAPI: endpoint no longer used
Org-->>UI: subscriptions field removed from return
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks (3 passed)✅ Passed checks (3 passed)
✨ Finishing Touches
🧪 Generate unit tests
Comment |
getSubscriptions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.changeset/chilly-dots-heal.md (1)
7-7
: Remove stray trailing character.There is a solitary
7
at EOF. It will render in the changelog. Please delete it.-7
🧹 Nitpick comments (4)
.changeset/chilly-dots-heal.md (1)
6-6
: Strengthen the changeset with migration notes and deprecation context.Add a short migration blurb (replacement or “no replacement”) and note the prior experimental status to reduce churn for consumers scanning the changelog.
-[Billing Beta] Removal of Billing experimental methods: `organization.getSubscriptions()` and `billing.getSubscriptions()` +[Billing Beta] BREAKING: Removed experimental methods `organization.getSubscriptions()` and `billing.getSubscriptions()`. + +- These methods were part of the Billing Beta/experimental surface and are now removed. +- There is currently no direct replacement. If you need subscription data, please use <your recommended path here> or contact support. +- This removal only affects Beta surfaces and does not impact stable billing APIs.packages/types/src/organization.ts (1)
31-37
: Docs touch-up (optional): annotate Beta removal in JSDoc for discoverability.Consider adding a one-line note in the interface doc that Billing Beta subscription listing has been removed, pointing to the changelog.
packages/clerk-js/src/core/resources/Organization.ts (2)
41-45
: Type nullability for slug (optional correctness).
slug!: string;
but the types defineslug: string | null
andfromJSON
assignsdata.slug
which can benull
. Consider widening to avoid a latent null-at-runtime mismatch.- slug!: string; + slug!: string | null;
161-177
: Naming nit: “suggestions” → “memberships”.Local variable and mapping names refer to “suggestions”, which is misleading in a memberships endpoint. Rename for clarity (no behavior change).
- const { data: suggestions, total_count } = + const { data: memberships, total_count } = res?.response as unknown as ClerkPaginatedResponse<OrganizationMembershipJSON>; return { total_count, - data: suggestions.map(suggestion => new OrganizationMembership(suggestion)), + data: memberships.map(m => new OrganizationMembership(m)), };
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (6)
.changeset/chilly-dots-heal.md
(1 hunks)packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts
(0 hunks)packages/clerk-js/src/core/resources/Organization.ts
(1 hunks)packages/shared/src/react/hooks/useOrganization.tsx
(0 hunks)packages/types/src/commerce.ts
(0 hunks)packages/types/src/organization.ts
(1 hunks)
💤 Files with no reviewable changes (3)
- packages/shared/src/react/hooks/useOrganization.tsx
- packages/types/src/commerce.ts
- packages/clerk-js/src/core/modules/commerce/CommerceBilling.ts
🧰 Additional context used
📓 Path-based instructions (7)
.changeset/**
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Automated releases must use Changesets.
Files:
.changeset/chilly-dots-heal.md
**/*.{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/organization.ts
packages/clerk-js/src/core/resources/Organization.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/types/src/organization.ts
packages/clerk-js/src/core/resources/Organization.ts
packages/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
packages/types/src/organization.ts
packages/clerk-js/src/core/resources/Organization.ts
packages/**/*.{ts,tsx,d.ts}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Packages should export TypeScript types alongside runtime code
Files:
packages/types/src/organization.ts
packages/clerk-js/src/core/resources/Organization.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
Avoidany
type - preferunknown
when type is uncertain, then narrow with type guards
Useinterface
for object shapes that might be extended
Usetype
for unions, primitives, and computed types
Preferreadonly
properties for immutable data structures
Useprivate
for internal implementation details
Useprotected
for inheritance hierarchies
Usepublic
explicitly for clarity in public APIs
Preferreadonly
for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Useconst assertions
for literal types:as const
Usesatisfies
operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports:import type { ... } from ...
Noany
types without justification
Proper error handling with typed errors
Consistent use ofreadonly
for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)
Files:
packages/types/src/organization.ts
packages/clerk-js/src/core/resources/Organization.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/types/src/organization.ts
packages/clerk-js/src/core/resources/Organization.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). (8)
- GitHub Check: pr-title-lint
- GitHub Check: pr-title-lint
- GitHub Check: Formatting | Dedupe | Changeset
- GitHub Check: Build Packages
- GitHub Check: semgrep/ci
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: semgrep-cloud-platform/scan
- GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (5)
.changeset/chilly-dots-heal.md (1)
1-4
: Semver level: confirm whether this should be a major bump (API removal), even if “Billing Beta”.Removing public methods (even experimental) from
@clerk/clerk-js
and@clerk/types
is a breaking change for consumers compiling against these types. If your policy allows removals of clearly-marked Beta/experimental APIs under minor, keep as-is; otherwise, bump tomajor
for safety.Suggested diff if you decide to mark as major:
--- -'@clerk/clerk-js': minor -'@clerk/types': minor +'@clerk/clerk-js': major +'@clerk/types': major ---packages/types/src/organization.ts (2)
38-69
: Removal from OrganizationResource: looks consistent with the PR intent.
getSubscriptions
is gone from the public interface; dependent commerce subscription types are also absent. This aligns with the stated objective.
1-1
: No dangling references to removed APIs/types
Verified thatorganization.getSubscriptions
is no longer called and no residual references to the removed types exist outside of their intended definitions and changelogs.packages/clerk-js/src/core/resources/Organization.ts (2)
32-32
: Import cleanup aligns with removal.Subscription-related imports are gone; only
BaseResource
,OrganizationInvitation
, andOrganizationMembership
remain. Matches the types change.
1-27
: Remove irrelevant guardrail for getSubscriptions in Organization.ts – this file doesn’t referencebilling.getSubscriptions
or anyCommerceSubscriptionItem*
types; there are no callsites to remove.Likely an incorrect or invalid review comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.changeset/upset-masks-ask.md (1)
13-13
: Tighten wording and make docs guidance framework-agnostic.Say “params object” and avoid a Next.js-specific link since multiple packages are bumped.
Apply:
-[Billing Beta] Drop experimental `subscriptions` property from params of `useOrganization()`. Use [`useSubscription()`](https://clerk.com/docs/nextjs/hooks/use-subscription) instead. +[Billing Beta] Drop experimental `subscriptions` property from the params object of `useOrganization()`. Migrate to `useSubscription()` instead (see framework-specific docs). + +Migration: + +Before: +```ts +useOrganization({ subscriptions: { /* ... */ } }) +``` +After: +```ts +const subscription = useSubscription(); +const org = useOrganization(); +```
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
.changeset/upset-masks-ask.md
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/**
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Automated releases must use Changesets.
Files:
.changeset/upset-masks-ask.md
⏰ 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: semgrep/ci
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: semgrep-cloud-platform/scan
- GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (2)
.changeset/upset-masks-ask.md (2)
1-11
: Frontmatter looks valid for a multi-package minor bump.Packages list and Changesets format are correct.
1-13
: Semver and changesets coverage is complete
Companion changeset.changeset/chilly-dots-heal.md
covers the experimental removals, nogetSubscriptions
references remain, and both@clerk/types
and@clerk/clerk-js
are versioned.
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/elements
@clerk/clerk-expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/clerk-react
@clerk/react-router
@clerk/remix
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/themes
@clerk/types
@clerk/upgrade
@clerk/vue
commit: |
51886cf
to
40ad28e
Compare
getSubscriptions
getSubscriptions
Description
We are dropping the experimental
Clerk.organization.getSubscriptions()
andClerk.billing.getSubscriptions()
methods. A replacement is already in placeClerk.billing.getSubscription()
.Checklist
pnpm test
runs as expected.pnpm build
runs as expected.Type of change
Summary by CodeRabbit