@cardsjd/utilities 0.0.0 → 0.0.1

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.
package/lib/index.js CHANGED
@@ -1 +0,0 @@
1
- export { getOS } from './getOS';
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
- {
2
- "name": "@cardsjd/utilities",
3
- "private": false,
4
- "version": "0.0.0",
5
- "type": "module",
6
- "main": "./lib/index.js",
7
- "files": [
8
- "lib"
9
- ],
10
- "scripts": {},
11
- "devDependencies": {}
12
- }
1
+ {
2
+ "name": "@cardsjd/utilities",
3
+ "private": false,
4
+ "version": "0.0.1",
5
+ "type": "module",
6
+ "main": "./lib/index.js",
7
+ "files": [
8
+ "lib"
9
+ ],
10
+ "scripts": {},
11
+ "dependencies": {
12
+ "@capacitor/core": "^6.0.0"
13
+ }
14
+ }
package/lib/getOS.js DELETED
@@ -1,49 +0,0 @@
1
- /**
2
- * @returns {OSType}
3
- */
4
- export function getOS() {
5
- const ua = navigator.userAgent;
6
- const isCordova = typeof globalThis.cordova != 'undefined';
7
-
8
- if (typeof globalThis.FBInstant !== 'undefined') {
9
- return 'FBMessenger';
10
- }
11
-
12
- if (/(Windows Phone.*MSAppHost\/3.0)/i.test(navigator.appVersion)) {
13
- // Windows 10 UWP
14
- return 'windowsPhone';
15
- }
16
-
17
- if (/(MSAppHost\/3.0)/i.test(navigator.appVersion)) {
18
- // Windows 10 UWP
19
- return 'windows';
20
- }
21
-
22
- const isKindle = /Kindle|Silk|Amazon|KFDOWI|KFAPWA|KFSAW|KFGIWI|KFGIWI|KFAPW|KFARWI|KFTBWI|KFASWI|KFFOWI|KFJW|KFMEWI|KFOT|KFSAW|KFSOWI|KFTBW|KFTHW|KFTT|WFFOWI|KFJWA|KFJWI|KFTHWA|KFTHWI|KFAPWI|KFKAWI/i.test(ua);
23
- if (isCordova && /(android)/i.test(navigator.userAgent) && isKindle) {
24
- return 'amazon';
25
- }
26
-
27
- if (isCordova && /(android)/i.test(navigator.userAgent) && !isKindle) {
28
- return 'android';
29
- }
30
-
31
- if (isCordova && /(ipod|iphone|ipad)/i.test(navigator.userAgent) || navigator.platform === 'MacIntel') {
32
- return 'ios';
33
- }
34
-
35
- const searchParams = new URLSearchParams(window.location.search);
36
- if (searchParams.get('steamId')) {
37
- return 'Steam';
38
- }
39
-
40
- //pwa + edg = Edge
41
- const isInStandaloneMode = (window.matchMedia('(display-mode: standalone)').matches) || (globalThis.navigator.standalone) || document.referrer.includes('android-app://');
42
- if (isInStandaloneMode && /(Edg)/i.test(navigator.userAgent)) {
43
- return 'windowsPWA';
44
- }
45
-
46
- return 'web';
47
- }
48
-
49
- /** @typedef {'FBMessenger' | 'windowsPhone' | 'windows' | 'amazon' | 'android' | 'ios' | 'Steam' | 'windowsPWA' | 'web'} OSType */