@riligar/auth-react 1.34.0 → 1.35.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/README.md +1 -0
- package/dist/index.esm.js +154 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +152 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,6 +68,7 @@ function Header() {
|
|
|
68
68
|
| `<ResetPassword />` | Password reset form |
|
|
69
69
|
| `<VerifyEmail />` | Email verification |
|
|
70
70
|
| `<UserProfile />` | User profile management modal |
|
|
71
|
+
| `<UserInformation />` | Flexible user details and account menu |
|
|
71
72
|
|
|
72
73
|
### Control Components
|
|
73
74
|
|
package/dist/index.esm.js
CHANGED
|
@@ -3,9 +3,9 @@ import { useMemo, useEffect, createContext, useState, useRef } from 'react';
|
|
|
3
3
|
import { useShallow } from 'zustand/react/shallow';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import { Navigate, Outlet, useNavigate } from 'react-router-dom';
|
|
6
|
-
import { Modal, Stack, Text, Image, Title, Paper, TextInput, PasswordInput, Anchor, Button, Divider, Group, Center, Loader, Box, Avatar, Collapse, FileButton, Tooltip, ThemeIcon, Badge } from '@mantine/core';
|
|
6
|
+
import { Modal, Stack, Text, Image, Title, Paper, TextInput, PasswordInput, Anchor, Button, Divider, Group, Center, Loader, Box, Avatar, Collapse, FileButton, Tooltip, ThemeIcon, Badge, rem, ActionIcon } from '@mantine/core';
|
|
7
7
|
import { useForm } from '@mantine/form';
|
|
8
|
-
import { IconMail, IconLock, IconArrowRight, IconBrandGoogle, IconBrandGithub, IconUser, IconSend, IconCheck, IconX, IconRefresh, IconPhoto, IconTrash, IconPencil, IconShield, IconKey, IconDevices, IconDeviceMobile, IconLogout, IconUserCircle } from '@tabler/icons-react';
|
|
8
|
+
import { IconMail, IconLock, IconArrowRight, IconBrandGoogle, IconBrandGithub, IconUser, IconSend, IconCheck, IconX, IconRefresh, IconPhoto, IconTrash, IconPencil, IconShield, IconKey, IconDevices, IconDeviceMobile, IconLogout, IconUserCircle, IconSettings, IconCreditCard, IconShieldCheck } from '@tabler/icons-react';
|
|
9
9
|
|
|
10
10
|
// Config - API Base URL fixa para o serviço de autenticação
|
|
11
11
|
let API_BASE = 'https://manager.myauth.click';
|
|
@@ -2963,6 +2963,157 @@ function UserProfile({
|
|
|
2963
2963
|
});
|
|
2964
2964
|
}
|
|
2965
2965
|
|
|
2966
|
+
function UserInformation({
|
|
2967
|
+
user,
|
|
2968
|
+
signOut,
|
|
2969
|
+
onAccountClick,
|
|
2970
|
+
onBillingClick,
|
|
2971
|
+
accountLabel = 'Conta',
|
|
2972
|
+
billingLabel = 'Assinatura',
|
|
2973
|
+
padded = true,
|
|
2974
|
+
size = 'sm',
|
|
2975
|
+
style,
|
|
2976
|
+
...others
|
|
2977
|
+
}) {
|
|
2978
|
+
if (!user) return null;
|
|
2979
|
+
|
|
2980
|
+
// Size mappings
|
|
2981
|
+
const avatarSizeMap = {
|
|
2982
|
+
sm: 32,
|
|
2983
|
+
md: 40,
|
|
2984
|
+
lg: 48
|
|
2985
|
+
};
|
|
2986
|
+
const fontSizeTitleMap = {
|
|
2987
|
+
sm: 'sm',
|
|
2988
|
+
md: 'md',
|
|
2989
|
+
lg: 'lg'
|
|
2990
|
+
};
|
|
2991
|
+
const fontSizeEmailMap = {
|
|
2992
|
+
sm: '10px',
|
|
2993
|
+
md: 'xs',
|
|
2994
|
+
lg: 'sm'
|
|
2995
|
+
};
|
|
2996
|
+
const btnSizeMap = {
|
|
2997
|
+
sm: 'xs',
|
|
2998
|
+
md: 'sm',
|
|
2999
|
+
lg: 'md'
|
|
3000
|
+
};
|
|
3001
|
+
const gapMap = {
|
|
3002
|
+
sm: 'xs',
|
|
3003
|
+
md: 'sm',
|
|
3004
|
+
lg: 'md'
|
|
3005
|
+
};
|
|
3006
|
+
const widthMap = {
|
|
3007
|
+
sm: 280,
|
|
3008
|
+
md: 320,
|
|
3009
|
+
lg: 400
|
|
3010
|
+
};
|
|
3011
|
+
const name = user.fullName || user.name || 'User';
|
|
3012
|
+
const email = user.primaryEmailAddress || user.email || '';
|
|
3013
|
+
const initials = name.split(' ').map(n => n[0]).join('').toUpperCase().slice(0, 2);
|
|
3014
|
+
return /*#__PURE__*/jsx(Box, {
|
|
3015
|
+
p: padded ? gapMap[size] : 0,
|
|
3016
|
+
w: widthMap[size],
|
|
3017
|
+
style: style,
|
|
3018
|
+
...others,
|
|
3019
|
+
children: /*#__PURE__*/jsxs(Stack, {
|
|
3020
|
+
gap: gapMap[size],
|
|
3021
|
+
children: [/*#__PURE__*/jsxs(Group, {
|
|
3022
|
+
wrap: "nowrap",
|
|
3023
|
+
gap: "xs",
|
|
3024
|
+
children: [/*#__PURE__*/jsx(Avatar, {
|
|
3025
|
+
src: user.imageUrl || user.image,
|
|
3026
|
+
size: avatarSizeMap[size],
|
|
3027
|
+
radius: "xl",
|
|
3028
|
+
bg: "gray.1",
|
|
3029
|
+
c: "gray.6",
|
|
3030
|
+
styles: {
|
|
3031
|
+
placeholder: {
|
|
3032
|
+
fontSize: rem(avatarSizeMap[size] / 2.2),
|
|
3033
|
+
fontWeight: 600
|
|
3034
|
+
}
|
|
3035
|
+
},
|
|
3036
|
+
children: initials || 'CC'
|
|
3037
|
+
}), /*#__PURE__*/jsxs(Box, {
|
|
3038
|
+
style: {
|
|
3039
|
+
flex: 1,
|
|
3040
|
+
overflow: 'hidden'
|
|
3041
|
+
},
|
|
3042
|
+
children: [/*#__PURE__*/jsx(Text, {
|
|
3043
|
+
size: fontSizeTitleMap[size],
|
|
3044
|
+
fw: 700,
|
|
3045
|
+
truncate: "end",
|
|
3046
|
+
c: "dark.9",
|
|
3047
|
+
lh: 1.1,
|
|
3048
|
+
children: name
|
|
3049
|
+
}), /*#__PURE__*/jsx(Text, {
|
|
3050
|
+
size: fontSizeEmailMap[size],
|
|
3051
|
+
c: "gray.5",
|
|
3052
|
+
truncate: "end",
|
|
3053
|
+
lh: 1.1,
|
|
3054
|
+
children: email
|
|
3055
|
+
})]
|
|
3056
|
+
}), /*#__PURE__*/jsx(ActionIcon, {
|
|
3057
|
+
variant: "subtle",
|
|
3058
|
+
color: "gray.4",
|
|
3059
|
+
size: size,
|
|
3060
|
+
onClick: signOut,
|
|
3061
|
+
children: /*#__PURE__*/jsx(IconLogout, {
|
|
3062
|
+
size: avatarSizeMap[size] * 0.45
|
|
3063
|
+
})
|
|
3064
|
+
})]
|
|
3065
|
+
}), /*#__PURE__*/jsxs(Group, {
|
|
3066
|
+
gap: gapMap[size] === 'xs' ? 6 : 8,
|
|
3067
|
+
grow: true,
|
|
3068
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
3069
|
+
variant: "default",
|
|
3070
|
+
size: btnSizeMap[size],
|
|
3071
|
+
leftSection: /*#__PURE__*/jsx(IconSettings, {
|
|
3072
|
+
size: avatarSizeMap[size] * 0.45
|
|
3073
|
+
}),
|
|
3074
|
+
onClick: onAccountClick,
|
|
3075
|
+
fw: 700,
|
|
3076
|
+
fz: gapMap[size] === 'xs' ? "10px" : "xs",
|
|
3077
|
+
radius: "md",
|
|
3078
|
+
children: accountLabel
|
|
3079
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
3080
|
+
variant: "default",
|
|
3081
|
+
size: btnSizeMap[size],
|
|
3082
|
+
leftSection: /*#__PURE__*/jsx(IconCreditCard, {
|
|
3083
|
+
size: avatarSizeMap[size] * 0.45
|
|
3084
|
+
}),
|
|
3085
|
+
onClick: onBillingClick,
|
|
3086
|
+
fw: 700,
|
|
3087
|
+
fz: gapMap[size] === 'xs' ? "10px" : "xs",
|
|
3088
|
+
radius: "md",
|
|
3089
|
+
children: billingLabel
|
|
3090
|
+
})]
|
|
3091
|
+
}), /*#__PURE__*/jsxs(Group, {
|
|
3092
|
+
justify: "center",
|
|
3093
|
+
gap: 4,
|
|
3094
|
+
opacity: 0.3,
|
|
3095
|
+
children: [/*#__PURE__*/jsx(Text, {
|
|
3096
|
+
size: "10px",
|
|
3097
|
+
c: "gray.6",
|
|
3098
|
+
fw: 600,
|
|
3099
|
+
children: "Secured by"
|
|
3100
|
+
}), /*#__PURE__*/jsxs(Group, {
|
|
3101
|
+
gap: 2,
|
|
3102
|
+
children: [/*#__PURE__*/jsx(IconShieldCheck, {
|
|
3103
|
+
size: 10,
|
|
3104
|
+
stroke: 2
|
|
3105
|
+
}), /*#__PURE__*/jsx(Text, {
|
|
3106
|
+
size: "10px",
|
|
3107
|
+
fw: 800,
|
|
3108
|
+
c: "dark.9",
|
|
3109
|
+
children: "Auth"
|
|
3110
|
+
})]
|
|
3111
|
+
})]
|
|
3112
|
+
})]
|
|
3113
|
+
})
|
|
3114
|
+
});
|
|
3115
|
+
}
|
|
3116
|
+
|
|
2966
3117
|
/**
|
|
2967
3118
|
* Renderiza children apenas quando o usuário está autenticado
|
|
2968
3119
|
* Equivalente ao <SignedIn> do Clerk
|
|
@@ -3064,5 +3215,5 @@ function SignOutButton({
|
|
|
3064
3215
|
});
|
|
3065
3216
|
}
|
|
3066
3217
|
|
|
3067
|
-
export { UserProfile as AccountModal, AuthCard, AuthLoaded, AuthLoading, AuthProvider, ForgotPassword, ForgotPassword as ForgotPasswordForm, MagicLink, MagicLinkCallback, MagicLink as MagicLinkForm, MagicLinkCallback as MagicLinkVerify, Protect, Protect as ProtectedRoute, ResetPassword, ResetPassword as ResetPasswordForm, SignIn, SignInButton, SignIn as SignInForm, SignOutButton, SignUp, SignUpButton, SignUp as SignUpForm, SignedIn, SignedOut, UserProfile, VerifyEmail, VerifyEmail as VerifyEmailCard, changeEmail, changePassword, configure, decodeJWT, forgotPassword, getApplicationInfo, getCurrentUser, getSession, isAuthenticated, isInternal, listSessions, refreshToken, resendVerification, resetPassword, revokeOtherSessions, revokeSession, sendMagicLink, signIn, signOut, signUp, socialRedirect, updateProfile, useApplicationLogo, useAuth, useAuthLoading, useAuthStore, useCheckToken, useEmailVerification, useMagicLink, usePasswordReset, useUser as useProfile, useSession, useSessions, useSignIn, useSignOut, useSignUp, useUser, verifyEmail, verifyMagicLink };
|
|
3218
|
+
export { UserProfile as AccountModal, AuthCard, AuthLoaded, AuthLoading, AuthProvider, ForgotPassword, ForgotPassword as ForgotPasswordForm, MagicLink, MagicLinkCallback, MagicLink as MagicLinkForm, MagicLinkCallback as MagicLinkVerify, Protect, Protect as ProtectedRoute, ResetPassword, ResetPassword as ResetPasswordForm, SignIn, SignInButton, SignIn as SignInForm, SignOutButton, SignUp, SignUpButton, SignUp as SignUpForm, SignedIn, SignedOut, UserInformation, UserProfile, VerifyEmail, VerifyEmail as VerifyEmailCard, changeEmail, changePassword, configure, decodeJWT, forgotPassword, getApplicationInfo, getCurrentUser, getSession, isAuthenticated, isInternal, listSessions, refreshToken, resendVerification, resetPassword, revokeOtherSessions, revokeSession, sendMagicLink, signIn, signOut, signUp, socialRedirect, updateProfile, useApplicationLogo, useAuth, useAuthLoading, useAuthStore, useCheckToken, useEmailVerification, useMagicLink, usePasswordReset, useUser as useProfile, useSession, useSessions, useSignIn, useSignOut, useSignUp, useUser, verifyEmail, verifyMagicLink };
|
|
3068
3219
|
//# sourceMappingURL=index.esm.js.map
|