@insforge/react 0.2.9 → 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.
- package/README.md +71 -32
- package/dist/atoms.d.mts +23 -2
- package/dist/atoms.d.ts +23 -2
- package/dist/atoms.js +139 -0
- package/dist/atoms.js.map +1 -1
- package/dist/atoms.mjs +140 -2
- package/dist/atoms.mjs.map +1 -1
- package/dist/components.d.mts +127 -5
- package/dist/components.d.ts +127 -5
- package/dist/components.js +900 -342
- package/dist/components.js.map +1 -1
- package/dist/components.mjs +898 -344
- package/dist/components.mjs.map +1 -1
- package/dist/forms.js +4 -0
- package/dist/forms.js.map +1 -1
- package/dist/forms.mjs +5 -1
- package/dist/forms.mjs.map +1 -1
- package/dist/hooks.d.mts +4 -0
- package/dist/hooks.d.ts +4 -0
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.d.mts +6 -11
- package/dist/index.d.ts +6 -11
- package/dist/index.js +930 -458
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +927 -459
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types.d.mts +1 -0
- package/dist/types.d.ts +1 -0
- package/package.json +2 -2
package/dist/components.d.ts
CHANGED
|
@@ -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
|
*
|
|
@@ -154,15 +271,20 @@ interface InsforgeCallbackProps {
|
|
|
154
271
|
onRedirect?: (url: string) => void;
|
|
155
272
|
}
|
|
156
273
|
/**
|
|
157
|
-
* InsforgeCallback - Handles OAuth
|
|
274
|
+
* InsforgeCallback - Handles OAuth authentication callbacks
|
|
158
275
|
*
|
|
159
276
|
* Place this component on your `/auth/callback` page.
|
|
160
277
|
*
|
|
278
|
+
* How it works:
|
|
279
|
+
* 1. SDK automatically detects OAuth callback parameters and saves to localStorage
|
|
280
|
+
* 2. Provider validates the session from localStorage
|
|
281
|
+
* 3. This component waits for validation and handles redirect
|
|
282
|
+
*
|
|
161
283
|
* @example
|
|
162
284
|
* ```tsx
|
|
163
285
|
* // Minimal usage
|
|
164
286
|
* export default function CallbackPage() {
|
|
165
|
-
* return <InsforgeCallback />;
|
|
287
|
+
* return <InsforgeCallback redirectTo="/dashboard" />;
|
|
166
288
|
* }
|
|
167
289
|
* ```
|
|
168
290
|
*
|
|
@@ -184,4 +306,4 @@ interface InsforgeCallbackProps {
|
|
|
184
306
|
*/
|
|
185
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;
|
|
186
308
|
|
|
187
|
-
export { InsforgeCallback, type InsforgeCallbackProps, Protect, SignIn, SignUp, SignedIn, SignedOut, UserButton };
|
|
309
|
+
export { ForgotPassword, InsforgeCallback, type InsforgeCallbackProps, Protect, ResetPassword, SignIn, SignUp, SignedIn, SignedOut, UserButton, VerifyEmail };
|