@wildix/xbees-connect 1.1.20 → 1.1.21

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildix/xbees-connect",
3
- "version": "1.1.20",
3
+ "version": "1.1.21",
4
4
  "description": "This library provides easy communication between x-bees and integrated web applications",
5
5
  "author": "dimitri.chernykh <dimitri.chernykh@wildix.com>",
6
6
  "homepage": "",
@@ -47,13 +47,11 @@ export class Client {
47
47
  this.userEmail = (params.get(UrlParams.USER) ?? params.get(DeprecatedUrlParams.USER));
48
48
  this.userToken = (params.get(UrlParams.TOKEN) ?? params.get(DeprecatedUrlParams.TOKEN));
49
49
  this.referrer = (params.get(UrlParams.REFERRER) ?? params.get(DeprecatedUrlParams.REFERRER));
50
- this.needAuthorize = (params.has(UrlParams.AUTHORIZE) ?? params.has(DeprecatedUrlParams.AUTHORIZE));
50
+ this.needAuthorize = params.has(UrlParams.AUTHORIZE) ?? params.has(DeprecatedUrlParams.AUTHORIZE);
51
51
  // @ts-expect-error window.ReactNativeWebView will be provided by ReactNative WebView
52
52
  this.isParentReactNativeWebView = !!window.ReactNativeWebView;
53
- this.worker = this.isParentReactNativeWebView
54
- ? new PostMessageControllerNative()
55
- : new PostMessageControllerWeb();
56
- this.addEventListener(EventType.PBX_TOKEN, (token) => this.userToken = token);
53
+ this.worker = this.isParentReactNativeWebView ? new PostMessageControllerNative() : new PostMessageControllerWeb();
54
+ this.addEventListener(EventType.PBX_TOKEN, (token) => (this.userToken = token));
57
55
  }
58
56
  sendAsync(data) {
59
57
  return this.worker.sendAsync({
@@ -71,9 +69,7 @@ export class Client {
71
69
  }
72
70
  parseMessage(message) {
73
71
  try {
74
- const data = typeof message.data === 'string'
75
- ? JSON.parse(message.data)
76
- : message.data;
72
+ const data = typeof message.data === 'string' ? JSON.parse(message.data) : message.data;
77
73
  if (!data?.type) {
78
74
  return null;
79
75
  }
@@ -205,8 +201,7 @@ export class Client {
205
201
  };
206
202
  }
207
203
  removeEventListener(eventName, callback) {
208
- this.listeners = this.listeners.filter(({ eventName: _eventName, callback: _callback }) => !(Object.is(callback, _callback) &&
209
- (!eventName ? true : eventName === _eventName)));
204
+ this.listeners = this.listeners.filter(({ eventName: _eventName, callback: _callback }) => !(Object.is(callback, _callback) && (!eventName ? true : eventName === _eventName)));
210
205
  if (this.useSubscription && !this.listeners.length) {
211
206
  this.useSubscription = false;
212
207
  window.removeEventListener('message', this.onMessage.bind(this));
@@ -1,3 +1,6 @@
1
+ export var EventType1;
2
+ (function (EventType1) {
3
+ })(EventType1 || (EventType1 = {}));
1
4
  export var EventType;
2
5
  (function (EventType) {
3
6
  EventType["GET_CONTACTS_AUTO_SUGGEST"] = "xBeesGetContactsAutoSuggest";
@@ -15,9 +15,7 @@ class LocalStorageManager {
15
15
  return !this.integrationKey ? key : `${this.integrationKey}_${key}`;
16
16
  }
17
17
  getKey(key) {
18
- return !this.integrationKey
19
- ? key
20
- : key.slice(`${this.integrationKey}_`.length);
18
+ return !this.integrationKey ? key : key.slice(`${this.integrationKey}_`.length);
21
19
  }
22
20
  constructor() {
23
21
  if (this.shouldUseIntegrationKey()) {
@@ -1,3 +1,5 @@
1
+ export declare enum EventType1 {
2
+ }
1
3
  export declare enum EventType {
2
4
  GET_CONTACTS_AUTO_SUGGEST = "xBeesGetContactsAutoSuggest",
3
5
  GET_LOOK_UP_AND_MATCH = "xBeesGetLookUpAndMatch",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildix/xbees-connect",
3
- "version": "1.1.20",
3
+ "version": "1.1.21",
4
4
  "description": "This library provides easy communication between x-bees and integrated web applications",
5
5
  "author": "dimitri.chernykh <dimitri.chernykh@wildix.com>",
6
6
  "homepage": "",
@@ -42,5 +42,5 @@
42
42
  "engines": {
43
43
  "node": ">=16"
44
44
  },
45
- "gitHead": "a2b8416ab3351c9c94fe9165729692f3a60b6df8"
45
+ "gitHead": "48e2a82b88e4228028e3d0e0470d06aa3c20a1df"
46
46
  }