mailsentry-auth 0.2.1 → 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 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;
@@ -209,531 +211,6 @@ interface UseFormSubmissionProps<T> {
209
211
  onError?: (error: unknown) => void;
210
212
  }
211
213
 
212
- /**
213
- * Authentication Orchestrator Interface
214
- * Follows Interface Segregation Principle (ISP)
215
- */
216
- interface IAuthOrchestrator {
217
- handleEmailCheck(email: string): Promise<AuthActionResult>;
218
- handleLoginFlow(credentials: LoginRequest): Promise<AuthActionResult>;
219
- handleGoogleLogin(token: string): Promise<AuthActionResult>;
220
- handleEmailVerification(email: string, code: string): Promise<AuthActionResult>;
221
- handleLogout(): Promise<AuthActionResult>;
222
- checkAuthenticationStatus(): Promise<AuthActionResult>;
223
- getUserProfileData(): Promise<AuthActionResult>;
224
- getMeData(): Promise<AuthActionResult>;
225
- getTokenInfo(): Promise<AuthActionResult>;
226
- }
227
-
228
- declare enum HttpMethod {
229
- GET = "GET",
230
- POST = "POST",
231
- PUT = "PUT",
232
- DELETE = "DELETE",
233
- PATCH = "PATCH"
234
- }
235
- interface ApiKeyConfig {
236
- apiKey: string;
237
- headerName?: string;
238
- }
239
- interface HttpClientConfig {
240
- baseURL: string;
241
- timeout?: number;
242
- retries?: number;
243
- apiKey?: ApiKeyConfig;
244
- apiKeys?: Record<string, string>;
245
- origin?: string;
246
- headers?: Record<string, string>;
247
- getAccessToken?: () => Promise<string | null>;
248
- }
249
- interface HttpRequestOptions {
250
- method: HttpMethod;
251
- url: string;
252
- data?: unknown;
253
- body?: unknown;
254
- headers?: Record<string, string>;
255
- timeout?: number;
256
- }
257
- interface HttpResponse<T = unknown> {
258
- data: T;
259
- status: number;
260
- statusText: string;
261
- headers: Headers;
262
- ok: boolean;
263
- }
264
- interface ApiErrorResponse {
265
- message: string;
266
- statusCode: number;
267
- error: string;
268
- digest?: string;
269
- }
270
- interface HttpError extends Error {
271
- status?: number;
272
- statusText?: string;
273
- response?: unknown;
274
- }
275
-
276
- interface FormHeaderProps {
277
- title: string;
278
- description?: string;
279
- }
280
-
281
- interface BaseFormField extends Omit<FormItemProps, 'children'> {
282
- component: React.ReactNode;
283
- }
284
- interface FormFieldsProps {
285
- fields: BaseFormField[];
286
- }
287
-
288
- interface BaseComponentProps extends FormHeaderProps {
289
- submitButtonText: string;
290
- isLoading?: boolean;
291
- initialValues?: Store;
292
- }
293
- type BaseStepProps = BaseComponentProps;
294
- interface BaseFormProps<T = Record<string, unknown>> extends BaseComponentProps, FormFieldsProps {
295
- onSubmit: (values: T) => void | Promise<void>;
296
- form?: FormInstance;
297
- additionalActions?: React.ReactNode;
298
- }
299
-
300
- interface GoogleSignInActionsProps {
301
- onGoogleSignIn?: (token: string) => void;
302
- isLoading?: boolean;
303
- }
304
-
305
- interface EmailStepProps extends BaseStepProps, GoogleSignInActionsProps {
306
- onSubmit: (email: string) => void | Promise<void>;
307
- onForgotPassword?: () => void;
308
- }
309
-
310
- interface PasswordStepProps extends BaseStepProps {
311
- mode: NextAction;
312
- email: string;
313
- onSubmit: (password: string) => void | Promise<void>;
314
- onBack?: () => void;
315
- showEmailField?: boolean;
316
- showBackButton?: boolean;
317
- }
318
-
319
- interface VerificationStepProps extends BaseStepProps {
320
- email: string;
321
- onSubmit: (verificationCode: string) => void | Promise<void>;
322
- onBack?: () => void;
323
- onResendCode?: () => void;
324
- codeLength?: number;
325
- showBackButton?: boolean;
326
- showResendButton?: boolean;
327
- }
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
-
347
- declare enum ProfileUIState {
348
- LOADING = "LOADING",
349
- UNAUTHENTICATED = "UNAUTHENTICATED",
350
- AUTHENTICATED = "AUTHENTICATED"
351
- }
352
- interface AuthenticatedStateProps {
353
- user: UserProfile;
354
- onLogout: () => void;
355
- }
356
-
357
- interface Step<T = string> {
358
- id: T;
359
- title: string;
360
- description: string;
361
- icon?: ReactNode;
362
- disabled?: boolean;
363
- }
364
- interface StepConfig<T = string> {
365
- steps: Step<T>[];
366
- initialStep?: T;
367
- }
368
- interface StepperState$1<T = string> {
369
- currentStep: T;
370
- currentStepIndex: number;
371
- steps: Step<T>[];
372
- isFirstStep: boolean;
373
- isLastStep: boolean;
374
- progress: number;
375
- }
376
- interface StepperActions<T = string> {
377
- goToStep: (step: T) => void;
378
- goToNext: () => void;
379
- goToPrevious: () => void;
380
- goToIndex: (index: number) => void;
381
- reset: () => void;
382
- }
383
- interface UseStepperReturn<T = string> {
384
- state: StepperState$1<T>;
385
- actions: StepperActions<T>;
386
- helpers: {
387
- getStepIndex: (step: T) => number;
388
- getStepByIndex: (index: number) => Step<T> | undefined;
389
- isStepValid: (step: T) => boolean;
390
- getProgressPercentage: () => number;
391
- };
392
- }
393
-
394
- type StepRegistryBaseProps = Omit<BaseStepProps, 'title' | 'description' | 'submitButtonText'>;
395
- interface StepRegistryParams {
396
- baseProps: StepRegistryBaseProps;
397
- handlers: StepRegistryHandlers;
398
- state: StepRegistryState;
399
- configs: StepRegistryConfigs;
400
- }
401
- interface UseStepRegistryParams extends StepRegistryParams {
402
- getStepComponent: (step: AuthFlowStep) => StepComponent | null;
403
- stepperState: StepperState;
404
- }
405
- interface StepRegistryHandlers {
406
- handleEmailSubmit: (email: string) => Promise<void>;
407
- handlePasswordSubmit: (password: string) => Promise<void>;
408
- handleVerificationSubmit: (code: string) => Promise<void>;
409
- handleResendCode: () => void;
410
- goBackToEmail: () => void;
411
- goBackToPassword: () => void;
412
- onGoogleSignIn?: (token: string) => void;
413
- handleForgotPassword?: (email: string) => Promise<void>;
414
- onForgotPasswordClick?: () => void;
415
- }
416
- interface StepRegistryState {
417
- email: string;
418
- authIntent: NextAction;
419
- authData: unknown;
420
- }
421
- interface StepRegistryConfigs {
422
- emailStepConfig: Record<string, unknown>;
423
- passwordStepConfig: Record<string, unknown>;
424
- verificationStepConfig: Record<string, unknown>;
425
- }
426
- interface StepperState {
427
- currentStep: AuthFlowStep;
428
- }
429
- type StepComponentRetriever = (step: AuthFlowStep) => StepComponent | null;
430
- type AnyStepProps = EmailStepProps | PasswordStepProps | VerificationStepProps | ForgotPasswordStepProps;
431
- type StepComponent = React__default.ComponentType<AnyStepProps>;
432
- type StepRegistry = Record<AuthFlowStep, StepComponent>;
433
- type PropsFactory = () => AnyStepProps;
434
- type StepPropsFactoryRegistry = Record<AuthFlowStep, PropsFactory>;
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
-
455
- /**
456
- * Enum for user roles
457
- */
458
- declare enum RoleType {
459
- USER = "USER",
460
- ADMIN = "ADMIN"
461
- }
462
- type AuthState = {
463
- isAuthenticated: boolean;
464
- isLoading: boolean;
465
- error: string | null;
466
- user: Record<string, unknown> | null;
467
- tokens: {
468
- accessToken: string | null;
469
- refreshToken: string | null;
470
- };
471
- };
472
- type EmailCheckResult = {
473
- exists: boolean;
474
- nextAction: NextAction;
475
- message: string;
476
- };
477
- type UserSession = {
478
- user: {
479
- id: string;
480
- email: string;
481
- firstName: string;
482
- lastName: string;
483
- role: RoleType;
484
- };
485
- tokens: {
486
- accessToken: string;
487
- refreshToken: string;
488
- };
489
- expiresAt: number;
490
- };
491
- type UserState = {
492
- user: UserProfile | null;
493
- isLoading: boolean;
494
- error: string | null;
495
- isAuthenticated: boolean;
496
- };
497
-
498
- /**
499
- * Token Management Interface
500
- * Follows Single Responsibility Principle (SRP)
501
- * Updated to support async operations for SSR compatibility
502
- */
503
- interface ITokenManager {
504
- saveTokens(accessToken: string, refreshToken?: string): void;
505
- clearTokens(): void;
506
- getAccessToken(): Promise<string | null>;
507
- getRefreshToken(): Promise<string | null>;
508
- getAllTokens(): Promise<Record<string, string>>;
509
- areCookiesSupported(): boolean;
510
- getDomainInfo(): Record<string, string>;
511
- }
512
-
513
- /**
514
- * Strategy Pattern: Login Flow Strategy Interface
515
- */
516
- interface ILoginFlowStrategy {
517
- execute(credentials: LoginRequest): Promise<AuthActionResult<LoginData>>;
518
- }
519
-
520
- /**
521
- * State Pattern: Authentication Status State Interface
522
- */
523
- interface IAuthStatusState {
524
- getStatus(tokenManager: ITokenManager): Promise<AuthActionResult>;
525
- }
526
-
527
- /**
528
- * Chain of Responsibility: Error Handler Interface
529
- */
530
- interface IErrorHandler {
531
- setNext(handler: IErrorHandler): IErrorHandler;
532
- handle(error: unknown, context: string): AuthActionResult;
533
- }
534
-
535
- /**
536
- * Lookup Pattern: Logger Interface
537
- */
538
- interface ILogger {
539
- log(message: string, data?: unknown): void;
540
- warn(message: string, data?: unknown): void;
541
- error(message: string, data?: unknown): void;
542
- }
543
-
544
- interface Subscription {
545
- unsubscribe(): void;
546
- }
547
- interface EventBus<TEvent = unknown> {
548
- publish(event: TEvent): void;
549
- subscribe(handler: (event: TEvent) => void): Subscription;
550
- }
551
- declare abstract class BaseEventBus {
552
- }
553
-
554
- declare enum AuthEventType {
555
- LoggedIn = "auth.logged_in",
556
- LoggedOut = "auth.logged_out",
557
- EmailVerified = "auth.email_verified",
558
- SignInRequiredModal = "auth.signin_required_modal"
559
- }
560
- type AuthEvent = {
561
- type: AuthEventType.LoggedIn;
562
- userId: string;
563
- sourcePageType?: PageType;
564
- } | {
565
- type: AuthEventType.LoggedOut;
566
- sourcePageType?: PageType;
567
- } | {
568
- type: AuthEventType.EmailVerified;
569
- email: string;
570
- sourcePageType?: PageType;
571
- } | {
572
- type: AuthEventType.SignInRequiredModal;
573
- sourcePageType?: PageType;
574
- };
575
- declare enum PageType {
576
- LOGIN = "/login",
577
- DASHBOARD = "dashboard",
578
- HOME = "/"
579
- }
580
- declare enum NavigationAction {
581
- NONE = "none",
582
- RELOAD = "reload"
583
- }
584
- declare const PageTypePatterns: {
585
- readonly "/login": PageType.LOGIN;
586
- readonly dashboard: PageType.DASHBOARD;
587
- readonly "/": PageType.HOME;
588
- };
589
- declare const CrossTabBehaviorConfig: {
590
- readonly "/login": {
591
- readonly "auth.logged_in": {
592
- readonly action: NavigationAction.NONE;
593
- };
594
- readonly "auth.logged_out": {
595
- readonly action: NavigationAction.NONE;
596
- };
597
- readonly "auth.email_verified": {
598
- readonly action: NavigationAction.NONE;
599
- };
600
- readonly "auth.signin_required_modal": {
601
- readonly action: NavigationAction.NONE;
602
- };
603
- };
604
- readonly dashboard: {
605
- readonly "auth.logged_in": {
606
- readonly action: NavigationAction.RELOAD;
607
- };
608
- readonly "auth.logged_out": {
609
- readonly action: NavigationAction.RELOAD;
610
- };
611
- readonly "auth.email_verified": {
612
- readonly action: NavigationAction.RELOAD;
613
- };
614
- readonly "auth.signin_required_modal": {
615
- readonly action: NavigationAction.NONE;
616
- };
617
- };
618
- readonly "/": {
619
- readonly "auth.logged_in": {
620
- readonly action: NavigationAction.NONE;
621
- };
622
- readonly "auth.logged_out": {
623
- readonly action: NavigationAction.NONE;
624
- };
625
- readonly "auth.email_verified": {
626
- readonly action: NavigationAction.NONE;
627
- };
628
- readonly "auth.signin_required_modal": {
629
- readonly action: NavigationAction.NONE;
630
- };
631
- };
632
- };
633
-
634
- /**
635
- * Middleware request context containing all necessary data
636
- */
637
- interface MiddlewareContext {
638
- request: NextRequest;
639
- method: string;
640
- pathname: string;
641
- searchParams: URLSearchParams;
642
- cookies: NextRequest['cookies'];
643
- nextUrl: URL;
644
- hostname: string;
645
- }
646
- /**
647
- * Base interface for middleware handlers
648
- */
649
- interface MiddlewareHandler {
650
- handle(context: MiddlewareContext): NextResponse | null | Promise<NextResponse | null>;
651
- }
652
-
653
- declare enum Channel {
654
- AUTH = "auth-event-channel"
655
- }
656
-
657
- declare const createAuthSteps: (options?: {
658
- authIntent?: NextAction;
659
- nextAction?: NextAction;
660
- }) => Step<AuthFlowStep>[];
661
- declare const getStepProgressMessage: (step: AuthFlowStep) => string;
662
- declare const getAuthPageStepMessage: (step: AuthFlowStep) => string;
663
-
664
- declare const EMAIL_SUBMISSION_NAVIGATION: {
665
- readonly "login-verification": AuthFlowStep.VERIFICATION;
666
- readonly login: AuthFlowStep.PASSWORD;
667
- readonly signup: AuthFlowStep.PASSWORD;
668
- };
669
- declare const PASSWORD_SUBMISSION_NAVIGATION: {
670
- readonly VERIFIED: AuthFlowStep.VERIFICATION;
671
- readonly UNVERIFIED: AuthFlowStep.VERIFICATION;
672
- };
673
- declare const VERIFICATION_SUBMISSION_NAVIGATION: {
674
- readonly SUCCESS: AuthFlowStep.VERIFICATION;
675
- readonly ERROR: AuthFlowStep.VERIFICATION;
676
- };
677
- declare const getStepForEmailSubmission: (nextAction: NextAction) => AuthFlowStep;
678
- declare const getStepForPasswordSubmission: (isVerified: boolean) => AuthFlowStep;
679
- declare const getStepForVerificationSubmission: (success: boolean) => AuthFlowStep;
680
-
681
- declare const getEmailField: (options?: InputProps) => BaseFormField;
682
- declare const getPasswordField: (isLogin: boolean, disabled?: boolean, options?: PasswordProps) => BaseFormField;
683
- declare const getVerificationField: (codeLength?: number, options?: InputProps) => BaseFormField;
684
- declare const getTermsCheckboxField: (options?: CheckboxProps) => BaseFormField;
685
- declare const getForgotPasswordField: (options?: ButtonProps) => BaseFormField;
686
-
687
- /**
688
- * Middleware configuration constants for routing and protection
689
- */
690
- declare class MiddlewareConfig {
691
- static readonly CONSTANTS: {
692
- readonly LOGIN_PATH: "/login";
693
- readonly DASHBOARD_SUBDOMAIN: "dashboard";
694
- readonly PUBLIC_PATH: "/public";
695
- readonly PUBLIC_API_PATH: "/api/public";
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[];
702
- static readonly PROTECTED_ROUTES: {
703
- INCLUDE: string[];
704
- EXCLUDE: string[];
705
- };
706
- static readonly ALLOWED_METHODS: readonly ["GET", "HEAD"];
707
- static readonly QUERY_PARAMS: {
708
- readonly LOGIN_REQUIRED: "sign_in_required";
709
- readonly AUTH_CHECKED: "auth_checked";
710
- readonly REDIRECT_URL: "redirect_url";
711
- };
712
- static readonly QUERY_VALUES: {
713
- readonly LOGIN_REQUIRED: "true";
714
- readonly AUTH_CHECKED: "1";
715
- };
716
- /**
717
- * Get the base domain from environment or use default
718
- */
719
- static getBaseDomain(): string;
720
- /**
721
- * Get the protocol based on environment
722
- */
723
- static getProtocol(): string;
724
- }
725
- /**
726
- * Middleware matcher patterns
727
- * Matches all routes except API routes, Next.js internals, and static assets
728
- */
729
- declare const middlewareMatcher: readonly ["/((?!api|_next/static|_next/image|_next/webpack-hmr|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|css|js)$).*)"];
730
- /**
731
- * Middleware configuration
732
- */
733
- declare const config: {
734
- matcher: readonly ["/((?!api|_next/static|_next/image|_next/webpack-hmr|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|css|js)$).*)"];
735
- };
736
-
737
214
  /**
738
215
  * Cookie utility for managing authentication tokens with automatic SSR and client-side support
739
216
  * Automatically chooses the right method based on environment
@@ -848,6 +325,10 @@ declare class LocalStorageUtils {
848
325
  static isCacheValid(cacheDuration?: number): boolean;
849
326
  }
850
327
 
328
+ declare enum Channel {
329
+ AUTH = "auth-event-channel"
330
+ }
331
+
851
332
  type Handler<T> = (e: T) => void;
852
333
  declare class BroadcastChannelEventBus<TEvent> {
853
334
  private channel?;
@@ -904,433 +385,1026 @@ declare class CrossTabBehaviorHandler {
904
385
  }
905
386
 
906
387
  /**
907
- * URL utility functions
388
+ * URL utility functions
389
+ */
390
+ declare class UrlUtils {
391
+ /**
392
+ * Extract subdomain from hostname
393
+ * Example: "dashboard.cutly.io" -> "dashboard"
394
+ */
395
+ static getSubdomain(hostname: string): string | null;
396
+ /**
397
+ * Get root domain for cookie scope
398
+ * Example: "dashboard.cutly.io" -> ".cutly.io"
399
+ * Example: "cutly.io" -> ".cutly.io"
400
+ */
401
+ static getRootDomain(hostname: string): string | null;
402
+ /**
403
+ * Check if URL has auth-related query parameters
404
+ */
405
+ static hasAuthParams(url: string): boolean;
406
+ /**
407
+ * Get the dashboard URL for the current environment
408
+ */
409
+ static getDashboardUrl(location: Pick<Location, 'protocol' | 'hostname'>): string;
410
+ }
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
+
427
+ /**
428
+ * Token Manager Implementation
429
+ * Handles token storage and validation using CookieUtils
430
+ * Updated to support async operations for SSR compatibility
431
+ */
432
+ declare class TokenManager implements ITokenManager {
433
+ private cookieUtils;
434
+ constructor(cookieUtils: typeof CookieUtils);
435
+ saveTokens(accessToken: string, refreshToken?: string): void;
436
+ clearTokens(): void;
437
+ getAccessToken(): Promise<string | null>;
438
+ getRefreshToken(): Promise<string | null>;
439
+ /**
440
+ * Get all stored tokens for debugging or validation
441
+ */
442
+ getAllTokens(): Promise<Record<string, string>>;
443
+ /**
444
+ * Check if cookies are supported in the current environment
445
+ */
446
+ areCookiesSupported(): boolean;
447
+ /**
448
+ * Get domain information for debugging
449
+ */
450
+ getDomainInfo(): Record<string, string>;
451
+ }
452
+
453
+ /**
454
+ * HTTP Client with better error handling
455
+ */
456
+ declare class HttpClient {
457
+ private config;
458
+ constructor(config: HttpClientConfig);
459
+ /**
460
+ * Execute HTTP request
461
+ */
462
+ request<T>(endpoint: string, options: HttpRequestOptions): Promise<HttpResponse<T>>;
463
+ /**
464
+ * Build headers with defaults including multiple API keys and Bearer token
465
+ */
466
+ private buildHeaders;
467
+ /**
468
+ * Execute request with timeout
469
+ */
470
+ private executeWithTimeout;
471
+ }
472
+ /**
473
+ * Base Service with dependency injection and better separation of concerns
474
+ */
475
+ declare abstract class BaseService {
476
+ protected httpClient: HttpClient;
477
+ protected tokenManager: TokenManager;
478
+ constructor(httpClient?: HttpClient, tokenManager?: TokenManager);
479
+ /**
480
+ * Create default HTTP client with configuration
481
+ */
482
+ private createDefaultHttpClient;
483
+ /**
484
+ * Handle HTTP response and throw structured error if needed
485
+ */
486
+ private handleResponse;
487
+ /**
488
+ * Create API error from HTTP response following Single Responsibility Principle
489
+ */
490
+ private createApiErrorFromResponse;
491
+ /**
492
+ * Try to parse API error response from response data
493
+ */
494
+ private tryParseApiErrorResponse;
495
+ /**
496
+ * Check if response data has valid API error structure
497
+ */
498
+ private isValidApiErrorResponse;
499
+ /**
500
+ * Create generic API error as fallback
501
+ */
502
+ private createGenericApiError;
503
+ /**
504
+ * GET request
505
+ */
506
+ protected get<T>(endpoint: string, headers?: Record<string, string>): Promise<T>;
507
+ /**
508
+ * POST request
509
+ */
510
+ protected post<T>(endpoint: string, body?: unknown, headers?: Record<string, string>): Promise<T>;
511
+ /**
512
+ * PUT request
513
+ */
514
+ protected put<T>(endpoint: string, body?: unknown, headers?: Record<string, string>): Promise<T>;
515
+ /**
516
+ * DELETE request
517
+ */
518
+ protected delete<T>(endpoint: string, headers?: Record<string, string>): Promise<T>;
519
+ /**
520
+ * PATCH request
521
+ */
522
+ protected patch<T>(endpoint: string, body?: unknown, headers?: Record<string, string>): Promise<T>;
523
+ }
524
+
525
+ /**
526
+ * Authentication Service
527
+ * Handles all authentication-related operations with clean separation of concerns
908
528
  */
909
- declare class UrlUtils {
529
+ declare class AuthService extends BaseService implements IAuthService {
910
530
  /**
911
- * Extract subdomain from hostname
912
- * Example: "dashboard.cutly.io" -> "dashboard"
531
+ * Check if an email exists in the system
913
532
  */
914
- static getSubdomain(hostname: string): string | null;
533
+ checkEmailExists(email: string): Promise<EmailExistResponse>;
915
534
  /**
916
- * Get root domain for cookie scope
917
- * Example: "dashboard.cutly.io" -> ".cutly.io"
918
- * Example: "cutly.io" -> ".cutly.io"
535
+ * Login with email and password
919
536
  */
920
- static getRootDomain(hostname: string): string | null;
537
+ login(credentials: LoginRequest): Promise<LoginResponse>;
921
538
  /**
922
- * Check if URL has auth-related query parameters
539
+ * Login with Google
923
540
  */
924
- static hasAuthParams(url: string): boolean;
541
+ loginWithGoogle(token: string): Promise<LoginResponse>;
925
542
  /**
926
- * Get the dashboard URL for the current environment
543
+ * Verify email with verification code
927
544
  */
928
- static getDashboardUrl(location: Pick<Location, 'protocol' | 'hostname'>): string;
929
- }
930
-
931
- /**
932
- * Token Manager Implementation
933
- * Handles token storage and validation using CookieUtils
934
- * Updated to support async operations for SSR compatibility
935
- */
936
- declare class TokenManager implements ITokenManager {
937
- private cookieUtils;
938
- constructor(cookieUtils: typeof CookieUtils);
939
- saveTokens(accessToken: string, refreshToken?: string): void;
940
- clearTokens(): void;
941
- getAccessToken(): Promise<string | null>;
942
- getRefreshToken(): Promise<string | null>;
545
+ verifyEmail(verification: VerifyEmailRequest): Promise<VerifyEmailResponse>;
943
546
  /**
944
- * Get all stored tokens for debugging or validation
547
+ * Get user profile
945
548
  */
946
- getAllTokens(): Promise<Record<string, string>>;
549
+ getUserProfile(): Promise<UserProfileResponse>;
947
550
  /**
948
- * Check if cookies are supported in the current environment
551
+ * Get public user profile (me)
949
552
  */
950
- areCookiesSupported(): boolean;
553
+ getMe(): Promise<PublicUserProfileResponse>;
951
554
  /**
952
- * Get domain information for debugging
555
+ * Logout user
953
556
  */
954
- getDomainInfo(): Record<string, string>;
557
+ logout(): Promise<void>;
955
558
  }
956
559
 
957
560
  /**
958
- * HTTP Client with better error handling
561
+ * Authentication API endpoints
959
562
  */
960
- declare class HttpClient {
961
- private config;
962
- constructor(config: HttpClientConfig);
563
+ declare const AUTH_ENDPOINTS: {
564
+ readonly CHECK_EMAIL_EXISTS: (email: string) => string;
565
+ readonly LOGIN: "/auth/user/login";
566
+ readonly LOGIN_GOOGLE: "/auth/user/login/google";
567
+ readonly VERIFY_EMAIL: "/auth/user/verify";
568
+ readonly GET_USER_PROFILE: "/auth/user/profile";
569
+ readonly GET_ME: "/auth/user/me";
570
+ readonly LOGOUT: "/auth/logout";
571
+ };
572
+ /**
573
+ * Endpoint builder utility
574
+ */
575
+ declare class EndpointBuilder {
576
+ static auth: {
577
+ readonly CHECK_EMAIL_EXISTS: (email: string) => string;
578
+ readonly LOGIN: "/auth/user/login";
579
+ readonly LOGIN_GOOGLE: "/auth/user/login/google";
580
+ readonly VERIFY_EMAIL: "/auth/user/verify";
581
+ readonly GET_USER_PROFILE: "/auth/user/profile";
582
+ readonly GET_ME: "/auth/user/me";
583
+ readonly LOGOUT: "/auth/logout";
584
+ };
585
+ }
586
+
587
+ /**
588
+ * Strategy Pattern: Signup Flow Strategy
589
+ */
590
+ declare class SignupFlowStrategy implements ILoginFlowStrategy {
591
+ private authService;
592
+ private tokenManager;
593
+ constructor(authService: AuthService, tokenManager: ITokenManager);
594
+ execute(credentials: LoginRequest): Promise<AuthActionResult<LoginData>>;
595
+ private handleSuccessfulAuthentication;
596
+ }
597
+
598
+ /**
599
+ * Strategy Pattern: Existing User Login Strategy
600
+ */
601
+ declare class ExistingUserLoginStrategy implements ILoginFlowStrategy {
602
+ private authService;
603
+ private tokenManager;
604
+ constructor(authService: AuthService, tokenManager: ITokenManager);
605
+ execute(credentials: LoginRequest): Promise<AuthActionResult<LoginData>>;
606
+ private handleSuccessfulAuthentication;
607
+ }
608
+
609
+ /**
610
+ * Strategy Pattern: Login Verification Strategy
611
+ * Handles the case when user needs to verify their email before logging in
612
+ * API returns next_action: "login-verification"
613
+ */
614
+ declare class LoginVerificationStrategy implements ILoginFlowStrategy {
615
+ private authService;
616
+ private tokenManager;
617
+ constructor(authService: AuthService, tokenManager: ITokenManager);
618
+ execute(credentials: LoginRequest): Promise<AuthActionResult<LoginData>>;
619
+ }
620
+
621
+ /**
622
+ * Strategy Pattern: Login Flow Strategy Factory
623
+ */
624
+ declare class LoginFlowStrategyFactory {
625
+ private static strategies;
626
+ static createStrategy(action: NextAction, authService: AuthService, tokenManager: ITokenManager): ILoginFlowStrategy;
627
+ }
628
+
629
+ /**
630
+ * Strategy Pattern: Login Strategy Resolution
631
+ * Uses Command Pattern to eliminate conditionals
632
+ */
633
+ /**
634
+ * Enum: Strategy resolution modes
635
+ * Easily extendable for new resolution strategies
636
+ */
637
+ declare enum StrategyResolutionMode {
638
+ SKIP_EMAIL_CHECK = "SKIP_EMAIL_CHECK",
639
+ CHECK_EMAIL_EXISTS = "CHECK_EMAIL_EXISTS"
640
+ }
641
+ interface IStrategyCommand {
642
+ execute(email: string): Promise<NextAction>;
643
+ }
644
+ /**
645
+ * Strategy Resolver: Eliminates conditionals using Command Pattern
646
+ * Easy to extend with new strategies without modifying existing code
647
+ */
648
+ declare class LoginStrategyResolver {
649
+ private readonly strategies;
650
+ constructor(authService: AuthService);
651
+ resolve(email: string, mode: StrategyResolutionMode): Promise<NextAction>;
963
652
  /**
964
- * Execute HTTP request
653
+ * Extend resolver with new strategies at runtime
654
+ * Example: resolver.registerStrategy(StrategyResolutionMode.CUSTOM, customCommand)
965
655
  */
966
- request<T>(endpoint: string, options: HttpRequestOptions): Promise<HttpResponse<T>>;
656
+ registerStrategy(mode: StrategyResolutionMode, command: IStrategyCommand): void;
657
+ }
658
+
659
+ /**
660
+ * State Pattern: Authenticated State
661
+ */
662
+ declare class AuthenticatedState implements IAuthStatusState {
663
+ getStatus(tokenManager: ITokenManager): Promise<AuthActionResultSuccess<{
664
+ isAuthenticated: boolean;
665
+ hasAccessToken: boolean;
666
+ hasRefreshToken: boolean;
667
+ cookiesSupported: boolean;
668
+ domainInfo: Record<string, string>;
669
+ }>>;
670
+ private buildAuthStatus;
671
+ }
672
+
673
+ /**
674
+ * State Pattern: Unauthenticated State
675
+ */
676
+ declare class UnauthenticatedState implements IAuthStatusState {
677
+ getStatus(tokenManager: ITokenManager): Promise<AuthActionResultFailure>;
678
+ private buildAuthStatus;
679
+ }
680
+
681
+ /**
682
+ * State Pattern: Authentication Status Context
683
+ */
684
+ declare class AuthenticationStatusContext {
685
+ private static states;
686
+ static getStatus(tokenManager: ITokenManager): Promise<AuthActionResult>;
687
+ }
688
+
689
+ /**
690
+ * Command Pattern: Result Creation Commands
691
+ * Follows Single Responsibility Principle - only responsible for creating AuthResult objects
692
+ */
693
+ declare class AuthResultFactory {
967
694
  /**
968
- * Build headers with defaults including multiple API keys and Bearer token
695
+ * Creates a successful authentication result
969
696
  */
970
- private buildHeaders;
697
+ static createSuccess<T = unknown>(data: T): AuthActionResultSuccess<T>;
971
698
  /**
972
- * Execute request with timeout
699
+ * Creates a failed authentication result
973
700
  */
974
- private executeWithTimeout;
701
+ static createFailure(error?: string | Error | unknown): AuthActionResultFailure;
975
702
  }
703
+
976
704
  /**
977
- * Base Service with dependency injection and better separation of concerns
705
+ * Chain of Responsibility: Base Error Handler
978
706
  */
979
- declare abstract class BaseService {
980
- protected httpClient: HttpClient;
981
- protected tokenManager: TokenManager;
982
- constructor(httpClient?: HttpClient, tokenManager?: TokenManager);
707
+ declare abstract class BaseErrorHandler implements IErrorHandler {
708
+ private nextHandler?;
709
+ setNext(handler: IErrorHandler): IErrorHandler;
710
+ handle(error: unknown, context: string): AuthActionResult;
711
+ protected abstract canHandle(error: unknown): boolean;
712
+ protected abstract handleError(error: unknown, context: string): AuthActionResult;
713
+ }
714
+
715
+ /**
716
+ * Validation Error Handler
717
+ */
718
+ declare class ValidationErrorHandler extends BaseErrorHandler {
719
+ protected canHandle(error: unknown): boolean;
720
+ protected handleError(error: unknown, context: string): AuthActionResult;
721
+ }
722
+
723
+ /**
724
+ * Network Error Handler
725
+ */
726
+ declare class NetworkErrorHandler extends BaseErrorHandler {
727
+ protected canHandle(error: unknown): boolean;
728
+ protected handleError(error: unknown, context: string): AuthActionResult;
729
+ }
730
+
731
+ /**
732
+ * Generic Error Handler
733
+ */
734
+ declare class GenericErrorHandler extends BaseErrorHandler {
735
+ protected canHandle(): boolean;
736
+ protected handleError(error: unknown, context: string): AuthActionResult;
737
+ }
738
+
739
+ /**
740
+ * Development Logger Implementation
741
+ */
742
+ declare class DevelopmentLogger implements ILogger {
743
+ log(message: string, data?: unknown): void;
744
+ warn(message: string, data?: unknown): void;
745
+ error(message: string, data?: unknown): void;
746
+ }
747
+
748
+ /**
749
+ * Production Logger Implementation
750
+ */
751
+ declare class ProductionLogger implements ILogger {
752
+ log(_message: string, _data?: unknown): void;
753
+ warn(_message: string, _data?: unknown): void;
754
+ error(_message: string, _data?: unknown): void;
755
+ }
756
+
757
+ /**
758
+ * Lookup Pattern: Logger Factory with Environment-based Strategy
759
+ */
760
+ declare class LoggerFactory {
761
+ private static loggers;
762
+ static create(environment?: string): ILogger;
763
+ }
764
+
765
+ /**
766
+ * Authentication Orchestrator Service
767
+ * Orchestrates authentication flow with proper separation of concerns
768
+ * Follows Dependency Inversion Principle (DIP) and Open/Closed Principle (OCP)
769
+ */
770
+ declare class AuthOrchestrator implements IAuthOrchestrator {
771
+ private authService;
772
+ private eventBus;
773
+ private tokenManager;
774
+ private userStorageManager;
775
+ private errorHandler;
776
+ private logger;
777
+ constructor(authService: AuthService, eventBus: EventBus<AuthEvent>, tokenManager?: ITokenManager);
778
+ /**
779
+ * Setup Chain of Responsibility for error handling
780
+ */
781
+ private setupErrorHandlerChain;
983
782
  /**
984
- * Create default HTTP client with configuration
783
+ * Validate that cookies are supported in the current environment
985
784
  */
986
- private createDefaultHttpClient;
785
+ private validateCookieSupport;
987
786
  /**
988
- * Handle HTTP response and throw structured error if needed
787
+ * Handle email check to determine if user exists and what action to take
989
788
  */
990
- private handleResponse;
789
+ handleEmailCheck(email: string): Promise<AuthActionResult<EmailExistResponse>>;
991
790
  /**
992
- * Create API error from HTTP response following Single Responsibility Principle
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.
993
793
  */
994
- private createApiErrorFromResponse;
794
+ handleLoginStrategy(loginRequest: LoginRequest): Promise<AuthActionResult<LoginData>>;
995
795
  /**
996
- * Try to parse API error response from response data
796
+ * Handle complete login flow with proper error handling and token management
797
+ * @param credentials - Login credentials (email and password)
798
+ * @param mode - Strategy resolution mode (defaults to CHECK_EMAIL_EXISTS)
997
799
  */
998
- private tryParseApiErrorResponse;
800
+ handleLoginFlow(credentials: LoginRequest, mode?: StrategyResolutionMode): Promise<AuthActionResult<LoginData>>;
999
801
  /**
1000
- * Check if response data has valid API error structure
802
+ * Handle Google login flow
1001
803
  */
1002
- private isValidApiErrorResponse;
804
+ handleGoogleLogin(token: string): Promise<AuthActionResult<LoginData>>;
1003
805
  /**
1004
- * Create generic API error as fallback
806
+ * Handle email verification flow
1005
807
  */
1006
- private createGenericApiError;
808
+ handleEmailVerification(email: string, code: string): Promise<AuthActionResult>;
1007
809
  /**
1008
- * GET request
810
+ * Handle logout flow
1009
811
  */
1010
- protected get<T>(endpoint: string, headers?: Record<string, string>): Promise<T>;
812
+ handleLogout(): Promise<AuthActionResult>;
1011
813
  /**
1012
- * POST request
814
+ * Check current authentication status using State Pattern
1013
815
  */
1014
- protected post<T>(endpoint: string, body?: unknown, headers?: Record<string, string>): Promise<T>;
816
+ checkAuthenticationStatus(): Promise<AuthActionResult>;
1015
817
  /**
1016
- * PUT request
818
+ * Get user profile data
1017
819
  */
1018
- protected put<T>(endpoint: string, body?: unknown, headers?: Record<string, string>): Promise<T>;
820
+ getUserProfileData(): Promise<AuthActionResult>;
1019
821
  /**
1020
- * DELETE request
822
+ * Get public user profile data (me) and save tokens for public sessions
823
+ *
824
+ * Note: This method saves tokens but does NOT publish AuthEventType.LoggedIn event,
825
+ * allowing public sessions to have tokens without being marked as "authenticated".
826
+ * The store's initializePublicUser() maintains isAuthenticated = false.
1021
827
  */
1022
- protected delete<T>(endpoint: string, headers?: Record<string, string>): Promise<T>;
828
+ getMeData(): Promise<AuthActionResult>;
1023
829
  /**
1024
- * PATCH request
830
+ * Get detailed token information
1025
831
  */
1026
- protected patch<T>(endpoint: string, body?: unknown, headers?: Record<string, string>): Promise<T>;
832
+ getTokenInfo(): Promise<AuthActionResult>;
1027
833
  }
1028
-
1029
834
  /**
1030
- * Authentication Service
1031
- * Handles all authentication-related operations with clean separation of concerns
835
+ * Authentication Orchestrator Factory
836
+ * Follows Factory Pattern for dependency injection
1032
837
  */
1033
- declare class AuthService extends BaseService implements IAuthService {
838
+ declare class AuthOrchestratorFactory {
1034
839
  /**
1035
- * Check if an email exists in the system
840
+ * Create AuthOrchestrator with default dependencies
1036
841
  */
1037
- checkEmailExists(email: string): Promise<EmailExistResponse>;
842
+ static create(): AuthOrchestrator;
1038
843
  /**
1039
- * Login with email and password
844
+ * Create AuthOrchestrator with custom dependencies
1040
845
  */
1041
- login(credentials: LoginRequest): Promise<LoginResponse>;
846
+ static createWithDependencies(authService: AuthService, eventBus: EventBus<AuthEvent>, tokenManager?: ITokenManager): AuthOrchestrator;
847
+ }
848
+
849
+ /**
850
+ * User Storage Manager Implementation
851
+ * Handles user profile storage using LocalStorageUtils
852
+ * Provides a clean interface for user data persistence
853
+ */
854
+ declare class UserStorageManager {
855
+ private storageUtils;
856
+ constructor(storageUtils: typeof LocalStorageUtils);
1042
857
  /**
1043
- * Login with Google
858
+ * Save user profile data to storage
1044
859
  */
1045
- loginWithGoogle(token: string): Promise<LoginResponse>;
860
+ saveUserProfile(userProfile: UserProfile): boolean;
1046
861
  /**
1047
- * Verify email with verification code
862
+ * Get user profile data from storage
1048
863
  */
1049
- verifyEmail(verification: VerifyEmailRequest): Promise<VerifyEmailResponse>;
864
+ getUserProfile(cacheDuration?: number): UserProfile | null;
1050
865
  /**
1051
- * Get user profile
866
+ * Clear user profile data from storage
1052
867
  */
1053
- getUserProfile(): Promise<UserProfileResponse>;
868
+ clearUserProfile(): boolean;
1054
869
  /**
1055
- * Get public user profile (me)
870
+ * Check if cached user profile is still valid
1056
871
  */
1057
- getMe(): Promise<PublicUserProfileResponse>;
872
+ isCacheValid(cacheDuration?: number): boolean;
1058
873
  /**
1059
- * Logout user
874
+ * Get user profile with automatic cache validation
875
+ * Returns null if cache is expired or invalid
1060
876
  */
1061
- logout(): Promise<void>;
877
+ getValidUserProfile(cacheDuration?: number): UserProfile | null;
1062
878
  }
1063
879
 
1064
880
  /**
1065
- * Authentication API endpoints
881
+ * Authentication Orchestrator Interface
882
+ * Follows Interface Segregation Principle (ISP)
1066
883
  */
1067
- declare const AUTH_ENDPOINTS: {
1068
- readonly CHECK_EMAIL_EXISTS: (email: string) => string;
1069
- readonly LOGIN: "/auth/user/login";
1070
- readonly LOGIN_GOOGLE: "/auth/user/login/google";
1071
- readonly VERIFY_EMAIL: "/auth/user/verify";
1072
- readonly GET_USER_PROFILE: "/auth/user/profile";
1073
- readonly GET_ME: "/auth/user/me";
1074
- readonly LOGOUT: "/auth/logout";
884
+ interface IAuthOrchestrator {
885
+ handleEmailCheck(email: string): Promise<AuthActionResult>;
886
+ handleLoginFlow(credentials: LoginRequest, mode?: StrategyResolutionMode): Promise<AuthActionResult>;
887
+ handleGoogleLogin(token: string): Promise<AuthActionResult>;
888
+ handleEmailVerification(email: string, code: string): Promise<AuthActionResult>;
889
+ handleLogout(): Promise<AuthActionResult>;
890
+ checkAuthenticationStatus(): Promise<AuthActionResult>;
891
+ getUserProfileData(): Promise<AuthActionResult>;
892
+ getMeData(): Promise<AuthActionResult>;
893
+ getTokenInfo(): Promise<AuthActionResult>;
894
+ }
895
+
896
+ declare enum HttpMethod {
897
+ GET = "GET",
898
+ POST = "POST",
899
+ PUT = "PUT",
900
+ DELETE = "DELETE",
901
+ PATCH = "PATCH"
902
+ }
903
+ interface ApiKeyConfig {
904
+ apiKey: string;
905
+ headerName?: string;
906
+ }
907
+ interface HttpClientConfig {
908
+ baseURL: string;
909
+ timeout?: number;
910
+ retries?: number;
911
+ apiKey?: ApiKeyConfig;
912
+ apiKeys?: Record<string, string>;
913
+ origin?: string;
914
+ headers?: Record<string, string>;
915
+ getAccessToken?: () => Promise<string | null>;
916
+ }
917
+ interface HttpRequestOptions {
918
+ method: HttpMethod;
919
+ url: string;
920
+ data?: unknown;
921
+ body?: unknown;
922
+ headers?: Record<string, string>;
923
+ timeout?: number;
924
+ }
925
+ interface HttpResponse<T = unknown> {
926
+ data: T;
927
+ status: number;
928
+ statusText: string;
929
+ headers: Headers;
930
+ ok: boolean;
931
+ }
932
+ interface ApiErrorResponse {
933
+ message: string;
934
+ statusCode: number;
935
+ error: string;
936
+ digest?: string;
937
+ }
938
+ interface HttpError extends Error {
939
+ status?: number;
940
+ statusText?: string;
941
+ response?: unknown;
942
+ }
943
+
944
+ interface FormHeaderProps {
945
+ title: string;
946
+ description?: string;
947
+ }
948
+
949
+ interface BaseFormField extends Omit<FormItemProps, 'children'> {
950
+ component: React.ReactNode;
951
+ }
952
+ interface FormFieldsProps {
953
+ fields: BaseFormField[];
954
+ }
955
+
956
+ interface BaseComponentProps extends FormHeaderProps {
957
+ submitButtonText: string;
958
+ isLoading?: boolean;
959
+ initialValues?: Store;
960
+ }
961
+ type BaseStepProps = BaseComponentProps;
962
+ interface BaseFormProps<T = Record<string, unknown>> extends BaseComponentProps, FormFieldsProps {
963
+ onSubmit: (values: T) => void | Promise<void>;
964
+ form?: FormInstance;
965
+ additionalActions?: React.ReactNode;
966
+ }
967
+
968
+ interface GoogleSignInActionsProps {
969
+ onGoogleSignIn?: (token: string) => void;
970
+ isLoading?: boolean;
971
+ }
972
+
973
+ interface EmailStepProps extends BaseStepProps, GoogleSignInActionsProps {
974
+ onSubmit: (email: string) => void | Promise<void>;
975
+ onForgotPassword?: () => void;
976
+ }
977
+
978
+ interface PasswordStepProps extends BaseStepProps {
979
+ mode: NextAction;
980
+ email: string;
981
+ onSubmit: (password: string) => void | Promise<void>;
982
+ onBack?: () => void;
983
+ showEmailField?: boolean;
984
+ showBackButton?: boolean;
985
+ }
986
+
987
+ interface VerificationStepProps extends BaseStepProps {
988
+ email: string;
989
+ onSubmit: (verificationCode: string) => void | Promise<void>;
990
+ onResendCode?: () => void;
991
+ codeLength?: number;
992
+ showResendButton?: boolean;
993
+ }
994
+
995
+ interface ForgotPasswordStepProps extends BaseStepProps {
996
+ email: string;
997
+ onSubmit: (email: string) => void | Promise<void>;
998
+ }
999
+
1000
+ declare enum AuthFlowVariant {
1001
+ DEFAULT = "default",
1002
+ WITH_IMAGE = "with_image"
1003
+ }
1004
+ type AuthFlowProps = {
1005
+ variant?: AuthFlowVariant;
1006
+ backgroundImage?: string;
1075
1007
  };
1076
- /**
1077
- * Endpoint builder utility
1078
- */
1079
- declare class EndpointBuilder {
1080
- static auth: {
1081
- readonly CHECK_EMAIL_EXISTS: (email: string) => string;
1082
- readonly LOGIN: "/auth/user/login";
1083
- readonly LOGIN_GOOGLE: "/auth/user/login/google";
1084
- readonly VERIFY_EMAIL: "/auth/user/verify";
1085
- readonly GET_USER_PROFILE: "/auth/user/profile";
1086
- readonly GET_ME: "/auth/user/me";
1087
- readonly LOGOUT: "/auth/logout";
1008
+ type AuthFlowContainerProps = AuthFlowProps;
1009
+ type AuthFlowModalProps = AuthFlowProps & {
1010
+ children: ReactNode;
1011
+ };
1012
+
1013
+ declare enum ProfileUIState {
1014
+ LOADING = "LOADING",
1015
+ UNAUTHENTICATED = "UNAUTHENTICATED",
1016
+ AUTHENTICATED = "AUTHENTICATED"
1017
+ }
1018
+ interface AuthenticatedStateProps {
1019
+ user: UserProfile;
1020
+ onLogout: () => void;
1021
+ }
1022
+
1023
+ interface Step<T = string> {
1024
+ id: T;
1025
+ title: string;
1026
+ description: string;
1027
+ icon?: ReactNode;
1028
+ disabled?: boolean;
1029
+ }
1030
+ interface StepConfig<T = string> {
1031
+ steps: Step<T>[];
1032
+ initialStep?: T;
1033
+ }
1034
+ interface StepperState$1<T = string> {
1035
+ currentStep: T;
1036
+ currentStepIndex: number;
1037
+ steps: Step<T>[];
1038
+ isFirstStep: boolean;
1039
+ isLastStep: boolean;
1040
+ progress: number;
1041
+ }
1042
+ interface StepperActions<T = string> {
1043
+ goToStep: (step: T) => void;
1044
+ goToNext: () => void;
1045
+ goToPrevious: () => void;
1046
+ goToIndex: (index: number) => void;
1047
+ reset: () => void;
1048
+ }
1049
+ interface UseStepperReturn<T = string> {
1050
+ state: StepperState$1<T>;
1051
+ actions: StepperActions<T>;
1052
+ helpers: {
1053
+ getStepIndex: (step: T) => number;
1054
+ getStepByIndex: (index: number) => Step<T> | undefined;
1055
+ isStepValid: (step: T) => boolean;
1056
+ getProgressPercentage: () => number;
1088
1057
  };
1089
1058
  }
1090
1059
 
1091
- /**
1092
- * Authentication Orchestrator Service
1093
- * Orchestrates authentication flow with proper separation of concerns
1094
- * Follows Dependency Inversion Principle (DIP) and Open/Closed Principle (OCP)
1095
- */
1096
- declare class AuthOrchestrator implements IAuthOrchestrator {
1097
- private authService;
1098
- private eventBus;
1099
- private tokenManager;
1100
- private userStorageManager;
1101
- private errorHandler;
1102
- private logger;
1103
- constructor(authService: AuthService, eventBus: EventBus<AuthEvent>, tokenManager?: ITokenManager);
1104
- /**
1105
- * Setup Chain of Responsibility for error handling
1106
- */
1107
- private setupErrorHandlerChain;
1108
- /**
1109
- * Validate that cookies are supported in the current environment
1110
- */
1111
- private validateCookieSupport;
1112
- /**
1113
- * Handle email check to determine if user exists and what action to take
1114
- */
1115
- handleEmailCheck(email: string): Promise<AuthActionResult<EmailExistResponse>>;
1116
- /**
1117
- * Handle complete login flow with proper error handling and token management
1118
- */
1119
- handleLoginFlow(credentials: LoginRequest): Promise<AuthActionResult<LoginData>>;
1120
- /**
1121
- * Handle Google login flow
1122
- */
1123
- handleGoogleLogin(token: string): Promise<AuthActionResult<LoginData>>;
1124
- /**
1125
- * Handle email verification flow
1126
- */
1127
- handleEmailVerification(email: string, code: string): Promise<AuthActionResult>;
1128
- /**
1129
- * Handle logout flow
1130
- */
1131
- handleLogout(): Promise<AuthActionResult>;
1132
- /**
1133
- * Check current authentication status using State Pattern
1134
- */
1135
- checkAuthenticationStatus(): Promise<AuthActionResult>;
1136
- /**
1137
- * Get user profile data
1138
- */
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>;
1148
- /**
1149
- * Get detailed token information
1150
- */
1151
- getTokenInfo(): Promise<AuthActionResult>;
1060
+ type StepRegistryBaseProps = Omit<BaseStepProps, 'title' | 'description' | 'submitButtonText'>;
1061
+ interface StepRegistryParams {
1062
+ baseProps: StepRegistryBaseProps;
1063
+ handlers: StepRegistryHandlers;
1064
+ state: StepRegistryState;
1065
+ configs: StepRegistryConfigs;
1152
1066
  }
1153
- /**
1154
- * Authentication Orchestrator Factory
1155
- * Follows Factory Pattern for dependency injection
1156
- */
1157
- declare class AuthOrchestratorFactory {
1158
- /**
1159
- * Create AuthOrchestrator with default dependencies
1160
- */
1161
- static create(): AuthOrchestrator;
1162
- /**
1163
- * Create AuthOrchestrator with custom dependencies
1164
- */
1165
- static createWithDependencies(authService: AuthService, eventBus: EventBus<AuthEvent>, tokenManager?: ITokenManager): AuthOrchestrator;
1067
+ interface UseStepRegistryParams extends StepRegistryParams {
1068
+ getStepComponent: (step: AuthFlowStep) => StepComponent | null;
1069
+ stepperState: StepperState;
1166
1070
  }
1167
-
1168
- /**
1169
- * User Storage Manager Implementation
1170
- * Handles user profile storage using LocalStorageUtils
1171
- * Provides a clean interface for user data persistence
1172
- */
1173
- declare class UserStorageManager {
1174
- private storageUtils;
1175
- constructor(storageUtils: typeof LocalStorageUtils);
1176
- /**
1177
- * Save user profile data to storage
1178
- */
1179
- saveUserProfile(userProfile: UserProfile): boolean;
1180
- /**
1181
- * Get user profile data from storage
1182
- */
1183
- getUserProfile(cacheDuration?: number): UserProfile | null;
1184
- /**
1185
- * Clear user profile data from storage
1186
- */
1187
- clearUserProfile(): boolean;
1188
- /**
1189
- * Check if cached user profile is still valid
1190
- */
1191
- isCacheValid(cacheDuration?: number): boolean;
1192
- /**
1193
- * Get user profile with automatic cache validation
1194
- * Returns null if cache is expired or invalid
1195
- */
1196
- getValidUserProfile(cacheDuration?: number): UserProfile | null;
1071
+ interface StepRegistryHandlers {
1072
+ handleEmailSubmit: (email: string) => Promise<void>;
1073
+ handlePasswordSubmit: (password: string) => Promise<void>;
1074
+ handleVerificationSubmit: (code: string) => Promise<void>;
1075
+ handleResendCode: () => void;
1076
+ goBackToEmail: () => void;
1077
+ goBackToPassword: () => void;
1078
+ onGoogleSignIn?: (token: string) => void;
1079
+ handleForgotPassword?: (email: string) => Promise<void>;
1080
+ onForgotPasswordClick?: () => void;
1197
1081
  }
1198
-
1199
- /**
1200
- * Strategy Pattern: Signup Flow Strategy
1201
- */
1202
- declare class SignupFlowStrategy implements ILoginFlowStrategy {
1203
- private authService;
1204
- private tokenManager;
1205
- constructor(authService: AuthService, tokenManager: ITokenManager);
1206
- execute(credentials: LoginRequest): Promise<AuthActionResult<LoginData>>;
1207
- private handleSuccessfulAuthentication;
1082
+ interface StepRegistryState {
1083
+ email: string;
1084
+ authIntent: NextAction;
1085
+ authData: unknown;
1086
+ }
1087
+ interface StepRegistryConfigs {
1088
+ emailStepConfig: Record<string, unknown>;
1089
+ passwordStepConfig: Record<string, unknown>;
1090
+ verificationStepConfig: Record<string, unknown>;
1091
+ }
1092
+ interface StepperState {
1093
+ currentStep: AuthFlowStep;
1208
1094
  }
1095
+ type StepComponentRetriever = (step: AuthFlowStep) => StepComponent | null;
1096
+ type AnyStepProps = EmailStepProps | PasswordStepProps | VerificationStepProps | ForgotPasswordStepProps;
1097
+ type StepComponent = React__default.ComponentType<AnyStepProps>;
1098
+ type StepRegistry = Record<AuthFlowStep, StepComponent>;
1099
+ type PropsFactory = () => AnyStepProps;
1100
+ type StepPropsFactoryRegistry = Record<AuthFlowStep, PropsFactory>;
1209
1101
 
1210
- /**
1211
- * Strategy Pattern: Existing User Login Strategy
1212
- */
1213
- declare class ExistingUserLoginStrategy implements ILoginFlowStrategy {
1214
- private authService;
1215
- private tokenManager;
1216
- constructor(authService: AuthService, tokenManager: ITokenManager);
1217
- execute(credentials: LoginRequest): Promise<AuthActionResult<LoginData>>;
1218
- private handleSuccessfulAuthentication;
1102
+ interface AlertDisplayProps {
1103
+ error?: string;
1104
+ success?: string;
1219
1105
  }
1220
1106
 
1221
- /**
1222
- * Strategy Pattern: Login Flow Strategy Factory
1223
- */
1224
- declare class LoginFlowStrategyFactory {
1225
- private static strategies;
1226
- static createStrategy(action: NextAction, authService: AuthService, tokenManager: ITokenManager): ILoginFlowStrategy;
1107
+ interface PasswordStrengthRule {
1108
+ label: string;
1109
+ test: (password: string) => boolean;
1110
+ }
1111
+ interface StrengthResult {
1112
+ label: string;
1113
+ percent: number;
1114
+ status: 'success' | 'exception' | 'normal';
1115
+ color?: string;
1116
+ }
1117
+ interface PasswordInputWithStrengthProps extends PasswordProps {
1118
+ showStrengthIndicator?: boolean;
1227
1119
  }
1228
1120
 
1229
1121
  /**
1230
- * State Pattern: Authenticated State
1122
+ * Enum for user roles
1231
1123
  */
1232
- declare class AuthenticatedState implements IAuthStatusState {
1233
- getStatus(tokenManager: ITokenManager): Promise<AuthActionResultSuccess<{
1234
- isAuthenticated: boolean;
1235
- hasAccessToken: boolean;
1236
- hasRefreshToken: boolean;
1237
- cookiesSupported: boolean;
1238
- domainInfo: Record<string, string>;
1239
- }>>;
1240
- private buildAuthStatus;
1124
+ declare enum RoleType {
1125
+ USER = "USER",
1126
+ ADMIN = "ADMIN"
1241
1127
  }
1128
+ type AuthState = {
1129
+ isAuthenticated: boolean;
1130
+ isLoading: boolean;
1131
+ error: string | null;
1132
+ user: Record<string, unknown> | null;
1133
+ tokens: {
1134
+ accessToken: string | null;
1135
+ refreshToken: string | null;
1136
+ };
1137
+ };
1138
+ type EmailCheckResult = {
1139
+ exists: boolean;
1140
+ nextAction: NextAction;
1141
+ message: string;
1142
+ };
1143
+ type UserSession = {
1144
+ user: {
1145
+ id: string;
1146
+ email: string;
1147
+ firstName: string;
1148
+ lastName: string;
1149
+ role: RoleType;
1150
+ };
1151
+ tokens: {
1152
+ accessToken: string;
1153
+ refreshToken: string;
1154
+ };
1155
+ expiresAt: number;
1156
+ };
1157
+ type UserState = {
1158
+ user: UserProfile | null;
1159
+ isLoading: boolean;
1160
+ error: string | null;
1161
+ isAuthenticated: boolean;
1162
+ };
1242
1163
 
1243
1164
  /**
1244
- * State Pattern: Unauthenticated State
1165
+ * Token Management Interface
1166
+ * Follows Single Responsibility Principle (SRP)
1167
+ * Updated to support async operations for SSR compatibility
1245
1168
  */
1246
- declare class UnauthenticatedState implements IAuthStatusState {
1247
- getStatus(tokenManager: ITokenManager): Promise<AuthActionResultFailure>;
1248
- private buildAuthStatus;
1169
+ interface ITokenManager {
1170
+ saveTokens(accessToken: string, refreshToken?: string): void;
1171
+ clearTokens(): void;
1172
+ getAccessToken(): Promise<string | null>;
1173
+ getRefreshToken(): Promise<string | null>;
1174
+ getAllTokens(): Promise<Record<string, string>>;
1175
+ areCookiesSupported(): boolean;
1176
+ getDomainInfo(): Record<string, string>;
1249
1177
  }
1250
1178
 
1251
1179
  /**
1252
- * State Pattern: Authentication Status Context
1180
+ * Strategy Pattern: Login Flow Strategy Interface
1253
1181
  */
1254
- declare class AuthenticationStatusContext {
1255
- private static states;
1256
- static getStatus(tokenManager: ITokenManager): Promise<AuthActionResult>;
1182
+ interface ILoginFlowStrategy {
1183
+ execute(credentials: LoginRequest): Promise<AuthActionResult<LoginData>>;
1257
1184
  }
1258
1185
 
1259
1186
  /**
1260
- * Command Pattern: Result Creation Commands
1261
- * Follows Single Responsibility Principle - only responsible for creating AuthResult objects
1187
+ * State Pattern: Authentication Status State Interface
1262
1188
  */
1263
- declare class AuthResultFactory {
1264
- /**
1265
- * Creates a successful authentication result
1266
- */
1267
- static createSuccess<T = unknown>(data: T): AuthActionResultSuccess<T>;
1268
- /**
1269
- * Creates a failed authentication result
1270
- */
1271
- static createFailure(error?: string | Error | unknown): AuthActionResultFailure;
1189
+ interface IAuthStatusState {
1190
+ getStatus(tokenManager: ITokenManager): Promise<AuthActionResult>;
1272
1191
  }
1273
1192
 
1274
1193
  /**
1275
- * Chain of Responsibility: Base Error Handler
1194
+ * Chain of Responsibility: Error Handler Interface
1276
1195
  */
1277
- declare abstract class BaseErrorHandler implements IErrorHandler {
1278
- private nextHandler?;
1196
+ interface IErrorHandler {
1279
1197
  setNext(handler: IErrorHandler): IErrorHandler;
1280
1198
  handle(error: unknown, context: string): AuthActionResult;
1281
- protected abstract canHandle(error: unknown): boolean;
1282
- protected abstract handleError(error: unknown, context: string): AuthActionResult;
1283
1199
  }
1284
1200
 
1285
1201
  /**
1286
- * Validation Error Handler
1202
+ * Lookup Pattern: Logger Interface
1287
1203
  */
1288
- declare class ValidationErrorHandler extends BaseErrorHandler {
1289
- protected canHandle(error: unknown): boolean;
1290
- protected handleError(error: unknown, context: string): AuthActionResult;
1204
+ interface ILogger {
1205
+ log(message: string, data?: unknown): void;
1206
+ warn(message: string, data?: unknown): void;
1207
+ error(message: string, data?: unknown): void;
1291
1208
  }
1292
1209
 
1293
- /**
1294
- * Network Error Handler
1295
- */
1296
- declare class NetworkErrorHandler extends BaseErrorHandler {
1297
- protected canHandle(error: unknown): boolean;
1298
- protected handleError(error: unknown, context: string): AuthActionResult;
1210
+ interface Subscription {
1211
+ unsubscribe(): void;
1212
+ }
1213
+ interface EventBus<TEvent = unknown> {
1214
+ publish(event: TEvent): void;
1215
+ subscribe(handler: (event: TEvent) => void): Subscription;
1216
+ }
1217
+ declare abstract class BaseEventBus {
1218
+ }
1219
+
1220
+ declare enum AuthEventType {
1221
+ LoggedIn = "auth.logged_in",
1222
+ LoggedOut = "auth.logged_out",
1223
+ EmailVerified = "auth.email_verified",
1224
+ SignInRequiredModal = "auth.signin_required_modal"
1225
+ }
1226
+ type AuthEvent = {
1227
+ type: AuthEventType.LoggedIn;
1228
+ userId: string;
1229
+ sourcePageType?: PageType;
1230
+ } | {
1231
+ type: AuthEventType.LoggedOut;
1232
+ sourcePageType?: PageType;
1233
+ } | {
1234
+ type: AuthEventType.EmailVerified;
1235
+ email: string;
1236
+ sourcePageType?: PageType;
1237
+ } | {
1238
+ type: AuthEventType.SignInRequiredModal;
1239
+ sourcePageType?: PageType;
1240
+ };
1241
+ declare enum PageType {
1242
+ LOGIN = "/login",
1243
+ DASHBOARD = "dashboard",
1244
+ HOME = "/"
1245
+ }
1246
+ declare enum NavigationAction {
1247
+ NONE = "none",
1248
+ RELOAD = "reload"
1299
1249
  }
1250
+ declare const PageTypePatterns: {
1251
+ readonly "/login": PageType.LOGIN;
1252
+ readonly dashboard: PageType.DASHBOARD;
1253
+ readonly "/": PageType.HOME;
1254
+ };
1255
+ declare const CrossTabBehaviorConfig: {
1256
+ readonly "/login": {
1257
+ readonly "auth.logged_in": {
1258
+ readonly action: NavigationAction.NONE;
1259
+ };
1260
+ readonly "auth.logged_out": {
1261
+ readonly action: NavigationAction.NONE;
1262
+ };
1263
+ readonly "auth.email_verified": {
1264
+ readonly action: NavigationAction.NONE;
1265
+ };
1266
+ readonly "auth.signin_required_modal": {
1267
+ readonly action: NavigationAction.NONE;
1268
+ };
1269
+ };
1270
+ readonly dashboard: {
1271
+ readonly "auth.logged_in": {
1272
+ readonly action: NavigationAction.RELOAD;
1273
+ };
1274
+ readonly "auth.logged_out": {
1275
+ readonly action: NavigationAction.RELOAD;
1276
+ };
1277
+ readonly "auth.email_verified": {
1278
+ readonly action: NavigationAction.RELOAD;
1279
+ };
1280
+ readonly "auth.signin_required_modal": {
1281
+ readonly action: NavigationAction.NONE;
1282
+ };
1283
+ };
1284
+ readonly "/": {
1285
+ readonly "auth.logged_in": {
1286
+ readonly action: NavigationAction.NONE;
1287
+ };
1288
+ readonly "auth.logged_out": {
1289
+ readonly action: NavigationAction.NONE;
1290
+ };
1291
+ readonly "auth.email_verified": {
1292
+ readonly action: NavigationAction.NONE;
1293
+ };
1294
+ readonly "auth.signin_required_modal": {
1295
+ readonly action: NavigationAction.NONE;
1296
+ };
1297
+ };
1298
+ };
1300
1299
 
1301
1300
  /**
1302
- * Generic Error Handler
1301
+ * Middleware request context containing all necessary data
1303
1302
  */
1304
- declare class GenericErrorHandler extends BaseErrorHandler {
1305
- protected canHandle(): boolean;
1306
- protected handleError(error: unknown, context: string): AuthActionResult;
1303
+ interface MiddlewareContext {
1304
+ request: NextRequest;
1305
+ method: string;
1306
+ pathname: string;
1307
+ searchParams: URLSearchParams;
1308
+ cookies: NextRequest['cookies'];
1309
+ nextUrl: URL;
1310
+ hostname: string;
1307
1311
  }
1308
-
1309
1312
  /**
1310
- * Development Logger Implementation
1313
+ * Base interface for middleware handlers
1311
1314
  */
1312
- declare class DevelopmentLogger implements ILogger {
1313
- log(message: string, data?: unknown): void;
1314
- warn(message: string, data?: unknown): void;
1315
- error(message: string, data?: unknown): void;
1315
+ interface MiddlewareHandler {
1316
+ handle(context: MiddlewareContext): NextResponse | null | Promise<NextResponse | null>;
1316
1317
  }
1317
1318
 
1318
1319
  /**
1319
- * Production Logger Implementation
1320
+ * Email Provider Configuration Interface
1321
+ * Defines the structure for email provider configurations
1320
1322
  */
1321
- declare class ProductionLogger implements ILogger {
1322
- log(_message: string, _data?: unknown): void;
1323
- warn(_message: string, _data?: unknown): void;
1324
- error(_message: string, _data?: unknown): void;
1323
+ interface EmailProviderConfig {
1324
+ name: string;
1325
+ pattern: RegExp;
1326
+ getUrl: (email: string, subject?: string) => string;
1325
1327
  }
1326
1328
 
1329
+ declare const createAuthSteps: (options?: {
1330
+ authIntent?: NextAction;
1331
+ nextAction?: NextAction;
1332
+ }) => Step<AuthFlowStep>[];
1333
+ declare const getStepProgressMessage: (step: AuthFlowStep) => string;
1334
+ declare const getAuthPageStepMessage: (step: AuthFlowStep) => string;
1335
+
1336
+ declare const EMAIL_SUBMISSION_NAVIGATION: {
1337
+ readonly "login-verification": AuthFlowStep.PASSWORD;
1338
+ readonly login: AuthFlowStep.PASSWORD;
1339
+ readonly signup: AuthFlowStep.PASSWORD;
1340
+ };
1341
+ declare const PASSWORD_SUBMISSION_NAVIGATION: {
1342
+ readonly VERIFIED: AuthFlowStep.VERIFICATION;
1343
+ readonly UNVERIFIED: AuthFlowStep.VERIFICATION;
1344
+ };
1345
+ declare const VERIFICATION_SUBMISSION_NAVIGATION: {
1346
+ readonly SUCCESS: AuthFlowStep.VERIFICATION;
1347
+ readonly ERROR: AuthFlowStep.VERIFICATION;
1348
+ };
1349
+ declare const getStepForEmailSubmission: (nextAction: NextAction) => AuthFlowStep;
1350
+ declare const getStepForPasswordSubmission: (isVerified: boolean) => AuthFlowStep;
1351
+ declare const getStepForVerificationSubmission: (success: boolean) => AuthFlowStep;
1352
+
1353
+ declare const getEmailField: (options?: InputProps) => BaseFormField;
1354
+ declare const getPasswordField: (isLogin: boolean, disabled?: boolean, options?: PasswordProps) => BaseFormField;
1355
+ declare const getVerificationField: (codeLength?: number, options?: InputProps, email?: string) => BaseFormField;
1356
+ declare const getTermsCheckboxField: (options?: CheckboxProps) => BaseFormField;
1357
+ declare const getForgotPasswordField: (options?: ButtonProps) => BaseFormField;
1358
+
1327
1359
  /**
1328
- * Lookup Pattern: Logger Factory with Environment-based Strategy
1360
+ * Middleware configuration constants for routing and protection
1329
1361
  */
1330
- declare class LoggerFactory {
1331
- private static loggers;
1332
- static create(environment?: string): ILogger;
1362
+ declare class MiddlewareConfig {
1363
+ static readonly CONSTANTS: {
1364
+ readonly LOGIN_PATH: "/login";
1365
+ readonly DASHBOARD_SUBDOMAIN: "dashboard";
1366
+ readonly PUBLIC_PATH: "/public";
1367
+ readonly PUBLIC_API_PATH: "/api/public";
1368
+ };
1369
+ /**
1370
+ * Get public routes whitelist from environment variable
1371
+ * Expected format: comma-separated paths like "/public,/links/new,/about"
1372
+ */
1373
+ static getPublicRoutesWhitelist(): string[];
1374
+ static readonly PROTECTED_ROUTES: {
1375
+ INCLUDE: string[];
1376
+ EXCLUDE: string[];
1377
+ };
1378
+ static readonly ALLOWED_METHODS: readonly ["GET", "HEAD"];
1379
+ static readonly QUERY_PARAMS: {
1380
+ readonly LOGIN_REQUIRED: "sign_in_required";
1381
+ readonly AUTH_CHECKED: "auth_checked";
1382
+ readonly REDIRECT_URL: "redirect_url";
1383
+ };
1384
+ static readonly QUERY_VALUES: {
1385
+ readonly LOGIN_REQUIRED: "true";
1386
+ readonly AUTH_CHECKED: "1";
1387
+ };
1388
+ /**
1389
+ * Get the base domain from environment or use default
1390
+ */
1391
+ static getBaseDomain(): string;
1392
+ /**
1393
+ * Get the protocol based on environment
1394
+ */
1395
+ static getProtocol(): string;
1333
1396
  }
1397
+ /**
1398
+ * Middleware matcher patterns
1399
+ * Matches all routes except API routes, Next.js internals, and static assets
1400
+ */
1401
+ declare const middlewareMatcher: readonly ["/((?!api|_next/static|_next/image|_next/webpack-hmr|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|css|js)$).*)"];
1402
+ /**
1403
+ * Middleware configuration
1404
+ */
1405
+ declare const config: {
1406
+ matcher: readonly ["/((?!api|_next/static|_next/image|_next/webpack-hmr|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|css|js)$).*)"];
1407
+ };
1334
1408
 
1335
1409
  /**
1336
1410
  * User store state interface
@@ -1648,4 +1722,4 @@ declare const useAuthFlowModal: () => {
1648
1722
  openModal: () => void;
1649
1723
  };
1650
1724
 
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 };
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 };