Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/late-geckos-impress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@clerk/clerk-js': minor
'@clerk/types': minor
---

Accept `skipInvitationScreen` as a prop from OrganizationSwitcher.
Comment thread
panteliselef marked this conversation as resolved.

`skipInvitationScreen` hides the screen for sending invitations after an organization is created.
By default, Clerk will automatically hide the screen if the number of max allowed members is equal to 1
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const OrganizationSwitcherPopover = React.forwardRef<HTMLDivElement, Orga
navigateAfterSelectPersonal,
navigateAfterSelectOrganization,
organizationProfileProps,
skipInvitationScreen,
} = useOrganizationSwitcherContext();

const { user } = useUser();
Expand Down Expand Up @@ -84,7 +85,7 @@ export const OrganizationSwitcherPopover = React.forwardRef<HTMLDivElement, Orga
if (createOrganizationMode === 'navigation') {
return navigateCreateOrganization();
}
return openCreateOrganization({ afterCreateOrganizationUrl });
return openCreateOrganization({ afterCreateOrganizationUrl, skipInvitationScreen });
};

const handleManageOrganizationClicked = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ export const useOrganizationSwitcherContext = () => {
hidePersonal: ctx.hidePersonal || false,
organizationProfileMode: organizationProfileMode || 'modal',
createOrganizationMode: createOrganizationMode || 'modal',
skipInvitationScreen: ctx.skipInvitationScreen || false,
afterCreateOrganizationUrl,
afterLeaveOrganizationUrl,
navigateOrganizationProfile,
Expand Down
8 changes: 6 additions & 2 deletions packages/types/src/clerk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,6 @@ export type OrganizationSwitcherProps = CreateOrganizationMode &
afterSelectOrganizationUrl?:
| ((organization: OrganizationResource) => string)
| LooseExtractedParams<PrimitiveKeys<OrganizationResource>>;

/**
* Full URL or path to navigate after a successful selection of personal workspace.
* Accepts a function that returns URL or path
Expand All @@ -865,13 +864,18 @@ export type OrganizationSwitcherProps = CreateOrganizationMode &
* @default undefined
*/
afterLeaveOrganizationUrl?: string;
/**
* Hides the screen for sending invitations after an organization is created.
* @default undefined When left undefined Clerk will automatically hide the screen if
* the number of max allowed members is equal to 1
*/
skipInvitationScreen?: boolean;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why don't we nest this under createOrganizationProps?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As i mention in the description, I'd like to backport this to v4 as is, in order to follow the same pattern.
I can come back and update the grouping of props for both OrgnanizationSwitcher and OrganizationList only for v5.

/**
* Customisation options to fully match the Clerk components to your own brand.
* These options serve as overrides and will be merged with the global `appearance`
* prop of ClerkProvided (if one is provided)
*/
appearance?: OrganizationSwitcherTheme;

/*
* Specify options for the underlying <OrganizationProfile /> component.
* e.g. <UserButton userProfileProps={{appearance: {...}}} />
Expand Down