-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(elements): Handle sign in start (#2443)
* feat(elements): Implement initial createSignIn handling * feat(elements): Handle complete and needs_first_factor from sign in create * chore(elements): Rename back to Start * chore(repo): Add changeset, fix dependencies * feat(elements): Move param construction into actor
- Loading branch information
Showing
12 changed files
with
111 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
'use client'; | ||
import { useNextRouter } from './internals/router'; | ||
|
||
export * from './sign-in'; | ||
export * from './common/form'; | ||
|
||
export { useSignInFlow, useSignInFlowSelector } from './internals/machines/sign-in.context'; | ||
export { SignIn, SignInStart, SignInFactorOne, SignInFactorTwo, SignInSSOCallback } from './sign-in'; | ||
|
||
export { useNextRouter }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import type { Clerk } from '@clerk/types'; | ||
import { fromPromise } from 'xstate'; | ||
|
||
export const waitForClerk = fromPromise( | ||
// @ts-expect-error -- not specified on the type | ||
({ input: clerk }: { input: Clerk }) => new Promise(resolve => clerk.addOnLoaded(resolve)), | ||
); |
33 changes: 24 additions & 9 deletions
33
packages/elements/src/internals/machines/sign-in.actors.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
import type { ClientResource } from '@clerk/types'; | ||
import type { LoadedClerk } from '@clerk/types'; | ||
|
||
export type FieldDetails = { | ||
type?: string; | ||
value?: string | readonly string[] | number; | ||
error?: Error; | ||
}; | ||
|
||
export type SignInClient = ClientResource; | ||
|
||
export type SignInResourceParams<T> = { | ||
client: SignInClient; | ||
client: LoadedClerk['client']; | ||
params: T; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters