@braintree/browser-detection 1.12.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  module.exports = function isAndroid(ua) {
3
3
  ua = ua || window.navigator.userAgent;
4
- return /Android/.test(ua);
4
+ return /Android/i.test(ua);
5
5
  };
@@ -5,7 +5,17 @@ var webkitRegexp = /webkit/i;
5
5
  function isWebkit(ua) {
6
6
  return webkitRegexp.test(ua);
7
7
  }
8
+ function isIosChrome(ua) {
9
+ return ua.indexOf("CriOS") > -1;
10
+ }
11
+ function isFacebook(ua) {
12
+ return ua.indexOf("FBAN") > -1;
13
+ }
8
14
  module.exports = function isIosSafari(ua) {
9
15
  ua = ua || window.navigator.userAgent;
10
- return (isIos(ua) && isWebkit(ua) && ua.indexOf("CriOS") === -1 && !isIosFirefox(ua));
16
+ return (isIos(ua) &&
17
+ isWebkit(ua) &&
18
+ !isIosChrome(ua) &&
19
+ !isIosFirefox(ua) &&
20
+ !isFacebook(ua));
11
21
  };
@@ -8,7 +8,8 @@ module.exports = function isIosWebview(ua) {
8
8
  if (isIosGoogleSearchApp(ua)) {
9
9
  return true;
10
10
  }
11
- return /.+AppleWebKit(?!.*Safari)/.test(ua);
11
+ // Historically, a webview could be identified by the presence of AppleWebKit and _no_ presence of Safari after.
12
+ return /.+AppleWebKit(?!.*Safari)/i.test(ua);
12
13
  }
13
14
  return false;
14
15
  };
@@ -20,7 +20,7 @@ function isOperaMini(ua) {
20
20
  return ua.indexOf("Opera Mini") > -1;
21
21
  }
22
22
  function isAndroidWebview(ua) {
23
- var androidWebviewRegExp = /Version\/[\d.]+/;
23
+ var androidWebviewRegExp = /Version\/[\d.]+/i;
24
24
  ua = ua || window.navigator.userAgent;
25
25
  if (isAndroid(ua)) {
26
26
  return (androidWebviewRegExp.test(ua) && !isOperaMini(ua) && !isDuckDuckGo(ua));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@braintree/browser-detection",
3
- "version": "1.12.0",
3
+ "version": "1.14.0",
4
4
  "description": "A small lib to detect browser compatibility for braintree products",
5
5
  "main": "dist/browser-detection.js",
6
6
  "types": "dist/browser-detection.d.ts",
@@ -8,16 +8,17 @@
8
8
  "dist",
9
9
  "*.js"
10
10
  ],
11
- "dependencies": {},
12
11
  "devDependencies": {
13
- "@types/jest": "^26.0.23",
14
- "@types/node": "^15.6.1",
15
- "eslint": "^7.27.0",
16
- "eslint-config-braintree": "^5.0.0-typescript-prep-rc.18",
17
- "jest": "^27.0.3",
18
- "prettier": "^2.3.0",
19
- "ts-jest": "^27.0.2",
20
- "typescript": "^4.3.2"
12
+ "@types/jest": "^27.4.1",
13
+ "@types/node": "^17.0.23",
14
+ "@typescript-eslint/eslint-plugin": "^5.19.0",
15
+ "eslint": "^8.13.0",
16
+ "eslint-config-braintree": "^6.0.0-typescript-prep-rc.2",
17
+ "eslint-plugin-prettier": "^4.0.0",
18
+ "jest": "^27.5.1",
19
+ "prettier": "^2.6.2",
20
+ "ts-jest": "^27.1.4",
21
+ "typescript": "^4.6.3"
21
22
  },
22
23
  "scripts": {
23
24
  "prepublishOnly": "npm run build",
package/CHANGELOG.md DELETED
@@ -1,80 +0,0 @@
1
- # Browser Detection - Release Notes
2
-
3
- # 1.12.0 (2021-06-08)
4
-
5
- - Add `is-duckduckgo` method
6
- - Add `is-ios-google-search-app` method
7
- - Add `is-opera` method
8
- - Add `is-silk` method
9
- - Fix issue where `is-chrome` would incorrectly report `true` for DuckDuckGo and Silk browsers
10
- - Fix issue where `supports-popups` would incorrectly report `false` for DuckDuckGo
11
-
12
- # 1.11.1 (2021-04-07)
13
-
14
- - Fix issue where `is-ios-safari` was returning `true` for iOS Firefox browsers
15
-
16
- # 1.11.0 (2020-10-27)
17
-
18
- - Add `has-software-keyboard` method
19
-
20
- # 1.10.1 (2020-10-19)
21
-
22
- - Fix issue where typescript declarations did not get published
23
-
24
- # 1.10.0 (2020-07-10)
25
-
26
- - Add typescript types
27
-
28
- ## v1.9.0 (2019-09-18)
29
-
30
- - Add `is-firefox` method
31
-
32
- ## v1.8.0 (2019-08-07)
33
-
34
- - Add `is-chrome-os` method
35
- - Fix README typo for iOS
36
- - Update README code samples to use `const`
37
-
38
- ## 1.7.0 (2017-10-18)
39
-
40
- - Add `supports-payment-request-api` method
41
-
42
- ## 1.6.0 (2017-07-25)
43
-
44
- - Correct is-chrome to not return true on edge browser
45
- - Correct supports-popups to not return true on iOS Firefox
46
- - Add `is-samsung-browser` method
47
- - Add `is-mobile-firefox` method
48
- - Add `is-ios-firefox` method
49
-
50
- ## 1.5.0 (2017-07-03)
51
-
52
- - Add `is-ie` method
53
- - Add `is-ie11` method
54
- - Add `is-edge` method
55
-
56
- ## 1.4.1 (2017-06-01)
57
-
58
- - publish to npm as scoped package `@braintree/browser-detection`
59
-
60
- ## 1.4.0 (2017-05-22)
61
-
62
- - Add `is-ios-uiwebview` method
63
- - Add `is-ios-wkwebview` method
64
-
65
- ## 1.3.0 (2017-04-11)
66
-
67
- - Add `is-ios-webview` method
68
- - Add `is-ios-safari` method
69
-
70
- ## 1.2.0 (2017-04-10)
71
-
72
- - Add `is-ie10` method
73
-
74
- ## 1.1.0 (2017-04-07)
75
-
76
- - Add `is-chrome` method
77
-
78
- ## 1.0.0 (2017-04-05)
79
-
80
- - Initial public release of browser-detection