@mesob/auth-react 0.0.8 → 0.1.0
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/components/auth/auth-page-layout.d.ts +1 -3
- package/dist/components/auth/auth-page-layout.js +1 -17
- package/dist/components/auth/auth-page-layout.js.map +1 -1
- package/dist/components/auth/countdown.js +70 -9
- package/dist/components/auth/countdown.js.map +1 -1
- package/dist/components/auth/forgot-password.js +101 -35
- package/dist/components/auth/forgot-password.js.map +1 -1
- package/dist/components/auth/pages/forgot-password-page.d.ts +2 -13
- package/dist/components/auth/pages/forgot-password-page.js +198 -126
- package/dist/components/auth/pages/forgot-password-page.js.map +1 -1
- package/dist/components/auth/pages/reset-password-page.d.ts +1 -12
- package/dist/components/auth/pages/reset-password-page.js +288 -200
- package/dist/components/auth/pages/reset-password-page.js.map +1 -1
- package/dist/components/auth/pages/sign-in-page.d.ts +1 -12
- package/dist/components/auth/pages/sign-in-page.js +352 -230
- package/dist/components/auth/pages/sign-in-page.js.map +1 -1
- package/dist/components/auth/pages/sign-up-page.d.ts +1 -11
- package/dist/components/auth/pages/sign-up-page.js +310 -216
- package/dist/components/auth/pages/sign-up-page.js.map +1 -1
- package/dist/components/auth/pages/verify-email-page.d.ts +2 -12
- package/dist/components/auth/pages/verify-email-page.js +203 -135
- package/dist/components/auth/pages/verify-email-page.js.map +1 -1
- package/dist/components/auth/pages/verify-phone-page.d.ts +1 -11
- package/dist/components/auth/pages/verify-phone-page.js +206 -137
- package/dist/components/auth/pages/verify-phone-page.js.map +1 -1
- package/dist/components/auth/reset-password-form.d.ts +1 -1
- package/dist/components/auth/reset-password-form.js +188 -106
- package/dist/components/auth/reset-password-form.js.map +1 -1
- package/dist/components/auth/sign-in.d.ts +3 -3
- package/dist/components/auth/sign-in.js +228 -109
- package/dist/components/auth/sign-in.js.map +1 -1
- package/dist/components/auth/sign-up.js +210 -122
- package/dist/components/auth/sign-up.js.map +1 -1
- package/dist/components/auth/verification-form.d.ts +1 -1
- package/dist/components/auth/verification-form.js +101 -53
- package/dist/components/auth/verification-form.js.map +1 -1
- package/dist/components/error-boundary.d.ts +27 -0
- package/dist/components/error-boundary.js +49 -0
- package/dist/components/error-boundary.js.map +1 -0
- package/dist/components/iam/permissions/permissions-page.d.ts +5 -0
- package/dist/components/iam/permissions/permissions-page.js +201 -0
- package/dist/components/iam/permissions/permissions-page.js.map +1 -0
- package/dist/components/iam/roles/roles-page.d.ts +5 -0
- package/dist/components/iam/roles/roles-page.js +199 -0
- package/dist/components/iam/roles/roles-page.js.map +1 -0
- package/dist/components/iam/sessions/sessions-page.d.ts +5 -0
- package/dist/components/iam/sessions/sessions-page.js +202 -0
- package/dist/components/iam/sessions/sessions-page.js.map +1 -0
- package/dist/components/iam/tenants/tenants-page.d.ts +5 -0
- package/dist/components/iam/tenants/tenants-page.js +202 -0
- package/dist/components/iam/tenants/tenants-page.js.map +1 -0
- package/dist/components/iam/users/users-page.d.ts +5 -0
- package/dist/components/iam/users/users-page.js +211 -0
- package/dist/components/iam/users/users-page.js.map +1 -0
- package/dist/components/profile/profile-page.d.ts +8 -0
- package/dist/components/profile/profile-page.js +163 -0
- package/dist/components/profile/profile-page.js.map +1 -0
- package/dist/components/shared/data-table/data-table.d.ts +22 -0
- package/dist/components/shared/data-table/data-table.js +85 -0
- package/dist/components/shared/data-table/data-table.js.map +1 -0
- package/dist/components/skeletons/auth-form-skeleton.d.ts +5 -0
- package/dist/components/skeletons/auth-form-skeleton.js +32 -0
- package/dist/components/skeletons/auth-form-skeleton.js.map +1 -0
- package/dist/components/skeletons/profile-skeleton.d.ts +5 -0
- package/dist/components/skeletons/profile-skeleton.js +33 -0
- package/dist/components/skeletons/profile-skeleton.js.map +1 -0
- package/dist/components/skeletons/table-skeleton.d.ts +9 -0
- package/dist/components/skeletons/table-skeleton.js +39 -0
- package/dist/components/skeletons/table-skeleton.js.map +1 -0
- package/dist/handle-error-BqDMxnQZ.d.ts +8 -0
- package/dist/index.d.ts +75 -208
- package/dist/index.js +2091 -1057
- package/dist/index.js.map +1 -1
- package/package.json +9 -3
- package/dist/handle-error-H0iqQxJ5.d.ts +0 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,64 @@
|
|
|
1
1
|
export { AuthCard } from './components/auth/auth-card.js';
|
|
2
|
-
export { AuthPageLayout } from './components/auth/auth-page-layout.js';
|
|
3
|
-
export { Countdown } from './components/auth/countdown.js';
|
|
4
|
-
export { ForgotPassword } from './components/auth/forgot-password.js';
|
|
5
2
|
export { ForgotPasswordPage } from './components/auth/pages/forgot-password-page.js';
|
|
6
3
|
export { ResetPasswordPage } from './components/auth/pages/reset-password-page.js';
|
|
7
4
|
export { SignInPage } from './components/auth/pages/sign-in-page.js';
|
|
8
5
|
export { SignUpPage } from './components/auth/pages/sign-up-page.js';
|
|
9
6
|
export { VerifyEmailPage } from './components/auth/pages/verify-email-page.js';
|
|
10
7
|
export { VerifyPhonePage } from './components/auth/pages/verify-phone-page.js';
|
|
11
|
-
export { ResetPasswordForm } from './components/auth/reset-password-form.js';
|
|
12
|
-
export { SignIn } from './components/auth/sign-in.js';
|
|
13
|
-
export { SignUp } from './components/auth/sign-up.js';
|
|
14
8
|
export { VerificationForm } from './components/auth/verification-form.js';
|
|
9
|
+
export { AuthErrorBoundary, ErrorBoundary } from './components/error-boundary.js';
|
|
10
|
+
export { PermissionsPage } from './components/iam/permissions/permissions-page.js';
|
|
11
|
+
export { RolesPage } from './components/iam/roles/roles-page.js';
|
|
12
|
+
export { SessionsPage } from './components/iam/sessions/sessions-page.js';
|
|
13
|
+
export { TenantsPage } from './components/iam/tenants/tenants-page.js';
|
|
14
|
+
export { UsersPage } from './components/iam/users/users-page.js';
|
|
15
|
+
export { ProfilePage } from './components/profile/profile-page.js';
|
|
16
|
+
export { DataTable, DataTableColumn } from './components/shared/data-table/data-table.js';
|
|
17
|
+
export { AuthFormSkeleton } from './components/skeletons/auth-form-skeleton.js';
|
|
18
|
+
export { ProfileSkeleton } from './components/skeletons/profile-skeleton.js';
|
|
19
|
+
export { TableSkeleton } from './components/skeletons/table-skeleton.js';
|
|
15
20
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
16
21
|
import { ReactNode } from 'react';
|
|
17
|
-
|
|
22
|
+
export { A as AuthErrorContent, h as handleError } from './handle-error-BqDMxnQZ.js';
|
|
18
23
|
|
|
24
|
+
declare function useSessionCookieName(): string;
|
|
25
|
+
|
|
26
|
+
declare function useTranslator(namespace?: string): (key: string, params?: Record<string, string | number>) => string;
|
|
27
|
+
|
|
28
|
+
type UIConfig = {
|
|
29
|
+
logo: React.ReactNode;
|
|
30
|
+
name: React.ReactNode;
|
|
31
|
+
logoImage?: string;
|
|
32
|
+
};
|
|
33
|
+
type FeaturesConfig = {
|
|
34
|
+
enableSignup?: boolean;
|
|
35
|
+
enablePasswordReset?: boolean;
|
|
36
|
+
enableEmailSignup?: boolean;
|
|
37
|
+
enablePhoneSignup?: boolean;
|
|
38
|
+
enableSocialSignup?: boolean;
|
|
39
|
+
socialProviders?: string[];
|
|
40
|
+
};
|
|
41
|
+
type NavigationConfig = {
|
|
42
|
+
locale?: string;
|
|
43
|
+
defaultRedirectUrl?: string;
|
|
44
|
+
onNavigate?: (path: string) => void;
|
|
45
|
+
linkComponent?: React.ComponentType<React.ComponentProps<'a'> & {
|
|
46
|
+
href: string;
|
|
47
|
+
}>;
|
|
48
|
+
links?: {
|
|
49
|
+
signIn?: string;
|
|
50
|
+
signUp?: string;
|
|
51
|
+
forgotPassword?: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
type AuthClientConfig = {
|
|
55
|
+
baseURL: string;
|
|
56
|
+
ui: UIConfig;
|
|
57
|
+
features?: FeaturesConfig;
|
|
58
|
+
navigation?: NavigationConfig;
|
|
59
|
+
messages?: Record<string, unknown>;
|
|
60
|
+
cookiePrefix?: string;
|
|
61
|
+
};
|
|
19
62
|
type UserRole = {
|
|
20
63
|
id: string;
|
|
21
64
|
roleId: string;
|
|
@@ -49,216 +92,40 @@ type AuthResponse = {
|
|
|
49
92
|
sessionToken: string;
|
|
50
93
|
sessionExpiresAt: string;
|
|
51
94
|
};
|
|
52
|
-
type VerificationResponse = {
|
|
53
|
-
verificationId: string;
|
|
54
|
-
requiresVerification?: boolean;
|
|
55
|
-
};
|
|
56
|
-
type SessionResponse = {
|
|
57
|
-
user: User | null;
|
|
58
|
-
session: Session | null;
|
|
59
|
-
};
|
|
60
|
-
type PendingAccountChange = {
|
|
61
|
-
changeType: 'email' | 'phone';
|
|
62
|
-
newEmail: string | null;
|
|
63
|
-
newPhone: string | null;
|
|
64
|
-
expiresAt: string;
|
|
65
|
-
};
|
|
66
|
-
type PendingAccountChangeResponse = {
|
|
67
|
-
accountChange: PendingAccountChange | null;
|
|
68
|
-
verificationId: string | null;
|
|
69
|
-
};
|
|
70
|
-
type AuthErrorCode = 'USER_NOT_FOUND' | 'INVALID_PASSWORD' | 'USER_EXISTS' | 'VERIFICATION_EXPIRED' | 'VERIFICATION_MISMATCH' | 'VERIFICATION_NOT_FOUND' | 'TOO_MANY_ATTEMPTS' | 'REQUIRES_VERIFICATION' | 'UNAUTHORIZED' | 'ACCESS_DENIED' | 'HAS_NO_PASSWORD';
|
|
71
95
|
|
|
72
|
-
type
|
|
73
|
-
|
|
74
|
-
};
|
|
75
|
-
declare class AuthClient {
|
|
76
|
-
private baseURL;
|
|
77
|
-
constructor(config: AuthClientConfig);
|
|
78
|
-
private request;
|
|
79
|
-
signUpWithEmail(data: {
|
|
80
|
-
email: string;
|
|
81
|
-
password: string;
|
|
82
|
-
fullName: string;
|
|
83
|
-
handle?: string;
|
|
84
|
-
}): Promise<AuthResponse | VerificationResponse>;
|
|
85
|
-
signUpWithPhone(data: {
|
|
86
|
-
phone: string;
|
|
87
|
-
password: string;
|
|
88
|
-
fullName: string;
|
|
89
|
-
handle?: string;
|
|
90
|
-
}): Promise<AuthResponse | VerificationResponse>;
|
|
91
|
-
checkUser(data: {
|
|
92
|
-
identifier: string;
|
|
93
|
-
}): Promise<{
|
|
94
|
-
exists: boolean;
|
|
95
|
-
}>;
|
|
96
|
-
signInWithPassword(data: {
|
|
97
|
-
identifier: string;
|
|
98
|
-
password: string;
|
|
99
|
-
}): Promise<AuthResponse | VerificationResponse>;
|
|
100
|
-
signOut(): Promise<{
|
|
101
|
-
message: string;
|
|
102
|
-
}>;
|
|
103
|
-
requestEmailVerification(data?: {
|
|
104
|
-
email?: string;
|
|
105
|
-
}): Promise<{
|
|
106
|
-
verificationId: string;
|
|
107
|
-
}>;
|
|
108
|
-
verifyEmail(data: {
|
|
109
|
-
verificationId: string;
|
|
110
|
-
code: string;
|
|
111
|
-
}): Promise<AuthResponse>;
|
|
112
|
-
resendVerification(_verificationId: string): Promise<{
|
|
113
|
-
verificationId: string;
|
|
114
|
-
}>;
|
|
115
|
-
requestPhoneOtp(data: {
|
|
116
|
-
phone: string;
|
|
117
|
-
context: 'sign-up' | 'sign-in' | 'change-phone';
|
|
118
|
-
}): Promise<{
|
|
119
|
-
verificationId: string;
|
|
120
|
-
}>;
|
|
121
|
-
verifyPhoneOtp(data: {
|
|
122
|
-
verificationId: string;
|
|
123
|
-
code: string;
|
|
124
|
-
context: 'sign-up' | 'sign-in' | 'change-phone';
|
|
125
|
-
}): Promise<AuthResponse | {
|
|
126
|
-
user: User | null;
|
|
127
|
-
session: null;
|
|
128
|
-
verified: boolean;
|
|
129
|
-
}>;
|
|
130
|
-
forgotPassword(data: {
|
|
131
|
-
identifier: string;
|
|
132
|
-
}): Promise<{
|
|
133
|
-
message: string;
|
|
134
|
-
}>;
|
|
135
|
-
resetPassword(data: {
|
|
136
|
-
verificationId: string;
|
|
137
|
-
code: string;
|
|
138
|
-
password: string;
|
|
139
|
-
}): Promise<AuthResponse>;
|
|
140
|
-
verifyPassword(data: {
|
|
141
|
-
password: string;
|
|
142
|
-
}): Promise<{
|
|
143
|
-
message: string;
|
|
144
|
-
}>;
|
|
145
|
-
changePassword(data: {
|
|
146
|
-
currentPassword: string;
|
|
147
|
-
newPassword: string;
|
|
148
|
-
}): Promise<{
|
|
149
|
-
message: string;
|
|
150
|
-
}>;
|
|
151
|
-
getSession(): Promise<SessionResponse>;
|
|
152
|
-
getPendingAccountChange(): Promise<PendingAccountChangeResponse>;
|
|
153
|
-
updateProfile(data: {
|
|
154
|
-
fullName?: string;
|
|
155
|
-
}): Promise<{
|
|
156
|
-
user: User;
|
|
157
|
-
}>;
|
|
158
|
-
updateEmail(data: {
|
|
159
|
-
email: string;
|
|
160
|
-
}): Promise<{
|
|
161
|
-
user: User;
|
|
162
|
-
}>;
|
|
163
|
-
updatePhone(data: {
|
|
164
|
-
phone: string;
|
|
165
|
-
}): Promise<{
|
|
166
|
-
user: User;
|
|
167
|
-
}>;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
type AuthContextValue = {
|
|
96
|
+
type OpenApiHooks = any;
|
|
97
|
+
type SessionState = {
|
|
171
98
|
user: User | null;
|
|
172
99
|
session: Session | null;
|
|
173
|
-
|
|
100
|
+
isLoading: boolean;
|
|
101
|
+
isAuthenticated: boolean;
|
|
174
102
|
error: Error | null;
|
|
175
|
-
|
|
103
|
+
};
|
|
104
|
+
type SessionContextValue = SessionState & {
|
|
176
105
|
refresh: () => Promise<void>;
|
|
177
|
-
|
|
106
|
+
signOut: () => Promise<void>;
|
|
178
107
|
};
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
108
|
+
type ApiContextValue = {
|
|
109
|
+
hooks: OpenApiHooks;
|
|
110
|
+
setAuth: (auth: AuthResponse) => void;
|
|
111
|
+
clearAuth: () => void;
|
|
112
|
+
refresh: () => Promise<void>;
|
|
183
113
|
};
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
signUpWithEmail: (data: {
|
|
188
|
-
email: string;
|
|
189
|
-
password: string;
|
|
190
|
-
fullName: string;
|
|
191
|
-
handle?: string;
|
|
192
|
-
}) => Promise<AuthResponse | VerificationResponse>;
|
|
193
|
-
signUpWithPhone: (data: {
|
|
194
|
-
phone: string;
|
|
195
|
-
password: string;
|
|
196
|
-
fullName: string;
|
|
197
|
-
handle?: string;
|
|
198
|
-
}) => Promise<AuthResponse | VerificationResponse>;
|
|
199
|
-
signInWithPassword: (data: {
|
|
200
|
-
identifier: string;
|
|
201
|
-
password: string;
|
|
202
|
-
}) => Promise<AuthResponse | VerificationResponse>;
|
|
203
|
-
signOut: () => Promise<{
|
|
204
|
-
message: string;
|
|
205
|
-
}>;
|
|
206
|
-
requestEmailVerification: (data?: {
|
|
207
|
-
email?: string;
|
|
208
|
-
}) => Promise<{
|
|
209
|
-
verificationId: string;
|
|
210
|
-
}>;
|
|
211
|
-
verifyEmail: (data: {
|
|
212
|
-
verificationId: string;
|
|
213
|
-
code: string;
|
|
214
|
-
}) => Promise<AuthResponse>;
|
|
215
|
-
resendVerification: (_verificationId: string) => Promise<{
|
|
216
|
-
verificationId: string;
|
|
217
|
-
}>;
|
|
218
|
-
requestPhoneOtp: (data: {
|
|
219
|
-
phone: string;
|
|
220
|
-
context: "sign-up" | "sign-in" | "change-phone";
|
|
221
|
-
}) => Promise<{
|
|
222
|
-
verificationId: string;
|
|
223
|
-
}>;
|
|
224
|
-
verifyPhoneOtp: (data: {
|
|
225
|
-
verificationId: string;
|
|
226
|
-
code: string;
|
|
227
|
-
context: "sign-up" | "sign-in" | "change-phone";
|
|
228
|
-
}) => Promise<AuthResponse | {
|
|
229
|
-
user: User | null;
|
|
230
|
-
session: null;
|
|
231
|
-
verified: boolean;
|
|
232
|
-
}>;
|
|
233
|
-
forgotPassword: (data: {
|
|
234
|
-
identifier: string;
|
|
235
|
-
}) => Promise<{
|
|
236
|
-
message: string;
|
|
237
|
-
}>;
|
|
238
|
-
resetPassword: (data: {
|
|
239
|
-
verificationId: string;
|
|
240
|
-
code: string;
|
|
241
|
-
password: string;
|
|
242
|
-
}) => Promise<AuthResponse>;
|
|
243
|
-
changePassword: (data: {
|
|
244
|
-
currentPassword: string;
|
|
245
|
-
newPassword: string;
|
|
246
|
-
}) => Promise<{
|
|
247
|
-
message: string;
|
|
248
|
-
}>;
|
|
249
|
-
getSession: () => Promise<SessionResponse>;
|
|
250
|
-
useSession: () => never;
|
|
114
|
+
type ConfigContextValue = {
|
|
115
|
+
config: AuthClientConfig;
|
|
116
|
+
t: (key: string, params?: Record<string, string | number>) => string;
|
|
251
117
|
};
|
|
252
|
-
|
|
253
|
-
declare
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
error: Error | null;
|
|
259
|
-
refresh: () => Promise<void>;
|
|
118
|
+
declare function useSession(): SessionContextValue;
|
|
119
|
+
declare function useApi(): ApiContextValue;
|
|
120
|
+
declare function useConfig(): ConfigContextValue;
|
|
121
|
+
type MesobAuthProviderProps = {
|
|
122
|
+
config: AuthClientConfig;
|
|
123
|
+
children: ReactNode;
|
|
260
124
|
};
|
|
125
|
+
declare function MesobAuthProvider({ config, children, }: MesobAuthProviderProps): react_jsx_runtime.JSX.Element;
|
|
126
|
+
|
|
127
|
+
declare const getSessionCookieName: (config: AuthClientConfig) => string;
|
|
261
128
|
|
|
262
129
|
declare function normalizePhone(phone: string): string;
|
|
263
130
|
|
|
264
|
-
export {
|
|
131
|
+
export { type AuthClientConfig, type AuthResponse, MesobAuthProvider, type Session, type User, type UserRole, getSessionCookieName, normalizePhone, useApi, useConfig, useSession, useSessionCookieName, useTranslator };
|