chayns-api 1.0.40 → 1.0.41
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/components/ChaynsProvider.js +1 -1
- package/dist/cjs/host/iframe/HostIframe.js +0 -1
- package/dist/cjs/types/IChaynsReact.js +2 -0
- package/dist/cjs/util/deviceHelper.js +5 -1
- package/dist/esm/calls/dialogs/date.js +1 -0
- package/dist/esm/components/ChaynsProvider.js +1 -1
- package/dist/esm/host/iframe/HostIframe.js +0 -1
- package/dist/esm/types/IChaynsReact.js +2 -0
- package/dist/esm/util/deviceHelper.js +5 -1
- package/dist/types/types/IChaynsReact.d.ts +3 -1
- package/package.json +1 -1
|
@@ -63,7 +63,7 @@ const ChaynsProvider = ({
|
|
|
63
63
|
var _deviceInfo$app$name, _deviceInfo$app;
|
|
64
64
|
const deviceInfo = (0, _deviceHelper.default)(navigator.userAgent, '');
|
|
65
65
|
// load framewrapper in Chaynsweb in app (window.self === window.top)
|
|
66
|
-
if ([_IChaynsReact.AppName.Chayns, _IChaynsReact.AppName.ChaynsLauncher].includes((_deviceInfo$app$name = (_deviceInfo$app = deviceInfo.app) === null || _deviceInfo$app === void 0 ? void 0 : _deviceInfo$app.name) !== null && _deviceInfo$app$name !== void 0 ? _deviceInfo$app$name : _IChaynsReact.AppName.Unknown) && window.self === window.top) {
|
|
66
|
+
if ([_IChaynsReact.AppName.Chayns, _IChaynsReact.AppName.ChaynsLauncher, _IChaynsReact.AppName.Sidekick, _IChaynsReact.AppName.TobitChat].includes((_deviceInfo$app$name = (_deviceInfo$app = deviceInfo.app) === null || _deviceInfo$app === void 0 ? void 0 : _deviceInfo$app.name) !== null && _deviceInfo$app$name !== void 0 ? _deviceInfo$app$name : _IChaynsReact.AppName.Unknown) && window.self === window.top) {
|
|
67
67
|
customWrapper.current = new _AppWrapper.AppWrapper();
|
|
68
68
|
} else {
|
|
69
69
|
customWrapper.current = new _FrameWrapper.FrameWrapper();
|
|
@@ -39,7 +39,6 @@ const HostIframe = ({
|
|
|
39
39
|
if (!eventTarget.current) {
|
|
40
40
|
eventTarget.current = global.document ? document.createElement('div') : undefined; // global.EventTarget ? new EventTarget() : undefined
|
|
41
41
|
}
|
|
42
|
-
|
|
43
42
|
const setHeight = value => {
|
|
44
43
|
if (ref.current) {
|
|
45
44
|
ref.current.style.height = `${value}px`;
|
|
@@ -227,6 +227,8 @@ let AppName = exports.AppName = /*#__PURE__*/function (AppName) {
|
|
|
227
227
|
AppName[AppName["Location"] = 3] = "Location";
|
|
228
228
|
AppName[AppName["Intercom"] = 4] = "Intercom";
|
|
229
229
|
AppName[AppName["ChaynsLauncher"] = 5] = "ChaynsLauncher";
|
|
230
|
+
AppName[AppName["TobitChat"] = 6] = "TobitChat";
|
|
231
|
+
AppName[AppName["Sidekick"] = 7] = "Sidekick";
|
|
230
232
|
return AppName;
|
|
231
233
|
}({});
|
|
232
234
|
let BrowserName = exports.BrowserName = /*#__PURE__*/function (BrowserName) {
|
|
@@ -11,7 +11,11 @@ const getDeviceInfo = (userAgent, acceptHeader) => {
|
|
|
11
11
|
const parsedUA = (0, _detectBrowser.parseUserAgent)(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
|
-
if ((
|
|
14
|
+
if (/\sintercom\/\d+/i.test(userAgent)) {
|
|
15
|
+
appName = _IChaynsReact.AppName.TobitChat;
|
|
16
|
+
} else if (/\ssidekick\/\d+/i.test(userAgent)) {
|
|
17
|
+
appName = _IChaynsReact.AppName.Sidekick;
|
|
18
|
+
} else if ((match === null || match === void 0 || (_match$groups = match.groups) === null || _match$groups === void 0 ? void 0 : _match$groups.siteId) === '60021-08989') {
|
|
15
19
|
appName = _IChaynsReact.AppName.Chayns;
|
|
16
20
|
} else if ((match === null || match === void 0 || (_match$groups2 = match.groups) === null || _match$groups2 === void 0 ? void 0 : _match$groups2.siteId) === '77892-10814') {
|
|
17
21
|
appName = _IChaynsReact.AppName.David;
|
|
@@ -57,7 +57,7 @@ const ChaynsProvider = _ref2 => {
|
|
|
57
57
|
var _deviceInfo$app$name, _deviceInfo$app;
|
|
58
58
|
const deviceInfo = getDeviceInfo(navigator.userAgent, '');
|
|
59
59
|
// load framewrapper in Chaynsweb in app (window.self === window.top)
|
|
60
|
-
if ([AppName.Chayns, AppName.ChaynsLauncher].includes((_deviceInfo$app$name = (_deviceInfo$app = deviceInfo.app) === null || _deviceInfo$app === void 0 ? void 0 : _deviceInfo$app.name) !== null && _deviceInfo$app$name !== void 0 ? _deviceInfo$app$name : AppName.Unknown) && window.self === window.top) {
|
|
60
|
+
if ([AppName.Chayns, AppName.ChaynsLauncher, AppName.Sidekick, AppName.TobitChat].includes((_deviceInfo$app$name = (_deviceInfo$app = deviceInfo.app) === null || _deviceInfo$app === void 0 ? void 0 : _deviceInfo$app.name) !== null && _deviceInfo$app$name !== void 0 ? _deviceInfo$app$name : AppName.Unknown) && window.self === window.top) {
|
|
61
61
|
customWrapper.current = new AppWrapper();
|
|
62
62
|
} else {
|
|
63
63
|
customWrapper.current = new FrameWrapper();
|
|
@@ -31,7 +31,6 @@ const HostIframe = _ref => {
|
|
|
31
31
|
if (!eventTarget.current) {
|
|
32
32
|
eventTarget.current = global.document ? document.createElement('div') : undefined; // global.EventTarget ? new EventTarget() : undefined
|
|
33
33
|
}
|
|
34
|
-
|
|
35
34
|
const setHeight = value => {
|
|
36
35
|
if (ref.current) {
|
|
37
36
|
ref.current.style.height = `${value}px`;
|
|
@@ -224,6 +224,8 @@ export let AppName = /*#__PURE__*/function (AppName) {
|
|
|
224
224
|
AppName[AppName["Location"] = 3] = "Location";
|
|
225
225
|
AppName[AppName["Intercom"] = 4] = "Intercom";
|
|
226
226
|
AppName[AppName["ChaynsLauncher"] = 5] = "ChaynsLauncher";
|
|
227
|
+
AppName[AppName["TobitChat"] = 6] = "TobitChat";
|
|
228
|
+
AppName[AppName["Sidekick"] = 7] = "Sidekick";
|
|
227
229
|
return AppName;
|
|
228
230
|
}({});
|
|
229
231
|
export let BrowserName = /*#__PURE__*/function (BrowserName) {
|
|
@@ -5,7 +5,11 @@ const getDeviceInfo = (userAgent, acceptHeader) => {
|
|
|
5
5
|
const parsedUA = parseUserAgent(userAgent);
|
|
6
6
|
let appName = AppName.Unknown;
|
|
7
7
|
const match = /(?:my)?chayns\/(?<version>\d+).*(?<siteId>\d{5}-\d{5})/i.exec(userAgent);
|
|
8
|
-
if ((
|
|
8
|
+
if (/\sintercom\/\d+/i.test(userAgent)) {
|
|
9
|
+
appName = AppName.TobitChat;
|
|
10
|
+
} else if (/\ssidekick\/\d+/i.test(userAgent)) {
|
|
11
|
+
appName = AppName.Sidekick;
|
|
12
|
+
} else if ((match === null || match === void 0 || (_match$groups = match.groups) === null || _match$groups === void 0 ? void 0 : _match$groups.siteId) === '60021-08989') {
|
|
9
13
|
appName = AppName.Chayns;
|
|
10
14
|
} else if ((match === null || match === void 0 || (_match$groups2 = match.groups) === null || _match$groups2 === void 0 ? void 0 : _match$groups2.siteId) === '77892-10814') {
|
|
11
15
|
appName = AppName.David;
|