@wildix/xbees-connect 1.1.11 → 1.1.13

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/README.md CHANGED
@@ -81,6 +81,11 @@ Retrieves current x-bees context data. The data may be different depending on co
81
81
 
82
82
  Retrieves contact data currently opened in x-bees.
83
83
 
84
+ #### `getCurrentConversation(): Promise<Response>`
85
+
86
+ Retrieves conversation data ({id, type}) currently opened in x-bees.
87
+ If the conversation is temporary - retrieves undefined
88
+
84
89
  #### `getThemeMode(): Promise<Response>`
85
90
 
86
91
  Retrieves current theme mode (light or dark)
@@ -139,6 +144,14 @@ Starts listening for one of the x-bees events and returns the provided callback
139
144
 
140
145
  Stops listening for one of the x-bees events with the particular callback
141
146
 
147
+ #### `onLogout()`
148
+
149
+ Starts listen on logout event and send event to the xbees about logout able
150
+
151
+ #### `sendAnalytics()`
152
+
153
+ Sends analytics data to xbees for track into analytics data
154
+
142
155
  ## Known issues
143
156
 
144
157
  The below function can fix cases when `String.replaceAll()` does not work in the mobile version. Most likely, this is some kind of WebView bug.
@@ -298,4 +298,13 @@ export class Client {
298
298
  });
299
299
  return this.addEventListener(EventType.LOGOUT, callback);
300
300
  }
301
+ sendAnalytics(eventName, params) {
302
+ void this.sendAsync({
303
+ type: ClientEventType.SEND_ANALYTICS,
304
+ payload: {
305
+ eventName,
306
+ params,
307
+ },
308
+ });
309
+ }
301
310
  }
@@ -29,6 +29,7 @@ export var ClientEventType;
29
29
  ClientEventType["CONTACT_LOOKUP_AND_MATCH_NOT_FOUND"] = "xBeesContactLookupAndMatchNotFound";
30
30
  ClientEventType["CONTACT_CREATE_OR_UPDATE"] = "xBeesContactCreateOrUpdate";
31
31
  ClientEventType["LOGOUT_IS_SUPPORTED"] = "xBeesLogoutIsSupported";
32
+ ClientEventType["SEND_ANALYTICS"] = "xBeesSendAnalytics";
32
33
  })(ClientEventType || (ClientEventType = {}));
33
34
  export var DeprecatedUrlParams;
34
35
  (function (DeprecatedUrlParams) {
@@ -66,4 +66,5 @@ export declare class Client implements ConnectClient {
66
66
  deleteFromStorage(key: string): void;
67
67
  onStorage(listener: StorageEventCallback): () => void;
68
68
  onLogout(callback: Callback<EventType.LOGOUT>): RemoveEventListener;
69
+ sendAnalytics(eventName: string, params?: Record<string, string>): void;
69
70
  }
@@ -26,7 +26,8 @@ export declare enum ClientEventType {
26
26
  CONTACT_LOOKUP_AND_MATCH = "xBeesContactLookupAndMatch",
27
27
  CONTACT_LOOKUP_AND_MATCH_NOT_FOUND = "xBeesContactLookupAndMatchNotFound",
28
28
  CONTACT_CREATE_OR_UPDATE = "xBeesContactCreateOrUpdate",
29
- LOGOUT_IS_SUPPORTED = "xBeesLogoutIsSupported"
29
+ LOGOUT_IS_SUPPORTED = "xBeesLogoutIsSupported",
30
+ SEND_ANALYTICS = "xBeesSendAnalytics"
30
31
  }
31
32
  export declare enum DeprecatedUrlParams {
32
33
  TOKEN = "token",
@@ -66,7 +66,11 @@ export interface IPayloadContactResult {
66
66
  }
67
67
  export interface IPayloadContextResult extends IPayloadContactResult {
68
68
  }
69
- type EventPayload<T extends MessageType> = T extends EventType.GET_CONTACTS_AUTO_SUGGEST ? string : T extends ClientEventType.CONTACTS_AUTO_SUGGEST ? IPayloadAutoSuggestResult : T extends ClientEventType.CONTACT_LOOKUP_AND_MATCH ? IPayloadContactMatchResult : T extends ClientEventType.CONTACT_LOOKUP_AND_MATCH_NOT_FOUND ? IPayloadContactMatchResultNotFound : T extends ClientEventType.CONTACT_CREATE_OR_UPDATE ? IPayloadContactMatchResult : T extends ClientEventType.CONTEXT ? IPayloadContextResult : T extends ClientEventType.CURRENT_CONTACT ? IPayloadContactResult : T extends EventType.ADD_CALL ? IPayloadCallStartedInfo : T extends ClientEventType.START_CALL ? IPayloadCallStart : T extends ClientEventType.READY ? IPayloadVersion : T extends ClientEventType.VIEW_PORT ? IPayloadViewPort : T extends ClientEventType.THEME ? IPayloadThemeChange : T extends EventType.USE_THEME ? IPayloadThemeChange : T extends ClientEventType.TOAST ? IPayloadToast : T extends EventType.PBX_TOKEN ? string : T extends ClientEventType.TOKEN ? string : T extends ClientEventType.TO_CLIPBOARD ? string : never;
69
+ export interface IPayloadSendAnalytics {
70
+ eventName: string;
71
+ params?: Record<string, string>;
72
+ }
73
+ type EventPayload<T extends MessageType> = T extends EventType.GET_CONTACTS_AUTO_SUGGEST ? string : T extends ClientEventType.CONTACTS_AUTO_SUGGEST ? IPayloadAutoSuggestResult : T extends ClientEventType.CONTACT_LOOKUP_AND_MATCH ? IPayloadContactMatchResult : T extends ClientEventType.CONTACT_LOOKUP_AND_MATCH_NOT_FOUND ? IPayloadContactMatchResultNotFound : T extends ClientEventType.CONTACT_CREATE_OR_UPDATE ? IPayloadContactMatchResult : T extends ClientEventType.CONTEXT ? IPayloadContextResult : T extends ClientEventType.CURRENT_CONTACT ? IPayloadContactResult : T extends EventType.ADD_CALL ? IPayloadCallStartedInfo : T extends ClientEventType.START_CALL ? IPayloadCallStart : T extends ClientEventType.READY ? IPayloadVersion : T extends ClientEventType.VIEW_PORT ? IPayloadViewPort : T extends ClientEventType.THEME ? IPayloadThemeChange : T extends EventType.USE_THEME ? IPayloadThemeChange : T extends ClientEventType.TOAST ? IPayloadToast : T extends ClientEventType.SEND_ANALYTICS ? IPayloadSendAnalytics : T extends EventType.PBX_TOKEN ? string : T extends ClientEventType.TOKEN ? string : T extends ClientEventType.TO_CLIPBOARD ? string : never;
70
74
  export type Message<T extends MessageType = MessageType> = {
71
75
  type: T;
72
76
  payload?: EventPayload<T>;
@@ -245,5 +249,8 @@ export interface ConnectClient {
245
249
  /**
246
250
  * starts listen on logout event and send event to the xbees about logout able */
247
251
  onLogout: (callback: Callback<EventType.LOGOUT>) => RemoveEventListener;
252
+ /**
253
+ * send analytics data to xbees for track into analytics data */
254
+ sendAnalytics: (eventName: string, params?: Record<string, string>) => void;
248
255
  }
249
256
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildix/xbees-connect",
3
- "version": "1.1.11",
3
+ "version": "1.1.13",
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": "106c5ae830969189ce148276124aca70c8be3325"
45
+ "gitHead": "f61ad8eeaa80bcaf32fb3a897c1aeca47d09ba9a"
46
46
  }