Skip to content

Commit

Permalink
feat(clerk-js,elements): Handle new organization membership quota exc…
Browse files Browse the repository at this point in the history
…eeded error for SSO (#4763)
  • Loading branch information
mzhong9723 authored Dec 11, 2024
1 parent 66ad299 commit c7d7f45
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/two-doors-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@clerk/clerk-js': patch
'@clerk/elements': patch
---

Handle organization membership quote exceeded error during enterprise SSO
1 change: 1 addition & 0 deletions packages/clerk-js/src/core/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const ERROR_CODES = {
ENTERPRISE_SSO_HOSTED_DOMAIN_MISMATCH: 'enterprise_sso_hosted_domain_mismatch',
SAML_EMAIL_ADDRESS_DOMAIN_MISMATCH: 'saml_email_address_domain_mismatch',
INVITATION_ACCOUNT_NOT_EXISTS: 'invitation_account_not_exists',
ORGANIZATION_MEMBERSHIP_QUOTA_EXCEEDED_FOR_SSO: 'organization_membership_quota_exceeded_for_sso',
} as const;

export const SIGN_IN_INITIAL_VALUE_KEYS = ['email_address', 'phone_number', 'username'];
Expand Down
1 change: 1 addition & 0 deletions packages/clerk-js/src/ui/components/SignIn/SignInStart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ export function _SignInStart(): JSX.Element {
case ERROR_CODES.ENTERPRISE_SSO_EMAIL_ADDRESS_DOMAIN_MISMATCH:
case ERROR_CODES.ENTERPRISE_SSO_HOSTED_DOMAIN_MISMATCH:
case ERROR_CODES.SAML_EMAIL_ADDRESS_DOMAIN_MISMATCH:
case ERROR_CODES.ORGANIZATION_MEMBERSHIP_QUOTA_EXCEEDED_FOR_SSO:
card.setError(error);
break;
default:
Expand Down
1 change: 1 addition & 0 deletions packages/clerk-js/src/ui/components/SignUp/SignUpStart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ function _SignUpStart(): JSX.Element {
case ERROR_CODES.ENTERPRISE_SSO_EMAIL_ADDRESS_DOMAIN_MISMATCH:
case ERROR_CODES.ENTERPRISE_SSO_HOSTED_DOMAIN_MISMATCH:
case ERROR_CODES.SAML_EMAIL_ADDRESS_DOMAIN_MISMATCH:
case ERROR_CODES.ORGANIZATION_MEMBERSHIP_QUOTA_EXCEEDED_FOR_SSO:
card.setError(error);
break;
default:
Expand Down
1 change: 1 addition & 0 deletions packages/elements/src/internals/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const ERROR_CODES = {
ENTERPRISE_SSO_EMAIL_ADDRESS_DOMAIN_MISMATCH: 'enterprise_sso_email_address_domain_mismatch',
ENTERPRISE_SSO_HOSTED_DOMAIN_MISMATCH: 'enterprise_sso_hosted_domain_mismatch',
SAML_EMAIL_ADDRESS_DOMAIN_MISMATCH: 'saml_email_address_domain_mismatch',
ORGANIZATION_MEMBERSHIP_QUOTA_EXCEEDED_FOR_SSO: 'organization_membership_quota_exceeded_for_sso',
};

export const ROUTING = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export const SignInRouterMachine = setup({
case ERROR_CODES.ENTERPRISE_SSO_EMAIL_ADDRESS_DOMAIN_MISMATCH:
case ERROR_CODES.ENTERPRISE_SSO_HOSTED_DOMAIN_MISMATCH:
case ERROR_CODES.SAML_EMAIL_ADDRESS_DOMAIN_MISMATCH:
case ERROR_CODES.ORGANIZATION_MEMBERSHIP_QUOTA_EXCEEDED_FOR_SSO:
error = new ClerkElementsError(errorOrig.code, errorOrig.longMessage || '');
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export const SignUpRouterMachine = setup({
case ERROR_CODES.ENTERPRISE_SSO_EMAIL_ADDRESS_DOMAIN_MISMATCH:
case ERROR_CODES.ENTERPRISE_SSO_HOSTED_DOMAIN_MISMATCH:
case ERROR_CODES.SAML_EMAIL_ADDRESS_DOMAIN_MISMATCH:
case ERROR_CODES.ORGANIZATION_MEMBERSHIP_QUOTA_EXCEEDED_FOR_SSO:
error = new ClerkElementsError(errorOrig.code, errorOrig.longMessage!);
break;
default:
Expand Down

0 comments on commit c7d7f45

Please sign in to comment.