@insforge/react 0.3.1 → 0.3.3

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/forms.d.mts CHANGED
@@ -37,7 +37,7 @@ import '@insforge/shared-schemas';
37
37
  * />
38
38
  * ```
39
39
  */
40
- declare function SignInForm({ email, password, onEmailChange, onPasswordChange, onSubmit, error, loading, oauthLoading, availableProviders, onOAuthClick, emailAuthConfig, appearance, title, subtitle, emailLabel, emailPlaceholder, passwordLabel, passwordPlaceholder, forgotPasswordText, forgotPasswordUrl, submitButtonText, loadingButtonText, signUpText, signUpLinkText, signUpUrl, dividerText, showVerificationStep, onVerifyCode, verificationDescription, }: SignInFormProps): react_jsx_runtime.JSX.Element;
40
+ declare function SignInForm({ email, password, onEmailChange, onPasswordChange, onSubmit, error, loading, oauthLoading, availableProviders, onOAuthClick, authConfig, appearance, title, subtitle, emailLabel, emailPlaceholder, passwordLabel, passwordPlaceholder, forgotPasswordText, forgotPasswordUrl, submitButtonText, loadingButtonText, signUpText, signUpLinkText, signUpUrl, dividerText, showVerificationStep, onVerifyCode, verificationDescription, }: SignInFormProps): react_jsx_runtime.JSX.Element;
41
41
 
42
42
  /**
43
43
  * Pre-built sign-up form component (UI only, no business logic).
@@ -73,7 +73,7 @@ declare function SignInForm({ email, password, onEmailChange, onPasswordChange,
73
73
  * />
74
74
  * ```
75
75
  */
76
- declare function SignUpForm({ email, password, onEmailChange, onPasswordChange, onSubmit, error, loading, oauthLoading, availableProviders, onOAuthClick, emailAuthConfig, appearance, title, subtitle, emailLabel, emailPlaceholder, passwordLabel, passwordPlaceholder, submitButtonText, loadingButtonText, signInText, signInLinkText, signInUrl, dividerText, showVerificationStep, onVerifyCode, verificationDescription, }: SignUpFormProps): react_jsx_runtime.JSX.Element;
76
+ declare function SignUpForm({ email, password, onEmailChange, onPasswordChange, onSubmit, error, loading, oauthLoading, availableProviders, onOAuthClick, authConfig, appearance, title, subtitle, emailLabel, emailPlaceholder, passwordLabel, passwordPlaceholder, submitButtonText, loadingButtonText, signInText, signInLinkText, signInUrl, dividerText, showVerificationStep, onVerifyCode, verificationDescription, }: SignUpFormProps): react_jsx_runtime.JSX.Element;
77
77
 
78
78
  /**
79
79
  * Pre-built forgot password form component (UI only, no business logic).
@@ -146,11 +146,11 @@ declare function ForgotPasswordForm({ email, onEmailChange, onSubmit, error, loa
146
146
  * onSubmit={handleSubmit}
147
147
  * error={error}
148
148
  * loading={loading}
149
- * emailAuthConfig={config}
149
+ * authConfig={config}
150
150
  * />
151
151
  * ```
152
152
  */
153
- declare function ResetPasswordForm({ newPassword, confirmPassword, onNewPasswordChange, onConfirmPasswordChange, onSubmit, error, loading, emailAuthConfig, appearance, title, subtitle, newPasswordLabel, newPasswordPlaceholder, confirmPasswordLabel, confirmPasswordPlaceholder, submitButtonText, loadingButtonText, backToSignInText, backToSignInUrl, }: ResetPasswordFormProps): react_jsx_runtime.JSX.Element;
153
+ declare function ResetPasswordForm({ newPassword, confirmPassword, onNewPasswordChange, onConfirmPasswordChange, onSubmit, error, loading, success, authConfig, appearance, title, subtitle, newPasswordLabel, newPasswordPlaceholder, confirmPasswordLabel, confirmPasswordPlaceholder, submitButtonText, loadingButtonText, backToSignInText, backToSignInUrl, successTitle, successMessage, }: ResetPasswordFormProps): react_jsx_runtime.JSX.Element;
154
154
 
155
155
  /**
156
156
  * Email verification status display component (UI only, no business logic).
package/dist/forms.d.ts CHANGED
@@ -37,7 +37,7 @@ import '@insforge/shared-schemas';
37
37
  * />
38
38
  * ```
39
39
  */
40
- declare function SignInForm({ email, password, onEmailChange, onPasswordChange, onSubmit, error, loading, oauthLoading, availableProviders, onOAuthClick, emailAuthConfig, appearance, title, subtitle, emailLabel, emailPlaceholder, passwordLabel, passwordPlaceholder, forgotPasswordText, forgotPasswordUrl, submitButtonText, loadingButtonText, signUpText, signUpLinkText, signUpUrl, dividerText, showVerificationStep, onVerifyCode, verificationDescription, }: SignInFormProps): react_jsx_runtime.JSX.Element;
40
+ declare function SignInForm({ email, password, onEmailChange, onPasswordChange, onSubmit, error, loading, oauthLoading, availableProviders, onOAuthClick, authConfig, appearance, title, subtitle, emailLabel, emailPlaceholder, passwordLabel, passwordPlaceholder, forgotPasswordText, forgotPasswordUrl, submitButtonText, loadingButtonText, signUpText, signUpLinkText, signUpUrl, dividerText, showVerificationStep, onVerifyCode, verificationDescription, }: SignInFormProps): react_jsx_runtime.JSX.Element;
41
41
 
42
42
  /**
43
43
  * Pre-built sign-up form component (UI only, no business logic).
@@ -73,7 +73,7 @@ declare function SignInForm({ email, password, onEmailChange, onPasswordChange,
73
73
  * />
74
74
  * ```
75
75
  */
76
- declare function SignUpForm({ email, password, onEmailChange, onPasswordChange, onSubmit, error, loading, oauthLoading, availableProviders, onOAuthClick, emailAuthConfig, appearance, title, subtitle, emailLabel, emailPlaceholder, passwordLabel, passwordPlaceholder, submitButtonText, loadingButtonText, signInText, signInLinkText, signInUrl, dividerText, showVerificationStep, onVerifyCode, verificationDescription, }: SignUpFormProps): react_jsx_runtime.JSX.Element;
76
+ declare function SignUpForm({ email, password, onEmailChange, onPasswordChange, onSubmit, error, loading, oauthLoading, availableProviders, onOAuthClick, authConfig, appearance, title, subtitle, emailLabel, emailPlaceholder, passwordLabel, passwordPlaceholder, submitButtonText, loadingButtonText, signInText, signInLinkText, signInUrl, dividerText, showVerificationStep, onVerifyCode, verificationDescription, }: SignUpFormProps): react_jsx_runtime.JSX.Element;
77
77
 
78
78
  /**
79
79
  * Pre-built forgot password form component (UI only, no business logic).
@@ -146,11 +146,11 @@ declare function ForgotPasswordForm({ email, onEmailChange, onSubmit, error, loa
146
146
  * onSubmit={handleSubmit}
147
147
  * error={error}
148
148
  * loading={loading}
149
- * emailAuthConfig={config}
149
+ * authConfig={config}
150
150
  * />
151
151
  * ```
152
152
  */
153
- declare function ResetPasswordForm({ newPassword, confirmPassword, onNewPasswordChange, onConfirmPasswordChange, onSubmit, error, loading, emailAuthConfig, appearance, title, subtitle, newPasswordLabel, newPasswordPlaceholder, confirmPasswordLabel, confirmPasswordPlaceholder, submitButtonText, loadingButtonText, backToSignInText, backToSignInUrl, }: ResetPasswordFormProps): react_jsx_runtime.JSX.Element;
153
+ declare function ResetPasswordForm({ newPassword, confirmPassword, onNewPasswordChange, onConfirmPasswordChange, onSubmit, error, loading, success, authConfig, appearance, title, subtitle, newPasswordLabel, newPasswordPlaceholder, confirmPasswordLabel, confirmPasswordPlaceholder, submitButtonText, loadingButtonText, backToSignInText, backToSignInUrl, successTitle, successMessage, }: ResetPasswordFormProps): react_jsx_runtime.JSX.Element;
154
154
 
155
155
  /**
156
156
  * Email verification status display component (UI only, no business logic).
package/dist/forms.js CHANGED
@@ -237,7 +237,7 @@ function AuthPasswordField({
237
237
  label,
238
238
  id,
239
239
  showStrengthIndicator = false,
240
- emailAuthConfig,
240
+ authConfig,
241
241
  forgotPasswordLink,
242
242
  value,
243
243
  appearance = {},
@@ -315,7 +315,7 @@ function AuthPasswordField({
315
315
  AuthPasswordStrengthIndicator,
316
316
  {
317
317
  password: String(value || ""),
318
- config: emailAuthConfig
318
+ config: authConfig
319
319
  }
320
320
  )
321
321
  ]
@@ -759,11 +759,7 @@ function AuthEmailVerificationStep({
759
759
  react.useEffect(() => {
760
760
  const sendInitialEmail = async () => {
761
761
  try {
762
- if (method === "code") {
763
- await insforge.auth.sendVerificationCode({ email });
764
- } else {
765
- await insforge.auth.sendVerificationLink({ email });
766
- }
762
+ await insforge.auth.sendVerificationEmail({ email });
767
763
  } catch {
768
764
  }
769
765
  };
@@ -789,11 +785,7 @@ function AuthEmailVerificationStep({
789
785
  setIsSending(true);
790
786
  setVerificationError("");
791
787
  try {
792
- if (method === "code") {
793
- await insforge.auth.sendVerificationCode({ email });
794
- } else {
795
- await insforge.auth.sendVerificationLink({ email });
796
- }
788
+ await insforge.auth.sendVerificationEmail({ email });
797
789
  } catch {
798
790
  setResendDisabled(false);
799
791
  setResendCountdown(0);
@@ -871,7 +863,7 @@ function SignInForm({
871
863
  oauthLoading = null,
872
864
  availableProviders = [],
873
865
  onOAuthClick,
874
- emailAuthConfig,
866
+ authConfig,
875
867
  appearance = {},
876
868
  title = "Welcome Back",
877
869
  subtitle = "Login to your account",
@@ -961,7 +953,7 @@ function SignInForm({
961
953
  onChange: (e) => onPasswordChange(e.target.value),
962
954
  required: true,
963
955
  autoComplete: "current-password",
964
- emailAuthConfig,
956
+ authConfig,
965
957
  forgotPasswordLink: forgotPasswordUrl ? {
966
958
  href: forgotPasswordUrl,
967
959
  text: forgotPasswordText
@@ -1036,7 +1028,7 @@ function SignUpForm({
1036
1028
  oauthLoading = null,
1037
1029
  availableProviders = [],
1038
1030
  onOAuthClick,
1039
- emailAuthConfig,
1031
+ authConfig,
1040
1032
  appearance = {},
1041
1033
  title = "Get Started",
1042
1034
  subtitle = "Create your account",
@@ -1123,10 +1115,10 @@ function SignUpForm({
1123
1115
  value: password,
1124
1116
  onChange: (e) => onPasswordChange(e.target.value),
1125
1117
  required: true,
1126
- minLength: emailAuthConfig.passwordMinLength,
1118
+ minLength: authConfig.passwordMinLength,
1127
1119
  autoComplete: "new-password",
1128
1120
  showStrengthIndicator: true,
1129
- emailAuthConfig,
1121
+ authConfig,
1130
1122
  appearance: {
1131
1123
  containerClassName: appearance.form?.passwordField?.container,
1132
1124
  labelClassName: appearance.form?.passwordField?.label,
@@ -1310,7 +1302,8 @@ function ResetPasswordForm({
1310
1302
  onSubmit,
1311
1303
  error,
1312
1304
  loading = false,
1313
- emailAuthConfig,
1305
+ success = false,
1306
+ authConfig,
1314
1307
  appearance = {},
1315
1308
  title = "Reset Password",
1316
1309
  subtitle = "Enter your new password below.",
@@ -1321,8 +1314,27 @@ function ResetPasswordForm({
1321
1314
  submitButtonText = "Reset Password",
1322
1315
  loadingButtonText = "Resetting...",
1323
1316
  backToSignInText = "",
1324
- backToSignInUrl = "/sign-in"
1317
+ backToSignInUrl = "/sign-in",
1318
+ successTitle = "Password Reset Successful!",
1319
+ successMessage = "Your password has been successfully reset. You can now sign in with your new password."
1325
1320
  }) {
1321
+ if (success) {
1322
+ return /* @__PURE__ */ jsxRuntime.jsx(
1323
+ AuthContainer,
1324
+ {
1325
+ appearance: {
1326
+ containerClassName: appearance.container,
1327
+ cardClassName: appearance.card
1328
+ },
1329
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-4", children: [
1330
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-16 h-16 rounded-full bg-green-100 dark:bg-green-900 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-8 h-8 text-green-600 dark:text-green-400", fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 13l4 4L19 7" }) }) }),
1331
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl font-semibold text-black dark:text-white text-center", children: successTitle }),
1332
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 text-center", children: successMessage }),
1333
+ /* @__PURE__ */ jsxRuntime.jsx("a", { href: backToSignInUrl, className: "mt-4 text-black dark:text-white font-medium", children: "Back to Sign In" })
1334
+ ] })
1335
+ }
1336
+ );
1337
+ }
1326
1338
  return /* @__PURE__ */ jsxRuntime.jsxs(
1327
1339
  AuthContainer,
1328
1340
  {
@@ -1368,7 +1380,7 @@ function ResetPasswordForm({
1368
1380
  required: true,
1369
1381
  autoComplete: "new-password",
1370
1382
  showStrengthIndicator: true,
1371
- emailAuthConfig,
1383
+ authConfig,
1372
1384
  appearance: {
1373
1385
  containerClassName: appearance.form?.newPasswordField?.container,
1374
1386
  labelClassName: appearance.form?.newPasswordField?.label,
@@ -1386,7 +1398,7 @@ function ResetPasswordForm({
1386
1398
  onChange: (e) => onConfirmPasswordChange(e.target.value),
1387
1399
  required: true,
1388
1400
  autoComplete: "new-password",
1389
- emailAuthConfig,
1401
+ authConfig,
1390
1402
  appearance: {
1391
1403
  containerClassName: appearance.form?.confirmPasswordField?.container,
1392
1404
  labelClassName: appearance.form?.confirmPasswordField?.label,