@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.
- package/dist/components.js +29 -2
- package/dist/components.js.map +1 -1
- package/dist/components.mjs +29 -2
- package/dist/components.mjs.map +1 -1
- package/dist/forms.d.mts +1 -1
- package/dist/forms.d.ts +1 -1
- package/dist/forms.js +21 -1
- package/dist/forms.js.map +1 -1
- package/dist/forms.mjs +21 -1
- package/dist/forms.mjs.map +1 -1
- package/dist/index.js +29 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -2
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.mts +3 -0
- package/dist/types.d.ts +3 -0
- package/package.json +1 -1
package/dist/components.js
CHANGED
|
@@ -1582,6 +1582,7 @@ function ResetPasswordForm({
|
|
|
1582
1582
|
onSubmit,
|
|
1583
1583
|
error,
|
|
1584
1584
|
loading = false,
|
|
1585
|
+
success = false,
|
|
1585
1586
|
emailAuthConfig,
|
|
1586
1587
|
appearance = {},
|
|
1587
1588
|
title = "Reset Password",
|
|
@@ -1593,8 +1594,27 @@ function ResetPasswordForm({
|
|
|
1593
1594
|
submitButtonText = "Reset Password",
|
|
1594
1595
|
loadingButtonText = "Resetting...",
|
|
1595
1596
|
backToSignInText = "",
|
|
1596
|
-
backToSignInUrl = "/sign-in"
|
|
1597
|
+
backToSignInUrl = "/sign-in",
|
|
1598
|
+
successTitle = "Password Reset Successful!",
|
|
1599
|
+
successMessage = "Your password has been successfully reset. You can now sign in with your new password."
|
|
1597
1600
|
}) {
|
|
1601
|
+
if (success) {
|
|
1602
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1603
|
+
AuthContainer,
|
|
1604
|
+
{
|
|
1605
|
+
appearance: {
|
|
1606
|
+
containerClassName: appearance.container,
|
|
1607
|
+
cardClassName: appearance.card
|
|
1608
|
+
},
|
|
1609
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-4", children: [
|
|
1610
|
+
/* @__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" }) }) }),
|
|
1611
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl font-semibold text-black dark:text-white text-center", children: successTitle }),
|
|
1612
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 text-center", children: successMessage }),
|
|
1613
|
+
/* @__PURE__ */ jsxRuntime.jsx("a", { href: backToSignInUrl, className: "mt-4 text-black dark:text-white font-medium", children: "Back to Sign In" })
|
|
1614
|
+
] })
|
|
1615
|
+
}
|
|
1616
|
+
);
|
|
1617
|
+
}
|
|
1598
1618
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1599
1619
|
AuthContainer,
|
|
1600
1620
|
{
|
|
@@ -1707,6 +1727,7 @@ function ResetPassword({
|
|
|
1707
1727
|
const [confirmPassword, setConfirmPassword] = react.useState("");
|
|
1708
1728
|
const [error, setError] = react.useState("");
|
|
1709
1729
|
const [loading, setLoading] = react.useState(false);
|
|
1730
|
+
const [success, setSuccess] = react.useState(false);
|
|
1710
1731
|
async function handleSubmit(e) {
|
|
1711
1732
|
e.preventDefault();
|
|
1712
1733
|
setLoading(true);
|
|
@@ -1743,6 +1764,7 @@ function ResetPassword({
|
|
|
1743
1764
|
try {
|
|
1744
1765
|
const result = await resetPassword(token, newPassword);
|
|
1745
1766
|
if (result?.message) {
|
|
1767
|
+
setSuccess(true);
|
|
1746
1768
|
if (onSuccess) {
|
|
1747
1769
|
onSuccess(result.redirectTo);
|
|
1748
1770
|
}
|
|
@@ -1776,6 +1798,7 @@ function ResetPassword({
|
|
|
1776
1798
|
onSubmit: handleSubmit,
|
|
1777
1799
|
error,
|
|
1778
1800
|
loading,
|
|
1801
|
+
success,
|
|
1779
1802
|
emailAuthConfig: emailConfig,
|
|
1780
1803
|
backToSignInUrl,
|
|
1781
1804
|
...uiProps
|
|
@@ -1892,10 +1915,14 @@ function ForgotPassword({
|
|
|
1892
1915
|
setIsSendingCode(false);
|
|
1893
1916
|
}
|
|
1894
1917
|
}, [email, sendPasswordResetCode]);
|
|
1895
|
-
function handlePasswordResetSuccess() {
|
|
1918
|
+
function handlePasswordResetSuccess(redirectTo) {
|
|
1919
|
+
const targetUrl = redirectTo || backToSignInUrl;
|
|
1896
1920
|
if (onSuccess) {
|
|
1897
1921
|
onSuccess();
|
|
1898
1922
|
}
|
|
1923
|
+
setTimeout(() => {
|
|
1924
|
+
window.location.href = targetUrl;
|
|
1925
|
+
}, 1500);
|
|
1899
1926
|
}
|
|
1900
1927
|
if (!emailConfig) {
|
|
1901
1928
|
return null;
|