import {Wnd} from './astron'; export const isBot = (userAgent: string) => { return ( /(bot|spider|crawl)/i.test(userAgent) || (window as Wnd)._phantom || (window as Wnd).__nightmare || (window as Wnd).navigator.webdriver || (window as Wnd).Cypress ); }; export const doNotTrack = () => { const {doNotTrack, navigator, external} = window as Wnd; const msTracking = () => { return ( external && // @ts-ignore typeof external.msTrackingProtectionEnabled === 'function' && // @ts-ignore external.msTrackingProtectionEnabled() ); }; const dnt = doNotTrack || navigator.doNotTrack || // @ts-ignore navigator.msDoNotTrack || msTracking(); return dnt === true || dnt === 1 || dnt === 'yes' || dnt === '1'; }; export const buildWarn = () => (msg: string | string[]) => { // @ts-ignore if (DEBUG) { console.warn('Proxima:', msg); } };