mailsentry-auth 0.1.1 → 0.1.4

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
@@ -516,22 +516,22 @@ type AuthEvent = {
516
516
  sourcePageType?: PageType;
517
517
  };
518
518
  declare enum PageType {
519
- LOGIN = "/login",
520
- DASHBOARD = "/dashboard",
519
+ LOGIN = "login",
520
+ DASHBOARD = "dashboard",
521
521
  HOME = "/"
522
522
  }
523
523
  declare enum NavigationAction {
524
524
  NONE = "none",
525
525
  REDIRECT = "redirect",
526
- MODAL = "modal"
526
+ MODAL = "modal",
527
+ CURRENT = "current"
527
528
  }
528
529
  declare const PageTypePatterns: {
529
- readonly "/login": PageType.LOGIN;
530
- readonly "/dashboard": PageType.DASHBOARD;
531
- readonly "/": PageType.HOME;
530
+ readonly login: PageType.LOGIN;
531
+ readonly dashboard: PageType.DASHBOARD;
532
532
  };
533
533
  declare const CrossTabBehaviorConfig: {
534
- readonly "/login": {
534
+ readonly login: {
535
535
  readonly "auth.logged_in": {
536
536
  readonly action: NavigationAction.REDIRECT;
537
537
  readonly target: PageType.DASHBOARD;
@@ -546,31 +546,29 @@ declare const CrossTabBehaviorConfig: {
546
546
  readonly action: NavigationAction.NONE;
547
547
  };
548
548
  };
549
- readonly "/dashboard": {
549
+ readonly dashboard: {
550
550
  readonly "auth.logged_in": {
551
- readonly action: NavigationAction.MODAL;
551
+ readonly action: NavigationAction.CURRENT;
552
552
  };
553
553
  readonly "auth.logged_out": {
554
- readonly action: NavigationAction.REDIRECT;
555
- readonly target: PageType.DASHBOARD;
554
+ readonly action: NavigationAction.CURRENT;
556
555
  };
557
556
  readonly "auth.email_verified": {
558
- readonly action: NavigationAction.MODAL;
557
+ readonly action: NavigationAction.CURRENT;
559
558
  };
560
559
  readonly "auth.signin_required_modal": {
561
- readonly action: NavigationAction.NONE;
560
+ readonly action: NavigationAction.CURRENT;
562
561
  };
563
562
  };
564
563
  readonly "/": {
565
564
  readonly "auth.logged_in": {
566
- readonly action: NavigationAction.MODAL;
565
+ readonly action: NavigationAction.NONE;
567
566
  };
568
567
  readonly "auth.logged_out": {
569
- readonly action: NavigationAction.REDIRECT;
570
- readonly target: PageType.HOME;
568
+ readonly action: NavigationAction.NONE;
571
569
  };
572
570
  readonly "auth.email_verified": {
573
- readonly action: NavigationAction.MODAL;
571
+ readonly action: NavigationAction.NONE;
574
572
  };
575
573
  readonly "auth.signin_required_modal": {
576
574
  readonly action: NavigationAction.NONE;
@@ -588,6 +586,7 @@ interface MiddlewareContext {
588
586
  searchParams: URLSearchParams;
589
587
  cookies: NextRequest['cookies'];
590
588
  nextUrl: URL;
589
+ hostname: string;
591
590
  }
592
591
  /**
593
592
  * Base interface for middleware handlers
@@ -629,38 +628,49 @@ declare const getPasswordField: (isLogin: boolean, disabled?: boolean, options?:
629
628
  declare const getVerificationField: (codeLength?: number, options?: InputProps) => BaseFormField;
630
629
 
631
630
  /**
632
- * Middleware configuration constants
631
+ * Middleware configuration constants for subdomain-based routing
633
632
  */
634
633
  declare class MiddlewareConfig {
635
- static readonly PROTECTED_ROUTES: {
636
- readonly DASHBOARD: "/";
634
+ static readonly SUBDOMAINS: {
635
+ readonly DASHBOARD: "dashboard";
637
636
  };
638
- static readonly AUTH_ROUTES: {
637
+ static readonly ROUTES: {
638
+ readonly ROOT: "/";
639
639
  readonly LOGIN: "/login";
640
640
  };
641
641
  static readonly ALLOWED_METHODS: readonly ["GET", "HEAD"];
642
642
  static readonly QUERY_PARAMS: {
643
643
  readonly LOGIN_REQUIRED: "sign_in_required";
644
644
  readonly AUTH_CHECKED: "auth_checked";
645
+ readonly REDIRECT_URL: "redirect_url";
645
646
  };
646
647
  static readonly QUERY_VALUES: {
647
648
  readonly LOGIN_REQUIRED: "true";
648
649
  readonly AUTH_CHECKED: "1";
649
650
  };
651
+ /**
652
+ * Get the base domain from environment or use default
653
+ */
654
+ static getBaseDomain(): string;
655
+ /**
656
+ * Get the protocol based on environment
657
+ */
658
+ static getProtocol(): string;
659
+ /**
660
+ * Get the dashboard subdomain URL
661
+ */
662
+ static getDashboardUrl(path?: string): string;
650
663
  }
651
664
  /**
652
- * Middleware matcher patterns - exported separately for static analysis
653
- * Pattern includes:
654
- * - / (home route and all other routes for authentication protection)
655
- * - /login route (for authenticated user redirection)
656
- * Excludes: API routes, Next.js internals, static assets, and file extensions
665
+ * Middleware matcher patterns
666
+ * Matches all routes except API routes, Next.js internals, and static assets
657
667
  */
658
- declare const middlewareMatcher: readonly ["/((?!api|_next/static|_next/image|_next/webpack-hmr|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|css|js)$).*)", "/login"];
668
+ declare const middlewareMatcher: readonly ["/((?!api|_next/static|_next/image|_next/webpack-hmr|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|css|js)$).*)"];
659
669
  /**
660
- * Middleware configuration - runs on all routes (including home) and login page
670
+ * Middleware configuration
661
671
  */
662
672
  declare const config: {
663
- matcher: readonly ["/((?!api|_next/static|_next/image|_next/webpack-hmr|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|css|js)$).*)", "/login"];
673
+ matcher: readonly ["/((?!api|_next/static|_next/image|_next/webpack-hmr|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|css|js)$).*)"];
664
674
  };
665
675
 
666
676
  /**
@@ -676,11 +686,12 @@ declare class CookieUtils {
676
686
  * Get the refresh token cookie key from environment variables
677
687
  */
678
688
  static getRefreshTokenKey(): string;
679
- private static readonly COOKIE_DOMAIN;
680
689
  /**
681
690
  * Get root domain for subdomain support
691
+ * Must match the domain used by backend when setting cookies
682
692
  */
683
693
  private static getRootDomain;
694
+ private static readonly COOKIE_DOMAIN;
684
695
  /**
685
696
  * Get common cookie options
686
697
  */
@@ -722,6 +733,7 @@ declare class CookieUtils {
722
733
  }>;
723
734
  /**
724
735
  * Clear all authentication cookies (client-side only)
736
+ * Clears cookies from both current domain and root domain
725
737
  */
726
738
  static clearAuthCookies(): void;
727
739
  /**
@@ -793,11 +805,11 @@ declare class BroadcastChannelEventBus<TEvent> {
793
805
  /**
794
806
  * Cross-Tab Behavior Handler
795
807
  * Determines cross-tab behavior based on authentication events and current page context
796
- * Uses lookup patterns instead of conditional statements
808
+ * Uses object lookup pattern for page type detection
797
809
  */
798
810
  declare class CrossTabBehaviorHandler {
799
811
  /**
800
- * Get current page type based on pathname using pattern matching
812
+ * Get current page type using object lookup pattern
801
813
  */
802
814
  static getCurrentPageType(): PageType;
803
815
  /**
@@ -813,32 +825,43 @@ declare class CrossTabBehaviorHandler {
813
825
  } | {
814
826
  readonly action: NavigationAction.NONE;
815
827
  } | {
816
- readonly action: NavigationAction.MODAL;
828
+ readonly action: NavigationAction.CURRENT;
817
829
  } | {
818
- readonly action: NavigationAction.REDIRECT;
819
- readonly target: PageType.DASHBOARD;
830
+ readonly action: NavigationAction.CURRENT;
820
831
  } | {
821
- readonly action: NavigationAction.MODAL;
832
+ readonly action: NavigationAction.CURRENT;
822
833
  } | {
823
- readonly action: NavigationAction.NONE;
834
+ readonly action: NavigationAction.CURRENT;
824
835
  } | {
825
- readonly action: NavigationAction.MODAL;
836
+ readonly action: NavigationAction.NONE;
826
837
  } | {
827
- readonly action: NavigationAction.REDIRECT;
828
- readonly target: PageType.HOME;
838
+ readonly action: NavigationAction.NONE;
829
839
  } | {
830
- readonly action: NavigationAction.MODAL;
840
+ readonly action: NavigationAction.NONE;
831
841
  } | {
832
842
  readonly action: NavigationAction.NONE;
833
843
  };
834
844
  /**
835
845
  * Check if current route requires redirect for given event
846
+ * Returns PageType to redirect to, or null if no redirect needed
836
847
  */
837
848
  static shouldRedirect(currentPageType: PageType, eventType: AuthEventType): PageType | null;
849
+ }
850
+
851
+ /**
852
+ * URL utility functions
853
+ */
854
+ declare class UrlUtils {
855
+ /**
856
+ * Extract subdomain from hostname or URL
857
+ * Example: "dashboard.cutly.io" -> "dashboard"
858
+ * Example: "dashboard.localhost" -> "dashboard"
859
+ */
860
+ static getSubdomain(url: string): string | null;
838
861
  /**
839
- * Check if current route should show modal for given event
862
+ * Check if URL has auth-related query parameters
840
863
  */
841
- static shouldShowModal(currentPageType: PageType, eventType: AuthEventType): boolean;
864
+ static hasAuthParams(url: string): boolean;
842
865
  }
843
866
 
844
867
  /**
@@ -1489,4 +1512,4 @@ declare const useAuthFlowModal: () => {
1489
1512
  openModal: () => void;
1490
1513
  };
1491
1514
 
1492
- export { AUTH_ENDPOINTS, AlertDisplay, type AlertDisplayProps, type AnyStepProps, type ApiErrorResponse, type ApiKeyConfig, type AuthActionCallbacks, type AuthActionOptions, type AuthActionResult, type AuthActionResultFailure, type AuthActionResultSuccess, type AuthActionState, type AuthEvent, AuthEventType, AuthFlowContainer, AuthFlowModal, AuthFlowStep, AuthInitializer, AuthOrchestrator, AuthOrchestratorFactory, AuthResultFactory, AuthService, type AuthState, AuthenticatedState, type AuthenticatedStateProps, AuthenticationStatusContext, type BaseComponentProps, BaseErrorHandler, BaseEventBus, BaseForm, type BaseFormField, type BaseFormProps, type BaseResponse, BaseService, type BaseStepProps, BroadcastChannelEventBus, Channel, CookieUtils, CrossTabBehaviorConfig, CrossTabBehaviorHandler, CrossTabDemo, DevelopmentLogger, EMAIL_SUBMISSION_NAVIGATION, type EmailCheckResult, type EmailExistResponse, EmailStep, type EmailStepProps, EndpointBuilder, type EventBus, ExistingUserLoginStrategy, FormFields, type FormFieldsProps, FormHeader, type FormHeaderProps, GenericErrorHandler, HttpClient, type HttpClientConfig, type HttpError, HttpMethod, type HttpRequestOptions, type HttpResponse, type IAuthOrchestrator, type IAuthService, type IAuthStatusState, type IErrorHandler, type ILogger, type ILoginFlowStrategy, type ITokenManager, LocalStorageUtils, LoggerFactory, type LoginData, LoginFlowStrategyFactory, type LoginRequest, type LoginResponse, MiddlewareConfig, type MiddlewareContext, type MiddlewareHandler, NavigationAction, NetworkErrorHandler, NextAction, PASSWORD_SUBMISSION_NAVIGATION, PageType, PageTypePatterns, PasswordStep, type PasswordStepProps, ProductionLogger, ProfileStateRenderer, ProfileUIState, type PropsFactory, RoleType, SignupFlowStrategy, type Step, type StepComponent, type StepComponentRetriever, type StepConfig, type StepPropsFactoryRegistry, type StepRegistry, type StepRegistryBaseProps, type StepRegistryConfigs, type StepRegistryHandlers, type StepRegistryParams, type StepRegistryState, type StepperActions, type StepperState$1 as StepperState, type Subscription, TokenManager, UnauthenticatedState, 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, getEmailStepComponent, getPasswordField, getPasswordStepComponent, getStepForEmailSubmission, getStepForPasswordSubmission, getStepForVerificationSubmission, getStepProgressMessage, getVerificationField, getVerificationStepComponent, middlewareMatcher, useAuth, useAuthActionHandler, useAuthEventBus, useAuthFlowModal, useAuthInitializer, useIsAuthenticated, useLogout, useRefreshUser, useSharedEventBus, useSignInRequiredParams, useStepRegistry, useStepRenderer, useStepper, useUser, useUserActions, useUserData, useUserError, useUserLoading, useUserProfile, useUserStore, userSelectors };
1515
+ export { AUTH_ENDPOINTS, AlertDisplay, type AlertDisplayProps, type AnyStepProps, type ApiErrorResponse, type ApiKeyConfig, type AuthActionCallbacks, type AuthActionOptions, type AuthActionResult, type AuthActionResultFailure, type AuthActionResultSuccess, type AuthActionState, type AuthEvent, AuthEventType, AuthFlowContainer, AuthFlowModal, AuthFlowStep, AuthInitializer, AuthOrchestrator, AuthOrchestratorFactory, AuthResultFactory, AuthService, type AuthState, AuthenticatedState, type AuthenticatedStateProps, AuthenticationStatusContext, type BaseComponentProps, BaseErrorHandler, BaseEventBus, BaseForm, type BaseFormField, type BaseFormProps, type BaseResponse, BaseService, type BaseStepProps, BroadcastChannelEventBus, Channel, CookieUtils, CrossTabBehaviorConfig, CrossTabBehaviorHandler, CrossTabDemo, DevelopmentLogger, EMAIL_SUBMISSION_NAVIGATION, type EmailCheckResult, type EmailExistResponse, EmailStep, type EmailStepProps, EndpointBuilder, type EventBus, ExistingUserLoginStrategy, FormFields, type FormFieldsProps, FormHeader, type FormHeaderProps, GenericErrorHandler, HttpClient, type HttpClientConfig, type HttpError, HttpMethod, type HttpRequestOptions, type HttpResponse, type IAuthOrchestrator, type IAuthService, type IAuthStatusState, type IErrorHandler, type ILogger, type ILoginFlowStrategy, type ITokenManager, LocalStorageUtils, LoggerFactory, type LoginData, LoginFlowStrategyFactory, type LoginRequest, type LoginResponse, MiddlewareConfig, type MiddlewareContext, type MiddlewareHandler, NavigationAction, NetworkErrorHandler, NextAction, PASSWORD_SUBMISSION_NAVIGATION, PageType, PageTypePatterns, PasswordStep, type PasswordStepProps, ProductionLogger, ProfileStateRenderer, ProfileUIState, type PropsFactory, RoleType, SignupFlowStrategy, type Step, type StepComponent, type StepComponentRetriever, type StepConfig, type StepPropsFactoryRegistry, type StepRegistry, type StepRegistryBaseProps, type StepRegistryConfigs, type StepRegistryHandlers, type StepRegistryParams, type StepRegistryState, type StepperActions, type StepperState$1 as StepperState, type Subscription, TokenManager, UnauthenticatedState, UrlUtils, type UseAuthActionHandler, type UseAuthEventBusProps, type UseFormSubmissionProps, type UseStepRegistryParams, type UseStepperReturn, type UserProfile, type UserProfileResponse, type UserSession, type UserState, UserStorageManager, type UserStoreState, VERIFICATION_SUBMISSION_NAVIGATION, ValidationErrorHandler, VerificationStep, type VerificationStepProps, type VerifyEmailRequest, type VerifyEmailResponse, config, createAuthSteps, createPropsFactoryRegistry, createStepRegistry, getAuthPageStepMessage, getEmailField, getEmailStepComponent, getPasswordField, getPasswordStepComponent, getStepForEmailSubmission, getStepForPasswordSubmission, getStepForVerificationSubmission, getStepProgressMessage, getVerificationField, getVerificationStepComponent, middlewareMatcher, useAuth, useAuthActionHandler, useAuthEventBus, useAuthFlowModal, useAuthInitializer, useIsAuthenticated, useLogout, useRefreshUser, useSharedEventBus, useSignInRequiredParams, useStepRegistry, useStepRenderer, useStepper, useUser, useUserActions, useUserData, useUserError, useUserLoading, useUserProfile, useUserStore, userSelectors };
package/dist/index.d.ts CHANGED
@@ -516,22 +516,22 @@ type AuthEvent = {
516
516
  sourcePageType?: PageType;
517
517
  };
518
518
  declare enum PageType {
519
- LOGIN = "/login",
520
- DASHBOARD = "/dashboard",
519
+ LOGIN = "login",
520
+ DASHBOARD = "dashboard",
521
521
  HOME = "/"
522
522
  }
523
523
  declare enum NavigationAction {
524
524
  NONE = "none",
525
525
  REDIRECT = "redirect",
526
- MODAL = "modal"
526
+ MODAL = "modal",
527
+ CURRENT = "current"
527
528
  }
528
529
  declare const PageTypePatterns: {
529
- readonly "/login": PageType.LOGIN;
530
- readonly "/dashboard": PageType.DASHBOARD;
531
- readonly "/": PageType.HOME;
530
+ readonly login: PageType.LOGIN;
531
+ readonly dashboard: PageType.DASHBOARD;
532
532
  };
533
533
  declare const CrossTabBehaviorConfig: {
534
- readonly "/login": {
534
+ readonly login: {
535
535
  readonly "auth.logged_in": {
536
536
  readonly action: NavigationAction.REDIRECT;
537
537
  readonly target: PageType.DASHBOARD;
@@ -546,31 +546,29 @@ declare const CrossTabBehaviorConfig: {
546
546
  readonly action: NavigationAction.NONE;
547
547
  };
548
548
  };
549
- readonly "/dashboard": {
549
+ readonly dashboard: {
550
550
  readonly "auth.logged_in": {
551
- readonly action: NavigationAction.MODAL;
551
+ readonly action: NavigationAction.CURRENT;
552
552
  };
553
553
  readonly "auth.logged_out": {
554
- readonly action: NavigationAction.REDIRECT;
555
- readonly target: PageType.DASHBOARD;
554
+ readonly action: NavigationAction.CURRENT;
556
555
  };
557
556
  readonly "auth.email_verified": {
558
- readonly action: NavigationAction.MODAL;
557
+ readonly action: NavigationAction.CURRENT;
559
558
  };
560
559
  readonly "auth.signin_required_modal": {
561
- readonly action: NavigationAction.NONE;
560
+ readonly action: NavigationAction.CURRENT;
562
561
  };
563
562
  };
564
563
  readonly "/": {
565
564
  readonly "auth.logged_in": {
566
- readonly action: NavigationAction.MODAL;
565
+ readonly action: NavigationAction.NONE;
567
566
  };
568
567
  readonly "auth.logged_out": {
569
- readonly action: NavigationAction.REDIRECT;
570
- readonly target: PageType.HOME;
568
+ readonly action: NavigationAction.NONE;
571
569
  };
572
570
  readonly "auth.email_verified": {
573
- readonly action: NavigationAction.MODAL;
571
+ readonly action: NavigationAction.NONE;
574
572
  };
575
573
  readonly "auth.signin_required_modal": {
576
574
  readonly action: NavigationAction.NONE;
@@ -588,6 +586,7 @@ interface MiddlewareContext {
588
586
  searchParams: URLSearchParams;
589
587
  cookies: NextRequest['cookies'];
590
588
  nextUrl: URL;
589
+ hostname: string;
591
590
  }
592
591
  /**
593
592
  * Base interface for middleware handlers
@@ -629,38 +628,49 @@ declare const getPasswordField: (isLogin: boolean, disabled?: boolean, options?:
629
628
  declare const getVerificationField: (codeLength?: number, options?: InputProps) => BaseFormField;
630
629
 
631
630
  /**
632
- * Middleware configuration constants
631
+ * Middleware configuration constants for subdomain-based routing
633
632
  */
634
633
  declare class MiddlewareConfig {
635
- static readonly PROTECTED_ROUTES: {
636
- readonly DASHBOARD: "/";
634
+ static readonly SUBDOMAINS: {
635
+ readonly DASHBOARD: "dashboard";
637
636
  };
638
- static readonly AUTH_ROUTES: {
637
+ static readonly ROUTES: {
638
+ readonly ROOT: "/";
639
639
  readonly LOGIN: "/login";
640
640
  };
641
641
  static readonly ALLOWED_METHODS: readonly ["GET", "HEAD"];
642
642
  static readonly QUERY_PARAMS: {
643
643
  readonly LOGIN_REQUIRED: "sign_in_required";
644
644
  readonly AUTH_CHECKED: "auth_checked";
645
+ readonly REDIRECT_URL: "redirect_url";
645
646
  };
646
647
  static readonly QUERY_VALUES: {
647
648
  readonly LOGIN_REQUIRED: "true";
648
649
  readonly AUTH_CHECKED: "1";
649
650
  };
651
+ /**
652
+ * Get the base domain from environment or use default
653
+ */
654
+ static getBaseDomain(): string;
655
+ /**
656
+ * Get the protocol based on environment
657
+ */
658
+ static getProtocol(): string;
659
+ /**
660
+ * Get the dashboard subdomain URL
661
+ */
662
+ static getDashboardUrl(path?: string): string;
650
663
  }
651
664
  /**
652
- * Middleware matcher patterns - exported separately for static analysis
653
- * Pattern includes:
654
- * - / (home route and all other routes for authentication protection)
655
- * - /login route (for authenticated user redirection)
656
- * Excludes: API routes, Next.js internals, static assets, and file extensions
665
+ * Middleware matcher patterns
666
+ * Matches all routes except API routes, Next.js internals, and static assets
657
667
  */
658
- declare const middlewareMatcher: readonly ["/((?!api|_next/static|_next/image|_next/webpack-hmr|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|css|js)$).*)", "/login"];
668
+ declare const middlewareMatcher: readonly ["/((?!api|_next/static|_next/image|_next/webpack-hmr|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|css|js)$).*)"];
659
669
  /**
660
- * Middleware configuration - runs on all routes (including home) and login page
670
+ * Middleware configuration
661
671
  */
662
672
  declare const config: {
663
- matcher: readonly ["/((?!api|_next/static|_next/image|_next/webpack-hmr|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|css|js)$).*)", "/login"];
673
+ matcher: readonly ["/((?!api|_next/static|_next/image|_next/webpack-hmr|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|css|js)$).*)"];
664
674
  };
665
675
 
666
676
  /**
@@ -676,11 +686,12 @@ declare class CookieUtils {
676
686
  * Get the refresh token cookie key from environment variables
677
687
  */
678
688
  static getRefreshTokenKey(): string;
679
- private static readonly COOKIE_DOMAIN;
680
689
  /**
681
690
  * Get root domain for subdomain support
691
+ * Must match the domain used by backend when setting cookies
682
692
  */
683
693
  private static getRootDomain;
694
+ private static readonly COOKIE_DOMAIN;
684
695
  /**
685
696
  * Get common cookie options
686
697
  */
@@ -722,6 +733,7 @@ declare class CookieUtils {
722
733
  }>;
723
734
  /**
724
735
  * Clear all authentication cookies (client-side only)
736
+ * Clears cookies from both current domain and root domain
725
737
  */
726
738
  static clearAuthCookies(): void;
727
739
  /**
@@ -793,11 +805,11 @@ declare class BroadcastChannelEventBus<TEvent> {
793
805
  /**
794
806
  * Cross-Tab Behavior Handler
795
807
  * Determines cross-tab behavior based on authentication events and current page context
796
- * Uses lookup patterns instead of conditional statements
808
+ * Uses object lookup pattern for page type detection
797
809
  */
798
810
  declare class CrossTabBehaviorHandler {
799
811
  /**
800
- * Get current page type based on pathname using pattern matching
812
+ * Get current page type using object lookup pattern
801
813
  */
802
814
  static getCurrentPageType(): PageType;
803
815
  /**
@@ -813,32 +825,43 @@ declare class CrossTabBehaviorHandler {
813
825
  } | {
814
826
  readonly action: NavigationAction.NONE;
815
827
  } | {
816
- readonly action: NavigationAction.MODAL;
828
+ readonly action: NavigationAction.CURRENT;
817
829
  } | {
818
- readonly action: NavigationAction.REDIRECT;
819
- readonly target: PageType.DASHBOARD;
830
+ readonly action: NavigationAction.CURRENT;
820
831
  } | {
821
- readonly action: NavigationAction.MODAL;
832
+ readonly action: NavigationAction.CURRENT;
822
833
  } | {
823
- readonly action: NavigationAction.NONE;
834
+ readonly action: NavigationAction.CURRENT;
824
835
  } | {
825
- readonly action: NavigationAction.MODAL;
836
+ readonly action: NavigationAction.NONE;
826
837
  } | {
827
- readonly action: NavigationAction.REDIRECT;
828
- readonly target: PageType.HOME;
838
+ readonly action: NavigationAction.NONE;
829
839
  } | {
830
- readonly action: NavigationAction.MODAL;
840
+ readonly action: NavigationAction.NONE;
831
841
  } | {
832
842
  readonly action: NavigationAction.NONE;
833
843
  };
834
844
  /**
835
845
  * Check if current route requires redirect for given event
846
+ * Returns PageType to redirect to, or null if no redirect needed
836
847
  */
837
848
  static shouldRedirect(currentPageType: PageType, eventType: AuthEventType): PageType | null;
849
+ }
850
+
851
+ /**
852
+ * URL utility functions
853
+ */
854
+ declare class UrlUtils {
855
+ /**
856
+ * Extract subdomain from hostname or URL
857
+ * Example: "dashboard.cutly.io" -> "dashboard"
858
+ * Example: "dashboard.localhost" -> "dashboard"
859
+ */
860
+ static getSubdomain(url: string): string | null;
838
861
  /**
839
- * Check if current route should show modal for given event
862
+ * Check if URL has auth-related query parameters
840
863
  */
841
- static shouldShowModal(currentPageType: PageType, eventType: AuthEventType): boolean;
864
+ static hasAuthParams(url: string): boolean;
842
865
  }
843
866
 
844
867
  /**
@@ -1489,4 +1512,4 @@ declare const useAuthFlowModal: () => {
1489
1512
  openModal: () => void;
1490
1513
  };
1491
1514
 
1492
- export { AUTH_ENDPOINTS, AlertDisplay, type AlertDisplayProps, type AnyStepProps, type ApiErrorResponse, type ApiKeyConfig, type AuthActionCallbacks, type AuthActionOptions, type AuthActionResult, type AuthActionResultFailure, type AuthActionResultSuccess, type AuthActionState, type AuthEvent, AuthEventType, AuthFlowContainer, AuthFlowModal, AuthFlowStep, AuthInitializer, AuthOrchestrator, AuthOrchestratorFactory, AuthResultFactory, AuthService, type AuthState, AuthenticatedState, type AuthenticatedStateProps, AuthenticationStatusContext, type BaseComponentProps, BaseErrorHandler, BaseEventBus, BaseForm, type BaseFormField, type BaseFormProps, type BaseResponse, BaseService, type BaseStepProps, BroadcastChannelEventBus, Channel, CookieUtils, CrossTabBehaviorConfig, CrossTabBehaviorHandler, CrossTabDemo, DevelopmentLogger, EMAIL_SUBMISSION_NAVIGATION, type EmailCheckResult, type EmailExistResponse, EmailStep, type EmailStepProps, EndpointBuilder, type EventBus, ExistingUserLoginStrategy, FormFields, type FormFieldsProps, FormHeader, type FormHeaderProps, GenericErrorHandler, HttpClient, type HttpClientConfig, type HttpError, HttpMethod, type HttpRequestOptions, type HttpResponse, type IAuthOrchestrator, type IAuthService, type IAuthStatusState, type IErrorHandler, type ILogger, type ILoginFlowStrategy, type ITokenManager, LocalStorageUtils, LoggerFactory, type LoginData, LoginFlowStrategyFactory, type LoginRequest, type LoginResponse, MiddlewareConfig, type MiddlewareContext, type MiddlewareHandler, NavigationAction, NetworkErrorHandler, NextAction, PASSWORD_SUBMISSION_NAVIGATION, PageType, PageTypePatterns, PasswordStep, type PasswordStepProps, ProductionLogger, ProfileStateRenderer, ProfileUIState, type PropsFactory, RoleType, SignupFlowStrategy, type Step, type StepComponent, type StepComponentRetriever, type StepConfig, type StepPropsFactoryRegistry, type StepRegistry, type StepRegistryBaseProps, type StepRegistryConfigs, type StepRegistryHandlers, type StepRegistryParams, type StepRegistryState, type StepperActions, type StepperState$1 as StepperState, type Subscription, TokenManager, UnauthenticatedState, 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, getEmailStepComponent, getPasswordField, getPasswordStepComponent, getStepForEmailSubmission, getStepForPasswordSubmission, getStepForVerificationSubmission, getStepProgressMessage, getVerificationField, getVerificationStepComponent, middlewareMatcher, useAuth, useAuthActionHandler, useAuthEventBus, useAuthFlowModal, useAuthInitializer, useIsAuthenticated, useLogout, useRefreshUser, useSharedEventBus, useSignInRequiredParams, useStepRegistry, useStepRenderer, useStepper, useUser, useUserActions, useUserData, useUserError, useUserLoading, useUserProfile, useUserStore, userSelectors };
1515
+ export { AUTH_ENDPOINTS, AlertDisplay, type AlertDisplayProps, type AnyStepProps, type ApiErrorResponse, type ApiKeyConfig, type AuthActionCallbacks, type AuthActionOptions, type AuthActionResult, type AuthActionResultFailure, type AuthActionResultSuccess, type AuthActionState, type AuthEvent, AuthEventType, AuthFlowContainer, AuthFlowModal, AuthFlowStep, AuthInitializer, AuthOrchestrator, AuthOrchestratorFactory, AuthResultFactory, AuthService, type AuthState, AuthenticatedState, type AuthenticatedStateProps, AuthenticationStatusContext, type BaseComponentProps, BaseErrorHandler, BaseEventBus, BaseForm, type BaseFormField, type BaseFormProps, type BaseResponse, BaseService, type BaseStepProps, BroadcastChannelEventBus, Channel, CookieUtils, CrossTabBehaviorConfig, CrossTabBehaviorHandler, CrossTabDemo, DevelopmentLogger, EMAIL_SUBMISSION_NAVIGATION, type EmailCheckResult, type EmailExistResponse, EmailStep, type EmailStepProps, EndpointBuilder, type EventBus, ExistingUserLoginStrategy, FormFields, type FormFieldsProps, FormHeader, type FormHeaderProps, GenericErrorHandler, HttpClient, type HttpClientConfig, type HttpError, HttpMethod, type HttpRequestOptions, type HttpResponse, type IAuthOrchestrator, type IAuthService, type IAuthStatusState, type IErrorHandler, type ILogger, type ILoginFlowStrategy, type ITokenManager, LocalStorageUtils, LoggerFactory, type LoginData, LoginFlowStrategyFactory, type LoginRequest, type LoginResponse, MiddlewareConfig, type MiddlewareContext, type MiddlewareHandler, NavigationAction, NetworkErrorHandler, NextAction, PASSWORD_SUBMISSION_NAVIGATION, PageType, PageTypePatterns, PasswordStep, type PasswordStepProps, ProductionLogger, ProfileStateRenderer, ProfileUIState, type PropsFactory, RoleType, SignupFlowStrategy, type Step, type StepComponent, type StepComponentRetriever, type StepConfig, type StepPropsFactoryRegistry, type StepRegistry, type StepRegistryBaseProps, type StepRegistryConfigs, type StepRegistryHandlers, type StepRegistryParams, type StepRegistryState, type StepperActions, type StepperState$1 as StepperState, type Subscription, TokenManager, UnauthenticatedState, UrlUtils, type UseAuthActionHandler, type UseAuthEventBusProps, type UseFormSubmissionProps, type UseStepRegistryParams, type UseStepperReturn, type UserProfile, type UserProfileResponse, type UserSession, type UserState, UserStorageManager, type UserStoreState, VERIFICATION_SUBMISSION_NAVIGATION, ValidationErrorHandler, VerificationStep, type VerificationStepProps, type VerifyEmailRequest, type VerifyEmailResponse, config, createAuthSteps, createPropsFactoryRegistry, createStepRegistry, getAuthPageStepMessage, getEmailField, getEmailStepComponent, getPasswordField, getPasswordStepComponent, getStepForEmailSubmission, getStepForPasswordSubmission, getStepForVerificationSubmission, getStepProgressMessage, getVerificationField, getVerificationStepComponent, middlewareMatcher, useAuth, useAuthActionHandler, useAuthEventBus, useAuthFlowModal, useAuthInitializer, useIsAuthenticated, useLogout, useRefreshUser, useSharedEventBus, useSignInRequiredParams, useStepRegistry, useStepRenderer, useStepper, useUser, useUserActions, useUserData, useUserError, useUserLoading, useUserProfile, useUserStore, userSelectors };