@wildix/xbees-connect 1.1.6 → 1.1.7

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.5",
3
+ "version": "1.1.6",
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": "",
@@ -226,6 +226,9 @@ export class Client {
226
226
  onPbxTokenChange(callback) {
227
227
  return this.addEventListener(EventType.PBX_TOKEN, callback);
228
228
  }
229
+ getXBeesToken() {
230
+ return this.sendAsync({ type: ClientEventType.TOKEN });
231
+ }
229
232
  onSuggestContacts(callback) {
230
233
  return this.addEventListener(EventType.GET_CONTACTS_AUTO_SUGGEST, (query) => {
231
234
  const resolve = (contacts) => this.sendAsync({
@@ -22,6 +22,7 @@ export var ClientEventType;
22
22
  ClientEventType["TOAST"] = "xBeesShowToast";
23
23
  ClientEventType["NOT_AUTHORIZED"] = "xBeesNotAuthorized";
24
24
  ClientEventType["AUTHORIZED"] = "xBeesAuthorized";
25
+ ClientEventType["TOKEN"] = "xBeesToken";
25
26
  ClientEventType["CONTACTS_AUTO_SUGGEST"] = "xBeesContactsAutoSuggest";
26
27
  ClientEventType["CONTACT_LOOKUP_AND_MATCH"] = "xBeesContactLookupAndMatch";
27
28
  ClientEventType["CONTACT_CREATE_OR_UPDATE"] = "xBeesContactCreateOrUpdate";
@@ -56,6 +56,7 @@ export declare class Client implements ConnectClient {
56
56
  onCallEnded(callback: Callback<EventType.TERMINATE_CALL>): RemoveEventListener;
57
57
  onCallStarted(callback: Callback<EventType.ADD_CALL>): RemoveEventListener;
58
58
  onPbxTokenChange(callback: Callback<EventType.PBX_TOKEN>): RemoveEventListener;
59
+ getXBeesToken(): Promise<Message<ClientEventType.TOKEN>>;
59
60
  onSuggestContacts(callback: (query: string, resolve: SuggestContactsResolver, reject: Reject) => void): RemoveEventListener;
60
61
  onLookupAndMatchContact(callback: (query: ContactQuery, resolve: LookupAndMatchContactsResolver, reject: Reject) => void): RemoveEventListener;
61
62
  onThemeChange(callback: Callback<EventType.USE_THEME>): RemoveEventListener;
@@ -20,6 +20,7 @@ export declare enum ClientEventType {
20
20
  TOAST = "xBeesShowToast",
21
21
  NOT_AUTHORIZED = "xBeesNotAuthorized",
22
22
  AUTHORIZED = "xBeesAuthorized",
23
+ TOKEN = "xBeesToken",
23
24
  CONTACTS_AUTO_SUGGEST = "xBeesContactsAutoSuggest",
24
25
  CONTACT_LOOKUP_AND_MATCH = "xBeesContactLookupAndMatch",
25
26
  CONTACT_CREATE_OR_UPDATE = "xBeesContactCreateOrUpdate"
@@ -63,7 +63,7 @@ export interface IPayloadContactResult {
63
63
  }
64
64
  export interface IPayloadContextResult extends IPayloadContactResult {
65
65
  }
66
- 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_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.TO_CLIPBOARD ? string : never;
66
+ 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_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;
67
67
  export type Message<T extends MessageType = MessageType> = {
68
68
  type: T;
69
69
  payload?: EventPayload<T>;
@@ -203,6 +203,9 @@ export interface ConnectClient {
203
203
  /**
204
204
  * Starts listen for the events of changing pbx token and handle with the provided callback */
205
205
  onPbxTokenChange: (callback: Callback<EventType.PBX_TOKEN>) => RemoveEventListener;
206
+ /**
207
+ * Retrieves current x-bees token */
208
+ getXBeesToken: () => Promise<Message<ClientEventType.TOKEN>>;
206
209
  /**
207
210
  * Starts listen for the events of searching contacts and handle autosuggestion with the provided callback */
208
211
  onSuggestContacts: (callback: (query: string, resolve: SuggestContactsResolver, reject: Reject) => void) => RemoveEventListener;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildix/xbees-connect",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
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": "1374b364b1fe0c035ffd6e8dbb040cca28088edf"
45
+ "gitHead": "0f4783eaf917b09c70b65745fc2a264331d4c721"
46
46
  }