@wildix/xbees-connect 1.1.8 → 1.1.12
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.9",
|
|
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
|
@@ -291,4 +291,20 @@ export class Client {
|
|
|
291
291
|
onStorage(listener) {
|
|
292
292
|
return this.localStorageManager.onStorage(listener);
|
|
293
293
|
}
|
|
294
|
+
onLogout(callback) {
|
|
295
|
+
// send event to x-bees
|
|
296
|
+
void this.sendAsync({
|
|
297
|
+
type: ClientEventType.LOGOUT_IS_SUPPORTED,
|
|
298
|
+
});
|
|
299
|
+
return this.addEventListener(EventType.LOGOUT, callback);
|
|
300
|
+
}
|
|
301
|
+
sendAnalytics(eventName, params) {
|
|
302
|
+
void this.sendAsync({
|
|
303
|
+
type: ClientEventType.SEND_ANALYTICS,
|
|
304
|
+
payload: {
|
|
305
|
+
eventName,
|
|
306
|
+
params,
|
|
307
|
+
},
|
|
308
|
+
});
|
|
309
|
+
}
|
|
294
310
|
}
|
|
@@ -7,6 +7,7 @@ export var EventType;
|
|
|
7
7
|
EventType["USE_THEME"] = "xBeesUseTheme";
|
|
8
8
|
EventType["PBX_TOKEN"] = "xBeesPbxToken";
|
|
9
9
|
EventType["REDIRECT_QUERY"] = "xBeesRedirectQuery";
|
|
10
|
+
EventType["LOGOUT"] = "xBeesLogout";
|
|
10
11
|
})(EventType || (EventType = {}));
|
|
11
12
|
export var ClientEventType;
|
|
12
13
|
(function (ClientEventType) {
|
|
@@ -27,6 +28,8 @@ export var ClientEventType;
|
|
|
27
28
|
ClientEventType["CONTACT_LOOKUP_AND_MATCH"] = "xBeesContactLookupAndMatch";
|
|
28
29
|
ClientEventType["CONTACT_LOOKUP_AND_MATCH_NOT_FOUND"] = "xBeesContactLookupAndMatchNotFound";
|
|
29
30
|
ClientEventType["CONTACT_CREATE_OR_UPDATE"] = "xBeesContactCreateOrUpdate";
|
|
31
|
+
ClientEventType["LOGOUT_IS_SUPPORTED"] = "xBeesLogoutIsSupported";
|
|
32
|
+
ClientEventType["SEND_ANALYTICS"] = "xBeesSendAnalytics";
|
|
30
33
|
})(ClientEventType || (ClientEventType = {}));
|
|
31
34
|
export var DeprecatedUrlParams;
|
|
32
35
|
(function (DeprecatedUrlParams) {
|
|
@@ -65,4 +65,6 @@ export declare class Client implements ConnectClient {
|
|
|
65
65
|
saveToStorage<SavingType>(key: string, value: SavingType): void;
|
|
66
66
|
deleteFromStorage(key: string): void;
|
|
67
67
|
onStorage(listener: StorageEventCallback): () => void;
|
|
68
|
+
onLogout(callback: Callback<EventType.LOGOUT>): RemoveEventListener;
|
|
69
|
+
sendAnalytics(eventName: string, params?: Record<string, string>): void;
|
|
68
70
|
}
|
|
@@ -5,7 +5,8 @@ export declare enum EventType {
|
|
|
5
5
|
TERMINATE_CALL = "xBeesTerminateCall",
|
|
6
6
|
USE_THEME = "xBeesUseTheme",
|
|
7
7
|
PBX_TOKEN = "xBeesPbxToken",
|
|
8
|
-
REDIRECT_QUERY = "xBeesRedirectQuery"
|
|
8
|
+
REDIRECT_QUERY = "xBeesRedirectQuery",
|
|
9
|
+
LOGOUT = "xBeesLogout"
|
|
9
10
|
}
|
|
10
11
|
export declare enum ClientEventType {
|
|
11
12
|
READY = "xBeesReady",
|
|
@@ -24,7 +25,9 @@ export declare enum ClientEventType {
|
|
|
24
25
|
CONTACTS_AUTO_SUGGEST = "xBeesContactsAutoSuggest",
|
|
25
26
|
CONTACT_LOOKUP_AND_MATCH = "xBeesContactLookupAndMatch",
|
|
26
27
|
CONTACT_LOOKUP_AND_MATCH_NOT_FOUND = "xBeesContactLookupAndMatchNotFound",
|
|
27
|
-
CONTACT_CREATE_OR_UPDATE = "xBeesContactCreateOrUpdate"
|
|
28
|
+
CONTACT_CREATE_OR_UPDATE = "xBeesContactCreateOrUpdate",
|
|
29
|
+
LOGOUT_IS_SUPPORTED = "xBeesLogoutIsSupported",
|
|
30
|
+
SEND_ANALYTICS = "xBeesSendAnalytics"
|
|
28
31
|
}
|
|
29
32
|
export declare enum DeprecatedUrlParams {
|
|
30
33
|
TOKEN = "token",
|
|
@@ -66,7 +66,11 @@ export interface IPayloadContactResult {
|
|
|
66
66
|
}
|
|
67
67
|
export interface IPayloadContextResult extends IPayloadContactResult {
|
|
68
68
|
}
|
|
69
|
-
|
|
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>;
|
|
@@ -242,5 +246,11 @@ export interface ConnectClient {
|
|
|
242
246
|
/**
|
|
243
247
|
* listens on localStorage */
|
|
244
248
|
onStorage: (listener: StorageEventCallback) => () => void;
|
|
249
|
+
/**
|
|
250
|
+
* starts listen on logout event and send event to the xbees about logout able */
|
|
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;
|
|
245
255
|
}
|
|
246
256
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildix/xbees-connect",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.12",
|
|
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": "1a59bfec423258c28f82805d2c5719a9e3b1ea76"
|
|
46
46
|
}
|