@insforge/react 0.3.1 → 0.3.2

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.
@@ -1580,6 +1580,7 @@ function ResetPasswordForm({
1580
1580
  onSubmit,
1581
1581
  error,
1582
1582
  loading = false,
1583
+ success = false,
1583
1584
  emailAuthConfig,
1584
1585
  appearance = {},
1585
1586
  title = "Reset Password",
@@ -1591,8 +1592,27 @@ function ResetPasswordForm({
1591
1592
  submitButtonText = "Reset Password",
1592
1593
  loadingButtonText = "Resetting...",
1593
1594
  backToSignInText = "",
1594
- backToSignInUrl = "/sign-in"
1595
+ backToSignInUrl = "/sign-in",
1596
+ successTitle = "Password Reset Successful!",
1597
+ successMessage = "Your password has been successfully reset. You can now sign in with your new password."
1595
1598
  }) {
1599
+ if (success) {
1600
+ return /* @__PURE__ */ jsx(
1601
+ AuthContainer,
1602
+ {
1603
+ appearance: {
1604
+ containerClassName: appearance.container,
1605
+ cardClassName: appearance.card
1606
+ },
1607
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-4", children: [
1608
+ /* @__PURE__ */ jsx("div", { className: "w-16 h-16 rounded-full bg-green-100 dark:bg-green-900 flex items-center justify-center", children: /* @__PURE__ */ 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__ */ jsx("path", { d: "M5 13l4 4L19 7" }) }) }),
1609
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold text-black dark:text-white text-center", children: successTitle }),
1610
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 text-center", children: successMessage }),
1611
+ /* @__PURE__ */ jsx("a", { href: backToSignInUrl, className: "mt-4 text-black dark:text-white font-medium", children: "Back to Sign In" })
1612
+ ] })
1613
+ }
1614
+ );
1615
+ }
1596
1616
  return /* @__PURE__ */ jsxs(
1597
1617
  AuthContainer,
1598
1618
  {
@@ -1705,6 +1725,7 @@ function ResetPassword({
1705
1725
  const [confirmPassword, setConfirmPassword] = useState("");
1706
1726
  const [error, setError] = useState("");
1707
1727
  const [loading, setLoading] = useState(false);
1728
+ const [success, setSuccess] = useState(false);
1708
1729
  async function handleSubmit(e) {
1709
1730
  e.preventDefault();
1710
1731
  setLoading(true);
@@ -1741,6 +1762,7 @@ function ResetPassword({
1741
1762
  try {
1742
1763
  const result = await resetPassword(token, newPassword);
1743
1764
  if (result?.message) {
1765
+ setSuccess(true);
1744
1766
  if (onSuccess) {
1745
1767
  onSuccess(result.redirectTo);
1746
1768
  }
@@ -1774,6 +1796,7 @@ function ResetPassword({
1774
1796
  onSubmit: handleSubmit,
1775
1797
  error,
1776
1798
  loading,
1799
+ success,
1777
1800
  emailAuthConfig: emailConfig,
1778
1801
  backToSignInUrl,
1779
1802
  ...uiProps
@@ -1890,10 +1913,14 @@ function ForgotPassword({
1890
1913
  setIsSendingCode(false);
1891
1914
  }
1892
1915
  }, [email, sendPasswordResetCode]);
1893
- function handlePasswordResetSuccess() {
1916
+ function handlePasswordResetSuccess(redirectTo) {
1917
+ const targetUrl = redirectTo || backToSignInUrl;
1894
1918
  if (onSuccess) {
1895
1919
  onSuccess();
1896
1920
  }
1921
+ setTimeout(() => {
1922
+ window.location.href = targetUrl;
1923
+ }, 1500);
1897
1924
  }
1898
1925
  if (!emailConfig) {
1899
1926
  return null;