mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-27 16:08:47 +03:00
BREAKING CHANGE: AR/VR devices moved to new device type: xr
This commit is contained in:
parent
39590f112d
commit
0543b87c02
@ -179,7 +179,8 @@ const Device = Object.freeze({
|
|||||||
MOBILE: 'mobile',
|
MOBILE: 'mobile',
|
||||||
SMARTTV: 'smarttv',
|
SMARTTV: 'smarttv',
|
||||||
TABLET: 'tablet',
|
TABLET: 'tablet',
|
||||||
WEARABLE: 'wearable'
|
WEARABLE: 'wearable',
|
||||||
|
XR: 'xr'
|
||||||
});
|
});
|
||||||
|
|
||||||
const Vendor = Object.freeze({
|
const Vendor = Object.freeze({
|
||||||
|
3
src/main/ua-parser.d.ts
vendored
3
src/main/ua-parser.d.ts
vendored
@ -23,7 +23,7 @@ declare namespace UAParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface IDevice extends IData<IDevice> {
|
interface IDevice extends IData<IDevice> {
|
||||||
type?: 'mobile' | 'tablet' | 'console' | 'smarttv' | 'wearable';
|
type?: 'mobile' | 'tablet' | 'console' | 'smarttv' | 'wearable' | 'xr' | 'embedded';
|
||||||
vendor?: string;
|
vendor?: string;
|
||||||
model?: string;
|
model?: string;
|
||||||
}
|
}
|
||||||
@ -76,6 +76,7 @@ declare namespace UAParser {
|
|||||||
SMARTTV: 'smarttv';
|
SMARTTV: 'smarttv';
|
||||||
TABLET: 'tablet';
|
TABLET: 'tablet';
|
||||||
WEARABLE: 'wearable';
|
WEARABLE: 'wearable';
|
||||||
|
XR: 'xr';
|
||||||
EMBEDDED: 'embedded';
|
EMBEDDED: 'embedded';
|
||||||
};
|
};
|
||||||
static readonly ENGINE: {
|
static readonly ENGINE: {
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
TABLET = 'tablet',
|
TABLET = 'tablet',
|
||||||
SMARTTV = 'smarttv',
|
SMARTTV = 'smarttv',
|
||||||
WEARABLE = 'wearable',
|
WEARABLE = 'wearable',
|
||||||
|
XR = 'xr',
|
||||||
EMBEDDED = 'embedded',
|
EMBEDDED = 'embedded',
|
||||||
USER_AGENT = 'user-agent',
|
USER_AGENT = 'user-agent',
|
||||||
UA_MAX_LENGTH = 500,
|
UA_MAX_LENGTH = 500,
|
||||||
@ -274,7 +275,8 @@
|
|||||||
'mobile' : 'Mobile',
|
'mobile' : 'Mobile',
|
||||||
'tablet' : ['Tablet', 'EInk'],
|
'tablet' : ['Tablet', 'EInk'],
|
||||||
'smarttv' : 'TV',
|
'smarttv' : 'TV',
|
||||||
'wearable' : ['VR', 'XR', 'Watch'],
|
'wearable' : 'Watch',
|
||||||
|
'xr' : ['VR', 'XR'],
|
||||||
'?' : ['Desktop', 'Unknown'],
|
'?' : ['Desktop', 'Unknown'],
|
||||||
'*' : undefined
|
'*' : undefined
|
||||||
};
|
};
|
||||||
@ -711,12 +713,17 @@
|
|||||||
], [VENDOR, MODEL, [TYPE, WEARABLE]], [
|
], [VENDOR, MODEL, [TYPE, WEARABLE]], [
|
||||||
/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i // Apple Watch
|
/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i // Apple Watch
|
||||||
], [MODEL, [VENDOR, APPLE], [TYPE, WEARABLE]], [
|
], [MODEL, [VENDOR, APPLE], [TYPE, WEARABLE]], [
|
||||||
/droid.+; (glass) \d/i // Google Glass
|
|
||||||
], [MODEL, [VENDOR, GOOGLE], [TYPE, WEARABLE]], [
|
|
||||||
/droid.+; (wt63?0{2,3})\)/i
|
/droid.+; (wt63?0{2,3})\)/i
|
||||||
], [MODEL, [VENDOR, ZEBRA], [TYPE, WEARABLE]], [
|
], [MODEL, [VENDOR, ZEBRA], [TYPE, WEARABLE]], [
|
||||||
|
|
||||||
|
///////////////////
|
||||||
|
// XR
|
||||||
|
///////////////////
|
||||||
|
|
||||||
|
/droid.+; (glass) \d/i // Google Glass
|
||||||
|
], [MODEL, [VENDOR, GOOGLE], [TYPE, XR]], [
|
||||||
/(quest( \d| pro)?)/i // Oculus Quest
|
/(quest( \d| pro)?)/i // Oculus Quest
|
||||||
], [MODEL, [VENDOR, FACEBOOK], [TYPE, WEARABLE]], [
|
], [MODEL, [VENDOR, FACEBOOK], [TYPE, XR]], [
|
||||||
|
|
||||||
///////////////////
|
///////////////////
|
||||||
// EMBEDDED
|
// EMBEDDED
|
||||||
|
@ -479,7 +479,7 @@ describe('Map UA-CH headers', function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
UAParser(FFVR).withClientHints().then(function (ua) {
|
UAParser(FFVR).withClientHints().then(function (ua) {
|
||||||
assert.strictEqual(ua.device.type, 'wearable');
|
assert.strictEqual(ua.device.type, 'xr');
|
||||||
});
|
});
|
||||||
|
|
||||||
UAParser(FFEInk).withClientHints().then(function (ua) {
|
UAParser(FFEInk).withClientHints().then(function (ua) {
|
||||||
|
@ -1373,7 +1373,7 @@
|
|||||||
"expect": {
|
"expect": {
|
||||||
"vendor": "Facebook",
|
"vendor": "Facebook",
|
||||||
"model": "Quest",
|
"model": "Quest",
|
||||||
"type": "wearable"
|
"type": "xr"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1382,7 +1382,7 @@
|
|||||||
"expect": {
|
"expect": {
|
||||||
"vendor": "Facebook",
|
"vendor": "Facebook",
|
||||||
"model": "Quest 2",
|
"model": "Quest 2",
|
||||||
"type": "wearable"
|
"type": "xr"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1391,7 +1391,7 @@
|
|||||||
"expect": {
|
"expect": {
|
||||||
"vendor": "Facebook",
|
"vendor": "Facebook",
|
||||||
"model": "Quest 3",
|
"model": "Quest 3",
|
||||||
"type": "wearable"
|
"type": "xr"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1400,7 +1400,7 @@
|
|||||||
"expect": {
|
"expect": {
|
||||||
"vendor": "Facebook",
|
"vendor": "Facebook",
|
||||||
"model": "Quest Pro",
|
"model": "Quest Pro",
|
||||||
"type": "wearable"
|
"type": "xr"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user