@insforge/react 0.5.11 → 0.6.1

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.
@@ -1,10 +1,11 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { UserSchema } from '@insforge/sdk';
3
3
  import { ReactNode } from 'react';
4
- import { InsforgeUser } from './types.cjs';
4
+ import { InsforgeUser } from '@insforge/shared';
5
5
  export { ForgotPasswordForm, ForgotPasswordFormProps, ResetPasswordForm, ResetPasswordFormProps, SignInForm, SignInFormProps, SignUpForm, SignUpFormProps, VerifyEmailStatus, VerifyEmailStatusProps } from './forms.cjs';
6
6
  export { AuthBranding, AuthContainer, AuthContainerProps, AuthDivider, AuthDividerProps, AuthEmailVerificationStep, AuthErrorBanner, AuthErrorBannerProps, AuthFormField, AuthFormFieldProps, AuthHeader, AuthHeaderProps, AuthLink, AuthLinkProps, AuthOAuthButton, AuthOAuthButtonProps, AuthOAuthProviders, AuthOAuthProvidersProps, AuthPasswordField, AuthPasswordFieldProps, AuthPasswordStrengthIndicator, AuthPasswordStrengthIndicatorProps, AuthResetPasswordVerificationStep, AuthSubmitButton, AuthSubmitButtonProps, AuthVerificationCodeInput, AuthVerificationCodeInputProps } from './atoms.cjs';
7
7
  import '@insforge/shared-schemas';
8
+ import './types.cjs';
8
9
 
9
10
  interface SignInProps {
10
11
  title?: string;
@@ -1,10 +1,11 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { UserSchema } from '@insforge/sdk';
3
3
  import { ReactNode } from 'react';
4
- import { InsforgeUser } from './types.js';
4
+ import { InsforgeUser } from '@insforge/shared';
5
5
  export { ForgotPasswordForm, ForgotPasswordFormProps, ResetPasswordForm, ResetPasswordFormProps, SignInForm, SignInFormProps, SignUpForm, SignUpFormProps, VerifyEmailStatus, VerifyEmailStatusProps } from './forms.js';
6
6
  export { AuthBranding, AuthContainer, AuthContainerProps, AuthDivider, AuthDividerProps, AuthEmailVerificationStep, AuthErrorBanner, AuthErrorBannerProps, AuthFormField, AuthFormFieldProps, AuthHeader, AuthHeaderProps, AuthLink, AuthLinkProps, AuthOAuthButton, AuthOAuthButtonProps, AuthOAuthProviders, AuthOAuthProvidersProps, AuthPasswordField, AuthPasswordFieldProps, AuthPasswordStrengthIndicator, AuthPasswordStrengthIndicatorProps, AuthResetPasswordVerificationStep, AuthSubmitButton, AuthSubmitButtonProps, AuthVerificationCodeInput, AuthVerificationCodeInputProps } from './atoms.js';
7
7
  import '@insforge/shared-schemas';
8
+ import './types.js';
8
9
 
9
10
  interface SignInProps {
10
11
  title?: string;
@@ -1,6 +1,7 @@
1
1
  import { createContext, useState, useMemo, useRef, useEffect, useCallback, isValidElement, cloneElement, useContext } from 'react';
2
2
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
3
  import '@insforge/sdk';
4
+ import { InsforgeContext } from '@insforge/shared/react';
4
5
  import { AlertTriangle, Check, EyeOff, Eye, Loader2, CircleCheck, LogOut } from 'lucide-react';
5
6
  import { z } from 'zod';
6
7
 
@@ -22,7 +23,6 @@ function useSearchParams() {
22
23
  const adapter = useNavigationAdapter();
23
24
  return adapter.useSearchParams();
24
25
  }
25
- var InsforgeContext = createContext(void 0);
26
26
  function useInsforge() {
27
27
  const context = useContext(InsforgeContext);
28
28
  if (!context) {
@@ -32,20 +32,18 @@ function useInsforge() {
32
32
  isSignedIn: false,
33
33
  setUser: () => {
34
34
  },
35
- signIn: async () => ({ error: "SSR mode" }),
36
- signUp: async () => ({ error: "SSR mode" }),
37
- signOut: async () => {
38
- },
39
- updateUser: async () => ({ error: "SSR mode" }),
40
- reloadAuth: async () => ({ success: false, error: "SSR mode" }),
41
- sendVerificationEmail: async () => null,
42
- sendResetPasswordEmail: async () => null,
43
- resetPassword: async () => null,
44
- verifyEmail: async () => null,
45
- exchangeResetPasswordToken: async () => ({ error: { message: "SSR mode" } }),
46
- loginWithOAuth: async () => {
47
- },
48
- getPublicAuthConfig: async () => null,
35
+ signIn: () => Promise.resolve({ error: "SSR mode" }),
36
+ signUp: () => Promise.resolve({ error: "SSR mode" }),
37
+ signOut: () => Promise.resolve(),
38
+ updateUser: () => Promise.resolve({ error: "SSR mode" }),
39
+ reloadAuth: () => Promise.resolve({ success: false, error: "SSR mode" }),
40
+ sendVerificationEmail: () => Promise.resolve(null),
41
+ sendResetPasswordEmail: () => Promise.resolve(null),
42
+ resetPassword: () => Promise.resolve(null),
43
+ verifyEmail: () => Promise.resolve(null),
44
+ exchangeResetPasswordToken: () => Promise.resolve({ error: { message: "SSR mode" } }),
45
+ loginWithOAuth: () => Promise.resolve(),
46
+ getPublicAuthConfig: () => Promise.resolve(null),
49
47
  baseUrl: "",
50
48
  afterSignInUrl: "/"
51
49
  };
@@ -67,7 +65,7 @@ function usePublicAuthConfig() {
67
65
  }
68
66
  setIsLoaded(true);
69
67
  }
70
- fetchConfig();
68
+ void fetchConfig();
71
69
  }, [getPublicAuthConfig]);
72
70
  return { authConfig, isLoaded };
73
71
  }
@@ -1033,7 +1031,7 @@ function SignIn({ onError, ...uiProps }) {
1033
1031
  }
1034
1032
  function handleOAuth(provider) {
1035
1033
  try {
1036
- loginWithOAuth(provider, redirectUrl || "");
1034
+ void loginWithOAuth(provider, redirectUrl || "");
1037
1035
  } catch (err) {
1038
1036
  const errorMessage = err instanceof Error ? err.message : "OAuth login failed";
1039
1037
  setError(errorMessage);
@@ -1052,7 +1050,7 @@ function SignIn({ onError, ...uiProps }) {
1052
1050
  password,
1053
1051
  onEmailChange: setEmail,
1054
1052
  onPasswordChange: setPassword,
1055
- onSubmit: handleSubmit,
1053
+ onSubmit: (e) => void handleSubmit(e),
1056
1054
  error,
1057
1055
  loading,
1058
1056
  oauthLoading,
@@ -1267,7 +1265,7 @@ function SignUp({ onError, ...uiProps }) {
1267
1265
  }
1268
1266
  function handleOAuth(provider) {
1269
1267
  try {
1270
- loginWithOAuth(provider, redirectUrl || "");
1268
+ void loginWithOAuth(provider, redirectUrl || "");
1271
1269
  } catch (err) {
1272
1270
  const errorMessage = err instanceof Error ? err.message : "OAuth login failed";
1273
1271
  setError(errorMessage);
@@ -1286,7 +1284,7 @@ function SignUp({ onError, ...uiProps }) {
1286
1284
  password,
1287
1285
  onEmailChange: setEmail,
1288
1286
  onPasswordChange: setPassword,
1289
- onSubmit: handleSubmit,
1287
+ onSubmit: (e) => void handleSubmit(e),
1290
1288
  error,
1291
1289
  loading,
1292
1290
  oauthLoading,
@@ -1596,7 +1594,7 @@ function ForgotPassword({ onError, ...uiProps }) {
1596
1594
  confirmPassword,
1597
1595
  onNewPasswordChange: setNewPassword,
1598
1596
  onConfirmPasswordChange: setConfirmPassword,
1599
- onSubmit: handleResetPasswordSubmit,
1597
+ onSubmit: (e) => void handleResetPasswordSubmit(e),
1600
1598
  error,
1601
1599
  loading,
1602
1600
  success,
@@ -1771,7 +1769,7 @@ function ResetPassword({ onError, ...uiProps }) {
1771
1769
  confirmPassword,
1772
1770
  onNewPasswordChange: setNewPassword,
1773
1771
  onConfirmPasswordChange: setConfirmPassword,
1774
- onSubmit: handleSubmit,
1772
+ onSubmit: (e) => void handleSubmit(e),
1775
1773
  error,
1776
1774
  loading,
1777
1775
  success: false,
@@ -1895,7 +1893,7 @@ function UserButton({ afterSignOutUrl = "/", mode = "detailed" }) {
1895
1893
  setImageError(true);
1896
1894
  }
1897
1895
  };
1898
- checkImageUrl();
1896
+ void checkImageUrl();
1899
1897
  }, [user?.avatarUrl]);
1900
1898
  useEffect(() => {
1901
1899
  function handleClickOutside(event) {
@@ -1948,7 +1946,7 @@ function UserButton({ afterSignOutUrl = "/", mode = "detailed" }) {
1948
1946
  isOpen && /* @__PURE__ */ jsx("div", { className: "if-userButton-menu", children: /* @__PURE__ */ jsxs(
1949
1947
  "button",
1950
1948
  {
1951
- onClick: handleSignOut,
1949
+ onClick: () => void handleSignOut(),
1952
1950
  className: "if-userButton-menuItem if-userButton-menuItem-signout",
1953
1951
  children: [
1954
1952
  /* @__PURE__ */ jsx(LogOut, { className: "if-userButton-menuItem-icon" }),