@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.
@@ -30,7 +30,6 @@ interface SignInProps {
30
30
  * @example
31
31
  * ```tsx
32
32
  * <SignIn
33
- * onSuccess={(user) => console.log('Signed in:', user)}
34
33
  * onError={(error) => console.error('Error:', error)}
35
34
  * />
36
35
  * ```
@@ -30,7 +30,6 @@ interface SignInProps {
30
30
  * @example
31
31
  * ```tsx
32
32
  * <SignIn
33
- * onSuccess={(user) => console.log('Signed in:', user)}
34
33
  * onError={(error) => console.error('Error:', error)}
35
34
  * />
36
35
  * ```
@@ -1752,7 +1752,7 @@ function useInsforge() {
1752
1752
  sendVerificationEmail: () => Promise.resolve(null),
1753
1753
  sendResetPasswordEmail: () => Promise.resolve(null),
1754
1754
  resetPassword: () => Promise.resolve(null),
1755
- verifyEmail: () => Promise.resolve(null),
1755
+ verifyEmail: () => Promise.resolve({ error: "SSR mode" }),
1756
1756
  exchangeResetPasswordToken: () => Promise.resolve({ error: { message: "SSR mode" } }),
1757
1757
  loginWithOAuth: () => Promise.resolve(),
1758
1758
  getPublicAuthConfig: () => Promise.resolve(null),
@@ -3649,8 +3649,7 @@ function SignIn({ onError, ...uiProps }) {
3649
3649
  }
3650
3650
  throw new Error(result.error);
3651
3651
  }
3652
- const { user, accessToken, redirectTo } = result;
3653
- const csrfToken = result.csrfToken;
3652
+ const { user, accessToken, redirectTo, csrfToken } = result;
3654
3653
  if (user) {
3655
3654
  const finalUrl = new URL(redirectTo || redirectUrl || "", window.location.origin);
3656
3655
  finalUrl.searchParams.set("access_token", accessToken);
@@ -3676,7 +3675,7 @@ function SignIn({ onError, ...uiProps }) {
3676
3675
  setError("");
3677
3676
  try {
3678
3677
  const result = await verifyEmail(code, email);
3679
- if (!result) {
3678
+ if ("error" in result) {
3680
3679
  throw new Error("Verification failed");
3681
3680
  }
3682
3681
  const finalUrl = new URL(result.redirectTo || redirectUrl || "", window.location.origin);
@@ -3892,7 +3891,7 @@ function SignUp({ onError, ...uiProps }) {
3892
3891
  if ("error" in result) {
3893
3892
  throw new Error(result.error);
3894
3893
  }
3895
- if (result.requireEmailVerification && !result.accessToken) {
3894
+ if (result.requireEmailVerification) {
3896
3895
  setStep("awaiting-verification");
3897
3896
  setLoading(false);
3898
3897
  return;
@@ -3923,7 +3922,7 @@ function SignUp({ onError, ...uiProps }) {
3923
3922
  setError("");
3924
3923
  try {
3925
3924
  const result = await verifyEmail(code, email);
3926
- if (!result) {
3925
+ if ("error" in result) {
3927
3926
  throw new Error("Verification failed");
3928
3927
  }
3929
3928
  const finalUrl = new URL(result.redirectTo || redirectUrl || "", window.location.origin);
@@ -4507,8 +4506,8 @@ function VerifyEmail({ token: token2, onSuccess, onError, ...uiProps }) {
4507
4506
  }
4508
4507
  try {
4509
4508
  const result = await verifyEmail(token2);
4510
- if (!result?.accessToken) {
4511
- const errorMessage = result ? "Verification succeeded but no access token received" : "Email verification failed";
4509
+ if ("error" in result) {
4510
+ const errorMessage = result.error || "Email verification failed";
4512
4511
  setError(errorMessage);
4513
4512
  setStatus("error");
4514
4513
  if (onError) {