import breakpoints from 'shared/constants/breakpoints'; declare global { interface Window { DocumentTouch: any; } } export type ViewType = 'desktop' | 'mobile'; type Gender = 'women' | 'men'; export const getIsTouchDevice = (DocumentTouch?: any): boolean => { if ( typeof window !== 'undefined' && typeof window.navigator !== 'undefined' ) { return Boolean( 'ontouchstart' in window || window.navigator.maxTouchPoints > 0 || window.navigator.msMaxTouchPoints > 0 || (window.DocumentTouch && document instanceof DocumentTouch) ); } }; export const getViewType = (): ViewType => { return typeof window !== 'undefined' ? window.innerWidth >= breakpoints.small ? 'desktop' : 'mobile' : 'desktop'; }; export const getCurrentGender = (): Gender => { return typeof window !== 'undefined' ? window.location.href.includes('women') ? 'women' : 'men' : 'women'; };