chayns-api 1.0.39 → 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.
@@ -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 ((match === null || match === void 0 || (_match$groups = match.groups) === null || _match$groups === void 0 ? void 0 : _match$groups.siteId) === '60021-08989') {
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;
@@ -30,6 +30,7 @@ import { getDevice } from "../index";
30
30
  * console.log(data);
31
31
  * });
32
32
  */
33
+
33
34
  export function date() {
34
35
  let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
35
36
  let {
@@ -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 ((match === null || match === void 0 || (_match$groups = match.groups) === null || _match$groups === void 0 ? void 0 : _match$groups.siteId) === '60021-08989') {
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;
@@ -49,9 +49,9 @@ export interface BaseDialog {
49
49
  text?: string;
50
50
  buttons?: DialogButton[];
51
51
  width?: string | number;
52
- animation: {
52
+ animation?: {
53
53
  type: DialogAnimation;
54
- config: any;
54
+ config?: any;
55
55
  };
56
56
  }
57
57
  export type Dialog = BaseDialog & (DialogAlert | DialogConfirm | DialogInput | DialogModule | DialogIFrame | DialogSelect | DialogDate | DialogToast);
@@ -702,7 +702,9 @@ export declare enum AppName {
702
702
  Chayns = 2,
703
703
  Location = 3,
704
704
  Intercom = 4,
705
- ChaynsLauncher = 5
705
+ ChaynsLauncher = 5,
706
+ TobitChat = 6,
707
+ Sidekick = 7
706
708
  }
707
709
  export declare enum BrowserName {
708
710
  Unknown = "unknown",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chayns-api",
3
- "version": "1.0.39",
3
+ "version": "1.0.41",
4
4
  "description": "new chayns api",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",