Skip to content

Commit 9737ef5

Browse files
authoredFeb 5, 2024
feat(clerk-js): Accept skipInvitationScreen as a prop from OrganizationSwitcher (#2713)
* feat(clerk-js): Accept `skipInvitationScreen` as a prop from OrganizationSwitcher * chore(clerk-js): Improve changeset
1 parent 13cfbf4 commit 9737ef5

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed
 

‎.changeset/late-geckos-impress.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@clerk/clerk-js': minor
3+
'@clerk/types': minor
4+
---
5+
6+
Accept `skipInvitationScreen` as a prop from OrganizationSwitcher.
7+
8+
`skipInvitationScreen` hides the screen for sending invitations after an organization is created.
9+
By default, Clerk will automatically hide the screen if the number of max allowed members is equal to 1

‎packages/clerk-js/src/ui/components/OrganizationSwitcher/OrganizationSwitcherPopover.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const OrganizationSwitcherPopover = React.forwardRef<HTMLDivElement, Orga
4848
navigateAfterSelectPersonal,
4949
navigateAfterSelectOrganization,
5050
organizationProfileProps,
51+
skipInvitationScreen,
5152
} = useOrganizationSwitcherContext();
5253

5354
const { user } = useUser();
@@ -84,7 +85,7 @@ export const OrganizationSwitcherPopover = React.forwardRef<HTMLDivElement, Orga
8485
if (createOrganizationMode === 'navigation') {
8586
return navigateCreateOrganization();
8687
}
87-
return openCreateOrganization({ afterCreateOrganizationUrl });
88+
return openCreateOrganization({ afterCreateOrganizationUrl, skipInvitationScreen });
8889
};
8990

9091
const handleManageOrganizationClicked = () => {

‎packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ export const useOrganizationSwitcherContext = () => {
335335
hidePersonal: ctx.hidePersonal || false,
336336
organizationProfileMode: organizationProfileMode || 'modal',
337337
createOrganizationMode: createOrganizationMode || 'modal',
338+
skipInvitationScreen: ctx.skipInvitationScreen || false,
338339
afterCreateOrganizationUrl,
339340
afterLeaveOrganizationUrl,
340341
navigateOrganizationProfile,

‎packages/types/src/clerk.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,6 @@ export type OrganizationSwitcherProps = CreateOrganizationMode &
853853
afterSelectOrganizationUrl?:
854854
| ((organization: OrganizationResource) => string)
855855
| LooseExtractedParams<PrimitiveKeys<OrganizationResource>>;
856-
857856
/**
858857
* Full URL or path to navigate after a successful selection of personal workspace.
859858
* Accepts a function that returns URL or path
@@ -865,13 +864,18 @@ export type OrganizationSwitcherProps = CreateOrganizationMode &
865864
* @default undefined
866865
*/
867866
afterLeaveOrganizationUrl?: string;
867+
/**
868+
* Hides the screen for sending invitations after an organization is created.
869+
* @default undefined When left undefined Clerk will automatically hide the screen if
870+
* the number of max allowed members is equal to 1
871+
*/
872+
skipInvitationScreen?: boolean;
868873
/**
869874
* Customisation options to fully match the Clerk components to your own brand.
870875
* These options serve as overrides and will be merged with the global `appearance`
871876
* prop of ClerkProvided (if one is provided)
872877
*/
873878
appearance?: OrganizationSwitcherTheme;
874-
875879
/*
876880
* Specify options for the underlying <OrganizationProfile /> component.
877881
* e.g. <UserButton userProfileProps={{appearance: {...}}} />

0 commit comments

Comments
 (0)
Please sign in to comment.