Skip to content

Commit 356ec17

Browse files
committed
Add page for Enums
1 parent c8c78d6 commit 356ec17

File tree

6 files changed

+329
-198
lines changed

6 files changed

+329
-198
lines changed

docs/.vitepress/config.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default defineConfig({
3131
items: [
3232
{
3333
text: 'Changelog',
34-
link: '/intro/whats-new'
34+
link: '/intro/changelog'
3535
},
3636
{
3737
text: 'Contributing',
@@ -59,7 +59,8 @@ export default defineConfig({
5959
]
6060
},
6161
{ text: 'Extending Regex', link: '/intro/extending-regex' },
62-
{ text: 'Migrating from v1 to v2', link: '/intro/whats-new' }
62+
{ text: 'Migrating from v1 to v2', link: '/intro/whats-new' },
63+
{ text: 'Changelog', link: '/intro/changelog' }
6364
]
6465
},
6566
{
@@ -139,7 +140,8 @@ export default defineConfig({
139140
text: 'Submodules',
140141
items: [
141142
{
142-
text: 'Enums'
143+
text: 'Enums',
144+
link: '/api/submodules/enums',
143145
},
144146
{
145147
text: 'Extensions',

docs/api/main/get-device.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ Get details of device information (type, vendor, model) from user-agent string.
1717

1818
::: info
1919
See list of possible device type [here](/info/device/type).
20-
21-
If you wish to detect **desktop** devices, you must handle the logic yourself, since UAParser only reports info that is directly available from user-agent string (read more about this issue [here🡭](https://github.com/faisalman/ua-parser-js/issues/182)).
2220
:::
2321

2422
---

docs/api/submodules/enums.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Enums Submodule
2+
3+
### `'ua-parser-js/enums'`
4+
5+
## `Browser`
6+
```csv:no-line-numbers
7+
"115", "2345", "360", ALIPAY, AMAYA, ANDROID, ARORA, AVANT, AVAST, AVG,
8+
BAIDU, BASILISK, BLAZER, BOLT, BOWSER, BRAVE, CAMINO, CHIMERA, CHROME,
9+
CHROME_HEADLESS, CHROME_MOBILE, CHROME_WEBVIEW, CHROMIUM, COBALT,
10+
COC_COC, CONKEROR, DAUM, DILLO, DOLPHIN, DORIS, DRAGON, DUCKDUCKGO,
11+
EDGE, EPIPHANY, FACEBOOK, FALKON, FIREBIRD, FIREFOX, FIREFOX_FOCUS,
12+
FIREFOX_MOBILE, FIREFOX_REALITY, FENNEC, FLOCK, FLOW, GO,
13+
GOOGLE_SEARCH, HELIO, HEYTAP, HONOR, HUAWEI, ICAB, ICE, ICEAPE,
14+
ICECAT, ICEDRAGON, ICEWEASEL, IE, INSTAGRAM, IRIDIUM, IRON, JASMINE,
15+
KONQUEROR, KAKAO, KHTML, K_MELEON, KLAR, KLARNA, KINDLE, LENOVO,
16+
LADYBIRD, LIBREWOLF, LIEBAO, LINE, LINKEDIN, LINKS, LUNASCAPE, LYNX,
17+
MAEMO, MAXTHON, MIDORI, MINIMO, MIUI, MOZILLA, MOSAIC, NAVER,
18+
NETFRONT, NETSCAPE, NETSURF, NOKIA, OBIGO, OCULUS, OMNIWEB, OPERA,
19+
OPERA_COAST, OPERA_MINI, OPERA_MOBI, OPERA_TABLET, OPERA_TOUCH, OVI,
20+
PALEMOON, PHANTOMJS, PHOENIX, PICOBROWSER, POLARIS, PUFFIN, QQ,
21+
QQ_LITE, QUARK, QUPZILLA, REKONQ, ROCKMELT, SAFARI, SAFARI_MOBILE,
22+
SAILFISH, SAMSUNG, SEAMONKEY, SILK, SKYFIRE, SLEIPNIR, SLIMBOAT,
23+
SLIMBROWSER, SLIMJET, SNAPCHAT, SOGOU_EXPLORER, SOGOU_MOBILE,
24+
SWIFTFOX, TESLA, TIKTOK, TIZEN, TWITTER, UC, UP, VIVALDI, VIVO,
25+
W3M, WATERFOX, WEBKIT, WECHAT, WEIBO, WHALE, WOLVIC, YANDEX
26+
```
27+
::: info
28+
See list of possible browser name [here](/info/browser/name).
29+
:::
30+
31+
## `BrowserType`
32+
```csv:no-line-numbers
33+
CRAWLER, CLI, EMAIL, FETCHER, INAPP, MEDIAPLAYER, LIBRARY
34+
```
35+
::: info
36+
Find the example of various browser types in [**ua-parser-js/extensions**](/api/submodules/extensions/overview) submodule.
37+
:::
38+
39+
## `CPU`
40+
```csv:no-line-numbers
41+
"68K", ARM, ARM_64, ARM_HF, AVR, AVR_32, IA64, IRIX, IRIX_64, MIPS,
42+
MIPS_64, PA_RISC, PPC, SPARC, SPARC_64, X86, X86_64
43+
```
44+
::: info
45+
See list of possible cpu architecture [here](/info/cpu/arch).
46+
:::
47+
48+
## `Device`
49+
```csv:no-line-numbers
50+
CONSOLE, DESKTOP, EMBEDDED, MOBILE, SMARTTV, TABLET, WEARABLE, XR
51+
```
52+
::: info
53+
See list of possible device type [here](/info/device/type).
54+
:::
55+
56+
## `Vendor`
57+
```csv:no-line-numbers
58+
ACER, ADVAN, ALCATEL, APPLE, AMAZON, ARCHOS, ASUS, ATT, BENQ,
59+
BLACKBERRY, CAT, DELL, ENERGIZER, ESSENTIAL, FACEBOOK, FAIRPHONE,
60+
GEEKSPHONE, GENERIC, GOOGLE, HMD, HP, HTC, HUAWEI, IMO, INFINIX,
61+
ITEL, JOLLA, KOBO, LENOVO, LG, MEIZU, MICROMAX, MICROSOFT, MOTOROLA,
62+
NEXIAN, NINTENDO, NOKIA, NOTHING, NVIDIA, ONEPLUS, OPPO, OUYA, PALM,
63+
PANASONIC, PEBBLE, PICO, POLYTRON, REALME, RIM, ROKU, SAMSUNG, SHARP,
64+
SIEMENS, SMARTFREN, SONY, SPRINT, TCL, TECHNISAT, TECNO, TESLA,
65+
ULEFONE, VIVO, VODAFONE, XBOX, XIAOMI, ZEBRA, ZTE
66+
```
67+
::: info
68+
See list of possible device vendor [here](/info/device/vendor).
69+
:::
70+
71+
## `Engine`
72+
```csv:no-line-numbers
73+
AMAYA, ARKWEB, BLINK, EDGEHTML, FLOW, GECKO, GOANNA, ICAB, KHTML,
74+
LIBWEB, LINKS, LYNX, NETFRONT, NETSURF, PRESTO, SERVO, TASMAN,
75+
TRIDENT, W3M, WEBKIT
76+
```
77+
::: info
78+
See list of possible engine name [here](/info/engine/name).
79+
:::
80+
81+
## `OS`
82+
```csv:no-line-numbers
83+
AIX, AMIGA_OS, ANDROID, ANDROID_X86, ARCH, BADA, BEOS, BLACKBERRY,
84+
CENTOS, CHROME_OS, CHROMECAST, CHROMECAST_ANDROID, CHROMECAST_FUCHSIA,
85+
CHROMECAST_LINUX, CHROMECAST_SMARTSPEAKER, CONTIKI, DEBIAN, DEEPIN,
86+
DRAGONFLY, ELEMENTARY_OS, FEDORA, FIREFOX_OS, FREEBSD, FUCHSIA,
87+
GENTOO, GHOSTBSD, GNU, HAIKU, HARMONYOS, HP_UX, HURD, IOS, JOLI,
88+
KAIOS, KUBUNTU, LINPUS, LINSPIRE, LINUX, MACOS, MAEMO, MAGEIA,
89+
MANDRIVA, MANJARO, MEEGO, MINIX, MINT, MORPH_OS, NETBSD, NETRANGE,
90+
NETTV, NINTENDO, OPENHARMONY, OPENBSD, OPENVMS, OS2, PALM, PC_BSD,
91+
PCLINUXOS, PICO, PLAN9, PLAYSTATION, QNX, RASPBIAN, REDHAT,
92+
RIM_TABLET_OS, RISC_OS, SABAYON, SAILFISH, SERENITYOS, SERIES40,
93+
SLACKWARE, SOLARIS, SUSE, SYMBIAN, TIZEN, UBUNTU, UBUNTU_TOUCH,
94+
UNIX, VECTORLINUX, WATCHOS, WEBOS, WINDOWS, WINDOWS_IOT,
95+
WINDOWS_MOBILE, WINDOWS_PHONE, XBOX, ZENWALK
96+
```
97+
::: info
98+
See list of possible os name [here](/info/os/name).
99+
:::
100+
101+
102+
## Code Example
103+
104+
- Match for a specific `os.name`:
105+
106+
```js
107+
import { UAParser } from 'ua-parser-js';
108+
import { OS } from 'ua-parser-js/enums';
109+
110+
if (UAParser().os.name == OS.RIM_TABLET_OS) {
111+
console.log('Are you for real?');
112+
}
113+
```
114+
115+
- Match for a specific `browser.type`:
116+
117+
```js
118+
import { UAParser } from 'ua-parser-js';
119+
import { Bots } from 'ua-parser-js/extensions';
120+
import { BrowserType } from 'ua-parser-js/enums';
121+
122+
const botParser = new UAParser(Bots);
123+
const typeofBrowser = botParser.setUA(req.headers['user-agent']).getBrowser().type;
124+
if (typeofBrowser == BrowserType.CRAWLER) {
125+
console.log('Hi, hello there Spidey!');
126+
}
127+
```

docs/info/device/type.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,9 @@ Type of the device.
1010
| `smarttv` | Smart TVs or similar devices. | `LG Smart TV`, `Samsung Smart TV` |
1111
| `tablet` | Portable touchscreen devices larger than smartphones but smaller than laptops. | `Apple iPad`, `Samsung Galaxy Tab` |
1212
| `wearable` | Devices worn on the body, such as smartwatches or fitness trackers. | `Pebble`, `Apple Watch` |
13-
| `xr` | Extended reality (XR) devices, encompassing virtual reality (VR) and augmented reality (AR) headsets. | `Google Glass`, `Oculus Quest` |
13+
| `xr` | Extended reality (XR) devices, encompassing virtual reality (VR) and augmented reality (AR) headsets. | `Google Glass`, `Oculus Quest` |
14+
15+
16+
::: tip
17+
If you wish to detect **desktop** devices, you must handle the logic yourself, since UAParser only reports info that is directly available from user-agent string (read more about this issue [here🡭](https://github.com/faisalman/ua-parser-js/issues/182)).
18+
:::

docs/intro/changelog.md

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
# UAParser.js Changelog
2+
3+
## Version 2.0.0
4+
5+
- `ua-parser-js/extensions` submodule:
6+
- Add new CLI: ELinks, HTTPie
7+
- Add new crawler: AI2Bot, aiHitBot, anthropic-ai, Diffbot, ImagesiftBot, magpie-crawler, Omgilibot, Screaming Frog SEO Spider, Seznambot, Teoma, Timpibot, VelenPublicWebCrawler, Webzio-Extended, YouBot
8+
- Add new email: Airmail, BlueMail, eMClient, NaverMailApp, Sparrow, Yahoo
9+
- Add new fetcher: cohere-ai, Vercelbot
10+
- Add new library: java, python-urllib, python-requests
11+
- `ua-parser-js/helpers` submodule:
12+
- Add new method `isAIBot()`: Checks if the user-agent is an AI bot
13+
14+
## Version 2.0.0-rc.3
15+
16+
- Add support for Headers object
17+
- Add new device: Advan, Cat, Energizer, Honor, IMO, Micromax, Smartfren
18+
- Add new engine: Servo
19+
- `ua-parser-js/extensions` submodule:
20+
- Breaking change: rename `module` to `library`
21+
- Add new email clients: Evolution, KMail, Kontact
22+
- Add new bots: 360Spider, Archive.org Bots, CCBot, DataForSeoBot, DuckAssistBot, Exabot, Google Bots, Meta Bots, MojeekBot, PerplexityBot, PetalBot, TurnitinBot, Yeti, YisouSpider
23+
24+
## Version 2.0.0-rc.2
25+
26+
- Fix incorrect import path in ESM files
27+
- Add new browser: 115, SlimBoat, Slimjet, LibreWolf
28+
- Improve browser detection: 2345, 360, Dragon, Iron, Maxthon
29+
- `ua-parser-js/enums` submodule:
30+
- Add Chromecast OS variants: Android/Fuchsia/Linux/SmartSpeaker
31+
- `ua-parser-js/helpers` submodule:
32+
- Add new method: `isBot()` to check if the browser is identified as a bot
33+
34+
## Version 2.0.0-rc.1
35+
36+
- Fix Python Request mistakenly identified as Meta Quest
37+
- Add new browser: Helio
38+
- Add new device: itel, Nothing, Pico, TCL
39+
- Add new engine: ArkWeb
40+
- Add new OS: OpenHarmony, Pico
41+
- Improve browser detection: Quark
42+
- Improve device detection: Xiaomi, Amazon Echo Show, Google Chromecast, Samsung Galaxy Watch
43+
- `ua-parser-js/helpers` submodule:
44+
- Add new method:
45+
- `getDeviceVendor()` to guess for a device vendor based on its model name
46+
- `isElectron()` to check if current window is running inside Electron
47+
- `isFromEU()` to check if current window is from an EU (European Union) country
48+
- `isStandalonePWA()` to check if current window is a standalone PWA
49+
- Rename `isChromiumBased()` to `isChromeFamily()`
50+
- Update `isAppleSilicon()` to also checks for WebGL renderer info
51+
- `ua-parser-js/extensions` submodule:
52+
- Restore `Bots` as a compilation of all these browser types: `cli`, `crawler`, `fetcher`, and `library`
53+
54+
## Version 2.0.0-beta.3
55+
56+
- Breaking:
57+
- AR/VR devices moved to new device type: `xr`
58+
- New property in `browser`: `type`
59+
- New features:
60+
- Parse directly from command line using `npx ua-parser-js`
61+
- Extensions can be passed as a list to `UAParser()`
62+
- Add new browser: Pico Browser, Twitter, Wolvic
63+
- Improve browser detection: DuckDuckGo, ICEBrowser, Klar, QQ, Sleipnir
64+
- Improve device detection: Oculus Quest & Oppo Pad
65+
- Update latest client hints spec: `formFactor` -> `formFactors`
66+
- In `ua-parser-js/extensions` submodule, `bots` divided into `crawler` / `fetcher`
67+
68+
## Version 2.0.0-beta.2
69+
70+
- Increase UA_MAX_LENGTH to 500
71+
- Add TypeScript declaration file in `ua-parser-js/extensions` submodule
72+
- Improve TypeScript module resolution
73+
- Add new methods in `ua-parser-js/helpers` submodule: `isAppleSilicon()` & `isChromiumBased()`
74+
- Fix misidentified WebView token as device model
75+
- Add new browser: Alipay, Klarna, Opera GX, Smart Lenovo Browser, Vivo Browser
76+
- Rename browser: Avant, Baidu, Samsung Internet, Sogou Explorer, Sogou Mobile, WeChat
77+
- Improve client-hints detection: Edge, Xbox
78+
79+
## Version 2.0.0-beta.1
80+
81+
- Update Client Hints Form-Factor
82+
- Provide in-package type definitions
83+
- Add new device: Ulefone
84+
- Improve device detection: Realme, Xiaomi Redmi
85+
86+
## Version 2.0.0-alpha.3
87+
88+
- Add `withFeatureCheck()` method
89+
- Add `isFrozenUA()` method in `ua-parser-js/helpers` submodule
90+
- Add `MediaPlayers` & `Modules` in `ua-parser-js/extensions` submodule
91+
- Fix issue with ESM import
92+
93+
## Version 2.0.0-alpha.2
94+
95+
- Fix browser result always returning Chromium when using withClientHints()
96+
- Fix infinite-loop when await-ing withClientHints() in non-client-hints browser
97+
98+
## Version 2.0.0-alpha.1
99+
100+
- Initial work on new major version
101+
102+
---
103+
104+
## Version 0.7.38 / 1.0.38
105+
- Fix error on getOS() when userAgentData.platform is undefined
106+
- Add new browser: Opera GX, Twitter
107+
- Improve browser detection: DuckDuckGo
108+
- Improve device detection: OPPO Pad, Oculus Quest
109+
110+
## Version 0.7.37 / 1.0.37
111+
- Fix misidentified WebView token as device model
112+
- Increase UA_MAX_LENGTH to 500
113+
- Add new browser: Alipay, Klarna, Smart Lenovo Browser, Vivo Browser
114+
- Add new device: Ulefone
115+
- Improve device detection: Realme, Xiaomi Redmi
116+
- Rename browser: Avant, Baidu, Samsung Internet, Sogou Explorer, Sogou Mobile, WeChat
117+
118+
## Version 0.7.36 / 1.0.36
119+
- Add new browser: Snapchat
120+
- Add new devices: Infinix, Tecno
121+
- Improve device detection: Amazon Fire TV, Xiaomi POCO
122+
- Improve OS detection: iOS
123+
124+
## Version 0.7.35 / 1.0.35
125+
- Fix result from user-supplied user-agent being altered
126+
- Add new browser: Heytap, TikTok
127+
- Add new engine: LibWeb
128+
- Add new OS: SerenityOS
129+
- Improve browser detection: Yandex
130+
- Improve device detection: iPhone, Amazon Echo
131+
- Improve OS detection: iOS
132+
133+
## Version 0.7.34 / 1.0.34
134+
- Fix Sharp Mobile detected as Huawei Tablet
135+
- Fix IE8 bug
136+
- Add new devices : Kobo e-Reader, Apple Watch, and some new SmartTV devices
137+
- Add new OS : watchOS
138+
- Improve browser detection : Kakao, Naver, Brave
139+
- Improve device detection : Oculus, iPad
140+
- Improve OS detection : Chrome OS
141+
- Using navigator.userAgentData as fallback for device.type & os.name
142+
143+
## Version 0.7.33 / 1.0.33
144+
145+
- Add new browser : Cobalt
146+
- Identify Macintosh as an Apple device
147+
- Fix ReDoS vulnerability
148+
149+
## Version 0.7.32 / 1.0.32
150+
151+
- Add new browser : DuckDuckGo, Huawei Browser, LinkedIn
152+
- Add new OS : HarmonyOS
153+
- Add some Huawei models
154+
- Add Sharp Aquos TV
155+
- Improve detection Xiaomi Mi CC9
156+
- Fix Sony Xperia 1 III misidentified as Acer tablet
157+
- Fix Detect Sony BRAVIA as SmartTV
158+
- Fix Detect Xiaomi Mi TV as SmartTV
159+
- Fix Detect Galaxy Tab S8 as tablet
160+
- Fix WeGame mistakenly identified as WeChat
161+
- Fix included commas in Safari / Mobile Safari version
162+
- Increase UA_MAX_LENGTH to 350
163+
164+
## Version 0.7.31 / 1.0.2
165+
166+
- Fix OPPO Reno A5 incorrect detection
167+
- Fix TypeError Bug
168+
- Use AST to extract regexes and verify them with safe-regex
169+
170+
## Version 0.7.30 / 1.0.1
171+
172+
- Add new browser : Obigo, UP.Browser, Klar
173+
- Add new device : Oculus, Roku
174+
- Add new OS: Maemo, HP-UX, Android-x86, Deepin, elementary OS, GhostBSD, Linspire, Manjaro, Sabayon
175+
- Improve detection for Sony Xperia 1ii, LG Android TV, and some more devices
176+
- Improve detection for ARM64 CPU
177+
- Improve detection for Windows Mobile, Netscape, Mac on PowerPC
178+
- Categorize PDA as mobile
179+
- Fix Sharp devices misjudged as Huawei
180+
- Fix trailing comma for ES3 compatibility
181+
- Some code refactor
182+
183+
## Version 0.7 / 1.0
184+
185+
Version 1.0.x is basically the equivalent of version 0.7.x (mirror/duplicate). See [#536](https://github.com/faisalman/ua-parser-js/issues/536) for the reason behind this confusion.
186+
187+
## Version 0.8
188+
189+
Version 0.8 was created by accident. This version is now deprecated and no longer maintained, please update to version 0.7 / 1.0.

0 commit comments

Comments
 (0)