chayns-api 1.1.6 → 1.1.8
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.
|
@@ -25,13 +25,16 @@ const System = ({
|
|
|
25
25
|
});
|
|
26
26
|
const Component = (0, _react.useMemo)(() => {
|
|
27
27
|
// maybe return waitcursor instead
|
|
28
|
-
if (
|
|
28
|
+
if (failed) {
|
|
29
|
+
throw new Error('failed to load component');
|
|
30
|
+
}
|
|
31
|
+
if (!system || !ready) {
|
|
29
32
|
return null;
|
|
30
33
|
}
|
|
31
34
|
return /*#__PURE__*/_react.default.lazy((0, _loadComponent.default)(system.scope, system.module, system.url, undefined, system.preventSingleton));
|
|
32
35
|
|
|
33
36
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
34
|
-
}, [system === null || system === void 0 ? void 0 : system.scope, ready, system === null || system === void 0 ? void 0 : system.url]);
|
|
37
|
+
}, [system === null || system === void 0 ? void 0 : system.scope, ready, failed, system === null || system === void 0 ? void 0 : system.url]);
|
|
35
38
|
return Component ? /*#__PURE__*/_react.default.createElement(_react.default.Suspense, {
|
|
36
39
|
fallback: fallback || ''
|
|
37
40
|
}, /*#__PURE__*/_react.default.createElement(Component, props)) : fallback;
|
|
@@ -46,7 +46,7 @@ const getDeviceInfo = (userAgent, acceptHeader) => {
|
|
|
46
46
|
callVersion: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN
|
|
47
47
|
};
|
|
48
48
|
result.imei = undefined; // TODO
|
|
49
|
-
result.
|
|
49
|
+
result.engine = uaParser.getEngine();
|
|
50
50
|
result.os = ((_uaParser$getOS = uaParser.getOS()) === null || _uaParser$getOS === void 0 ? void 0 : _uaParser$getOS.name) === 'Android' ? 'Android OS' : (_uaParser$getOS2 = uaParser.getOS()) === null || _uaParser$getOS2 === void 0 ? void 0 : _uaParser$getOS2.name;
|
|
51
51
|
if (typeof window !== 'undefined') {
|
|
52
52
|
result.screenSize = getScreenSize(window.innerWidth);
|
|
@@ -17,13 +17,16 @@ const System = _ref => {
|
|
|
17
17
|
});
|
|
18
18
|
const Component = useMemo(() => {
|
|
19
19
|
// maybe return waitcursor instead
|
|
20
|
-
if (
|
|
20
|
+
if (failed) {
|
|
21
|
+
throw new Error('failed to load component');
|
|
22
|
+
}
|
|
23
|
+
if (!system || !ready) {
|
|
21
24
|
return null;
|
|
22
25
|
}
|
|
23
26
|
return /*#__PURE__*/React.lazy(loadComponent(system.scope, system.module, system.url, undefined, system.preventSingleton));
|
|
24
27
|
|
|
25
28
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
26
|
-
}, [system === null || system === void 0 ? void 0 : system.scope, ready, system === null || system === void 0 ? void 0 : system.url]);
|
|
29
|
+
}, [system === null || system === void 0 ? void 0 : system.scope, ready, failed, system === null || system === void 0 ? void 0 : system.url]);
|
|
27
30
|
return Component ? /*#__PURE__*/React.createElement(React.Suspense, {
|
|
28
31
|
fallback: fallback || ''
|
|
29
32
|
}, /*#__PURE__*/React.createElement(Component, props)) : fallback;
|
|
@@ -40,7 +40,7 @@ const getDeviceInfo = (userAgent, acceptHeader) => {
|
|
|
40
40
|
callVersion: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN
|
|
41
41
|
};
|
|
42
42
|
result.imei = undefined; // TODO
|
|
43
|
-
result.
|
|
43
|
+
result.engine = uaParser.getEngine();
|
|
44
44
|
result.os = ((_uaParser$getOS = uaParser.getOS()) === null || _uaParser$getOS === void 0 ? void 0 : _uaParser$getOS.name) === 'Android' ? 'Android OS' : (_uaParser$getOS2 = uaParser.getOS()) === null || _uaParser$getOS2 === void 0 ? void 0 : _uaParser$getOS2.name;
|
|
45
45
|
if (typeof window !== 'undefined') {
|
|
46
46
|
result.screenSize = getScreenSize(window.innerWidth);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IBrowser } from 'ua-parser-js';
|
|
1
|
+
import { IBrowser, IEngine } from 'ua-parser-js';
|
|
2
2
|
import DialogHandler from '../handler/DialogHandler';
|
|
3
3
|
import { DialogButtonOld, SelectDialogItem } from './dialog';
|
|
4
4
|
export type DialogButton = {
|
|
@@ -181,6 +181,7 @@ export type ChaynsApiDevice = {
|
|
|
181
181
|
majorVersion: number;
|
|
182
182
|
isWebPSupported: boolean;
|
|
183
183
|
};
|
|
184
|
+
engine?: IEngine;
|
|
184
185
|
imei?: string;
|
|
185
186
|
accessToken?: string;
|
|
186
187
|
os?: 'AIX' | 'Amiga OS' | 'Android OS' | 'Arch' | 'Bada' | 'BeOS' | 'BlackBerry' | 'CentOS' | 'Chromium OS' | 'Contiki' | 'Fedora' | 'Firefox OS' | 'FreeBSD' | 'Debian' | 'DragonFly' | 'Gentoo' | 'GNU' | 'Haiku' | 'Hurd' | 'iOS' | 'Joli' | 'Linpus' | 'Linux' | 'Mac OS' | 'Mageia' | 'Mandriva' | 'MeeGo' | 'Minix' | 'Mint' | 'Morph OS' | 'NetBSD' | 'Nintendo' | 'OpenBSD' | 'OpenVMS' | 'OS/2' | 'Palm' | 'PCLinuxOS' | 'Plan9' | 'Playstation' | 'QNX' | 'RedHat' | 'RIM Tablet OS' | 'RISC OS' | 'Sailfish' | 'Series40' | 'Slackware' | 'Solaris' | 'SUSE' | 'Symbian' | 'Tizen' | 'Ubuntu' | 'UNIX' | 'VectorLinux' | 'WebOS' | 'Windows' | 'Windows Phone' | 'Windows Mobile' | 'Zenwalk' | null;
|