chayns-api 2.2.15 → 2.2.17

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
  };
@@ -604,7 +604,7 @@ class AppWrapper {
604
604
  addAnonymousAccount: async () => {
605
605
  return this.appCall(302);
606
606
  },
607
- addAccessTokenChangeListener: async callback => {
607
+ addAccessTokenChangeListener: async (options, callback) => {
608
608
  const {
609
609
  id
610
610
  } = (0, _apiListenerHelper.addApiListener)('accessTokenChangeListener', callback);
@@ -307,9 +307,9 @@ class FrameWrapper {
307
307
  if (!this.initialized) await this.ready;
308
308
  return this.exposedFunctions.addAnonymousAccount();
309
309
  },
310
- addAccessTokenChangeListener: async callback => {
310
+ addAccessTokenChangeListener: async (options, callback) => {
311
311
  if (!this.initialized) await this.ready;
312
- return this.exposedFunctions.addAccessTokenChangeListener(callback && comlink.proxy(result => callback(result)));
312
+ return this.exposedFunctions.addAccessTokenChangeListener(options, callback && comlink.proxy(result => callback(result)));
313
313
  },
314
314
  removeAccessTokenChangeListener: async id => {
315
315
  if (!this.initialized) await this.ready;
@@ -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
  };
@@ -569,7 +569,7 @@ export class AppWrapper {
569
569
  addAnonymousAccount: async () => {
570
570
  return this.appCall(302);
571
571
  },
572
- addAccessTokenChangeListener: async callback => {
572
+ addAccessTokenChangeListener: async (options, callback) => {
573
573
  const {
574
574
  id
575
575
  } = addApiListener('accessTokenChangeListener', callback);
@@ -303,9 +303,9 @@ export class FrameWrapper {
303
303
  if (!this.initialized) await this.ready;
304
304
  return this.exposedFunctions.addAnonymousAccount();
305
305
  },
306
- addAccessTokenChangeListener: async callback => {
306
+ addAccessTokenChangeListener: async (options, callback) => {
307
307
  if (!this.initialized) await this.ready;
308
- return this.exposedFunctions.addAccessTokenChangeListener(callback && comlink.proxy(result => callback(result)));
308
+ return this.exposedFunctions.addAccessTokenChangeListener(options, callback && comlink.proxy(result => callback(result)));
309
309
  },
310
310
  removeAccessTokenChangeListener: async id => {
311
311
  if (!this.initialized) await this.ready;
@@ -423,9 +423,10 @@ export interface ChaynsReactFunctions {
423
423
  addDialogHostEventListener: (callback: (data: object) => void) => Promise<number>;
424
424
  removeDialogHostEventListener: (id: number) => Promise<void>;
425
425
  addAnonymousAccount: () => Promise<AnonymousAccountResult>;
426
- addAccessTokenChangeListener: (callback: (result: {
426
+ addAccessTokenChangeListener: (options: {
427
+ external?: boolean;
428
+ }, callback: (result: {
427
429
  accessToken: string;
428
- isExternal: boolean;
429
430
  }) => void) => Promise<number>;
430
431
  removeAccessTokenChangeListener: (id: number) => Promise<void>;
431
432
  }
@@ -878,7 +879,8 @@ export declare enum AppName {
878
879
  TobitChat = 6,
879
880
  Sidekick = 7,
880
881
  Team = 8,
881
- CityApp = 9
882
+ CityApp = 9,
883
+ ElectronChayns = 10
882
884
  }
883
885
  export declare enum BrowserName {
884
886
  Unknown = "unknown",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chayns-api",
3
- "version": "2.2.15",
3
+ "version": "2.2.17",
4
4
  "description": "new chayns api",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",