@wildix/xbees-connect 1.1.6 → 1.1.8
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.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": "",
|
package/dist-es/src/Client.js
CHANGED
|
@@ -111,6 +111,9 @@ export class Client {
|
|
|
111
111
|
isPlatformWeb() {
|
|
112
112
|
return !this.isParentReactNativeWebView;
|
|
113
113
|
}
|
|
114
|
+
isOpenedFromXBees() {
|
|
115
|
+
return this.isParentReactNativeWebView || (!!parent && parent !== window);
|
|
116
|
+
}
|
|
114
117
|
getUserPbxToken() {
|
|
115
118
|
return this.userToken;
|
|
116
119
|
}
|
|
@@ -226,6 +229,9 @@ export class Client {
|
|
|
226
229
|
onPbxTokenChange(callback) {
|
|
227
230
|
return this.addEventListener(EventType.PBX_TOKEN, callback);
|
|
228
231
|
}
|
|
232
|
+
getXBeesToken() {
|
|
233
|
+
return this.sendAsync({ type: ClientEventType.TOKEN });
|
|
234
|
+
}
|
|
229
235
|
onSuggestContacts(callback) {
|
|
230
236
|
return this.addEventListener(EventType.GET_CONTACTS_AUTO_SUGGEST, (query) => {
|
|
231
237
|
const resolve = (contacts) => this.sendAsync({
|
|
@@ -257,6 +263,10 @@ export class Client {
|
|
|
257
263
|
});
|
|
258
264
|
const reject = (reason) => {
|
|
259
265
|
console.debug(reason);
|
|
266
|
+
void this.sendAsync({
|
|
267
|
+
type: ClientEventType.CONTACT_LOOKUP_AND_MATCH_NOT_FOUND,
|
|
268
|
+
payload: { query },
|
|
269
|
+
});
|
|
260
270
|
};
|
|
261
271
|
try {
|
|
262
272
|
callback(query, resolve, reject);
|
|
@@ -22,8 +22,10 @@ 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";
|
|
28
|
+
ClientEventType["CONTACT_LOOKUP_AND_MATCH_NOT_FOUND"] = "xBeesContactLookupAndMatchNotFound";
|
|
27
29
|
ClientEventType["CONTACT_CREATE_OR_UPDATE"] = "xBeesContactCreateOrUpdate";
|
|
28
30
|
})(ClientEventType || (ClientEventType = {}));
|
|
29
31
|
export var DeprecatedUrlParams;
|
|
@@ -27,6 +27,7 @@ export declare class Client implements ConnectClient {
|
|
|
27
27
|
version(): string;
|
|
28
28
|
isPlatformNative(): boolean;
|
|
29
29
|
isPlatformWeb(): boolean;
|
|
30
|
+
isOpenedFromXBees(): boolean;
|
|
30
31
|
getUserPbxToken(): string;
|
|
31
32
|
getUserEmail(): string;
|
|
32
33
|
getReferrer(): string;
|
|
@@ -56,6 +57,7 @@ export declare class Client implements ConnectClient {
|
|
|
56
57
|
onCallEnded(callback: Callback<EventType.TERMINATE_CALL>): RemoveEventListener;
|
|
57
58
|
onCallStarted(callback: Callback<EventType.ADD_CALL>): RemoveEventListener;
|
|
58
59
|
onPbxTokenChange(callback: Callback<EventType.PBX_TOKEN>): RemoveEventListener;
|
|
60
|
+
getXBeesToken(): Promise<Message<ClientEventType.TOKEN>>;
|
|
59
61
|
onSuggestContacts(callback: (query: string, resolve: SuggestContactsResolver, reject: Reject) => void): RemoveEventListener;
|
|
60
62
|
onLookupAndMatchContact(callback: (query: ContactQuery, resolve: LookupAndMatchContactsResolver, reject: Reject) => void): RemoveEventListener;
|
|
61
63
|
onThemeChange(callback: Callback<EventType.USE_THEME>): RemoveEventListener;
|
|
@@ -20,8 +20,10 @@ 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",
|
|
26
|
+
CONTACT_LOOKUP_AND_MATCH_NOT_FOUND = "xBeesContactLookupAndMatchNotFound",
|
|
25
27
|
CONTACT_CREATE_OR_UPDATE = "xBeesContactCreateOrUpdate"
|
|
26
28
|
}
|
|
27
29
|
export declare enum DeprecatedUrlParams {
|
|
@@ -58,12 +58,15 @@ export interface IPayloadContactMatchResult {
|
|
|
58
58
|
contact: Contact;
|
|
59
59
|
query: ContactQuery;
|
|
60
60
|
}
|
|
61
|
+
export interface IPayloadContactMatchResultNotFound {
|
|
62
|
+
query: ContactQuery;
|
|
63
|
+
}
|
|
61
64
|
export interface IPayloadContactResult {
|
|
62
65
|
contact: Contact;
|
|
63
66
|
}
|
|
64
67
|
export interface IPayloadContextResult extends IPayloadContactResult {
|
|
65
68
|
}
|
|
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;
|
|
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;
|
|
67
70
|
export type Message<T extends MessageType = MessageType> = {
|
|
68
71
|
type: T;
|
|
69
72
|
payload?: EventPayload<T>;
|
|
@@ -134,6 +137,9 @@ export interface ConnectClient {
|
|
|
134
137
|
/**
|
|
135
138
|
* Determines x-bees is running on web browser platform */
|
|
136
139
|
isPlatformWeb: () => boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Determines application is opened as x-bees child in Browser iFrame or Native WebView */
|
|
142
|
+
isOpenedFromXBees: () => boolean;
|
|
137
143
|
/**
|
|
138
144
|
* Determines x-bees is using this connect for messages only and this integration will not be shown on UI */
|
|
139
145
|
isDataOnly: () => boolean;
|
|
@@ -203,6 +209,9 @@ export interface ConnectClient {
|
|
|
203
209
|
/**
|
|
204
210
|
* Starts listen for the events of changing pbx token and handle with the provided callback */
|
|
205
211
|
onPbxTokenChange: (callback: Callback<EventType.PBX_TOKEN>) => RemoveEventListener;
|
|
212
|
+
/**
|
|
213
|
+
* Retrieves current x-bees token */
|
|
214
|
+
getXBeesToken: () => Promise<Message<ClientEventType.TOKEN>>;
|
|
206
215
|
/**
|
|
207
216
|
* Starts listen for the events of searching contacts and handle autosuggestion with the provided callback */
|
|
208
217
|
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.
|
|
3
|
+
"version": "1.1.8",
|
|
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": "8d88b055be175fb25e9e1f6cb1d4ce3878013564"
|
|
46
46
|
}
|