@wildix/xbees-connect 1.2.4 → 1.2.5

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.2.4",
3
+ "version": "1.2.5",
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": "",
@@ -35,6 +35,7 @@ export class Client {
35
35
  listeners = [];
36
36
  useSubscription = false;
37
37
  userToken;
38
+ visible = false;
38
39
  userEmail;
39
40
  referrer;
40
41
  needAuthorize;
@@ -56,6 +57,7 @@ export class Client {
56
57
  this.isParentReactNativeWebView = !!window.ReactNativeWebView;
57
58
  this.worker = this.isParentReactNativeWebView ? new PostMessageControllerNative() : new PostMessageControllerWeb();
58
59
  this.addEventListener(EventType.PBX_TOKEN, (token) => (this.userToken = token));
60
+ this.addEventListener(EventType.VISIBILITY, (isActive) => (this.visible = isActive));
59
61
  }
60
62
  sendAsync(data) {
61
63
  return this.worker.sendAsync({
@@ -134,6 +136,9 @@ export class Client {
134
136
  getReferrer() {
135
137
  return this.referrer;
136
138
  }
139
+ isVisible() {
140
+ return this.visible;
141
+ }
137
142
  getBackToAppUrl() {
138
143
  if (Client.getInstance().isPlatformNative()) {
139
144
  return `com.wildix.rnc://integrations/${this.iframeId}`;
@@ -325,7 +330,7 @@ export class Client {
325
330
  getTechnicalSupport() {
326
331
  return TechnicalSupport.getInstance();
327
332
  }
328
- onIframeActivityChange(callback) {
329
- return this.addEventListener(EventType.IFRAME_ACTIVITY, callback);
333
+ onVisibilityChange(callback) {
334
+ return this.addEventListener(EventType.VISIBILITY, callback);
330
335
  }
331
336
  }
@@ -8,7 +8,7 @@ export var EventType;
8
8
  EventType["PBX_TOKEN"] = "xBeesPbxToken";
9
9
  EventType["REDIRECT_QUERY"] = "xBeesRedirectQuery";
10
10
  EventType["LOGOUT"] = "xBeesLogout";
11
- EventType["IFRAME_ACTIVITY"] = "xBeesIframeActivity";
11
+ EventType["VISIBILITY"] = "xBeesVisibility";
12
12
  })(EventType || (EventType = {}));
13
13
  export var ClientEventType;
14
14
  (function (ClientEventType) {
@@ -13,6 +13,7 @@ export declare class Client implements ConnectClient {
13
13
  private listeners;
14
14
  private useSubscription;
15
15
  private userToken;
16
+ private visible;
16
17
  private readonly userEmail;
17
18
  private readonly referrer;
18
19
  private readonly needAuthorize;
@@ -35,6 +36,7 @@ export declare class Client implements ConnectClient {
35
36
  getUserEmail(): string;
36
37
  getUserExtension(): string | null;
37
38
  getReferrer(): string;
39
+ isVisible(): boolean;
38
40
  getBackToAppUrl(): string;
39
41
  isDataOnly(): boolean;
40
42
  isSetupDialog(): boolean;
@@ -73,5 +75,5 @@ export declare class Client implements ConnectClient {
73
75
  sendAnalytics(eventName: string, params?: Record<string, string>): void;
74
76
  setIntegrationStorageKey(integrationKey: string): void;
75
77
  getTechnicalSupport(): TechnicalSupport;
76
- onIframeActivityChange(callback: Callback<EventType.IFRAME_ACTIVITY>): RemoveEventListener;
78
+ onVisibilityChange(callback: Callback<EventType.VISIBILITY>): RemoveEventListener;
77
79
  }
@@ -7,7 +7,7 @@ export declare enum EventType {
7
7
  PBX_TOKEN = "xBeesPbxToken",
8
8
  REDIRECT_QUERY = "xBeesRedirectQuery",
9
9
  LOGOUT = "xBeesLogout",
10
- IFRAME_ACTIVITY = "xBeesIframeActivity"
10
+ VISIBILITY = "xBeesVisibility"
11
11
  }
12
12
  export declare enum ClientEventType {
13
13
  READY = "xBeesReady",
@@ -19,6 +19,9 @@ export interface ConnectClient {
19
19
  /**
20
20
  * Retrieves current user's email */
21
21
  getUserEmail: () => string;
22
+ /**
23
+ * Retrieves current user's extension */
24
+ getUserExtension: () => string | null;
22
25
  /**
23
26
  * Retrieves url for x-bees app which uses integration */
24
27
  getReferrer: () => string;
@@ -28,6 +31,9 @@ export interface ConnectClient {
28
31
  /**
29
32
  * Retrieves the version of xBeesConnect */
30
33
  version: () => string;
34
+ /**
35
+ * Indicates whether the UI iframe with the integration is currently active */
36
+ isVisible: () => boolean;
31
37
  /**
32
38
  * Determines x-bees is running on mobile native platform */
33
39
  isPlatformNative: () => boolean;
@@ -153,5 +159,5 @@ export interface ConnectClient {
153
159
  getTechnicalSupport: () => TechnicalSupport;
154
160
  /**
155
161
  * Starts listen for the events of changing iframe activity and handle with the provided callback */
156
- onIframeActivityChange: (callback: Callback<EventType.IFRAME_ACTIVITY>) => RemoveEventListener;
162
+ onVisibilityChange: (callback: Callback<EventType.VISIBILITY>) => RemoveEventListener;
157
163
  }
@@ -9,7 +9,7 @@ export type EventPayloadMap = {
9
9
  [EventType.ADD_CALL]: IPayloadCallStartedInfo;
10
10
  [EventType.USE_THEME]: IPayloadThemeChange;
11
11
  [EventType.PBX_TOKEN]: string;
12
- [EventType.IFRAME_ACTIVITY]: boolean;
12
+ [EventType.VISIBILITY]: boolean;
13
13
  [EventType.REDIRECT_QUERY]: string;
14
14
  };
15
15
  export type EventCallbackMap = {
@@ -18,7 +18,7 @@ export type EventCallbackMap = {
18
18
  [EventType.ADD_CALL]: (callStartInfo: EventPayloadMap[EventType.ADD_CALL]) => void;
19
19
  [EventType.USE_THEME]: (theme: EventPayloadMap[EventType.USE_THEME]) => void;
20
20
  [EventType.PBX_TOKEN]: (token: EventPayloadMap[EventType.PBX_TOKEN]) => void;
21
- [EventType.IFRAME_ACTIVITY]: (isActive: EventPayloadMap[EventType.IFRAME_ACTIVITY]) => void;
21
+ [EventType.VISIBILITY]: (isActive: EventPayloadMap[EventType.VISIBILITY]) => void;
22
22
  [EventType.REDIRECT_QUERY]: (query: EventPayloadMap[EventType.REDIRECT_QUERY]) => void;
23
23
  };
24
24
  export type RawMessageEvent = MessageEvent<string | Message>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildix/xbees-connect",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
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": "",
@@ -43,5 +43,5 @@
43
43
  "engines": {
44
44
  "node": ">=16"
45
45
  },
46
- "gitHead": "22fb9ba8de5736e78a8e533cd6bd68a5089c7a4f"
46
+ "gitHead": "56d5acf92d57e033678929fcb9927126bc54a39c"
47
47
  }