@insforge/react 0.6.0 → 0.6.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.
@@ -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,8 +23,6 @@ function useSearchParams() {
22
23
  const adapter = useNavigationAdapter();
23
24
  return adapter.useSearchParams();
24
25
  }
25
- var InsforgeContext = createContext(void 0);
26
- InsforgeContext.displayName = "InsforgeContext";
27
26
  function useInsforge() {
28
27
  const context = useContext(InsforgeContext);
29
28
  if (!context) {
@@ -33,20 +32,18 @@ function useInsforge() {
33
32
  isSignedIn: false,
34
33
  setUser: () => {
35
34
  },
36
- signIn: async () => ({ error: "SSR mode" }),
37
- signUp: async () => ({ error: "SSR mode" }),
38
- signOut: async () => {
39
- },
40
- updateUser: async () => ({ error: "SSR mode" }),
41
- reloadAuth: async () => ({ success: false, error: "SSR mode" }),
42
- sendVerificationEmail: async () => null,
43
- sendResetPasswordEmail: async () => null,
44
- resetPassword: async () => null,
45
- verifyEmail: async () => null,
46
- exchangeResetPasswordToken: async () => ({ error: { message: "SSR mode" } }),
47
- loginWithOAuth: async () => {
48
- },
49
- 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),
50
47
  baseUrl: "",
51
48
  afterSignInUrl: "/"
52
49
  };
@@ -68,7 +65,7 @@ function usePublicAuthConfig() {
68
65
  }
69
66
  setIsLoaded(true);
70
67
  }
71
- fetchConfig();
68
+ void fetchConfig();
72
69
  }, [getPublicAuthConfig]);
73
70
  return { authConfig, isLoaded };
74
71
  }
@@ -1034,7 +1031,7 @@ function SignIn({ onError, ...uiProps }) {
1034
1031
  }
1035
1032
  function handleOAuth(provider) {
1036
1033
  try {
1037
- loginWithOAuth(provider, redirectUrl || "");
1034
+ void loginWithOAuth(provider, redirectUrl || "");
1038
1035
  } catch (err) {
1039
1036
  const errorMessage = err instanceof Error ? err.message : "OAuth login failed";
1040
1037
  setError(errorMessage);
@@ -1053,7 +1050,7 @@ function SignIn({ onError, ...uiProps }) {
1053
1050
  password,
1054
1051
  onEmailChange: setEmail,
1055
1052
  onPasswordChange: setPassword,
1056
- onSubmit: handleSubmit,
1053
+ onSubmit: (e) => void handleSubmit(e),
1057
1054
  error,
1058
1055
  loading,
1059
1056
  oauthLoading,
@@ -1268,7 +1265,7 @@ function SignUp({ onError, ...uiProps }) {
1268
1265
  }
1269
1266
  function handleOAuth(provider) {
1270
1267
  try {
1271
- loginWithOAuth(provider, redirectUrl || "");
1268
+ void loginWithOAuth(provider, redirectUrl || "");
1272
1269
  } catch (err) {
1273
1270
  const errorMessage = err instanceof Error ? err.message : "OAuth login failed";
1274
1271
  setError(errorMessage);
@@ -1287,7 +1284,7 @@ function SignUp({ onError, ...uiProps }) {
1287
1284
  password,
1288
1285
  onEmailChange: setEmail,
1289
1286
  onPasswordChange: setPassword,
1290
- onSubmit: handleSubmit,
1287
+ onSubmit: (e) => void handleSubmit(e),
1291
1288
  error,
1292
1289
  loading,
1293
1290
  oauthLoading,
@@ -1597,7 +1594,7 @@ function ForgotPassword({ onError, ...uiProps }) {
1597
1594
  confirmPassword,
1598
1595
  onNewPasswordChange: setNewPassword,
1599
1596
  onConfirmPasswordChange: setConfirmPassword,
1600
- onSubmit: handleResetPasswordSubmit,
1597
+ onSubmit: (e) => void handleResetPasswordSubmit(e),
1601
1598
  error,
1602
1599
  loading,
1603
1600
  success,
@@ -1772,7 +1769,7 @@ function ResetPassword({ onError, ...uiProps }) {
1772
1769
  confirmPassword,
1773
1770
  onNewPasswordChange: setNewPassword,
1774
1771
  onConfirmPasswordChange: setConfirmPassword,
1775
- onSubmit: handleSubmit,
1772
+ onSubmit: (e) => void handleSubmit(e),
1776
1773
  error,
1777
1774
  loading,
1778
1775
  success: false,
@@ -1896,7 +1893,7 @@ function UserButton({ afterSignOutUrl = "/", mode = "detailed" }) {
1896
1893
  setImageError(true);
1897
1894
  }
1898
1895
  };
1899
- checkImageUrl();
1896
+ void checkImageUrl();
1900
1897
  }, [user?.avatarUrl]);
1901
1898
  useEffect(() => {
1902
1899
  function handleClickOutside(event) {
@@ -1949,7 +1946,7 @@ function UserButton({ afterSignOutUrl = "/", mode = "detailed" }) {
1949
1946
  isOpen && /* @__PURE__ */ jsx("div", { className: "if-userButton-menu", children: /* @__PURE__ */ jsxs(
1950
1947
  "button",
1951
1948
  {
1952
- onClick: handleSignOut,
1949
+ onClick: () => void handleSignOut(),
1953
1950
  className: "if-userButton-menuItem if-userButton-menuItem-signout",
1954
1951
  children: [
1955
1952
  /* @__PURE__ */ jsx(LogOut, { className: "if-userButton-menuItem-icon" }),