@volr/react 0.1.75 → 0.1.77

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/index.cjs CHANGED
@@ -9792,6 +9792,15 @@ function useAutoRecover({
9792
9792
  const recover = async () => {
9793
9793
  try {
9794
9794
  setIsLoading(true);
9795
+ if (typeof window !== "undefined") {
9796
+ const params = new URLSearchParams(window.location.search);
9797
+ const code = params.get("code");
9798
+ if (code?.startsWith("volr_auth_")) {
9799
+ console.log("[Provider] OAuth callback detected, skipping auto-recover");
9800
+ setIsLoading(false);
9801
+ return;
9802
+ }
9803
+ }
9795
9804
  if (!client.getRefreshToken()) {
9796
9805
  console.log("[Provider] No refresh token found, skipping auto-recover");
9797
9806
  setIsLoading(false);
@@ -18730,7 +18739,7 @@ function useVolrAuthCallback(options = {}) {
18730
18739
  const { clearUrlParams = true } = options;
18731
18740
  const { setUser } = useVolrContext();
18732
18741
  const { setAccessToken, setRefreshToken, client } = useInternalAuth();
18733
- const [isLoading, setIsLoading] = react.useState(true);
18742
+ const [isLoading, setIsLoading] = react.useState(false);
18734
18743
  const [error, setError] = react.useState(null);
18735
18744
  const [isNewUser, setIsNewUser] = react.useState(false);
18736
18745
  const [user, setLocalUser] = react.useState(null);
@@ -18754,12 +18763,16 @@ function useVolrAuthCallback(options = {}) {
18754
18763
  const handleCallback = async () => {
18755
18764
  if (typeof window === "undefined") return;
18756
18765
  if (hasProcessed.current) return;
18757
- hasProcessed.current = true;
18758
18766
  const searchParams = new URLSearchParams(window.location.search);
18759
18767
  const authCode = searchParams.get("code");
18760
18768
  const errorParam = searchParams.get("error");
18761
18769
  const isNew = searchParams.get("isNewUser") === "true";
18762
18770
  const warning = searchParams.get("warning");
18771
+ if (!authCode && !errorParam) {
18772
+ return;
18773
+ }
18774
+ hasProcessed.current = true;
18775
+ setIsLoading(true);
18763
18776
  if (warning) {
18764
18777
  console.warn(`[Volr] ${warning}`);
18765
18778
  }
@@ -18770,13 +18783,6 @@ function useVolrAuthCallback(options = {}) {
18770
18783
  options.onError?.(errorMsg);
18771
18784
  return;
18772
18785
  }
18773
- if (!authCode) {
18774
- const errorMsg = "No authorization code found. Please try logging in again.";
18775
- setError(errorMsg);
18776
- setIsLoading(false);
18777
- options.onError?.(errorMsg);
18778
- return;
18779
- }
18780
18786
  if (!authCode.startsWith("volr_auth_")) {
18781
18787
  const errorMsg = "Invalid authorization code format";
18782
18788
  setError(errorMsg);