mailsentry-auth 0.2.2 → 0.2.3
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 +35 -5
- package/dist/index.d.ts +35 -5
- package/dist/index.js +202 -71
- package/dist/index.mjs +225 -94
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -66,6 +66,8 @@ interface LoginData {
|
|
|
66
66
|
tokenInfo: {
|
|
67
67
|
domain: string;
|
|
68
68
|
};
|
|
69
|
+
next_action?: NextAction;
|
|
70
|
+
loginRequest?: LoginRequest;
|
|
69
71
|
}
|
|
70
72
|
interface LoginResponse extends BaseResponse {
|
|
71
73
|
data: LoginData;
|
|
@@ -407,6 +409,21 @@ declare class UrlUtils {
|
|
|
407
409
|
static getDashboardUrl(location: Pick<Location, 'protocol' | 'hostname'>): string;
|
|
408
410
|
}
|
|
409
411
|
|
|
412
|
+
declare class EmailProviderUtils {
|
|
413
|
+
/**
|
|
414
|
+
* Detects email provider from email address
|
|
415
|
+
*/
|
|
416
|
+
static detectProvider(email: string): EmailProviderConfig | null;
|
|
417
|
+
/**
|
|
418
|
+
* Generates inbox URL for the given email
|
|
419
|
+
*/
|
|
420
|
+
static getInboxUrl(email: string, subject?: string): string | null;
|
|
421
|
+
/**
|
|
422
|
+
* Gets provider name from email
|
|
423
|
+
*/
|
|
424
|
+
static getProviderName(email: string): string | null;
|
|
425
|
+
}
|
|
426
|
+
|
|
410
427
|
/**
|
|
411
428
|
* Token Manager Implementation
|
|
412
429
|
* Handles token storage and validation using CookieUtils
|
|
@@ -770,6 +787,11 @@ declare class AuthOrchestrator implements IAuthOrchestrator {
|
|
|
770
787
|
* Handle email check to determine if user exists and what action to take
|
|
771
788
|
*/
|
|
772
789
|
handleEmailCheck(email: string): Promise<AuthActionResult<EmailExistResponse>>;
|
|
790
|
+
/**
|
|
791
|
+
* Handle login strategy based on the result of an email check.
|
|
792
|
+
* This method implements a strategy pattern to decide which login flow to execute.
|
|
793
|
+
*/
|
|
794
|
+
handleLoginStrategy(loginRequest: LoginRequest): Promise<AuthActionResult<LoginData>>;
|
|
773
795
|
/**
|
|
774
796
|
* Handle complete login flow with proper error handling and token management
|
|
775
797
|
* @param credentials - Login credentials (email and password)
|
|
@@ -965,10 +987,8 @@ interface PasswordStepProps extends BaseStepProps {
|
|
|
965
987
|
interface VerificationStepProps extends BaseStepProps {
|
|
966
988
|
email: string;
|
|
967
989
|
onSubmit: (verificationCode: string) => void | Promise<void>;
|
|
968
|
-
onBack?: () => void;
|
|
969
990
|
onResendCode?: () => void;
|
|
970
991
|
codeLength?: number;
|
|
971
|
-
showBackButton?: boolean;
|
|
972
992
|
showResendButton?: boolean;
|
|
973
993
|
}
|
|
974
994
|
|
|
@@ -1296,6 +1316,16 @@ interface MiddlewareHandler {
|
|
|
1296
1316
|
handle(context: MiddlewareContext): NextResponse | null | Promise<NextResponse | null>;
|
|
1297
1317
|
}
|
|
1298
1318
|
|
|
1319
|
+
/**
|
|
1320
|
+
* Email Provider Configuration Interface
|
|
1321
|
+
* Defines the structure for email provider configurations
|
|
1322
|
+
*/
|
|
1323
|
+
interface EmailProviderConfig {
|
|
1324
|
+
name: string;
|
|
1325
|
+
pattern: RegExp;
|
|
1326
|
+
getUrl: (email: string, subject?: string) => string;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1299
1329
|
declare const createAuthSteps: (options?: {
|
|
1300
1330
|
authIntent?: NextAction;
|
|
1301
1331
|
nextAction?: NextAction;
|
|
@@ -1304,7 +1334,7 @@ declare const getStepProgressMessage: (step: AuthFlowStep) => string;
|
|
|
1304
1334
|
declare const getAuthPageStepMessage: (step: AuthFlowStep) => string;
|
|
1305
1335
|
|
|
1306
1336
|
declare const EMAIL_SUBMISSION_NAVIGATION: {
|
|
1307
|
-
readonly "login-verification": AuthFlowStep.
|
|
1337
|
+
readonly "login-verification": AuthFlowStep.PASSWORD;
|
|
1308
1338
|
readonly login: AuthFlowStep.PASSWORD;
|
|
1309
1339
|
readonly signup: AuthFlowStep.PASSWORD;
|
|
1310
1340
|
};
|
|
@@ -1322,7 +1352,7 @@ declare const getStepForVerificationSubmission: (success: boolean) => AuthFlowSt
|
|
|
1322
1352
|
|
|
1323
1353
|
declare const getEmailField: (options?: InputProps) => BaseFormField;
|
|
1324
1354
|
declare const getPasswordField: (isLogin: boolean, disabled?: boolean, options?: PasswordProps) => BaseFormField;
|
|
1325
|
-
declare const getVerificationField: (codeLength?: number, options?: InputProps) => BaseFormField;
|
|
1355
|
+
declare const getVerificationField: (codeLength?: number, options?: InputProps, email?: string) => BaseFormField;
|
|
1326
1356
|
declare const getTermsCheckboxField: (options?: CheckboxProps) => BaseFormField;
|
|
1327
1357
|
declare const getForgotPasswordField: (options?: ButtonProps) => BaseFormField;
|
|
1328
1358
|
|
|
@@ -1692,4 +1722,4 @@ declare const useAuthFlowModal: () => {
|
|
|
1692
1722
|
openModal: () => void;
|
|
1693
1723
|
};
|
|
1694
1724
|
|
|
1695
|
-
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, LoginStrategyResolver, LoginVerificationStrategy, 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, StrategyResolutionMode, 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 };
|
|
1725
|
+
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, type EmailProviderConfig, EmailProviderUtils, 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, LoginStrategyResolver, LoginVerificationStrategy, 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, StrategyResolutionMode, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -66,6 +66,8 @@ interface LoginData {
|
|
|
66
66
|
tokenInfo: {
|
|
67
67
|
domain: string;
|
|
68
68
|
};
|
|
69
|
+
next_action?: NextAction;
|
|
70
|
+
loginRequest?: LoginRequest;
|
|
69
71
|
}
|
|
70
72
|
interface LoginResponse extends BaseResponse {
|
|
71
73
|
data: LoginData;
|
|
@@ -407,6 +409,21 @@ declare class UrlUtils {
|
|
|
407
409
|
static getDashboardUrl(location: Pick<Location, 'protocol' | 'hostname'>): string;
|
|
408
410
|
}
|
|
409
411
|
|
|
412
|
+
declare class EmailProviderUtils {
|
|
413
|
+
/**
|
|
414
|
+
* Detects email provider from email address
|
|
415
|
+
*/
|
|
416
|
+
static detectProvider(email: string): EmailProviderConfig | null;
|
|
417
|
+
/**
|
|
418
|
+
* Generates inbox URL for the given email
|
|
419
|
+
*/
|
|
420
|
+
static getInboxUrl(email: string, subject?: string): string | null;
|
|
421
|
+
/**
|
|
422
|
+
* Gets provider name from email
|
|
423
|
+
*/
|
|
424
|
+
static getProviderName(email: string): string | null;
|
|
425
|
+
}
|
|
426
|
+
|
|
410
427
|
/**
|
|
411
428
|
* Token Manager Implementation
|
|
412
429
|
* Handles token storage and validation using CookieUtils
|
|
@@ -770,6 +787,11 @@ declare class AuthOrchestrator implements IAuthOrchestrator {
|
|
|
770
787
|
* Handle email check to determine if user exists and what action to take
|
|
771
788
|
*/
|
|
772
789
|
handleEmailCheck(email: string): Promise<AuthActionResult<EmailExistResponse>>;
|
|
790
|
+
/**
|
|
791
|
+
* Handle login strategy based on the result of an email check.
|
|
792
|
+
* This method implements a strategy pattern to decide which login flow to execute.
|
|
793
|
+
*/
|
|
794
|
+
handleLoginStrategy(loginRequest: LoginRequest): Promise<AuthActionResult<LoginData>>;
|
|
773
795
|
/**
|
|
774
796
|
* Handle complete login flow with proper error handling and token management
|
|
775
797
|
* @param credentials - Login credentials (email and password)
|
|
@@ -965,10 +987,8 @@ interface PasswordStepProps extends BaseStepProps {
|
|
|
965
987
|
interface VerificationStepProps extends BaseStepProps {
|
|
966
988
|
email: string;
|
|
967
989
|
onSubmit: (verificationCode: string) => void | Promise<void>;
|
|
968
|
-
onBack?: () => void;
|
|
969
990
|
onResendCode?: () => void;
|
|
970
991
|
codeLength?: number;
|
|
971
|
-
showBackButton?: boolean;
|
|
972
992
|
showResendButton?: boolean;
|
|
973
993
|
}
|
|
974
994
|
|
|
@@ -1296,6 +1316,16 @@ interface MiddlewareHandler {
|
|
|
1296
1316
|
handle(context: MiddlewareContext): NextResponse | null | Promise<NextResponse | null>;
|
|
1297
1317
|
}
|
|
1298
1318
|
|
|
1319
|
+
/**
|
|
1320
|
+
* Email Provider Configuration Interface
|
|
1321
|
+
* Defines the structure for email provider configurations
|
|
1322
|
+
*/
|
|
1323
|
+
interface EmailProviderConfig {
|
|
1324
|
+
name: string;
|
|
1325
|
+
pattern: RegExp;
|
|
1326
|
+
getUrl: (email: string, subject?: string) => string;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1299
1329
|
declare const createAuthSteps: (options?: {
|
|
1300
1330
|
authIntent?: NextAction;
|
|
1301
1331
|
nextAction?: NextAction;
|
|
@@ -1304,7 +1334,7 @@ declare const getStepProgressMessage: (step: AuthFlowStep) => string;
|
|
|
1304
1334
|
declare const getAuthPageStepMessage: (step: AuthFlowStep) => string;
|
|
1305
1335
|
|
|
1306
1336
|
declare const EMAIL_SUBMISSION_NAVIGATION: {
|
|
1307
|
-
readonly "login-verification": AuthFlowStep.
|
|
1337
|
+
readonly "login-verification": AuthFlowStep.PASSWORD;
|
|
1308
1338
|
readonly login: AuthFlowStep.PASSWORD;
|
|
1309
1339
|
readonly signup: AuthFlowStep.PASSWORD;
|
|
1310
1340
|
};
|
|
@@ -1322,7 +1352,7 @@ declare const getStepForVerificationSubmission: (success: boolean) => AuthFlowSt
|
|
|
1322
1352
|
|
|
1323
1353
|
declare const getEmailField: (options?: InputProps) => BaseFormField;
|
|
1324
1354
|
declare const getPasswordField: (isLogin: boolean, disabled?: boolean, options?: PasswordProps) => BaseFormField;
|
|
1325
|
-
declare const getVerificationField: (codeLength?: number, options?: InputProps) => BaseFormField;
|
|
1355
|
+
declare const getVerificationField: (codeLength?: number, options?: InputProps, email?: string) => BaseFormField;
|
|
1326
1356
|
declare const getTermsCheckboxField: (options?: CheckboxProps) => BaseFormField;
|
|
1327
1357
|
declare const getForgotPasswordField: (options?: ButtonProps) => BaseFormField;
|
|
1328
1358
|
|
|
@@ -1692,4 +1722,4 @@ declare const useAuthFlowModal: () => {
|
|
|
1692
1722
|
openModal: () => void;
|
|
1693
1723
|
};
|
|
1694
1724
|
|
|
1695
|
-
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, LoginStrategyResolver, LoginVerificationStrategy, 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, StrategyResolutionMode, 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 };
|
|
1725
|
+
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, type EmailProviderConfig, EmailProviderUtils, 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, LoginStrategyResolver, LoginVerificationStrategy, 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, StrategyResolutionMode, 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 };
|
package/dist/index.js
CHANGED
|
@@ -65,11 +65,11 @@ var AuthFlowStep = /* @__PURE__ */ ((AuthFlowStep2) => {
|
|
|
65
65
|
AuthFlowStep2["FORGOT_PASSWORD"] = "forgot-password";
|
|
66
66
|
return AuthFlowStep2;
|
|
67
67
|
})(AuthFlowStep || {});
|
|
68
|
-
var NextAction = /* @__PURE__ */ ((
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return
|
|
68
|
+
var NextAction = /* @__PURE__ */ ((NextAction2) => {
|
|
69
|
+
NextAction2["LOGIN"] = "login";
|
|
70
|
+
NextAction2["SIGNUP"] = "signup";
|
|
71
|
+
NextAction2["LOGIN_VERIFICATION"] = "login-verification";
|
|
72
|
+
return NextAction2;
|
|
73
73
|
})(NextAction || {});
|
|
74
74
|
|
|
75
75
|
// src/types/auth/auth-types.ts
|
|
@@ -191,7 +191,7 @@ var getAuthPageStepMessage = (step) => {
|
|
|
191
191
|
|
|
192
192
|
// src/config/step-navigation.ts
|
|
193
193
|
var EMAIL_SUBMISSION_NAVIGATION = {
|
|
194
|
-
["login-verification" /* LOGIN_VERIFICATION */]: "
|
|
194
|
+
["login-verification" /* LOGIN_VERIFICATION */]: "password" /* PASSWORD */,
|
|
195
195
|
["login" /* LOGIN */]: "password" /* PASSWORD */,
|
|
196
196
|
["signup" /* SIGNUP */]: "password" /* PASSWORD */
|
|
197
197
|
};
|
|
@@ -216,11 +216,12 @@ var getStepForVerificationSubmission = (success) => {
|
|
|
216
216
|
|
|
217
217
|
// src/config/form-fields.tsx
|
|
218
218
|
var _antd = require('antd');
|
|
219
|
+
var _icons = require('@ant-design/icons');
|
|
219
220
|
|
|
220
221
|
// src/components/auth/password-input-with-strength.tsx
|
|
221
222
|
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
222
223
|
|
|
223
|
-
|
|
224
|
+
|
|
224
225
|
var _jsxruntime = require('react/jsx-runtime');
|
|
225
226
|
var { Text } = _antd.Typography;
|
|
226
227
|
var PASSWORD_RULES = [
|
|
@@ -565,50 +566,35 @@ var PasswordStep = ({
|
|
|
565
566
|
// src/components/auth/verification-step.tsx
|
|
566
567
|
|
|
567
568
|
|
|
568
|
-
|
|
569
569
|
var VerificationStep = ({
|
|
570
570
|
title,
|
|
571
571
|
description,
|
|
572
572
|
onSubmit,
|
|
573
|
-
onBack,
|
|
574
573
|
onResendCode,
|
|
575
574
|
submitButtonText,
|
|
576
575
|
isLoading = false,
|
|
577
576
|
codeLength = 5,
|
|
578
|
-
showBackButton = true,
|
|
579
577
|
showResendButton = true,
|
|
580
|
-
initialValues
|
|
578
|
+
initialValues,
|
|
579
|
+
email
|
|
581
580
|
}) => {
|
|
582
581
|
const handleSubmit = async (values) => {
|
|
583
582
|
await onSubmit(values.verificationCode);
|
|
584
583
|
};
|
|
585
584
|
const fields = [
|
|
586
|
-
getVerificationField(codeLength, { disabled: isLoading })
|
|
585
|
+
getVerificationField(codeLength, { disabled: isLoading }, email)
|
|
587
586
|
];
|
|
588
|
-
const additionalActions = /* @__PURE__ */ _jsxruntime.
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
),
|
|
600
|
-
showBackButton && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
601
|
-
_antd.Button,
|
|
602
|
-
{
|
|
603
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _icons.ArrowLeftOutlined, {}),
|
|
604
|
-
onClick: onBack,
|
|
605
|
-
type: "link",
|
|
606
|
-
block: true,
|
|
607
|
-
disabled: isLoading,
|
|
608
|
-
children: "Back to password"
|
|
609
|
-
}
|
|
610
|
-
)
|
|
611
|
-
] });
|
|
587
|
+
const additionalActions = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: showResendButton && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
588
|
+
_antd.Button,
|
|
589
|
+
{
|
|
590
|
+
type: "link",
|
|
591
|
+
onClick: onResendCode,
|
|
592
|
+
disabled: isLoading,
|
|
593
|
+
block: true,
|
|
594
|
+
className: "mb-2",
|
|
595
|
+
children: "Resend verification code"
|
|
596
|
+
}
|
|
597
|
+
) });
|
|
612
598
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
613
599
|
BaseForm,
|
|
614
600
|
{
|
|
@@ -696,24 +682,27 @@ var createPropsFactoryRegistry = ({
|
|
|
696
682
|
onGoogleSignIn: handlers.onGoogleSignIn,
|
|
697
683
|
onForgotPassword: handlers.onForgotPasswordClick
|
|
698
684
|
}),
|
|
699
|
-
["password" /* PASSWORD */]: () =>
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
685
|
+
["password" /* PASSWORD */]: () => {
|
|
686
|
+
const LOGIN_FLOW_ACTIONS = /* @__PURE__ */ new Set(["login" /* LOGIN */, "login-verification" /* LOGIN_VERIFICATION */]);
|
|
687
|
+
const isLoginFlow = LOGIN_FLOW_ACTIONS.has(state.authIntent);
|
|
688
|
+
return __spreadProps(__spreadValues({}, baseProps), {
|
|
689
|
+
title: isLoginFlow ? "Welcome Back" : "Create Account",
|
|
690
|
+
description: isLoginFlow ? "Please enter your password to sign in" : "Please create a password for your account",
|
|
691
|
+
submitButtonText: isLoginFlow ? "Sign In" : "Next",
|
|
692
|
+
mode: isLoginFlow ? "login" /* LOGIN */ : state.authIntent,
|
|
693
|
+
email: state.email,
|
|
694
|
+
onSubmit: handlers.handlePasswordSubmit,
|
|
695
|
+
onBack: handlers.goBackToEmail,
|
|
696
|
+
showEmailField: configs.passwordStepConfig.showEmailField,
|
|
697
|
+
initialValues: { email: state.email }
|
|
698
|
+
});
|
|
699
|
+
},
|
|
710
700
|
["verification" /* VERIFICATION */]: () => __spreadProps(__spreadValues({}, baseProps), {
|
|
711
701
|
title: "Email Verification",
|
|
712
702
|
description: `Please enter the verification code sent to ${state.email}`,
|
|
713
703
|
submitButtonText: "Verify Email",
|
|
714
704
|
email: state.email,
|
|
715
705
|
onSubmit: handlers.handleVerificationSubmit,
|
|
716
|
-
onBack: handlers.goBackToPassword,
|
|
717
706
|
onResendCode: handlers.handleResendCode,
|
|
718
707
|
codeLength: configs.verificationStepConfig.codeLength,
|
|
719
708
|
showResendButton: configs.verificationStepConfig.showResendButton
|
|
@@ -1632,6 +1621,83 @@ LocalStorageUtils.USER_PROFILE_STORAGE_KEY = "user_profile_data";
|
|
|
1632
1621
|
LocalStorageUtils.USER_PROFILE_TIMESTAMP_KEY = "user_profile_timestamp";
|
|
1633
1622
|
LocalStorageUtils.DEFAULT_CACHE_DURATION = 5 * 60 * 1e3;
|
|
1634
1623
|
|
|
1624
|
+
// src/services/utils/email-provider-utils.ts
|
|
1625
|
+
var EMAIL_PROVIDERS = [
|
|
1626
|
+
{
|
|
1627
|
+
name: "Gmail",
|
|
1628
|
+
pattern: /@gmail\.com$/i,
|
|
1629
|
+
getUrl: (email, subject) => {
|
|
1630
|
+
const searchQuery = subject ? `subject:${encodeURIComponent(subject)}+in:all` : "in:inbox";
|
|
1631
|
+
return `https://mail.google.com/mail/u/${email}/#search/${searchQuery}`;
|
|
1632
|
+
}
|
|
1633
|
+
},
|
|
1634
|
+
{
|
|
1635
|
+
name: "Outlook",
|
|
1636
|
+
pattern: /@(outlook|hotmail|live)\.com$/i,
|
|
1637
|
+
getUrl: (email, subject) => {
|
|
1638
|
+
if (subject) {
|
|
1639
|
+
return `https://outlook.live.com/mail/0/?search=subject%3A${encodeURIComponent(subject)}`;
|
|
1640
|
+
}
|
|
1641
|
+
return "https://outlook.live.com/mail/0/inbox";
|
|
1642
|
+
}
|
|
1643
|
+
},
|
|
1644
|
+
{
|
|
1645
|
+
name: "Yahoo",
|
|
1646
|
+
pattern: /@yahoo\.(com|co\.uk|ca|fr|de|it|es)$/i,
|
|
1647
|
+
getUrl: (email, subject) => {
|
|
1648
|
+
if (subject) {
|
|
1649
|
+
return `https://mail.yahoo.com/d/search/keyword=${encodeURIComponent(subject)}`;
|
|
1650
|
+
}
|
|
1651
|
+
return "https://mail.yahoo.com/d/folders/1";
|
|
1652
|
+
}
|
|
1653
|
+
},
|
|
1654
|
+
{
|
|
1655
|
+
name: "iCloud",
|
|
1656
|
+
pattern: /@(icloud|me)\.com$/i,
|
|
1657
|
+
getUrl: () => "https://www.icloud.com/mail/"
|
|
1658
|
+
},
|
|
1659
|
+
{
|
|
1660
|
+
name: "ProtonMail",
|
|
1661
|
+
pattern: /@(protonmail|proton\.me)$/i,
|
|
1662
|
+
getUrl: () => "https://mail.proton.me/u/0/inbox"
|
|
1663
|
+
},
|
|
1664
|
+
{
|
|
1665
|
+
name: "Zoho",
|
|
1666
|
+
pattern: /@zoho(mail)?\.com$/i,
|
|
1667
|
+
getUrl: () => "https://mail.zoho.com/zm/"
|
|
1668
|
+
},
|
|
1669
|
+
{
|
|
1670
|
+
name: "AOL",
|
|
1671
|
+
pattern: /@aol\.com$/i,
|
|
1672
|
+
getUrl: () => "https://mail.aol.com/webmail-std/en-us/suite"
|
|
1673
|
+
}
|
|
1674
|
+
];
|
|
1675
|
+
var EmailProviderUtils = class {
|
|
1676
|
+
/**
|
|
1677
|
+
* Detects email provider from email address
|
|
1678
|
+
*/
|
|
1679
|
+
static detectProvider(email) {
|
|
1680
|
+
if (!email) return null;
|
|
1681
|
+
const provider = EMAIL_PROVIDERS.find((p) => p.pattern.test(email));
|
|
1682
|
+
return provider || null;
|
|
1683
|
+
}
|
|
1684
|
+
/**
|
|
1685
|
+
* Generates inbox URL for the given email
|
|
1686
|
+
*/
|
|
1687
|
+
static getInboxUrl(email, subject) {
|
|
1688
|
+
const provider = this.detectProvider(email);
|
|
1689
|
+
if (!provider) return null;
|
|
1690
|
+
return provider.getUrl(email, subject);
|
|
1691
|
+
}
|
|
1692
|
+
/**
|
|
1693
|
+
* Gets provider name from email
|
|
1694
|
+
*/
|
|
1695
|
+
static getProviderName(email) {
|
|
1696
|
+
const provider = this.detectProvider(email);
|
|
1697
|
+
return (provider == null ? void 0 : provider.name) || null;
|
|
1698
|
+
}
|
|
1699
|
+
};
|
|
1700
|
+
|
|
1635
1701
|
// src/services/auth/manager/token-manager.ts
|
|
1636
1702
|
var TokenManager = class {
|
|
1637
1703
|
constructor(cookieUtils) {
|
|
@@ -2347,6 +2413,39 @@ var AuthOrchestrator = class {
|
|
|
2347
2413
|
return this.errorHandler.handle(error, "Email check");
|
|
2348
2414
|
}
|
|
2349
2415
|
}
|
|
2416
|
+
/**
|
|
2417
|
+
* Handle login strategy based on the result of an email check.
|
|
2418
|
+
* This method implements a strategy pattern to decide which login flow to execute.
|
|
2419
|
+
*/
|
|
2420
|
+
async handleLoginStrategy(loginRequest) {
|
|
2421
|
+
try {
|
|
2422
|
+
const { next_action } = await this.authService.checkEmailExists(loginRequest.email);
|
|
2423
|
+
const loginStrategies = {
|
|
2424
|
+
["login" /* LOGIN */]: () => this.handleLoginFlow(loginRequest),
|
|
2425
|
+
["signup" /* SIGNUP */]: () => this.handleLoginFlow(loginRequest),
|
|
2426
|
+
["login-verification" /* LOGIN_VERIFICATION */]: async () => {
|
|
2427
|
+
await this.handleLoginFlow(loginRequest);
|
|
2428
|
+
return AuthResultFactory.createSuccess({
|
|
2429
|
+
roleType: "",
|
|
2430
|
+
accessToken: "",
|
|
2431
|
+
refreshToken: "",
|
|
2432
|
+
isVerifiedEmail: false,
|
|
2433
|
+
profile: {},
|
|
2434
|
+
tokenInfo: { domain: "" },
|
|
2435
|
+
next_action: "login-verification" /* LOGIN_VERIFICATION */,
|
|
2436
|
+
loginRequest
|
|
2437
|
+
});
|
|
2438
|
+
}
|
|
2439
|
+
};
|
|
2440
|
+
const strategy = loginStrategies[next_action];
|
|
2441
|
+
if (strategy) {
|
|
2442
|
+
return await strategy();
|
|
2443
|
+
}
|
|
2444
|
+
throw new Error(`Unknown next action: ${next_action}`);
|
|
2445
|
+
} catch (error) {
|
|
2446
|
+
return this.errorHandler.handle(error, "Login strategy");
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2350
2449
|
/**
|
|
2351
2450
|
* Handle complete login flow with proper error handling and token management
|
|
2352
2451
|
* @param credentials - Login credentials (email and password)
|
|
@@ -3018,17 +3117,30 @@ function AuthFlowContainer({
|
|
|
3018
3117
|
await executeAction(
|
|
3019
3118
|
async () => {
|
|
3020
3119
|
const loginRequest = { email, password: passwordValue };
|
|
3021
|
-
return await authOrchestrator.
|
|
3120
|
+
return await authOrchestrator.handleLoginStrategy(loginRequest);
|
|
3022
3121
|
},
|
|
3023
3122
|
{
|
|
3024
3123
|
onSuccess: (data) => {
|
|
3124
|
+
var _a;
|
|
3025
3125
|
setAuthData(data);
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3126
|
+
const actionPipeline = [
|
|
3127
|
+
{
|
|
3128
|
+
condition: () => data.next_action === "login-verification" /* LOGIN_VERIFICATION */,
|
|
3129
|
+
execute: () => stepperActions.goToStep("verification" /* VERIFICATION */)
|
|
3130
|
+
},
|
|
3131
|
+
{
|
|
3132
|
+
condition: () => !data.isVerifiedEmail,
|
|
3133
|
+
execute: () => {
|
|
3134
|
+
const nextStep = getStepForPasswordSubmission(data.isVerifiedEmail);
|
|
3135
|
+
stepperActions.goToStep(nextStep);
|
|
3136
|
+
}
|
|
3137
|
+
},
|
|
3138
|
+
{
|
|
3139
|
+
condition: () => true,
|
|
3140
|
+
execute: () => handleSuccess()
|
|
3141
|
+
}
|
|
3142
|
+
];
|
|
3143
|
+
(_a = actionPipeline.find((action) => action.condition())) == null ? void 0 : _a.execute();
|
|
3032
3144
|
},
|
|
3033
3145
|
onError: (error) => {
|
|
3034
3146
|
console.error(error);
|
|
@@ -3475,21 +3587,39 @@ var getPasswordField = (isLogin, disabled = false, options = {}) => ({
|
|
|
3475
3587
|
] : []
|
|
3476
3588
|
]
|
|
3477
3589
|
});
|
|
3478
|
-
var getVerificationField = (codeLength = 5, options = {}) =>
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
}
|
|
3590
|
+
var getVerificationField = (codeLength = 5, options = {}, email) => {
|
|
3591
|
+
const inboxUrl = EmailProviderUtils.getInboxUrl(email != null ? email : "", "Confirm Your MailSentry Account Registration");
|
|
3592
|
+
const providerName = EmailProviderUtils.getProviderName(email != null ? email : "");
|
|
3593
|
+
const suffix = inboxUrl ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3594
|
+
_antd.Button,
|
|
3595
|
+
{
|
|
3596
|
+
type: "link",
|
|
3597
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _icons.MailOutlined, {}),
|
|
3598
|
+
href: inboxUrl,
|
|
3599
|
+
target: "_blank",
|
|
3600
|
+
rel: "noopener noreferrer",
|
|
3601
|
+
className: "!p-0 !h-auto",
|
|
3602
|
+
title: `Open ${providerName || "email"}`,
|
|
3603
|
+
children: "Check Email"
|
|
3604
|
+
}
|
|
3605
|
+
) : void 0;
|
|
3606
|
+
return {
|
|
3607
|
+
name: "verificationCode",
|
|
3608
|
+
component: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3609
|
+
_antd.Input,
|
|
3610
|
+
__spreadProps(__spreadValues({}, options), {
|
|
3611
|
+
placeholder: "Enter verification code",
|
|
3612
|
+
maxLength: codeLength,
|
|
3613
|
+
size: "large",
|
|
3614
|
+
suffix
|
|
3615
|
+
})
|
|
3616
|
+
),
|
|
3617
|
+
rules: [
|
|
3618
|
+
{ required: true, message: "Please enter the verification code!" },
|
|
3619
|
+
{ len: codeLength, message: `Verification code must be ${codeLength} characters!` }
|
|
3620
|
+
]
|
|
3621
|
+
};
|
|
3622
|
+
};
|
|
3493
3623
|
var getTermsCheckboxField = (options = {}) => ({
|
|
3494
3624
|
name: "acceptTerms",
|
|
3495
3625
|
component: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _antd.Checkbox, __spreadProps(__spreadValues({}, options), { children: "I Accept Terms and Conditions" })),
|
|
@@ -3610,7 +3740,8 @@ var getForgotPasswordField = (options = {}) => ({
|
|
|
3610
3740
|
|
|
3611
3741
|
|
|
3612
3742
|
|
|
3613
|
-
|
|
3743
|
+
|
|
3744
|
+
exports.AUTH_ENDPOINTS = AUTH_ENDPOINTS; exports.AlertDisplay = AlertDisplay; exports.AuthEventType = AuthEventType; exports.AuthFlowContainer = AuthFlowContainer; exports.AuthFlowModal = AuthFlowModal; exports.AuthFlowStep = AuthFlowStep; exports.AuthFlowVariant = AuthFlowVariant; exports.AuthInitializer = AuthInitializer; exports.AuthOrchestrator = AuthOrchestrator; exports.AuthOrchestratorFactory = AuthOrchestratorFactory; exports.AuthResultFactory = AuthResultFactory; exports.AuthService = AuthService; exports.AuthenticatedState = AuthenticatedState; exports.AuthenticationStatusContext = AuthenticationStatusContext; exports.BaseErrorHandler = BaseErrorHandler; exports.BaseEventBus = BaseEventBus; exports.BaseForm = BaseForm; exports.BaseService = BaseService; exports.BroadcastChannelEventBus = BroadcastChannelEventBus; exports.Channel = Channel; exports.CookieUtils = CookieUtils; exports.CrossTabBehaviorConfig = CrossTabBehaviorConfig; exports.CrossTabBehaviorHandler = CrossTabBehaviorHandler; exports.CrossTabDemo = CrossTabDemo; exports.DevelopmentLogger = DevelopmentLogger; exports.EMAIL_SUBMISSION_NAVIGATION = EMAIL_SUBMISSION_NAVIGATION; exports.EmailProviderUtils = EmailProviderUtils; exports.EmailStep = EmailStep; exports.EndpointBuilder = EndpointBuilder; exports.ExistingUserLoginStrategy = ExistingUserLoginStrategy; exports.FormFields = FormFields; exports.FormHeader = FormHeader; exports.GenericErrorHandler = GenericErrorHandler; exports.HttpClient = HttpClient; exports.HttpMethod = HttpMethod; exports.LocalStorageUtils = LocalStorageUtils; exports.LoggerFactory = LoggerFactory; exports.LoginFlowStrategyFactory = LoginFlowStrategyFactory; exports.LoginStrategyResolver = LoginStrategyResolver; exports.LoginVerificationStrategy = LoginVerificationStrategy; exports.MiddlewareConfig = MiddlewareConfig; exports.NavigationAction = NavigationAction; exports.NetworkErrorHandler = NetworkErrorHandler; exports.NextAction = NextAction; exports.PASSWORD_SUBMISSION_NAVIGATION = PASSWORD_SUBMISSION_NAVIGATION; exports.PageType = PageType; exports.PageTypePatterns = PageTypePatterns; exports.PasswordInputWithStrength = PasswordInputWithStrength; exports.PasswordStep = PasswordStep; exports.ProductionLogger = ProductionLogger; exports.ProfileStateRenderer = ProfileStateRenderer; exports.ProfileUIState = ProfileUIState; exports.RoleType = RoleType; exports.SignupFlowStrategy = SignupFlowStrategy; exports.StrategyResolutionMode = StrategyResolutionMode; exports.TokenManager = TokenManager; exports.UnauthenticatedState = UnauthenticatedState; exports.UrlUtils = UrlUtils; exports.UserStorageManager = UserStorageManager; exports.VERIFICATION_SUBMISSION_NAVIGATION = VERIFICATION_SUBMISSION_NAVIGATION; exports.ValidationErrorHandler = ValidationErrorHandler; exports.VerificationStep = VerificationStep; exports.config = config; exports.createAuthSteps = createAuthSteps; exports.createPropsFactoryRegistry = createPropsFactoryRegistry; exports.createStepRegistry = createStepRegistry; exports.getAuthPageStepMessage = getAuthPageStepMessage; exports.getEmailField = getEmailField; exports.getForgotPasswordField = getForgotPasswordField; exports.getPasswordField = getPasswordField; exports.getStepForEmailSubmission = getStepForEmailSubmission; exports.getStepForPasswordSubmission = getStepForPasswordSubmission; exports.getStepForVerificationSubmission = getStepForVerificationSubmission; exports.getStepProgressMessage = getStepProgressMessage; exports.getTermsCheckboxField = getTermsCheckboxField; exports.getVerificationField = getVerificationField; exports.isPublicUser = isPublicUser; exports.isPublicUserEmail = isPublicUserEmail; exports.middlewareMatcher = middlewareMatcher; exports.useAuth = useAuth; exports.useAuthActionHandler = useAuthActionHandler; exports.useAuthEventBus = useAuthEventBus; exports.useAuthFlowModal = useAuthFlowModal; exports.useAuthInitializer = useAuthInitializer; exports.useIsAuthenticated = useIsAuthenticated; exports.useLogout = useLogout; exports.usePublicUserSession = usePublicUserSession; exports.useRefreshUser = useRefreshUser; exports.useSharedEventBus = useSharedEventBus; exports.useSignInRequiredParams = useSignInRequiredParams; exports.useStepRegistry = useStepRegistry; exports.useStepRenderer = useStepRenderer; exports.useStepper = useStepper; exports.useUser = useUser; exports.useUserActions = useUserActions; exports.useUserData = useUserData; exports.useUserError = useUserError; exports.useUserLoading = useUserLoading; exports.useUserProfile = useUserProfile; exports.useUserSelectors = useUserSelectors; exports.useUserStore = useUserStore; exports.userSelectors = userSelectors;
|
|
3614
3745
|
/*! Bundled license information:
|
|
3615
3746
|
|
|
3616
3747
|
js-cookie/dist/js.cookie.mjs:
|
package/dist/index.mjs
CHANGED
|
@@ -65,11 +65,11 @@ var AuthFlowStep = /* @__PURE__ */ ((AuthFlowStep2) => {
|
|
|
65
65
|
AuthFlowStep2["FORGOT_PASSWORD"] = "forgot-password";
|
|
66
66
|
return AuthFlowStep2;
|
|
67
67
|
})(AuthFlowStep || {});
|
|
68
|
-
var NextAction = /* @__PURE__ */ ((
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return
|
|
68
|
+
var NextAction = /* @__PURE__ */ ((NextAction2) => {
|
|
69
|
+
NextAction2["LOGIN"] = "login";
|
|
70
|
+
NextAction2["SIGNUP"] = "signup";
|
|
71
|
+
NextAction2["LOGIN_VERIFICATION"] = "login-verification";
|
|
72
|
+
return NextAction2;
|
|
73
73
|
})(NextAction || {});
|
|
74
74
|
|
|
75
75
|
// src/types/auth/auth-types.ts
|
|
@@ -191,7 +191,7 @@ var getAuthPageStepMessage = (step) => {
|
|
|
191
191
|
|
|
192
192
|
// src/config/step-navigation.ts
|
|
193
193
|
var EMAIL_SUBMISSION_NAVIGATION = {
|
|
194
|
-
["login-verification" /* LOGIN_VERIFICATION */]: "
|
|
194
|
+
["login-verification" /* LOGIN_VERIFICATION */]: "password" /* PASSWORD */,
|
|
195
195
|
["login" /* LOGIN */]: "password" /* PASSWORD */,
|
|
196
196
|
["signup" /* SIGNUP */]: "password" /* PASSWORD */
|
|
197
197
|
};
|
|
@@ -216,6 +216,7 @@ var getStepForVerificationSubmission = (success) => {
|
|
|
216
216
|
|
|
217
217
|
// src/config/form-fields.tsx
|
|
218
218
|
import { Input as Input2, Checkbox, Button as Button7 } from "antd";
|
|
219
|
+
import { MailOutlined as MailOutlined2 } from "@ant-design/icons";
|
|
219
220
|
|
|
220
221
|
// src/components/auth/password-input-with-strength.tsx
|
|
221
222
|
import { useState, useEffect, useMemo } from "react";
|
|
@@ -564,51 +565,36 @@ var PasswordStep = ({
|
|
|
564
565
|
|
|
565
566
|
// src/components/auth/verification-step.tsx
|
|
566
567
|
import { Button as Button4 } from "antd";
|
|
567
|
-
import {
|
|
568
|
-
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
568
|
+
import { Fragment as Fragment3, jsx as jsx9 } from "react/jsx-runtime";
|
|
569
569
|
var VerificationStep = ({
|
|
570
570
|
title,
|
|
571
571
|
description,
|
|
572
572
|
onSubmit,
|
|
573
|
-
onBack,
|
|
574
573
|
onResendCode,
|
|
575
574
|
submitButtonText,
|
|
576
575
|
isLoading = false,
|
|
577
576
|
codeLength = 5,
|
|
578
|
-
showBackButton = true,
|
|
579
577
|
showResendButton = true,
|
|
580
|
-
initialValues
|
|
578
|
+
initialValues,
|
|
579
|
+
email
|
|
581
580
|
}) => {
|
|
582
581
|
const handleSubmit = async (values) => {
|
|
583
582
|
await onSubmit(values.verificationCode);
|
|
584
583
|
};
|
|
585
584
|
const fields = [
|
|
586
|
-
getVerificationField(codeLength, { disabled: isLoading })
|
|
585
|
+
getVerificationField(codeLength, { disabled: isLoading }, email)
|
|
587
586
|
];
|
|
588
|
-
const additionalActions = /* @__PURE__ */
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
),
|
|
600
|
-
showBackButton && /* @__PURE__ */ jsx9(
|
|
601
|
-
Button4,
|
|
602
|
-
{
|
|
603
|
-
icon: /* @__PURE__ */ jsx9(ArrowLeftOutlined2, {}),
|
|
604
|
-
onClick: onBack,
|
|
605
|
-
type: "link",
|
|
606
|
-
block: true,
|
|
607
|
-
disabled: isLoading,
|
|
608
|
-
children: "Back to password"
|
|
609
|
-
}
|
|
610
|
-
)
|
|
611
|
-
] });
|
|
587
|
+
const additionalActions = /* @__PURE__ */ jsx9(Fragment3, { children: showResendButton && /* @__PURE__ */ jsx9(
|
|
588
|
+
Button4,
|
|
589
|
+
{
|
|
590
|
+
type: "link",
|
|
591
|
+
onClick: onResendCode,
|
|
592
|
+
disabled: isLoading,
|
|
593
|
+
block: true,
|
|
594
|
+
className: "mb-2",
|
|
595
|
+
children: "Resend verification code"
|
|
596
|
+
}
|
|
597
|
+
) });
|
|
612
598
|
return /* @__PURE__ */ jsx9(
|
|
613
599
|
BaseForm,
|
|
614
600
|
{
|
|
@@ -696,24 +682,27 @@ var createPropsFactoryRegistry = ({
|
|
|
696
682
|
onGoogleSignIn: handlers.onGoogleSignIn,
|
|
697
683
|
onForgotPassword: handlers.onForgotPasswordClick
|
|
698
684
|
}),
|
|
699
|
-
["password" /* PASSWORD */]: () =>
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
685
|
+
["password" /* PASSWORD */]: () => {
|
|
686
|
+
const LOGIN_FLOW_ACTIONS = /* @__PURE__ */ new Set(["login" /* LOGIN */, "login-verification" /* LOGIN_VERIFICATION */]);
|
|
687
|
+
const isLoginFlow = LOGIN_FLOW_ACTIONS.has(state.authIntent);
|
|
688
|
+
return __spreadProps(__spreadValues({}, baseProps), {
|
|
689
|
+
title: isLoginFlow ? "Welcome Back" : "Create Account",
|
|
690
|
+
description: isLoginFlow ? "Please enter your password to sign in" : "Please create a password for your account",
|
|
691
|
+
submitButtonText: isLoginFlow ? "Sign In" : "Next",
|
|
692
|
+
mode: isLoginFlow ? "login" /* LOGIN */ : state.authIntent,
|
|
693
|
+
email: state.email,
|
|
694
|
+
onSubmit: handlers.handlePasswordSubmit,
|
|
695
|
+
onBack: handlers.goBackToEmail,
|
|
696
|
+
showEmailField: configs.passwordStepConfig.showEmailField,
|
|
697
|
+
initialValues: { email: state.email }
|
|
698
|
+
});
|
|
699
|
+
},
|
|
710
700
|
["verification" /* VERIFICATION */]: () => __spreadProps(__spreadValues({}, baseProps), {
|
|
711
701
|
title: "Email Verification",
|
|
712
702
|
description: `Please enter the verification code sent to ${state.email}`,
|
|
713
703
|
submitButtonText: "Verify Email",
|
|
714
704
|
email: state.email,
|
|
715
705
|
onSubmit: handlers.handleVerificationSubmit,
|
|
716
|
-
onBack: handlers.goBackToPassword,
|
|
717
706
|
onResendCode: handlers.handleResendCode,
|
|
718
707
|
codeLength: configs.verificationStepConfig.codeLength,
|
|
719
708
|
showResendButton: configs.verificationStepConfig.showResendButton
|
|
@@ -746,7 +735,7 @@ var useStepRenderer = () => {
|
|
|
746
735
|
// src/components/auth/auth-flow-container.tsx
|
|
747
736
|
import React3, { useState as useState5 } from "react";
|
|
748
737
|
import { Steps, Col, Button as Button5, Flex as Flex3, Row, Space as Space4 } from "antd";
|
|
749
|
-
import { ArrowLeftOutlined as
|
|
738
|
+
import { ArrowLeftOutlined as ArrowLeftOutlined2 } from "@ant-design/icons";
|
|
750
739
|
import Image from "next/image";
|
|
751
740
|
import { cva } from "class-variance-authority";
|
|
752
741
|
|
|
@@ -1632,6 +1621,83 @@ LocalStorageUtils.USER_PROFILE_STORAGE_KEY = "user_profile_data";
|
|
|
1632
1621
|
LocalStorageUtils.USER_PROFILE_TIMESTAMP_KEY = "user_profile_timestamp";
|
|
1633
1622
|
LocalStorageUtils.DEFAULT_CACHE_DURATION = 5 * 60 * 1e3;
|
|
1634
1623
|
|
|
1624
|
+
// src/services/utils/email-provider-utils.ts
|
|
1625
|
+
var EMAIL_PROVIDERS = [
|
|
1626
|
+
{
|
|
1627
|
+
name: "Gmail",
|
|
1628
|
+
pattern: /@gmail\.com$/i,
|
|
1629
|
+
getUrl: (email, subject) => {
|
|
1630
|
+
const searchQuery = subject ? `subject:${encodeURIComponent(subject)}+in:all` : "in:inbox";
|
|
1631
|
+
return `https://mail.google.com/mail/u/${email}/#search/${searchQuery}`;
|
|
1632
|
+
}
|
|
1633
|
+
},
|
|
1634
|
+
{
|
|
1635
|
+
name: "Outlook",
|
|
1636
|
+
pattern: /@(outlook|hotmail|live)\.com$/i,
|
|
1637
|
+
getUrl: (email, subject) => {
|
|
1638
|
+
if (subject) {
|
|
1639
|
+
return `https://outlook.live.com/mail/0/?search=subject%3A${encodeURIComponent(subject)}`;
|
|
1640
|
+
}
|
|
1641
|
+
return "https://outlook.live.com/mail/0/inbox";
|
|
1642
|
+
}
|
|
1643
|
+
},
|
|
1644
|
+
{
|
|
1645
|
+
name: "Yahoo",
|
|
1646
|
+
pattern: /@yahoo\.(com|co\.uk|ca|fr|de|it|es)$/i,
|
|
1647
|
+
getUrl: (email, subject) => {
|
|
1648
|
+
if (subject) {
|
|
1649
|
+
return `https://mail.yahoo.com/d/search/keyword=${encodeURIComponent(subject)}`;
|
|
1650
|
+
}
|
|
1651
|
+
return "https://mail.yahoo.com/d/folders/1";
|
|
1652
|
+
}
|
|
1653
|
+
},
|
|
1654
|
+
{
|
|
1655
|
+
name: "iCloud",
|
|
1656
|
+
pattern: /@(icloud|me)\.com$/i,
|
|
1657
|
+
getUrl: () => "https://www.icloud.com/mail/"
|
|
1658
|
+
},
|
|
1659
|
+
{
|
|
1660
|
+
name: "ProtonMail",
|
|
1661
|
+
pattern: /@(protonmail|proton\.me)$/i,
|
|
1662
|
+
getUrl: () => "https://mail.proton.me/u/0/inbox"
|
|
1663
|
+
},
|
|
1664
|
+
{
|
|
1665
|
+
name: "Zoho",
|
|
1666
|
+
pattern: /@zoho(mail)?\.com$/i,
|
|
1667
|
+
getUrl: () => "https://mail.zoho.com/zm/"
|
|
1668
|
+
},
|
|
1669
|
+
{
|
|
1670
|
+
name: "AOL",
|
|
1671
|
+
pattern: /@aol\.com$/i,
|
|
1672
|
+
getUrl: () => "https://mail.aol.com/webmail-std/en-us/suite"
|
|
1673
|
+
}
|
|
1674
|
+
];
|
|
1675
|
+
var EmailProviderUtils = class {
|
|
1676
|
+
/**
|
|
1677
|
+
* Detects email provider from email address
|
|
1678
|
+
*/
|
|
1679
|
+
static detectProvider(email) {
|
|
1680
|
+
if (!email) return null;
|
|
1681
|
+
const provider = EMAIL_PROVIDERS.find((p) => p.pattern.test(email));
|
|
1682
|
+
return provider || null;
|
|
1683
|
+
}
|
|
1684
|
+
/**
|
|
1685
|
+
* Generates inbox URL for the given email
|
|
1686
|
+
*/
|
|
1687
|
+
static getInboxUrl(email, subject) {
|
|
1688
|
+
const provider = this.detectProvider(email);
|
|
1689
|
+
if (!provider) return null;
|
|
1690
|
+
return provider.getUrl(email, subject);
|
|
1691
|
+
}
|
|
1692
|
+
/**
|
|
1693
|
+
* Gets provider name from email
|
|
1694
|
+
*/
|
|
1695
|
+
static getProviderName(email) {
|
|
1696
|
+
const provider = this.detectProvider(email);
|
|
1697
|
+
return (provider == null ? void 0 : provider.name) || null;
|
|
1698
|
+
}
|
|
1699
|
+
};
|
|
1700
|
+
|
|
1635
1701
|
// src/services/auth/manager/token-manager.ts
|
|
1636
1702
|
var TokenManager = class {
|
|
1637
1703
|
constructor(cookieUtils) {
|
|
@@ -2347,6 +2413,39 @@ var AuthOrchestrator = class {
|
|
|
2347
2413
|
return this.errorHandler.handle(error, "Email check");
|
|
2348
2414
|
}
|
|
2349
2415
|
}
|
|
2416
|
+
/**
|
|
2417
|
+
* Handle login strategy based on the result of an email check.
|
|
2418
|
+
* This method implements a strategy pattern to decide which login flow to execute.
|
|
2419
|
+
*/
|
|
2420
|
+
async handleLoginStrategy(loginRequest) {
|
|
2421
|
+
try {
|
|
2422
|
+
const { next_action } = await this.authService.checkEmailExists(loginRequest.email);
|
|
2423
|
+
const loginStrategies = {
|
|
2424
|
+
["login" /* LOGIN */]: () => this.handleLoginFlow(loginRequest),
|
|
2425
|
+
["signup" /* SIGNUP */]: () => this.handleLoginFlow(loginRequest),
|
|
2426
|
+
["login-verification" /* LOGIN_VERIFICATION */]: async () => {
|
|
2427
|
+
await this.handleLoginFlow(loginRequest);
|
|
2428
|
+
return AuthResultFactory.createSuccess({
|
|
2429
|
+
roleType: "",
|
|
2430
|
+
accessToken: "",
|
|
2431
|
+
refreshToken: "",
|
|
2432
|
+
isVerifiedEmail: false,
|
|
2433
|
+
profile: {},
|
|
2434
|
+
tokenInfo: { domain: "" },
|
|
2435
|
+
next_action: "login-verification" /* LOGIN_VERIFICATION */,
|
|
2436
|
+
loginRequest
|
|
2437
|
+
});
|
|
2438
|
+
}
|
|
2439
|
+
};
|
|
2440
|
+
const strategy = loginStrategies[next_action];
|
|
2441
|
+
if (strategy) {
|
|
2442
|
+
return await strategy();
|
|
2443
|
+
}
|
|
2444
|
+
throw new Error(`Unknown next action: ${next_action}`);
|
|
2445
|
+
} catch (error) {
|
|
2446
|
+
return this.errorHandler.handle(error, "Login strategy");
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2350
2449
|
/**
|
|
2351
2450
|
* Handle complete login flow with proper error handling and token management
|
|
2352
2451
|
* @param credentials - Login credentials (email and password)
|
|
@@ -2933,7 +3032,7 @@ var useAuthFlowModal = () => {
|
|
|
2933
3032
|
};
|
|
2934
3033
|
|
|
2935
3034
|
// src/components/auth/auth-flow-container.tsx
|
|
2936
|
-
import { jsx as jsx12, jsxs as
|
|
3035
|
+
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2937
3036
|
var containerVariants = cva("w-full h-screen p-6 overflow-hidden", {
|
|
2938
3037
|
variants: {
|
|
2939
3038
|
layout: {
|
|
@@ -3018,17 +3117,30 @@ function AuthFlowContainer({
|
|
|
3018
3117
|
await executeAction(
|
|
3019
3118
|
async () => {
|
|
3020
3119
|
const loginRequest = { email, password: passwordValue };
|
|
3021
|
-
return await authOrchestrator.
|
|
3120
|
+
return await authOrchestrator.handleLoginStrategy(loginRequest);
|
|
3022
3121
|
},
|
|
3023
3122
|
{
|
|
3024
3123
|
onSuccess: (data) => {
|
|
3124
|
+
var _a;
|
|
3025
3125
|
setAuthData(data);
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3126
|
+
const actionPipeline = [
|
|
3127
|
+
{
|
|
3128
|
+
condition: () => data.next_action === "login-verification" /* LOGIN_VERIFICATION */,
|
|
3129
|
+
execute: () => stepperActions.goToStep("verification" /* VERIFICATION */)
|
|
3130
|
+
},
|
|
3131
|
+
{
|
|
3132
|
+
condition: () => !data.isVerifiedEmail,
|
|
3133
|
+
execute: () => {
|
|
3134
|
+
const nextStep = getStepForPasswordSubmission(data.isVerifiedEmail);
|
|
3135
|
+
stepperActions.goToStep(nextStep);
|
|
3136
|
+
}
|
|
3137
|
+
},
|
|
3138
|
+
{
|
|
3139
|
+
condition: () => true,
|
|
3140
|
+
execute: () => handleSuccess()
|
|
3141
|
+
}
|
|
3142
|
+
];
|
|
3143
|
+
(_a = actionPipeline.find((action) => action.condition())) == null ? void 0 : _a.execute();
|
|
3032
3144
|
},
|
|
3033
3145
|
onError: (error) => {
|
|
3034
3146
|
console.error(error);
|
|
@@ -3174,8 +3286,8 @@ function AuthFlowContainer({
|
|
|
3174
3286
|
onClick: goBackToHome
|
|
3175
3287
|
};
|
|
3176
3288
|
}, [stepperState.currentStep, stepperActions, clearAll, goBackToHome]);
|
|
3177
|
-
return /* @__PURE__ */
|
|
3178
|
-
/* @__PURE__ */ jsx12(Col, { xs: 24, lg: showRightSideImage ? 10 : 24, className: "flex flex-col", children: /* @__PURE__ */
|
|
3289
|
+
return /* @__PURE__ */ jsxs6(Row, { className: "m-0 h-screen", children: [
|
|
3290
|
+
/* @__PURE__ */ jsx12(Col, { xs: 24, lg: showRightSideImage ? 10 : 24, className: "flex flex-col", children: /* @__PURE__ */ jsxs6(
|
|
3179
3291
|
Flex3,
|
|
3180
3292
|
{
|
|
3181
3293
|
vertical: true,
|
|
@@ -3186,12 +3298,12 @@ function AuthFlowContainer({
|
|
|
3186
3298
|
children: [
|
|
3187
3299
|
config2.showBackToHome && /* @__PURE__ */ jsx12(Flex3, { justify: "flex-start", children: /* @__PURE__ */ jsx12(Button5, { onClick: topButton.onClick, shape: "round", size: "large", type: "primary", ghost: true, children: topButton.label }) }),
|
|
3188
3300
|
/* @__PURE__ */ jsx12(Flex3, { flex: 1, justify: "center", align: "center", className: formContentVariants(), children: /* @__PURE__ */ jsx12(Space4, { direction: "vertical", className: "w-full max-w-[480px]", children: /* @__PURE__ */ jsx12(SelectedComponent, __spreadValues({}, stepProps)) }) }),
|
|
3189
|
-
/* @__PURE__ */
|
|
3301
|
+
/* @__PURE__ */ jsxs6(Flex3, { align: "center", gap: "small", className: "mt-4", children: [
|
|
3190
3302
|
/* @__PURE__ */ jsx12(
|
|
3191
3303
|
Button5,
|
|
3192
3304
|
{
|
|
3193
3305
|
type: "text",
|
|
3194
|
-
icon: /* @__PURE__ */ jsx12(
|
|
3306
|
+
icon: /* @__PURE__ */ jsx12(ArrowLeftOutlined2, {}),
|
|
3195
3307
|
onClick: handleBack,
|
|
3196
3308
|
disabled: stepperState.isFirstStep
|
|
3197
3309
|
}
|
|
@@ -3227,7 +3339,7 @@ function AuthFlowContainer({
|
|
|
3227
3339
|
|
|
3228
3340
|
// src/components/auth/auth-flow-modal.tsx
|
|
3229
3341
|
import { Modal, Spin as Spin2 } from "antd";
|
|
3230
|
-
import { Fragment as Fragment4, jsx as jsx13, jsxs as
|
|
3342
|
+
import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3231
3343
|
function AuthFlowModal({
|
|
3232
3344
|
children,
|
|
3233
3345
|
variant = "default" /* DEFAULT */,
|
|
@@ -3237,7 +3349,7 @@ function AuthFlowModal({
|
|
|
3237
3349
|
if (isInitialLoading) {
|
|
3238
3350
|
return /* @__PURE__ */ jsx13("div", { className: "min-h-screen flex items-center justify-center bg-gray-50", children: /* @__PURE__ */ jsx13(Spin2, { size: "large" }) });
|
|
3239
3351
|
}
|
|
3240
|
-
return /* @__PURE__ */
|
|
3352
|
+
return /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
3241
3353
|
isModalOpen ? /* @__PURE__ */ jsx13("div", { className: "min-h-screen flex items-center justify-center bg-gray-50", children: /* @__PURE__ */ jsx13(Spin2, { size: "large" }) }) : children,
|
|
3242
3354
|
/* @__PURE__ */ jsx13(
|
|
3243
3355
|
Modal,
|
|
@@ -3267,7 +3379,7 @@ var AuthInitializer = ({ children }) => {
|
|
|
3267
3379
|
import { useState as useState6, useEffect as useEffect6 } from "react";
|
|
3268
3380
|
import { Dropdown, Button as Button6 } from "antd";
|
|
3269
3381
|
import { MailOutlined, CrownOutlined, LogoutOutlined, UserOutlined } from "@ant-design/icons";
|
|
3270
|
-
import { jsx as jsx15, jsxs as
|
|
3382
|
+
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3271
3383
|
var DefaultUnauthenticated = () => {
|
|
3272
3384
|
const rootDomain = UrlUtils.getRootDomain(window.location.hostname);
|
|
3273
3385
|
const baseDomain = rootDomain == null ? void 0 : rootDomain.replace(/^\./, "");
|
|
@@ -3299,7 +3411,7 @@ var AuthenticatedState2 = ({ user, onLogout }) => {
|
|
|
3299
3411
|
email: {
|
|
3300
3412
|
key: "email",
|
|
3301
3413
|
icon: /* @__PURE__ */ jsx15(MailOutlined, {}),
|
|
3302
|
-
label: /* @__PURE__ */
|
|
3414
|
+
label: /* @__PURE__ */ jsxs8("div", { children: [
|
|
3303
3415
|
/* @__PURE__ */ jsx15("div", { className: "text-xs text-gray-500", children: "Email" }),
|
|
3304
3416
|
/* @__PURE__ */ jsx15("div", { className: "font-medium", children: ((_a = user.user) == null ? void 0 : _a.email) || "N/A" })
|
|
3305
3417
|
] })
|
|
@@ -3307,7 +3419,7 @@ var AuthenticatedState2 = ({ user, onLogout }) => {
|
|
|
3307
3419
|
role: {
|
|
3308
3420
|
key: "role",
|
|
3309
3421
|
icon: /* @__PURE__ */ jsx15(CrownOutlined, {}),
|
|
3310
|
-
label: /* @__PURE__ */
|
|
3422
|
+
label: /* @__PURE__ */ jsxs8("div", { children: [
|
|
3311
3423
|
/* @__PURE__ */ jsx15("div", { className: "text-xs text-gray-500", children: "Role" }),
|
|
3312
3424
|
/* @__PURE__ */ jsx15("div", { className: "font-medium", children: ((_c = (_b = user.user) == null ? void 0 : _b.role) == null ? void 0 : _c.name) || "N/A" })
|
|
3313
3425
|
] })
|
|
@@ -3364,7 +3476,7 @@ var ProfileStateRenderer = () => {
|
|
|
3364
3476
|
|
|
3365
3477
|
// src/components/demo/cross-tab-demo.tsx
|
|
3366
3478
|
import { Card, Typography as Typography3, Tag, Space as Space5 } from "antd";
|
|
3367
|
-
import { Fragment as Fragment6, jsx as jsx16, jsxs as
|
|
3479
|
+
import { Fragment as Fragment6, jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3368
3480
|
var { Title: Title2, Text: Text2, Paragraph: Paragraph2 } = Typography3;
|
|
3369
3481
|
var CrossTabDemo = () => {
|
|
3370
3482
|
var _a;
|
|
@@ -3376,31 +3488,31 @@ var CrossTabDemo = () => {
|
|
|
3376
3488
|
title: "Cross-Tab Authentication Demo",
|
|
3377
3489
|
className: "w-full max-w-2xl",
|
|
3378
3490
|
style: { marginTop: "2rem" },
|
|
3379
|
-
children: /* @__PURE__ */
|
|
3380
|
-
/* @__PURE__ */
|
|
3491
|
+
children: /* @__PURE__ */ jsxs9(Space5, { direction: "vertical", size: "middle", className: "w-full", children: [
|
|
3492
|
+
/* @__PURE__ */ jsxs9("div", { children: [
|
|
3381
3493
|
/* @__PURE__ */ jsx16(Title2, { level: 4, children: "Current Status" }),
|
|
3382
|
-
/* @__PURE__ */
|
|
3494
|
+
/* @__PURE__ */ jsxs9(Space5, { children: [
|
|
3383
3495
|
/* @__PURE__ */ jsx16(Text2, { strong: true, children: "Authentication:" }),
|
|
3384
3496
|
/* @__PURE__ */ jsx16(Tag, { color: isAuthenticated ? "green" : "red", children: isAuthenticated ? "Authenticated" : "Not Authenticated" })
|
|
3385
3497
|
] }),
|
|
3386
3498
|
/* @__PURE__ */ jsx16("br", {}),
|
|
3387
|
-
/* @__PURE__ */
|
|
3499
|
+
/* @__PURE__ */ jsxs9(Space5, { style: { marginTop: "0.5rem" }, children: [
|
|
3388
3500
|
/* @__PURE__ */ jsx16(Text2, { strong: true, children: "Current Page:" }),
|
|
3389
3501
|
/* @__PURE__ */ jsx16(Tag, { color: "blue", children: currentPageType })
|
|
3390
3502
|
] }),
|
|
3391
|
-
user && /* @__PURE__ */
|
|
3503
|
+
user && /* @__PURE__ */ jsxs9(Fragment6, { children: [
|
|
3392
3504
|
/* @__PURE__ */ jsx16("br", {}),
|
|
3393
|
-
/* @__PURE__ */
|
|
3505
|
+
/* @__PURE__ */ jsxs9(Space5, { style: { marginTop: "0.5rem" }, children: [
|
|
3394
3506
|
/* @__PURE__ */ jsx16(Text2, { strong: true, children: "User:" }),
|
|
3395
3507
|
/* @__PURE__ */ jsx16(Text2, { children: (_a = user.user) == null ? void 0 : _a.email })
|
|
3396
3508
|
] })
|
|
3397
3509
|
] })
|
|
3398
3510
|
] }),
|
|
3399
|
-
/* @__PURE__ */
|
|
3511
|
+
/* @__PURE__ */ jsxs9("div", { children: [
|
|
3400
3512
|
/* @__PURE__ */ jsx16(Title2, { level: 4, children: "How It Works" }),
|
|
3401
3513
|
/* @__PURE__ */ jsx16(Paragraph2, { children: "This application now supports enhanced cross-tab authentication handling:" }),
|
|
3402
|
-
/* @__PURE__ */
|
|
3403
|
-
/* @__PURE__ */
|
|
3514
|
+
/* @__PURE__ */ jsxs9("div", { style: { marginLeft: "1rem" }, children: [
|
|
3515
|
+
/* @__PURE__ */ jsxs9(Paragraph2, { children: [
|
|
3404
3516
|
/* @__PURE__ */ jsx16(Text2, { strong: true, children: "Login Scenario:" }),
|
|
3405
3517
|
/* @__PURE__ */ jsx16("br", {}),
|
|
3406
3518
|
"\u2022 Open multiple tabs with some on the login page and others on different pages",
|
|
@@ -3409,7 +3521,7 @@ var CrossTabDemo = () => {
|
|
|
3409
3521
|
/* @__PURE__ */ jsx16("br", {}),
|
|
3410
3522
|
"\u2022 Non-login pages will receive the login event but won't redirect (they'll just update their state)"
|
|
3411
3523
|
] }),
|
|
3412
|
-
/* @__PURE__ */
|
|
3524
|
+
/* @__PURE__ */ jsxs9(Paragraph2, { children: [
|
|
3413
3525
|
/* @__PURE__ */ jsx16(Text2, { strong: true, children: "Logout Scenario:" }),
|
|
3414
3526
|
/* @__PURE__ */ jsx16("br", {}),
|
|
3415
3527
|
"\u2022 When you log out from the dashboard, other dashboard tabs will redirect to the login page",
|
|
@@ -3418,9 +3530,9 @@ var CrossTabDemo = () => {
|
|
|
3418
3530
|
] })
|
|
3419
3531
|
] })
|
|
3420
3532
|
] }),
|
|
3421
|
-
/* @__PURE__ */
|
|
3533
|
+
/* @__PURE__ */ jsxs9("div", { children: [
|
|
3422
3534
|
/* @__PURE__ */ jsx16(Title2, { level: 4, children: "Test Instructions" }),
|
|
3423
|
-
/* @__PURE__ */
|
|
3535
|
+
/* @__PURE__ */ jsxs9(Paragraph2, { children: [
|
|
3424
3536
|
"1. Open this page in multiple browser tabs",
|
|
3425
3537
|
/* @__PURE__ */ jsx16("br", {}),
|
|
3426
3538
|
"2. Navigate to ",
|
|
@@ -3475,21 +3587,39 @@ var getPasswordField = (isLogin, disabled = false, options = {}) => ({
|
|
|
3475
3587
|
] : []
|
|
3476
3588
|
]
|
|
3477
3589
|
});
|
|
3478
|
-
var getVerificationField = (codeLength = 5, options = {}) =>
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
}
|
|
3590
|
+
var getVerificationField = (codeLength = 5, options = {}, email) => {
|
|
3591
|
+
const inboxUrl = EmailProviderUtils.getInboxUrl(email != null ? email : "", "Confirm Your MailSentry Account Registration");
|
|
3592
|
+
const providerName = EmailProviderUtils.getProviderName(email != null ? email : "");
|
|
3593
|
+
const suffix = inboxUrl ? /* @__PURE__ */ jsx17(
|
|
3594
|
+
Button7,
|
|
3595
|
+
{
|
|
3596
|
+
type: "link",
|
|
3597
|
+
icon: /* @__PURE__ */ jsx17(MailOutlined2, {}),
|
|
3598
|
+
href: inboxUrl,
|
|
3599
|
+
target: "_blank",
|
|
3600
|
+
rel: "noopener noreferrer",
|
|
3601
|
+
className: "!p-0 !h-auto",
|
|
3602
|
+
title: `Open ${providerName || "email"}`,
|
|
3603
|
+
children: "Check Email"
|
|
3604
|
+
}
|
|
3605
|
+
) : void 0;
|
|
3606
|
+
return {
|
|
3607
|
+
name: "verificationCode",
|
|
3608
|
+
component: /* @__PURE__ */ jsx17(
|
|
3609
|
+
Input2,
|
|
3610
|
+
__spreadProps(__spreadValues({}, options), {
|
|
3611
|
+
placeholder: "Enter verification code",
|
|
3612
|
+
maxLength: codeLength,
|
|
3613
|
+
size: "large",
|
|
3614
|
+
suffix
|
|
3615
|
+
})
|
|
3616
|
+
),
|
|
3617
|
+
rules: [
|
|
3618
|
+
{ required: true, message: "Please enter the verification code!" },
|
|
3619
|
+
{ len: codeLength, message: `Verification code must be ${codeLength} characters!` }
|
|
3620
|
+
]
|
|
3621
|
+
};
|
|
3622
|
+
};
|
|
3493
3623
|
var getTermsCheckboxField = (options = {}) => ({
|
|
3494
3624
|
name: "acceptTerms",
|
|
3495
3625
|
component: /* @__PURE__ */ jsx17(Checkbox, __spreadProps(__spreadValues({}, options), { children: "I Accept Terms and Conditions" })),
|
|
@@ -3535,6 +3665,7 @@ export {
|
|
|
3535
3665
|
CrossTabDemo,
|
|
3536
3666
|
DevelopmentLogger,
|
|
3537
3667
|
EMAIL_SUBMISSION_NAVIGATION,
|
|
3668
|
+
EmailProviderUtils,
|
|
3538
3669
|
EmailStep,
|
|
3539
3670
|
EndpointBuilder,
|
|
3540
3671
|
ExistingUserLoginStrategy,
|
package/package.json
CHANGED