Skip to content

chore(clerk-js): Remove Clerk.commerce #5846

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
May 6, 2025
Merged

Conversation

brkalow
Copy link
Member

@brkalow brkalow commented May 6, 2025

Description

Removes the Clerk.commerce namespace in favor of just Clerk.billing. The payment source methods that lived under Clerk.commerce have been moved to Clerk.user and Clerk.organization.

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:

Copy link

changeset-bot bot commented May 6, 2025

🦋 Changeset detected

Latest commit: 05afd9c

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

This PR includes changesets to release 22 packages
Name Type
@clerk/clerk-js Minor
@clerk/clerk-react Minor
@clerk/types Minor
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch
@clerk/elements Patch
@clerk/nextjs Patch
@clerk/react-router Patch
@clerk/remix Patch
@clerk/tanstack-react-start Patch
@clerk/agent-toolkit Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/expo-passkeys Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/localizations Patch
@clerk/nuxt Patch
@clerk/shared 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 May 6, 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 May 6, 2025 4:04am

Copy link
Contributor

@LekoArts LekoArts left a comment

Choose a reason for hiding this comment

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

I think you should also update https://github.com/clerk/javascript/blob/main/.changeset/witty-doors-hear.md because otherwise the changelog is quite confusing. Then the new changeset you can keep minimal as the old one will show the correct one

Copy link
Member

@panteliselef panteliselef left a comment

Choose a reason for hiding this comment

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

Looks good, left some comments about invariant

@@ -29,9 +35,22 @@ export const useCheckoutContext = () => {

const { componentName, ...ctx } = context;

const subscriber = () => {
if (ctx.subscriberType === 'org' && clerk.organization) {
invariant(clerk.organization, 'Clerk: subscriberType is "org" but no active organization was found');
Copy link
Member

Choose a reason for hiding this comment

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

Should we handle this inside the mount/open singleton methods instead ?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is mostly to make types happy without casting, agreed it shouldn't really be necessary in practice

return clerk.organization;
}

invariant(clerk.user, 'Clerk: no active user found');
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this ? openCheckout will not mount any component if user is signed out.

Copy link
Member Author

Choose a reason for hiding this comment

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

Shouldn't be necessary I agree, it's mostly done to satisfy types in this usage.

@brkalow brkalow merged commit a60d0eb into main May 6, 2025
32 checks passed
@brkalow brkalow deleted the brk.feat/remove-clerk-commerce branch May 6, 2025 05:23
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