@insforge/react 0.2.10 → 0.3.0

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.
@@ -1,9 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { SignInProps, SignUpProps, UserButtonProps, ProtectProps, ConditionalProps } from './types.js';
2
+ import { SignInProps, SignUpProps, ForgotPasswordAppearance, ResetPasswordAppearance, VerifyEmailStatusProps, UserButtonProps, ProtectProps, ConditionalProps } from './types.js';
3
3
  import * as react from 'react';
4
4
  import { ReactNode } from 'react';
5
5
  export { ForgotPasswordForm, ResetPasswordForm, SignInForm, SignUpForm, VerifyEmailStatus } from './forms.js';
6
- export { AuthBranding, AuthContainer, AuthDivider, AuthErrorBanner, AuthFormField, AuthHeader, AuthLink, AuthOAuthButton, AuthOAuthProviders, AuthPasswordField, AuthPasswordStrengthIndicator, AuthSubmitButton, AuthVerificationCodeInput, validatePasswordStrength } from './atoms.js';
6
+ export { AuthBranding, AuthContainer, AuthDivider, AuthEmailVerificationStep, AuthErrorBanner, AuthFormField, AuthHeader, AuthLink, AuthOAuthButton, AuthOAuthProviders, AuthPasswordField, AuthPasswordStrengthIndicator, AuthSubmitButton, AuthVerificationCodeInput, validatePasswordStrength } from './atoms.js';
7
7
  import '@insforge/shared-schemas';
8
8
 
9
9
  /**
@@ -37,6 +37,123 @@ declare function SignIn({ afterSignInUrl, onSuccess, onError, ...uiProps }: Sign
37
37
  */
38
38
  declare function SignUp({ afterSignUpUrl, onSuccess, onError, ...uiProps }: SignUpProps): react_jsx_runtime.JSX.Element | null;
39
39
 
40
+ interface ForgotPasswordProps {
41
+ /** Hierarchical appearance configuration for deep customization */
42
+ appearance?: ForgotPasswordAppearance;
43
+ /** Text customization */
44
+ title?: string;
45
+ subtitle?: string;
46
+ emailLabel?: string;
47
+ emailPlaceholder?: string;
48
+ submitButtonText?: string;
49
+ loadingButtonText?: string;
50
+ backToSignInText?: string;
51
+ backToSignInUrl?: string;
52
+ successTitle?: string;
53
+ successMessage?: string;
54
+ /** Callback when password is successfully reset */
55
+ onSuccess?: () => void;
56
+ /** Callback when an error occurs */
57
+ onError?: (error: Error) => void;
58
+ }
59
+ /**
60
+ * Pre-built forgot password component with full business logic.
61
+ *
62
+ * Supports two password reset methods (auto-detected from backend config):
63
+ * - **Link method**: Sends email with reset link (handled by ResetPassword component)
64
+ * - **Code method**: Three-step flow (email → verify code → reset password)
65
+ *
66
+ * @component
67
+ * @example
68
+ * ```tsx
69
+ * <ForgotPassword
70
+ * backToSignInUrl="/sign-in"
71
+ * onSuccess={() => console.log('Password reset!')}
72
+ * onError={(error) => console.error('Error:', error)}
73
+ * />
74
+ * ```
75
+ */
76
+ declare function ForgotPassword({ backToSignInUrl, onSuccess, onError, ...uiProps }: ForgotPasswordProps): react_jsx_runtime.JSX.Element | null;
77
+
78
+ interface ResetPasswordProps {
79
+ /** Reset password token (from URL query params) */
80
+ token: string;
81
+ /** Hierarchical appearance configuration for deep customization */
82
+ appearance?: ResetPasswordAppearance;
83
+ /** Text customization */
84
+ title?: string;
85
+ subtitle?: string;
86
+ newPasswordLabel?: string;
87
+ newPasswordPlaceholder?: string;
88
+ confirmPasswordLabel?: string;
89
+ confirmPasswordPlaceholder?: string;
90
+ submitButtonText?: string;
91
+ loadingButtonText?: string;
92
+ backToSignInText?: string;
93
+ backToSignInUrl?: string;
94
+ /** Callback when password reset is successful */
95
+ onSuccess?: (redirectTo?: string) => void;
96
+ /** Callback when an error occurs */
97
+ onError?: (error: Error) => void;
98
+ }
99
+ /**
100
+ * Pre-built reset password component with full business logic.
101
+ *
102
+ * @component
103
+ * @example
104
+ * ```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
+ * />
113
+ * ```
114
+ */
115
+ declare function ResetPassword({ token, backToSignInUrl, onSuccess, onError, ...uiProps }: ResetPasswordProps): react_jsx_runtime.JSX.Element | null;
116
+
117
+ interface VerifyEmailProps {
118
+ /** Verification token (from URL query params) */
119
+ token: string;
120
+ /** Appearance configuration */
121
+ appearance?: VerifyEmailStatusProps["appearance"];
122
+ /** Text customization */
123
+ verifyingTitle?: string;
124
+ successTitle?: string;
125
+ successMessage?: string;
126
+ errorTitle?: string;
127
+ /** Callback when verification is successful */
128
+ onSuccess?: (data: {
129
+ accessToken: string;
130
+ user?: any;
131
+ }) => void;
132
+ /** Callback when verification fails */
133
+ onError?: (error: Error) => void;
134
+ }
135
+ /**
136
+ * Pre-built email verification component with full business logic.
137
+ *
138
+ * Automatically verifies the email when mounted using the provided token.
139
+ *
140
+ * @component
141
+ * @example
142
+ * ```tsx
143
+ * const token = new URLSearchParams(window.location.search).get('token');
144
+ *
145
+ * <VerifyEmail
146
+ * token={token || ''}
147
+ * onSuccess={(data) => {
148
+ * console.log('Email verified!', data);
149
+ * // Optionally navigate or close window
150
+ * }}
151
+ * onError={(error) => console.error('Verification failed:', error)}
152
+ * />
153
+ * ```
154
+ */
155
+ declare function VerifyEmail({ token, onSuccess, onError, ...uiProps }: VerifyEmailProps): react_jsx_runtime.JSX.Element;
156
+
40
157
  /**
41
158
  * User profile button with dropdown menu and sign-out functionality.
42
159
  *
@@ -189,4 +306,4 @@ interface InsforgeCallbackProps {
189
306
  */
190
307
  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;
191
308
 
192
- export { InsforgeCallback, type InsforgeCallbackProps, Protect, SignIn, SignUp, SignedIn, SignedOut, UserButton };
309
+ export { ForgotPassword, InsforgeCallback, type InsforgeCallbackProps, Protect, ResetPassword, SignIn, SignUp, SignedIn, SignedOut, UserButton, VerifyEmail };