-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: oauth add passkey after signup (redirect flow) (#1140)
* chore: local dev changes updated * chore: wip oauth redirect with add passkey after signup * chore: wip * refactor: remove a few things so we can test redirect * refactor: just render the pop-up on completed login for oauth * refactor: add new user signup event in signer * refactor: add hook to listen to signup events * chore: wip * refactor: use signup event to popup passkey create * fix: the modal was staying open * fix: move setAuthStep in the correct card * fix: infinite subscribe loop * fix: don't open passkey create until logged in * chore: remove local dev callback url * chore: removes unecessary bangs and refactors for readability * chore: removes unused usePrevious hook * fix: update useNewUserSignup to remove listener on dismount and when dependencies change * docs: link related discussion to TODO * refactor: adds emitNewUserEvent wrapper * chore: restore oauth mode to popup * chore: remove logging Co-authored-by: Michael Moldoveanu <michael.moldoveanu@alchemy.com> * chore: remove logging Co-authored-by: Michael Moldoveanu <michael.moldoveanu@alchemy.com> * chore: reset oauth mode to popup * fix: handle undefined isNewUser within emitNewUserEvent wrapper * chore: remove unnecessary bang --------- Co-authored-by: Michael Moldoveanu <michael.moldoveanu@alchemy.com>
- Loading branch information
Showing
11 changed files
with
123 additions
and
59 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
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { useEffect, useRef } from "react"; | ||
import { useSigner } from "../useSigner.js"; | ||
|
||
export function useNewUserSignup(onSignup: () => void, enabled?: boolean) { | ||
const hasHandled = useRef(false); | ||
const signer = useSigner(); | ||
|
||
useEffect(() => { | ||
if (!enabled) return; | ||
if (!signer) return; | ||
|
||
const handleSignup = () => { | ||
if (!hasHandled.current) { | ||
hasHandled.current = true; | ||
onSignup(); | ||
} | ||
}; | ||
|
||
const stopListening = signer.on("newUserSignup", handleSignup); | ||
return stopListening; | ||
}, [enabled, onSignup, signer]); | ||
} |
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