@insforge/react 0.7.4-dev.6 → 0.7.5

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
@@ -109,36 +109,22 @@ var InsforgeManager = class _InsforgeManager {
109
109
  // Public initialization method
110
110
  // Even if we have initialState (isLoaded=true from cookies), we still need to load full user data from SDK/API
111
111
  async initialize() {
112
- console.log("[InsforgeManager] initialize() called", {
113
- isInitializing: this.isInitializing,
114
- currentUser: this.user?.id || "none",
115
- isLoaded: this.isLoaded,
116
- hostedMode: this.config.hostedMode
117
- });
118
112
  if (this.isInitializing) {
119
- console.log("[InsforgeManager] Already initializing, skipping");
120
113
  return;
121
114
  }
122
115
  this.isInitializing = true;
123
116
  try {
124
117
  const sessionResult = this.sdk.auth.getCurrentSession();
125
118
  const hasToken = !!sessionResult.data?.session?.accessToken;
126
- console.log("[InsforgeManager] Session check:", {
127
- hasToken,
128
- tokenPreview: hasToken ? sessionResult.data?.session?.accessToken?.substring(0, 20) + "..." : "none"
129
- });
130
119
  if (hasToken) {
131
- console.log("[InsforgeManager] Token found, loading auth state...");
132
120
  await this.loadAuthState();
133
121
  } else if (this.user === void 0) {
134
- console.log("[InsforgeManager] No token and no initialState, marking as loaded with no user");
135
122
  this.user = null;
136
123
  this.isLoaded = true;
137
124
  this.notifyListeners();
138
125
  }
139
126
  } finally {
140
127
  this.isInitializing = false;
141
- console.log("[InsforgeManager] initialize() completed");
142
128
  }
143
129
  }
144
130
  // Get current state
@@ -479,39 +465,23 @@ var InsforgeManager = class _InsforgeManager {
479
465
  // Handle auth redirect after successful authentication
480
466
  // Works for all auth sources: OAuth providers, cloud hosting sign-in, email verification
481
467
  handleAuthRedirect(isLoaded, user) {
482
- console.log("[InsforgeManager] handleAuthRedirect called:", {
483
- isLoaded,
484
- hasUser: !!user,
485
- userId: user?.id,
486
- hostedMode: this.config.hostedMode,
487
- afterSignInUrl: this.config.afterSignInUrl,
488
- hasProcessedCallback: this.hasProcessedCallbackRef,
489
- currentPath: typeof window !== "undefined" ? window.location.pathname : "SSR"
490
- });
491
468
  if (this.config.hostedMode) {
492
- console.log("[InsforgeManager] \u{1F6AB} BLOCKED: hostedMode is enabled, skipping redirect");
493
469
  return false;
494
470
  }
495
471
  if (!isLoaded || this.hasProcessedCallbackRef) {
496
- console.log("[InsforgeManager] \u{1F6AB} BLOCKED: isLoaded=", isLoaded, "hasProcessedCallback=", this.hasProcessedCallbackRef);
497
472
  return false;
498
473
  }
499
474
  if (user && this.config.afterSignInUrl) {
500
475
  const currentPath = window.location.pathname + window.location.search;
501
476
  const targetPath = this.config.afterSignInUrl;
502
- console.log("[InsforgeManager] Checking redirect conditions:", {
503
- currentPath,
504
- targetPath,
505
- shouldRedirect: currentPath !== targetPath
506
- });
507
477
  if (currentPath !== targetPath && !this.hasProcessedCallbackRef) {
508
478
  this.hasProcessedCallbackRef = true;
509
- console.log("[InsforgeManager] \u{1F504} REDIRECTING to:", targetPath);
510
- console.log("[InsforgeManager] \u26A0\uFE0F REDIRECT BLOCKED FOR DEBUGGING");
511
- return false;
479
+ setTimeout(() => {
480
+ window.location.href = targetPath;
481
+ }, 100);
482
+ return true;
512
483
  }
513
484
  }
514
- console.log("[InsforgeManager] No redirect performed");
515
485
  return false;
516
486
  }
517
487
  // Cleanup
@@ -2244,22 +2214,12 @@ function SignIn({ onError, ...uiProps }) {
2244
2214
  throw new Error(result.error);
2245
2215
  }
2246
2216
  const { user, accessToken, redirectTo } = result;
2247
- console.log("[SignIn] Login success:", {
2248
- hasUser: !!user,
2249
- userId: user?.id,
2250
- hasAccessToken: !!accessToken,
2251
- redirectTo,
2252
- redirectUrl,
2253
- currentLocation: window.location.href
2254
- });
2255
2217
  if (user) {
2256
2218
  const finalUrl = new URL(redirectTo || redirectUrl || "", window.location.origin);
2257
2219
  finalUrl.searchParams.set("access_token", accessToken);
2258
2220
  finalUrl.searchParams.set("user_id", user.id);
2259
2221
  finalUrl.searchParams.set("email", user.email);
2260
2222
  finalUrl.searchParams.set("name", user.name);
2261
- console.log("[SignIn] \u{1F504} About to redirect to:", finalUrl.toString());
2262
- console.log("[SignIn] \u26A0\uFE0F REDIRECT BLOCKED FOR DEBUGGING");
2263
2223
  window.location.href = finalUrl.toString();
2264
2224
  }
2265
2225
  } catch (err) {