@ombori/ga-settings
Advanced tools
Comparing version 2.55.0 to 2.63.3
@@ -6,2 +6,13 @@ # Change Log | ||
## [2.63.3](https://github.com/ombori/gridapp/compare/v2.63.2...v2.63.3) (2021-06-07) | ||
### Bug Fixes | ||
* device info in ga-settings ([494f05c](https://github.com/ombori/gridapp/commit/494f05c755b1121f6e2975af2b33fdc0b4667c79)) | ||
# [2.55.0](https://github.com/ombori/gridapp/compare/v2.54.4...v2.55.0) (2021-04-30) | ||
@@ -8,0 +19,0 @@ |
@@ -7,2 +7,6 @@ declare global { | ||
export declare function useSettings<T>(): T | null; | ||
export declare type DeviceInfo = { | ||
id: string; | ||
name: string; | ||
}; | ||
export declare type AppInfo = { | ||
@@ -19,9 +23,34 @@ appDisplayName: string; | ||
type: string; | ||
device?: DeviceInfo; | ||
}; | ||
export declare const useAppInfo: () => AppInfo | null; | ||
export declare const useAppInfo: () => AppInfo | { | ||
device: DeviceInfo | null; | ||
appDisplayName: string; | ||
appId: string; | ||
appName: string; | ||
defaultLanguage: string; | ||
organizationId: string; | ||
organizationName: string; | ||
provider: string; | ||
release: string; | ||
supportedLanguages: string[]; | ||
type: string; | ||
} | null; | ||
declare const _default: { | ||
useSettings: typeof useSettings; | ||
useAppInfo: () => AppInfo | null; | ||
useAppInfo: () => AppInfo | { | ||
device: DeviceInfo | null; | ||
appDisplayName: string; | ||
appId: string; | ||
appName: string; | ||
defaultLanguage: string; | ||
organizationId: string; | ||
organizationName: string; | ||
provider: string; | ||
release: string; | ||
supportedLanguages: string[]; | ||
type: string; | ||
} | null; | ||
}; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,13 @@ | ||
import { useEffect, useState } from 'react'; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
import { useEffect, useMemo, useState } from 'react'; | ||
var globalSettings = null; | ||
@@ -32,2 +43,14 @@ var globalInfo = null; | ||
} | ||
var getDeviceInfo = function () { | ||
var data = /GridOS\/[0-9.]+ \((.+)\)/.exec(navigator.userAgent); | ||
if (!data || !data[1]) | ||
return null; | ||
return data[1].split("; ") | ||
.map(function (line) { return line.split("="); }) | ||
.reduce(function (res, _a) { | ||
var _b; | ||
var name = _a[0], val = _a[1]; | ||
return (__assign(__assign({}, res), (_b = {}, _b[name] = val, _b))); | ||
}, {}); | ||
}; | ||
export var useAppInfo = function () { | ||
@@ -37,4 +60,9 @@ if (IS_DEV) | ||
var settings = useSettings(); | ||
return settings ? settings._general : null; | ||
return useMemo(function () { | ||
if (!settings || !settings._general) | ||
return null; | ||
var device = getDeviceInfo(); | ||
return __assign(__assign({}, settings._general), { device: device }); | ||
}, [settings]); | ||
}; | ||
export default { useSettings: useSettings, useAppInfo: useAppInfo }; |
{ | ||
"name": "@ombori/ga-settings", | ||
"version": "2.55.0", | ||
"version": "2.63.3", | ||
"main": "dist/index.js", | ||
@@ -19,3 +19,3 @@ "license": "UNLICENSED", | ||
}, | ||
"gitHead": "f6e19e0e6163a7b54c19e9912e795a90de6b889d" | ||
"gitHead": "063a45892482026be6b5a3b2cf1c1fa7a7a845c4" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
11696
9
216
1
12