@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.js CHANGED
@@ -9768,6 +9768,15 @@ function useAutoRecover({
9768
9768
  const recover = async () => {
9769
9769
  try {
9770
9770
  setIsLoading(true);
9771
+ if (typeof window !== "undefined") {
9772
+ const params = new URLSearchParams(window.location.search);
9773
+ const code = params.get("code");
9774
+ if (code?.startsWith("volr_auth_")) {
9775
+ console.log("[Provider] OAuth callback detected, skipping auto-recover");
9776
+ setIsLoading(false);
9777
+ return;
9778
+ }
9779
+ }
9771
9780
  if (!client.getRefreshToken()) {
9772
9781
  console.log("[Provider] No refresh token found, skipping auto-recover");
9773
9782
  setIsLoading(false);
@@ -18706,7 +18715,7 @@ function useVolrAuthCallback(options = {}) {
18706
18715
  const { clearUrlParams = true } = options;
18707
18716
  const { setUser } = useVolrContext();
18708
18717
  const { setAccessToken, setRefreshToken, client } = useInternalAuth();
18709
- const [isLoading, setIsLoading] = useState(true);
18718
+ const [isLoading, setIsLoading] = useState(false);
18710
18719
  const [error, setError] = useState(null);
18711
18720
  const [isNewUser, setIsNewUser] = useState(false);
18712
18721
  const [user, setLocalUser] = useState(null);
@@ -18730,12 +18739,16 @@ function useVolrAuthCallback(options = {}) {
18730
18739
  const handleCallback = async () => {
18731
18740
  if (typeof window === "undefined") return;
18732
18741
  if (hasProcessed.current) return;
18733
- hasProcessed.current = true;
18734
18742
  const searchParams = new URLSearchParams(window.location.search);
18735
18743
  const authCode = searchParams.get("code");
18736
18744
  const errorParam = searchParams.get("error");
18737
18745
  const isNew = searchParams.get("isNewUser") === "true";
18738
18746
  const warning = searchParams.get("warning");
18747
+ if (!authCode && !errorParam) {
18748
+ return;
18749
+ }
18750
+ hasProcessed.current = true;
18751
+ setIsLoading(true);
18739
18752
  if (warning) {
18740
18753
  console.warn(`[Volr] ${warning}`);
18741
18754
  }
@@ -18746,13 +18759,6 @@ function useVolrAuthCallback(options = {}) {
18746
18759
  options.onError?.(errorMsg);
18747
18760
  return;
18748
18761
  }
18749
- if (!authCode) {
18750
- const errorMsg = "No authorization code found. Please try logging in again.";
18751
- setError(errorMsg);
18752
- setIsLoading(false);
18753
- options.onError?.(errorMsg);
18754
- return;
18755
- }
18756
18762
  if (!authCode.startsWith("volr_auth_")) {
18757
18763
  const errorMsg = "Invalid authorization code format";
18758
18764
  setError(errorMsg);