chayns-api 2.1.12 → 2.1.14
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/types/IChaynsReact.js +6 -1
- package/dist/cjs/util/deviceHelper.js +1 -0
- package/dist/cjs/wrapper/AppWrapper.js +6 -3
- package/dist/esm/types/IChaynsReact.js +5 -0
- package/dist/esm/util/deviceHelper.js +2 -1
- package/dist/esm/wrapper/AppWrapper.js +6 -3
- package/dist/types/types/IChaynsReact.d.ts +6 -0
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WeekDayType = exports.ToastType = exports.TappEvent = exports.SharingApp = exports.ScreenSize = exports.ScanQrCodeCodeType = exports.ScanQrCodeCameraTypes = exports.RuntimeEnviroment = exports.MediaType = exports.Language = exports.IconType = exports.Gender = exports.Font = exports.FloatingButtonPosition = exports.FloatingButtonAnimation = exports.Environment = exports.DialogType = exports.DialogSelectType = exports.DialogInputType = exports.DialogIconType = exports.DialogButtonType = exports.DialogAnimation = exports.DeviceOs = exports.DateType = exports.ColorMode = exports.BrowserName = exports.AppName = exports.AccessMode = void 0;
|
|
6
|
+
exports.WeekDayType = exports.ToastType = exports.TappEvent = exports.SharingApp = exports.ScreenSize = exports.ScanQrCodeCodeType = exports.ScanQrCodeCameraTypes = exports.RuntimeEnviroment = exports.MediaType = exports.Language = exports.IconType = exports.Gender = exports.Font = exports.FloatingButtonPosition = exports.FloatingButtonAnimation = exports.Environment = exports.DialogType = exports.DialogSelectType = exports.DialogInputType = exports.DialogIconType = exports.DialogButtonType = exports.DialogAnimation = exports.DeviceOs = exports.DateType = exports.ColorMode = exports.BrowserName = exports.AppName = exports.AppFlavor = exports.AccessMode = void 0;
|
|
7
7
|
let DateType = exports.DateType = function (DateType) {
|
|
8
8
|
DateType[DateType["DATE"] = 0] = "DATE";
|
|
9
9
|
DateType[DateType["TIME"] = 1] = "TIME";
|
|
@@ -56,6 +56,11 @@ let ScreenSize = exports.ScreenSize = function (ScreenSize) {
|
|
|
56
56
|
ScreenSize[ScreenSize["XL"] = 4] = "XL";
|
|
57
57
|
return ScreenSize;
|
|
58
58
|
}({});
|
|
59
|
+
let AppFlavor = exports.AppFlavor = function (AppFlavor) {
|
|
60
|
+
AppFlavor["None"] = "none";
|
|
61
|
+
AppFlavor["Chayns"] = "chayns";
|
|
62
|
+
return AppFlavor;
|
|
63
|
+
}({});
|
|
59
64
|
let AccessMode = exports.AccessMode = function (AccessMode) {
|
|
60
65
|
AccessMode[AccessMode["public"] = 0] = "public";
|
|
61
66
|
AccessMode[AccessMode["protected"] = 1] = "protected";
|
|
@@ -45,6 +45,7 @@ const getDeviceInfo = (userAgent, acceptHeader, {
|
|
|
45
45
|
};
|
|
46
46
|
result.app = {
|
|
47
47
|
name: appName,
|
|
48
|
+
flavor: appName === _IChaynsReact.AppName.Unknown ? _IChaynsReact.AppFlavor.None : _IChaynsReact.AppFlavor.Chayns,
|
|
48
49
|
version: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN,
|
|
49
50
|
appVersion,
|
|
50
51
|
callVersion: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN
|
|
@@ -609,9 +609,12 @@ class AppWrapper {
|
|
|
609
609
|
callback: ({
|
|
610
610
|
colorMode
|
|
611
611
|
}) => {
|
|
612
|
-
this.values
|
|
613
|
-
...this.values
|
|
614
|
-
|
|
612
|
+
this.values = {
|
|
613
|
+
...this.values,
|
|
614
|
+
site: {
|
|
615
|
+
...this.values.site,
|
|
616
|
+
colorMode
|
|
617
|
+
}
|
|
615
618
|
};
|
|
616
619
|
document.dispatchEvent(new CustomEvent('chayns_api_data', {
|
|
617
620
|
detail: {
|
|
@@ -50,6 +50,11 @@ export let ScreenSize = function (ScreenSize) {
|
|
|
50
50
|
ScreenSize[ScreenSize["XL"] = 4] = "XL";
|
|
51
51
|
return ScreenSize;
|
|
52
52
|
}({});
|
|
53
|
+
export let AppFlavor = function (AppFlavor) {
|
|
54
|
+
AppFlavor["None"] = "none";
|
|
55
|
+
AppFlavor["Chayns"] = "chayns";
|
|
56
|
+
return AppFlavor;
|
|
57
|
+
}({});
|
|
53
58
|
export let AccessMode = function (AccessMode) {
|
|
54
59
|
AccessMode[AccessMode["public"] = 0] = "public";
|
|
55
60
|
AccessMode[AccessMode["protected"] = 1] = "protected";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UAParser } from 'ua-parser-js';
|
|
2
|
-
import { AppName, ScreenSize } from '../types/IChaynsReact';
|
|
2
|
+
import { AppFlavor, AppName, ScreenSize } from '../types/IChaynsReact';
|
|
3
3
|
const getDeviceInfo = function (userAgent, acceptHeader) {
|
|
4
4
|
var _match$groups, _match$groups2, _customMatch$groups, _browser$version$spli, _browser$version, _uaParser$getOS, _uaParser$getOS2, _uaParser$getOS3;
|
|
5
5
|
let {
|
|
@@ -40,6 +40,7 @@ const getDeviceInfo = function (userAgent, acceptHeader) {
|
|
|
40
40
|
};
|
|
41
41
|
result.app = {
|
|
42
42
|
name: appName,
|
|
43
|
+
flavor: appName === AppName.Unknown ? AppFlavor.None : AppFlavor.Chayns,
|
|
43
44
|
version: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN,
|
|
44
45
|
appVersion,
|
|
45
46
|
callVersion: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN
|
|
@@ -620,9 +620,12 @@ export class AppWrapper {
|
|
|
620
620
|
let {
|
|
621
621
|
colorMode
|
|
622
622
|
} = _ref3;
|
|
623
|
-
this.values
|
|
624
|
-
...this.values
|
|
625
|
-
|
|
623
|
+
this.values = {
|
|
624
|
+
...this.values,
|
|
625
|
+
site: {
|
|
626
|
+
...this.values.site,
|
|
627
|
+
colorMode
|
|
628
|
+
}
|
|
626
629
|
};
|
|
627
630
|
document.dispatchEvent(new CustomEvent('chayns_api_data', {
|
|
628
631
|
detail: {
|
|
@@ -198,6 +198,10 @@ export declare enum ScreenSize {
|
|
|
198
198
|
/** screen width larger than 1200px */
|
|
199
199
|
XL = 4
|
|
200
200
|
}
|
|
201
|
+
export declare enum AppFlavor {
|
|
202
|
+
None = "none",
|
|
203
|
+
Chayns = "chayns"
|
|
204
|
+
}
|
|
201
205
|
export type ChaynsApiDevice = {
|
|
202
206
|
app?: {
|
|
203
207
|
name: AppName;
|
|
@@ -208,6 +212,8 @@ export type ChaynsApiDevice = {
|
|
|
208
212
|
/** the version of the chayns call interface */
|
|
209
213
|
callVersion: number;
|
|
210
214
|
storePackageName?: string;
|
|
215
|
+
/** the flavor of the app, e. g. all chayns apps including chat app, sidekick, team */
|
|
216
|
+
flavor: AppFlavor;
|
|
211
217
|
};
|
|
212
218
|
browser?: {
|
|
213
219
|
name?: IBrowser["name"] | 'bot' | null;
|