mailsentry-auth 0.2.1 → 0.2.2

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