@insforge/react 0.7.4 → 0.7.6

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
@@ -66,6 +66,19 @@ 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
+ }
69
82
  var InsforgeManager = class _InsforgeManager {
70
83
  // Static private instance
71
84
  static instance = null;
@@ -267,8 +280,7 @@ var InsforgeManager = class _InsforgeManager {
267
280
  async signIn(email, password) {
268
281
  const sdkResult = await this.sdk.auth.signInWithPassword({
269
282
  email,
270
- password,
271
- hostedMode: this.config.hostedMode ?? false
283
+ password
272
284
  });
273
285
  if (sdkResult.data) {
274
286
  await this.handleAuthSuccess(
@@ -289,7 +301,7 @@ var InsforgeManager = class _InsforgeManager {
289
301
  }
290
302
  }
291
303
  async signUp(email, password) {
292
- const sdkResult = await this.sdk.auth.signUp({ email, password, hostedMode: this.config.hostedMode ?? false });
304
+ const sdkResult = await this.sdk.auth.signUp({ email, password });
293
305
  if (sdkResult.data) {
294
306
  if (sdkResult.data.accessToken) {
295
307
  await this.handleAuthSuccess(
@@ -465,7 +477,7 @@ var InsforgeManager = class _InsforgeManager {
465
477
  // Handle auth redirect after successful authentication
466
478
  // Works for all auth sources: OAuth providers, cloud hosting sign-in, email verification
467
479
  handleAuthRedirect(isLoaded, user) {
468
- if (this.config.hostedMode) {
480
+ if (isHostedAuthEnvironment()) {
469
481
  return false;
470
482
  }
471
483
  if (!isLoaded || this.hasProcessedCallbackRef) {
@@ -511,8 +523,7 @@ function InsforgeProviderCore({
511
523
  onAuthChange,
512
524
  onSignIn,
513
525
  onSignOut,
514
- initialState,
515
- hostedMode = false
526
+ initialState
516
527
  }) {
517
528
  const manager = useMemo(
518
529
  () => InsforgeManager.getInstance({
@@ -520,10 +531,9 @@ function InsforgeProviderCore({
520
531
  afterSignInUrl,
521
532
  onAuthChange,
522
533
  onSignIn,
523
- onSignOut,
524
- hostedMode
534
+ onSignOut
525
535
  }),
526
- [baseUrl, afterSignInUrl, onAuthChange, onSignIn, onSignOut, hostedMode]
536
+ [baseUrl, afterSignInUrl, onAuthChange, onSignIn, onSignOut]
527
537
  );
528
538
  if (initialState) {
529
539
  const currentState = manager.getState();