/** * Authentication Types * * Core types for authentication functionality */ /** * Basic user information * * Represents a user account with core identification details */ export interface User { /** Unique user identifier */ id: string; /** User's email address */ email: string; /** Optional username for display */ username?: string; /** User's first name */ firstName?: string; /** User's last name */ lastName?: string; /** URL to user's avatar image */ avatar?: string; } /** * Authentication tokens * * Contains JWT tokens used for API authentication */ export interface AuthTokens { /** JWT access token for API requests */ accessToken: string; /** Optional refresh token for renewing access */ refreshToken?: string; /** Unix timestamp when the access token expires */ expiresAt?: number; } /** * Login credentials * * Email and password for user authentication */ export interface AuthCredentials { /** User's email address */ email: string; /** User's password */ password: string; } /** * Registration credentials * * Extended credentials for new user registration * @extends AuthCredentials */ export interface RegisterCredentials extends AuthCredentials { /** Optional username for the new account */ username?: string; /** User's first name */ firstName?: string; /** User's last name */ lastName?: string; } /** * Authentication response * * Successful authentication returns user data and tokens */ export interface AuthResponse { /** Authenticated user information */ user: User; /** JWT tokens for API access */ tokens: AuthTokens; } /** * Authentication error * * Standardized error format for authentication failures */ export interface AuthError { /** Error code identifier */ code: string; /** Human-readable error message */ message: string; /** Optional field name that caused the error */ field?: string; } /** * Authentication strategy type * * Supported authentication methods */ export type AuthStrategy = 'email' | 'phone' | 'oauth'; /** * Authentication configuration * * Configuration options for the authentication system */ export interface AuthConfig { /** Base URL for authentication API endpoints */ apiBaseUrl: string; /** Preferred authentication strategy */ strategy?: AuthStrategy; } /** * Authentication check response * * Response from checking if a user exists by email, phone, or username */ export interface AuthCheckResponseProps { /** Result status of the check */ result: 'success' | 'fail'; /** Optional message providing additional details */ message?: string; /** Type of attribute that was checked */ attribute?: 'email' | 'phone' | 'username'; /** Session ID for verification flow if user exists */ verification_session_id?: string; /** The attribute value that was checked */ value?: string; /** Next step in authentication flow - password entry or token verification */ next?: 'password' | 'token'; } /** * Authentication strategy configuration * * Defines an authentication strategy with its configuration and status */ export interface AuthStrategyProps { /** Unique identifier for the authentication strategy */ auth_strategy_id: string; /** Display name of the strategy */ name: string; /** Description of what this strategy does */ description: string; /** Current status of the strategy */ status: 'active' | 'inactive'; /** Type of authentication strategy (e.g., 'password', 'oauth', 'magic_link') */ strategy_type: string; /** Whether this strategy can be used for login */ allow_login?: boolean; /** Timestamp when the strategy was created */ create_datetime: any; /** Timestamp of the last update */ last_update_datetime: any; } /** * Authentication identifier * * Represents a type of identifier that can be used for authentication (e.g., email, phone, username) */ export interface AuthIdentifierProps { /** Unique identifier for this auth identifier type */ auth_identifier_id: string; /** The attribute name (e.g., 'email', 'phone', 'username') */ attribute: string; /** Current status of this identifier type */ status: 'active' | 'inactive'; /** Timestamp when the identifier was created */ create_datetime: any; /** Timestamp of the last update */ last_update_datetime: any; } /** * Authentication strategy identifier mapping * * Links an authentication strategy to a specific identifier with configuration */ export interface AuthStrategyIdentifierProps { /** Unique identifier for this strategy-identifier mapping */ auth_strategy_identifier_id: string; /** ID of the authentication strategy */ auth_strategy_id: string; /** ID of the auth identifier */ auth_identifier_id: string; /** Optional populated auth identifier details */ auth_identifier?: AuthIdentifierProps; /** Whether verification is required for this identifier */ verify_required: boolean; /** Display label for this identifier field */ label?: string; /** Whether this is the primary login identifier */ primary_login?: boolean; /** Whether input should be obscured (for passwords) */ secure_text_entry?: boolean; /** Label for the verification step */ verify_label: string; /** Description text for this identifier */ description?: string; /** Display priority/order */ priority?: number; /** Whether this field is optional */ optional?: boolean; /** Current status */ status: 'active' | 'inactive'; /** Timestamp when created */ create_datetime: any; /** Timestamp of last update */ last_update_datetime: any; } /** * Authentication execution request * * Request payload for executing an authentication strategy (login/signup) */ export interface AuthExecutionRequestProps { /** ID of the authentication strategy to execute */ auth_strategy_id: string; /** Optional company ID for white-label apps */ company_id?: string; /** Device identifier for tracking sessions */ device_id?: string; /** Source application making the request */ source?: 'widget' | 'bettoredge' | 'wl'; /** Optional referral code for new signups */ referral_code?: string; /** Array of identifier attributes (email, password, etc.) */ attributes: { /** Attribute name (e.g., 'email', 'password', 'username') */ attribute: string; /** Attribute value */ value: string; }[]; } /** * Authentication execution response * * Response from executing an authentication strategy */ export interface AuthExecutionResponseProps { /** ID of the executed authentication strategy */ auth_strategy_id: string; /** Result of the authentication attempt */ result: 'success' | 'fail'; /** Whether this created a new player account */ new_player?: boolean; /** ID of the strategy identifier that was used */ auth_strategy_identifier_id?: string; /** Session ID for verification flow */ verification_session_id?: string; /** When the verification session expires */ session_expire_datetime?: any; /** Device ID associated with this session */ device_id?: string; } /** * Authentication state * * Represents the current authentication state of the application */ export interface AuthStateProps { /** Whether the user is authenticated */ authenticated: boolean; /** Unique identifier for analytics tracking */ distinct_id: string; /** Current session identifier */ session_id: string; /** Player ID if authenticated, null/undefined otherwise */ player_id?: string | null; /** JWT access token for API requests */ access_token?: string; /** JWT refresh token for renewing access */ refresh_token?: string; /** When the access token expires */ expire_datetime?: any; } //# sourceMappingURL=auth.types.d.ts.map