react-user-agent-client-hints
Advanced tools
Comparing version 0.1.7 to 0.2.0
@@ -19,3 +19,3 @@ "use strict"; | ||
}; | ||
const highEntropyUserAgentData = Object.assign(Object.assign({}, lowEntropyUserAgentData), { architecture: "x86", bitness: "64", model: "Pixel 2XL", platformVersion: "10.0" }); | ||
const highEntropyUserAgentData = Object.assign(Object.assign({}, lowEntropyUserAgentData), { architecture: "x86", bitness: "64", model: "Pixel 2XL", platformVersion: "10.0", fullVersionList: [{ brand: "Google Chrome", version: "200.0.3333.99" }] }); | ||
Object.defineProperty(navigator, "userAgentData", { | ||
@@ -22,0 +22,0 @@ value: { |
@@ -45,3 +45,2 @@ "use strict"; | ||
if ((0, types_1.isUADataValues)(data)) { | ||
console.log(data); | ||
dispatch({ type: HIGH_ENTROPY, payload: data }); | ||
@@ -71,3 +70,3 @@ } | ||
} | ||
getUserAgentData().catch(err => { | ||
void getUserAgentData().catch(err => { | ||
if (err instanceof Error) | ||
@@ -74,0 +73,0 @@ setError(err); |
@@ -13,3 +13,3 @@ export interface NavigatorUABrandVersion { | ||
readonly platformVersion?: string; | ||
readonly uaFullVersion?: string; | ||
readonly fullVersionList?: NavigatorUABrandVersion[]; | ||
} | ||
@@ -21,3 +21,3 @@ export interface UALowEntropyJSON { | ||
} | ||
export declare type Hint = "architecture" | "model" | "bitness" | "platformVersion" | "fullVersionList" | "uaFullVersion"; | ||
export declare type Hint = "architecture" | "model" | "bitness" | "platformVersion" | "fullVersionList"; | ||
export declare type HighEntropy = "high"; | ||
@@ -24,0 +24,0 @@ export declare type LowEntropy = "low"; |
@@ -7,8 +7,2 @@ "use strict"; | ||
exports.isUALowEntropyJSON = exports.isUADataValues = void 0; | ||
// function hasKey<K extends string, T extends object>( | ||
// k: K, | ||
// o: T | ||
// ): o is T & Record<K, unknown> { | ||
// return k in o | ||
// } | ||
function isDefined(params) { | ||
@@ -26,4 +20,2 @@ return params !== undefined; | ||
(!isDefined(params.bitness) || typeof params.bitness === "string") && | ||
(!isDefined(params.uaFullVersion) || | ||
typeof params.uaFullVersion === "string") && | ||
(!isDefined(params.model) || typeof params.model === "string") && | ||
@@ -30,0 +22,0 @@ (!isDefined(params.platformVersion) || |
{ | ||
"name": "react-user-agent-client-hints", | ||
"version": "0.1.7", | ||
"version": "0.2.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
# React User Agent Client Hints | ||
React hook implementing the User-Agent Client Hints API to get information about the browser and operating system of a user. | ||
[![codecov](https://codecov.io/gh/zaknicholsdev/react-user-agent-client-hints/branch/develop/graph/badge.svg)](https://codecov.io/gh/zaknicholsdev/react-user-agent-client-hints) | ||
@@ -7,4 +9,2 @@ | ||
React hook implementing the User-Agent Client Hints API to get information about the browser and operating system of a user. | ||
### Potential Use Cases | ||
@@ -11,0 +11,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
29573
505