@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.
package/dist-es/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildix/xbees-connect",
|
|
3
|
-
"version": "1.1.
|
|
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": "",
|
package/dist-es/src/Client.js
CHANGED
|
@@ -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 =
|
|
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
|
-
|
|
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));
|
|
@@ -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()) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildix/xbees-connect",
|
|
3
|
-
"version": "1.1.
|
|
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": "
|
|
45
|
+
"gitHead": "48e2a82b88e4228028e3d0e0470d06aa3c20a1df"
|
|
46
46
|
}
|