@insforge/react 0.3.5 → 0.4.5

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.
Files changed (66) hide show
  1. package/README.md +476 -604
  2. package/dist/atoms.cjs +837 -0
  3. package/dist/atoms.cjs.map +1 -0
  4. package/dist/atoms.d.cts +253 -0
  5. package/dist/atoms.d.ts +111 -245
  6. package/dist/atoms.js +412 -468
  7. package/dist/atoms.js.map +1 -1
  8. package/dist/components.cjs +2000 -0
  9. package/dist/components.cjs.map +1 -0
  10. package/dist/components.d.cts +258 -0
  11. package/dist/components.d.ts +71 -123
  12. package/dist/components.js +1040 -1428
  13. package/dist/components.js.map +1 -1
  14. package/dist/forms.cjs +1194 -0
  15. package/dist/forms.cjs.map +1 -0
  16. package/dist/forms.d.cts +135 -0
  17. package/dist/forms.d.ts +113 -163
  18. package/dist/forms.js +657 -943
  19. package/dist/forms.js.map +1 -1
  20. package/dist/{hooks.mjs → hooks.cjs} +15 -13
  21. package/dist/hooks.cjs.map +1 -0
  22. package/dist/{hooks.d.mts → hooks.d.cts} +1 -1
  23. package/dist/hooks.js +9 -15
  24. package/dist/hooks.js.map +1 -1
  25. package/dist/index.cjs +2461 -0
  26. package/dist/index.cjs.map +1 -0
  27. package/dist/{index.d.mts → index.d.cts} +37 -22
  28. package/dist/index.d.ts +34 -19
  29. package/dist/index.js +1142 -1497
  30. package/dist/index.js.map +1 -1
  31. package/dist/{lib.mjs → lib.cjs} +13 -11
  32. package/dist/lib.cjs.map +1 -0
  33. package/dist/{lib.d.mts → lib.d.cts} +1 -8
  34. package/dist/lib.d.ts +1 -8
  35. package/dist/lib.js +4 -17
  36. package/dist/lib.js.map +1 -1
  37. package/dist/{router.mjs → router.cjs} +14 -16
  38. package/dist/router.cjs.map +1 -0
  39. package/dist/{router.d.mts → router.d.cts} +0 -11
  40. package/dist/router.d.ts +0 -11
  41. package/dist/router.js +10 -16
  42. package/dist/router.js.map +1 -1
  43. package/dist/styles.css +864 -2
  44. package/dist/types.cjs +4 -0
  45. package/dist/{types.mjs.map → types.cjs.map} +1 -1
  46. package/dist/types.d.cts +32 -0
  47. package/dist/types.d.ts +11 -613
  48. package/dist/types.js +0 -1
  49. package/package.json +111 -98
  50. package/dist/atoms.d.mts +0 -387
  51. package/dist/atoms.mjs +0 -861
  52. package/dist/atoms.mjs.map +0 -1
  53. package/dist/components.d.mts +0 -310
  54. package/dist/components.mjs +0 -2327
  55. package/dist/components.mjs.map +0 -1
  56. package/dist/forms.d.mts +0 -185
  57. package/dist/forms.mjs +0 -1468
  58. package/dist/forms.mjs.map +0 -1
  59. package/dist/hooks.mjs.map +0 -1
  60. package/dist/index.mjs +0 -2724
  61. package/dist/index.mjs.map +0 -1
  62. package/dist/lib.mjs.map +0 -1
  63. package/dist/router.mjs.map +0 -1
  64. package/dist/types.d.mts +0 -634
  65. package/dist/types.mjs +0 -3
  66. package/src/styles.css +0 -15
@@ -0,0 +1,258 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { UserSchema } from '@insforge/sdk';
3
+ import * as react from 'react';
4
+ import { ReactNode } from 'react';
5
+ import { InsforgeUser } from './types.cjs';
6
+ export { ForgotPasswordForm, ForgotPasswordFormProps, ResetPasswordForm, ResetPasswordFormProps, SignInForm, SignInFormProps, SignUpForm, SignUpFormProps, VerifyEmailStatus, VerifyEmailStatusProps } from './forms.cjs';
7
+ 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';
8
+ import '@insforge/shared-schemas';
9
+
10
+ interface SignInProps {
11
+ title?: string;
12
+ subtitle?: string;
13
+ emailLabel?: string;
14
+ emailPlaceholder?: string;
15
+ passwordLabel?: string;
16
+ passwordPlaceholder?: string;
17
+ forgotPasswordText?: string;
18
+ forgotPasswordUrl?: string;
19
+ submitButtonText?: string;
20
+ loadingButtonText?: string;
21
+ signUpText?: string;
22
+ signUpLinkText?: string;
23
+ signUpUrl?: string;
24
+ dividerText?: string;
25
+ onError?: (error: Error) => void;
26
+ }
27
+ /**
28
+ * Pre-built sign-in component with full authentication logic.
29
+ *
30
+ * @component
31
+ * @example
32
+ * ```tsx
33
+ * <SignIn
34
+ * onSuccess={(user) => console.log('Signed in:', user)}
35
+ * onError={(error) => console.error('Error:', error)}
36
+ * />
37
+ * ```
38
+ */
39
+ declare function SignIn({ onError, ...uiProps }: SignInProps): react_jsx_runtime.JSX.Element | null;
40
+
41
+ interface SignUpProps {
42
+ title?: string;
43
+ subtitle?: string;
44
+ emailLabel?: string;
45
+ emailPlaceholder?: string;
46
+ passwordLabel?: string;
47
+ passwordPlaceholder?: string;
48
+ submitButtonText?: string;
49
+ loadingButtonText?: string;
50
+ signInText?: string;
51
+ signInLinkText?: string;
52
+ signInUrl?: string;
53
+ dividerText?: string;
54
+ onError?: (error: Error) => void;
55
+ }
56
+ /**
57
+ * Pre-built sign-up component with full authentication logic.
58
+ *
59
+ * @component
60
+ * @example
61
+ * ```tsx
62
+ * <SignUp
63
+ * onError={(error) => console.error('Error:', error)}
64
+ * />
65
+ *
66
+ * ```
67
+ */
68
+ declare function SignUp({ onError, ...uiProps }: SignUpProps): react_jsx_runtime.JSX.Element | null;
69
+
70
+ interface ForgotPasswordProps {
71
+ /** Text customization */
72
+ title?: string;
73
+ subtitle?: string;
74
+ emailLabel?: string;
75
+ emailPlaceholder?: string;
76
+ submitButtonText?: string;
77
+ loadingButtonText?: string;
78
+ backToSignInText?: string;
79
+ /** Callback when an error occurs */
80
+ onError?: (error: Error) => void;
81
+ }
82
+ /**
83
+ * Pre-built forgot password component with full business logic.
84
+ *
85
+ * Supports two password reset methods (auto-detected from backend config):
86
+ * - **Link method**: Two-step flow (email → check email message)
87
+ * User receives an email with a reset link to complete the process in a new tab
88
+ * - **Code method**: Three-step flow (email → verify code → reset password)
89
+ * User receives a verification code, enters it, then sets a new password
90
+ *
91
+ * @component
92
+ * @example
93
+ * ```tsx
94
+ * <ForgotPassword
95
+ * onError={(error) => console.error('Error:', error)}
96
+ * />
97
+ * ```
98
+ */
99
+ declare function ForgotPassword({ onError, ...uiProps }: ForgotPasswordProps): react_jsx_runtime.JSX.Element | null;
100
+
101
+ interface ResetPasswordProps {
102
+ /** Text customization */
103
+ title?: string;
104
+ subtitle?: string;
105
+ newPasswordLabel?: string;
106
+ newPasswordPlaceholder?: string;
107
+ confirmPasswordLabel?: string;
108
+ confirmPasswordPlaceholder?: string;
109
+ submitButtonText?: string;
110
+ loadingButtonText?: string;
111
+ /** Callback when an error occurs */
112
+ onError?: (error: Error) => void;
113
+ }
114
+ /**
115
+ * Pre-built reset password page component with full business logic.
116
+ *
117
+ * Automatically reads the reset token from URL query parameter (?token=xxx).
118
+ * Shows an error if token is missing.
119
+ *
120
+ * @component
121
+ * @example
122
+ * ```tsx
123
+ * // Used at /reset-password?token=xxxxx
124
+ * <ResetPassword />
125
+ * ```
126
+ */
127
+ declare function ResetPassword({ onError, ...uiProps }: ResetPasswordProps): react_jsx_runtime.JSX.Element | null;
128
+
129
+ interface VerifyEmailProps {
130
+ /** Verification token (from URL query params) */
131
+ token: string;
132
+ /** Text customization */
133
+ verifyingTitle?: string;
134
+ successTitle?: string;
135
+ successMessage?: string;
136
+ errorTitle?: string;
137
+ /** Callback when verification is successful */
138
+ onSuccess?: (data: {
139
+ accessToken: string;
140
+ user?: UserSchema;
141
+ redirectTo?: string;
142
+ }) => void;
143
+ /** Callback when verification fails */
144
+ onError?: (error: Error) => void;
145
+ }
146
+ /**
147
+ * Pre-built email verification component with full business logic.
148
+ *
149
+ * Automatically verifies the email when mounted using the provided token.
150
+ *
151
+ * @component
152
+ * @example
153
+ * ```tsx
154
+ * const token = new URLSearchParams(window.location.search).get('token');
155
+ *
156
+ * <VerifyEmail
157
+ * token={token || ''}
158
+ * onSuccess={(data) => {
159
+ * console.log('Email verified!', data);
160
+ * // Optionally navigate or close window
161
+ * }}
162
+ * onError={(error) => console.error('Verification failed:', error)}
163
+ * />
164
+ * ```
165
+ */
166
+ declare function VerifyEmail({ token, onSuccess, onError, ...uiProps }: VerifyEmailProps): react_jsx_runtime.JSX.Element;
167
+
168
+ interface UserButtonProps {
169
+ afterSignOutUrl?: string;
170
+ mode?: 'detailed' | 'simple';
171
+ }
172
+ /**
173
+ * User profile button with dropdown menu and sign-out functionality.
174
+ */
175
+ declare function UserButton({ afterSignOutUrl, mode }: UserButtonProps): react_jsx_runtime.JSX.Element | null;
176
+
177
+ interface ProtectProps {
178
+ children: ReactNode;
179
+ fallback?: ReactNode;
180
+ redirectTo?: string;
181
+ condition?: (user: InsforgeUser) => boolean;
182
+ onRedirect?: (url: string) => void;
183
+ }
184
+ /**
185
+ * Protected route component that redirects unauthenticated users.
186
+ *
187
+ * @component
188
+ * @example
189
+ * ```tsx
190
+ * // Basic usage
191
+ * <Protect redirectTo="/sign-in">
192
+ * <Dashboard />
193
+ * </Protect>
194
+ *
195
+ * // With custom redirect handler (e.g., for Next.js router)
196
+ * <Protect
197
+ * redirectTo="/sign-in"
198
+ * onRedirect={(url) => router.push(url)}
199
+ * >
200
+ * <AdminPanel />
201
+ * </Protect>
202
+ *
203
+ * // With custom condition (role-based access)
204
+ * <Protect
205
+ * redirectTo="/unauthorized"
206
+ * condition={(user) => user.role === 'admin'}
207
+ * >
208
+ * <AdminContent />
209
+ * </Protect>
210
+ * ```
211
+ *
212
+ * @param {ReactNode} children - Content to protect
213
+ * @param {ReactNode} [fallback] - Fallback UI while loading
214
+ * @param {string} [redirectTo='/sign-in'] - Redirect URL
215
+ * @param {function} [condition] - Custom access condition
216
+ * @param {function} [onRedirect] - Custom redirect handler (default: window.location)
217
+ */
218
+ declare function Protect({ children, fallback, redirectTo, condition, onRedirect, }: ProtectProps): string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null;
219
+
220
+ interface ConditionalProps$1 {
221
+ children: ReactNode;
222
+ }
223
+ /**
224
+ * Conditional component that renders children only when user is signed in.
225
+ *
226
+ * @component
227
+ * @example
228
+ * ```tsx
229
+ * <SignedIn>
230
+ * <Dashboard />
231
+ * </SignedIn>
232
+ * ```
233
+ *
234
+ * @param {ReactNode} children - React nodes to render when user is authenticated
235
+ * @returns {JSX.Element | null} Renders children when signed in, null otherwise
236
+ */
237
+ declare function SignedIn({ children }: ConditionalProps$1): react_jsx_runtime.JSX.Element | null;
238
+
239
+ interface ConditionalProps {
240
+ children: ReactNode;
241
+ }
242
+ /**
243
+ * Conditional component that renders children only when user is signed out.
244
+ *
245
+ * @component
246
+ * @example
247
+ * ```tsx
248
+ * <SignedOut>
249
+ * <SignIn />
250
+ * </SignedOut>
251
+ * ```
252
+ *
253
+ * @param {ReactNode} children - React nodes to render when user is not authenticated
254
+ * @returns {JSX.Element | null} Renders children when signed out, null otherwise
255
+ */
256
+ declare function SignedOut({ children }: ConditionalProps): react_jsx_runtime.JSX.Element | null;
257
+
258
+ export { type ConditionalProps$1 as ConditionalProps, ForgotPassword, type ForgotPasswordProps, Protect, type ProtectProps, ResetPassword, type ResetPasswordProps, SignIn, type SignInProps, SignUp, type SignUpProps, SignedIn, SignedOut, UserButton, type UserButtonProps, VerifyEmail, type VerifyEmailProps };
@@ -1,11 +1,29 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { SignInProps, SignUpProps, ForgotPasswordAppearance, ResetPasswordAppearance, VerifyEmailStatusProps, UserButtonProps, ProtectProps, ConditionalProps } from './types.js';
2
+ import { UserSchema } from '@insforge/sdk';
3
3
  import * as react from 'react';
4
4
  import { ReactNode } from 'react';
5
- export { ForgotPasswordForm, ResetPasswordForm, SignInForm, SignUpForm, VerifyEmailStatus } from './forms.js';
6
- export { AuthBranding, AuthContainer, AuthDivider, AuthEmailVerificationStep, AuthErrorBanner, AuthFormField, AuthHeader, AuthLink, AuthOAuthButton, AuthOAuthProviders, AuthPasswordField, AuthPasswordStrengthIndicator, AuthSubmitButton, AuthVerificationCodeInput, validatePasswordStrength } from './atoms.js';
5
+ import { InsforgeUser } from './types.js';
6
+ export { ForgotPasswordForm, ForgotPasswordFormProps, ResetPasswordForm, ResetPasswordFormProps, SignInForm, SignInFormProps, SignUpForm, SignUpFormProps, VerifyEmailStatus, VerifyEmailStatusProps } from './forms.js';
7
+ 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';
7
8
  import '@insforge/shared-schemas';
8
9
 
10
+ interface SignInProps {
11
+ title?: string;
12
+ subtitle?: string;
13
+ emailLabel?: string;
14
+ emailPlaceholder?: string;
15
+ passwordLabel?: string;
16
+ passwordPlaceholder?: string;
17
+ forgotPasswordText?: string;
18
+ forgotPasswordUrl?: string;
19
+ submitButtonText?: string;
20
+ loadingButtonText?: string;
21
+ signUpText?: string;
22
+ signUpLinkText?: string;
23
+ signUpUrl?: string;
24
+ dividerText?: string;
25
+ onError?: (error: Error) => void;
26
+ }
9
27
  /**
10
28
  * Pre-built sign-in component with full authentication logic.
11
29
  *
@@ -13,14 +31,28 @@ import '@insforge/shared-schemas';
13
31
  * @example
14
32
  * ```tsx
15
33
  * <SignIn
16
- * afterSignInUrl="/auth/callback"
17
34
  * onSuccess={(user) => console.log('Signed in:', user)}
18
35
  * onError={(error) => console.error('Error:', error)}
19
36
  * />
20
37
  * ```
21
38
  */
22
- declare function SignIn({ afterSignInUrl, onSuccess, onError, ...uiProps }: SignInProps): react_jsx_runtime.JSX.Element | null;
39
+ declare function SignIn({ onError, ...uiProps }: SignInProps): react_jsx_runtime.JSX.Element | null;
23
40
 
41
+ interface SignUpProps {
42
+ title?: string;
43
+ subtitle?: string;
44
+ emailLabel?: string;
45
+ emailPlaceholder?: string;
46
+ passwordLabel?: string;
47
+ passwordPlaceholder?: string;
48
+ submitButtonText?: string;
49
+ loadingButtonText?: string;
50
+ signInText?: string;
51
+ signInLinkText?: string;
52
+ signInUrl?: string;
53
+ dividerText?: string;
54
+ onError?: (error: Error) => void;
55
+ }
24
56
  /**
25
57
  * Pre-built sign-up component with full authentication logic.
26
58
  *
@@ -28,18 +60,14 @@ declare function SignIn({ afterSignInUrl, onSuccess, onError, ...uiProps }: Sign
28
60
  * @example
29
61
  * ```tsx
30
62
  * <SignUp
31
- * afterSignUpUrl="/auth/callback"
32
- * onSuccess={(user) => console.log('Signed up:', user)}
33
63
  * onError={(error) => console.error('Error:', error)}
34
64
  * />
35
65
  *
36
66
  * ```
37
67
  */
38
- declare function SignUp({ afterSignUpUrl, onSuccess, onError, ...uiProps }: SignUpProps): react_jsx_runtime.JSX.Element | null;
68
+ declare function SignUp({ onError, ...uiProps }: SignUpProps): react_jsx_runtime.JSX.Element | null;
39
69
 
40
70
  interface ForgotPasswordProps {
41
- /** Hierarchical appearance configuration for deep customization */
42
- appearance?: ForgotPasswordAppearance;
43
71
  /** Text customization */
44
72
  title?: string;
45
73
  subtitle?: string;
@@ -48,11 +76,6 @@ interface ForgotPasswordProps {
48
76
  submitButtonText?: string;
49
77
  loadingButtonText?: string;
50
78
  backToSignInText?: string;
51
- backToSignInUrl?: string;
52
- successTitle?: string;
53
- successMessage?: string;
54
- /** Callback when password is successfully reset */
55
- onSuccess?: () => void;
56
79
  /** Callback when an error occurs */
57
80
  onError?: (error: Error) => void;
58
81
  }
@@ -60,26 +83,22 @@ interface ForgotPasswordProps {
60
83
  * Pre-built forgot password component with full business logic.
61
84
  *
62
85
  * Supports two password reset methods (auto-detected from backend config):
63
- * - **Link method**: Sends email with reset link (handled by ResetPassword component)
86
+ * - **Link method**: Two-step flow (email check email message)
87
+ * User receives an email with a reset link to complete the process in a new tab
64
88
  * - **Code method**: Three-step flow (email → verify code → reset password)
89
+ * User receives a verification code, enters it, then sets a new password
65
90
  *
66
91
  * @component
67
92
  * @example
68
93
  * ```tsx
69
94
  * <ForgotPassword
70
- * backToSignInUrl="/sign-in"
71
- * onSuccess={() => console.log('Password reset!')}
72
95
  * onError={(error) => console.error('Error:', error)}
73
96
  * />
74
97
  * ```
75
98
  */
76
- declare function ForgotPassword({ backToSignInUrl, onSuccess, onError, ...uiProps }: ForgotPasswordProps): react_jsx_runtime.JSX.Element | null;
99
+ declare function ForgotPassword({ onError, ...uiProps }: ForgotPasswordProps): react_jsx_runtime.JSX.Element | null;
77
100
 
78
101
  interface ResetPasswordProps {
79
- /** Reset password token (from URL query params) */
80
- token: string;
81
- /** Hierarchical appearance configuration for deep customization */
82
- appearance?: ResetPasswordAppearance;
83
102
  /** Text customization */
84
103
  title?: string;
85
104
  subtitle?: string;
@@ -89,36 +108,27 @@ interface ResetPasswordProps {
89
108
  confirmPasswordPlaceholder?: string;
90
109
  submitButtonText?: string;
91
110
  loadingButtonText?: string;
92
- backToSignInText?: string;
93
- backToSignInUrl?: string;
94
- /** Callback when password reset is successful */
95
- onSuccess?: () => void;
96
111
  /** Callback when an error occurs */
97
112
  onError?: (error: Error) => void;
98
113
  }
99
114
  /**
100
- * Pre-built reset password component with full business logic.
115
+ * Pre-built reset password page component with full business logic.
116
+ *
117
+ * Automatically reads the reset token from URL query parameter (?token=xxx).
118
+ * Shows an error if token is missing.
101
119
  *
102
120
  * @component
103
121
  * @example
104
122
  * ```tsx
105
- * const token = new URLSearchParams(window.location.search).get('token');
106
- *
107
- * <ResetPassword
108
- * token={token || ''}
109
- * backToSignInUrl="/sign-in"
110
- * onSuccess={(redirectTo) => window.location.href = redirectTo || '/'}
111
- * onError={(error) => console.error('Error:', error)}
112
- * />
123
+ * // Used at /reset-password?token=xxxxx
124
+ * <ResetPassword />
113
125
  * ```
114
126
  */
115
- declare function ResetPassword({ token, backToSignInUrl, onSuccess, onError, ...uiProps }: ResetPasswordProps): react_jsx_runtime.JSX.Element | null;
127
+ declare function ResetPassword({ onError, ...uiProps }: ResetPasswordProps): react_jsx_runtime.JSX.Element | null;
116
128
 
117
129
  interface VerifyEmailProps {
118
130
  /** Verification token (from URL query params) */
119
131
  token: string;
120
- /** Appearance configuration */
121
- appearance?: VerifyEmailStatusProps["appearance"];
122
132
  /** Text customization */
123
133
  verifyingTitle?: string;
124
134
  successTitle?: string;
@@ -127,7 +137,7 @@ interface VerifyEmailProps {
127
137
  /** Callback when verification is successful */
128
138
  onSuccess?: (data: {
129
139
  accessToken: string;
130
- user?: any;
140
+ user?: UserSchema;
131
141
  redirectTo?: string;
132
142
  }) => void;
133
143
  /** Callback when verification fails */
@@ -155,32 +165,22 @@ interface VerifyEmailProps {
155
165
  */
156
166
  declare function VerifyEmail({ token, onSuccess, onError, ...uiProps }: VerifyEmailProps): react_jsx_runtime.JSX.Element;
157
167
 
168
+ interface UserButtonProps {
169
+ afterSignOutUrl?: string;
170
+ mode?: 'detailed' | 'simple';
171
+ }
158
172
  /**
159
173
  * User profile button with dropdown menu and sign-out functionality.
160
- *
161
- * @component
162
- * @example
163
- * ```tsx
164
- * <UserButton afterSignOutUrl="/" />
165
- *
166
- * // Simple mode
167
- * <UserButton mode="simple" />
168
- *
169
- * // With custom styling
170
- * <UserButton
171
- * appearance={{
172
- * buttonClassName: "hover:bg-white/10",
173
- * dropdownClassName: "bg-gray-900"
174
- * }}
175
- * />
176
- * ```
177
- *
178
- * @param {string} [afterSignOutUrl='/'] - URL to redirect to after sign-out
179
- * @param {'detailed'|'simple'} [mode='detailed'] - Display mode
180
- * @param {object} [appearance] - Custom Tailwind classes
181
174
  */
182
- declare function UserButton({ afterSignOutUrl, mode, appearance, }: UserButtonProps): react_jsx_runtime.JSX.Element | null;
175
+ declare function UserButton({ afterSignOutUrl, mode }: UserButtonProps): react_jsx_runtime.JSX.Element | null;
183
176
 
177
+ interface ProtectProps {
178
+ children: ReactNode;
179
+ fallback?: ReactNode;
180
+ redirectTo?: string;
181
+ condition?: (user: InsforgeUser) => boolean;
182
+ onRedirect?: (url: string) => void;
183
+ }
184
184
  /**
185
185
  * Protected route component that redirects unauthenticated users.
186
186
  *
@@ -215,8 +215,11 @@ declare function UserButton({ afterSignOutUrl, mode, appearance, }: UserButtonPr
215
215
  * @param {function} [condition] - Custom access condition
216
216
  * @param {function} [onRedirect] - Custom redirect handler (default: window.location)
217
217
  */
218
- declare function Protect({ children, fallback, redirectTo, condition, onRedirect, }: ProtectProps): string | number | bigint | true | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null;
218
+ declare function Protect({ children, fallback, redirectTo, condition, onRedirect, }: ProtectProps): string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null;
219
219
 
220
+ interface ConditionalProps$1 {
221
+ children: ReactNode;
222
+ }
220
223
  /**
221
224
  * Conditional component that renders children only when user is signed in.
222
225
  *
@@ -231,8 +234,11 @@ declare function Protect({ children, fallback, redirectTo, condition, onRedirect
231
234
  * @param {ReactNode} children - React nodes to render when user is authenticated
232
235
  * @returns {JSX.Element | null} Renders children when signed in, null otherwise
233
236
  */
234
- declare function SignedIn({ children }: ConditionalProps): react_jsx_runtime.JSX.Element | null;
237
+ declare function SignedIn({ children }: ConditionalProps$1): react_jsx_runtime.JSX.Element | null;
235
238
 
239
+ interface ConditionalProps {
240
+ children: ReactNode;
241
+ }
236
242
  /**
237
243
  * Conditional component that renders children only when user is signed out.
238
244
  *
@@ -249,62 +255,4 @@ declare function SignedIn({ children }: ConditionalProps): react_jsx_runtime.JSX
249
255
  */
250
256
  declare function SignedOut({ children }: ConditionalProps): react_jsx_runtime.JSX.Element | null;
251
257
 
252
- interface InsforgeCallbackProps {
253
- /**
254
- * Redirect destination after successful authentication
255
- */
256
- redirectTo?: string;
257
- /**
258
- * Callback fired on successful authentication
259
- */
260
- onSuccess?: () => void;
261
- /**
262
- * Callback fired on authentication error
263
- */
264
- onError?: (error: string) => void;
265
- /**
266
- * Custom loading component
267
- */
268
- loadingComponent?: ReactNode;
269
- /**
270
- * Custom redirect handler (default: window.location)
271
- */
272
- onRedirect?: (url: string) => void;
273
- }
274
- /**
275
- * InsforgeCallback - Handles OAuth authentication callbacks
276
- *
277
- * Place this component on your `/auth/callback` page.
278
- *
279
- * How it works:
280
- * 1. SDK automatically detects OAuth callback parameters and saves to localStorage
281
- * 2. Provider validates the session from localStorage
282
- * 3. This component waits for validation and handles redirect
283
- *
284
- * @example
285
- * ```tsx
286
- * // Minimal usage
287
- * export default function CallbackPage() {
288
- * return <InsforgeCallback redirectTo="/dashboard" />;
289
- * }
290
- * ```
291
- *
292
- * @example
293
- * ```tsx
294
- * // With Next.js router
295
- * import { useRouter } from 'next/navigation';
296
- *
297
- * export default function CallbackPage() {
298
- * const router = useRouter();
299
- * return (
300
- * <InsforgeCallback
301
- * redirectTo="/dashboard"
302
- * onRedirect={(url) => router.push(url)}
303
- * />
304
- * );
305
- * }
306
- * ```
307
- */
308
- declare function InsforgeCallback({ redirectTo, onSuccess, onError, loadingComponent, onRedirect, }: InsforgeCallbackProps): string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element;
309
-
310
- export { ForgotPassword, InsforgeCallback, type InsforgeCallbackProps, Protect, ResetPassword, SignIn, SignUp, SignedIn, SignedOut, UserButton, VerifyEmail };
258
+ export { type ConditionalProps$1 as ConditionalProps, ForgotPassword, type ForgotPasswordProps, Protect, type ProtectProps, ResetPassword, type ResetPasswordProps, SignIn, type SignInProps, SignUp, type SignUpProps, SignedIn, SignedOut, UserButton, type UserButtonProps, VerifyEmail, type VerifyEmailProps };