mailsentry-auth 0.1.7 → 0.2.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/index.d.mts +187 -47
- package/dist/index.d.ts +187 -47
- package/dist/index.js +2610 -2157
- package/dist/index.mjs +2718 -2265
- package/dist/middleware.mjs +66 -18
- package/dist/utils/cookie-utils.js +26 -4
- package/dist/utils/cookie-utils.mjs +26 -4
- package/package.json +4 -2
package/dist/index.d.mts
CHANGED
|
@@ -3,9 +3,11 @@ import { Store } from 'rc-field-form/lib/interface';
|
|
|
3
3
|
import { FormItemProps } from 'antd';
|
|
4
4
|
import * as React$1 from 'react';
|
|
5
5
|
import React__default, { ReactNode } from 'react';
|
|
6
|
+
import { PasswordProps } from 'antd/es/input/Password';
|
|
6
7
|
import { NextRequest, NextResponse } from 'next/server';
|
|
7
8
|
import { InputProps } from 'antd/es/input';
|
|
8
|
-
import {
|
|
9
|
+
import { CheckboxProps } from 'antd/es/checkbox';
|
|
10
|
+
import { ButtonProps } from 'antd/es/button';
|
|
9
11
|
import * as immer from 'immer';
|
|
10
12
|
import * as zustand from 'zustand';
|
|
11
13
|
|
|
@@ -22,7 +24,9 @@ import * as zustand from 'zustand';
|
|
|
22
24
|
declare enum AuthFlowStep {
|
|
23
25
|
EMAIL = "email",
|
|
24
26
|
PASSWORD = "password",
|
|
25
|
-
VERIFICATION = "verification"
|
|
27
|
+
VERIFICATION = "verification",
|
|
28
|
+
FINISH = "finish",
|
|
29
|
+
FORGOT_PASSWORD = "forgot-password"
|
|
26
30
|
}
|
|
27
31
|
/**
|
|
28
32
|
* Enum for next action after email check
|
|
@@ -137,11 +141,29 @@ interface UserProfile {
|
|
|
137
141
|
interface UserProfileResponse extends BaseResponse {
|
|
138
142
|
data: UserProfile;
|
|
139
143
|
}
|
|
144
|
+
interface PublicUserProfile extends Omit<UserProfile, 'project'> {
|
|
145
|
+
tokens: {
|
|
146
|
+
accessToken: string;
|
|
147
|
+
refreshToken: string;
|
|
148
|
+
};
|
|
149
|
+
project?: {
|
|
150
|
+
_id: string;
|
|
151
|
+
name: string;
|
|
152
|
+
origin: string;
|
|
153
|
+
secretKey: string;
|
|
154
|
+
__v: number;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
interface PublicUserProfileResponse extends BaseResponse {
|
|
158
|
+
data: PublicUserProfile;
|
|
159
|
+
}
|
|
140
160
|
interface IAuthService {
|
|
141
161
|
checkEmailExists(email: string): Promise<EmailExistResponse>;
|
|
142
162
|
login(credentials: LoginRequest): Promise<LoginResponse>;
|
|
163
|
+
loginWithGoogle(token: string): Promise<LoginResponse>;
|
|
143
164
|
verifyEmail(verification: VerifyEmailRequest): Promise<VerifyEmailResponse>;
|
|
144
165
|
getUserProfile(): Promise<UserProfileResponse>;
|
|
166
|
+
getMe(): Promise<PublicUserProfileResponse>;
|
|
145
167
|
}
|
|
146
168
|
|
|
147
169
|
interface AuthActionState {
|
|
@@ -158,7 +180,6 @@ interface AuthActionOptions<T = unknown> extends AuthActionCallbacks<T> {
|
|
|
158
180
|
preserveSuccessOnError?: boolean;
|
|
159
181
|
}
|
|
160
182
|
interface BaseAuthActionResult {
|
|
161
|
-
message: string;
|
|
162
183
|
nextAction?: NextAction;
|
|
163
184
|
}
|
|
164
185
|
interface AuthActionResultSuccess<T = unknown> extends BaseAuthActionResult {
|
|
@@ -195,10 +216,12 @@ interface UseFormSubmissionProps<T> {
|
|
|
195
216
|
interface IAuthOrchestrator {
|
|
196
217
|
handleEmailCheck(email: string): Promise<AuthActionResult>;
|
|
197
218
|
handleLoginFlow(credentials: LoginRequest): Promise<AuthActionResult>;
|
|
219
|
+
handleGoogleLogin(token: string): Promise<AuthActionResult>;
|
|
198
220
|
handleEmailVerification(email: string, code: string): Promise<AuthActionResult>;
|
|
199
221
|
handleLogout(): Promise<AuthActionResult>;
|
|
200
222
|
checkAuthenticationStatus(): Promise<AuthActionResult>;
|
|
201
223
|
getUserProfileData(): Promise<AuthActionResult>;
|
|
224
|
+
getMeData(): Promise<AuthActionResult>;
|
|
202
225
|
getTokenInfo(): Promise<AuthActionResult>;
|
|
203
226
|
}
|
|
204
227
|
|
|
@@ -250,11 +273,6 @@ interface HttpError extends Error {
|
|
|
250
273
|
response?: unknown;
|
|
251
274
|
}
|
|
252
275
|
|
|
253
|
-
interface AlertDisplayProps {
|
|
254
|
-
error?: string;
|
|
255
|
-
success?: string;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
276
|
interface FormHeaderProps {
|
|
259
277
|
title: string;
|
|
260
278
|
description?: string;
|
|
@@ -267,7 +285,7 @@ interface FormFieldsProps {
|
|
|
267
285
|
fields: BaseFormField[];
|
|
268
286
|
}
|
|
269
287
|
|
|
270
|
-
interface BaseComponentProps extends FormHeaderProps
|
|
288
|
+
interface BaseComponentProps extends FormHeaderProps {
|
|
271
289
|
submitButtonText: string;
|
|
272
290
|
isLoading?: boolean;
|
|
273
291
|
initialValues?: Store;
|
|
@@ -277,15 +295,16 @@ interface BaseFormProps<T = Record<string, unknown>> extends BaseComponentProps,
|
|
|
277
295
|
onSubmit: (values: T) => void | Promise<void>;
|
|
278
296
|
form?: FormInstance;
|
|
279
297
|
additionalActions?: React.ReactNode;
|
|
280
|
-
showAlerts?: boolean;
|
|
281
298
|
}
|
|
282
299
|
|
|
283
|
-
interface
|
|
300
|
+
interface GoogleSignInActionsProps {
|
|
301
|
+
onGoogleSignIn?: (token: string) => void;
|
|
302
|
+
isLoading?: boolean;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
interface EmailStepProps extends BaseStepProps, GoogleSignInActionsProps {
|
|
284
306
|
onSubmit: (email: string) => void | Promise<void>;
|
|
285
|
-
onGoogleSignIn?: () => void;
|
|
286
307
|
onForgotPassword?: () => void;
|
|
287
|
-
showGoogleButton?: boolean;
|
|
288
|
-
showForgotPassword?: boolean;
|
|
289
308
|
}
|
|
290
309
|
|
|
291
310
|
interface PasswordStepProps extends BaseStepProps {
|
|
@@ -307,6 +326,24 @@ interface VerificationStepProps extends BaseStepProps {
|
|
|
307
326
|
showResendButton?: boolean;
|
|
308
327
|
}
|
|
309
328
|
|
|
329
|
+
interface ForgotPasswordStepProps extends BaseStepProps {
|
|
330
|
+
email: string;
|
|
331
|
+
onSubmit: (email: string) => void | Promise<void>;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
declare enum AuthFlowVariant {
|
|
335
|
+
DEFAULT = "default",
|
|
336
|
+
WITH_IMAGE = "with_image"
|
|
337
|
+
}
|
|
338
|
+
type AuthFlowProps = {
|
|
339
|
+
variant?: AuthFlowVariant;
|
|
340
|
+
backgroundImage?: string;
|
|
341
|
+
};
|
|
342
|
+
type AuthFlowContainerProps = AuthFlowProps;
|
|
343
|
+
type AuthFlowModalProps = AuthFlowProps & {
|
|
344
|
+
children: ReactNode;
|
|
345
|
+
};
|
|
346
|
+
|
|
310
347
|
declare enum ProfileUIState {
|
|
311
348
|
LOADING = "LOADING",
|
|
312
349
|
UNAUTHENTICATED = "UNAUTHENTICATED",
|
|
@@ -372,8 +409,9 @@ interface StepRegistryHandlers {
|
|
|
372
409
|
handleResendCode: () => void;
|
|
373
410
|
goBackToEmail: () => void;
|
|
374
411
|
goBackToPassword: () => void;
|
|
375
|
-
onGoogleSignIn?: () => void;
|
|
376
|
-
|
|
412
|
+
onGoogleSignIn?: (token: string) => void;
|
|
413
|
+
handleForgotPassword?: (email: string) => Promise<void>;
|
|
414
|
+
onForgotPasswordClick?: () => void;
|
|
377
415
|
}
|
|
378
416
|
interface StepRegistryState {
|
|
379
417
|
email: string;
|
|
@@ -389,12 +427,31 @@ interface StepperState {
|
|
|
389
427
|
currentStep: AuthFlowStep;
|
|
390
428
|
}
|
|
391
429
|
type StepComponentRetriever = (step: AuthFlowStep) => StepComponent | null;
|
|
392
|
-
type AnyStepProps = EmailStepProps | PasswordStepProps | VerificationStepProps;
|
|
430
|
+
type AnyStepProps = EmailStepProps | PasswordStepProps | VerificationStepProps | ForgotPasswordStepProps;
|
|
393
431
|
type StepComponent = React__default.ComponentType<AnyStepProps>;
|
|
394
432
|
type StepRegistry = Record<AuthFlowStep, StepComponent>;
|
|
395
433
|
type PropsFactory = () => AnyStepProps;
|
|
396
434
|
type StepPropsFactoryRegistry = Record<AuthFlowStep, PropsFactory>;
|
|
397
435
|
|
|
436
|
+
interface AlertDisplayProps {
|
|
437
|
+
error?: string;
|
|
438
|
+
success?: string;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
interface PasswordStrengthRule {
|
|
442
|
+
label: string;
|
|
443
|
+
test: (password: string) => boolean;
|
|
444
|
+
}
|
|
445
|
+
interface StrengthResult {
|
|
446
|
+
label: string;
|
|
447
|
+
percent: number;
|
|
448
|
+
status: 'success' | 'exception' | 'normal';
|
|
449
|
+
color?: string;
|
|
450
|
+
}
|
|
451
|
+
interface PasswordInputWithStrengthProps extends PasswordProps {
|
|
452
|
+
showStrengthIndicator?: boolean;
|
|
453
|
+
}
|
|
454
|
+
|
|
398
455
|
/**
|
|
399
456
|
* Enum for user roles
|
|
400
457
|
*/
|
|
@@ -532,10 +589,10 @@ declare const PageTypePatterns: {
|
|
|
532
589
|
declare const CrossTabBehaviorConfig: {
|
|
533
590
|
readonly "/login": {
|
|
534
591
|
readonly "auth.logged_in": {
|
|
535
|
-
readonly action: NavigationAction.
|
|
592
|
+
readonly action: NavigationAction.NONE;
|
|
536
593
|
};
|
|
537
594
|
readonly "auth.logged_out": {
|
|
538
|
-
readonly action: NavigationAction.
|
|
595
|
+
readonly action: NavigationAction.NONE;
|
|
539
596
|
};
|
|
540
597
|
readonly "auth.email_verified": {
|
|
541
598
|
readonly action: NavigationAction.NONE;
|
|
@@ -624,6 +681,8 @@ declare const getStepForVerificationSubmission: (success: boolean) => AuthFlowSt
|
|
|
624
681
|
declare const getEmailField: (options?: InputProps) => BaseFormField;
|
|
625
682
|
declare const getPasswordField: (isLogin: boolean, disabled?: boolean, options?: PasswordProps) => BaseFormField;
|
|
626
683
|
declare const getVerificationField: (codeLength?: number, options?: InputProps) => BaseFormField;
|
|
684
|
+
declare const getTermsCheckboxField: (options?: CheckboxProps) => BaseFormField;
|
|
685
|
+
declare const getForgotPasswordField: (options?: ButtonProps) => BaseFormField;
|
|
627
686
|
|
|
628
687
|
/**
|
|
629
688
|
* Middleware configuration constants for routing and protection
|
|
@@ -635,9 +694,14 @@ declare class MiddlewareConfig {
|
|
|
635
694
|
readonly PUBLIC_PATH: "/public";
|
|
636
695
|
readonly PUBLIC_API_PATH: "/api/public";
|
|
637
696
|
};
|
|
697
|
+
/**
|
|
698
|
+
* Get public routes whitelist from environment variable
|
|
699
|
+
* Expected format: comma-separated paths like "/public,/links/new,/about"
|
|
700
|
+
*/
|
|
701
|
+
static getPublicRoutesWhitelist(): string[];
|
|
638
702
|
static readonly PROTECTED_ROUTES: {
|
|
639
703
|
INCLUDE: string[];
|
|
640
|
-
EXCLUDE:
|
|
704
|
+
EXCLUDE: string[];
|
|
641
705
|
};
|
|
642
706
|
static readonly ALLOWED_METHODS: readonly ["GET", "HEAD"];
|
|
643
707
|
static readonly QUERY_PARAMS: {
|
|
@@ -813,9 +877,9 @@ declare class CrossTabBehaviorHandler {
|
|
|
813
877
|
* Get the action configuration for current route and event
|
|
814
878
|
*/
|
|
815
879
|
static getAction(currentPageType: PageType, eventType: AuthEventType): {
|
|
816
|
-
readonly action: NavigationAction.
|
|
880
|
+
readonly action: NavigationAction.NONE;
|
|
817
881
|
} | {
|
|
818
|
-
readonly action: NavigationAction.
|
|
882
|
+
readonly action: NavigationAction.NONE;
|
|
819
883
|
} | {
|
|
820
884
|
readonly action: NavigationAction.NONE;
|
|
821
885
|
} | {
|
|
@@ -858,6 +922,10 @@ declare class UrlUtils {
|
|
|
858
922
|
* Check if URL has auth-related query parameters
|
|
859
923
|
*/
|
|
860
924
|
static hasAuthParams(url: string): boolean;
|
|
925
|
+
/**
|
|
926
|
+
* Get the dashboard URL for the current environment
|
|
927
|
+
*/
|
|
928
|
+
static getDashboardUrl(location: Pick<Location, 'protocol' | 'hostname'>): string;
|
|
861
929
|
}
|
|
862
930
|
|
|
863
931
|
/**
|
|
@@ -971,6 +1039,10 @@ declare class AuthService extends BaseService implements IAuthService {
|
|
|
971
1039
|
* Login with email and password
|
|
972
1040
|
*/
|
|
973
1041
|
login(credentials: LoginRequest): Promise<LoginResponse>;
|
|
1042
|
+
/**
|
|
1043
|
+
* Login with Google
|
|
1044
|
+
*/
|
|
1045
|
+
loginWithGoogle(token: string): Promise<LoginResponse>;
|
|
974
1046
|
/**
|
|
975
1047
|
* Verify email with verification code
|
|
976
1048
|
*/
|
|
@@ -979,6 +1051,10 @@ declare class AuthService extends BaseService implements IAuthService {
|
|
|
979
1051
|
* Get user profile
|
|
980
1052
|
*/
|
|
981
1053
|
getUserProfile(): Promise<UserProfileResponse>;
|
|
1054
|
+
/**
|
|
1055
|
+
* Get public user profile (me)
|
|
1056
|
+
*/
|
|
1057
|
+
getMe(): Promise<PublicUserProfileResponse>;
|
|
982
1058
|
/**
|
|
983
1059
|
* Logout user
|
|
984
1060
|
*/
|
|
@@ -991,8 +1067,10 @@ declare class AuthService extends BaseService implements IAuthService {
|
|
|
991
1067
|
declare const AUTH_ENDPOINTS: {
|
|
992
1068
|
readonly CHECK_EMAIL_EXISTS: (email: string) => string;
|
|
993
1069
|
readonly LOGIN: "/auth/user/login";
|
|
1070
|
+
readonly LOGIN_GOOGLE: "/auth/user/login/google";
|
|
994
1071
|
readonly VERIFY_EMAIL: "/auth/user/verify";
|
|
995
1072
|
readonly GET_USER_PROFILE: "/auth/user/profile";
|
|
1073
|
+
readonly GET_ME: "/auth/user/me";
|
|
996
1074
|
readonly LOGOUT: "/auth/logout";
|
|
997
1075
|
};
|
|
998
1076
|
/**
|
|
@@ -1002,8 +1080,10 @@ declare class EndpointBuilder {
|
|
|
1002
1080
|
static auth: {
|
|
1003
1081
|
readonly CHECK_EMAIL_EXISTS: (email: string) => string;
|
|
1004
1082
|
readonly LOGIN: "/auth/user/login";
|
|
1083
|
+
readonly LOGIN_GOOGLE: "/auth/user/login/google";
|
|
1005
1084
|
readonly VERIFY_EMAIL: "/auth/user/verify";
|
|
1006
1085
|
readonly GET_USER_PROFILE: "/auth/user/profile";
|
|
1086
|
+
readonly GET_ME: "/auth/user/me";
|
|
1007
1087
|
readonly LOGOUT: "/auth/logout";
|
|
1008
1088
|
};
|
|
1009
1089
|
}
|
|
@@ -1037,6 +1117,10 @@ declare class AuthOrchestrator implements IAuthOrchestrator {
|
|
|
1037
1117
|
* Handle complete login flow with proper error handling and token management
|
|
1038
1118
|
*/
|
|
1039
1119
|
handleLoginFlow(credentials: LoginRequest): Promise<AuthActionResult<LoginData>>;
|
|
1120
|
+
/**
|
|
1121
|
+
* Handle Google login flow
|
|
1122
|
+
*/
|
|
1123
|
+
handleGoogleLogin(token: string): Promise<AuthActionResult<LoginData>>;
|
|
1040
1124
|
/**
|
|
1041
1125
|
* Handle email verification flow
|
|
1042
1126
|
*/
|
|
@@ -1053,6 +1137,14 @@ declare class AuthOrchestrator implements IAuthOrchestrator {
|
|
|
1053
1137
|
* Get user profile data
|
|
1054
1138
|
*/
|
|
1055
1139
|
getUserProfileData(): Promise<AuthActionResult>;
|
|
1140
|
+
/**
|
|
1141
|
+
* Get public user profile data (me) and save tokens for public sessions
|
|
1142
|
+
*
|
|
1143
|
+
* Note: This method saves tokens but does NOT publish AuthEventType.LoggedIn event,
|
|
1144
|
+
* allowing public sessions to have tokens without being marked as "authenticated".
|
|
1145
|
+
* The store's initializePublicUser() maintains isAuthenticated = false.
|
|
1146
|
+
*/
|
|
1147
|
+
getMeData(): Promise<AuthActionResult>;
|
|
1056
1148
|
/**
|
|
1057
1149
|
* Get detailed token information
|
|
1058
1150
|
*/
|
|
@@ -1172,11 +1264,11 @@ declare class AuthResultFactory {
|
|
|
1172
1264
|
/**
|
|
1173
1265
|
* Creates a successful authentication result
|
|
1174
1266
|
*/
|
|
1175
|
-
static createSuccess<T = unknown>(
|
|
1267
|
+
static createSuccess<T = unknown>(data: T): AuthActionResultSuccess<T>;
|
|
1176
1268
|
/**
|
|
1177
1269
|
* Creates a failed authentication result
|
|
1178
1270
|
*/
|
|
1179
|
-
static createFailure(
|
|
1271
|
+
static createFailure(error?: string | Error | unknown): AuthActionResultFailure;
|
|
1180
1272
|
}
|
|
1181
1273
|
|
|
1182
1274
|
/**
|
|
@@ -1210,7 +1302,7 @@ declare class NetworkErrorHandler extends BaseErrorHandler {
|
|
|
1210
1302
|
* Generic Error Handler
|
|
1211
1303
|
*/
|
|
1212
1304
|
declare class GenericErrorHandler extends BaseErrorHandler {
|
|
1213
|
-
protected canHandle(
|
|
1305
|
+
protected canHandle(): boolean;
|
|
1214
1306
|
protected handleError(error: unknown, context: string): AuthActionResult;
|
|
1215
1307
|
}
|
|
1216
1308
|
|
|
@@ -1253,6 +1345,8 @@ interface UserStoreState {
|
|
|
1253
1345
|
setError: (error: string | null) => void;
|
|
1254
1346
|
clearUser: () => Promise<void>;
|
|
1255
1347
|
refreshUser: (forceRefresh?: boolean) => Promise<void>;
|
|
1348
|
+
initializePublicUser: () => Promise<void>;
|
|
1349
|
+
clearPublicUser: () => void;
|
|
1256
1350
|
_authOrchestrator: AuthOrchestrator;
|
|
1257
1351
|
_userStorageManager: UserStorageManager;
|
|
1258
1352
|
}
|
|
@@ -1318,24 +1412,20 @@ declare const userSelectors: {
|
|
|
1318
1412
|
setError: (error: string | null) => void;
|
|
1319
1413
|
clearUser: () => Promise<void>;
|
|
1320
1414
|
refreshUser: (forceRefresh?: boolean) => Promise<void>;
|
|
1415
|
+
initializePublicUser: () => Promise<void>;
|
|
1416
|
+
clearPublicUser: () => void;
|
|
1321
1417
|
};
|
|
1322
1418
|
};
|
|
1323
1419
|
|
|
1324
|
-
declare const
|
|
1420
|
+
declare const PasswordInputWithStrength: React__default.FC<PasswordInputWithStrengthProps>;
|
|
1325
1421
|
|
|
1326
|
-
declare const
|
|
1327
|
-
children: React__default.ReactNode;
|
|
1328
|
-
}) => React__default.JSX.Element;
|
|
1422
|
+
declare const AlertDisplay: ({ error, success }: AlertDisplayProps) => React__default.JSX.Element | null;
|
|
1329
1423
|
|
|
1330
|
-
|
|
1331
|
-
* Auth Initializer Component
|
|
1332
|
-
* Initializes the auth event bus and user store without requiring a provider
|
|
1333
|
-
*/
|
|
1334
|
-
declare const AuthInitializer: ({ children }: {
|
|
1335
|
-
children: React.ReactNode;
|
|
1336
|
-
}) => React.ReactElement;
|
|
1424
|
+
declare const FormHeader: ({ title, description }: FormHeaderProps) => React__default.JSX.Element;
|
|
1337
1425
|
|
|
1338
|
-
declare const
|
|
1426
|
+
declare const FormFields: ({ fields }: FormFieldsProps) => React__default.JSX.Element[];
|
|
1427
|
+
|
|
1428
|
+
declare const BaseForm: <T>({ title, description, fields, submitButtonText, onSubmit, isLoading, form, additionalActions, initialValues }: BaseFormProps<T>) => React__default.JSX.Element;
|
|
1339
1429
|
|
|
1340
1430
|
declare const EmailStep: React__default.FC<EmailStepProps>;
|
|
1341
1431
|
|
|
@@ -1343,20 +1433,23 @@ declare const PasswordStep: React__default.FC<PasswordStepProps>;
|
|
|
1343
1433
|
|
|
1344
1434
|
declare const VerificationStep: React__default.FC<VerificationStepProps>;
|
|
1345
1435
|
|
|
1346
|
-
declare const getEmailStepComponent: StepComponent;
|
|
1347
|
-
declare const getPasswordStepComponent: StepComponent;
|
|
1348
|
-
declare const getVerificationStepComponent: StepComponent;
|
|
1349
1436
|
declare const createStepRegistry: () => StepRegistry;
|
|
1350
1437
|
declare const createPropsFactoryRegistry: ({ baseProps, handlers, state, configs }: StepRegistryParams) => StepPropsFactoryRegistry;
|
|
1351
1438
|
declare const useStepRenderer: () => {
|
|
1352
1439
|
getStepComponent: (step: AuthFlowStep) => StepComponent | null;
|
|
1353
1440
|
};
|
|
1354
1441
|
|
|
1355
|
-
declare
|
|
1442
|
+
declare function AuthFlowContainer({ variant, backgroundImage, }: AuthFlowContainerProps): React__default.JSX.Element;
|
|
1356
1443
|
|
|
1357
|
-
declare
|
|
1444
|
+
declare function AuthFlowModal({ children, variant, backgroundImage, }: AuthFlowModalProps): React__default.JSX.Element;
|
|
1358
1445
|
|
|
1359
|
-
|
|
1446
|
+
/**
|
|
1447
|
+
* Auth Initializer Component
|
|
1448
|
+
* Initializes the auth event bus and user store without requiring a provider
|
|
1449
|
+
*/
|
|
1450
|
+
declare const AuthInitializer: ({ children }: {
|
|
1451
|
+
children: React.ReactNode;
|
|
1452
|
+
}) => React.ReactElement;
|
|
1360
1453
|
|
|
1361
1454
|
declare const ProfileStateRenderer: () => React__default.JSX.Element;
|
|
1362
1455
|
|
|
@@ -1399,10 +1492,8 @@ declare const useStepper: <T extends string>(config: StepConfig<T>) => UseSteppe
|
|
|
1399
1492
|
|
|
1400
1493
|
declare function useStepRegistry({ baseProps: actionState, handlers, state, configs, getStepComponent, stepperState }: UseStepRegistryParams): {
|
|
1401
1494
|
SelectedComponent: React$1.ComponentType<AnyStepProps>;
|
|
1402
|
-
stepProps:
|
|
1495
|
+
stepProps: EmailStepProps | ForgotPasswordStepProps | {
|
|
1403
1496
|
isLoading: boolean | undefined;
|
|
1404
|
-
error: string | undefined;
|
|
1405
|
-
success: string | undefined;
|
|
1406
1497
|
};
|
|
1407
1498
|
};
|
|
1408
1499
|
|
|
@@ -1412,6 +1503,18 @@ declare function useSharedEventBus(): BroadcastChannelEventBus<AuthEvent>;
|
|
|
1412
1503
|
|
|
1413
1504
|
declare function useSignInRequiredParams(): void;
|
|
1414
1505
|
|
|
1506
|
+
/**
|
|
1507
|
+
* Email validation utilities for middleware
|
|
1508
|
+
* These functions are Edge Runtime compatible (no client dependencies)
|
|
1509
|
+
*/
|
|
1510
|
+
/**
|
|
1511
|
+
* Validates if email is in public user format (IP-based)
|
|
1512
|
+
* Format: "31.40.213.163@mailsentry.io"
|
|
1513
|
+
* @param email - Email address to validate
|
|
1514
|
+
* @returns true if email matches IP-based pattern
|
|
1515
|
+
*/
|
|
1516
|
+
declare const isPublicUserEmail: (email: string) => boolean;
|
|
1517
|
+
|
|
1415
1518
|
/**
|
|
1416
1519
|
* Main hook for accessing user state and actions
|
|
1417
1520
|
* This is the primary interface components should use
|
|
@@ -1422,6 +1525,8 @@ declare const useUser: () => {
|
|
|
1422
1525
|
setError: (error: string | null) => void;
|
|
1423
1526
|
clearUser: () => Promise<void>;
|
|
1424
1527
|
refreshUser: (forceRefresh?: boolean) => Promise<void>;
|
|
1528
|
+
initializePublicUser: () => Promise<void>;
|
|
1529
|
+
clearPublicUser: () => void;
|
|
1425
1530
|
user: UserProfile | null;
|
|
1426
1531
|
isAuthenticated: boolean;
|
|
1427
1532
|
isLoading: boolean;
|
|
@@ -1445,6 +1550,8 @@ declare const useUserActions: () => {
|
|
|
1445
1550
|
setError: (error: string | null) => void;
|
|
1446
1551
|
clearUser: () => Promise<void>;
|
|
1447
1552
|
refreshUser: (forceRefresh?: boolean) => Promise<void>;
|
|
1553
|
+
initializePublicUser: () => Promise<void>;
|
|
1554
|
+
clearPublicUser: () => void;
|
|
1448
1555
|
};
|
|
1449
1556
|
/**
|
|
1450
1557
|
* Hook for checking authentication status
|
|
@@ -1465,6 +1572,8 @@ declare const useAuthInitializer: () => {
|
|
|
1465
1572
|
setError: (error: string | null) => void;
|
|
1466
1573
|
clearUser: () => Promise<void>;
|
|
1467
1574
|
refreshUser: (forceRefresh?: boolean) => Promise<void>;
|
|
1575
|
+
initializePublicUser: () => Promise<void>;
|
|
1576
|
+
clearPublicUser: () => void;
|
|
1468
1577
|
user: UserProfile | null;
|
|
1469
1578
|
isAuthenticated: boolean;
|
|
1470
1579
|
isLoading: boolean;
|
|
@@ -1497,6 +1606,37 @@ declare const useLogout: () => () => Promise<void>;
|
|
|
1497
1606
|
* Hook for refreshing user data
|
|
1498
1607
|
*/
|
|
1499
1608
|
declare const useRefreshUser: () => (force?: boolean) => Promise<void>;
|
|
1609
|
+
/**
|
|
1610
|
+
* Hook for executing logic within a public user session
|
|
1611
|
+
*/
|
|
1612
|
+
declare const usePublicUserSession: () => <T>(action: () => Promise<T>) => Promise<T>;
|
|
1613
|
+
/**
|
|
1614
|
+
* Export selectors for direct usage if needed
|
|
1615
|
+
*/
|
|
1616
|
+
declare const useUserSelectors: {
|
|
1617
|
+
useUser: () => UserProfile | null;
|
|
1618
|
+
useIsAuthenticated: () => boolean;
|
|
1619
|
+
useIsLoading: () => boolean;
|
|
1620
|
+
useError: () => string | null;
|
|
1621
|
+
};
|
|
1622
|
+
|
|
1623
|
+
/**
|
|
1624
|
+
* Check if user object represents a public user
|
|
1625
|
+
* If no user is provided, automatically gets current user from store
|
|
1626
|
+
*
|
|
1627
|
+
* @param user - Optional user object with email property. If not provided, gets from store
|
|
1628
|
+
* @returns true if user is a public user
|
|
1629
|
+
*
|
|
1630
|
+
* @example
|
|
1631
|
+
* // Auto-fetch from store
|
|
1632
|
+
* const isPublic = isPublicUser();
|
|
1633
|
+
*
|
|
1634
|
+
* // Pass specific user object
|
|
1635
|
+
* const isPublic = isPublicUser(someUser);
|
|
1636
|
+
*/
|
|
1637
|
+
declare const isPublicUser: (user?: {
|
|
1638
|
+
email?: string | null;
|
|
1639
|
+
} | null | undefined) => boolean;
|
|
1500
1640
|
|
|
1501
1641
|
/**
|
|
1502
1642
|
* Custom hook to manage AuthFlowModal state
|
|
@@ -1508,4 +1648,4 @@ declare const useAuthFlowModal: () => {
|
|
|
1508
1648
|
openModal: () => void;
|
|
1509
1649
|
};
|
|
1510
1650
|
|
|
1511
|
-
export { AUTH_ENDPOINTS, AlertDisplay, type AlertDisplayProps, type AnyStepProps, type ApiErrorResponse, type ApiKeyConfig, type AuthActionCallbacks, type AuthActionOptions, type AuthActionResult, type AuthActionResultFailure, type AuthActionResultSuccess, type AuthActionState, type AuthEvent, AuthEventType, AuthFlowContainer, AuthFlowModal, AuthFlowStep, AuthInitializer, AuthOrchestrator, AuthOrchestratorFactory, AuthResultFactory, AuthService, type AuthState, AuthenticatedState, type AuthenticatedStateProps, AuthenticationStatusContext, type BaseComponentProps, BaseErrorHandler, BaseEventBus, BaseForm, type BaseFormField, type BaseFormProps, type BaseResponse, BaseService, type BaseStepProps, BroadcastChannelEventBus, Channel, CookieUtils, CrossTabBehaviorConfig, CrossTabBehaviorHandler, CrossTabDemo, DevelopmentLogger, EMAIL_SUBMISSION_NAVIGATION, type EmailCheckResult, type EmailExistResponse, EmailStep, type EmailStepProps, EndpointBuilder, type EventBus, ExistingUserLoginStrategy, FormFields, type FormFieldsProps, FormHeader, type FormHeaderProps, GenericErrorHandler, HttpClient, type HttpClientConfig, type HttpError, HttpMethod, type HttpRequestOptions, type HttpResponse, type IAuthOrchestrator, type IAuthService, type IAuthStatusState, type IErrorHandler, type ILogger, type ILoginFlowStrategy, type ITokenManager, LocalStorageUtils, LoggerFactory, type LoginData, LoginFlowStrategyFactory, type LoginRequest, type LoginResponse, MiddlewareConfig, type MiddlewareContext, type MiddlewareHandler, NavigationAction, NetworkErrorHandler, NextAction, PASSWORD_SUBMISSION_NAVIGATION, PageType, PageTypePatterns, PasswordStep, type PasswordStepProps, ProductionLogger, ProfileStateRenderer, ProfileUIState, type PropsFactory, RoleType, SignupFlowStrategy, type Step, type StepComponent, type StepComponentRetriever, type StepConfig, type StepPropsFactoryRegistry, type StepRegistry, type StepRegistryBaseProps, type StepRegistryConfigs, type StepRegistryHandlers, type StepRegistryParams, type StepRegistryState, type StepperActions, type StepperState$1 as StepperState, type Subscription, TokenManager, UnauthenticatedState, UrlUtils, type UseAuthActionHandler, type UseAuthEventBusProps, type UseFormSubmissionProps, type UseStepRegistryParams, type UseStepperReturn, type UserProfile, type UserProfileResponse, type UserSession, type UserState, UserStorageManager, type UserStoreState, VERIFICATION_SUBMISSION_NAVIGATION, ValidationErrorHandler, VerificationStep, type VerificationStepProps, type VerifyEmailRequest, type VerifyEmailResponse, config, createAuthSteps, createPropsFactoryRegistry, createStepRegistry, getAuthPageStepMessage, getEmailField,
|
|
1651
|
+
export { AUTH_ENDPOINTS, AlertDisplay, type AlertDisplayProps, type AnyStepProps, type ApiErrorResponse, type ApiKeyConfig, type AuthActionCallbacks, type AuthActionOptions, type AuthActionResult, type AuthActionResultFailure, type AuthActionResultSuccess, type AuthActionState, type AuthEvent, AuthEventType, AuthFlowContainer, type AuthFlowContainerProps, AuthFlowModal, type AuthFlowModalProps, type AuthFlowProps, AuthFlowStep, AuthFlowVariant, AuthInitializer, AuthOrchestrator, AuthOrchestratorFactory, AuthResultFactory, AuthService, type AuthState, AuthenticatedState, type AuthenticatedStateProps, AuthenticationStatusContext, type BaseComponentProps, BaseErrorHandler, BaseEventBus, BaseForm, type BaseFormField, type BaseFormProps, type BaseResponse, BaseService, type BaseStepProps, BroadcastChannelEventBus, Channel, CookieUtils, CrossTabBehaviorConfig, CrossTabBehaviorHandler, CrossTabDemo, DevelopmentLogger, EMAIL_SUBMISSION_NAVIGATION, type EmailCheckResult, type EmailExistResponse, EmailStep, type EmailStepProps, EndpointBuilder, type EventBus, ExistingUserLoginStrategy, type ForgotPasswordStepProps, FormFields, type FormFieldsProps, FormHeader, type FormHeaderProps, GenericErrorHandler, HttpClient, type HttpClientConfig, type HttpError, HttpMethod, type HttpRequestOptions, type HttpResponse, type IAuthOrchestrator, type IAuthService, type IAuthStatusState, type IErrorHandler, type ILogger, type ILoginFlowStrategy, type ITokenManager, LocalStorageUtils, LoggerFactory, type LoginData, LoginFlowStrategyFactory, type LoginRequest, type LoginResponse, MiddlewareConfig, type MiddlewareContext, type MiddlewareHandler, NavigationAction, NetworkErrorHandler, NextAction, PASSWORD_SUBMISSION_NAVIGATION, PageType, PageTypePatterns, PasswordInputWithStrength, type PasswordInputWithStrengthProps, PasswordStep, type PasswordStepProps, type PasswordStrengthRule, ProductionLogger, ProfileStateRenderer, ProfileUIState, type PropsFactory, type PublicUserProfile, type PublicUserProfileResponse, RoleType, SignupFlowStrategy, type Step, type StepComponent, type StepComponentRetriever, type StepConfig, type StepPropsFactoryRegistry, type StepRegistry, type StepRegistryBaseProps, type StepRegistryConfigs, type StepRegistryHandlers, type StepRegistryParams, type StepRegistryState, type StepperActions, type StepperState$1 as StepperState, type StrengthResult, type Subscription, TokenManager, UnauthenticatedState, UrlUtils, type UseAuthActionHandler, type UseAuthEventBusProps, type UseFormSubmissionProps, type UseStepRegistryParams, type UseStepperReturn, type UserProfile, type UserProfileResponse, type UserSession, type UserState, UserStorageManager, type UserStoreState, VERIFICATION_SUBMISSION_NAVIGATION, ValidationErrorHandler, VerificationStep, type VerificationStepProps, type VerifyEmailRequest, type VerifyEmailResponse, config, createAuthSteps, createPropsFactoryRegistry, createStepRegistry, getAuthPageStepMessage, getEmailField, getForgotPasswordField, getPasswordField, getStepForEmailSubmission, getStepForPasswordSubmission, getStepForVerificationSubmission, getStepProgressMessage, getTermsCheckboxField, getVerificationField, isPublicUser, isPublicUserEmail, middlewareMatcher, useAuth, useAuthActionHandler, useAuthEventBus, useAuthFlowModal, useAuthInitializer, useIsAuthenticated, useLogout, usePublicUserSession, useRefreshUser, useSharedEventBus, useSignInRequiredParams, useStepRegistry, useStepRenderer, useStepper, useUser, useUserActions, useUserData, useUserError, useUserLoading, useUserProfile, useUserSelectors, useUserStore, userSelectors };
|