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.
❓ 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.
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
| }; | ||
|
|
||
| const removeInvalidEmails = (err: any) => { | ||
| if (!isClerkAPIResponseError(err)) { |
There was a problem hiding this comment.
❓ 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.
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.
We would like to remove any email addresses included in the meta.emailAddresses & meta.identifiers properties regardless the error code
| paramName?: string; | ||
| sessionId?: string; | ||
| emailAddresses?: string[]; | ||
| identifiers?: string[]; |
There was a problem hiding this comment.
@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.
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.
@chanioxaris Shall we update the copy here ? (Happy to do it as part of another PR)

There was a problem hiding this comment.
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
| }; | ||
|
|
||
| const removeInvalidEmails = (err: any) => { | ||
| if (!isClerkAPIResponseError(err)) { |
There was a problem hiding this comment.
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 ?? []), |
…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
|
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 testruns as expected.npm run buildruns 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-extensiongatsby-plugin-clerkbuild/tooling/chore