chayns-api 1.2.0-0 → 1.2.0-1
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/index.js +12 -0
- package/dist/cjs/types/IChaynsReact.js +1 -0
- package/dist/cjs/util/deviceHelper.js +17 -9
- package/dist/cjs/util/is.js +30 -0
- package/dist/cjs/wrapper/AppWrapper.js +25 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/types/IChaynsReact.js +1 -0
- package/dist/esm/util/deviceHelper.js +17 -9
- package/dist/esm/util/is.js +23 -0
- package/dist/esm/wrapper/AppWrapper.js +28 -3
- package/dist/types/index.d.ts +1 -0
- package/dist/types/types/IChaynsReact.d.ts +14 -4
- package/dist/types/util/is.d.ts +5 -0
- package/package.json +3 -2
package/dist/cjs/index.js
CHANGED
|
@@ -148,6 +148,18 @@ Object.keys(_IChaynsReact).forEach(function (key) {
|
|
|
148
148
|
}
|
|
149
149
|
});
|
|
150
150
|
});
|
|
151
|
+
var _is = require("./util/is");
|
|
152
|
+
Object.keys(_is).forEach(function (key) {
|
|
153
|
+
if (key === "default" || key === "__esModule") return;
|
|
154
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
155
|
+
if (key in exports && exports[key] === _is[key]) return;
|
|
156
|
+
Object.defineProperty(exports, key, {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function () {
|
|
159
|
+
return _is[key];
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
});
|
|
151
163
|
var _constants = require("./constants");
|
|
152
164
|
Object.keys(_constants).forEach(function (key) {
|
|
153
165
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -29,6 +29,7 @@ let DialogSelectType = exports.DialogSelectType = /*#__PURE__*/function (DialogS
|
|
|
29
29
|
DialogSelectType[DialogSelectType["DEFAULT"] = 0] = "DEFAULT";
|
|
30
30
|
DialogSelectType[DialogSelectType["ICON"] = 1] = "ICON";
|
|
31
31
|
DialogSelectType[DialogSelectType["IMAGE"] = 2] = "IMAGE";
|
|
32
|
+
DialogSelectType[DialogSelectType["SIMPLE"] = 3] = "SIMPLE";
|
|
32
33
|
return DialogSelectType;
|
|
33
34
|
}({});
|
|
34
35
|
let DialogButtonType = exports.DialogButtonType = /*#__PURE__*/function (DialogButtonType) {
|
|
@@ -4,13 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getScreenSize = exports.getClientDeviceInfo = exports.default = void 0;
|
|
7
|
-
var
|
|
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,
|
|
11
|
-
const
|
|
10
|
+
var _match$groups, _match$groups2, _customMatch$groups, _browser$version$spli, _browser$version, _uaParser$getOS, _uaParser$getOS2;
|
|
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);
|
|
14
|
+
const customMatch = /\s(?<name>intercom|sidekick|team)\/(?<version>\d+)/i.exec(userAgent);
|
|
14
15
|
if (/\sintercom\/\d+/i.test(userAgent)) {
|
|
15
16
|
appName = _IChaynsReact.AppName.TobitChat;
|
|
16
17
|
} else if (/\ssidekick\/\d+/i.test(userAgent)) {
|
|
@@ -26,20 +27,27 @@ const getDeviceInfo = (userAgent, acceptHeader) => {
|
|
|
26
27
|
} else if (/dface|h96pp|h96max|jabiru|chaynsterminal|wayter|odroidn2p/i.test(userAgent)) {
|
|
27
28
|
appName = _IChaynsReact.AppName.ChaynsLauncher;
|
|
28
29
|
}
|
|
30
|
+
let appVersion = match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN;
|
|
31
|
+
if (customMatch !== null && customMatch !== void 0 && (_customMatch$groups = customMatch.groups) !== null && _customMatch$groups !== void 0 && _customMatch$groups.version) {
|
|
32
|
+
appVersion = Number.parseInt(customMatch.groups.version, 10);
|
|
33
|
+
}
|
|
29
34
|
const result = {};
|
|
35
|
+
const browser = uaParser.getBrowser();
|
|
30
36
|
result.browser = {
|
|
31
|
-
name:
|
|
32
|
-
version:
|
|
33
|
-
majorVersion: Number.parseInt((
|
|
37
|
+
name: browser === null || browser === void 0 ? void 0 : browser.name,
|
|
38
|
+
version: browser === null || browser === void 0 ? void 0 : browser.version,
|
|
39
|
+
majorVersion: Number.parseInt((_browser$version$spli = browser === null || browser === void 0 || (_browser$version = browser.version) === null || _browser$version === void 0 ? void 0 : _browser$version.split('.')[0]) !== null && _browser$version$spli !== void 0 ? _browser$version$spli : '0', 10) || 0,
|
|
34
40
|
isWebPSupported: acceptHeader.includes('image/webp')
|
|
35
41
|
};
|
|
36
42
|
result.app = {
|
|
37
43
|
name: appName,
|
|
38
|
-
version: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN
|
|
44
|
+
version: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN,
|
|
45
|
+
appVersion,
|
|
46
|
+
callVersion: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN
|
|
39
47
|
};
|
|
40
48
|
result.imei = undefined; // TODO
|
|
41
|
-
result.
|
|
42
|
-
result.os =
|
|
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;
|
|
43
51
|
if (typeof window !== 'undefined') {
|
|
44
52
|
result.screenSize = getScreenSize(window.innerWidth);
|
|
45
53
|
result.isTouch = getClientDeviceInfo().isTouch;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isAppCallSupported = exports.isApp = void 0;
|
|
7
|
+
var _calls = require("../calls");
|
|
8
|
+
var _IChaynsReact = require("../types/IChaynsReact");
|
|
9
|
+
const isApp = () => {
|
|
10
|
+
var _getDevice$app$name, _getDevice$app;
|
|
11
|
+
return ((_getDevice$app$name = (_getDevice$app = (0, _calls.getDevice)().app) === null || _getDevice$app === void 0 ? void 0 : _getDevice$app.name) !== null && _getDevice$app$name !== void 0 ? _getDevice$app$name : _IChaynsReact.AppName.Unknown) !== _IChaynsReact.AppName.Unknown;
|
|
12
|
+
};
|
|
13
|
+
exports.isApp = isApp;
|
|
14
|
+
const isAppCallSupported = ({
|
|
15
|
+
minAndroidVersion = 1,
|
|
16
|
+
minIOSVersion = 1
|
|
17
|
+
}) => {
|
|
18
|
+
var _device$app;
|
|
19
|
+
if (!isApp()) return false;
|
|
20
|
+
const device = (0, _calls.getDevice)();
|
|
21
|
+
if (!((_device$app = device.app) !== null && _device$app !== void 0 && _device$app.callVersion) || isNaN(device.app.callVersion)) return false;
|
|
22
|
+
if (device.os && ['iOS', 'Mac OS'].includes(device.os)) {
|
|
23
|
+
return device.app.callVersion >= minIOSVersion;
|
|
24
|
+
}
|
|
25
|
+
if (device.os === 'Android OS') {
|
|
26
|
+
return device.app.callVersion >= minAndroidVersion;
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
};
|
|
30
|
+
exports.isAppCallSupported = isAppCallSupported;
|
|
@@ -13,6 +13,7 @@ var _getUserInfo = _interopRequireDefault(require("../calls/getUserInfo"));
|
|
|
13
13
|
var _sendMessage = require("../calls/sendMessage");
|
|
14
14
|
var _apiListenerHelper = require("../helper/apiListenerHelper");
|
|
15
15
|
var _languages = require("../constants/languages");
|
|
16
|
+
var _is = require("../util/is");
|
|
16
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -417,6 +418,25 @@ class AppWrapper {
|
|
|
417
418
|
}
|
|
418
419
|
},
|
|
419
420
|
selectPage: async options => {
|
|
421
|
+
var _this$values, _this$values2;
|
|
422
|
+
if ((_this$values = this.values) !== null && _this$values !== void 0 && (_this$values = _this$values.site) !== null && _this$values !== void 0 && _this$values.id && options.siteId && options.siteId !== ((_this$values2 = this.values) === null || _this$values2 === void 0 || (_this$values2 = _this$values2.site) === null || _this$values2 === void 0 ? void 0 : _this$values2.id)) {
|
|
423
|
+
const url = new URL(`https://chayns.site/${options.siteId}`);
|
|
424
|
+
if (options.id) {
|
|
425
|
+
url.pathname += `/tapp/${options.id}`;
|
|
426
|
+
} else if (options.path) {
|
|
427
|
+
url.pathname += `/${options.path}`;
|
|
428
|
+
}
|
|
429
|
+
if (options.params) {
|
|
430
|
+
Object.entries(options.params).forEach(([k, v]) => {
|
|
431
|
+
url.searchParams.set(k, v);
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
void this.appCall(9, {
|
|
435
|
+
url: url.toString(),
|
|
436
|
+
checkForChaynsSite: true
|
|
437
|
+
});
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
420
440
|
void this.appCall(2, {
|
|
421
441
|
id: options.id,
|
|
422
442
|
showName: options.showName,
|
|
@@ -539,12 +559,16 @@ class AppWrapper {
|
|
|
539
559
|
},
|
|
540
560
|
openDialog: async (config, callback) => {
|
|
541
561
|
const currentDialogId = appWrapperDialogId++;
|
|
562
|
+
const isSupported = (0, _is.isAppCallSupported)({
|
|
563
|
+
minAndroidVersion: 7137,
|
|
564
|
+
minIOSVersion: 6934
|
|
565
|
+
});
|
|
542
566
|
this.appCall(184, {
|
|
543
567
|
dialogContent: {
|
|
544
568
|
apiVersion: 5,
|
|
545
569
|
config
|
|
546
570
|
},
|
|
547
|
-
externalDialogUrl: 'https://tapp.chayns-static.space/api/dialog-v2/v1/index.html'
|
|
571
|
+
externalDialogUrl: isSupported ? undefined : 'https://tapp.chayns-static.space/api/dialog-v2/v1/index.html'
|
|
548
572
|
}, {
|
|
549
573
|
awaitResult: true
|
|
550
574
|
}).then(result => {
|
package/dist/esm/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from './calls';
|
|
|
7
7
|
export * from './hooks';
|
|
8
8
|
export * from './components/WaitUntil';
|
|
9
9
|
export * from './types/IChaynsReact';
|
|
10
|
+
export * from './util/is';
|
|
10
11
|
export * from './components/withCompatMode';
|
|
11
12
|
export * from './constants';
|
|
12
13
|
export { default as withHydrationBoundary } from './components/withHydrationBoundary';
|
|
@@ -23,6 +23,7 @@ export let DialogSelectType = /*#__PURE__*/function (DialogSelectType) {
|
|
|
23
23
|
DialogSelectType[DialogSelectType["DEFAULT"] = 0] = "DEFAULT";
|
|
24
24
|
DialogSelectType[DialogSelectType["ICON"] = 1] = "ICON";
|
|
25
25
|
DialogSelectType[DialogSelectType["IMAGE"] = 2] = "IMAGE";
|
|
26
|
+
DialogSelectType[DialogSelectType["SIMPLE"] = 3] = "SIMPLE";
|
|
26
27
|
return DialogSelectType;
|
|
27
28
|
}({});
|
|
28
29
|
export let DialogButtonType = /*#__PURE__*/function (DialogButtonType) {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
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,
|
|
5
|
-
const
|
|
4
|
+
var _match$groups, _match$groups2, _customMatch$groups, _browser$version$spli, _browser$version, _uaParser$getOS, _uaParser$getOS2;
|
|
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);
|
|
8
|
+
const customMatch = /\s(?<name>intercom|sidekick|team)\/(?<version>\d+)/i.exec(userAgent);
|
|
8
9
|
if (/\sintercom\/\d+/i.test(userAgent)) {
|
|
9
10
|
appName = AppName.TobitChat;
|
|
10
11
|
} else if (/\ssidekick\/\d+/i.test(userAgent)) {
|
|
@@ -20,20 +21,27 @@ const getDeviceInfo = (userAgent, acceptHeader) => {
|
|
|
20
21
|
} else if (/dface|h96pp|h96max|jabiru|chaynsterminal|wayter|odroidn2p/i.test(userAgent)) {
|
|
21
22
|
appName = AppName.ChaynsLauncher;
|
|
22
23
|
}
|
|
24
|
+
let appVersion = match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN;
|
|
25
|
+
if (customMatch !== null && customMatch !== void 0 && (_customMatch$groups = customMatch.groups) !== null && _customMatch$groups !== void 0 && _customMatch$groups.version) {
|
|
26
|
+
appVersion = Number.parseInt(customMatch.groups.version, 10);
|
|
27
|
+
}
|
|
23
28
|
const result = {};
|
|
29
|
+
const browser = uaParser.getBrowser();
|
|
24
30
|
result.browser = {
|
|
25
|
-
name:
|
|
26
|
-
version:
|
|
27
|
-
majorVersion: Number.parseInt((
|
|
31
|
+
name: browser === null || browser === void 0 ? void 0 : browser.name,
|
|
32
|
+
version: browser === null || browser === void 0 ? void 0 : browser.version,
|
|
33
|
+
majorVersion: Number.parseInt((_browser$version$spli = browser === null || browser === void 0 || (_browser$version = browser.version) === null || _browser$version === void 0 ? void 0 : _browser$version.split('.')[0]) !== null && _browser$version$spli !== void 0 ? _browser$version$spli : '0', 10) || 0,
|
|
28
34
|
isWebPSupported: acceptHeader.includes('image/webp')
|
|
29
35
|
};
|
|
30
36
|
result.app = {
|
|
31
37
|
name: appName,
|
|
32
|
-
version: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN
|
|
38
|
+
version: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN,
|
|
39
|
+
appVersion,
|
|
40
|
+
callVersion: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN
|
|
33
41
|
};
|
|
34
42
|
result.imei = undefined; // TODO
|
|
35
|
-
result.
|
|
36
|
-
result.os =
|
|
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;
|
|
37
45
|
if (typeof window !== 'undefined') {
|
|
38
46
|
result.screenSize = getScreenSize(window.innerWidth);
|
|
39
47
|
result.isTouch = getClientDeviceInfo().isTouch;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getDevice } from '../calls';
|
|
2
|
+
import { AppName } from '../types/IChaynsReact';
|
|
3
|
+
export const isApp = () => {
|
|
4
|
+
var _getDevice$app$name, _getDevice$app;
|
|
5
|
+
return ((_getDevice$app$name = (_getDevice$app = getDevice().app) === null || _getDevice$app === void 0 ? void 0 : _getDevice$app.name) !== null && _getDevice$app$name !== void 0 ? _getDevice$app$name : AppName.Unknown) !== AppName.Unknown;
|
|
6
|
+
};
|
|
7
|
+
export const isAppCallSupported = _ref => {
|
|
8
|
+
var _device$app;
|
|
9
|
+
let {
|
|
10
|
+
minAndroidVersion = 1,
|
|
11
|
+
minIOSVersion = 1
|
|
12
|
+
} = _ref;
|
|
13
|
+
if (!isApp()) return false;
|
|
14
|
+
const device = getDevice();
|
|
15
|
+
if (!((_device$app = device.app) !== null && _device$app !== void 0 && _device$app.callVersion) || isNaN(device.app.callVersion)) return false;
|
|
16
|
+
if (device.os && ['iOS', 'Mac OS'].includes(device.os)) {
|
|
17
|
+
return device.app.callVersion >= minIOSVersion;
|
|
18
|
+
}
|
|
19
|
+
if (device.os === 'Android OS') {
|
|
20
|
+
return device.app.callVersion >= minAndroidVersion;
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
};
|
|
@@ -13,6 +13,7 @@ import getUserInfo from '../calls/getUserInfo';
|
|
|
13
13
|
import { sendMessageToGroup, sendMessageToPage, sendMessageToUser } from '../calls/sendMessage';
|
|
14
14
|
import { addApiListener, dispatchApiEvent, removeApiListener } from '../helper/apiListenerHelper';
|
|
15
15
|
import { DeviceLanguage } from '../constants/languages';
|
|
16
|
+
import { isAppCallSupported } from '../util/is';
|
|
16
17
|
let appWrapperDialogId = 0;
|
|
17
18
|
export class AppWrapper {
|
|
18
19
|
mapOldApiToNew(retVal) {
|
|
@@ -380,6 +381,26 @@ export class AppWrapper {
|
|
|
380
381
|
}
|
|
381
382
|
},
|
|
382
383
|
selectPage: async options => {
|
|
384
|
+
var _this$values, _this$values2;
|
|
385
|
+
if ((_this$values = this.values) !== null && _this$values !== void 0 && (_this$values = _this$values.site) !== null && _this$values !== void 0 && _this$values.id && options.siteId && options.siteId !== ((_this$values2 = this.values) === null || _this$values2 === void 0 || (_this$values2 = _this$values2.site) === null || _this$values2 === void 0 ? void 0 : _this$values2.id)) {
|
|
386
|
+
const url = new URL(`https://chayns.site/${options.siteId}`);
|
|
387
|
+
if (options.id) {
|
|
388
|
+
url.pathname += `/tapp/${options.id}`;
|
|
389
|
+
} else if (options.path) {
|
|
390
|
+
url.pathname += `/${options.path}`;
|
|
391
|
+
}
|
|
392
|
+
if (options.params) {
|
|
393
|
+
Object.entries(options.params).forEach(_ref2 => {
|
|
394
|
+
let [k, v] = _ref2;
|
|
395
|
+
url.searchParams.set(k, v);
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
void this.appCall(9, {
|
|
399
|
+
url: url.toString(),
|
|
400
|
+
checkForChaynsSite: true
|
|
401
|
+
});
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
383
404
|
void this.appCall(2, {
|
|
384
405
|
id: options.id,
|
|
385
406
|
showName: options.showName,
|
|
@@ -502,12 +523,16 @@ export class AppWrapper {
|
|
|
502
523
|
},
|
|
503
524
|
openDialog: async (config, callback) => {
|
|
504
525
|
const currentDialogId = appWrapperDialogId++;
|
|
526
|
+
const isSupported = isAppCallSupported({
|
|
527
|
+
minAndroidVersion: 7137,
|
|
528
|
+
minIOSVersion: 6934
|
|
529
|
+
});
|
|
505
530
|
this.appCall(184, {
|
|
506
531
|
dialogContent: {
|
|
507
532
|
apiVersion: 5,
|
|
508
533
|
config
|
|
509
534
|
},
|
|
510
|
-
externalDialogUrl: 'https://tapp.chayns-static.space/api/dialog-v2/v1/index.html'
|
|
535
|
+
externalDialogUrl: isSupported ? undefined : 'https://tapp.chayns-static.space/api/dialog-v2/v1/index.html'
|
|
511
536
|
}, {
|
|
512
537
|
awaitResult: true
|
|
513
538
|
}).then(result => {
|
|
@@ -588,10 +613,10 @@ export class AppWrapper {
|
|
|
588
613
|
this.appCall(254, {
|
|
589
614
|
enabled: true
|
|
590
615
|
}, {
|
|
591
|
-
callback:
|
|
616
|
+
callback: _ref3 => {
|
|
592
617
|
let {
|
|
593
618
|
colorMode
|
|
594
|
-
} =
|
|
619
|
+
} = _ref3;
|
|
595
620
|
this.values.site = {
|
|
596
621
|
...this.values.site,
|
|
597
622
|
colorMode
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './calls';
|
|
|
7
7
|
export * from './hooks';
|
|
8
8
|
export * from './components/WaitUntil';
|
|
9
9
|
export * from './types/IChaynsReact';
|
|
10
|
+
export * from './util/is';
|
|
10
11
|
export * from './components/withCompatMode';
|
|
11
12
|
export * from './constants';
|
|
12
13
|
export { default as withHydrationBoundary } from './components/withHydrationBoundary';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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 = {
|
|
@@ -98,7 +98,8 @@ export interface DialogInput {
|
|
|
98
98
|
export declare enum DialogSelectType {
|
|
99
99
|
DEFAULT = 0,
|
|
100
100
|
ICON = 1,
|
|
101
|
-
IMAGE = 2
|
|
101
|
+
IMAGE = 2,
|
|
102
|
+
SIMPLE = 3
|
|
102
103
|
}
|
|
103
104
|
export type DialogSelectListItemType = {
|
|
104
105
|
id: number;
|
|
@@ -115,6 +116,9 @@ export type DialogSelectListItemType = {
|
|
|
115
116
|
export interface DialogSelect {
|
|
116
117
|
type: DialogType.SELECT;
|
|
117
118
|
list: DialogSelectListItemType[];
|
|
119
|
+
fixedItem?: DialogSelectListItemType & {
|
|
120
|
+
position?: 'top' | 'bottom';
|
|
121
|
+
};
|
|
118
122
|
multiselect?: boolean;
|
|
119
123
|
quickfind?: boolean;
|
|
120
124
|
selectType?: DialogSelectType;
|
|
@@ -163,18 +167,24 @@ export declare enum ScreenSize {
|
|
|
163
167
|
export type ChaynsApiDevice = {
|
|
164
168
|
app?: {
|
|
165
169
|
name: AppName;
|
|
170
|
+
/** @deprecated same value as callVersion */
|
|
166
171
|
version: number;
|
|
172
|
+
/** the actual app version according to the app name */
|
|
173
|
+
appVersion: number;
|
|
174
|
+
/** the version of the chayns call interface */
|
|
175
|
+
callVersion: number;
|
|
167
176
|
storePackageName?: string;
|
|
168
177
|
};
|
|
169
178
|
browser?: {
|
|
170
|
-
name?:
|
|
179
|
+
name?: IBrowser["name"] | 'bot' | null;
|
|
171
180
|
version?: string | null;
|
|
172
181
|
majorVersion: number;
|
|
173
182
|
isWebPSupported: boolean;
|
|
174
183
|
};
|
|
184
|
+
engine?: IEngine;
|
|
175
185
|
imei?: string;
|
|
176
186
|
accessToken?: string;
|
|
177
|
-
os?:
|
|
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;
|
|
178
188
|
isTouch: boolean;
|
|
179
189
|
screenSize: ScreenSize;
|
|
180
190
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chayns-api",
|
|
3
|
-
"version": "1.2.0-
|
|
3
|
+
"version": "1.2.0-1",
|
|
4
4
|
"description": "new chayns api",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
"@module-federation/runtime": "^0.1.13",
|
|
46
46
|
"@types/semver": "^7.5.8",
|
|
47
47
|
"comlink": "4.3.1",
|
|
48
|
-
"detect-browser": "^5.2.1",
|
|
49
48
|
"htmlescape": "^1.1.1",
|
|
50
49
|
"lodash.throttle": "^4.1.1",
|
|
51
50
|
"prop-types": "^15.7.2",
|
|
52
51
|
"scheduler": "^0.23.0",
|
|
53
52
|
"semaphore-async-await": "^1.5.1",
|
|
54
53
|
"semver": "^7.6.0",
|
|
54
|
+
"ua-parser-js": "^1.0.38",
|
|
55
55
|
"use-context-selector": "^1.4.4",
|
|
56
56
|
"util": "^0.12.5"
|
|
57
57
|
},
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"@types/prop-types": "^15.7.12",
|
|
69
69
|
"@types/react": "^18.2.78",
|
|
70
70
|
"@types/react-dom": "^18.2.25",
|
|
71
|
+
"@types/ua-parser-js": "^0.7.39",
|
|
71
72
|
"@typescript-eslint/parser": "^7.6.0",
|
|
72
73
|
"chayns-toolkit": "^2.0.9",
|
|
73
74
|
"concurrently": "^8.2.2",
|