@insforge/react 0.7.6 → 0.7.7
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/atoms.cjs.map +1 -1
- package/dist/atoms.js.map +1 -1
- package/dist/components.cjs.map +1 -1
- package/dist/components.js.map +1 -1
- package/dist/forms.cjs.map +1 -1
- package/dist/forms.js.map +1 -1
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +0 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +0 -41
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -66,19 +66,6 @@ function useSearchParams() {
|
|
|
66
66
|
const adapter = useNavigationAdapter();
|
|
67
67
|
return adapter.useSearchParams();
|
|
68
68
|
}
|
|
69
|
-
function isHostedAuthEnvironment() {
|
|
70
|
-
if (typeof window === "undefined") {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
const { hostname, port, protocol } = window.location;
|
|
74
|
-
if (hostname === "localhost" && port === "7130") {
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
if (protocol === "https:" && hostname.endsWith(".insforge.app")) {
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
69
|
var InsforgeManager = class _InsforgeManager {
|
|
83
70
|
// Static private instance
|
|
84
71
|
static instance = null;
|
|
@@ -91,7 +78,6 @@ var InsforgeManager = class _InsforgeManager {
|
|
|
91
78
|
// Config
|
|
92
79
|
config;
|
|
93
80
|
refreshIntervalRef = null;
|
|
94
|
-
hasProcessedCallbackRef = false;
|
|
95
81
|
// Private constructor (prevents external instantiation)
|
|
96
82
|
constructor(config) {
|
|
97
83
|
this.config = config;
|
|
@@ -474,28 +460,6 @@ var InsforgeManager = class _InsforgeManager {
|
|
|
474
460
|
getSDK() {
|
|
475
461
|
return this.sdk;
|
|
476
462
|
}
|
|
477
|
-
// Handle auth redirect after successful authentication
|
|
478
|
-
// Works for all auth sources: OAuth providers, cloud hosting sign-in, email verification
|
|
479
|
-
handleAuthRedirect(isLoaded, user) {
|
|
480
|
-
if (isHostedAuthEnvironment()) {
|
|
481
|
-
return false;
|
|
482
|
-
}
|
|
483
|
-
if (!isLoaded || this.hasProcessedCallbackRef) {
|
|
484
|
-
return false;
|
|
485
|
-
}
|
|
486
|
-
if (user && this.config.afterSignInUrl) {
|
|
487
|
-
const currentPath = window.location.pathname + window.location.search;
|
|
488
|
-
const targetPath = this.config.afterSignInUrl;
|
|
489
|
-
if (currentPath !== targetPath && !this.hasProcessedCallbackRef) {
|
|
490
|
-
this.hasProcessedCallbackRef = true;
|
|
491
|
-
setTimeout(() => {
|
|
492
|
-
window.location.href = targetPath;
|
|
493
|
-
}, 100);
|
|
494
|
-
return true;
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
return false;
|
|
498
|
-
}
|
|
499
463
|
// Cleanup
|
|
500
464
|
cleanup() {
|
|
501
465
|
if (this.refreshIntervalRef) {
|
|
@@ -551,11 +515,6 @@ function InsforgeProviderCore({
|
|
|
551
515
|
unsubscribe();
|
|
552
516
|
};
|
|
553
517
|
}, [manager]);
|
|
554
|
-
useEffect(() => {
|
|
555
|
-
if (typeof window !== "undefined") {
|
|
556
|
-
manager.handleAuthRedirect(state.isLoaded, state.user);
|
|
557
|
-
}
|
|
558
|
-
}, [manager, state.isLoaded, state.user]);
|
|
559
518
|
const contextValue = useMemo(
|
|
560
519
|
() => ({
|
|
561
520
|
// State from Manager
|