@passkeyme/react-auth 2.2.9 → 2.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/PasskeymeCallbackHandler.d.ts.map +1 -1
- package/dist/index.esm.js +11 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6608,7 +6608,7 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6608
6608
|
showPasskeyPrompt: false,
|
|
6609
6609
|
});
|
|
6610
6610
|
handlePasskeyRegistrationComplete(true);
|
|
6611
|
-
proceedWithRedirect();
|
|
6611
|
+
proceedWithRedirect(currentUser);
|
|
6612
6612
|
}
|
|
6613
6613
|
catch (error) {
|
|
6614
6614
|
console.error("Passkey registration failed:", error);
|
|
@@ -6652,7 +6652,7 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6652
6652
|
}
|
|
6653
6653
|
// This is actually a "success" case - user has passkeys, just localStorage was out of sync
|
|
6654
6654
|
handlePasskeyRegistrationComplete(true, "Passkey already registered and ready to use.");
|
|
6655
|
-
proceedWithRedirect();
|
|
6655
|
+
proceedWithRedirect(currentUser);
|
|
6656
6656
|
return;
|
|
6657
6657
|
}
|
|
6658
6658
|
else if (msg.includes("user cancelled") ||
|
|
@@ -6672,7 +6672,7 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6672
6672
|
handlePasskeyRegistrationComplete(false, "Passkey registration failed. You can try again later.");
|
|
6673
6673
|
}
|
|
6674
6674
|
// Always proceed with redirect - don't block user flow
|
|
6675
|
-
proceedWithRedirect();
|
|
6675
|
+
proceedWithRedirect(currentUser);
|
|
6676
6676
|
}
|
|
6677
6677
|
};
|
|
6678
6678
|
// Handle skipping passkey registration
|
|
@@ -6683,16 +6683,17 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6683
6683
|
sessionStorage.setItem("passkey_declined", Date.now().toString());
|
|
6684
6684
|
updateState({ showPasskeyPrompt: false });
|
|
6685
6685
|
handlePasskeyRegistrationComplete(false, "User chose to skip passkey registration");
|
|
6686
|
-
proceedWithRedirect();
|
|
6686
|
+
proceedWithRedirect(state.authenticatedUser);
|
|
6687
6687
|
};
|
|
6688
6688
|
// Proceed with redirect after auth completion
|
|
6689
|
-
const proceedWithRedirect = async () => {
|
|
6689
|
+
const proceedWithRedirect = async (authenticatedUser) => {
|
|
6690
6690
|
// CRITICAL: Clean URL synchronously BEFORE any async operations
|
|
6691
6691
|
// This prevents Next.js App Router from remounting the component with stale URL params
|
|
6692
6692
|
// Must happen outside setTimeout to execute immediately
|
|
6693
6693
|
window.history.replaceState({}, document.title, window.location.pathname);
|
|
6694
6694
|
setTimeout(async () => {
|
|
6695
|
-
|
|
6695
|
+
// Use passed user or fall back to state/context user
|
|
6696
|
+
const currentUser = authenticatedUser || state.authenticatedUser || user;
|
|
6696
6697
|
// If custom onSuccess callback provided, use it and let parent handle navigation
|
|
6697
6698
|
if (onSuccess) {
|
|
6698
6699
|
if (!currentUser) {
|
|
@@ -6784,8 +6785,8 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6784
6785
|
// Mark callback as processed to prevent re-execution
|
|
6785
6786
|
callbackProcessedRef.current = true;
|
|
6786
6787
|
if (!shouldPrompt) {
|
|
6787
|
-
// Proceed with normal redirect
|
|
6788
|
-
proceedWithRedirect();
|
|
6788
|
+
// Proceed with normal redirect, pass user directly to avoid state timing issues
|
|
6789
|
+
proceedWithRedirect(authenticatedUser);
|
|
6789
6790
|
}
|
|
6790
6791
|
}
|
|
6791
6792
|
catch (err) {
|
|
@@ -6835,8 +6836,8 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6835
6836
|
// Mark callback as processed to prevent re-execution
|
|
6836
6837
|
callbackProcessedRef.current = true;
|
|
6837
6838
|
if (!shouldPrompt) {
|
|
6838
|
-
// Proceed with normal redirect
|
|
6839
|
-
proceedWithRedirect();
|
|
6839
|
+
// Proceed with normal redirect, pass user directly to avoid state timing issues
|
|
6840
|
+
proceedWithRedirect(authenticatedUser);
|
|
6840
6841
|
}
|
|
6841
6842
|
}
|
|
6842
6843
|
catch (err) {
|