gebeya-telegram-otp
Version:
Reusable Telegram phone verification components for React applications
70 lines • 2.48 kB
TypeScript
/**
* Device detection utilities for identifying mobile, tablet, and desktop devices
* Implements multiple detection methods with fallback strategy
*/
export interface DeviceBreakpoints {
mobile: number;
tablet: number;
desktop: number;
}
export type DeviceType = "mobile" | "tablet" | "desktop";
export interface DeviceDetectionResult {
isMobile: boolean;
isTablet: boolean;
isDesktop: boolean;
deviceType: DeviceType;
userAgent: string;
screenWidth: number;
hasTouch: boolean;
}
export declare const DEFAULT_BREAKPOINTS: DeviceBreakpoints;
/**
* Detects mobile devices based on user agent string
* Supports major mobile browsers and operating systems
*/
export declare function detectMobileFromUserAgent(userAgent: string): boolean;
/**
* Detects tablet devices based on user agent string
* Specifically looks for tablet indicators
*/
export declare function detectTabletFromUserAgent(userAgent: string): boolean;
/**
* Detects device type based on screen width and breakpoints
*/
export declare function detectDeviceFromScreenSize(screenWidth: number, breakpoints?: DeviceBreakpoints): DeviceType;
/**
* Detects touch capability using multiple methods
* Checks for touch points and touch events support
*/
export declare function detectTouchCapability(): boolean;
/**
* Gets current screen width safely
* Handles cases where window might not be available (SSR)
*/
export declare function getScreenWidth(): number;
/**
* Gets user agent string safely
* Handles cases where navigator might not be available
*/
export declare function getUserAgent(): string;
/**
* Main device detection function that combines all detection methods
* Implements fallback strategy that defaults to desktop when uncertain
*/
export declare function detectDevice(breakpoints?: DeviceBreakpoints): DeviceDetectionResult;
/**
* Utility function to check if current device is mobile
* Convenience wrapper around detectDevice
*/
export declare function isMobileDevice(breakpoints?: DeviceBreakpoints): boolean;
/**
* Utility function to check if current device is tablet
* Convenience wrapper around detectDevice
*/
export declare function isTabletDevice(breakpoints?: DeviceBreakpoints): boolean;
/**
* Utility function to check if current device is desktop
* Convenience wrapper around detectDevice
*/
export declare function isDesktopDevice(breakpoints?: DeviceBreakpoints): boolean;
//# sourceMappingURL=deviceDetection.d.ts.map