@insforge/react 0.7.5 → 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/index.d.cts CHANGED
@@ -34,13 +34,6 @@ interface InsforgeProviderProps {
34
34
  * @internal - Not intended for public use, used by Next.js package
35
35
  */
36
36
  initialState?: InitialAuthState;
37
- /**
38
- * Internal use only - enables hosted auth mode for centralized auth pages.
39
- * When true, disables automatic redirects to prevent security issues.
40
- * @internal - Never set to true in user applications
41
- * @default false
42
- */
43
- hostedMode?: boolean;
44
37
  }
45
38
  /**
46
39
  * Unified Insforge Provider - manages authentication state and configuration
@@ -80,7 +73,7 @@ interface InsforgeProviderProps {
80
73
  * </InsforgeProvider>
81
74
  * ```
82
75
  */
83
- declare function InsforgeProviderCore({ children, baseUrl, afterSignInUrl, onAuthChange, onSignIn, onSignOut, initialState, hostedMode, }: InsforgeProviderProps): react_jsx_runtime.JSX.Element;
76
+ declare function InsforgeProviderCore({ children, baseUrl, afterSignInUrl, onAuthChange, onSignIn, onSignOut, initialState, }: InsforgeProviderProps): react_jsx_runtime.JSX.Element;
84
77
  declare function InsforgeProvider(props: InsforgeProviderProps): react_jsx_runtime.JSX.Element;
85
78
  /**
86
79
  * Hook to access Insforge context
package/dist/index.d.ts CHANGED
@@ -34,13 +34,6 @@ interface InsforgeProviderProps {
34
34
  * @internal - Not intended for public use, used by Next.js package
35
35
  */
36
36
  initialState?: InitialAuthState;
37
- /**
38
- * Internal use only - enables hosted auth mode for centralized auth pages.
39
- * When true, disables automatic redirects to prevent security issues.
40
- * @internal - Never set to true in user applications
41
- * @default false
42
- */
43
- hostedMode?: boolean;
44
37
  }
45
38
  /**
46
39
  * Unified Insforge Provider - manages authentication state and configuration
@@ -80,7 +73,7 @@ interface InsforgeProviderProps {
80
73
  * </InsforgeProvider>
81
74
  * ```
82
75
  */
83
- declare function InsforgeProviderCore({ children, baseUrl, afterSignInUrl, onAuthChange, onSignIn, onSignOut, initialState, hostedMode, }: InsforgeProviderProps): react_jsx_runtime.JSX.Element;
76
+ declare function InsforgeProviderCore({ children, baseUrl, afterSignInUrl, onAuthChange, onSignIn, onSignOut, initialState, }: InsforgeProviderProps): react_jsx_runtime.JSX.Element;
84
77
  declare function InsforgeProvider(props: InsforgeProviderProps): react_jsx_runtime.JSX.Element;
85
78
  /**
86
79
  * Hook to access Insforge context
package/dist/index.js CHANGED
@@ -78,7 +78,6 @@ var InsforgeManager = class _InsforgeManager {
78
78
  // Config
79
79
  config;
80
80
  refreshIntervalRef = null;
81
- hasProcessedCallbackRef = false;
82
81
  // Private constructor (prevents external instantiation)
83
82
  constructor(config) {
84
83
  this.config = config;
@@ -267,8 +266,7 @@ var InsforgeManager = class _InsforgeManager {
267
266
  async signIn(email, password) {
268
267
  const sdkResult = await this.sdk.auth.signInWithPassword({
269
268
  email,
270
- password,
271
- hostedMode: this.config.hostedMode ?? false
269
+ password
272
270
  });
273
271
  if (sdkResult.data) {
274
272
  await this.handleAuthSuccess(
@@ -289,7 +287,7 @@ var InsforgeManager = class _InsforgeManager {
289
287
  }
290
288
  }
291
289
  async signUp(email, password) {
292
- const sdkResult = await this.sdk.auth.signUp({ email, password, hostedMode: this.config.hostedMode ?? false });
290
+ const sdkResult = await this.sdk.auth.signUp({ email, password });
293
291
  if (sdkResult.data) {
294
292
  if (sdkResult.data.accessToken) {
295
293
  await this.handleAuthSuccess(
@@ -462,28 +460,6 @@ var InsforgeManager = class _InsforgeManager {
462
460
  getSDK() {
463
461
  return this.sdk;
464
462
  }
465
- // Handle auth redirect after successful authentication
466
- // Works for all auth sources: OAuth providers, cloud hosting sign-in, email verification
467
- handleAuthRedirect(isLoaded, user) {
468
- if (this.config.hostedMode) {
469
- return false;
470
- }
471
- if (!isLoaded || this.hasProcessedCallbackRef) {
472
- return false;
473
- }
474
- if (user && this.config.afterSignInUrl) {
475
- const currentPath = window.location.pathname + window.location.search;
476
- const targetPath = this.config.afterSignInUrl;
477
- if (currentPath !== targetPath && !this.hasProcessedCallbackRef) {
478
- this.hasProcessedCallbackRef = true;
479
- setTimeout(() => {
480
- window.location.href = targetPath;
481
- }, 100);
482
- return true;
483
- }
484
- }
485
- return false;
486
- }
487
463
  // Cleanup
488
464
  cleanup() {
489
465
  if (this.refreshIntervalRef) {
@@ -511,8 +487,7 @@ function InsforgeProviderCore({
511
487
  onAuthChange,
512
488
  onSignIn,
513
489
  onSignOut,
514
- initialState,
515
- hostedMode = false
490
+ initialState
516
491
  }) {
517
492
  const manager = useMemo(
518
493
  () => InsforgeManager.getInstance({
@@ -520,10 +495,9 @@ function InsforgeProviderCore({
520
495
  afterSignInUrl,
521
496
  onAuthChange,
522
497
  onSignIn,
523
- onSignOut,
524
- hostedMode
498
+ onSignOut
525
499
  }),
526
- [baseUrl, afterSignInUrl, onAuthChange, onSignIn, onSignOut, hostedMode]
500
+ [baseUrl, afterSignInUrl, onAuthChange, onSignIn, onSignOut]
527
501
  );
528
502
  if (initialState) {
529
503
  const currentState = manager.getState();
@@ -541,11 +515,6 @@ function InsforgeProviderCore({
541
515
  unsubscribe();
542
516
  };
543
517
  }, [manager]);
544
- useEffect(() => {
545
- if (typeof window !== "undefined") {
546
- manager.handleAuthRedirect(state.isLoaded, state.user);
547
- }
548
- }, [manager, state.isLoaded, state.user]);
549
518
  const contextValue = useMemo(
550
519
  () => ({
551
520
  // State from Manager