@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.
@@ -1 +1 @@
1
- {"version":3,"file":"PasskeymeCallbackHandler.d.ts","sourceRoot":"","sources":["../../src/components/PasskeymeCallbackHandler.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAuLzD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iBAAiB,EAAE,GAAG,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,wBAAwB,GAAI,sIAQtC,6BAA6B,mDA24B/B,CAAC"}
1
+ {"version":3,"file":"PasskeymeCallbackHandler.d.ts","sourceRoot":"","sources":["../../src/components/PasskeymeCallbackHandler.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAuLzD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iBAAiB,EAAE,GAAG,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,wBAAwB,GAAI,sIAQtC,6BAA6B,mDA44B/B,CAAC"}
package/dist/index.esm.js CHANGED
@@ -6607,7 +6607,7 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
6607
6607
  showPasskeyPrompt: false,
6608
6608
  });
6609
6609
  handlePasskeyRegistrationComplete(true);
6610
- proceedWithRedirect();
6610
+ proceedWithRedirect(currentUser);
6611
6611
  }
6612
6612
  catch (error) {
6613
6613
  console.error("Passkey registration failed:", error);
@@ -6651,7 +6651,7 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
6651
6651
  }
6652
6652
  // This is actually a "success" case - user has passkeys, just localStorage was out of sync
6653
6653
  handlePasskeyRegistrationComplete(true, "Passkey already registered and ready to use.");
6654
- proceedWithRedirect();
6654
+ proceedWithRedirect(currentUser);
6655
6655
  return;
6656
6656
  }
6657
6657
  else if (msg.includes("user cancelled") ||
@@ -6671,7 +6671,7 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
6671
6671
  handlePasskeyRegistrationComplete(false, "Passkey registration failed. You can try again later.");
6672
6672
  }
6673
6673
  // Always proceed with redirect - don't block user flow
6674
- proceedWithRedirect();
6674
+ proceedWithRedirect(currentUser);
6675
6675
  }
6676
6676
  };
6677
6677
  // Handle skipping passkey registration
@@ -6682,16 +6682,17 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
6682
6682
  sessionStorage.setItem("passkey_declined", Date.now().toString());
6683
6683
  updateState({ showPasskeyPrompt: false });
6684
6684
  handlePasskeyRegistrationComplete(false, "User chose to skip passkey registration");
6685
- proceedWithRedirect();
6685
+ proceedWithRedirect(state.authenticatedUser);
6686
6686
  };
6687
6687
  // Proceed with redirect after auth completion
6688
- const proceedWithRedirect = async () => {
6688
+ const proceedWithRedirect = async (authenticatedUser) => {
6689
6689
  // CRITICAL: Clean URL synchronously BEFORE any async operations
6690
6690
  // This prevents Next.js App Router from remounting the component with stale URL params
6691
6691
  // Must happen outside setTimeout to execute immediately
6692
6692
  window.history.replaceState({}, document.title, window.location.pathname);
6693
6693
  setTimeout(async () => {
6694
- const currentUser = state.authenticatedUser || user;
6694
+ // Use passed user or fall back to state/context user
6695
+ const currentUser = authenticatedUser || state.authenticatedUser || user;
6695
6696
  // If custom onSuccess callback provided, use it and let parent handle navigation
6696
6697
  if (onSuccess) {
6697
6698
  if (!currentUser) {
@@ -6783,8 +6784,8 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
6783
6784
  // Mark callback as processed to prevent re-execution
6784
6785
  callbackProcessedRef.current = true;
6785
6786
  if (!shouldPrompt) {
6786
- // Proceed with normal redirect
6787
- proceedWithRedirect();
6787
+ // Proceed with normal redirect, pass user directly to avoid state timing issues
6788
+ proceedWithRedirect(authenticatedUser);
6788
6789
  }
6789
6790
  }
6790
6791
  catch (err) {
@@ -6834,8 +6835,8 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
6834
6835
  // Mark callback as processed to prevent re-execution
6835
6836
  callbackProcessedRef.current = true;
6836
6837
  if (!shouldPrompt) {
6837
- // Proceed with normal redirect
6838
- proceedWithRedirect();
6838
+ // Proceed with normal redirect, pass user directly to avoid state timing issues
6839
+ proceedWithRedirect(authenticatedUser);
6839
6840
  }
6840
6841
  }
6841
6842
  catch (err) {