@insforge/react 0.6.0 → 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.
- package/dist/atoms.cjs +14 -17
- package/dist/atoms.cjs.map +1 -1
- package/dist/atoms.d.cts +1 -0
- package/dist/atoms.d.ts +1 -0
- package/dist/atoms.js +13 -16
- package/dist/atoms.js.map +1 -1
- package/dist/components.cjs +23 -26
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +2 -1
- package/dist/components.d.ts +2 -1
- package/dist/components.js +22 -25
- package/dist/components.js.map +1 -1
- package/dist/forms.cjs +14 -17
- package/dist/forms.cjs.map +1 -1
- package/dist/forms.d.cts +1 -0
- package/dist/forms.d.ts +1 -0
- package/dist/forms.js +13 -16
- package/dist/forms.js.map +1 -1
- package/dist/hooks.cjs +15 -18
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +4 -5
- package/dist/hooks.d.ts +4 -5
- package/dist/hooks.js +14 -17
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +40 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -59
- package/dist/index.d.ts +7 -59
- package/dist/index.js +38 -44
- package/dist/index.js.map +1 -1
- package/dist/types.d.cts +3 -19
- package/dist/types.d.ts +3 -19
- package/package.json +98 -110
package/dist/components.d.cts
CHANGED
|
@@ -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 '
|
|
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;
|
package/dist/components.d.ts
CHANGED
|
@@ -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 '
|
|
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;
|
package/dist/components.js
CHANGED
|
@@ -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:
|
|
37
|
-
signUp:
|
|
38
|
-
signOut:
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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" }),
|