chayns-api 1.1.4 → 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.
- package/dist/cjs/host/module/ModuleHost.js +5 -2
- package/dist/cjs/util/deviceHelper.js +3 -3
- package/dist/cjs/util/is.js +1 -1
- package/dist/esm/host/module/ModuleHost.js +5 -2
- package/dist/esm/util/deviceHelper.js +3 -3
- package/dist/esm/util/is.js +1 -1
- package/dist/types/calls/index.d.ts +0 -8
- package/dist/types/types/IChaynsReact.d.ts +3 -2
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -7,7 +7,7 @@ exports.getScreenSize = exports.getClientDeviceInfo = exports.default = void 0;
|
|
|
7
7
|
var _uaParserJs = require("ua-parser-js");
|
|
8
8
|
var _IChaynsReact = require("../types/IChaynsReact");
|
|
9
9
|
const getDeviceInfo = (userAgent, acceptHeader) => {
|
|
10
|
-
var _match$groups, _match$groups2, _customMatch$groups, _browser$version$spli, _browser$version, _uaParser$getOS;
|
|
10
|
+
var _match$groups, _match$groups2, _customMatch$groups, _browser$version$spli, _browser$version, _uaParser$getOS, _uaParser$getOS2;
|
|
11
11
|
const uaParser = new _uaParserJs.UAParser(userAgent);
|
|
12
12
|
let appName = _IChaynsReact.AppName.Unknown;
|
|
13
13
|
const match = /(?:my)?chayns\/(?<version>\d+).*(?<siteId>\d{5}-\d{5})/i.exec(userAgent);
|
|
@@ -46,8 +46,8 @@ 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.
|
|
50
|
-
result.os = (_uaParser$getOS = uaParser.getOS()) === null || _uaParser$getOS === void 0 ? void 0 : _uaParser$getOS.name;
|
|
49
|
+
result.engine = uaParser.getEngine();
|
|
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);
|
|
53
53
|
result.isTouch = getClientDeviceInfo().isTouch;
|
package/dist/cjs/util/is.js
CHANGED
|
@@ -22,7 +22,7 @@ const isAppCallSupported = ({
|
|
|
22
22
|
if (device.os && ['iOS', 'Mac OS'].includes(device.os)) {
|
|
23
23
|
return device.app.callVersion >= minIOSVersion;
|
|
24
24
|
}
|
|
25
|
-
if (device.os === 'Android') {
|
|
25
|
+
if (device.os === 'Android OS') {
|
|
26
26
|
return device.app.callVersion >= minAndroidVersion;
|
|
27
27
|
}
|
|
28
28
|
return false;
|
|
@@ -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;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UAParser } from 'ua-parser-js';
|
|
2
2
|
import { AppName, ScreenSize } from '../types/IChaynsReact';
|
|
3
3
|
const getDeviceInfo = (userAgent, acceptHeader) => {
|
|
4
|
-
var _match$groups, _match$groups2, _customMatch$groups, _browser$version$spli, _browser$version, _uaParser$getOS;
|
|
4
|
+
var _match$groups, _match$groups2, _customMatch$groups, _browser$version$spli, _browser$version, _uaParser$getOS, _uaParser$getOS2;
|
|
5
5
|
const uaParser = new UAParser(userAgent);
|
|
6
6
|
let appName = AppName.Unknown;
|
|
7
7
|
const match = /(?:my)?chayns\/(?<version>\d+).*(?<siteId>\d{5}-\d{5})/i.exec(userAgent);
|
|
@@ -40,8 +40,8 @@ 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.
|
|
44
|
-
result.os = (_uaParser$getOS = uaParser.getOS()) === null || _uaParser$getOS === void 0 ? void 0 : _uaParser$getOS.name;
|
|
43
|
+
result.engine = uaParser.getEngine();
|
|
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);
|
|
47
47
|
result.isTouch = getClientDeviceInfo().isTouch;
|
package/dist/esm/util/is.js
CHANGED
|
@@ -16,7 +16,7 @@ export const isAppCallSupported = _ref => {
|
|
|
16
16
|
if (device.os && ['iOS', 'Mac OS'].includes(device.os)) {
|
|
17
17
|
return device.app.callVersion >= minIOSVersion;
|
|
18
18
|
}
|
|
19
|
-
if (device.os === 'Android') {
|
|
19
|
+
if (device.os === 'Android OS') {
|
|
20
20
|
return device.app.callVersion >= minAndroidVersion;
|
|
21
21
|
}
|
|
22
22
|
return false;
|
|
@@ -232,10 +232,6 @@ export declare const getParameters: () => {
|
|
|
232
232
|
};
|
|
233
233
|
export declare const getPages: () => import("../types/IChaynsReact").Page[];
|
|
234
234
|
export declare const getEnvironment: () => {
|
|
235
|
-
/**
|
|
236
|
-
* Removes visibility change listener.
|
|
237
|
-
* @category Event listener
|
|
238
|
-
*/
|
|
239
235
|
buildEnvironment: import("../types/IChaynsReact").Environment;
|
|
240
236
|
runtimeEnvironment: string | import("../types/IChaynsReact").RuntimeEnviroment;
|
|
241
237
|
};
|
|
@@ -254,10 +250,6 @@ export declare const parameters: {
|
|
|
254
250
|
};
|
|
255
251
|
export declare const pages: import("../types/IChaynsReact").Page[];
|
|
256
252
|
export declare const environment: {
|
|
257
|
-
/**
|
|
258
|
-
* Removes visibility change listener.
|
|
259
|
-
* @category Event listener
|
|
260
|
-
*/
|
|
261
253
|
buildEnvironment: import("../types/IChaynsReact").Environment;
|
|
262
254
|
runtimeEnvironment: string | import("../types/IChaynsReact").RuntimeEnviroment;
|
|
263
255
|
};
|
|
@@ -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,9 +181,10 @@ 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
|
-
os?: 'AIX' | 'Amiga OS' | 'Android' | '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
|
|
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;
|
|
187
188
|
isTouch: boolean;
|
|
188
189
|
screenSize: ScreenSize;
|
|
189
190
|
};
|