-
Notifications
You must be signed in to change notification settings - Fork 283
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
feat(clerk-js,shared,types): Remove invalid email addresses from input for Organization Invitation #1869
feat(clerk-js,shared,types): Remove invalid email addresses from input for Organization Invitation #1869
Conversation
🦋 Changeset detectedLatest commit: 7397bed The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
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 |
|
||
const invalidEmails = new Set([ | ||
...(err.errors[0].meta?.emailAddresses ?? []), | ||
...(err.errors[0].meta?.identifiers ?? []), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ where is the meta.identifiers
returned? Do we need this? If so, let's add a test to verify that we handle that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's included in the API error. Well i was aiming to test it as part of the removes blocked/not allowed emails from input after error
test, but apparently used the old emailAddresses
parameter. I will update it accordingly
} else { | ||
setLocalizedEmails(null); | ||
handleError(err, [], card.setError); | ||
} | ||
}); | ||
}; | ||
|
||
const removeInvalidEmails = (err: any) => { | ||
if (!isClerkAPIResponseError(err)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ the removal of invalid email addresses was executed only when the error code was duplicate_code
but after this change, it's executed for all error codes. Is this intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
invalid email addresses will be return in meta.emailAddresses
and we want to remove them from the text field despite the error code returned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would like to remove any email addresses included in the meta.emailAddresses
& meta.identifiers
properties regardless the error code
@@ -9,6 +9,7 @@ export interface ClerkAPIError { | |||
paramName?: string; | |||
sessionId?: string; | |||
emailAddresses?: string[]; | |||
identifiers?: string[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chanioxaris Did we introduced that to FAPI ? I don't think we support any other identifier than emails, so is this even useful ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allowlist & Blocklist are working for every identifier type (email_address, phone_number, web3_wallet). So in such an api error we can't limit them to only email addresses or reuse the existing meta parameter emailAddresses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chanioxaris Shall we update the copy here ? (Happy to do it as part of another PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case of Organization Invitations, only email addresses can be provided. Although the API error is used in general for the Allowlist/Blocklist feature
} else { | ||
setLocalizedEmails(null); | ||
handleError(err, [], card.setError); | ||
} | ||
}); | ||
}; | ||
|
||
const removeInvalidEmails = (err: any) => { | ||
if (!isClerkAPIResponseError(err)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
invalid email addresses will be return in meta.emailAddresses
and we want to remove them from the text field despite the error code returned
|
||
const invalidEmails = new Set([ | ||
...(err.errors[0].meta?.emailAddresses ?? []), | ||
...(err.errors[0].meta?.identifiers ?? []), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👆
packages/clerk-js/src/ui/components/OrganizationProfile/InviteMembersForm.tsx
Outdated
Show resolved
Hide resolved
…t for Organization Invitation In invite members screen of the <OrganizationProfile /> component, consume any invalid email addresses as they are returned in the API error and remove them from the input automatically.
86cc9c4
to
7397bed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
This PR has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
In invite members screen of the component, consume any invalid email addresses as they are returned in the API error and remove them from the input automatically.
Before
Screen.Recording.2023-10-12.at.12.08.40.PM.mov
After
Screen.Recording.2023-10-12.at.12.12.54.PM.mov
Checklist
npm test
runs as expected.npm run build
runs as expected.Type of change
Packages affected
@clerk/clerk-js
@clerk/clerk-react
@clerk/nextjs
@clerk/remix
@clerk/types
@clerk/themes
@clerk/localizations
@clerk/clerk-expo
@clerk/backend
@clerk/clerk-sdk-node
@clerk/shared
@clerk/fastify
@clerk/chrome-extension
gatsby-plugin-clerk
build/tooling/chore