feat(core, react): unify invitation connection picker across providers and user directories - #430
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/react/src/types/my-organization/member-management/organization-invitation-table-types.ts (1)
36-45: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winMake the connection payload required and mutually exclusive.
Both fields are optional, so callers can submit no connection or both IDs despite the required-picker contract. Model this as a discriminated union so invalid invitation payloads cannot reach the mutation.
Proposed type shape
-export interface CreateInvitationInput { +type CreateInvitationInputBase = { invitees: Array<{ email: string; roles?: string[]; }>; inviter?: { name?: string; }; - identity_provider_id?: string; - user_store_id?: string; /** Time to live in seconds */ ttl_sec?: number; -} +}; + +export type CreateInvitationInput = CreateInvitationInputBase & + ( + | { identity_provider_id: string; user_store_id?: never } + | { identity_provider_id?: never; user_store_id: string } + );🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/react/src/types/my-organization/member-management/organization-invitation-table-types.ts` around lines 36 - 45, Update CreateInvitationInput so the connection fields use a discriminated union requiring exactly one of identity_provider_id or user_store_id, while preserving the shared invitees and inviter fields. Make each union branch require its selected ID and disallow the other, preventing payloads with neither or both connection IDs.
🧹 Nitpick comments (5)
packages/react/src/components/auth0/my-organization/shared/member-management/invitations/invitation-details/__tests__/organization-invitation-details-modal.test.tsx (2)
198-199: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMake the
describeblock condition-oriented.Use a
when...condition such asdescribe('when the invitation has a connection', ...), with separate condition blocks for the unassigned case. As per coding guidelines, describes should express conditions withwhen...anditnames should describe actions.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/react/src/components/auth0/my-organization/shared/member-management/invitations/invitation-details/__tests__/organization-invitation-details-modal.test.tsx` around lines 198 - 199, Update the invitation-details modal test suite’s connection describe block to use a condition-oriented name such as “when the invitation has a connection.” Add a separate “when…” describe block for the unassigned-connection case, and keep each it name focused on the behavior or action being tested.Source: Coding guidelines
232-241: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCover the missing-name fallback, not only missing connections.
This test exercises
connection === undefined; add a case where the matching connection exists but has no name, and assert that the connection ID is displayed.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/react/src/components/auth0/my-organization/shared/member-management/invitations/invitation-details/__tests__/organization-invitation-details-modal.test.tsx` around lines 232 - 241, Add a test case alongside “should show connection ID as fallback when connection not found” that supplies a matching available connection without a name, then renders OrganizationInvitationDetailsModal and asserts the invitation’s connection ID is displayed. Keep the existing missing-connection case unchanged and target the connection-name fallback behavior.packages/react/src/components/auth0/my-organization/shared/member-management/shared/invitation-create/__tests__/organization-invitation-create-modal.test.tsx (1)
213-343: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse the required condition/action test naming.
Rename the suite to a
when...condition and removeshouldprefixes fromitnames, e.g.describe('when connection options are available', ...)andit('submits user_store_id for a selected user store', ...). As per coding guidelines, tests underpackages/*/src/**/__tests__/*.test.{ts,tsx}must describe conditions withwhen...and actions in theitname.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/react/src/components/auth0/my-organization/shared/member-management/shared/invitation-create/__tests__/organization-invitation-create-modal.test.tsx` around lines 213 - 343, Rename the availableConnections test suite to the required when-condition form, such as “when connection options are available,” and remove “should” prefixes from every it description within it. Keep each test’s existing behavior and assertions unchanged while phrasing names as actions and outcomes, including the identity-provider and user-store submission cases.Source: Coding guidelines
packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts (1)
100-104: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove the unnecessary
as constassertions.ConnectionOption[]already supplies the discriminated target shape; use contextual typing or explicitly returnConnectionOptionfrom each mapper instead.
packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts#L100-L104: type the provider mapper asConnectionOptionwithoutas const.packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts#L118-L122: type the user-store mapper asConnectionOptionwithoutas const.As per coding guidelines, “Avoid type assertions (
as) unless there is no other option.”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts` around lines 100 - 104, Remove the unnecessary `as const` assertions from both the provider mapper at packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts#L100-L104 and the user-store mapper at packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts#L118-L122. Type each mapper result as `ConnectionOption` or rely on contextual typing so the discriminated `type` field remains correctly inferred.Source: Coding guidelines
packages/react/src/hooks/my-organization/__tests__/use-member-management-service.test.ts (1)
101-124: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse the repository’s Vitest naming convention.
packages/react/src/hooks/my-organization/__tests__/use-member-management-service.test.ts#L101-L124: renameit('should map …')to an action-oriented name.packages/react/src/hooks/my-organization/__tests__/use-member-management-service.test.ts#L127-L178: split or rename thedescribe('userStoresQuery')cases intodescribe('when …')conditions and action-orientedit(...)names.packages/react/src/hooks/my-organization/__tests__/use-member-management-service.test.ts#L416-L434: renameit('should forward …')to an action-oriented name.As per coding guidelines, use
describeconditions beginning with “when…” and action-orienteditnames.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/react/src/hooks/my-organization/__tests__/use-member-management-service.test.ts` around lines 101 - 124, Update packages/react/src/hooks/my-organization/__tests__/use-member-management-service.test.ts at lines 101-124 to rename the identity-provider test with an action-oriented it name; at lines 127-178, organize the userStoresQuery cases under describe conditions beginning with “when…” and give each case action-oriented it names; and at lines 416-434, rename the forwarding test to an action-oriented it name, preserving all test behavior.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@packages/react/src/components/auth0/my-organization/shared/member-management/invitations/invitation-details/organization-invitation-details-modal.tsx`:
- Around line 259-265: Update the connection label in the invitation details
modal’s connectionName block to use the new connection-neutral translation key
instead of invitation.details.provider_label, and update the corresponding
assertion to expect the neutral label for both identity providers and user
stores.
In
`@packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts`:
- Line 306: Update resendInvitationMutation to preserve the original
invitation’s connection identifiers when recreating it: forward user_store_id
and identity_provider_id as available, and explicitly handle legacy invitations
where neither is present according to the existing invitation validation
behavior.
- Around line 112-124: Update the user-store loading callback around
organization.userStores.get so it retrieves every paginated response before
filtering and mapping results. Follow each response.next via the SDK’s
pagination mechanism, or use its all-pages helper, then combine all page data
and preserve the existing normalization and option fields.
---
Outside diff comments:
In
`@packages/react/src/types/my-organization/member-management/organization-invitation-table-types.ts`:
- Around line 36-45: Update CreateInvitationInput so the connection fields use a
discriminated union requiring exactly one of identity_provider_id or
user_store_id, while preserving the shared invitees and inviter fields. Make
each union branch require its selected ID and disallow the other, preventing
payloads with neither or both connection IDs.
---
Nitpick comments:
In
`@packages/react/src/components/auth0/my-organization/shared/member-management/invitations/invitation-details/__tests__/organization-invitation-details-modal.test.tsx`:
- Around line 198-199: Update the invitation-details modal test suite’s
connection describe block to use a condition-oriented name such as “when the
invitation has a connection.” Add a separate “when…” describe block for the
unassigned-connection case, and keep each it name focused on the behavior or
action being tested.
- Around line 232-241: Add a test case alongside “should show connection ID as
fallback when connection not found” that supplies a matching available
connection without a name, then renders OrganizationInvitationDetailsModal and
asserts the invitation’s connection ID is displayed. Keep the existing
missing-connection case unchanged and target the connection-name fallback
behavior.
In
`@packages/react/src/components/auth0/my-organization/shared/member-management/shared/invitation-create/__tests__/organization-invitation-create-modal.test.tsx`:
- Around line 213-343: Rename the availableConnections test suite to the
required when-condition form, such as “when connection options are available,”
and remove “should” prefixes from every it description within it. Keep each
test’s existing behavior and assertions unchanged while phrasing names as
actions and outcomes, including the identity-provider and user-store submission
cases.
In
`@packages/react/src/hooks/my-organization/__tests__/use-member-management-service.test.ts`:
- Around line 101-124: Update
packages/react/src/hooks/my-organization/__tests__/use-member-management-service.test.ts
at lines 101-124 to rename the identity-provider test with an action-oriented it
name; at lines 127-178, organize the userStoresQuery cases under describe
conditions beginning with “when…” and give each case action-oriented it names;
and at lines 416-434, rename the forwarding test to an action-oriented it name,
preserving all test behavior.
In
`@packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts`:
- Around line 100-104: Remove the unnecessary `as const` assertions from both
the provider mapper at
packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts#L100-L104
and the user-store mapper at
packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts#L118-L122.
Type each mapper result as `ConnectionOption` or rely on contextual typing so
the discriminated `type` field remains correctly inferred.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a6e86c84-160a-4f1c-887d-3ac94fec1992
📒 Files selected for processing (19)
packages/core/src/i18n/custom-messages/my-organization/member-management/invitation-tab-types.tspackages/core/src/i18n/translations/en-US.jsonpackages/core/src/i18n/translations/ja.jsonpackages/core/src/services/my-organization/member-management/member-management-constants.tspackages/core/src/services/my-organization/member-management/member-management-types.tspackages/react/src/__tests__/utils/test-helpers.tspackages/react/src/components/auth0/my-organization/__tests__/organization-member-management.test.tsxpackages/react/src/components/auth0/my-organization/organization-member-management.tsxpackages/react/src/components/auth0/my-organization/shared/member-management/invitations/invitation-details/__tests__/organization-invitation-details-modal.test.tsxpackages/react/src/components/auth0/my-organization/shared/member-management/invitations/invitation-details/organization-invitation-details-modal.tsxpackages/react/src/components/auth0/my-organization/shared/member-management/shared/invitation-create/__tests__/organization-invitation-create-modal.test.tsxpackages/react/src/components/auth0/my-organization/shared/member-management/shared/invitation-create/organization-invitation-create-modal.tsxpackages/react/src/hooks/my-organization/__tests__/use-member-management-service.test.tspackages/react/src/hooks/my-organization/shared/services/use-member-management-service.tspackages/react/src/hooks/my-organization/use-organization-member-management.tspackages/react/src/tests/utils/__mocks__/core/core-client.mocks.tspackages/react/src/tests/utils/__mocks__/my-organization/member-management/invitation.mocks.tspackages/react/src/types/my-organization/member-management/organization-invitation-table-types.tspackages/react/src/types/my-organization/member-management/organization-member-management-types.ts
| {/* Connection (identity provider or user directory) */} | ||
| {connectionName && ( | ||
| <div className="space-y-2"> | ||
| <Label className="text-sm font-medium text-muted-foreground"> | ||
| {t('invitation.details.provider_label')} | ||
| </Label> | ||
| <TextField value={providerName} readOnly /> | ||
| <TextField value={connectionName} readOnly /> |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Use a connection-neutral label for both connection types.
This block now displays identity providers and user stores, but still renders invitation.details.provider_label. If that translation is provider-specific, user-store invitations will be mislabeled. Use the new connection-specific/neutral translation key and update the corresponding assertion.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@packages/react/src/components/auth0/my-organization/shared/member-management/invitations/invitation-details/organization-invitation-details-modal.tsx`
around lines 259 - 265, Update the connection label in the invitation details
modal’s connectionName block to use the new connection-neutral translation key
instead of invitation.details.provider_label, and update the corresponding
assertion to expect the neutral label for both identity providers and user
stores.
| const page = await coreClient! | ||
| .getMyOrganizationApiClient() | ||
| .organization.userStores.get({ is_enabled: true }); | ||
| const userStores = page.data ?? []; | ||
| return userStores | ||
| .filter((store) => !!store.id) | ||
| .map((store) => ({ | ||
| id: store.id!, | ||
| name: store.display_name ?? store.name ?? store.id!, | ||
| type: 'user_store' as const, | ||
| })); | ||
| }, | ||
| enabled: !!coreClient && isActiveTabProvided, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n -C5 '\.organization\.userStores\.get\(' packages
rg -n -C5 'response\.next|userStoresQuery|user_store_id' packages/react packages/coreRepository: auth0/auth0-ui-components
Length of output: 37728
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Locate userStores symbols in packages"
rg -n "userStores|next:" packages || true
echo
echo "Inspect target service around queryFn and mock setup"
sed -n '90,180p' packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts
echo
sed -n '120,190p' packages/react/src/hooks/my-organization/__tests__/use-member-management-service.test.ts
echo
echo "Find SDK/client package files that define UserStores or get behavior"
git ls-files packages | rg -n 'UserStores|userStores|users|organizations' || trueRepository: auth0/auth0-ui-components
Length of output: 11915
🌐 Web query:
Auth0 Node.js SDK MyOrganizationApiClient organization userStores get response next pagination
💡 Result:
In the Auth0 Management SDK, when retrieving organization members using the members.list method, you can handle pagination using either offset-based or checkpoint-based pagination [1][2]. Checkpoint pagination is required when you need to retrieve more than 1000 organization members [1][2]. The process for using checkpoint pagination is as follows: 1. Initial Request: Call the list method without providing a 'from' parameter [1][2]. 2. Subsequent Requests: The response object will contain a 'next' value if more results are available [1][2]. Use this 'next' value as the 'from' parameter in your subsequent API calls [1][2]. 3. Completion: When the 'next' value is no longer present in the response, it indicates that there are no more pages remaining [1][2]. The parameters for checkpoint pagination are: - from: The ID from which to start the selection (omit this for the first call) [1][2][3]. - take: The number of entries to retrieve (defaults to 50) [1][2][3]. Note that if you are using the dedicated MyOrganization SDK (@auth0/myorganization-js), the pagination pattern is generally handled through pageable objects that provide methods like getNextPage [4][5]. If the SDK version you are using returns a pageable object with a 'next' property or a 'getNextPage' helper, you should utilize those methods for consistent traversal [5]. If you encounter a scenario where a 'next' value is returned even when no further results exist, it is recommended to verify the specific SDK behavior or implement a check to see if the returned list of members is empty [6]. Always ensure your Management API token has the necessary 'read:organization_members' scope [2][7].
Citations:
- 1: https://auth0.github.io/node-auth0/classes/management.SDK.MembersClient-1.html
- 2: https://auth0.com/docs/api/management/v2/organizations/get-organization-members
- 3: https://auth0.github.io/node-auth0/interfaces/management.Management.ListOrganizationMembersRequestParameters.html
- 4: https://github.com/auth0/myorganization-js/blob/main/reference.md
- 5: https://auth0.github.io/node-auth0/
- 6: https://community.auth0.com/t/get-organization-members-with-take-query-parameter-returns-next-when-no-further-results/134281
- 7: https://auth0.mintlify.app/docs/manage-users/organizations/configure-organizations/retrieve-members
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Package files mentioning `@auth0/myorganization` or management SDK"
rg -n '"`@auth0/myorganization`|`@auth0/node`|from `@auth0/myorganization`|useMyOrganization|MyOrganizationApiClient|organization\.userStores|userStores' \
package.json packages package-lock.json pnpm-lock.yaml yarn.lock 2>/dev/null || true
echo
echo "Read only first package manifests"
if [ -f package.json ]; then sed -n '1,220p' package.json; fi
echo
echo "Search lockfiles for package versions"
rg -n '`@auth0/`(myorganization|node|management|auth0-mgmt-client)' package-lock.json pnpm-lock.yaml yarn.lock 2>/dev/null || trueRepository: auth0/auth0-ui-components
Length of output: 42229
🌐 Web query:
"@auth0/myorganization-js" "1.1.0" userStores get nextPage
💡 Result:
The @auth0/myorganization-js SDK utilizes a cursor-based pagination pattern for its list-oriented operations (e.g., client.organization.domains.list) rather than a method explicitly named get nextPage [1][2]. In this SDK, paginated methods return a Page object [1][2]. To retrieve subsequent pages, you can iterate through the results using the hasNextPage() method in combination with getNextPage() [1]. Example usage: // Retrieve the first page of results let page = await client.organization.domains.list({ take: 1, // Example parameter }); // Iterate through remaining pages while (page.hasNextPage) { page = await page.getNextPage; } The getNextPage() method returns a new Page object containing the subsequent set of records, allowing for a structured, type-safe approach to consuming paginated API responses [1][2]. If you are not using the SDK's abstraction and are instead interacting with the underlying API via a proxy or direct fetch, pagination is typically handled via query parameters such as from and take, where the response body provides a cursor for the next request [1][2][3].
Citations:
- 1: https://github.com/auth0/myorganization-js/blob/main/reference.md
- 2: https://github.com/auth0/myorganization-js/blob/main/CHANGELOG.md
- 3: https://auth0-nextjs-auth0.mintlify.app/advanced/my-account-api-proxy
Fetch all user-store pages before normalizing.
This only normalizes the first userStores.get() page, so any user stores beyond the initial cursor remain unavailable for invitation creation. Page through response.next, hasNextPage()/getNextPage(), or use the SDK’s all-pages helper before merging options.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts`
around lines 112 - 124, Update the user-store loading callback around
organization.userStores.get so it retrieves every paginated response before
filtering and mapping results. Follow each response.next via the SDK’s
pagination mechanism, or use its all-pages helper, then combine all page data
and preserve the existing normalization and option fields.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts (1)
109-123: 🎯 Functional Correctness | 🟠 MajorFetch all enabled user-store pages before normalizing.
userStores.get()is called once andpage.nextis never consumed, so user stores beyond the first page are omitted from the available connections. Follow the SDK’s pagination mechanism, concatenate all pages, and add a multi-page test; the current test only coversnext: null.#!/bin/bash set -euo pipefail rg -n -C5 'organization\.userStores\.get|hasNextPage|getNextPage|response\.next|user_stores' \ packages/react packages/core🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts` around lines 109 - 123, Update the userStores queryFn to follow the SDK pagination mechanism from organization.userStores.get, repeatedly fetch and concatenate every page while page.next is present, then filter and map the complete collection. Add or update the multi-page test for the userStores query, retaining coverage for the next: null termination case.
🧹 Nitpick comments (1)
packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts (1)
98-104: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAvoid the
as constassertions in both mappings.These assertions are only needed because the callbacks lack a contextual
ConnectionOptionreturn type. Annotate each callback as returningConnectionOption(and keep the existing ID narrowing) so the literaltypevalues are inferred withoutas.Proposed refactor
- .map((p) => ({ + .map((p): ConnectionOption => ({ id: p.id!, name: p.display_name ?? p.name ?? p.id!, - type: 'identity_provider' as const, + type: 'identity_provider', })); ... - .map((store) => ({ + .map((store): ConnectionOption => ({ id: store.id!, name: store.display_name ?? store.name ?? store.id!, - type: 'user_store' as const, + type: 'user_store', }));Also applies to: 116-122
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts` around lines 98 - 104, Update both provider mapping callbacks in the member-management service to explicitly return ConnectionOption, preserving the existing ID narrowing and field values. Remove the `as const` assertions from each literal `type` field so the callback return annotation provides the required literal typing.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts`:
- Around line 361-369: The resend flow around the invitation deletion and
recreation must handle legacy invitations lacking both connection identifiers
before deleting the existing invitation. Validate that identityProviderId or
userStoreId is available, or explicitly route this case through the supported
legacy-invitation behavior, and ensure creation cannot fail after deletion while
leaving the invitation lost.
---
Duplicate comments:
In
`@packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts`:
- Around line 109-123: Update the userStores queryFn to follow the SDK
pagination mechanism from organization.userStores.get, repeatedly fetch and
concatenate every page while page.next is present, then filter and map the
complete collection. Add or update the multi-page test for the userStores query,
retaining coverage for the next: null termination case.
---
Nitpick comments:
In
`@packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts`:
- Around line 98-104: Update both provider mapping callbacks in the
member-management service to explicitly return ConnectionOption, preserving the
existing ID narrowing and field values. Remove the `as const` assertions from
each literal `type` field so the callback return annotation provides the
required literal typing.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: bc75cacd-9948-4ebf-8109-623b5cd1ae8d
📒 Files selected for processing (8)
packages/core/src/i18n/custom-messages/my-organization/member-management/invitation-tab-types.tspackages/core/src/i18n/translations/en-US.jsonpackages/core/src/i18n/translations/ja.jsonpackages/react/src/components/auth0/my-organization/shared/member-management/invitations/invitation-details/__tests__/organization-invitation-details-modal.test.tsxpackages/react/src/components/auth0/my-organization/shared/member-management/invitations/invitation-details/organization-invitation-details-modal.tsxpackages/react/src/hooks/my-organization/__tests__/use-member-management-service.test.tspackages/react/src/hooks/my-organization/shared/services/use-member-management-service.tspackages/react/src/tests/utils/__mocks__/my-organization/member-management/invitation.mocks.ts
🚧 Files skipped from review as they are similar to previous changes (6)
- packages/react/src/components/auth0/my-organization/shared/member-management/invitations/invitation-details/tests/organization-invitation-details-modal.test.tsx
- packages/core/src/i18n/custom-messages/my-organization/member-management/invitation-tab-types.ts
- packages/core/src/i18n/translations/en-US.json
- packages/react/src/tests/utils/mocks/my-organization/member-management/invitation.mocks.ts
- packages/react/src/hooks/my-organization/tests/use-member-management-service.test.ts
- packages/core/src/i18n/translations/ja.json
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/core/src/i18n/translations/ja.json (1)
1319-1319: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winDo not expose internal field names in the Japanese validation message.
The message shows
identity_provider_idanduser_store_id, which is developer-facing terminology and inconsistent with the localized “接続”/directory labels.Proposed fix
- "connection_required": "identity_provider_id または user_store_id のいずれか一方を指定する必要があります。", + "connection_required": "IDプロバイダーまたはユーザーディレクトリを1つ選択してください。",🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/i18n/translations/ja.json` at line 1319, Update the Japanese connection_required translation to use localized connection or directory terminology instead of exposing the internal identity_provider_id and user_store_id field names, while preserving the requirement that one of the two connection options must be specified.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@packages/react/src/components/auth0/my-organization/shared/member-management/shared/invitation-create/__tests__/organization-invitation-create-modal.test.tsx`:
- Around line 336-343: Update the test case “should render the connection label
as required” for OrganizationInvitationCreateModal to assert the connection
field’s required contract, such as aria-required="true" or its required
indicator, in addition to verifying the label text. Locate the rendered
connection field using its accessible label or role and preserve the existing
provider setup.
---
Outside diff comments:
In `@packages/core/src/i18n/translations/ja.json`:
- Line 1319: Update the Japanese connection_required translation to use
localized connection or directory terminology instead of exposing the internal
identity_provider_id and user_store_id field names, while preserving the
requirement that one of the two connection options must be specified.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 63f36d48-1956-4311-9efe-db80301384d4
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (8)
auth0-myorganization-js-1.1.0.tgzpackages/core/package.jsonpackages/core/src/i18n/custom-messages/my-organization/member-management/invitation-tab-types.tspackages/core/src/i18n/translations/en-US.jsonpackages/core/src/i18n/translations/ja.jsonpackages/react/src/components/auth0/my-organization/__tests__/domain-table.test.tsxpackages/react/src/components/auth0/my-organization/shared/member-management/shared/invitation-create/__tests__/organization-invitation-create-modal.test.tsxpackages/react/src/components/auth0/my-organization/shared/member-management/shared/invitation-create/organization-invitation-create-modal.tsx
💤 Files with no reviewable changes (1)
- packages/react/src/components/auth0/my-organization/tests/domain-table.test.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/core/src/i18n/translations/en-US.json
- packages/react/src/components/auth0/my-organization/shared/member-management/shared/invitation-create/organization-invitation-create-modal.tsx
Summary
Replaces the invitation modal's identity-provider dropdown with a unified connection picker that lists both enterprise identity providers and user stores (directories), grouped by source, and makes selecting a connection required before an invite can be sent.
Why
When inviting a member, admins could only route the invite to an identity provider — organization user stores weren't selectable, even though invitations can target them. The field was also optional, so an invite could be submitted without a routing target. This unifies both connection sources into one required picker.
What
Breaking API changes
IdentityProviderOptionis removed, replaced byConnectionOptionandConnectionOptionTypeexported frompackages/react. Migration:{ id, name, type?: string }becomes{ id, name, type: 'identity_provider' | 'user_store' }.availableProvidersprop is removed fromOrganizationInvitationCreateModalPropsandOrganizationInvitationDetailsModalProps. PassavailableConnectionsinstead.useOrganizationMemberManagementno longer returnsavailableProviders; it returnsavailableConnections(identity providers and user stores merged). Consumers rendering their own picker should read that instead.useMemberManagementService'sprovidersQuerynow resolves toConnectionOption[]rather thanIdentityProviderOption[].Behavior
*, submit stays disabled until a connection is chosen, and submitting without one sets an inline error and marks the triggeraria-invalid.CreateInvitationInputacceptsuser_store_idalongsideidentity_provider_id. The modal sends whichever matches the selected connection's type, and the service forwards it on the create request.identity_provider_id ?? user_store_idagainstavailableConnections, so user-directory invites show a name instead of a raw ID.idare dropped, and a missingdisplay_nameornamefalls back to the ID, so the picker never renders a blank row.Additions
userStoresQueryinuseMemberManagementService, fetching enabled organization user stores (is_enabled: true).identityProviders()anduserStores()added tomemberManagementQueryKeysin core; the providers query now uses the named key instead of an inline array.UserStoreandListUserStoresResponseContentre-exported frompackages/core.provider_required_error,provider_group_user_store, andprovider_group_identity_providerinen-USandja.provider_placeholderandprovider_helperare reworded now that the field is required.setupJsdomMocksstubsscrollIntoView,hasPointerCapture, andreleasePointerCaptureso RadixSelectcan open under jsdom.Packages
packages/corepackages/reactexamplesReferences
Testing
How can this be verified? Note anything intentionally not covered by tests and why.
identity_provider_id. Repeat with a user directory and confirm it carriesuser_store_idinstead.Checklist
Contributing
Summary by CodeRabbit