Skip to content

Conversation

@LauraBeatris
Copy link
Member

@LauraBeatris LauraBeatris commented Nov 5, 2025

Description

This PR allows developers to enable the organization's featureset in-app instead of having to go to the Clerk Dashboard, decreasing friction to build B2B apps.

The prompt only appears for development instances only.

CleanShot 2025-11-10 at 13 25 57
CleanShot.2025-11-10.at.13.25.44.mp4

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:

@LauraBeatris LauraBeatris self-assigned this Nov 5, 2025
@changeset-bot
Copy link

changeset-bot bot commented Nov 5, 2025

⚠️ No Changeset found

Latest commit: 56a47e3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Nov 5, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
clerk-js-sandbox Ready Ready Preview Comment Nov 11, 2025 7:34pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 5, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch laura/enable-orgs

Comment @coderabbitai help to get the list of available commands and usage tips.

Revert pnpm-lock.yaml changes
if (name === 'enableOrganizationsPrompt') {
setState(prev => {
// Modal is already open, don't update state
if (prev.enableOrganizationsPromptModal) {
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 to handle the cases where multiple AIOs/hooks are executed at the same time on a single page.

Showing only one prompt is enough, I don't see that much value in listing all, eg: "You're using useOrganization, OrganizationSwitcher..."

As soon as the environment settings gets patched, then all would be rendered as usual

Comment on lines 165 to 182
${mainCTAStyles};
min-width: 100%;
color: white;
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 30.5%, rgba(0, 0, 0, 0.05) 100%), #454545;
box-shadow:
0px 0px 0px 1px rgba(255, 255, 255, 0.04) inset,
0px 1px 0px 0px rgba(255, 255, 255, 0.04) inset,
0px 0px 0px 1px rgba(0, 0, 0, 0.12),
0px 1.5px 2px 0px rgba(0, 0, 0, 0.48),
0px 0px 4px 0px rgba(243, 107, 22, 0) inset;
&:hover {
box-shadow:
0px 0px 6px 0px rgba(255, 255, 255, 0.04) inset,
0px 0px 0px 1px rgba(255, 255, 255, 0.04) inset,
0px 1px 0px 0px rgba(255, 255, 255, 0.04) inset,
0px 0px 0px 1px rgba(0, 0, 0, 0.1),
0px 1.5px 2px 0px rgba(0, 0, 0, 0.48);
Copy link
Member Author

Choose a reason for hiding this comment

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

I've noticed that for the Keyless Prompt, there's a lot of raw CSS and it might be due to not being part of public components, therefore we don't leverage our design system variables.

That's my assumption, but I want to confirm if that's indeed the case.

@@ -0,0 +1,61 @@
import { css } from '@emotion/react';
Copy link
Member Author

Choose a reason for hiding this comment

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

I've created a shared folder for dev prompts or "in-app" UI, the idea is to keep those sort of components isolated from the public ones.

If the naming doesn't make sense, I'd appreciate feedback on other suggestions.

* A container for prompt components
* @internal
*/
export function PromptContainer({ children, sx, ...props }: React.ComponentProps<typeof Flex>) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Our design for the enable org prompt aims to reuse a bit of the UI from the keyless prompt, especially the container, so I thought would be wise to extract it as shared component.

@LauraBeatris LauraBeatris marked this pull request as ready for review November 10, 2025 16:31
color: #b4b4b4;
font-size: 0.8125rem;
font-weight: 400;
line-height: 1rem;
Copy link
Member

Choose a reason for hiding this comment

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

Static line heights will cause some issues, lets rely on unitless values for line-height

justify-content: center;
width: 100%;
height: 1.75rem;
max-width: 14.625rem;
Copy link
Member

Choose a reason for hiding this comment

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

Is this max-width needed?

0px 1px 0px 0px rgba(255, 255, 255, 0.04) inset,
0px 0px 0px 1px rgba(0, 0, 0, 0.1),
0px 1.5px 2px 0px rgba(0, 0, 0, 0.48);
}
Copy link
Member

Choose a reason for hiding this comment

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

Same here, would be good to have hover+focus-visible styles accounted for.

Comment on lines 50 to 51
width='20'
height='20'
Copy link
Member

@alexcarpenter alexcarpenter Nov 10, 2025

Choose a reason for hiding this comment

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

Lets remove the width+height attributes and use CSS to size to ensure it scales properly.

@LauraBeatris
Copy link
Member Author

I'll also add some telemetry so we can track the amount of times this prompt gets triggered once released

Comment on lines 25 to 43
export const withOrganizationSettingsEnabled =
<TParams extends any[], TReturn>(
hook: (...args: TParams) => TReturn,
getLoadedClerk: () => LoadedClerk | null | undefined,
utilityName?: __internal_EnableOrganizationsPromptProps['utilityName'],
) =>
(...args: TParams): TReturn => {
const clerk = getLoadedClerk();
// @ts-expect-error - __unstable__environment is not typed
const environment = clerk?.__unstable__environment;

if (!environment?.organizationSettings.enabled) {
clerk?.__internal_openEnableOrganizationsPrompt({
utilityName,
});
}

return hook(...args);
};
Copy link
Member

Choose a reason for hiding this comment

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

Using an HoC for hooks seems like an anti-patern. I'd simply do

function useOrganization(){
  useAutoEnablement()
  return useOrganizationOriginal()
}

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought of the HOC in order to be a pure function that could be reused for the hooks from other packages, not React only, so we can receive the Clerk instance as an argument.

// @ts-expect-error - __unstable__environment is not typed
const environment = clerk?.__unstable__environment;

if (!environment?.organizationSettings.enabled) {
Copy link
Member

Choose a reason for hiding this comment

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

Probably we want this to only run in dev instances.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 11, 2025

Open in StackBlitz

@clerk/agent-toolkit

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

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/elements

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

@clerk/clerk-expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/clerk-react

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

@clerk/react-router

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

@clerk/remix

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/themes

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

@clerk/types

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

@clerk/upgrade

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

@clerk/vue

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

commit: b99a632

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.

5 participants