@wildix/xbees-connect 1.1.12 → 1.1.14

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildix/xbees-connect",
3
- "version": "1.1.9",
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": "",
@@ -147,6 +147,9 @@ export class Client {
147
147
  getCurrentContact() {
148
148
  return this.sendAsync({ type: ClientEventType.CURRENT_CONTACT });
149
149
  }
150
+ getCurrentConversation() {
151
+ return this.sendAsync({ type: ClientEventType.CURRENT_CONVERSATION });
152
+ }
150
153
  contactUpdated(query, contact) {
151
154
  return this.sendAsync({ type: ClientEventType.CONTACT_CREATE_OR_UPDATE, payload: { query, contact } });
152
155
  }
@@ -14,6 +14,7 @@ export var ClientEventType;
14
14
  ClientEventType["READY"] = "xBeesReady";
15
15
  ClientEventType["CONTEXT"] = "xBeesContext";
16
16
  ClientEventType["CURRENT_CONTACT"] = "xBeesCurrentContact";
17
+ ClientEventType["CURRENT_CONVERSATION"] = "xBeesCurrentConversation";
17
18
  ClientEventType["THEME_MODE"] = "xBeesThemeMode";
18
19
  ClientEventType["THEME"] = "xBeesTheme";
19
20
  ClientEventType["START_CALL"] = "xBeesStartCall";
@@ -38,6 +38,7 @@ export declare class Client implements ConnectClient {
38
38
  isActivationOnly(): boolean;
39
39
  getContext(): Promise<Message<ClientEventType.CONTEXT>>;
40
40
  getCurrentContact(): Promise<Message<ClientEventType.CURRENT_CONTACT>>;
41
+ getCurrentConversation(): Promise<Message<ClientEventType.CURRENT_CONVERSATION>>;
41
42
  contactUpdated(query: ContactQuery, contact: Contact): Promise<Message<ClientEventType.CONTACT_CREATE_OR_UPDATE>>;
42
43
  getThemeMode(): Promise<Message<ClientEventType.THEME_MODE>>;
43
44
  getTheme(): Promise<Message<ClientEventType.THEME>>;
@@ -12,6 +12,7 @@ export declare enum ClientEventType {
12
12
  READY = "xBeesReady",
13
13
  CONTEXT = "xBeesContext",
14
14
  CURRENT_CONTACT = "xBeesCurrentContact",
15
+ CURRENT_CONVERSATION = "xBeesCurrentConversation",
15
16
  THEME_MODE = "xBeesThemeMode",
16
17
  THEME = "xBeesTheme",
17
18
  START_CALL = "xBeesStartCall",
@@ -18,6 +18,10 @@ export type Contact = (ContactShape & {
18
18
  }) | (ContactShape & {
19
19
  phone: string;
20
20
  });
21
+ export type Conversation = {
22
+ id: string;
23
+ type: string;
24
+ };
21
25
  export type ContactQuery = {
22
26
  id?: string;
23
27
  email?: string;
@@ -64,13 +68,16 @@ export interface IPayloadContactMatchResultNotFound {
64
68
  export interface IPayloadContactResult {
65
69
  contact: Contact;
66
70
  }
67
- export interface IPayloadContextResult extends IPayloadContactResult {
71
+ export interface IPayloadConversationResult {
72
+ conversation?: Conversation;
73
+ }
74
+ export interface IPayloadContextResult extends IPayloadContactResult, IPayloadConversationResult {
68
75
  }
69
76
  export interface IPayloadSendAnalytics {
70
77
  eventName: string;
71
78
  params?: Record<string, string>;
72
79
  }
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;
80
+ 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 ClientEventType.CURRENT_CONVERSATION ? IPayloadConversationResult : 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;
74
81
  export type Message<T extends MessageType = MessageType> = {
75
82
  type: T;
76
83
  payload?: EventPayload<T>;
@@ -165,6 +172,9 @@ export interface ConnectClient {
165
172
  /**
166
173
  * Retrieves current opened in x-bees contact data */
167
174
  getCurrentContact: () => Promise<Message<ClientEventType.CURRENT_CONTACT>>;
175
+ /**
176
+ * Retrieves current opened in x-bees conversation data or undefined if the conversation is temporary */
177
+ getCurrentConversation: () => Promise<Message<ClientEventType.CURRENT_CONVERSATION>>;
168
178
  /**
169
179
  * Sends notification to x-bees about contact data updated */
170
180
  contactUpdated(query: ContactQuery, contact: Contact): Promise<Message<ClientEventType.CONTACT_CREATE_OR_UPDATE>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildix/xbees-connect",
3
- "version": "1.1.12",
3
+ "version": "1.1.14",
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": "1a59bfec423258c28f82805d2c5719a9e3b1ea76"
45
+ "gitHead": "4f72ef6a17809a221be833a0a3da7c68f5d5ef14"
46
46
  }