@insforge/react 1.0.7 → 1.0.9-dev.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.
@@ -1773,7 +1773,7 @@ function useInsforge() {
1773
1773
  sendVerificationEmail: () => Promise.resolve(null),
1774
1774
  sendResetPasswordEmail: () => Promise.resolve(null),
1775
1775
  resetPassword: () => Promise.resolve(null),
1776
- verifyEmail: () => Promise.resolve(null),
1776
+ verifyEmail: () => Promise.resolve({ error: "SSR mode" }),
1777
1777
  exchangeResetPasswordToken: () => Promise.resolve({ error: { message: "SSR mode" } }),
1778
1778
  loginWithOAuth: () => Promise.resolve(),
1779
1779
  getPublicAuthConfig: () => Promise.resolve(null),
@@ -3670,8 +3670,7 @@ function SignIn({ onError, ...uiProps }) {
3670
3670
  }
3671
3671
  throw new Error(result.error);
3672
3672
  }
3673
- const { user, accessToken, redirectTo } = result;
3674
- const csrfToken = result.csrfToken;
3673
+ const { user, accessToken, redirectTo, csrfToken } = result;
3675
3674
  if (user) {
3676
3675
  const finalUrl = new URL(redirectTo || redirectUrl || "", window.location.origin);
3677
3676
  finalUrl.searchParams.set("access_token", accessToken);
@@ -3697,7 +3696,7 @@ function SignIn({ onError, ...uiProps }) {
3697
3696
  setError("");
3698
3697
  try {
3699
3698
  const result = await verifyEmail(code, email);
3700
- if (!result) {
3699
+ if ("error" in result) {
3701
3700
  throw new Error("Verification failed");
3702
3701
  }
3703
3702
  const finalUrl = new URL(result.redirectTo || redirectUrl || "", window.location.origin);
@@ -3913,7 +3912,7 @@ function SignUp({ onError, ...uiProps }) {
3913
3912
  if ("error" in result) {
3914
3913
  throw new Error(result.error);
3915
3914
  }
3916
- if (result.requireEmailVerification && !result.accessToken) {
3915
+ if (result.requireEmailVerification) {
3917
3916
  setStep("awaiting-verification");
3918
3917
  setLoading(false);
3919
3918
  return;
@@ -3944,7 +3943,7 @@ function SignUp({ onError, ...uiProps }) {
3944
3943
  setError("");
3945
3944
  try {
3946
3945
  const result = await verifyEmail(code, email);
3947
- if (!result) {
3946
+ if ("error" in result) {
3948
3947
  throw new Error("Verification failed");
3949
3948
  }
3950
3949
  const finalUrl = new URL(result.redirectTo || redirectUrl || "", window.location.origin);
@@ -4528,8 +4527,8 @@ function VerifyEmail({ token: token2, onSuccess, onError, ...uiProps }) {
4528
4527
  }
4529
4528
  try {
4530
4529
  const result = await verifyEmail(token2);
4531
- if (!result?.accessToken) {
4532
- const errorMessage = result ? "Verification succeeded but no access token received" : "Email verification failed";
4530
+ if ("error" in result) {
4531
+ const errorMessage = result.error || "Email verification failed";
4533
4532
  setError(errorMessage);
4534
4533
  setStatus("error");
4535
4534
  if (onError) {