@braintree/browser-detection 1.12.1 → 1.13.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
  };
@@ -8,7 +8,12 @@ module.exports = function isIosWebview(ua) {
8
8
  if (isIosGoogleSearchApp(ua)) {
9
9
  return true;
10
10
  }
11
- return /.+AppleWebKit(?!.*Safari)/.test(ua);
11
+ return (
12
+ // Historically, a webview could be identified by the presence of AppleWebKit and _no_ presence of Safari after.
13
+ /.+AppleWebKit(?!.*Safari)/i.test(ua) ||
14
+ // A webview can now have 'Safari', but if it does, then we want to check the `safari` window prop as webviews won't have it.
15
+ (ua.indexOf("Safari") > -1 &&
16
+ (!window.safari || !window.safari.pushNotification)));
12
17
  }
13
18
  return false;
14
19
  };
@@ -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.1",
3
+ "version": "1.13.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": "^27.0.2",
14
- "@types/node": "^16.9.6",
15
- "eslint": "^7.32.0",
16
- "eslint-config-braintree": "^5.0.0-typescript-prep-rc.18",
17
- "jest": "^27.2.1",
18
- "prettier": "^2.4.1",
19
- "ts-jest": "^27.0.5",
20
- "typescript": "^4.4.3"
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,84 +0,0 @@
1
- # Browser Detection - Release Notes
2
-
3
- # 1.12.1 (2021-09-28)
4
-
5
- - Correct `is-ios-safari` to return `false` for the Facebook browser
6
-
7
- # 1.12.0 (2021-06-08)
8
-
9
- - Add `is-duckduckgo` method
10
- - Add `is-ios-google-search-app` method
11
- - Add `is-opera` method
12
- - Add `is-silk` method
13
- - Fix issue where `is-chrome` would incorrectly report `true` for DuckDuckGo and Silk browsers
14
- - Fix issue where `supports-popups` would incorrectly report `false` for DuckDuckGo
15
-
16
- # 1.11.1 (2021-04-07)
17
-
18
- - Fix issue where `is-ios-safari` was returning `true` for iOS Firefox browsers
19
-
20
- # 1.11.0 (2020-10-27)
21
-
22
- - Add `has-software-keyboard` method
23
-
24
- # 1.10.1 (2020-10-19)
25
-
26
- - Fix issue where typescript declarations did not get published
27
-
28
- # 1.10.0 (2020-07-10)
29
-
30
- - Add typescript types
31
-
32
- ## v1.9.0 (2019-09-18)
33
-
34
- - Add `is-firefox` method
35
-
36
- ## v1.8.0 (2019-08-07)
37
-
38
- - Add `is-chrome-os` method
39
- - Fix README typo for iOS
40
- - Update README code samples to use `const`
41
-
42
- ## 1.7.0 (2017-10-18)
43
-
44
- - Add `supports-payment-request-api` method
45
-
46
- ## 1.6.0 (2017-07-25)
47
-
48
- - Correct is-chrome to not return true on edge browser
49
- - Correct supports-popups to not return true on iOS Firefox
50
- - Add `is-samsung-browser` method
51
- - Add `is-mobile-firefox` method
52
- - Add `is-ios-firefox` method
53
-
54
- ## 1.5.0 (2017-07-03)
55
-
56
- - Add `is-ie` method
57
- - Add `is-ie11` method
58
- - Add `is-edge` method
59
-
60
- ## 1.4.1 (2017-06-01)
61
-
62
- - publish to npm as scoped package `@braintree/browser-detection`
63
-
64
- ## 1.4.0 (2017-05-22)
65
-
66
- - Add `is-ios-uiwebview` method
67
- - Add `is-ios-wkwebview` method
68
-
69
- ## 1.3.0 (2017-04-11)
70
-
71
- - Add `is-ios-webview` method
72
- - Add `is-ios-safari` method
73
-
74
- ## 1.2.0 (2017-04-10)
75
-
76
- - Add `is-ie10` method
77
-
78
- ## 1.1.0 (2017-04-07)
79
-
80
- - Add `is-chrome` method
81
-
82
- ## 1.0.0 (2017-04-05)
83
-
84
- - Initial public release of browser-detection