@insforge/react 0.7.4-dev.6 → 0.7.4
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.cjs +0 -10
- package/dist/components.cjs.map +1 -1
- package/dist/components.js +0 -10
- package/dist/components.js.map +1 -1
- package/dist/index.cjs +4 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -44
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -116,36 +116,22 @@ var InsforgeManager = class _InsforgeManager {
|
|
|
116
116
|
// Public initialization method
|
|
117
117
|
// Even if we have initialState (isLoaded=true from cookies), we still need to load full user data from SDK/API
|
|
118
118
|
async initialize() {
|
|
119
|
-
console.log("[InsforgeManager] initialize() called", {
|
|
120
|
-
isInitializing: this.isInitializing,
|
|
121
|
-
currentUser: this.user?.id || "none",
|
|
122
|
-
isLoaded: this.isLoaded,
|
|
123
|
-
hostedMode: this.config.hostedMode
|
|
124
|
-
});
|
|
125
119
|
if (this.isInitializing) {
|
|
126
|
-
console.log("[InsforgeManager] Already initializing, skipping");
|
|
127
120
|
return;
|
|
128
121
|
}
|
|
129
122
|
this.isInitializing = true;
|
|
130
123
|
try {
|
|
131
124
|
const sessionResult = this.sdk.auth.getCurrentSession();
|
|
132
125
|
const hasToken = !!sessionResult.data?.session?.accessToken;
|
|
133
|
-
console.log("[InsforgeManager] Session check:", {
|
|
134
|
-
hasToken,
|
|
135
|
-
tokenPreview: hasToken ? sessionResult.data?.session?.accessToken?.substring(0, 20) + "..." : "none"
|
|
136
|
-
});
|
|
137
126
|
if (hasToken) {
|
|
138
|
-
console.log("[InsforgeManager] Token found, loading auth state...");
|
|
139
127
|
await this.loadAuthState();
|
|
140
128
|
} else if (this.user === void 0) {
|
|
141
|
-
console.log("[InsforgeManager] No token and no initialState, marking as loaded with no user");
|
|
142
129
|
this.user = null;
|
|
143
130
|
this.isLoaded = true;
|
|
144
131
|
this.notifyListeners();
|
|
145
132
|
}
|
|
146
133
|
} finally {
|
|
147
134
|
this.isInitializing = false;
|
|
148
|
-
console.log("[InsforgeManager] initialize() completed");
|
|
149
135
|
}
|
|
150
136
|
}
|
|
151
137
|
// Get current state
|
|
@@ -486,39 +472,23 @@ var InsforgeManager = class _InsforgeManager {
|
|
|
486
472
|
// Handle auth redirect after successful authentication
|
|
487
473
|
// Works for all auth sources: OAuth providers, cloud hosting sign-in, email verification
|
|
488
474
|
handleAuthRedirect(isLoaded, user) {
|
|
489
|
-
console.log("[InsforgeManager] handleAuthRedirect called:", {
|
|
490
|
-
isLoaded,
|
|
491
|
-
hasUser: !!user,
|
|
492
|
-
userId: user?.id,
|
|
493
|
-
hostedMode: this.config.hostedMode,
|
|
494
|
-
afterSignInUrl: this.config.afterSignInUrl,
|
|
495
|
-
hasProcessedCallback: this.hasProcessedCallbackRef,
|
|
496
|
-
currentPath: typeof window !== "undefined" ? window.location.pathname : "SSR"
|
|
497
|
-
});
|
|
498
475
|
if (this.config.hostedMode) {
|
|
499
|
-
console.log("[InsforgeManager] \u{1F6AB} BLOCKED: hostedMode is enabled, skipping redirect");
|
|
500
476
|
return false;
|
|
501
477
|
}
|
|
502
478
|
if (!isLoaded || this.hasProcessedCallbackRef) {
|
|
503
|
-
console.log("[InsforgeManager] \u{1F6AB} BLOCKED: isLoaded=", isLoaded, "hasProcessedCallback=", this.hasProcessedCallbackRef);
|
|
504
479
|
return false;
|
|
505
480
|
}
|
|
506
481
|
if (user && this.config.afterSignInUrl) {
|
|
507
482
|
const currentPath = window.location.pathname + window.location.search;
|
|
508
483
|
const targetPath = this.config.afterSignInUrl;
|
|
509
|
-
console.log("[InsforgeManager] Checking redirect conditions:", {
|
|
510
|
-
currentPath,
|
|
511
|
-
targetPath,
|
|
512
|
-
shouldRedirect: currentPath !== targetPath
|
|
513
|
-
});
|
|
514
484
|
if (currentPath !== targetPath && !this.hasProcessedCallbackRef) {
|
|
515
485
|
this.hasProcessedCallbackRef = true;
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
486
|
+
setTimeout(() => {
|
|
487
|
+
window.location.href = targetPath;
|
|
488
|
+
}, 100);
|
|
489
|
+
return true;
|
|
519
490
|
}
|
|
520
491
|
}
|
|
521
|
-
console.log("[InsforgeManager] No redirect performed");
|
|
522
492
|
return false;
|
|
523
493
|
}
|
|
524
494
|
// Cleanup
|
|
@@ -2251,22 +2221,12 @@ function SignIn({ onError, ...uiProps }) {
|
|
|
2251
2221
|
throw new Error(result.error);
|
|
2252
2222
|
}
|
|
2253
2223
|
const { user, accessToken, redirectTo } = result;
|
|
2254
|
-
console.log("[SignIn] Login success:", {
|
|
2255
|
-
hasUser: !!user,
|
|
2256
|
-
userId: user?.id,
|
|
2257
|
-
hasAccessToken: !!accessToken,
|
|
2258
|
-
redirectTo,
|
|
2259
|
-
redirectUrl,
|
|
2260
|
-
currentLocation: window.location.href
|
|
2261
|
-
});
|
|
2262
2224
|
if (user) {
|
|
2263
2225
|
const finalUrl = new URL(redirectTo || redirectUrl || "", window.location.origin);
|
|
2264
2226
|
finalUrl.searchParams.set("access_token", accessToken);
|
|
2265
2227
|
finalUrl.searchParams.set("user_id", user.id);
|
|
2266
2228
|
finalUrl.searchParams.set("email", user.email);
|
|
2267
2229
|
finalUrl.searchParams.set("name", user.name);
|
|
2268
|
-
console.log("[SignIn] \u{1F504} About to redirect to:", finalUrl.toString());
|
|
2269
|
-
console.log("[SignIn] \u26A0\uFE0F REDIRECT BLOCKED FOR DEBUGGING");
|
|
2270
2230
|
window.location.href = finalUrl.toString();
|
|
2271
2231
|
}
|
|
2272
2232
|
} catch (err) {
|