@wildix/xbees-connect 1.1.4-y.0 → 1.1.4
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.4-y.0",
|
|
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
|
@@ -207,14 +207,17 @@ export class Client {
|
|
|
207
207
|
this.localStorageManager.removeOnStorage(callback);
|
|
208
208
|
this.removeEventListener(null, callback);
|
|
209
209
|
}
|
|
210
|
+
onRedirectQuery(callback) {
|
|
211
|
+
return this.addEventListener(EventType.REDIRECT_QUERY, callback);
|
|
212
|
+
}
|
|
210
213
|
onCallEnded(callback) {
|
|
211
|
-
this.addEventListener(EventType.TERMINATE_CALL, callback);
|
|
214
|
+
return this.addEventListener(EventType.TERMINATE_CALL, callback);
|
|
212
215
|
}
|
|
213
216
|
onCallStarted(callback) {
|
|
214
|
-
this.addEventListener(EventType.ADD_CALL, callback);
|
|
217
|
+
return this.addEventListener(EventType.ADD_CALL, callback);
|
|
215
218
|
}
|
|
216
219
|
onPbxTokenChange(callback) {
|
|
217
|
-
this.addEventListener(EventType.PBX_TOKEN, callback);
|
|
220
|
+
return this.addEventListener(EventType.PBX_TOKEN, callback);
|
|
218
221
|
}
|
|
219
222
|
onSuggestContacts(callback) {
|
|
220
223
|
return this.addEventListener(EventType.GET_CONTACTS_AUTO_SUGGEST, (query) => {
|
|
@@ -257,7 +260,7 @@ export class Client {
|
|
|
257
260
|
});
|
|
258
261
|
}
|
|
259
262
|
onThemeChange(callback) {
|
|
260
|
-
this.addEventListener(EventType.USE_THEME, callback);
|
|
263
|
+
return this.addEventListener(EventType.USE_THEME, callback);
|
|
261
264
|
}
|
|
262
265
|
getFromStorage(key) {
|
|
263
266
|
return this.localStorageManager.retrieve(key);
|
|
@@ -6,6 +6,7 @@ export var EventType;
|
|
|
6
6
|
EventType["TERMINATE_CALL"] = "xBeesTerminateCall";
|
|
7
7
|
EventType["USE_THEME"] = "xBeesUseTheme";
|
|
8
8
|
EventType["PBX_TOKEN"] = "xBeesPbxToken";
|
|
9
|
+
EventType["REDIRECT_QUERY"] = "xBeesRedirectQuery";
|
|
9
10
|
})(EventType || (EventType = {}));
|
|
10
11
|
export var ClientEventType;
|
|
11
12
|
(function (ClientEventType) {
|
|
@@ -51,12 +51,13 @@ export declare class Client implements ConnectClient {
|
|
|
51
51
|
addEventListener<T extends EventType = EventType>(eventName: T, callback: Callback<T>): RemoveEventListener;
|
|
52
52
|
removeEventListener<T extends EventType = EventType>(eventName: T | null, callback: Callback<T>): void;
|
|
53
53
|
off(callback: Callback | StorageEventCallback): void;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
onRedirectQuery(callback: Callback<EventType.REDIRECT_QUERY>): RemoveEventListener;
|
|
55
|
+
onCallEnded(callback: Callback<EventType.TERMINATE_CALL>): RemoveEventListener;
|
|
56
|
+
onCallStarted(callback: Callback<EventType.ADD_CALL>): RemoveEventListener;
|
|
57
|
+
onPbxTokenChange(callback: Callback<EventType.PBX_TOKEN>): RemoveEventListener;
|
|
57
58
|
onSuggestContacts(callback: (query: string, resolve: SuggestContactsResolver, reject: Reject) => void): RemoveEventListener;
|
|
58
59
|
onLookupAndMatchContact(callback: (query: ContactQuery, resolve: LookupAndMatchContactsResolver, reject: Reject) => void): RemoveEventListener;
|
|
59
|
-
onThemeChange(callback: Callback<EventType.USE_THEME>):
|
|
60
|
+
onThemeChange(callback: Callback<EventType.USE_THEME>): RemoveEventListener;
|
|
60
61
|
getFromStorage<Type>(key: string): Type | null;
|
|
61
62
|
saveToStorage<SavingType>(key: string, value: SavingType): void;
|
|
62
63
|
deleteFromStorage(key: string): void;
|
|
@@ -4,7 +4,8 @@ export declare enum EventType {
|
|
|
4
4
|
ADD_CALL = "xBeesAddCall",
|
|
5
5
|
TERMINATE_CALL = "xBeesTerminateCall",
|
|
6
6
|
USE_THEME = "xBeesUseTheme",
|
|
7
|
-
PBX_TOKEN = "xBeesPbxToken"
|
|
7
|
+
PBX_TOKEN = "xBeesPbxToken",
|
|
8
|
+
REDIRECT_QUERY = "xBeesRedirectQuery"
|
|
8
9
|
}
|
|
9
10
|
export declare enum ClientEventType {
|
|
10
11
|
READY = "xBeesReady",
|
|
@@ -77,6 +77,7 @@ export type EventPayloadMap = {
|
|
|
77
77
|
[EventType.ADD_CALL]: IPayloadCallStartedInfo;
|
|
78
78
|
[EventType.USE_THEME]: IPayloadThemeChange;
|
|
79
79
|
[EventType.PBX_TOKEN]: string;
|
|
80
|
+
[EventType.REDIRECT_QUERY]: string;
|
|
80
81
|
};
|
|
81
82
|
export type EventCallbackMap = {
|
|
82
83
|
[EventType.GET_CONTACTS_AUTO_SUGGEST]: (query: EventPayloadMap[EventType.GET_CONTACTS_AUTO_SUGGEST]) => void;
|
|
@@ -84,6 +85,7 @@ export type EventCallbackMap = {
|
|
|
84
85
|
[EventType.ADD_CALL]: (callStartInfo: EventPayloadMap[EventType.ADD_CALL]) => void;
|
|
85
86
|
[EventType.USE_THEME]: (theme: EventPayloadMap[EventType.USE_THEME]) => void;
|
|
86
87
|
[EventType.PBX_TOKEN]: (token: EventPayloadMap[EventType.PBX_TOKEN]) => void;
|
|
88
|
+
[EventType.REDIRECT_QUERY]: (query: EventPayloadMap[EventType.REDIRECT_QUERY]) => void;
|
|
87
89
|
};
|
|
88
90
|
export type StorageEventCallback = (event: StorageEvent) => void;
|
|
89
91
|
export type Callback<T extends EventType = EventType> = T extends keyof EventCallbackMap ? EventCallbackMap[T] : DefaultCallback;
|
|
@@ -187,10 +189,10 @@ export interface ConnectClient {
|
|
|
187
189
|
removeEventListener: <T extends EventType = EventType>(eventName: T, callback: Callback<T>) => void;
|
|
188
190
|
/**
|
|
189
191
|
* Starts listen for the events of changing theme and handle with the provided callback */
|
|
190
|
-
onThemeChange: (callback: Callback<EventType.USE_THEME>) =>
|
|
192
|
+
onThemeChange: (callback: Callback<EventType.USE_THEME>) => RemoveEventListener;
|
|
191
193
|
/**
|
|
192
194
|
* Starts listen for the events of changing pbx token and handle with the provided callback */
|
|
193
|
-
onPbxTokenChange: (callback: Callback<EventType.PBX_TOKEN>) =>
|
|
195
|
+
onPbxTokenChange: (callback: Callback<EventType.PBX_TOKEN>) => RemoveEventListener;
|
|
194
196
|
/**
|
|
195
197
|
* Starts listen for the events of searching contacts and handle autosuggestion with the provided callback */
|
|
196
198
|
onSuggestContacts: (callback: (query: string, resolve: SuggestContactsResolver, reject: Reject) => void) => RemoveEventListener;
|
|
@@ -199,10 +201,13 @@ export interface ConnectClient {
|
|
|
199
201
|
onLookupAndMatchContact: (callback: (query: ContactQuery, resolve: LookupAndMatchContactsResolver, reject: Reject) => void) => RemoveEventListener;
|
|
200
202
|
/**
|
|
201
203
|
* Starts listen for the events of starting the call and handle with the provided callback */
|
|
202
|
-
onCallStarted: (callback: Callback<EventType.ADD_CALL>) =>
|
|
204
|
+
onCallStarted: (callback: Callback<EventType.ADD_CALL>) => RemoveEventListener;
|
|
203
205
|
/**
|
|
204
206
|
* Starts listen for the events of ending the call and handle with the provided callback */
|
|
205
|
-
onCallEnded: (callback: Callback<EventType.TERMINATE_CALL>) =>
|
|
207
|
+
onCallEnded: (callback: Callback<EventType.TERMINATE_CALL>) => RemoveEventListener;
|
|
208
|
+
/**
|
|
209
|
+
* Starts listen for redirect query message which fires when user opens app with deeplink to integration */
|
|
210
|
+
onRedirectQuery: (callback: Callback<EventType.REDIRECT_QUERY>) => RemoveEventListener;
|
|
206
211
|
/**
|
|
207
212
|
* Removes particular callback from handling events */
|
|
208
213
|
off: (callback: Callback | StorageEventCallback) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildix/xbees-connect",
|
|
3
|
-
"version": "1.1.4
|
|
3
|
+
"version": "1.1.4",
|
|
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": "485f83d2aa614de28b039aaa7c3bc788e10cbbb9"
|
|
46
46
|
}
|