@shopify/browser
Advanced tools
Comparing version 3.2.1 to 3.2.2
@@ -12,7 +12,5 @@ 'use strict'; | ||
} | ||
get version() { | ||
return this.ua.getBrowser().version || ''; | ||
} | ||
get majorVersion() { | ||
@@ -22,55 +20,41 @@ const { | ||
} = this; | ||
if (version === '') { | ||
return undefined; | ||
} | ||
const majorVersion = parseInt(version.split('.')[0], 10); | ||
return Number.isNaN(majorVersion) ? undefined : majorVersion; | ||
} | ||
get unknown() { | ||
return this.name === ''; | ||
} | ||
get isMobile() { | ||
return MOBILE_DEVICE_TYPES.includes(this.ua.getDevice().type) || this.isPOSFirstPartyDevice(); | ||
} | ||
get isDesktop() { | ||
return !this.isMobile; | ||
} | ||
get isNativeApp() { | ||
return this.ua.getUA().includes('Shopify Mobile/', 0); | ||
} | ||
get isShopifyPOSApp() { | ||
return this.ua.getUA().includes('Shopify POS/', 0); | ||
} | ||
get os() { | ||
return this.ua.getOS().name || ''; | ||
} | ||
get isWindows() { | ||
return this.os.includes('Windows'); | ||
} | ||
get isMac() { | ||
return this.os.includes('Mac OS'); | ||
} | ||
get isSafari() { | ||
return this.name.includes('Safari'); | ||
} | ||
get isChrome() { | ||
return this.name.includes('Chrome'); | ||
} | ||
get isAndroidChrome() { | ||
return this.ua.getUA().includes('Android') && this.name.includes('Chrome'); | ||
} | ||
get isAndroid() { | ||
@@ -80,15 +64,11 @@ const os = this.ua.getOS(); | ||
} | ||
get isFirefox() { | ||
return this.name === 'Firefox'; | ||
} | ||
get isIE() { | ||
return this.name.includes('IE'); | ||
} | ||
get isEdge() { | ||
return this.name === 'Edge'; | ||
} | ||
get isIOS() { | ||
@@ -100,3 +80,2 @@ const os = this.ua.getOS(); | ||
} | ||
constructor({ | ||
@@ -109,9 +88,8 @@ userAgent, | ||
this.ua = new uaParserJs.UAParser(userAgent); | ||
} // POS Go is a first party device that is not detected as a mobile device | ||
} | ||
// POS Go is a first party device that is not detected as a mobile device | ||
isPOSFirstPartyDevice() { | ||
return this.ua.getUA().includes('WSC6X') || this.ua.getUA().includes('WTH11'); | ||
} | ||
} | ||
@@ -122,3 +100,2 @@ function asPlainObject(browser) { | ||
} | ||
return { | ||
@@ -125,0 +102,0 @@ name: browser.name, |
{ | ||
"name": "@shopify/browser", | ||
"version": "3.2.1", | ||
"version": "3.2.2", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Utilities for extracting browser information from user-agents", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
255
20825