@insforge/react 0.5.11 → 0.6.1

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
@@ -3,68 +3,17 @@ export { ForgotPasswordForm, ForgotPasswordFormProps, ResetPasswordForm, ResetPa
3
3
  export { AuthBranding, AuthContainer, AuthContainerProps, AuthDivider, AuthDividerProps, AuthEmailVerificationStep, AuthErrorBanner, AuthErrorBannerProps, AuthFormField, AuthFormFieldProps, AuthHeader, AuthHeaderProps, AuthLink, AuthLinkProps, AuthOAuthButton, AuthOAuthButtonProps, AuthOAuthProviders, AuthOAuthProvidersProps, AuthPasswordField, AuthPasswordFieldProps, AuthPasswordStrengthIndicator, AuthPasswordStrengthIndicatorProps, AuthResetPasswordVerificationStep, AuthSubmitButton, AuthSubmitButtonProps, AuthVerificationCodeInput, AuthVerificationCodeInputProps } from './atoms.cjs';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import { ReactNode } from 'react';
6
- import { UserSchema } from '@insforge/sdk';
7
- import { InsforgeUser, OAuthProvider, OAuthProviderConfig } from './types.cjs';
8
- export { AuthConfig, EmailVerificationMethod } from './types.cjs';
9
- import { CreateSessionResponse, CreateUserResponse, ResetPasswordResponse, GetPublicAuthConfigResponse } from '@insforge/shared-schemas';
6
+ import { InsforgeUser, InsforgeContextValue, OAuthProvider } from '@insforge/shared';
7
+ export { InsforgeContextValue, InsforgeUser, OAuthProvider } from '@insforge/shared';
10
8
  export { useAuth, usePublicAuthConfig, useUser } from './hooks.cjs';
11
9
  export { checkPasswordStrength, createPasswordSchema, emailSchema, passwordSchema, resolveAuthPath, resolveAuthUrl, validateEmail, validatePassword } from './lib.cjs';
10
+ import { OAuthProviderConfig } from './types.cjs';
11
+ export { AuthConfig, EmailVerificationMethod } from './types.cjs';
12
12
  export { BrowserNavigationAdapter, NavigationAdapter, NavigationProvider, NavigationProviderProps, useNavigationAdapter, useSearchParams } from './navigation.cjs';
13
+ import '@insforge/sdk';
14
+ import '@insforge/shared-schemas';
13
15
  import 'zod';
14
16
 
15
- interface InsforgeContextValue {
16
- user: InsforgeUser | null;
17
- isLoaded: boolean;
18
- isSignedIn: boolean;
19
- setUser: (user: InsforgeUser | null) => void;
20
- signIn: (email: string, password: string) => Promise<CreateSessionResponse | {
21
- error: string;
22
- statusCode?: number;
23
- errorCode?: string;
24
- }>;
25
- signUp: (email: string, password: string) => Promise<CreateUserResponse | {
26
- error: string;
27
- statusCode?: number;
28
- errorCode?: string;
29
- }>;
30
- signOut: () => Promise<void>;
31
- updateUser: (data: Partial<InsforgeUser>) => Promise<{
32
- error: string;
33
- } | null>;
34
- reloadAuth: () => Promise<{
35
- success: boolean;
36
- error?: string;
37
- }>;
38
- sendVerificationEmail: (email: string) => Promise<{
39
- success: boolean;
40
- message: string;
41
- } | null>;
42
- sendResetPasswordEmail: (email: string) => Promise<{
43
- success: boolean;
44
- message: string;
45
- } | null>;
46
- resetPassword: (token: string, newPassword: string) => Promise<ResetPasswordResponse | null>;
47
- verifyEmail: (otp: string, email?: string) => Promise<{
48
- accessToken: string;
49
- user?: UserSchema;
50
- redirectTo?: string;
51
- error?: {
52
- message: string;
53
- };
54
- } | null>;
55
- exchangeResetPasswordToken: (email: string, code: string) => Promise<{
56
- token: string;
57
- expiresAt?: string;
58
- } | {
59
- error: {
60
- message: string;
61
- };
62
- }>;
63
- loginWithOAuth: (provider: OAuthProvider, redirectTo: string) => Promise<void>;
64
- getPublicAuthConfig: () => Promise<GetPublicAuthConfigResponse | null>;
65
- baseUrl: string;
66
- afterSignInUrl: string;
67
- }
68
17
  interface InsforgeProviderProps {
69
18
  children: ReactNode;
70
19
  baseUrl: string;
@@ -80,8 +29,8 @@ interface InsforgeProviderProps {
80
29
  /**
81
30
  * Unified Insforge Provider - manages authentication state and configuration
82
31
  *
83
- * Manages user authentication state and provides all necessary context to child components.
84
- * Works with any React framework (Next.js, Vite, Remix, etc.).
32
+ * Uses singleton InsforgeManager to manage state across packages.
33
+ * Context only subscribes to Manager and triggers React re-renders.
85
34
  *
86
35
  * @example
87
36
  * ```tsx
@@ -120,6 +69,9 @@ declare function InsforgeProvider(props: InsforgeProviderProps): react_jsx_runti
120
69
  /**
121
70
  * Hook to access Insforge context
122
71
  *
72
+ * Works seamlessly across packages thanks to singleton Manager.
73
+ * Context instance is guaranteed to be consistent.
74
+ *
123
75
  * @example
124
76
  * ```tsx
125
77
  * function MyComponent() {
@@ -148,4 +100,4 @@ declare function getProviderConfig(provider: OAuthProvider): OAuthProviderConfig
148
100
  */
149
101
  declare function getAllProviderConfigs(): Partial<Record<OAuthProvider, OAuthProviderConfig>>;
150
102
 
151
- export { InsforgeProvider, InsforgeProviderCore, type InsforgeProviderProps, InsforgeUser, OAUTH_PROVIDER_CONFIG, OAuthProvider, OAuthProviderConfig, getAllProviderConfigs, getProviderConfig, useInsforge };
103
+ export { InsforgeProvider, InsforgeProviderCore, type InsforgeProviderProps, OAUTH_PROVIDER_CONFIG, OAuthProviderConfig, getAllProviderConfigs, getProviderConfig, useInsforge };
package/dist/index.d.ts CHANGED
@@ -3,68 +3,17 @@ export { ForgotPasswordForm, ForgotPasswordFormProps, ResetPasswordForm, ResetPa
3
3
  export { AuthBranding, AuthContainer, AuthContainerProps, AuthDivider, AuthDividerProps, AuthEmailVerificationStep, AuthErrorBanner, AuthErrorBannerProps, AuthFormField, AuthFormFieldProps, AuthHeader, AuthHeaderProps, AuthLink, AuthLinkProps, AuthOAuthButton, AuthOAuthButtonProps, AuthOAuthProviders, AuthOAuthProvidersProps, AuthPasswordField, AuthPasswordFieldProps, AuthPasswordStrengthIndicator, AuthPasswordStrengthIndicatorProps, AuthResetPasswordVerificationStep, AuthSubmitButton, AuthSubmitButtonProps, AuthVerificationCodeInput, AuthVerificationCodeInputProps } from './atoms.js';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import { ReactNode } from 'react';
6
- import { UserSchema } from '@insforge/sdk';
7
- import { InsforgeUser, OAuthProvider, OAuthProviderConfig } from './types.js';
8
- export { AuthConfig, EmailVerificationMethod } from './types.js';
9
- import { CreateSessionResponse, CreateUserResponse, ResetPasswordResponse, GetPublicAuthConfigResponse } from '@insforge/shared-schemas';
6
+ import { InsforgeUser, InsforgeContextValue, OAuthProvider } from '@insforge/shared';
7
+ export { InsforgeContextValue, InsforgeUser, OAuthProvider } from '@insforge/shared';
10
8
  export { useAuth, usePublicAuthConfig, useUser } from './hooks.js';
11
9
  export { checkPasswordStrength, createPasswordSchema, emailSchema, passwordSchema, resolveAuthPath, resolveAuthUrl, validateEmail, validatePassword } from './lib.js';
10
+ import { OAuthProviderConfig } from './types.js';
11
+ export { AuthConfig, EmailVerificationMethod } from './types.js';
12
12
  export { BrowserNavigationAdapter, NavigationAdapter, NavigationProvider, NavigationProviderProps, useNavigationAdapter, useSearchParams } from './navigation.js';
13
+ import '@insforge/sdk';
14
+ import '@insforge/shared-schemas';
13
15
  import 'zod';
14
16
 
15
- interface InsforgeContextValue {
16
- user: InsforgeUser | null;
17
- isLoaded: boolean;
18
- isSignedIn: boolean;
19
- setUser: (user: InsforgeUser | null) => void;
20
- signIn: (email: string, password: string) => Promise<CreateSessionResponse | {
21
- error: string;
22
- statusCode?: number;
23
- errorCode?: string;
24
- }>;
25
- signUp: (email: string, password: string) => Promise<CreateUserResponse | {
26
- error: string;
27
- statusCode?: number;
28
- errorCode?: string;
29
- }>;
30
- signOut: () => Promise<void>;
31
- updateUser: (data: Partial<InsforgeUser>) => Promise<{
32
- error: string;
33
- } | null>;
34
- reloadAuth: () => Promise<{
35
- success: boolean;
36
- error?: string;
37
- }>;
38
- sendVerificationEmail: (email: string) => Promise<{
39
- success: boolean;
40
- message: string;
41
- } | null>;
42
- sendResetPasswordEmail: (email: string) => Promise<{
43
- success: boolean;
44
- message: string;
45
- } | null>;
46
- resetPassword: (token: string, newPassword: string) => Promise<ResetPasswordResponse | null>;
47
- verifyEmail: (otp: string, email?: string) => Promise<{
48
- accessToken: string;
49
- user?: UserSchema;
50
- redirectTo?: string;
51
- error?: {
52
- message: string;
53
- };
54
- } | null>;
55
- exchangeResetPasswordToken: (email: string, code: string) => Promise<{
56
- token: string;
57
- expiresAt?: string;
58
- } | {
59
- error: {
60
- message: string;
61
- };
62
- }>;
63
- loginWithOAuth: (provider: OAuthProvider, redirectTo: string) => Promise<void>;
64
- getPublicAuthConfig: () => Promise<GetPublicAuthConfigResponse | null>;
65
- baseUrl: string;
66
- afterSignInUrl: string;
67
- }
68
17
  interface InsforgeProviderProps {
69
18
  children: ReactNode;
70
19
  baseUrl: string;
@@ -80,8 +29,8 @@ interface InsforgeProviderProps {
80
29
  /**
81
30
  * Unified Insforge Provider - manages authentication state and configuration
82
31
  *
83
- * Manages user authentication state and provides all necessary context to child components.
84
- * Works with any React framework (Next.js, Vite, Remix, etc.).
32
+ * Uses singleton InsforgeManager to manage state across packages.
33
+ * Context only subscribes to Manager and triggers React re-renders.
85
34
  *
86
35
  * @example
87
36
  * ```tsx
@@ -120,6 +69,9 @@ declare function InsforgeProvider(props: InsforgeProviderProps): react_jsx_runti
120
69
  /**
121
70
  * Hook to access Insforge context
122
71
  *
72
+ * Works seamlessly across packages thanks to singleton Manager.
73
+ * Context instance is guaranteed to be consistent.
74
+ *
123
75
  * @example
124
76
  * ```tsx
125
77
  * function MyComponent() {
@@ -148,4 +100,4 @@ declare function getProviderConfig(provider: OAuthProvider): OAuthProviderConfig
148
100
  */
149
101
  declare function getAllProviderConfigs(): Partial<Record<OAuthProvider, OAuthProviderConfig>>;
150
102
 
151
- export { InsforgeProvider, InsforgeProviderCore, type InsforgeProviderProps, InsforgeUser, OAUTH_PROVIDER_CONFIG, OAuthProvider, OAuthProviderConfig, getAllProviderConfigs, getProviderConfig, useInsforge };
103
+ export { InsforgeProvider, InsforgeProviderCore, type InsforgeProviderProps, OAUTH_PROVIDER_CONFIG, OAuthProviderConfig, getAllProviderConfigs, getProviderConfig, useInsforge };