Skip to content

feat(core, react): unify invitation connection picker across providers and user directories - #430

Merged
chakrihacker merged 13 commits into
feat/my-org-ea-branchfrom
feat/connection-picker
Jul 30, 2026
Merged

feat(core, react): unify invitation connection picker across providers and user directories#430
chakrihacker merged 13 commits into
feat/my-org-ea-branchfrom
feat/connection-picker

Conversation

@chakrihacker

@chakrihacker chakrihacker commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

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

  • IdentityProviderOption is removed, replaced by ConnectionOption and ConnectionOptionType exported from packages/react. Migration: { id, name, type?: string } becomes { id, name, type: 'identity_provider' | 'user_store' }.
  • The availableProviders prop is removed from OrganizationInvitationCreateModalProps and OrganizationInvitationDetailsModalProps. Pass availableConnections instead.
  • useOrganizationMemberManagement no longer returns availableProviders; it returns availableConnections (identity providers and user stores merged). Consumers rendering their own picker should read that instead.
  • useMemberManagementService's providersQuery now resolves to ConnectionOption[] rather than IdentityProviderOption[].

Behavior

  • Connection selection is required: the label is marked with *, submit stays disabled until a connection is chosen, and submitting without one sets an inline error and marks the trigger aria-invalid.
  • Connections render under group headers ("User Directory" and "Enterprise SSO"), and a group is omitted when it has no entries.
  • CreateInvitationInput accepts user_store_id alongside identity_provider_id. The modal sends whichever matches the selected connection's type, and the service forwards it on the create request.
  • The invitation details modal resolves its display name from identity_provider_id ?? user_store_id against availableConnections, so user-directory invites show a name instead of a raw ID.
  • Connections with no id are dropped, and a missing display_name or name falls back to the ID, so the picker never renders a blank row.

Additions

  • New userStoresQuery in useMemberManagementService, fetching enabled organization user stores (is_enabled: true).
  • identityProviders() and userStores() added to memberManagementQueryKeys in core; the providers query now uses the named key instead of an inline array.
  • UserStore and ListUserStoresResponseContent re-exported from packages/core.
  • New i18n keys provider_required_error, provider_group_user_store, and provider_group_identity_provider in en-US and ja. provider_placeholder and provider_helper are reworded now that the field is required.
  • setupJsdomMocks stubs scrollIntoView, hasPointerCapture, and releasePointerCapture so Radix Select can open under jsdom.

Packages

  • packages/core
  • packages/react
  • examples

References

  1. Invite Modal with the grouped connection picker
Screenshot 2026-07-27 at 10 57 44 PM

Testing

How can this be verified? Note anything intentionally not covered by tests and why.

  1. Start an example app and open Organization to Members, then Invite.
  2. Add a valid email but leave the provider unselected. Send Invite should stay disabled.
  3. Open the connection dropdown. Entries should appear under "User Directory" and "Enterprise SSO" headers, with each header shown only when that group has entries.
  4. Select an identity provider and send. The create request should carry identity_provider_id. Repeat with a user directory and confirm it carries user_store_id instead.
  5. Open the details modal for each of those invitations. Both should show the connection's display name, not its ID.
  • This change adds unit test coverage
  • Tested for both SPA and RWA flows, all example apps working
  • All existing and new tests complete without errors

Checklist

  • Breaking change
  • Requires docs update
  • Backward compatible

Contributing

Summary by CodeRabbit

  • New Features
    • Invitation creation now supports selecting either an enterprise connection or user directory.
    • Connections are grouped by type for easier selection.
    • Invitation details display the selected connection, including user directories.
    • Invitations can be created and resent using user directory connections.
  • Bug Fixes
    • Added validation requiring a connection before sending an invitation.
    • Improved handling of invitations with missing or legacy connection information.
  • Localization
    • Updated English and Japanese invitation labels, helpers, and error messages to use connection terminology.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f3731815-4a98-42e8-a36e-fd83a1472ee7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/connection-picker

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chakrihacker
chakrihacker changed the base branch from main to feat/my-org-ea-branch July 28, 2026 06:09
@chakrihacker chakrihacker changed the title fix(core, react): connection picker is working now fix(core, react): unify invitation connection picker across providers and user directories Jul 28, 2026
@chakrihacker chakrihacker changed the title fix(core, react): unify invitation connection picker across providers and user directories feat(core, react): unify invitation connection picker across providers and user directories Jul 28, 2026
@chakrihacker
chakrihacker marked this pull request as ready for review July 28, 2026 06:26

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Make 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 win

Make the describe block condition-oriented.

Use a when... condition such as describe('when the invitation has a connection', ...), with separate condition blocks for the unassigned case. As per coding guidelines, describes should express conditions with when... and it names 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 win

Cover 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 win

Use the required condition/action test naming.

Rename the suite to a when... condition and remove should prefixes from it names, e.g. describe('when connection options are available', ...) and it('submits user_store_id for a selected user store', ...). As per coding guidelines, tests under packages/*/src/**/__tests__/*.test.{ts,tsx} must describe conditions with when... and actions in the it name.

🤖 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 value

Remove the unnecessary as const assertions. ConnectionOption[] already supplies the discriminated target shape; use contextual typing or explicitly return ConnectionOption from each mapper instead.

  • packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts#L100-L104: type the provider mapper as ConnectionOption without as const.
  • packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts#L118-L122: type the user-store mapper as ConnectionOption without as 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 value

Use the repository’s Vitest naming convention.

  • packages/react/src/hooks/my-organization/__tests__/use-member-management-service.test.ts#L101-L124: rename it('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 the describe('userStoresQuery') cases into describe('when …') conditions and action-oriented it(...) names.
  • packages/react/src/hooks/my-organization/__tests__/use-member-management-service.test.ts#L416-L434: rename it('should forward …') to an action-oriented name.

As per coding guidelines, use describe conditions beginning with “when…” and action-oriented it names.

🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between 51f72e8 and 98b88d4.

📒 Files selected for processing (19)
  • packages/core/src/i18n/custom-messages/my-organization/member-management/invitation-tab-types.ts
  • packages/core/src/i18n/translations/en-US.json
  • packages/core/src/i18n/translations/ja.json
  • packages/core/src/services/my-organization/member-management/member-management-constants.ts
  • packages/core/src/services/my-organization/member-management/member-management-types.ts
  • packages/react/src/__tests__/utils/test-helpers.ts
  • packages/react/src/components/auth0/my-organization/__tests__/organization-member-management.test.tsx
  • packages/react/src/components/auth0/my-organization/organization-member-management.tsx
  • packages/react/src/components/auth0/my-organization/shared/member-management/invitations/invitation-details/__tests__/organization-invitation-details-modal.test.tsx
  • packages/react/src/components/auth0/my-organization/shared/member-management/invitations/invitation-details/organization-invitation-details-modal.tsx
  • packages/react/src/components/auth0/my-organization/shared/member-management/shared/invitation-create/__tests__/organization-invitation-create-modal.test.tsx
  • packages/react/src/components/auth0/my-organization/shared/member-management/shared/invitation-create/organization-invitation-create-modal.tsx
  • packages/react/src/hooks/my-organization/__tests__/use-member-management-service.test.ts
  • packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts
  • packages/react/src/hooks/my-organization/use-organization-member-management.ts
  • packages/react/src/tests/utils/__mocks__/core/core-client.mocks.ts
  • packages/react/src/tests/utils/__mocks__/my-organization/member-management/invitation.mocks.ts
  • packages/react/src/types/my-organization/member-management/organization-invitation-table-types.ts
  • packages/react/src/types/my-organization/member-management/organization-member-management-types.ts

Comment on lines +259 to +265
{/* 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 />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.

Comment on lines +112 to 124
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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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/core

Repository: 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' || true

Repository: 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:


🏁 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 || true

Repository: 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:


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 | 🟠 Major

Fetch all enabled user-store pages before normalizing.

userStores.get() is called once and page.next is 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 covers next: 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 win

Avoid the as const assertions in both mappings.

These assertions are only needed because the callbacks lack a contextual ConnectionOption return type. Annotate each callback as returning ConnectionOption (and keep the existing ID narrowing) so the literal type values are inferred without as.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 98b88d4 and dc09ecc.

📒 Files selected for processing (8)
  • packages/core/src/i18n/custom-messages/my-organization/member-management/invitation-tab-types.ts
  • packages/core/src/i18n/translations/en-US.json
  • packages/core/src/i18n/translations/ja.json
  • packages/react/src/components/auth0/my-organization/shared/member-management/invitations/invitation-details/__tests__/organization-invitation-details-modal.test.tsx
  • packages/react/src/components/auth0/my-organization/shared/member-management/invitations/invitation-details/organization-invitation-details-modal.tsx
  • packages/react/src/hooks/my-organization/__tests__/use-member-management-service.test.ts
  • packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts
  • packages/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

Comment thread packages/react/src/__tests__/utils/test-helpers.ts
@rax7389 rax7389 added the enhancement New feature or request label Jul 28, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Do not expose internal field names in the Japanese validation message.

The message shows identity_provider_id and user_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

📥 Commits

Reviewing files that changed from the base of the PR and between 29b7f55 and 58e136f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • auth0-myorganization-js-1.1.0.tgz
  • packages/core/package.json
  • packages/core/src/i18n/custom-messages/my-organization/member-management/invitation-tab-types.ts
  • packages/core/src/i18n/translations/en-US.json
  • packages/core/src/i18n/translations/ja.json
  • packages/react/src/components/auth0/my-organization/__tests__/domain-table.test.tsx
  • packages/react/src/components/auth0/my-organization/shared/member-management/shared/invitation-create/__tests__/organization-invitation-create-modal.test.tsx
  • packages/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

@chakrihacker
chakrihacker merged commit 902b776 into feat/my-org-ea-branch Jul 30, 2026
2 checks passed
@chakrihacker
chakrihacker deleted the feat/connection-picker branch July 30, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants