-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Check WebAuthn support + fix referralInteraction hook
- Loading branch information
1 parent
e65e4bb
commit f8c200a
Showing
6 changed files
with
68 additions
and
29 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,5 @@ | ||
--- | ||
"@frak-labs/nexus-sdk": patch | ||
--- | ||
|
||
Fix `useReferralInteraction` to directly populate nexus context if user is logged in |
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
34 changes: 34 additions & 0 deletions
34
packages/wallet/src/module/common/component/RequireWebAuthN/index.tsx
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,34 @@ | ||
"use client"; | ||
|
||
import { type PropsWithChildren, useMemo } from "react"; | ||
|
||
/** | ||
* Component to require webauthn for the children sub-components | ||
* @param children | ||
* @constructor | ||
*/ | ||
export function RequireWebAuthN({ children }: PropsWithChildren) { | ||
// Check if webauthn is supported | ||
const isWebAuthnSupported = useMemo(() => { | ||
// If on server side, webauthn not supported | ||
if (typeof window === "undefined") { | ||
return false; | ||
} | ||
|
||
// Check if webauthn is supported | ||
return window.PublicKeyCredential !== undefined; | ||
}, []); | ||
|
||
// If webauthn is supported, directly return the children | ||
if (isWebAuthnSupported) { | ||
return children; | ||
} | ||
|
||
// Otherwise, simple message telling that webauthn isn't supported | ||
return ( | ||
<p> | ||
Open this page on your default web browser to enjoy Nexus rewards | ||
and benefits. | ||
</p> | ||
); | ||
} |
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