Repository navigation
Implement USER_SELECT, AUTH_FLOW_SELECT and USER_TYPE_SELECT inputs in the JavaScript core and React SDK - #106
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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 |
🔀 Cross-SDK feature parity, ports raisedThis pull request is labelled Ports (DO NOT EDIT)
3 of 3 sibling SDKs accounted for. Every sibling SDK is accounted for. The contract is in the SDK development specification. |
|
ce68fb3 to
d1fb5c2
Compare
d1fb5c2 to
313e70e
Compare
313e70e to
65b9c06
Compare
65b9c06 to
30d6ab0
Compare
Signed-off-by: Dilusha-Madushan <[email protected]> # Conflicts: # packages/javascript/src/index.ts # packages/javascript/src/utils/resolveResourceEndpoint.ts # Conflicts: # packages/node/src/ThunderIDNodeClient.ts # Conflicts: # packages/react/src/components/presentation/auth/AuthOptionFactory.tsx # packages/react/src/components/presentation/auth/__tests__/AuthOptionFactory.test.tsx # packages/vue/src/components/auth/sign-in/AuthOptionFactoryCore.ts
30d6ab0 to
fea0abb
Compare
Purpose
This PR adds three flow inputs for selecting users, authentication flows, and user types. Each picker loads its first page of options when it renders and lists a Load more option for the rest. It also lets a flow mark a copyable value as masked, so a value such as a client secret stays hidden until the user chooses to reveal it.
USER_SELECTAUTH_FLOW_SELECTUSER_TYPE_SELECTThunderID's agent onboarding flow uses
USER_SELECTto choose an owner and maskedCOPYABLE_TEXTto display the generated client secret. Copying a masked value still copies the original value.The built-in flow integration supports these pickers in
InviteUser, where a signed-in user's access token is available for the management API calls. Sign-in, sign-up, recovery, and accept-invite skip these inputs with the same warning the SDK logs forOU_SELECT. They do not replace them with free-text fields.Approach
The three pickers share the same building blocks.
Selectdisplays the options, the ReactuseInfiniteOptionshook and Vue composable manage pagination, and each picker connects them to its management API. Shared mapping, pagination, retry, and validation logic lives in core. The clipboard helper lives in browser.Selectstill uses the browser's<select>. It accepts optional loading props and a Load more option at the end of the list. Choosing Load more requests another page without changing or submitting the selected value. Reopen the dropdown to see the new options. The control shows loading feedback and removes Load more when there are no pages left.selectedOptionpreserves the label of a selected value that is not in the loaded pages.onError. The picker does not display an inline error. Requests also support cancellation throughAbortSignal.getFlowsandgetUserTypesalongside the existing user API. Node and Next.js expose all three management calls using the session's access token. Express inherits the Node methods, while React Router and TanStack Router inherit the React components./api/auth/users,/api/auth/auth-flows, and/api/auth/user-types, enabled individually through the newresourcePickersoption. These paths validate paging inputs, limit user filters to 512 characters, and return normalized options. Errors sent to the browser retain their status but use a controlled message instead of the upstream response text.InviteUsersupply loaders, validate required selections, and forward load errors to the existingonError. They also pass flow metadata and translations so templated headings resolve. Each picker has aBasevariant, and the fetch hooks and composables are exported for custom integrations.CopyableTextacceptsmaskedand displays the value in a read-onlyPasswordFieldwith Show/Hide and Copy controls. Copy always copies the original value, even while hidden. Masking uses the browser's password display, which reveals the value's length; it does not remove the value from the input.The PR also fixes required
SELECTvalidation in React and Vue accept-invite flows, passesadditionalDatato Vue's invite and accept-invite factories for copyable values, and adds the missing React key to elements returned by custom flow renderers.Test coverage and validation
The tests cover the shared logic, framework components, and server integrations:
Related Issues
Related PRs
Checklist
breaking changelabel added.parity/prs-raisedorparity/prs-not-neededadded.parity/prs-raised, the port links are posted as a reply on the parity check's comment.Security checks