chayns-api 2.2.16 → 2.2.18

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.
@@ -256,6 +256,7 @@ let AppName = exports.AppName = function (AppName) {
256
256
  AppName[AppName["Sidekick"] = 7] = "Sidekick";
257
257
  AppName[AppName["Team"] = 8] = "Team";
258
258
  AppName[AppName["CityApp"] = 9] = "CityApp";
259
+ AppName[AppName["ElectronChayns"] = 10] = "ElectronChayns";
259
260
  return AppName;
260
261
  }({});
261
262
  let BrowserName = exports.BrowserName = function (BrowserName) {
@@ -13,7 +13,7 @@ const getDeviceInfo = (userAgent, acceptHeader, {
13
13
  const uaParser = new _uaParserJs.UAParser(userAgent);
14
14
  let appName = _IChaynsReact.AppName.Unknown;
15
15
  const match = /(?:my)?chayns\/(?<version>\d+).*(?<siteId>\d{5}-\d{5})/i.exec(userAgent);
16
- const customMatch = /\s(?<name>intercom|sidekick|team|cityApp)\/(?<version>\d+)/i.exec(userAgent);
16
+ const customMatch = /\s(?<name>intercom|sidekick|team|cityApp|electron-chayns|electron-d3sc)\/(?<version>\d+)/i.exec(userAgent);
17
17
  if (/\sintercom\/\d+/i.test(userAgent)) {
18
18
  appName = _IChaynsReact.AppName.TobitChat;
19
19
  } else if (/\ssidekick\/\d+/i.test(userAgent)) {
@@ -30,6 +30,8 @@ const getDeviceInfo = (userAgent, acceptHeader, {
30
30
  appName = _IChaynsReact.AppName.Location;
31
31
  } else if (/dface|h96pp|h96max|jabiru|chaynsterminal|wayter|odroidn2p|chayns-runtime-custom/i.test(userAgent)) {
32
32
  appName = _IChaynsReact.AppName.ChaynsLauncher;
33
+ } else if (/electron-chayns|electron-d3sc/i.test(userAgent)) {
34
+ appName = _IChaynsReact.AppName.ElectronChayns;
33
35
  }
34
36
  let appVersion = match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN;
35
37
  if (customMatch !== null && customMatch !== void 0 && (_customMatch$groups = customMatch.groups) !== null && _customMatch$groups !== void 0 && _customMatch$groups.version) {
@@ -45,7 +47,7 @@ const getDeviceInfo = (userAgent, acceptHeader, {
45
47
  };
46
48
  result.app = {
47
49
  name: appName,
48
- flavor: appName === _IChaynsReact.AppName.Unknown ? _IChaynsReact.AppFlavor.None : _IChaynsReact.AppFlavor.Chayns,
50
+ flavor: appName === _IChaynsReact.AppName.Unknown || appName === _IChaynsReact.AppName.ElectronChayns ? _IChaynsReact.AppFlavor.None : _IChaynsReact.AppFlavor.Chayns,
49
51
  version: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN,
50
52
  appVersion,
51
53
  callVersion: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN
@@ -59,7 +61,7 @@ const getDeviceInfo = (userAgent, acceptHeader, {
59
61
  result.isTouch = getClientDeviceInfo().isTouch;
60
62
  } else {
61
63
  const screenSizeByUA = /mobi/i.test(userAgent) ? _IChaynsReact.ScreenSize.SM : _IChaynsReact.ScreenSize.XL;
62
- result.screenSize = appName !== _IChaynsReact.AppName.Unknown ? _IChaynsReact.ScreenSize.XS : screenSizeByUA;
64
+ result.screenSize = appName !== _IChaynsReact.AppName.Unknown && appName !== _IChaynsReact.AppName.ElectronChayns ? _IChaynsReact.ScreenSize.XS : screenSizeByUA;
63
65
  }
64
66
  return result;
65
67
  };
@@ -374,7 +374,10 @@ class AppWrapper {
374
374
  });
375
375
  },
376
376
  openUrl: async value => {
377
- window.open(value.url);
377
+ this.appCall(9, {
378
+ url: value.url,
379
+ inAppBrowser: value.openInApp
380
+ });
378
381
  },
379
382
  openVideo: async value => {
380
383
  this.appCall(15, {
@@ -250,6 +250,7 @@ export let AppName = function (AppName) {
250
250
  AppName[AppName["Sidekick"] = 7] = "Sidekick";
251
251
  AppName[AppName["Team"] = 8] = "Team";
252
252
  AppName[AppName["CityApp"] = 9] = "CityApp";
253
+ AppName[AppName["ElectronChayns"] = 10] = "ElectronChayns";
253
254
  return AppName;
254
255
  }({});
255
256
  export let BrowserName = function (BrowserName) {
@@ -8,7 +8,7 @@ const getDeviceInfo = function (userAgent, acceptHeader) {
8
8
  const uaParser = new UAParser(userAgent);
9
9
  let appName = AppName.Unknown;
10
10
  const match = /(?:my)?chayns\/(?<version>\d+).*(?<siteId>\d{5}-\d{5})/i.exec(userAgent);
11
- const customMatch = /\s(?<name>intercom|sidekick|team|cityApp)\/(?<version>\d+)/i.exec(userAgent);
11
+ const customMatch = /\s(?<name>intercom|sidekick|team|cityApp|electron-chayns|electron-d3sc)\/(?<version>\d+)/i.exec(userAgent);
12
12
  if (/\sintercom\/\d+/i.test(userAgent)) {
13
13
  appName = AppName.TobitChat;
14
14
  } else if (/\ssidekick\/\d+/i.test(userAgent)) {
@@ -25,6 +25,8 @@ const getDeviceInfo = function (userAgent, acceptHeader) {
25
25
  appName = AppName.Location;
26
26
  } else if (/dface|h96pp|h96max|jabiru|chaynsterminal|wayter|odroidn2p|chayns-runtime-custom/i.test(userAgent)) {
27
27
  appName = AppName.ChaynsLauncher;
28
+ } else if (/electron-chayns|electron-d3sc/i.test(userAgent)) {
29
+ appName = AppName.ElectronChayns;
28
30
  }
29
31
  let appVersion = match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN;
30
32
  if (customMatch !== null && customMatch !== void 0 && (_customMatch$groups = customMatch.groups) !== null && _customMatch$groups !== void 0 && _customMatch$groups.version) {
@@ -40,7 +42,7 @@ const getDeviceInfo = function (userAgent, acceptHeader) {
40
42
  };
41
43
  result.app = {
42
44
  name: appName,
43
- flavor: appName === AppName.Unknown ? AppFlavor.None : AppFlavor.Chayns,
45
+ flavor: appName === AppName.Unknown || appName === AppName.ElectronChayns ? AppFlavor.None : AppFlavor.Chayns,
44
46
  version: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN,
45
47
  appVersion,
46
48
  callVersion: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN
@@ -54,7 +56,7 @@ const getDeviceInfo = function (userAgent, acceptHeader) {
54
56
  result.isTouch = getClientDeviceInfo().isTouch;
55
57
  } else {
56
58
  const screenSizeByUA = /mobi/i.test(userAgent) ? ScreenSize.SM : ScreenSize.XL;
57
- result.screenSize = appName !== AppName.Unknown ? ScreenSize.XS : screenSizeByUA;
59
+ result.screenSize = appName !== AppName.Unknown && appName !== AppName.ElectronChayns ? ScreenSize.XS : screenSizeByUA;
58
60
  }
59
61
  return result;
60
62
  };
@@ -337,7 +337,10 @@ export class AppWrapper {
337
337
  });
338
338
  },
339
339
  openUrl: async value => {
340
- window.open(value.url);
340
+ this.appCall(9, {
341
+ url: value.url,
342
+ inAppBrowser: value.openInApp
343
+ });
341
344
  },
342
345
  openVideo: async value => {
343
346
  this.appCall(15, {
@@ -879,7 +879,8 @@ export declare enum AppName {
879
879
  TobitChat = 6,
880
880
  Sidekick = 7,
881
881
  Team = 8,
882
- CityApp = 9
882
+ CityApp = 9,
883
+ ElectronChayns = 10
883
884
  }
884
885
  export declare enum BrowserName {
885
886
  Unknown = "unknown",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chayns-api",
3
- "version": "2.2.16",
3
+ "version": "2.2.18",
4
4
  "description": "new chayns api",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",